zot/internal/agent
patriceckhart e48f4dda76 feat: runtime cwd switching via hidden /cd and extension submit_slash
Adds the plumbing needed to let an extension jump the running zot
session into a different working directory without restarting the
process. Two pieces:

1) Hidden /cd <path> slash command

   * accepts ~/abs/relative paths, validates the target is a real
     directory
   * cancels the active turn, flushes + closes the current session
   * re-roots the shared sandbox (the /jail state is preserved
     verbatim - if jailed it stays jailed, just pointed at the new
     cwd)
   * rebuilds the agent via the existing buildAgent() so tools,
     AGENTS.md addendum, system prompt, and sessions dir all bind
     to the new cwd
   * opens a fresh session in the new cwd's bucket (matches the
     semantics of relaunching with zot --cwd <path>)
   * pushes the new state into the running Interactive via a new
     ApplyChangedCWD method and re-scopes the swarm dashboard

   /cd is not in slash_suggest's catalog, not in /help, not in the
   README. It's in a new hiddenSlashCommands list so the dispatcher
   accepts it without surfacing the verb to autocomplete. The
   slashCancelsTurn switch returns true for /cd so it never races
   with a streaming turn.

   InteractiveConfig.ChangeCWD is the optional host hook; embedders
   that don't wire it surface 'host did not wire ChangeCWD' instead
   of no-oping.

2) submit_slash extension protocol frame

   Extensions can now send a spontaneous {type:'submit_slash',
   text:'/...'} frame from any handler (notably panel_key) to run
   a slash command in the host TUI as if the user had typed it.
   The host refuses anything that doesn't start with '/' and logs
   the refusal to the extension's stderr log file, so a misbehaving
   extension can't sneak a plain-text model prompt through this
   path.

   HostHooks gains a SubmitSlash(text string) method; the three
   existing implementers (interactive, non-interactive, rpc) and
   the test stub now satisfy it. Only the interactive hook does
   anything; the rest no-op since slash commands aren't meaningful
   outside the TUI.

   Interactive.SubmitSlash routes the text through runSlash with
   the same cancel-active-turn-if-destructive treatment the editor
   uses for typed commands.

The workspaces extension drives this end-to-end: pressing Enter on
a row sends panel_close + submit_slash '/cd <abs>', which jumps
zot into that directory in place.
2026-05-19 19:38:47 +02:00
..
extensions feat: runtime cwd switching via hidden /cd and extension submit_slash 2026-05-19 19:38:47 +02:00
modes feat: runtime cwd switching via hidden /cd and extension submit_slash 2026-05-19 19:38:47 +02:00
tools telegram: let zot send images and files back through the bridge 2026-04-28 08:23:04 +02:00
args.go swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope 2026-05-16 11:53:20 +02:00
botcmd.go Improve Telegram status and stop commands 2026-05-07 19:05:57 +02:00
botcmd_unix.go fix ci on windows: split detach helper into posix/windows variants 2026-04-18 10:58:10 +02:00
botcmd_windows.go fix ci on windows: split detach helper into posix/windows variants 2026-04-18 10:58:10 +02:00
build.go swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope 2026-05-16 11:53:20 +02:00
build_test.go swarm: introduce /swarm dashboard, /btw-style transcript view, and per-session scope 2026-05-16 11:53:20 +02:00
changelog.go fix(changelog): strip commit/date suffix from version strings 2026-04-25 17:50:35 +02:00
cli.go feat: runtime cwd switching via hidden /cd and extension submit_slash 2026-05-19 19:38:47 +02:00
config.go add deepseek provider (api-key, openai-compatible v4 catalog) 2026-05-10 16:49:31 +02:00
extcmd.go feat: extension system (subprocess + json-rpc, any language) 2026-04-19 14:09:43 +02:00
modelsync.go add Google Gemini provider 2026-05-07 21:15:34 +02:00
rpc.go feat: runtime cwd switching via hidden /cd and extension submit_slash 2026-05-19 19:38:47 +02:00
settings_store.go interactive: load resumed sessions asynchronously 2026-05-04 15:47:55 +02:00
swarm_agent.go Format swarm code 2026-05-16 14:01:23 +02:00
swarm_agent_test.go Fix swarm tests on Windows CI 2026-05-16 14:12:03 +02:00
systemprompt.go feat(tui): context diffs + framed tool blocks + paced streaming 2026-04-20 15:50:39 +02:00
update.go fix(update): re-check every launch when the cache says up-to-date 2026-04-20 18:31:51 +02:00
updatecmd.go agent: add 'zot update' subcommand for in-place self-update 2026-05-12 21:27:11 +02:00