feat(claude): respawn panes on account set/unset + safe --purge (T-480 part 2)
The extension consumer for the per-repo account verbs, making set/unset fully functional. The Claude extension subscribes to accountActionChannel: - set / unset → ClaudeSessionOrchestrator.respawnForWorkspace(cwd): closes the workspace's solo sessions (awaiting real process death, T-437) and re-spawns each on the same id with --resume, so the conversation continues under the newly-bound CLAUDE_CONFIG_DIR (resolved at spawn by agentBootstrap). Team and forked sessions are skipped — re-joining the broker / re-forking on an account swap is out of scope; they adopt the account on their next natural spawn. - remove --purge → deletes the config dir behind isPurgeableAccountDir, a strict guard that only ever removes a ~/.claude-* directory that is a direct child of $HOME. The purge payload now carries the dir (the account is gone from the registry by publish time). login still only publishes its action — spawning the `claude login` terminal pane needs argv+env terminal-pane support and is split to T-485. Covered: respawnForWorkspace (respawn solo, skip fork/other-repo) and the purge guard's accept/reject matrix. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -114,13 +114,15 @@ Future<IpcResponse> _dispatch(IpcRequest req, AccountStore? store, MessagePublis
|
||||
|
||||
case 'remove':
|
||||
if (name == null || name.isEmpty) return _err(req.id, 'account remove requires a <name>');
|
||||
if (_byName(store, name) == null) return _err(req.id, 'no such account: "$name"');
|
||||
final removing = _byName(store, name);
|
||||
if (removing == null) return _err(req.id, 'no such account: "$name"');
|
||||
if (store.boundAccountNames().contains(name)) {
|
||||
return _err(req.id, 'account "$name" is bound to a workspace', hint: 'clide claude account unset (in that workspace) first');
|
||||
}
|
||||
await store.remove(name);
|
||||
// The dir delete is IO the extension owns (this handler is Flutter-free).
|
||||
if (purge) publish?.call('cli', accountActionChannel, {'action': 'purge', 'name': name});
|
||||
// Carry the dir in the payload — the account is gone from the registry now.
|
||||
if (purge) publish?.call('cli', accountActionChannel, {'action': 'purge', 'name': name, 'dir': removing.dir});
|
||||
return _ok(req.id, {'removed': name, 'purge': purge});
|
||||
|
||||
case 'set':
|
||||
|
||||
Reference in New Issue
Block a user