bots-garden/sidekickspublic Fork
⑂ 0d0cb37
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

#91 Le journal de l'agent dit quels outils Sidekicks lui propose au démarrage

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-11T01:14:30+01:00 Browse files
0d0cb37 parent: 1ef0bf4
modified docs/en/how-to/use-sidekicks-tools-from-an-agent.md +1 -0
@@ -42,6 +42,7 @@ A model may answer a question it was already asked from its earlier answer inste
4242 ```
4343
4444 then save. The tools are read when an agent starts: a running agent whose tools change shows "restart to apply changes"; restart it. The editor suggests the names after `- `. An unknown name is shown as a warning.
45+- **The agent says it has no such tool**: open its log (**Log** in the status bar). At start, Sidekicks writes `sidekicks: tools offered (meta): about_sidekicks, current_channel, …`, then mm writes `[acp] client tools (meta): client_…` with the tools it took. A tool missing from the first line is left out by `agentTools`; from the second only, mm refused it (its stderr says why). If an older log lacks it, the agent was started before the change: restart it. If the log shows it and the agent still denies it, the model overlooked it: name the tool in its `system:` instructions.
4546 - **Keep an agent to its own channels**: `list_channels` and `search_messages` read every channel and direct conversation, not only the agent's. Leave them out of `offer` if that is not wanted.
4647
4748 - **`discovery: request`**: Sidekicks reads the agent's file (the one after `--config`) to know it, announces the tools only, and gives the list each time the agent opens a session. The file is read on this computer: an agent in a sandbox or a container must have it at the same path, which the assistant's sbx and Docker variants already require.
@@ -42,6 +42,7 @@ A model may answer a question it was already asked from its earlier answer inste
42 ```42 ```
43 43
44 then save. The tools are read when an agent starts: a running agent whose tools change shows "restart to apply changes"; restart it. The editor suggests the names after `- `. An unknown name is shown as a warning.44 then save. The tools are read when an agent starts: a running agent whose tools change shows "restart to apply changes"; restart it. The editor suggests the names after `- `. An unknown name is shown as a warning.
45+- **The agent says it has no such tool**: open its log (**Log** in the status bar). At start, Sidekicks writes `sidekicks: tools offered (meta): about_sidekicks, current_channel, …`, then mm writes `[acp] client tools (meta): client_…` with the tools it took. A tool missing from the first line is left out by `agentTools`; from the second only, mm refused it (its stderr says why). If an older log lacks it, the agent was started before the change: restart it. If the log shows it and the agent still denies it, the model overlooked it: name the tool in its `system:` instructions.
45 - **Keep an agent to its own channels**: `list_channels` and `search_messages` read every channel and direct conversation, not only the agent's. Leave them out of `offer` if that is not wanted.46 - **Keep an agent to its own channels**: `list_channels` and `search_messages` read every channel and direct conversation, not only the agent's. Leave them out of `offer` if that is not wanted.
46 47
47 - **`discovery: request`**: Sidekicks reads the agent's file (the one after `--config`) to know it, announces the tools only, and gives the list each time the agent opens a session. The file is read on this computer: an agent in a sandbox or a container must have it at the same path, which the assistant's sbx and Docker variants already require.48 - **`discovery: request`**: Sidekicks reads the agent's file (the one after `--config`) to know it, announces the tools only, and gives the list each time the agent opens a session. The file is read on this computer: an agent in a sandbox or a container must have it at the same path, which the assistant's sbx and Docker variants already require.
modified docs/en/reference/agents-and-events.md +1 -1
@@ -257,7 +257,7 @@ Only `search_messages` takes parameters; its `inputSchema` says `query` is requi
257257 | a tool's method | answered with `{"content":[{"type":"text","text":"…"}],"isError":false}`; a failure has `isError: true` and says why |
258258 | any other `_…` method | JSON-RPC error `-32601` (Method not found) |
259259
260-With `acp.clientTools.permissions: ask` (or `auto` without `yolo`), mm asks before each call: the permission card shows `client: <name>`.
260+When an agent starts, its log gets `sidekicks: tools offered (meta|request): <names>`, or `sidekicks: no tool offered (agentTools)`. With `acp.clientTools.permissions: ask` (or `auto` without `yolo`), mm asks before each call: the permission card shows `client: <name>`.
261261
262262 ## Stopping an agent
263263
@@ -257,7 +257,7 @@ Only `search_messages` takes parameters; its `inputSchema` says `query` is requi
257 | a tool's method | answered with `{"content":[{"type":"text","text":"…"}],"isError":false}`; a failure has `isError: true` and says why |257 | a tool's method | answered with `{"content":[{"type":"text","text":"…"}],"isError":false}`; a failure has `isError: true` and says why |
258 | any other `_…` method | JSON-RPC error `-32601` (Method not found) |258 | any other `_…` method | JSON-RPC error `-32601` (Method not found) |
259 259
260-With `acp.clientTools.permissions: ask` (or `auto` without `yolo`), mm asks before each call: the permission card shows `client: <name>`.260+When an agent starts, its log gets `sidekicks: tools offered (meta|request): <names>`, or `sidekicks: no tool offered (agentTools)`. With `acp.clientTools.permissions: ask` (or `auto` without `yolo`), mm asks before each call: the permission card shows `client: <name>`.
261 261
262 ## Stopping an agent262 ## Stopping an agent
263 263
modified docs/fr/how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.md +1 -0
@@ -42,6 +42,7 @@ Un modèle peut répondre à une question déjà posée avec sa réponse précé
4242 ```
4343
4444 puis enregistrez. Les outils sont lus au démarrage d'un agent : un agent en marche dont les outils changent affiche « à redémarrer » ; redémarrez-le. L'éditeur propose les noms après `- `. Un nom inconnu s'affiche en avertissement.
45+- **L'agent dit qu'il n'a pas cet outil** : ouvrez son journal (**Log** dans la barre d'état). Au démarrage, Sidekicks écrit `sidekicks: tools offered (meta): about_sidekicks, current_channel, …`, puis mm écrit `[acp] client tools (meta): client_…` avec les outils qu'il a pris. Un outil absent de la première ligne est retiré par `agentTools` ; absent de la seconde seulement, mm l'a refusé (son stderr dit pourquoi). Si l'outil manque dans un journal plus ancien, l'agent a été démarré avant le changement : redémarrez-le. Si le journal le montre et que l'agent le nie quand même, le modèle l'a ignoré : nommez l'outil dans ses instructions `system:`.
4546 - **Cantonner un agent à ses propres channels** : `list_channels` et `search_messages` lisent tous les channels et conversations directes, pas seulement ceux de l'agent. Retirez-les d'`offer` si ce n'est pas souhaité.
4647
4748 - **`discovery: request`** : Sidekicks lit le fichier de l'agent (celui qui suit `--config`) pour le savoir, annonce seulement les outils, et donne la liste à chaque ouverture de session. Le fichier est lu sur cet ordinateur : un agent dans une sandbox ou un conteneur doit l'avoir au même chemin, ce que demandent déjà les variantes sbx et Docker de l'assistant.
@@ -42,6 +42,7 @@ Un modèle peut répondre à une question déjà posée avec sa réponse précé
42 ```42 ```
43 43
44 puis enregistrez. Les outils sont lus au démarrage d'un agent : un agent en marche dont les outils changent affiche « à redémarrer » ; redémarrez-le. L'éditeur propose les noms après `- `. Un nom inconnu s'affiche en avertissement.44 puis enregistrez. Les outils sont lus au démarrage d'un agent : un agent en marche dont les outils changent affiche « à redémarrer » ; redémarrez-le. L'éditeur propose les noms après `- `. Un nom inconnu s'affiche en avertissement.
45+- **L'agent dit qu'il n'a pas cet outil** : ouvrez son journal (**Log** dans la barre d'état). Au démarrage, Sidekicks écrit `sidekicks: tools offered (meta): about_sidekicks, current_channel, …`, puis mm écrit `[acp] client tools (meta): client_…` avec les outils qu'il a pris. Un outil absent de la première ligne est retiré par `agentTools` ; absent de la seconde seulement, mm l'a refusé (son stderr dit pourquoi). Si l'outil manque dans un journal plus ancien, l'agent a été démarré avant le changement : redémarrez-le. Si le journal le montre et que l'agent le nie quand même, le modèle l'a ignoré : nommez l'outil dans ses instructions `system:`.
45 - **Cantonner un agent à ses propres channels** : `list_channels` et `search_messages` lisent tous les channels et conversations directes, pas seulement ceux de l'agent. Retirez-les d'`offer` si ce n'est pas souhaité.46 - **Cantonner un agent à ses propres channels** : `list_channels` et `search_messages` lisent tous les channels et conversations directes, pas seulement ceux de l'agent. Retirez-les d'`offer` si ce n'est pas souhaité.
46 47
47 - **`discovery: request`** : Sidekicks lit le fichier de l'agent (celui qui suit `--config`) pour le savoir, annonce seulement les outils, et donne la liste à chaque ouverture de session. Le fichier est lu sur cet ordinateur : un agent dans une sandbox ou un conteneur doit l'avoir au même chemin, ce que demandent déjà les variantes sbx et Docker de l'assistant.48 - **`discovery: request`** : Sidekicks lit le fichier de l'agent (celui qui suit `--config`) pour le savoir, annonce seulement les outils, et donne la liste à chaque ouverture de session. Le fichier est lu sur cet ordinateur : un agent dans une sandbox ou un conteneur doit l'avoir au même chemin, ce que demandent déjà les variantes sbx et Docker de l'assistant.
modified docs/fr/reference/agents-et-evenements.md +1 -1
@@ -257,7 +257,7 @@ Seul `search_messages` a des paramètres ; son `inputSchema` indique que `query`
257257 | la méthode d'un outil | répond `{"content":[{"type":"text","text":"…"}],"isError":false}` ; un échec a `isError: true` et dit pourquoi |
258258 | toute autre méthode `_…` | erreur JSON-RPC `-32601` (Method not found) |
259259
260-Avec `acp.clientTools.permissions: ask` (ou `auto` sans `yolo`), mm demande avant chaque appel : la carte de permission affiche `client: <nom>`.
260+Au démarrage d'un agent, son journal reçoit `sidekicks: tools offered (meta|request): <noms>`, ou `sidekicks: no tool offered (agentTools)`. Avec `acp.clientTools.permissions: ask` (ou `auto` sans `yolo`), mm demande avant chaque appel : la carte de permission affiche `client: <nom>`.
261261
262262 ## Arrêt d'un agent
263263
@@ -257,7 +257,7 @@ Seul `search_messages` a des paramètres ; son `inputSchema` indique que `query`
257 | la méthode d'un outil | répond `{"content":[{"type":"text","text":"…"}],"isError":false}` ; un échec a `isError: true` et dit pourquoi |257 | la méthode d'un outil | répond `{"content":[{"type":"text","text":"…"}],"isError":false}` ; un échec a `isError: true` et dit pourquoi |
258 | toute autre méthode `_…` | erreur JSON-RPC `-32601` (Method not found) |258 | toute autre méthode `_…` | erreur JSON-RPC `-32601` (Method not found) |
259 259
260-Avec `acp.clientTools.permissions: ask` (ou `auto` sans `yolo`), mm demande avant chaque appel : la carte de permission affiche `client: <nom>`.260+Au démarrage d'un agent, son journal reçoit `sidekicks: tools offered (meta|request): <noms>`, ou `sidekicks: no tool offered (agentTools)`. Avec `acp.clientTools.permissions: ask` (ou `auto` sans `yolo`), mm demande avant chaque appel : la carte de permission affiche `client: <nom>`.
261 261
262 ## Arrêt d'un agent262 ## Arrêt d'un agent
263 263
modified internal/agents/manager.go +17 -0
@@ -311,6 +311,9 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error
311311 spec := m.specFor(definition)
312312 startErr := m.prepare(ctx, a, definition)
313313 if startErr == nil {
314+ if m.options.Tools != nil {
315+ m.log(a, toolsLine(spec))
316+ }
314317 conn, startErr = m.options.Starter(ctx, spec, func(line string) { m.log(a, line) })
315318 }
316319
@@ -586,6 +589,20 @@ func (m *Manager) Reconfigure(ctx context.Context, definitions []config.Agent, m
586589 }
587590 }
588591
592+// toolsLine says in the agent's log which tools Sidekicks offers it, and
593+// how (issue #91): the agent's own log line, when it knows the protocol,
594+// says which ones it took.
595+func toolsLine(spec acp.Spec) string {
596+ if len(spec.Tools) == 0 {
597+ return "sidekicks: no tool offered (agentTools)"
598+ }
599+ discovery := spec.ToolDiscovery
600+ if discovery == "" {
601+ discovery = acp.DiscoveryMeta
602+ }
603+ return fmt.Sprintf("sidekicks: tools offered (%s): %s", discovery, strings.Join(toolNames(spec.Tools), ", "))
604+}
605+
589606 // toolNames are the names of tools, in order.
590607 func toolNames(tools []acp.Tool) []string {
591608 names := []string{}
@@ -311,6 +311,9 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error
311 spec := m.specFor(definition)311 spec := m.specFor(definition)
312 startErr := m.prepare(ctx, a, definition)312 startErr := m.prepare(ctx, a, definition)
313 if startErr == nil {313 if startErr == nil {
314+ if m.options.Tools != nil {
315+ m.log(a, toolsLine(spec))
316+ }
314 conn, startErr = m.options.Starter(ctx, spec, func(line string) { m.log(a, line) })317 conn, startErr = m.options.Starter(ctx, spec, func(line string) { m.log(a, line) })
315 }318 }
316 319
@@ -586,6 +589,20 @@ func (m *Manager) Reconfigure(ctx context.Context, definitions []config.Agent, m
586 }589 }
587 }590 }
588 591
592+// toolsLine says in the agent's log which tools Sidekicks offers it, and
593+// how (issue #91): the agent's own log line, when it knows the protocol,
594+// says which ones it took.
595+func toolsLine(spec acp.Spec) string {
596+ if len(spec.Tools) == 0 {
597+ return "sidekicks: no tool offered (agentTools)"
598+ }
599+ discovery := spec.ToolDiscovery
600+ if discovery == "" {
601+ discovery = acp.DiscoveryMeta
602+ }
603+ return fmt.Sprintf("sidekicks: tools offered (%s): %s", discovery, strings.Join(toolNames(spec.Tools), ", "))
604+}
605+
589 // toolNames are the names of tools, in order.606 // toolNames are the names of tools, in order.
590 func toolNames(tools []acp.Tool) []string {607 func toolNames(tools []acp.Tool) []string {
591 names := []string{}608 names := []string{}
modified internal/agents/manager_test.go +3 -0
@@ -469,6 +469,9 @@ func TestChangingTheToolsOfferedMakesARunningAgentOutdated(t *testing.T) {
469469 Tools: func(config.Agent) []acp.Tool { return offered },
470470 })
471471 _ = f.manager.Start(ctx, "alice")
472+ if logs, _ := f.manager.Logs("alice"); len(logs) == 0 || logs[0] != "sidekicks: tools offered (meta): memory_pressure" {
473+ t.Fatalf("the log says which tools are offered: %q", logs)
474+ }
472475 f.manager.Reconfigure(ctx, definitions("alice", "bob"), maxRunning, 0)
473476 if f.manager.Statuses()[0].Outdated {
474477 t.Fatal("the same tools: nothing to restart")
@@ -469,6 +469,9 @@ func TestChangingTheToolsOfferedMakesARunningAgentOutdated(t *testing.T) {
469 Tools: func(config.Agent) []acp.Tool { return offered },469 Tools: func(config.Agent) []acp.Tool { return offered },
470 })470 })
471 _ = f.manager.Start(ctx, "alice")471 _ = f.manager.Start(ctx, "alice")
472+ if logs, _ := f.manager.Logs("alice"); len(logs) == 0 || logs[0] != "sidekicks: tools offered (meta): memory_pressure" {
473+ t.Fatalf("the log says which tools are offered: %q", logs)
474+ }
472 f.manager.Reconfigure(ctx, definitions("alice", "bob"), maxRunning, 0)475 f.manager.Reconfigure(ctx, definitions("alice", "bob"), maxRunning, 0)
473 if f.manager.Statuses()[0].Outdated {476 if f.manager.Statuses()[0].Outdated {
474 t.Fatal("the same tools: nothing to restart")477 t.Fatal("the same tools: nothing to restart")