1 Commits
Author SHA1 Message Date
David Gageot a4c9f16c2e feat: foundation for hot-reload + /toolset-restart slash command
Lands two complementary pieces of the eventual file-watcher hot-reload:

1) The diff machinery (pkg/teamloader/diff.go) that classifies a
   freshly-loaded latest.Toolset slice against the running one as
   Added / Removed / Changed / Unchanged. ToolsetIdentity gives each
   entry a stable key (Type+Name when named, else Type+ref/cmd/url),
   and ToolsetSignature is a hex SHA-256 over the full Toolset
   JSON so adding new fields automatically participates in change
   detection without further wiring. HasChanges() is a fast-path for
   the future watcher.

2) An immediately-useful capability built on the supervisor: by-name
   restart. Most users hit a 'gopls is stuck' or 'I just OAuth'd this
   MCP and need it to reconnect' moment within minutes of using the
   agent; today they have to restart the whole agent.

   New tools.Restartable interface (Restart(ctx) error). Implemented
   by mcp.Toolset and *builtin.LSPTool, both of which delegate to
   supervisor.RestartAndWait under their respective timeouts.
   Runtime gains RestartToolset(ctx, name); the remote runtime
   refuses with a clear error since toolset lifecycle is server-side
   for that case. App is a thin pass-through.

   TUI: new RestartToolsetMsg, /toolset-restart slash command
   ('/toolset-restart gopls'), and a notification-toast handler that
   surfaces success or the supervisor's error.

Tests:
  * diff_test.go covers no-changes, added-only, removed-only,
    changed-only, mixed (preserves order), identity matching for
    named/unnamed toolsets across mcp/lsp/a2a, and signature
    stability/discrimination.
  * restart_test.go exercises name resolution and Restartable
    dispatch in isolation.

Note on full hot-reload (file watcher + diff-driven apply):
  Wiring the watcher into the agent so that Stop+Start of a single
  toolset works in a live runtime is non-trivial (Agent.toolsets
  needs a snapshot pattern, the tool dispatcher needs to swap
  references atomically, and the runtime loop needs a quiescent
  point). It is intentionally not in this commit. The pieces shipped
  here \u2014 diff machinery + per-toolset restart capability \u2014 are the
  primitives that flow needs and are independently useful.

Assisted-By: docker-agent
2026-04-28 18:23:42 +02:00