Merge feature/m8-divers-ajouts into main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
modified
.memory/history.md +25 -0 | @@ -207,3 +207,28 @@ | ||
| 207 | 207 | - Verified (Linux sandbox): `bash -n`, `check-license-headers.sh`, `package_test.sh`, notes generation of step 03. NOT verified: everything that needs the Mac (codesign, notarytool, wails3, dmg), and the Rickub API/upload steps. Nothing committed. |
| 208 | 208 | - Follow-up (owner: LSMinimumSystemVersion should be automatic and documented): `scripts/sync-build-assets.sh [--check]` runs `wails3 task common:update:build-assets`, puts 13.0.0 back in both Info.plist (sed, tested on a copy: round trip identical) and verifies versions; `local-ci-02-build.sh` runs it and stops if tracked build/ files changed. Docs: how-to `set-the-version` / `definir-la-version`, RELEASING, reference. Not run with wails3 (absent in the Linux sandbox); `--check` passes on the current tree. |
| 209 | 209 | - Follow-up: temporary FR-only guide `docs/fr/how-to/tester-la-ci-locale.md` (test of the local CI with v9.9.9, to delete once the method is proven). Not followed on the Mac yet. |
| 210 | + | |
| 211 | +## 2026-11-09 — M8 · Divers ajouts: files and terminals of the Agents panel (#70–#74) | |
| 212 | + | |
| 213 | +- Branch `feature/m8-divers-ajouts` (not pushed), one commit per ticket (#72 and #73 share one: same code). Owner asked whether to tag each feature: no — tags stay for releases; one commit per ticket is what can be reverted. | |
| 214 | +- #71: CodeMirror colours ~30 languages (`files.ts` `languageFor`, `editorLanguages.ts`, loaded on demand; `@codemirror/lang-*` + `legacy-modes`; plain text above 512 KB). `theme.ts` `isDark` makes the editors follow `ui.theme` (they followed only the system). | |
| 215 | +- #74: `WorkspaceInfo.revealable`; 📂 per tree row and above the open file, reusing `WorkspaceService.Reveal`. | |
| 216 | +- #70: `Workspace.Rename` / `MakeDir` (local + remote scripts, contract tests pass on local and alpine container), `workspace.Outermost`, `WorkspaceService.RemoveAll/Rename/Move/CreateFolder` with protections; FilesTab multi-selection, inline rename (F2, ✏️, double-click), drag and drop + Move to…, new folder, grouped delete, context menu (`fileSelection.ts`). Duplicate not done. | |
| 217 | +- #72/#73: `terminalSessions.svelte.ts` keeps terminals (xterm screen in its own element, reparented by TerminalView) outside AgentView; sub-tabs, +/×, 8 max per agent, counts on the tab and ⌨ n in the Agents panel; AgentView remembers the last tab per agent. | |
| 218 | +- Verified in the app under Xvfb (Linux): colouring, selection, drag and drop (HTML5 DnD works in WebKitGTK with slow xdotool moves), F2, menu, Move to…, delete to trash, terminal running while away, 3 terminals, close, exit/restart, no shell left after quit. Trap: the sandbox's `tty` prints no newline (not an app bug). `make verify` green. Not checked on macOS. | |
| 219 | +- Also filed #75–#80 (collective memory REST API, MCP mode question, MCP gateway, plugins, acting outside, prompt injection), no milestone. | |
| 220 | +- **2026-11-09 — #51 unload a model from the Log panel** (owner: "/unload already works; from the Log panel, unload the selected model or all of them"): convention kept — an agent that announces the `unload` slash command can unload its model. `channels.Manager.Unload` sends `/unload` in a throwaway session (no trace in conversations; refuses no-command / answering agents), `AgentService.Unload` also refuses a stopped agent and writes the answer to the agent log (`unload: …`), `UnloadAll` returns `{unloaded, skipped}` without starting stopped agents. UI: ⏏ Unload the model + ⏏ Unload all in the Log panel (result line), ⏏ on the agent row and in the agent view header; the frontend decides visibility from `appState.commands` (no `canUnload` in `List()`, it would be lost on agent:state events). Verified under Xvfb with two fake ACP agents (Python, scratchpad). Docs EN/FR: memory-pressure how-to, memory explanation, AgentService reference. | |
| 221 | +- **2026-11-09 — #26 agents calling agents** (owner: "add #26 to the milestone and implement it"): chose @mentions in answers over an MCP "ask_agent" tool (mm ignores mcpServers). In a channel, members mentioned in an agent's answer answer next (`channels.Manager.answer` loop; `HandoffPrompt` tells them who addressed them; unseen includes the user's message). Guards: members only, not self, not already queued, not in code, not after a /command, not in direct conversations; `limits.maxAgentHandoffs` (default 3, 0–10, 0 = off; `*int` in raw config, read per message via `Options.Handoffs` → `Core.maxAgentHandoffs`), then system message `handoff-limit`; ■ stops the chain. Verified under Xvfb with two fake agents mentioning each other. Docs EN/FR: manage-channels how-to, channels-and-context explanation, configuration + agents-and-events references. | |
| 222 | +- **2026-11-10 — messages for several agents** (owner tested "@alice make a story about seven of nine, then @bob make a summary of this story": Alice asked for the story, Bob did everything; "@alice … ensuite demande à @bob d'en faire un résumé" worked): cause — with nothing unseen, Alice got the raw text and does not know she is @alice. Now, when a user message routes to several agents in a channel, `SharedPrompt` tells each one its name, the answer order and its part (`PartFor`: words after its first mention up to the next addressed agent's mention, code masked; none under two words = request for all). The fake conn matches scripts on the user's text inside a shared prompt. Docs EN/FR: manage-channels row, channels-and-context explanation, agents-and-events routing row. Not yet tried with mm. | |
| 223 | +- **2026-11-10 — follow-up**: tried with mm, `SharedPrompt` failed (Alice echoed "make a story about seven of nine", Bob wrote the story). Replaced it: each addressed agent receives only its part through the plain `Prompt` format (the one that works for a single agent), linking word stripped (`trailingLink`: then/and/puis/et/ensuite…); whole text when the part is under two words. `SharedPrompt` removed. Not yet re-tried with mm. | |
| 224 | +- **2026-11-10 — #82 Codex and #84 Gemini in sbx, like #81** (owner: "implement 82 like 81, the example is agents/snippets/codex-acp; then 84, you create the example"): `sbxPrograms` + `sbxAgentOf` in agentform.ts (claude-agent-acp, `/home/agent/.local/bin/codex-acp` — outside the kit's PATH per its Docker Hub page —, `gemini --acp`); a note per agent (`assistant.codexNote`, `assistant.geminiNote`), config-file block hidden. Gemini example written: kit `docker.io/sbx/gemini-kit` (deprecated by Docker for `antigravity`), `bindings.google`. Lifecycle test reads every `agents/snippets/*/sbxenv.yaml`. Guides EN/FR add-a-codex/gemini-agent-in-a-sandbox. `agents/snippets/codex-acp` holds a nested `.git` (the owner's): not committed, asked the owner. Not tried with sbx. | |
| 225 | +- **2026-11-10 — #84 fix** (owner: "propose only gemini, --acp goes in the arguments"): `sbxPrograms.gemini = 'gemini'`, `sbxArguments` (gemini: `--acp`); choosing an sbx agent's program fills Arguments unless other arguments were typed. | |
| 226 | +- **2026-11-10 — #82 fix**: Claude and Gemini work on the Mac; Codex failed (`cannot mix v3 kits with v1/v2 kits`: sbx's `codex` agent is now the v3 kit docker.io/sbx/codex). Kit changed to the v3 `docker.io/sbx/codex-acp:latest` everywhere (snippet, note, guides); the error is documented in the Codex guide. | |
| 227 | +- **2026-11-10 — #82 wrong sandbox**: the Codex entry made by the assistant pointed at claude-acp (Claude's sbxenv.yaml was read; no code path keeps old values, the form restarts empty each time — cause on the Mac not established: dropped/chosen file?). Guard: `SbxEnv.Agent`/`SandboxEnv.agent`, `sandboxMismatch` blocks adding Claude/Codex/Gemini with another agent's sbxenv.yaml. | |
| 228 | +- **2026-11-10 — #82 verified on the Mac**: Codex works with `codex-acp` alone (v3 kit puts it in the PATH; `/home/agent/.local/bin/codex-acp` was the v2 launcher). Assistant, snippet README, guides updated. Claude, Codex and Gemini in sbx all work on the Mac. | |
| 229 | +- **2026-11-10 — sbx program from agent:** (owner: "select the right program once the sbxenv.yaml is dropped or chosen, for codex, gemini and claude"): `withSbxProgram` in `withSandboxEnv` — agent: claude/codex/gemini sets program + arguments when the field is empty or holds a listed program; typed programs kept. Guides EN/FR step 5 updated; comments on #81/#82/#84 (Gemini verified on the Mac). New ticket #86 Mistral Vibe in sbx (no milestone). | |
| 230 | +- **2026-11-10 — same for mini-me** (owner: "the same for mini me"): `programOfSandbox` — agent: mini-me* (e.g. mini-me-kit) → mm --acp; a configuration file given before the sbxenv.yaml re-applies --config. mm stays outside sbxAgentOf (its config file is still asked, no note). Docs EN/FR: run-an-agent-in-a-sandbox, add-an-agent. | |
| 231 | +- **2026-11-10 — snippets mini-me-acp + #87 docker-agent in sbx** (owner: "add an example in agents/snippets, then create a ticket for docker agent too and implement it"): snippet mini-me-acp (kit docker.io/k33g/mini-me-kit:0.1.1, workspace/agent.yaml from milo's). #87: `programOfSandbox` agent docker-agent|cagent → docker-agent serve acp (built-in sbx agent, no kit: the v3 kit does not load while the built-in exists); snippet docker-agent-acp (agent.yaml with anthropic/claude-sonnet-4-5, key via sbx secret). No milestone on #87. Not tried with sbx. | |
| 232 | +- **2026-11-10 — #87 on the Mac**: sandbox created (sbx resolves agent: docker-agent to the kit docker.io/sbx/docker-agent), but `serve acp` without the agent file → "accepts 1 arg(s), received 0". Assistant now refuses docker-agent serve acp without a file (Missing 'agentFile'); errors.ts explains the message. | |
| 233 | +- **2026-11-10 — #87 agent file from workspace** (owner: "add this argument automatically from the workspace of sbxenv.yaml"): `SandboxEnv.agentFile` = agent.yaml|agent.yml in the env workspace; the assistant uses it (or the file already dropped) for mm/docker-agent arguments. | |
| 234 | +- **2026-11-10 — #68 done**: macOS install guide EN/FR — signed & notarized path (Open once), update by replacing the app; variants: spctl check, unsigned 0.1.0/1.0.0 keep Open Anyway / xattr. | |
| @@ -207,3 +207,28 @@ | |||
| 207 | - Verified (Linux sandbox): `bash -n`, `check-license-headers.sh`, `package_test.sh`, notes generation of step 03. NOT verified: everything that needs the Mac (codesign, notarytool, wails3, dmg), and the Rickub API/upload steps. Nothing committed. | 207 | - Verified (Linux sandbox): `bash -n`, `check-license-headers.sh`, `package_test.sh`, notes generation of step 03. NOT verified: everything that needs the Mac (codesign, notarytool, wails3, dmg), and the Rickub API/upload steps. Nothing committed. |
| 208 | - Follow-up (owner: LSMinimumSystemVersion should be automatic and documented): `scripts/sync-build-assets.sh [--check]` runs `wails3 task common:update:build-assets`, puts 13.0.0 back in both Info.plist (sed, tested on a copy: round trip identical) and verifies versions; `local-ci-02-build.sh` runs it and stops if tracked build/ files changed. Docs: how-to `set-the-version` / `definir-la-version`, RELEASING, reference. Not run with wails3 (absent in the Linux sandbox); `--check` passes on the current tree. | 208 | - Follow-up (owner: LSMinimumSystemVersion should be automatic and documented): `scripts/sync-build-assets.sh [--check]` runs `wails3 task common:update:build-assets`, puts 13.0.0 back in both Info.plist (sed, tested on a copy: round trip identical) and verifies versions; `local-ci-02-build.sh` runs it and stops if tracked build/ files changed. Docs: how-to `set-the-version` / `definir-la-version`, RELEASING, reference. Not run with wails3 (absent in the Linux sandbox); `--check` passes on the current tree. |
| 209 | - Follow-up: temporary FR-only guide `docs/fr/how-to/tester-la-ci-locale.md` (test of the local CI with v9.9.9, to delete once the method is proven). Not followed on the Mac yet. | 209 | - Follow-up: temporary FR-only guide `docs/fr/how-to/tester-la-ci-locale.md` (test of the local CI with v9.9.9, to delete once the method is proven). Not followed on the Mac yet. |
| 210 | + | ||
| 211 | +## 2026-11-09 — M8 · Divers ajouts: files and terminals of the Agents panel (#70–#74) | ||
| 212 | + | ||
| 213 | +- Branch `feature/m8-divers-ajouts` (not pushed), one commit per ticket (#72 and #73 share one: same code). Owner asked whether to tag each feature: no — tags stay for releases; one commit per ticket is what can be reverted. | ||
| 214 | +- #71: CodeMirror colours ~30 languages (`files.ts` `languageFor`, `editorLanguages.ts`, loaded on demand; `@codemirror/lang-*` + `legacy-modes`; plain text above 512 KB). `theme.ts` `isDark` makes the editors follow `ui.theme` (they followed only the system). | ||
| 215 | +- #74: `WorkspaceInfo.revealable`; 📂 per tree row and above the open file, reusing `WorkspaceService.Reveal`. | ||
| 216 | +- #70: `Workspace.Rename` / `MakeDir` (local + remote scripts, contract tests pass on local and alpine container), `workspace.Outermost`, `WorkspaceService.RemoveAll/Rename/Move/CreateFolder` with protections; FilesTab multi-selection, inline rename (F2, ✏️, double-click), drag and drop + Move to…, new folder, grouped delete, context menu (`fileSelection.ts`). Duplicate not done. | ||
| 217 | +- #72/#73: `terminalSessions.svelte.ts` keeps terminals (xterm screen in its own element, reparented by TerminalView) outside AgentView; sub-tabs, +/×, 8 max per agent, counts on the tab and ⌨ n in the Agents panel; AgentView remembers the last tab per agent. | ||
| 218 | +- Verified in the app under Xvfb (Linux): colouring, selection, drag and drop (HTML5 DnD works in WebKitGTK with slow xdotool moves), F2, menu, Move to…, delete to trash, terminal running while away, 3 terminals, close, exit/restart, no shell left after quit. Trap: the sandbox's `tty` prints no newline (not an app bug). `make verify` green. Not checked on macOS. | ||
| 219 | +- Also filed #75–#80 (collective memory REST API, MCP mode question, MCP gateway, plugins, acting outside, prompt injection), no milestone. | ||
| 220 | +- **2026-11-09 — #51 unload a model from the Log panel** (owner: "/unload already works; from the Log panel, unload the selected model or all of them"): convention kept — an agent that announces the `unload` slash command can unload its model. `channels.Manager.Unload` sends `/unload` in a throwaway session (no trace in conversations; refuses no-command / answering agents), `AgentService.Unload` also refuses a stopped agent and writes the answer to the agent log (`unload: …`), `UnloadAll` returns `{unloaded, skipped}` without starting stopped agents. UI: ⏏ Unload the model + ⏏ Unload all in the Log panel (result line), ⏏ on the agent row and in the agent view header; the frontend decides visibility from `appState.commands` (no `canUnload` in `List()`, it would be lost on agent:state events). Verified under Xvfb with two fake ACP agents (Python, scratchpad). Docs EN/FR: memory-pressure how-to, memory explanation, AgentService reference. | ||
| 221 | +- **2026-11-09 — #26 agents calling agents** (owner: "add #26 to the milestone and implement it"): chose @mentions in answers over an MCP "ask_agent" tool (mm ignores mcpServers). In a channel, members mentioned in an agent's answer answer next (`channels.Manager.answer` loop; `HandoffPrompt` tells them who addressed them; unseen includes the user's message). Guards: members only, not self, not already queued, not in code, not after a /command, not in direct conversations; `limits.maxAgentHandoffs` (default 3, 0–10, 0 = off; `*int` in raw config, read per message via `Options.Handoffs` → `Core.maxAgentHandoffs`), then system message `handoff-limit`; ■ stops the chain. Verified under Xvfb with two fake agents mentioning each other. Docs EN/FR: manage-channels how-to, channels-and-context explanation, configuration + agents-and-events references. | ||
| 222 | +- **2026-11-10 — messages for several agents** (owner tested "@alice make a story about seven of nine, then @bob make a summary of this story": Alice asked for the story, Bob did everything; "@alice … ensuite demande à @bob d'en faire un résumé" worked): cause — with nothing unseen, Alice got the raw text and does not know she is @alice. Now, when a user message routes to several agents in a channel, `SharedPrompt` tells each one its name, the answer order and its part (`PartFor`: words after its first mention up to the next addressed agent's mention, code masked; none under two words = request for all). The fake conn matches scripts on the user's text inside a shared prompt. Docs EN/FR: manage-channels row, channels-and-context explanation, agents-and-events routing row. Not yet tried with mm. | ||
| 223 | +- **2026-11-10 — follow-up**: tried with mm, `SharedPrompt` failed (Alice echoed "make a story about seven of nine", Bob wrote the story). Replaced it: each addressed agent receives only its part through the plain `Prompt` format (the one that works for a single agent), linking word stripped (`trailingLink`: then/and/puis/et/ensuite…); whole text when the part is under two words. `SharedPrompt` removed. Not yet re-tried with mm. | ||
| 224 | +- **2026-11-10 — #82 Codex and #84 Gemini in sbx, like #81** (owner: "implement 82 like 81, the example is agents/snippets/codex-acp; then 84, you create the example"): `sbxPrograms` + `sbxAgentOf` in agentform.ts (claude-agent-acp, `/home/agent/.local/bin/codex-acp` — outside the kit's PATH per its Docker Hub page —, `gemini --acp`); a note per agent (`assistant.codexNote`, `assistant.geminiNote`), config-file block hidden. Gemini example written: kit `docker.io/sbx/gemini-kit` (deprecated by Docker for `antigravity`), `bindings.google`. Lifecycle test reads every `agents/snippets/*/sbxenv.yaml`. Guides EN/FR add-a-codex/gemini-agent-in-a-sandbox. `agents/snippets/codex-acp` holds a nested `.git` (the owner's): not committed, asked the owner. Not tried with sbx. | ||
| 225 | +- **2026-11-10 — #84 fix** (owner: "propose only gemini, --acp goes in the arguments"): `sbxPrograms.gemini = 'gemini'`, `sbxArguments` (gemini: `--acp`); choosing an sbx agent's program fills Arguments unless other arguments were typed. | ||
| 226 | +- **2026-11-10 — #82 fix**: Claude and Gemini work on the Mac; Codex failed (`cannot mix v3 kits with v1/v2 kits`: sbx's `codex` agent is now the v3 kit docker.io/sbx/codex). Kit changed to the v3 `docker.io/sbx/codex-acp:latest` everywhere (snippet, note, guides); the error is documented in the Codex guide. | ||
| 227 | +- **2026-11-10 — #82 wrong sandbox**: the Codex entry made by the assistant pointed at claude-acp (Claude's sbxenv.yaml was read; no code path keeps old values, the form restarts empty each time — cause on the Mac not established: dropped/chosen file?). Guard: `SbxEnv.Agent`/`SandboxEnv.agent`, `sandboxMismatch` blocks adding Claude/Codex/Gemini with another agent's sbxenv.yaml. | ||
| 228 | +- **2026-11-10 — #82 verified on the Mac**: Codex works with `codex-acp` alone (v3 kit puts it in the PATH; `/home/agent/.local/bin/codex-acp` was the v2 launcher). Assistant, snippet README, guides updated. Claude, Codex and Gemini in sbx all work on the Mac. | ||
| 229 | +- **2026-11-10 — sbx program from agent:** (owner: "select the right program once the sbxenv.yaml is dropped or chosen, for codex, gemini and claude"): `withSbxProgram` in `withSandboxEnv` — agent: claude/codex/gemini sets program + arguments when the field is empty or holds a listed program; typed programs kept. Guides EN/FR step 5 updated; comments on #81/#82/#84 (Gemini verified on the Mac). New ticket #86 Mistral Vibe in sbx (no milestone). | ||
| 230 | +- **2026-11-10 — same for mini-me** (owner: "the same for mini me"): `programOfSandbox` — agent: mini-me* (e.g. mini-me-kit) → mm --acp; a configuration file given before the sbxenv.yaml re-applies --config. mm stays outside sbxAgentOf (its config file is still asked, no note). Docs EN/FR: run-an-agent-in-a-sandbox, add-an-agent. | ||
| 231 | +- **2026-11-10 — snippets mini-me-acp + #87 docker-agent in sbx** (owner: "add an example in agents/snippets, then create a ticket for docker agent too and implement it"): snippet mini-me-acp (kit docker.io/k33g/mini-me-kit:0.1.1, workspace/agent.yaml from milo's). #87: `programOfSandbox` agent docker-agent|cagent → docker-agent serve acp (built-in sbx agent, no kit: the v3 kit does not load while the built-in exists); snippet docker-agent-acp (agent.yaml with anthropic/claude-sonnet-4-5, key via sbx secret). No milestone on #87. Not tried with sbx. | ||
| 232 | +- **2026-11-10 — #87 on the Mac**: sandbox created (sbx resolves agent: docker-agent to the kit docker.io/sbx/docker-agent), but `serve acp` without the agent file → "accepts 1 arg(s), received 0". Assistant now refuses docker-agent serve acp without a file (Missing 'agentFile'); errors.ts explains the message. | ||
| 233 | +- **2026-11-10 — #87 agent file from workspace** (owner: "add this argument automatically from the workspace of sbxenv.yaml"): `SandboxEnv.agentFile` = agent.yaml|agent.yml in the env workspace; the assistant uses it (or the file already dropped) for mm/docker-agent arguments. | ||
| 234 | +- **2026-11-10 — #68 done**: macOS install guide EN/FR — signed & notarized path (Open once), update by replacing the app; variants: spctl check, unsigned 0.1.0/1.0.0 keep Open Anyway / xattr. | ||
modified
.tickets/issues/0026-spike-permettre-a-un-agent-d-invoquer-un-autre-a.yaml +44 -7 | @@ -1,17 +1,18 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 26 |
| 3 | 3 | title: "Spike : permettre à un agent d'invoquer un autre agent" |
| 4 | -state: open | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-10-29T07:20:24.000Z |
| 9 | -updatedAt: 2026-10-29T07:20:24.000Z | |
| 9 | +updatedAt: 2026-11-09T19:08:51.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - "kind::spike" |
| 12 | 12 | - "area::acp" |
| 13 | 13 | - "priority::low" |
| 14 | 14 | - "size::M" |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 15 | 16 | epic: "Channels & multi-agents" |
| 16 | 17 | related: |
| 17 | 18 | - 23 |
| @@ -29,34 +30,70 @@ body: | | ||
| 29 | 30 | tasks: |
| 30 | 31 | - id: 1 |
| 31 | 32 | title: "Étudier la détection de mentions dans les réponses" |
| 32 | - state: open | |
| 33 | + state: closed | |
| 33 | 34 | priority: medium |
| 34 | 35 | author: |
| 35 | 36 | name: k33g |
| 36 | 37 | email: ph.charriere@gmail.com |
| 37 | 38 | createdAt: 2026-10-29T07:20:24.000Z |
| 39 | + updatedAt: 2026-11-09T19:08:51.000Z | |
| 40 | + closedAt: 2026-11-09T19:08:51.000Z | |
| 38 | 41 | - id: 2 |
| 39 | 42 | title: "Étudier un serveur MCP fourni par Sidekicks" |
| 40 | - state: open | |
| 43 | + state: closed | |
| 41 | 44 | priority: medium |
| 42 | 45 | author: |
| 43 | 46 | name: k33g |
| 44 | 47 | email: ph.charriere@gmail.com |
| 45 | 48 | createdAt: 2026-10-29T07:20:24.000Z |
| 49 | + updatedAt: 2026-11-09T19:08:51.000Z | |
| 50 | + closedAt: 2026-11-09T19:08:51.000Z | |
| 46 | 51 | - id: 3 |
| 47 | 52 | title: "Définir les garde-fous anti-boucle" |
| 48 | - state: open | |
| 53 | + state: closed | |
| 49 | 54 | priority: medium |
| 50 | 55 | author: |
| 51 | 56 | name: k33g |
| 52 | 57 | email: ph.charriere@gmail.com |
| 53 | 58 | createdAt: 2026-10-29T07:20:24.000Z |
| 59 | + updatedAt: 2026-11-09T19:08:51.000Z | |
| 60 | + closedAt: 2026-11-09T19:08:51.000Z | |
| 54 | 61 | - id: 4 |
| 55 | 62 | title: "Prototype" |
| 56 | - state: open | |
| 63 | + state: closed | |
| 57 | 64 | priority: low |
| 58 | 65 | author: |
| 59 | 66 | name: k33g |
| 60 | 67 | email: ph.charriere@gmail.com |
| 61 | 68 | createdAt: 2026-10-29T07:20:24.000Z |
| 62 | -comments: [] | |
| 69 | + updatedAt: 2026-11-09T19:08:51.000Z | |
| 70 | + closedAt: 2026-11-09T19:08:51.000Z | |
| 71 | +comments: | |
| 72 | + - id: 1 | |
| 73 | + author: | |
| 74 | + name: k33g | |
| 75 | + email: ph.charriere@gmail.com | |
| 76 | + createdAt: 2026-11-09T19:08:51.000Z | |
| 77 | + body: | | |
| 78 | + Implémenté avec la **détection des mentions dans les réponses**. | |
| 79 | + | |
| 80 | + - **Choix** : la piste MCP est écartée. mm ignore les `mcpServers` proposés par le client, et | |
| 81 | + les mentions ne demandent rien à l'agent ; l'utilisateur voit tout l'échange dans le channel. | |
| 82 | + - **Règle** : dans un channel, quand la réponse d'un agent mentionne d'autres **membres** avec | |
| 83 | + `@nom`, ils répondent ensuite, dans l'ordre. Chacun reçoit ce qu'il n'a pas vu (le message de | |
| 84 | + l'utilisateur et la réponse de l'agent qui l'appelle), puis « alice mentioned you (@bob)…: | |
| 85 | + answer alice directly » (`HandoffPrompt`). | |
| 86 | + - **Garde-fous** : | |
| 87 | + - seuls les membres (un agent n'en invite jamais un nouveau, donc pas de modèle en plus) ; | |
| 88 | + - pas l'agent lui-même, ni un agent qui répond déjà au message ; | |
| 89 | + - pas de mention dans du code, ni dans la réponse à une `/commande` ; | |
| 90 | + - rien en conversation directe ; | |
| 91 | + - au plus `limits.maxAgentHandoffs` passages par message (3 par défaut, de 0 à 10, 0 désactive), | |
| 92 | + puis le message système `handoff-limit` ; | |
| 93 | + - **■** arrête toute la chaîne. | |
| 94 | + - **Config** : schéma, chargeur, suggestions de clés ; la limite est relue à chaque message. | |
| 95 | + - **Tests** : 6 tests Go (`internal/channels/handoff_test.go`), plus les tests de config. Vérifié | |
| 96 | + dans l'application avec deux faux agents qui se mentionnent l'un l'autre : Alice → Bob → Alice, | |
| 97 | + puis la chaîne s'arrête avec le message. | |
| 98 | + - **Docs EN + FR** : guide « Gérer les channels » (section « Laisser les agents s'appeler entre | |
| 99 | + eux »), explication « Channels et contexte », référence configuration et agents/événements. | |
| @@ -1,17 +1,18 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 26 | 2 | id: 26 |
| 3 | title: "Spike : permettre à un agent d'invoquer un autre agent" | 3 | title: "Spike : permettre à un agent d'invoquer un autre agent" |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-10-29T07:20:24.000Z | 8 | createdAt: 2026-10-29T07:20:24.000Z |
| 9 | -updatedAt: 2026-10-29T07:20:24.000Z | 9 | +updatedAt: 2026-11-09T19:08:51.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - "kind::spike" | 11 | - "kind::spike" |
| 12 | - "area::acp" | 12 | - "area::acp" |
| 13 | - "priority::low" | 13 | - "priority::low" |
| 14 | - "size::M" | 14 | - "size::M" |
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 15 | epic: "Channels & multi-agents" | 16 | epic: "Channels & multi-agents" |
| 16 | related: | 17 | related: |
| 17 | - 23 | 18 | - 23 |
| @@ -29,34 +30,70 @@ body: | | |||
| 29 | tasks: | 30 | tasks: |
| 30 | - id: 1 | 31 | - id: 1 |
| 31 | title: "Étudier la détection de mentions dans les réponses" | 32 | title: "Étudier la détection de mentions dans les réponses" |
| 32 | - state: open | 33 | + state: closed |
| 33 | priority: medium | 34 | priority: medium |
| 34 | author: | 35 | author: |
| 35 | name: k33g | 36 | name: k33g |
| 36 | email: ph.charriere@gmail.com | 37 | email: ph.charriere@gmail.com |
| 37 | createdAt: 2026-10-29T07:20:24.000Z | 38 | createdAt: 2026-10-29T07:20:24.000Z |
| 39 | + updatedAt: 2026-11-09T19:08:51.000Z | ||
| 40 | + closedAt: 2026-11-09T19:08:51.000Z | ||
| 38 | - id: 2 | 41 | - id: 2 |
| 39 | title: "Étudier un serveur MCP fourni par Sidekicks" | 42 | title: "Étudier un serveur MCP fourni par Sidekicks" |
| 40 | - state: open | 43 | + state: closed |
| 41 | priority: medium | 44 | priority: medium |
| 42 | author: | 45 | author: |
| 43 | name: k33g | 46 | name: k33g |
| 44 | email: ph.charriere@gmail.com | 47 | email: ph.charriere@gmail.com |
| 45 | createdAt: 2026-10-29T07:20:24.000Z | 48 | createdAt: 2026-10-29T07:20:24.000Z |
| 49 | + updatedAt: 2026-11-09T19:08:51.000Z | ||
| 50 | + closedAt: 2026-11-09T19:08:51.000Z | ||
| 46 | - id: 3 | 51 | - id: 3 |
| 47 | title: "Définir les garde-fous anti-boucle" | 52 | title: "Définir les garde-fous anti-boucle" |
| 48 | - state: open | 53 | + state: closed |
| 49 | priority: medium | 54 | priority: medium |
| 50 | author: | 55 | author: |
| 51 | name: k33g | 56 | name: k33g |
| 52 | email: ph.charriere@gmail.com | 57 | email: ph.charriere@gmail.com |
| 53 | createdAt: 2026-10-29T07:20:24.000Z | 58 | createdAt: 2026-10-29T07:20:24.000Z |
| 59 | + updatedAt: 2026-11-09T19:08:51.000Z | ||
| 60 | + closedAt: 2026-11-09T19:08:51.000Z | ||
| 54 | - id: 4 | 61 | - id: 4 |
| 55 | title: "Prototype" | 62 | title: "Prototype" |
| 56 | - state: open | 63 | + state: closed |
| 57 | priority: low | 64 | priority: low |
| 58 | author: | 65 | author: |
| 59 | name: k33g | 66 | name: k33g |
| 60 | email: ph.charriere@gmail.com | 67 | email: ph.charriere@gmail.com |
| 61 | createdAt: 2026-10-29T07:20:24.000Z | 68 | createdAt: 2026-10-29T07:20:24.000Z |
| 62 | -comments: [] | 69 | + updatedAt: 2026-11-09T19:08:51.000Z |
| 70 | + closedAt: 2026-11-09T19:08:51.000Z | ||
| 71 | +comments: | ||
| 72 | + - id: 1 | ||
| 73 | + author: | ||
| 74 | + name: k33g | ||
| 75 | + email: ph.charriere@gmail.com | ||
| 76 | + createdAt: 2026-11-09T19:08:51.000Z | ||
| 77 | + body: | | ||
| 78 | + Implémenté avec la **détection des mentions dans les réponses**. | ||
| 79 | + | ||
| 80 | + - **Choix** : la piste MCP est écartée. mm ignore les `mcpServers` proposés par le client, et | ||
| 81 | + les mentions ne demandent rien à l'agent ; l'utilisateur voit tout l'échange dans le channel. | ||
| 82 | + - **Règle** : dans un channel, quand la réponse d'un agent mentionne d'autres **membres** avec | ||
| 83 | + `@nom`, ils répondent ensuite, dans l'ordre. Chacun reçoit ce qu'il n'a pas vu (le message de | ||
| 84 | + l'utilisateur et la réponse de l'agent qui l'appelle), puis « alice mentioned you (@bob)…: | ||
| 85 | + answer alice directly » (`HandoffPrompt`). | ||
| 86 | + - **Garde-fous** : | ||
| 87 | + - seuls les membres (un agent n'en invite jamais un nouveau, donc pas de modèle en plus) ; | ||
| 88 | + - pas l'agent lui-même, ni un agent qui répond déjà au message ; | ||
| 89 | + - pas de mention dans du code, ni dans la réponse à une `/commande` ; | ||
| 90 | + - rien en conversation directe ; | ||
| 91 | + - au plus `limits.maxAgentHandoffs` passages par message (3 par défaut, de 0 à 10, 0 désactive), | ||
| 92 | + puis le message système `handoff-limit` ; | ||
| 93 | + - **■** arrête toute la chaîne. | ||
| 94 | + - **Config** : schéma, chargeur, suggestions de clés ; la limite est relue à chaque message. | ||
| 95 | + - **Tests** : 6 tests Go (`internal/channels/handoff_test.go`), plus les tests de config. Vérifié | ||
| 96 | + dans l'application avec deux faux agents qui se mentionnent l'un l'autre : Alice → Bob → Alice, | ||
| 97 | + puis la chaîne s'arrête avec le message. | ||
| 98 | + - **Docs EN + FR** : guide « Gérer les channels » (section « Laisser les agents s'appeler entre | ||
| 99 | + eux »), explication « Channels et contexte », référence configuration et agents/événements. | ||
modified
.tickets/issues/0051-ajouter-un-bouton-pour-decharger-le-modele-de-la.yaml +67 -10 | @@ -1,17 +1,18 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 51 |
| 3 | 3 | title: Ajouter un bouton pour décharger le modèle de la mémoire (quand l'agent le permet) |
| 4 | -state: open | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-10-31T07:10:06.981Z |
| 9 | -updatedAt: 2026-11-01T06:58:53.000Z | |
| 9 | +updatedAt: 2026-11-09T18:55:08.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::acp |
| 13 | 13 | - area::ui |
| 14 | 14 | - citizen-ux |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 15 | 16 | epic: Agents |
| 16 | 17 | related: |
| 17 | 18 | - 61 |
| @@ -49,44 +50,100 @@ body: | | ||
| 49 | 50 | - Service `AgentService.Unload(name)` et bindings ; `AgentService.List()` dit si l'agent sait se |
| 50 | 51 | décharger (`canUnload`). |
| 51 | 52 | - Interface : bouton, état grisé, erreur traduite ; textes EN + FR. |
| 53 | + - Panneau Log : décharger l'agent sélectionné, ou tous les agents qui le permettent. | |
| 52 | 54 | - Tests Go avec un faux agent qui annonce (ou non) `unload` ; tests frontend. |
| 53 | 55 | - Docs EN + FR : guide « Surveiller la pression mémoire » (que faire quand elle monte), |
| 54 | 56 | référence `AgentService`, explication mémoire et modèles locaux (la convention `unload`). |
| 55 | 57 | |
| 56 | - ## À trancher | |
| 57 | - - Mettre aussi le bouton dans le panneau Log, à côté de la pression mémoire (pour l'agent choisi) ? | |
| 58 | - - Proposer un **Tout décharger** (tous les agents qui le permettent) quand la pression est élevée ? | |
| 58 | + ## Dans le panneau Log | |
| 59 | + La commande `/unload` tapée dans une conversation fonctionne déjà : ce ticket en fait un bouton, | |
| 60 | + sans laisser de trace dans la conversation. Dans le panneau **Log**, à côté de la pression mémoire : | |
| 61 | + - **⏏ Décharger le modèle** : décharge le modèle de l'agent sélectionné (s'il le permet). | |
| 62 | + - **⏏ Tout décharger** : décharge les modèles de tous les agents qui tournent et le permettent ; | |
| 63 | + les agents occupés ou sans `unload` sont passés, et le résultat dit lesquels l'ont été. | |
| 59 | 64 | tasks: |
| 60 | 65 | - id: 1 |
| 61 | 66 | title: "Unload(agent) : session dédiée, envoi de /unload, refus si arrêté, occupé ou sans la commande" |
| 62 | - state: open | |
| 67 | + state: closed | |
| 63 | 68 | priority: medium |
| 64 | 69 | author: |
| 65 | 70 | name: k33g |
| 66 | 71 | email: ph.charriere@gmail.com |
| 67 | 72 | createdAt: 2026-11-01T06:48:09.000Z |
| 73 | + updatedAt: 2026-11-09T18:55:08.000Z | |
| 74 | + closedAt: 2026-11-09T18:55:08.000Z | |
| 68 | 75 | - id: 2 |
| 69 | 76 | title: "AgentService.Unload et canUnload dans List(), bindings" |
| 70 | - state: open | |
| 77 | + state: closed | |
| 71 | 78 | priority: medium |
| 72 | 79 | author: |
| 73 | 80 | name: k33g |
| 74 | 81 | email: ph.charriere@gmail.com |
| 75 | 82 | createdAt: 2026-11-01T06:48:09.000Z |
| 83 | + updatedAt: 2026-11-09T18:55:08.000Z | |
| 84 | + closedAt: 2026-11-09T18:55:08.000Z | |
| 76 | 85 | - id: 3 |
| 77 | 86 | title: "Interface : bouton ⏏ dans la liste Agents et la vue de l'agent" |
| 78 | - state: open | |
| 87 | + state: closed | |
| 79 | 88 | priority: medium |
| 80 | 89 | author: |
| 81 | 90 | name: k33g |
| 82 | 91 | email: ph.charriere@gmail.com |
| 83 | 92 | createdAt: 2026-11-01T06:48:09.000Z |
| 93 | + updatedAt: 2026-11-09T18:55:08.000Z | |
| 94 | + closedAt: 2026-11-09T18:55:08.000Z | |
| 84 | 95 | - id: 4 |
| 85 | 96 | title: Tests et documentation EN + FR |
| 86 | - state: open | |
| 97 | + state: closed | |
| 87 | 98 | priority: low |
| 88 | 99 | author: |
| 89 | 100 | name: k33g |
| 90 | 101 | email: ph.charriere@gmail.com |
| 91 | 102 | createdAt: 2026-11-01T06:48:09.000Z |
| 92 | -comments: [] | |
| 103 | + updatedAt: 2026-11-09T18:55:08.000Z | |
| 104 | + closedAt: 2026-11-09T18:55:08.000Z | |
| 105 | + - id: 5 | |
| 106 | + title: "Panneau Log : ⏏ décharger le modèle de l'agent sélectionné, et ⏏ Tout décharger" | |
| 107 | + state: closed | |
| 108 | + priority: medium | |
| 109 | + author: | |
| 110 | + name: k33g | |
| 111 | + email: ph.charriere@gmail.com | |
| 112 | + createdAt: 2026-11-09T18:48:12.000Z | |
| 113 | + updatedAt: 2026-11-09T18:55:08.000Z | |
| 114 | + closedAt: 2026-11-09T18:55:08.000Z | |
| 115 | +comments: | |
| 116 | + - id: 1 | |
| 117 | + author: | |
| 118 | + name: k33g | |
| 119 | + email: ph.charriere@gmail.com | |
| 120 | + createdAt: 2026-11-09T18:48:12.000Z | |
| 121 | + body: | | |
| 122 | + La commande `/unload` fonctionne déjà depuis une conversation. Ce qui manque : pouvoir, depuis | |
| 123 | + le panneau **Log**, décharger le modèle de l'agent sélectionné, ou tous les modèles. | |
| 124 | + Les deux questions « À trancher » sont donc tranchées : oui pour le bouton dans le Log, oui pour | |
| 125 | + « Tout décharger ». | |
| 126 | + - id: 2 | |
| 127 | + author: | |
| 128 | + name: k33g | |
| 129 | + email: ph.charriere@gmail.com | |
| 130 | + createdAt: 2026-11-09T18:55:08.000Z | |
| 131 | + body: | | |
| 132 | + Implémenté. | |
| 133 | + | |
| 134 | + - `channels.Manager.Unload(agent)` : refuse un agent sans commande `unload` (`ErrCannotUnload`) | |
| 135 | + ou qui répond (`ErrAgentAnswering`), sinon ouvre une session à part, y envoie `/unload` et | |
| 136 | + renvoie la réponse. Les commandes annoncées dans cette session sont gardées comme d'habitude. | |
| 137 | + - `AgentService.Unload(name)` : refuse aussi un agent arrêté (`ErrNotRunning`) ; la réponse de | |
| 138 | + l'agent va dans son **Log** (`unload: …`). `AgentService.UnloadAll()` renvoie | |
| 139 | + `{unloaded, skipped}` ; les agents arrêtés ne sont pas démarrés. | |
| 140 | + - Écart avec la tâche 2 : pas de `canUnload` dans `List()`. L'interface connaît déjà les commandes | |
| 141 | + de chaque agent (`appState.commands`, tenu à jour par `commands:changed`) ; un champ dans | |
| 142 | + `List()` aurait été perdu à chaque événement `agent:state`. | |
| 143 | + - Interface : **⏏ Décharger le modèle** et **⏏ Tout décharger** dans le panneau Log, à côté de la | |
| 144 | + pression mémoire, avec une ligne de résultat ; ⏏ sur la ligne de l'agent (liste Agents) et | |
| 145 | + dans l'en-tête de sa vue. Grisé tant que l'agent n'est pas prêt ; erreurs traduites. | |
| 146 | + - Tests : Go (channels + app, avec un faux agent qui annonce ou non `unload`), frontend | |
| 147 | + (`unload.test.ts`). Vérifié dans l'application avec deux faux agents ACP. | |
| 148 | + - Docs EN + FR : guide « Surveiller la pression mémoire », explication « Mémoire et modèles | |
| 149 | + locaux » (la convention `unload`), référence `AgentService`. | |
| @@ -1,17 +1,18 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 51 | 2 | id: 51 |
| 3 | title: Ajouter un bouton pour décharger le modèle de la mémoire (quand l'agent le permet) | 3 | title: Ajouter un bouton pour décharger le modèle de la mémoire (quand l'agent le permet) |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-10-31T07:10:06.981Z | 8 | createdAt: 2026-10-31T07:10:06.981Z |
| 9 | -updatedAt: 2026-11-01T06:58:53.000Z | 9 | +updatedAt: 2026-11-09T18:55:08.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::acp | 12 | - area::acp |
| 13 | - area::ui | 13 | - area::ui |
| 14 | - citizen-ux | 14 | - citizen-ux |
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 15 | epic: Agents | 16 | epic: Agents |
| 16 | related: | 17 | related: |
| 17 | - 61 | 18 | - 61 |
| @@ -49,44 +50,100 @@ body: | | |||
| 49 | - Service `AgentService.Unload(name)` et bindings ; `AgentService.List()` dit si l'agent sait se | 50 | - Service `AgentService.Unload(name)` et bindings ; `AgentService.List()` dit si l'agent sait se |
| 50 | décharger (`canUnload`). | 51 | décharger (`canUnload`). |
| 51 | - Interface : bouton, état grisé, erreur traduite ; textes EN + FR. | 52 | - Interface : bouton, état grisé, erreur traduite ; textes EN + FR. |
| 53 | + - Panneau Log : décharger l'agent sélectionné, ou tous les agents qui le permettent. | ||
| 52 | - Tests Go avec un faux agent qui annonce (ou non) `unload` ; tests frontend. | 54 | - Tests Go avec un faux agent qui annonce (ou non) `unload` ; tests frontend. |
| 53 | - Docs EN + FR : guide « Surveiller la pression mémoire » (que faire quand elle monte), | 55 | - Docs EN + FR : guide « Surveiller la pression mémoire » (que faire quand elle monte), |
| 54 | référence `AgentService`, explication mémoire et modèles locaux (la convention `unload`). | 56 | référence `AgentService`, explication mémoire et modèles locaux (la convention `unload`). |
| 55 | 57 | ||
| 56 | - ## À trancher | 58 | + ## Dans le panneau Log |
| 57 | - - Mettre aussi le bouton dans le panneau Log, à côté de la pression mémoire (pour l'agent choisi) ? | 59 | + La commande `/unload` tapée dans une conversation fonctionne déjà : ce ticket en fait un bouton, |
| 58 | - - Proposer un **Tout décharger** (tous les agents qui le permettent) quand la pression est élevée ? | 60 | + sans laisser de trace dans la conversation. Dans le panneau **Log**, à côté de la pression mémoire : |
| 61 | + - **⏏ Décharger le modèle** : décharge le modèle de l'agent sélectionné (s'il le permet). | ||
| 62 | + - **⏏ Tout décharger** : décharge les modèles de tous les agents qui tournent et le permettent ; | ||
| 63 | + les agents occupés ou sans `unload` sont passés, et le résultat dit lesquels l'ont été. | ||
| 59 | tasks: | 64 | tasks: |
| 60 | - id: 1 | 65 | - id: 1 |
| 61 | title: "Unload(agent) : session dédiée, envoi de /unload, refus si arrêté, occupé ou sans la commande" | 66 | title: "Unload(agent) : session dédiée, envoi de /unload, refus si arrêté, occupé ou sans la commande" |
| 62 | - state: open | 67 | + state: closed |
| 63 | priority: medium | 68 | priority: medium |
| 64 | author: | 69 | author: |
| 65 | name: k33g | 70 | name: k33g |
| 66 | email: ph.charriere@gmail.com | 71 | email: ph.charriere@gmail.com |
| 67 | createdAt: 2026-11-01T06:48:09.000Z | 72 | createdAt: 2026-11-01T06:48:09.000Z |
| 73 | + updatedAt: 2026-11-09T18:55:08.000Z | ||
| 74 | + closedAt: 2026-11-09T18:55:08.000Z | ||
| 68 | - id: 2 | 75 | - id: 2 |
| 69 | title: "AgentService.Unload et canUnload dans List(), bindings" | 76 | title: "AgentService.Unload et canUnload dans List(), bindings" |
| 70 | - state: open | 77 | + state: closed |
| 71 | priority: medium | 78 | priority: medium |
| 72 | author: | 79 | author: |
| 73 | name: k33g | 80 | name: k33g |
| 74 | email: ph.charriere@gmail.com | 81 | email: ph.charriere@gmail.com |
| 75 | createdAt: 2026-11-01T06:48:09.000Z | 82 | createdAt: 2026-11-01T06:48:09.000Z |
| 83 | + updatedAt: 2026-11-09T18:55:08.000Z | ||
| 84 | + closedAt: 2026-11-09T18:55:08.000Z | ||
| 76 | - id: 3 | 85 | - id: 3 |
| 77 | title: "Interface : bouton ⏏ dans la liste Agents et la vue de l'agent" | 86 | title: "Interface : bouton ⏏ dans la liste Agents et la vue de l'agent" |
| 78 | - state: open | 87 | + state: closed |
| 79 | priority: medium | 88 | priority: medium |
| 80 | author: | 89 | author: |
| 81 | name: k33g | 90 | name: k33g |
| 82 | email: ph.charriere@gmail.com | 91 | email: ph.charriere@gmail.com |
| 83 | createdAt: 2026-11-01T06:48:09.000Z | 92 | createdAt: 2026-11-01T06:48:09.000Z |
| 93 | + updatedAt: 2026-11-09T18:55:08.000Z | ||
| 94 | + closedAt: 2026-11-09T18:55:08.000Z | ||
| 84 | - id: 4 | 95 | - id: 4 |
| 85 | title: Tests et documentation EN + FR | 96 | title: Tests et documentation EN + FR |
| 86 | - state: open | 97 | + state: closed |
| 87 | priority: low | 98 | priority: low |
| 88 | author: | 99 | author: |
| 89 | name: k33g | 100 | name: k33g |
| 90 | email: ph.charriere@gmail.com | 101 | email: ph.charriere@gmail.com |
| 91 | createdAt: 2026-11-01T06:48:09.000Z | 102 | createdAt: 2026-11-01T06:48:09.000Z |
| 92 | -comments: [] | 103 | + updatedAt: 2026-11-09T18:55:08.000Z |
| 104 | + closedAt: 2026-11-09T18:55:08.000Z | ||
| 105 | + - id: 5 | ||
| 106 | + title: "Panneau Log : ⏏ décharger le modèle de l'agent sélectionné, et ⏏ Tout décharger" | ||
| 107 | + state: closed | ||
| 108 | + priority: medium | ||
| 109 | + author: | ||
| 110 | + name: k33g | ||
| 111 | + email: ph.charriere@gmail.com | ||
| 112 | + createdAt: 2026-11-09T18:48:12.000Z | ||
| 113 | + updatedAt: 2026-11-09T18:55:08.000Z | ||
| 114 | + closedAt: 2026-11-09T18:55:08.000Z | ||
| 115 | +comments: | ||
| 116 | + - id: 1 | ||
| 117 | + author: | ||
| 118 | + name: k33g | ||
| 119 | + email: ph.charriere@gmail.com | ||
| 120 | + createdAt: 2026-11-09T18:48:12.000Z | ||
| 121 | + body: | | ||
| 122 | + La commande `/unload` fonctionne déjà depuis une conversation. Ce qui manque : pouvoir, depuis | ||
| 123 | + le panneau **Log**, décharger le modèle de l'agent sélectionné, ou tous les modèles. | ||
| 124 | + Les deux questions « À trancher » sont donc tranchées : oui pour le bouton dans le Log, oui pour | ||
| 125 | + « Tout décharger ». | ||
| 126 | + - id: 2 | ||
| 127 | + author: | ||
| 128 | + name: k33g | ||
| 129 | + email: ph.charriere@gmail.com | ||
| 130 | + createdAt: 2026-11-09T18:55:08.000Z | ||
| 131 | + body: | | ||
| 132 | + Implémenté. | ||
| 133 | + | ||
| 134 | + - `channels.Manager.Unload(agent)` : refuse un agent sans commande `unload` (`ErrCannotUnload`) | ||
| 135 | + ou qui répond (`ErrAgentAnswering`), sinon ouvre une session à part, y envoie `/unload` et | ||
| 136 | + renvoie la réponse. Les commandes annoncées dans cette session sont gardées comme d'habitude. | ||
| 137 | + - `AgentService.Unload(name)` : refuse aussi un agent arrêté (`ErrNotRunning`) ; la réponse de | ||
| 138 | + l'agent va dans son **Log** (`unload: …`). `AgentService.UnloadAll()` renvoie | ||
| 139 | + `{unloaded, skipped}` ; les agents arrêtés ne sont pas démarrés. | ||
| 140 | + - Écart avec la tâche 2 : pas de `canUnload` dans `List()`. L'interface connaît déjà les commandes | ||
| 141 | + de chaque agent (`appState.commands`, tenu à jour par `commands:changed`) ; un champ dans | ||
| 142 | + `List()` aurait été perdu à chaque événement `agent:state`. | ||
| 143 | + - Interface : **⏏ Décharger le modèle** et **⏏ Tout décharger** dans le panneau Log, à côté de la | ||
| 144 | + pression mémoire, avec une ligne de résultat ; ⏏ sur la ligne de l'agent (liste Agents) et | ||
| 145 | + dans l'en-tête de sa vue. Grisé tant que l'agent n'est pas prêt ; erreurs traduites. | ||
| 146 | + - Tests : Go (channels + app, avec un faux agent qui annonce ou non `unload`), frontend | ||
| 147 | + (`unload.test.ts`). Vérifié dans l'application avec deux faux agents ACP. | ||
| 148 | + - Docs EN + FR : guide « Surveiller la pression mémoire », explication « Mémoire et modèles | ||
| 149 | + locaux » (la convention `unload`), référence `AgentService`. | ||
modified
.tickets/issues/0068-corriger-le-guide-d-installation-macos-retirer-o.yaml +23 -6 | @@ -1,12 +1,12 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 68 |
| 3 | 3 | title: "Corriger le guide d'installation macOS : retirer Ouvrir quand même" |
| 4 | -state: open | |
| 4 | +state: closed | |
| 5 | 5 | author: |
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-07T04:47:58.000Z |
| 9 | -updatedAt: 2026-11-07T04:47:58.000Z | |
| 9 | +updatedAt: 2026-11-10T06:19:58.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - documentation |
| 12 | 12 | - kind::bug |
| @@ -34,26 +34,43 @@ body: | | ||
| 34 | 34 | tasks: |
| 35 | 35 | - id: 1 |
| 36 | 36 | title: "Réécrire la partie macOS du guide FR" |
| 37 | - state: open | |
| 37 | + state: closed | |
| 38 | 38 | priority: high |
| 39 | 39 | author: |
| 40 | 40 | name: k33g |
| 41 | 41 | email: ph.charriere@gmail.com |
| 42 | 42 | createdAt: 2026-11-07T04:47:58.000Z |
| 43 | + updatedAt: 2026-11-10T06:19:58.000Z | |
| 44 | + closedAt: 2026-11-10T06:19:58.000Z | |
| 43 | 45 | - id: 2 |
| 44 | 46 | title: "Réécrire la partie macOS du guide EN" |
| 45 | - state: open | |
| 47 | + state: closed | |
| 46 | 48 | priority: high |
| 47 | 49 | author: |
| 48 | 50 | name: k33g |
| 49 | 51 | email: ph.charriere@gmail.com |
| 50 | 52 | createdAt: 2026-11-07T04:47:58.000Z |
| 53 | + updatedAt: 2026-11-10T06:19:58.000Z | |
| 54 | + closedAt: 2026-11-10T06:19:58.000Z | |
| 51 | 55 | - id: 3 |
| 52 | 56 | title: "Garder la variante pour les paquets 0.1.0 et 1.0.0" |
| 53 | - state: open | |
| 57 | + state: closed | |
| 54 | 58 | priority: medium |
| 55 | 59 | author: |
| 56 | 60 | name: k33g |
| 57 | 61 | email: ph.charriere@gmail.com |
| 58 | 62 | createdAt: 2026-11-07T04:47:58.000Z |
| 59 | -comments: [] | |
| 63 | + updatedAt: 2026-11-10T06:19:58.000Z | |
| 64 | + closedAt: 2026-11-10T06:19:58.000Z | |
| 65 | +comments: | |
| 66 | + - id: 1 | |
| 67 | + author: | |
| 68 | + name: k33g | |
| 69 | + email: ph.charriere@gmail.com | |
| 70 | + createdAt: 2026-11-10T06:19:58.000Z | |
| 71 | + body: | | |
| 72 | + Fait, EN + FR ([install-sidekicks.md](docs/en/how-to/install-sidekicks.md), [installer-sidekicks.md](docs/fr/how-to/installer-sidekicks.md)) : | |
| 73 | + - macOS en 3 étapes : l'application est signée (Developer ID) et notarisée, macOS demande une fois d'ouvrir une application | |
| 74 | + téléchargée → **Ouvrir** ; plus de **Ouvrir quand même** dans le parcours par défaut. Ajout : mettre à jour en remplaçant l'app. | |
| 75 | + - Variantes : vérifier la signature (`spctl -a -vvv`) ; les paquets 0.1.0 et 1.0.0, non signés, gardent **Ouvrir quand même** | |
| 76 | + ou `xattr -dr com.apple.quarantine` ; `1.0.0-macos` et suivants sont signés. | |
| @@ -1,12 +1,12 @@ | |||
| 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | id: 68 | 2 | id: 68 |
| 3 | title: "Corriger le guide d'installation macOS : retirer Ouvrir quand même" | 3 | title: "Corriger le guide d'installation macOS : retirer Ouvrir quand même" |
| 4 | -state: open | 4 | +state: closed |
| 5 | author: | 5 | author: |
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-07T04:47:58.000Z | 8 | createdAt: 2026-11-07T04:47:58.000Z |
| 9 | -updatedAt: 2026-11-07T04:47:58.000Z | 9 | +updatedAt: 2026-11-10T06:19:58.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - documentation | 11 | - documentation |
| 12 | - kind::bug | 12 | - kind::bug |
| @@ -34,26 +34,43 @@ body: | | |||
| 34 | tasks: | 34 | tasks: |
| 35 | - id: 1 | 35 | - id: 1 |
| 36 | title: "Réécrire la partie macOS du guide FR" | 36 | title: "Réécrire la partie macOS du guide FR" |
| 37 | - state: open | 37 | + state: closed |
| 38 | priority: high | 38 | priority: high |
| 39 | author: | 39 | author: |
| 40 | name: k33g | 40 | name: k33g |
| 41 | email: ph.charriere@gmail.com | 41 | email: ph.charriere@gmail.com |
| 42 | createdAt: 2026-11-07T04:47:58.000Z | 42 | createdAt: 2026-11-07T04:47:58.000Z |
| 43 | + updatedAt: 2026-11-10T06:19:58.000Z | ||
| 44 | + closedAt: 2026-11-10T06:19:58.000Z | ||
| 43 | - id: 2 | 45 | - id: 2 |
| 44 | title: "Réécrire la partie macOS du guide EN" | 46 | title: "Réécrire la partie macOS du guide EN" |
| 45 | - state: open | 47 | + state: closed |
| 46 | priority: high | 48 | priority: high |
| 47 | author: | 49 | author: |
| 48 | name: k33g | 50 | name: k33g |
| 49 | email: ph.charriere@gmail.com | 51 | email: ph.charriere@gmail.com |
| 50 | createdAt: 2026-11-07T04:47:58.000Z | 52 | createdAt: 2026-11-07T04:47:58.000Z |
| 53 | + updatedAt: 2026-11-10T06:19:58.000Z | ||
| 54 | + closedAt: 2026-11-10T06:19:58.000Z | ||
| 51 | - id: 3 | 55 | - id: 3 |
| 52 | title: "Garder la variante pour les paquets 0.1.0 et 1.0.0" | 56 | title: "Garder la variante pour les paquets 0.1.0 et 1.0.0" |
| 53 | - state: open | 57 | + state: closed |
| 54 | priority: medium | 58 | priority: medium |
| 55 | author: | 59 | author: |
| 56 | name: k33g | 60 | name: k33g |
| 57 | email: ph.charriere@gmail.com | 61 | email: ph.charriere@gmail.com |
| 58 | createdAt: 2026-11-07T04:47:58.000Z | 62 | createdAt: 2026-11-07T04:47:58.000Z |
| 59 | -comments: [] | 63 | + updatedAt: 2026-11-10T06:19:58.000Z |
| 64 | + closedAt: 2026-11-10T06:19:58.000Z | ||
| 65 | +comments: | ||
| 66 | + - id: 1 | ||
| 67 | + author: | ||
| 68 | + name: k33g | ||
| 69 | + email: ph.charriere@gmail.com | ||
| 70 | + createdAt: 2026-11-10T06:19:58.000Z | ||
| 71 | + body: | | ||
| 72 | + Fait, EN + FR ([install-sidekicks.md](docs/en/how-to/install-sidekicks.md), [installer-sidekicks.md](docs/fr/how-to/installer-sidekicks.md)) : | ||
| 73 | + - macOS en 3 étapes : l'application est signée (Developer ID) et notarisée, macOS demande une fois d'ouvrir une application | ||
| 74 | + téléchargée → **Ouvrir** ; plus de **Ouvrir quand même** dans le parcours par défaut. Ajout : mettre à jour en remplaçant l'app. | ||
| 75 | + - Variantes : vérifier la signature (`spctl -a -vvv`) ; les paquets 0.1.0 et 1.0.0, non signés, gardent **Ouvrir quand même** | ||
| 76 | + ou `xattr -dr com.apple.quarantine` ; `1.0.0-macos` et suivants sont signés. | ||
modified
.tickets/issues/0069-comprendre-le-fonctionnement-du-wrapper-claude-a.yaml +1 -2 | @@ -6,12 +6,11 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-07T04:47:58.000Z |
| 9 | -updatedAt: 2026-11-07T04:47:58.000Z | |
| 9 | +updatedAt: 2026-11-10T06:20:06.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::spike |
| 12 | 12 | - area::acp |
| 13 | 13 | - real-agents |
| 14 | -milestone: "M8 · Divers ajouts" | |
| 15 | 14 | epic: Client ACP |
| 16 | 15 | related: |
| 17 | 16 | - 24 |
| @@ -6,12 +6,11 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-07T04:47:58.000Z | 8 | createdAt: 2026-11-07T04:47:58.000Z |
| 9 | -updatedAt: 2026-11-07T04:47:58.000Z | 9 | +updatedAt: 2026-11-10T06:20:06.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::spike | 11 | - kind::spike |
| 12 | - area::acp | 12 | - area::acp |
| 13 | - real-agents | 13 | - real-agents |
| 14 | -milestone: "M8 · Divers ajouts" | ||
| 15 | epic: Client ACP | 14 | epic: Client ACP |
| 16 | related: | 15 | related: |
| 17 | - 24 | 16 | - 24 |
added
.tickets/issues/0070-gerer-les-fichiers-du-panel-agents-renommer-supp.yaml +72 -0 | new file mode 100644 | ||
| @@ -0,0 +1,72 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 70 | |
| 3 | +title: "Gérer les fichiers du panel Agents : renommer, supprimer, déplacer… un ou plusieurs fichiers" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::workspace | |
| 13 | + - area::ui | |
| 14 | + - citizen-ux | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Workspace des agents | |
| 17 | +body: | | |
| 18 | + Dans le panel d'un agent, onglet **Fichiers** ([FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte)), | |
| 19 | + on ne peut aujourd'hui que supprimer **un** fichier à la fois (🗑 + confirmation, `WorkspaceService.Remove`). | |
| 20 | + On doit pouvoir gérer les fichiers comme dans un explorateur. | |
| 21 | + | |
| 22 | + ## Critères d'acceptation | |
| 23 | + - **Renommer** un fichier ou un dossier (en place dans l'arbre, Entrée valide, Échap annule ; | |
| 24 | + nom déjà pris ou invalide → message clair). | |
| 25 | + - **Supprimer** un ou **plusieurs** fichiers / dossiers d'un coup, avec une seule confirmation | |
| 26 | + (corbeille en local, suppression définitive annoncée en sbx / container, comme aujourd'hui). | |
| 27 | + - **Sélection multiple** dans l'arbre : ⌘/Ctrl-clic, ⇧-clic pour une plage, au clavier aussi. | |
| 28 | + - Autres actions utiles (à confirmer) : nouveau fichier, nouveau dossier, dupliquer, déplacer | |
| 29 | + (glisser-déposer dans un dossier). | |
| 30 | + - Menu contextuel (clic droit) regroupant les actions, en plus des boutons. | |
| 31 | + - Fonctionne en local, dans sbx et dans un container (`Workspace` dans | |
| 32 | + [workspace.go](internal/workspace/workspace.go) : ajouter `Rename` / `Move`… aux implémentations | |
| 33 | + [local.go](internal/workspace/local.go) et [container.go](internal/workspace/container.go)), | |
| 34 | + avec les mêmes protections que la suppression ([protect.go](internal/workspace/protect.go)). | |
| 35 | + - Un fichier ouvert dans l'éditeur / l'aperçu suit son renommage, et se ferme s'il est supprimé. | |
| 36 | + - Tests Go + frontend ; textes EN + FR ; docs EN + FR. | |
| 37 | +tasks: [] | |
| 38 | +comments: | |
| 39 | + - id: 1 | |
| 40 | + author: | |
| 41 | + name: k33g | |
| 42 | + email: ph.charriere@gmail.com | |
| 43 | + createdAt: 2026-11-09T05:09:11.000Z | |
| 44 | + body: | | |
| 45 | + Fait. | |
| 46 | + - Go : `Rename` et `MakeDir` dans l'interface `Workspace` ([local.go](internal/workspace/local.go), | |
| 47 | + [container.go](internal/workspace/container.go)), dans les tests de contrat (local et container alpine) ; | |
| 48 | + `workspace.Outermost` (un chemin dans un autre de la liste est ignoré) ; `WorkspaceService.RemoveAll`, | |
| 49 | + `Rename`, `Move`, `CreateFolder` avec les protections (rien n'est supprimé si l'un est protégé). | |
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : sélection multiple (⌘/Ctrl-clic, ⇧-clic, ⌘A), | |
| 51 | + renommage en place (✏️, double-clic, F2 ; Entrée / Échap), déplacement par glisser-déposer ou | |
| 52 | + **Move to…**, nouveau dossier, suppression groupée avec une seule confirmation (Suppr, ⌘⌫), menu contextuel. | |
| 53 | + Un fichier ouvert suit son renommage ou son déplacement sans perdre ce qui est tapé. | |
| 54 | + Logique pure dans [fileSelection.ts](frontend/src/lib/fileSelection.ts), testée. | |
| 55 | + - Vérifié dans l'application (Linux, Xvfb) : colorisation, sélection, glisser-déposer, F2, menu, Move to…, | |
| 56 | + suppression de 2 fichiers vers la corbeille. | |
| 57 | + - Textes EN + FR ; guide « fichiers et terminal » et référence `WorkspaceService` EN + FR. | |
| 58 | + - id: 2 | |
| 59 | + author: | |
| 60 | + name: k33g | |
| 61 | + email: ph.charriere@gmail.com | |
| 62 | + createdAt: 2026-11-09T05:23:59.000Z | |
| 63 | + body: | | |
| 64 | + **Dupliquer** ajouté, à la demande. | |
| 65 | + - Go : `Workspace.Copy` (local : fichiers avec leurs droits, liens symboliques copiés comme liens ; | |
| 66 | + container / sbx : `cp -RPp`), dans les tests de contrat (local et alpine) ; `WorkspaceService.Duplicate` | |
| 67 | + copie à côté de l'original sous `<nom>-copy<.ext>`, puis `-copy-2`… ; un fichier protégé peut être dupliqué | |
| 68 | + (la copie ne l'est pas), une copie qui tomberait dans un dossier protégé est refusée. | |
| 69 | + - Interface : **Duplicate** dans le menu contextuel (une entrée ou la sélection) et ⌘D / Ctrl+D dans l'arbre ; | |
| 70 | + les copies deviennent la sélection. | |
| 71 | + - Vérifié dans l'application : dossier `notes` → `notes-copy` avec son contenu, `AGENTS.md` (protégé) → `AGENTS-copy.md`. | |
| 72 | + - Docs EN + FR (guide et référence). | |
| new file mode 100644 | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 70 | ||
| 3 | +title: "Gérer les fichiers du panel Agents : renommer, supprimer, déplacer… un ou plusieurs fichiers" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | ||
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::workspace | ||
| 13 | + - area::ui | ||
| 14 | + - citizen-ux | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Workspace des agents | ||
| 17 | +body: | | ||
| 18 | + Dans le panel d'un agent, onglet **Fichiers** ([FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte)), | ||
| 19 | + on ne peut aujourd'hui que supprimer **un** fichier à la fois (🗑 + confirmation, `WorkspaceService.Remove`). | ||
| 20 | + On doit pouvoir gérer les fichiers comme dans un explorateur. | ||
| 21 | + | ||
| 22 | + ## Critères d'acceptation | ||
| 23 | + - **Renommer** un fichier ou un dossier (en place dans l'arbre, Entrée valide, Échap annule ; | ||
| 24 | + nom déjà pris ou invalide → message clair). | ||
| 25 | + - **Supprimer** un ou **plusieurs** fichiers / dossiers d'un coup, avec une seule confirmation | ||
| 26 | + (corbeille en local, suppression définitive annoncée en sbx / container, comme aujourd'hui). | ||
| 27 | + - **Sélection multiple** dans l'arbre : ⌘/Ctrl-clic, ⇧-clic pour une plage, au clavier aussi. | ||
| 28 | + - Autres actions utiles (à confirmer) : nouveau fichier, nouveau dossier, dupliquer, déplacer | ||
| 29 | + (glisser-déposer dans un dossier). | ||
| 30 | + - Menu contextuel (clic droit) regroupant les actions, en plus des boutons. | ||
| 31 | + - Fonctionne en local, dans sbx et dans un container (`Workspace` dans | ||
| 32 | + [workspace.go](internal/workspace/workspace.go) : ajouter `Rename` / `Move`… aux implémentations | ||
| 33 | + [local.go](internal/workspace/local.go) et [container.go](internal/workspace/container.go)), | ||
| 34 | + avec les mêmes protections que la suppression ([protect.go](internal/workspace/protect.go)). | ||
| 35 | + - Un fichier ouvert dans l'éditeur / l'aperçu suit son renommage, et se ferme s'il est supprimé. | ||
| 36 | + - Tests Go + frontend ; textes EN + FR ; docs EN + FR. | ||
| 37 | +tasks: [] | ||
| 38 | +comments: | ||
| 39 | + - id: 1 | ||
| 40 | + author: | ||
| 41 | + name: k33g | ||
| 42 | + email: ph.charriere@gmail.com | ||
| 43 | + createdAt: 2026-11-09T05:09:11.000Z | ||
| 44 | + body: | | ||
| 45 | + Fait. | ||
| 46 | + - Go : `Rename` et `MakeDir` dans l'interface `Workspace` ([local.go](internal/workspace/local.go), | ||
| 47 | + [container.go](internal/workspace/container.go)), dans les tests de contrat (local et container alpine) ; | ||
| 48 | + `workspace.Outermost` (un chemin dans un autre de la liste est ignoré) ; `WorkspaceService.RemoveAll`, | ||
| 49 | + `Rename`, `Move`, `CreateFolder` avec les protections (rien n'est supprimé si l'un est protégé). | ||
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : sélection multiple (⌘/Ctrl-clic, ⇧-clic, ⌘A), | ||
| 51 | + renommage en place (✏️, double-clic, F2 ; Entrée / Échap), déplacement par glisser-déposer ou | ||
| 52 | + **Move to…**, nouveau dossier, suppression groupée avec une seule confirmation (Suppr, ⌘⌫), menu contextuel. | ||
| 53 | + Un fichier ouvert suit son renommage ou son déplacement sans perdre ce qui est tapé. | ||
| 54 | + Logique pure dans [fileSelection.ts](frontend/src/lib/fileSelection.ts), testée. | ||
| 55 | + - Vérifié dans l'application (Linux, Xvfb) : colorisation, sélection, glisser-déposer, F2, menu, Move to…, | ||
| 56 | + suppression de 2 fichiers vers la corbeille. | ||
| 57 | + - Textes EN + FR ; guide « fichiers et terminal » et référence `WorkspaceService` EN + FR. | ||
| 58 | + - id: 2 | ||
| 59 | + author: | ||
| 60 | + name: k33g | ||
| 61 | + email: ph.charriere@gmail.com | ||
| 62 | + createdAt: 2026-11-09T05:23:59.000Z | ||
| 63 | + body: | | ||
| 64 | + **Dupliquer** ajouté, à la demande. | ||
| 65 | + - Go : `Workspace.Copy` (local : fichiers avec leurs droits, liens symboliques copiés comme liens ; | ||
| 66 | + container / sbx : `cp -RPp`), dans les tests de contrat (local et alpine) ; `WorkspaceService.Duplicate` | ||
| 67 | + copie à côté de l'original sous `<nom>-copy<.ext>`, puis `-copy-2`… ; un fichier protégé peut être dupliqué | ||
| 68 | + (la copie ne l'est pas), une copie qui tomberait dans un dossier protégé est refusée. | ||
| 69 | + - Interface : **Duplicate** dans le menu contextuel (une entrée ou la sélection) et ⌘D / Ctrl+D dans l'arbre ; | ||
| 70 | + les copies deviennent la sélection. | ||
| 71 | + - Vérifié dans l'application : dossier `notes` → `notes-copy` avec son contenu, `AGENTS.md` (protégé) → `AGENTS-copy.md`. | ||
| 72 | + - Docs EN + FR (guide et référence). | ||
added
.tickets/issues/0071-colorisation-syntaxique-des-fichiers-de-code-sou.yaml +49 -0 | new file mode 100644 | ||
| @@ -0,0 +1,49 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 71 | |
| 3 | +title: Colorisation syntaxique des fichiers de code source sélectionnés dans le panel Agents | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::workspace | |
| 13 | + - area::ui | |
| 14 | +milestone: "M8 · Divers ajouts" | |
| 15 | +epic: Workspace des agents | |
| 16 | +body: | | |
| 17 | + Quand on sélectionne un fichier dans l'arbre du panel d'un agent, s'il s'agit de code source | |
| 18 | + (`.go`, `.ts`, `.js`, `.py`, `.rs`, `.sh`, `.yaml`, `.json`…), il doit s'afficher avec la | |
| 19 | + **colorisation syntaxique**. | |
| 20 | + | |
| 21 | + Shiki est déjà utilisé pour les blocs de code des conversations | |
| 22 | + ([markdown.ts](frontend/src/lib/markdown.ts), thèmes clair / sombre) : le réutiliser dans | |
| 23 | + [FilePreview.svelte](frontend/src/lib/agent/FilePreview.svelte) / [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte). | |
| 24 | + | |
| 25 | + ## Critères d'acceptation | |
| 26 | + - Langage déduit de l'extension (et de quelques noms connus : `Makefile`, `Dockerfile`…) ; | |
| 27 | + fichier inconnu → texte brut, comme aujourd'hui. | |
| 28 | + - Suit le thème clair / sombre de l'application. | |
| 29 | + - En édition aussi, ou au moins en lecture (à décider : éditeur coloré type CodeMirror vs aperçu coloré). | |
| 30 | + - Les langages ajoutés sont chargés à la demande pour ne pas alourdir le démarrage ; | |
| 31 | + gros fichiers : pas de blocage de l'interface (limite de taille au-delà de laquelle on reste en brut). | |
| 32 | + - Tests frontend ; docs EN + FR si elles décrivent l'aperçu des fichiers. | |
| 33 | +tasks: [] | |
| 34 | +comments: | |
| 35 | + - id: 1 | |
| 36 | + author: | |
| 37 | + name: k33g | |
| 38 | + email: ph.charriere@gmail.com | |
| 39 | + createdAt: 2026-11-09T04:49:17.000Z | |
| 40 | + body: | | |
| 41 | + Fait, dans l'éditeur CodeMirror (coloré en lecture comme en édition, plutôt qu'un aperçu Shiki à part). | |
| 42 | + - [files.ts](frontend/src/lib/files.ts) : `languageFor` reconnaît ~30 langages par extension | |
| 43 | + et par nom (`Dockerfile`, `Makefile`, `.env`, `go.mod`…), `text` sinon. | |
| 44 | + - [editorLanguages.ts](frontend/src/lib/editorLanguages.ts) : chaque langage est chargé à la demande | |
| 45 | + (`@codemirror/lang-*`, `@codemirror/legacy-modes` pour shell, TOML, Dockerfile, Ruby, Swift…) ; | |
| 46 | + au-delà de 512 Ko le fichier reste en texte brut. | |
| 47 | + - [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte) : langage dans un `Compartment`, appliqué une fois chargé. | |
| 48 | + - Le thème suit maintenant `ui.theme` (`isDark` dans [theme.ts](frontend/src/lib/theme.ts)), aussi dans Settings. | |
| 49 | + - Tests vitest (chaque langage se charge) ; guide « fichiers et terminal » EN + FR. | |
| new file mode 100644 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 71 | ||
| 3 | +title: Colorisation syntaxique des fichiers de code source sélectionnés dans le panel Agents | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | ||
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::workspace | ||
| 13 | + - area::ui | ||
| 14 | +milestone: "M8 · Divers ajouts" | ||
| 15 | +epic: Workspace des agents | ||
| 16 | +body: | | ||
| 17 | + Quand on sélectionne un fichier dans l'arbre du panel d'un agent, s'il s'agit de code source | ||
| 18 | + (`.go`, `.ts`, `.js`, `.py`, `.rs`, `.sh`, `.yaml`, `.json`…), il doit s'afficher avec la | ||
| 19 | + **colorisation syntaxique**. | ||
| 20 | + | ||
| 21 | + Shiki est déjà utilisé pour les blocs de code des conversations | ||
| 22 | + ([markdown.ts](frontend/src/lib/markdown.ts), thèmes clair / sombre) : le réutiliser dans | ||
| 23 | + [FilePreview.svelte](frontend/src/lib/agent/FilePreview.svelte) / [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte). | ||
| 24 | + | ||
| 25 | + ## Critères d'acceptation | ||
| 26 | + - Langage déduit de l'extension (et de quelques noms connus : `Makefile`, `Dockerfile`…) ; | ||
| 27 | + fichier inconnu → texte brut, comme aujourd'hui. | ||
| 28 | + - Suit le thème clair / sombre de l'application. | ||
| 29 | + - En édition aussi, ou au moins en lecture (à décider : éditeur coloré type CodeMirror vs aperçu coloré). | ||
| 30 | + - Les langages ajoutés sont chargés à la demande pour ne pas alourdir le démarrage ; | ||
| 31 | + gros fichiers : pas de blocage de l'interface (limite de taille au-delà de laquelle on reste en brut). | ||
| 32 | + - Tests frontend ; docs EN + FR si elles décrivent l'aperçu des fichiers. | ||
| 33 | +tasks: [] | ||
| 34 | +comments: | ||
| 35 | + - id: 1 | ||
| 36 | + author: | ||
| 37 | + name: k33g | ||
| 38 | + email: ph.charriere@gmail.com | ||
| 39 | + createdAt: 2026-11-09T04:49:17.000Z | ||
| 40 | + body: | | ||
| 41 | + Fait, dans l'éditeur CodeMirror (coloré en lecture comme en édition, plutôt qu'un aperçu Shiki à part). | ||
| 42 | + - [files.ts](frontend/src/lib/files.ts) : `languageFor` reconnaît ~30 langages par extension | ||
| 43 | + et par nom (`Dockerfile`, `Makefile`, `.env`, `go.mod`…), `text` sinon. | ||
| 44 | + - [editorLanguages.ts](frontend/src/lib/editorLanguages.ts) : chaque langage est chargé à la demande | ||
| 45 | + (`@codemirror/lang-*`, `@codemirror/legacy-modes` pour shell, TOML, Dockerfile, Ruby, Swift…) ; | ||
| 46 | + au-delà de 512 Ko le fichier reste en texte brut. | ||
| 47 | + - [FileEditor.svelte](frontend/src/lib/agent/FileEditor.svelte) : langage dans un `Compartment`, appliqué une fois chargé. | ||
| 48 | + - Le thème suit maintenant `ui.theme` (`isDark` dans [theme.ts](frontend/src/lib/theme.ts)), aussi dans Settings. | ||
| 49 | + - Tests vitest (chaque langage se charge) ; guide « fichiers et terminal » EN + FR. | ||
added
.tickets/issues/0072-garder-les-terminaux-ouverts-et-leur-contenu-qua.yaml +57 -0 | new file mode 100644 | ||
| @@ -0,0 +1,57 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 72 | |
| 3 | +title: Garder les terminaux ouverts et ce qui tourne dedans quand on va ailleurs | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::workspace | |
| 13 | + - area::ui | |
| 14 | + - citizen-ux | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Workspace des agents | |
| 17 | +related: | |
| 18 | + - 73 | |
| 19 | +body: | | |
| 20 | + Si un ou plusieurs terminaux sont ouverts, on doit garder **leur état** (historique affiché, | |
| 21 | + position, taille) et **ce qui tourne à l'intérieur** (process en cours) même si l'on clique | |
| 22 | + ailleurs : une conversation, un channel, un autre agent, les Settings… | |
| 23 | + | |
| 24 | + Aujourd'hui [TerminalView.svelte](frontend/src/lib/agent/TerminalView.svelte) vit dans | |
| 25 | + [AgentView.svelte](frontend/src/lib/agent/AgentView.svelte) : il reste monté quand on change | |
| 26 | + d'onglet dans l'agent, mais la vue de l'agent est démontée quand on change de vue, et la sortie | |
| 27 | + arrivée pendant ce temps n'est plus routée ([terminals.ts](frontend/src/lib/terminals.ts)). | |
| 28 | + | |
| 29 | + ## Critères d'acceptation | |
| 30 | + - Lancer `top` (ou un long build) dans le terminal d'un agent, aller dans une conversation puis | |
| 31 | + sur un autre agent, revenir : le process tourne toujours et l'écran est à jour, sans trou. | |
| 32 | + - Idem pour plusieurs agents ayant chacun un terminal ouvert (et plusieurs terminaux par agent, #73). | |
| 33 | + - La sortie reçue quand le terminal n'est pas visible est conservée (xterm.js gardé en vie hors | |
| 34 | + de la vue, ou tampon borné rejoué au retour). | |
| 35 | + - Le terminal ne se ferme que si l'utilisateur le ferme, si le shell se termine, si l'agent / la | |
| 36 | + sandbox est arrêté, ou à la fermeture de l'application. | |
| 37 | + - Un indicateur dans le panneau de gauche montre qu'un agent a des terminaux ouverts (à confirmer). | |
| 38 | + - Tests frontend ; docs EN + FR. | |
| 39 | +tasks: [] | |
| 40 | +comments: | |
| 41 | + - id: 1 | |
| 42 | + author: | |
| 43 | + name: k33g | |
| 44 | + email: ph.charriere@gmail.com | |
| 45 | + createdAt: 2026-11-09T05:17:35.000Z | |
| 46 | + body: | | |
| 47 | + Fait (avec #73, même commit : le même code). | |
| 48 | + - [terminalSessions.svelte.ts](frontend/src/lib/terminalSessions.svelte.ts) : les terminaux vivent hors de la vue de | |
| 49 | + l'agent ; chaque écran xterm.js a son propre élément, que [TerminalView.svelte](frontend/src/lib/agent/TerminalView.svelte) | |
| 50 | + déplace dans la page et rend en partant. Ce que le shell affiche pendant ce temps est écrit dans l'écran. | |
| 51 | + - La vue de l'agent se souvient de l'onglet affiché : en revenant, on retombe sur les terminaux. | |
| 52 | + - Indicateurs : nombre de terminaux en cours sur l'onglet **Terminal** et **⌨ n** sur la ligne de l'agent. | |
| 53 | + - Un terminal ne s'arrête que s'il est fermé, si son shell se termine, à l'ouverture d'un autre fichier de | |
| 54 | + configuration ou à la fermeture de Sidekicks. | |
| 55 | + - Vérifié dans l'application (Linux, Xvfb) : une boucle `echo tick` continue pendant 6 s passées dans la | |
| 56 | + conversation, l'écran est complet au retour ; quitter Sidekicks ne laisse aucun shell. | |
| 57 | + - Docs EN + FR (guide et explication). | |
| new file mode 100644 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 72 | ||
| 3 | +title: Garder les terminaux ouverts et ce qui tourne dedans quand on va ailleurs | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | ||
| 9 | +updatedAt: 2026-11-09T06:42:39.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::workspace | ||
| 13 | + - area::ui | ||
| 14 | + - citizen-ux | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Workspace des agents | ||
| 17 | +related: | ||
| 18 | + - 73 | ||
| 19 | +body: | | ||
| 20 | + Si un ou plusieurs terminaux sont ouverts, on doit garder **leur état** (historique affiché, | ||
| 21 | + position, taille) et **ce qui tourne à l'intérieur** (process en cours) même si l'on clique | ||
| 22 | + ailleurs : une conversation, un channel, un autre agent, les Settings… | ||
| 23 | + | ||
| 24 | + Aujourd'hui [TerminalView.svelte](frontend/src/lib/agent/TerminalView.svelte) vit dans | ||
| 25 | + [AgentView.svelte](frontend/src/lib/agent/AgentView.svelte) : il reste monté quand on change | ||
| 26 | + d'onglet dans l'agent, mais la vue de l'agent est démontée quand on change de vue, et la sortie | ||
| 27 | + arrivée pendant ce temps n'est plus routée ([terminals.ts](frontend/src/lib/terminals.ts)). | ||
| 28 | + | ||
| 29 | + ## Critères d'acceptation | ||
| 30 | + - Lancer `top` (ou un long build) dans le terminal d'un agent, aller dans une conversation puis | ||
| 31 | + sur un autre agent, revenir : le process tourne toujours et l'écran est à jour, sans trou. | ||
| 32 | + - Idem pour plusieurs agents ayant chacun un terminal ouvert (et plusieurs terminaux par agent, #73). | ||
| 33 | + - La sortie reçue quand le terminal n'est pas visible est conservée (xterm.js gardé en vie hors | ||
| 34 | + de la vue, ou tampon borné rejoué au retour). | ||
| 35 | + - Le terminal ne se ferme que si l'utilisateur le ferme, si le shell se termine, si l'agent / la | ||
| 36 | + sandbox est arrêté, ou à la fermeture de l'application. | ||
| 37 | + - Un indicateur dans le panneau de gauche montre qu'un agent a des terminaux ouverts (à confirmer). | ||
| 38 | + - Tests frontend ; docs EN + FR. | ||
| 39 | +tasks: [] | ||
| 40 | +comments: | ||
| 41 | + - id: 1 | ||
| 42 | + author: | ||
| 43 | + name: k33g | ||
| 44 | + email: ph.charriere@gmail.com | ||
| 45 | + createdAt: 2026-11-09T05:17:35.000Z | ||
| 46 | + body: | | ||
| 47 | + Fait (avec #73, même commit : le même code). | ||
| 48 | + - [terminalSessions.svelte.ts](frontend/src/lib/terminalSessions.svelte.ts) : les terminaux vivent hors de la vue de | ||
| 49 | + l'agent ; chaque écran xterm.js a son propre élément, que [TerminalView.svelte](frontend/src/lib/agent/TerminalView.svelte) | ||
| 50 | + déplace dans la page et rend en partant. Ce que le shell affiche pendant ce temps est écrit dans l'écran. | ||
| 51 | + - La vue de l'agent se souvient de l'onglet affiché : en revenant, on retombe sur les terminaux. | ||
| 52 | + - Indicateurs : nombre de terminaux en cours sur l'onglet **Terminal** et **⌨ n** sur la ligne de l'agent. | ||
| 53 | + - Un terminal ne s'arrête que s'il est fermé, si son shell se termine, à l'ouverture d'un autre fichier de | ||
| 54 | + configuration ou à la fermeture de Sidekicks. | ||
| 55 | + - Vérifié dans l'application (Linux, Xvfb) : une boucle `echo tick` continue pendant 6 s passées dans la | ||
| 56 | + conversation, l'écran est complet au retour ; quitter Sidekicks ne laisse aucun shell. | ||
| 57 | + - Docs EN + FR (guide et explication). | ||
added
.tickets/issues/0073-ouvrir-plusieurs-terminaux-pour-un-meme-agent.yaml +49 -0 | new file mode 100644 | ||
| @@ -0,0 +1,49 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 73 | |
| 3 | +title: Ouvrir plusieurs terminaux pour un même agent | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T05:24:52.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::workspace | |
| 13 | + - area::ui | |
| 14 | +milestone: "M8 · Divers ajouts" | |
| 15 | +epic: Workspace des agents | |
| 16 | +body: | | |
| 17 | + On doit pouvoir ouvrir **plusieurs terminaux** pour un même agent (par ex. un serveur qui tourne | |
| 18 | + dans l'un, des commandes dans l'autre). | |
| 19 | + | |
| 20 | + Côté Go, [terminals.go](internal/workspace/terminals.go) identifie déjà chaque terminal par un id ; | |
| 21 | + côté interface, [AgentView.svelte](frontend/src/lib/agent/AgentView.svelte) n'en affiche qu'un | |
| 22 | + (`terminalOpened`). | |
| 23 | + | |
| 24 | + ## Critères d'acceptation | |
| 25 | + - Un bouton **+** ouvre un nouveau terminal ; les terminaux de l'agent s'affichent en sous-onglets | |
| 26 | + (« Terminal 1 », « Terminal 2 »…, renommables à confirmer), chacun avec un bouton de fermeture. | |
| 27 | + - Chaque terminal a son propre shell / process, en local, dans sbx et dans un container. | |
| 28 | + - Fermer un terminal termine son shell et ses descendants, sans toucher aux autres. | |
| 29 | + - Un terminal dont le shell s'est terminé l'indique et peut être relancé ou fermé. | |
| 30 | + - Compatible avec la conservation des terminaux quand on va ailleurs (#72). | |
| 31 | + - Limite raisonnable du nombre de terminaux par agent (à définir), avec message si atteinte. | |
| 32 | + - Tests Go + frontend ; textes EN + FR ; docs EN + FR. | |
| 33 | +tasks: [] | |
| 34 | +comments: | |
| 35 | + - id: 1 | |
| 36 | + author: | |
| 37 | + name: k33g | |
| 38 | + email: ph.charriere@gmail.com | |
| 39 | + createdAt: 2026-11-09T05:17:35.000Z | |
| 40 | + body: | | |
| 41 | + Fait (avec #72, même commit). | |
| 42 | + - Sous-onglets *Terminal 1*, *Terminal 2*… (le plus petit numéro libre), **+** pour en ouvrir un autre | |
| 43 | + (8 au plus par agent, `maxTerminalsPerAgent` dans [terminals.ts](frontend/src/lib/terminals.ts)), **×** pour en fermer un | |
| 44 | + (son shell et ses descendants s'arrêtent, les autres continuent). Le premier passage sur l'onglet en ouvre un. | |
| 45 | + - Un terminal dont le shell est terminé est barré, avec **Open a new shell**. | |
| 46 | + - Rien à changer côté Go : chaque terminal avait déjà son id. | |
| 47 | + - Pas fait : renommer un terminal. | |
| 48 | + - Vérifié dans l'application : 3 terminaux, fermeture de l'un (3 → 2 shells), `exit` puis relance. | |
| 49 | + - Test vitest (numérotation) ; textes EN + FR ; docs EN + FR. | |
| new file mode 100644 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 73 | ||
| 3 | +title: Ouvrir plusieurs terminaux pour un même agent | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:24:52.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::workspace | ||
| 13 | + - area::ui | ||
| 14 | +milestone: "M8 · Divers ajouts" | ||
| 15 | +epic: Workspace des agents | ||
| 16 | +body: | | ||
| 17 | + On doit pouvoir ouvrir **plusieurs terminaux** pour un même agent (par ex. un serveur qui tourne | ||
| 18 | + dans l'un, des commandes dans l'autre). | ||
| 19 | + | ||
| 20 | + Côté Go, [terminals.go](internal/workspace/terminals.go) identifie déjà chaque terminal par un id ; | ||
| 21 | + côté interface, [AgentView.svelte](frontend/src/lib/agent/AgentView.svelte) n'en affiche qu'un | ||
| 22 | + (`terminalOpened`). | ||
| 23 | + | ||
| 24 | + ## Critères d'acceptation | ||
| 25 | + - Un bouton **+** ouvre un nouveau terminal ; les terminaux de l'agent s'affichent en sous-onglets | ||
| 26 | + (« Terminal 1 », « Terminal 2 »…, renommables à confirmer), chacun avec un bouton de fermeture. | ||
| 27 | + - Chaque terminal a son propre shell / process, en local, dans sbx et dans un container. | ||
| 28 | + - Fermer un terminal termine son shell et ses descendants, sans toucher aux autres. | ||
| 29 | + - Un terminal dont le shell s'est terminé l'indique et peut être relancé ou fermé. | ||
| 30 | + - Compatible avec la conservation des terminaux quand on va ailleurs (#72). | ||
| 31 | + - Limite raisonnable du nombre de terminaux par agent (à définir), avec message si atteinte. | ||
| 32 | + - Tests Go + frontend ; textes EN + FR ; docs EN + FR. | ||
| 33 | +tasks: [] | ||
| 34 | +comments: | ||
| 35 | + - id: 1 | ||
| 36 | + author: | ||
| 37 | + name: k33g | ||
| 38 | + email: ph.charriere@gmail.com | ||
| 39 | + createdAt: 2026-11-09T05:17:35.000Z | ||
| 40 | + body: | | ||
| 41 | + Fait (avec #72, même commit). | ||
| 42 | + - Sous-onglets *Terminal 1*, *Terminal 2*… (le plus petit numéro libre), **+** pour en ouvrir un autre | ||
| 43 | + (8 au plus par agent, `maxTerminalsPerAgent` dans [terminals.ts](frontend/src/lib/terminals.ts)), **×** pour en fermer un | ||
| 44 | + (son shell et ses descendants s'arrêtent, les autres continuent). Le premier passage sur l'onglet en ouvre un. | ||
| 45 | + - Un terminal dont le shell est terminé est barré, avec **Open a new shell**. | ||
| 46 | + - Rien à changer côté Go : chaque terminal avait déjà son id. | ||
| 47 | + - Pas fait : renommer un terminal. | ||
| 48 | + - Vérifié dans l'application : 3 terminaux, fermeture de l'un (3 → 2 shells), `exit` puis relance. | ||
| 49 | + - Test vitest (numérotation) ; textes EN + FR ; docs EN + FR. | ||
added
.tickets/issues/0074-bouton-show-where-it-is-dans-l-arbre-des-fichier.yaml +54 -0 | new file mode 100644 | ||
| @@ -0,0 +1,54 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 74 | |
| 3 | +title: "Bouton « Show where it is » dans l'arbre des fichiers d'un agent" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | |
| 9 | +updatedAt: 2026-11-09T05:24:52.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::workspace | |
| 13 | + - area::ui | |
| 14 | + - citizen-ux | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Workspace des agents | |
| 17 | +related: | |
| 18 | + - 65 | |
| 19 | + - 70 | |
| 20 | +body: | | |
| 21 | + Dans l'arbre des fichiers du panel d'un agent ([FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte)), | |
| 22 | + ajouter un bouton **Show where it is** (« Afficher l'emplacement ») qui montre le fichier ou le | |
| 23 | + dossier dans le gestionnaire de fichiers du système : Finder (macOS), Explorateur (Windows), | |
| 24 | + gestionnaire de fichiers (Linux). | |
| 25 | + | |
| 26 | + La fonction existe déjà pour les fichiers liés ouverts à côté de la conversation (#65) : | |
| 27 | + `WorkspaceService.Reveal` et `RevealCommand` dans [links.go](internal/app/links.go). La réutiliser. | |
| 28 | + | |
| 29 | + ## Critères d'acceptation | |
| 30 | + - Bouton sur chaque fichier / dossier de l'arbre (au survol, comme 🗑) et dans le menu contextuel (#70), | |
| 31 | + ainsi que dans l'en-tête du fichier ouvert. | |
| 32 | + - Le gestionnaire de fichiers s'ouvre sur le dossier, l'élément sélectionné. | |
| 33 | + - Uniquement quand le fichier est sur cet ordinateur (`Revealable`) : agents locaux, ou dossier | |
| 34 | + monté depuis l'hôte pour sbx ; caché (ou désactivé avec infobulle) pour un fichier seulement dans | |
| 35 | + un container. | |
| 36 | + - Libellé adapté au système (« Afficher dans le Finder », « Afficher dans l'Explorateur »…), EN + FR. | |
| 37 | + - Tests Go + frontend ; docs EN + FR. | |
| 38 | +tasks: [] | |
| 39 | +comments: | |
| 40 | + - id: 1 | |
| 41 | + author: | |
| 42 | + name: k33g | |
| 43 | + email: ph.charriere@gmail.com | |
| 44 | + createdAt: 2026-11-09T04:50:50.000Z | |
| 45 | + body: | | |
| 46 | + Fait. | |
| 47 | + - Go : `WorkspaceInfo.Revealable` ([workspaces.go](internal/app/workspaces.go)) dit si le dossier de | |
| 48 | + l'agent est sur cet ordinateur (même règle que `hostFile` des fichiers liés) ; le bouton appelle | |
| 49 | + `WorkspaceService.Reveal`, déjà là. | |
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : **📂** au survol (et au focus clavier) de chaque | |
| 51 | + entrée, à côté de 🗑, et **📂 Show where it is** au-dessus du fichier ouvert ; caché sinon. | |
| 52 | + - Libellé : le même que le panneau des fichiers liés (« Show where it is » / « Afficher l'emplacement »), | |
| 53 | + pas de variante par système. Le menu contextuel viendra avec #70. | |
| 54 | + - Test Go ; guide « fichiers et terminal » EN + FR. | |
| new file mode 100644 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 74 | ||
| 3 | +title: "Bouton « Show where it is » dans l'arbre des fichiers d'un agent" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T04:42:57.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:24:52.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::workspace | ||
| 13 | + - area::ui | ||
| 14 | + - citizen-ux | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Workspace des agents | ||
| 17 | +related: | ||
| 18 | + - 65 | ||
| 19 | + - 70 | ||
| 20 | +body: | | ||
| 21 | + Dans l'arbre des fichiers du panel d'un agent ([FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte)), | ||
| 22 | + ajouter un bouton **Show where it is** (« Afficher l'emplacement ») qui montre le fichier ou le | ||
| 23 | + dossier dans le gestionnaire de fichiers du système : Finder (macOS), Explorateur (Windows), | ||
| 24 | + gestionnaire de fichiers (Linux). | ||
| 25 | + | ||
| 26 | + La fonction existe déjà pour les fichiers liés ouverts à côté de la conversation (#65) : | ||
| 27 | + `WorkspaceService.Reveal` et `RevealCommand` dans [links.go](internal/app/links.go). La réutiliser. | ||
| 28 | + | ||
| 29 | + ## Critères d'acceptation | ||
| 30 | + - Bouton sur chaque fichier / dossier de l'arbre (au survol, comme 🗑) et dans le menu contextuel (#70), | ||
| 31 | + ainsi que dans l'en-tête du fichier ouvert. | ||
| 32 | + - Le gestionnaire de fichiers s'ouvre sur le dossier, l'élément sélectionné. | ||
| 33 | + - Uniquement quand le fichier est sur cet ordinateur (`Revealable`) : agents locaux, ou dossier | ||
| 34 | + monté depuis l'hôte pour sbx ; caché (ou désactivé avec infobulle) pour un fichier seulement dans | ||
| 35 | + un container. | ||
| 36 | + - Libellé adapté au système (« Afficher dans le Finder », « Afficher dans l'Explorateur »…), EN + FR. | ||
| 37 | + - Tests Go + frontend ; docs EN + FR. | ||
| 38 | +tasks: [] | ||
| 39 | +comments: | ||
| 40 | + - id: 1 | ||
| 41 | + author: | ||
| 42 | + name: k33g | ||
| 43 | + email: ph.charriere@gmail.com | ||
| 44 | + createdAt: 2026-11-09T04:50:50.000Z | ||
| 45 | + body: | | ||
| 46 | + Fait. | ||
| 47 | + - Go : `WorkspaceInfo.Revealable` ([workspaces.go](internal/app/workspaces.go)) dit si le dossier de | ||
| 48 | + l'agent est sur cet ordinateur (même règle que `hostFile` des fichiers liés) ; le bouton appelle | ||
| 49 | + `WorkspaceService.Reveal`, déjà là. | ||
| 50 | + - [FilesTab.svelte](frontend/src/lib/agent/FilesTab.svelte) : **📂** au survol (et au focus clavier) de chaque | ||
| 51 | + entrée, à côté de 🗑, et **📂 Show where it is** au-dessus du fichier ouvert ; caché sinon. | ||
| 52 | + - Libellé : le même que le panneau des fichiers liés (« Show where it is » / « Afficher l'emplacement »), | ||
| 53 | + pas de variante par système. Le menu contextuel viendra avec #70. | ||
| 54 | + - Test Go ; guide « fichiers et terminal » EN + FR. | ||
added
.tickets/issues/0075-memoire-collective-api-rest-de-recherche-dans-la-ba.yaml +30 -0 | new file mode 100644 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 75 | |
| 3 | +title: "Mémoire collective : exposer une API REST de recherche dans la base de Sidekicks" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::persistence | |
| 13 | +epic: External applications | |
| 14 | +related: | |
| 15 | + - 76 | |
| 16 | +body: | | |
| 17 | + Sidekicks garde l'historique des channels et des conversations directes dans Pebble | |
| 18 | + ([internal/store](internal/store/store.go)). Cette base est une **mémoire collective** : ce que les agents | |
| 19 | + et l'utilisateur se sont dit. L'exposer via une **API REST de recherche** permettrait à des agents | |
| 20 | + (ou à d'autres outils) de la consulter. | |
| 21 | + | |
| 22 | + ## À définir | |
| 23 | + - Ce qui est cherchable : messages, channels, agents, fichiers liés ; filtres (channel, agent, dates). | |
| 24 | + - Le type de recherche : texte simple, index plein texte, sémantique (embeddings, modèle local) ? | |
| 25 | + - Sécurité : écoute sur `127.0.0.1` seulement, jeton, droits par agent (un agent ne lit que ses channels ?). | |
| 26 | + - Démarrage : option de configuration (`api: { listen, token }`), désactivée par défaut. | |
| 27 | + - Format : endpoints, pagination, schéma OpenAPI. | |
| 28 | + - Lien avec un éventuel mode MCP (#76) : la même recherche exposée comme outil MCP. | |
| 29 | +tasks: [] | |
| 30 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 75 | ||
| 3 | +title: "Mémoire collective : exposer une API REST de recherche dans la base de Sidekicks" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::persistence | ||
| 13 | +epic: External applications | ||
| 14 | +related: | ||
| 15 | + - 76 | ||
| 16 | +body: | | ||
| 17 | + Sidekicks garde l'historique des channels et des conversations directes dans Pebble | ||
| 18 | + ([internal/store](internal/store/store.go)). Cette base est une **mémoire collective** : ce que les agents | ||
| 19 | + et l'utilisateur se sont dit. L'exposer via une **API REST de recherche** permettrait à des agents | ||
| 20 | + (ou à d'autres outils) de la consulter. | ||
| 21 | + | ||
| 22 | + ## À définir | ||
| 23 | + - Ce qui est cherchable : messages, channels, agents, fichiers liés ; filtres (channel, agent, dates). | ||
| 24 | + - Le type de recherche : texte simple, index plein texte, sémantique (embeddings, modèle local) ? | ||
| 25 | + - Sécurité : écoute sur `127.0.0.1` seulement, jeton, droits par agent (un agent ne lit que ses channels ?). | ||
| 26 | + - Démarrage : option de configuration (`api: { listen, token }`), désactivée par défaut. | ||
| 27 | + - Format : endpoints, pagination, schéma OpenAPI. | ||
| 28 | + - Lien avec un éventuel mode MCP (#76) : la même recherche exposée comme outil MCP. | ||
| 29 | +tasks: [] | ||
| 30 | +comments: [] | ||
added
.tickets/issues/0076-question-un-mode-mcp-pour-sidekicks-a-t-il-un-inter.yaml +28 -0 | new file mode 100644 | ||
| @@ -0,0 +1,28 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 76 | |
| 3 | +title: "Question : est-ce que cela a un intérêt que Sidekicks ait un mode MCP ?" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::spike | |
| 12 | + - question | |
| 13 | +epic: External applications | |
| 14 | +body: | | |
| 15 | + Sidekicks pourrait exposer un **serveur MCP** : les agents (ou d'autres clients MCP) appelleraient | |
| 16 | + des outils de Sidekicks — chercher dans la mémoire collective (#75), poster dans un channel, | |
| 17 | + mentionner un autre agent, lire les fichiers d'un agent… | |
| 18 | + | |
| 19 | + ## Questions | |
| 20 | + - Quels cas d'usage concrets, pour le citizen user ? | |
| 21 | + - Transport : stdio (Sidekicks lancé par l'agent ?) ou HTTP streamable (Sidekicks déjà ouvert) ? | |
| 22 | + - Les agents ACP reçoivent déjà des `mcpServers` à `session/new` : Sidekicks peut-il s'y déclarer | |
| 23 | + lui-même ? (mm ignore `mcpServers` aujourd'hui.) | |
| 24 | + - Risques : un agent qui pilote Sidekicks, permissions. | |
| 25 | + | |
| 26 | + Résultat attendu : une décision (ADR) — oui / non / plus tard. | |
| 27 | +tasks: [] | |
| 28 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 76 | ||
| 3 | +title: "Question : est-ce que cela a un intérêt que Sidekicks ait un mode MCP ?" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::spike | ||
| 12 | + - question | ||
| 13 | +epic: External applications | ||
| 14 | +body: | | ||
| 15 | + Sidekicks pourrait exposer un **serveur MCP** : les agents (ou d'autres clients MCP) appelleraient | ||
| 16 | + des outils de Sidekicks — chercher dans la mémoire collective (#75), poster dans un channel, | ||
| 17 | + mentionner un autre agent, lire les fichiers d'un agent… | ||
| 18 | + | ||
| 19 | + ## Questions | ||
| 20 | + - Quels cas d'usage concrets, pour le citizen user ? | ||
| 21 | + - Transport : stdio (Sidekicks lancé par l'agent ?) ou HTTP streamable (Sidekicks déjà ouvert) ? | ||
| 22 | + - Les agents ACP reçoivent déjà des `mcpServers` à `session/new` : Sidekicks peut-il s'y déclarer | ||
| 23 | + lui-même ? (mm ignore `mcpServers` aujourd'hui.) | ||
| 24 | + - Risques : un agent qui pilote Sidekicks, permissions. | ||
| 25 | + | ||
| 26 | + Résultat attendu : une décision (ADR) — oui / non / plus tard. | ||
| 27 | +tasks: [] | ||
| 28 | +comments: [] | ||
added
.tickets/issues/0077-permettre-a-sidekicks-de-fonctionner-comme-une-mcp-g.yaml +28 -0 | new file mode 100644 | ||
| @@ -0,0 +1,28 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 77 | |
| 3 | +title: "Permettre à Sidekicks de fonctionner comme une MCP gateway" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | +epic: External applications | |
| 13 | +related: | |
| 14 | + - 76 | |
| 15 | +body: | | |
| 16 | + Sidekicks déclarerait une fois des serveurs MCP (outils, API, bases…) et les **relaierait** à ses agents, | |
| 17 | + comme une **MCP gateway** : configuration centralisée, choix des outils par agent, journal des appels, | |
| 18 | + permissions dans l'interface. | |
| 19 | + | |
| 20 | + ## À définir | |
| 21 | + - Configuration : `mcpServers` globaux, puis par agent (lesquels, quels outils). | |
| 22 | + - Passage aux agents : via `mcpServers` de `session/new` (ACP) en pointant sur la gateway. | |
| 23 | + - Lancement et cycle de vie des serveurs MCP (stdio, HTTP, containers). | |
| 24 | + - Permissions et journal visibles dans Sidekicks ; secrets (jetons) hors du YAML. | |
| 25 | + - Ce qui existe déjà (Docker MCP Gateway…) : réutiliser plutôt que refaire ? | |
| 26 | + - Dépend de la décision de #76. | |
| 27 | +tasks: [] | |
| 28 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 77 | ||
| 3 | +title: "Permettre à Sidekicks de fonctionner comme une MCP gateway" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | +epic: External applications | ||
| 13 | +related: | ||
| 14 | + - 76 | ||
| 15 | +body: | | ||
| 16 | + Sidekicks déclarerait une fois des serveurs MCP (outils, API, bases…) et les **relaierait** à ses agents, | ||
| 17 | + comme une **MCP gateway** : configuration centralisée, choix des outils par agent, journal des appels, | ||
| 18 | + permissions dans l'interface. | ||
| 19 | + | ||
| 20 | + ## À définir | ||
| 21 | + - Configuration : `mcpServers` globaux, puis par agent (lesquels, quels outils). | ||
| 22 | + - Passage aux agents : via `mcpServers` de `session/new` (ACP) en pointant sur la gateway. | ||
| 23 | + - Lancement et cycle de vie des serveurs MCP (stdio, HTTP, containers). | ||
| 24 | + - Permissions et journal visibles dans Sidekicks ; secrets (jetons) hors du YAML. | ||
| 25 | + - Ce qui existe déjà (Docker MCP Gateway…) : réutiliser plutôt que refaire ? | ||
| 26 | + - Dépend de la décision de #76. | ||
| 27 | +tasks: [] | ||
| 28 | +comments: [] | ||
added
.tickets/issues/0078-reflechir-a-l-interet-d-avoir-un-mode-plugin.yaml +27 -0 | new file mode 100644 | ||
| @@ -0,0 +1,27 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 78 | |
| 3 | +title: "Réfléchir à l'intérêt d'avoir un mode plugin" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::spike | |
| 12 | +epic: External applications | |
| 13 | +related: | |
| 14 | + - 76 | |
| 15 | +body: | | |
| 16 | + Un **mode plugin** permettrait d'étendre Sidekicks sans toucher à son code : nouveaux panneaux, | |
| 17 | + commandes, actions sur les messages, sources de données, intégrations. | |
| 18 | + | |
| 19 | + ## Questions | |
| 20 | + - Quels besoins réels un plugin couvrirait (que la configuration, MCP #76/#77 ou les agents ne couvrent pas) ? | |
| 21 | + - Forme : process externe (JSON-RPC, comme ACP), WebAssembly (Extism, wazero), scripts, composants frontend ? | |
| 22 | + - Sécurité et isolation ; distribution ; compatibilité entre versions. | |
| 23 | + - Coût de maintenance pour le projet. | |
| 24 | + | |
| 25 | + Résultat attendu : une décision (ADR), éventuellement un prototype jetable. | |
| 26 | +tasks: [] | |
| 27 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 78 | ||
| 3 | +title: "Réfléchir à l'intérêt d'avoir un mode plugin" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::spike | ||
| 12 | +epic: External applications | ||
| 13 | +related: | ||
| 14 | + - 76 | ||
| 15 | +body: | | ||
| 16 | + Un **mode plugin** permettrait d'étendre Sidekicks sans toucher à son code : nouveaux panneaux, | ||
| 17 | + commandes, actions sur les messages, sources de données, intégrations. | ||
| 18 | + | ||
| 19 | + ## Questions | ||
| 20 | + - Quels besoins réels un plugin couvrirait (que la configuration, MCP #76/#77 ou les agents ne couvrent pas) ? | ||
| 21 | + - Forme : process externe (JSON-RPC, comme ACP), WebAssembly (Extism, wazero), scripts, composants frontend ? | ||
| 22 | + - Sécurité et isolation ; distribution ; compatibilité entre versions. | ||
| 23 | + - Coût de maintenance pour le projet. | ||
| 24 | + | ||
| 25 | + Résultat attendu : une décision (ADR), éventuellement un prototype jetable. | ||
| 26 | +tasks: [] | ||
| 27 | +comments: [] | ||
added
.tickets/issues/0079-reflechir-a-comment-un-agent-peut-agir-sur-l-exterie.yaml +32 -0 | new file mode 100644 | ||
| @@ -0,0 +1,32 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 79 | |
| 3 | +title: "Réfléchir à comment donner à un agent la possibilité d'agir sur l'extérieur par le biais de Sidekicks" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::spike | |
| 12 | +epic: External applications | |
| 13 | +related: | |
| 14 | + - 76 | |
| 15 | + - 77 | |
| 16 | + - 80 | |
| 17 | +body: | | |
| 18 | + Aujourd'hui un agent agit dans son dossier (fichiers, terminal) et via ses propres outils. | |
| 19 | + Comment pourrait-il agir **sur l'extérieur par le biais de Sidekicks** : envoyer un mail, appeler une API, | |
| 20 | + ouvrir une page, notifier l'utilisateur, déclencher une action sur la machine… | |
| 21 | + | |
| 22 | + ## Questions | |
| 23 | + - Quel canal : outils MCP exposés par Sidekicks (#76, #77), demandes ACP (permissions), commandes ? | |
| 24 | + - Contrôle : chaque action passe par une carte de permission compréhensible par le citizen user, | |
| 25 | + avec liste blanche par agent et journal. | |
| 26 | + - Quelles actions en premier, et lesquelles jamais. | |
| 27 | + - Lien avec la détection de prompt injection (#80) : une action vers l'extérieur est ce qu'un contenu | |
| 28 | + malveillant chercherait à déclencher. | |
| 29 | + | |
| 30 | + Résultat attendu : une décision (ADR) et une liste d'actions possibles. | |
| 31 | +tasks: [] | |
| 32 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 79 | ||
| 3 | +title: "Réfléchir à comment donner à un agent la possibilité d'agir sur l'extérieur par le biais de Sidekicks" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::spike | ||
| 12 | +epic: External applications | ||
| 13 | +related: | ||
| 14 | + - 76 | ||
| 15 | + - 77 | ||
| 16 | + - 80 | ||
| 17 | +body: | | ||
| 18 | + Aujourd'hui un agent agit dans son dossier (fichiers, terminal) et via ses propres outils. | ||
| 19 | + Comment pourrait-il agir **sur l'extérieur par le biais de Sidekicks** : envoyer un mail, appeler une API, | ||
| 20 | + ouvrir une page, notifier l'utilisateur, déclencher une action sur la machine… | ||
| 21 | + | ||
| 22 | + ## Questions | ||
| 23 | + - Quel canal : outils MCP exposés par Sidekicks (#76, #77), demandes ACP (permissions), commandes ? | ||
| 24 | + - Contrôle : chaque action passe par une carte de permission compréhensible par le citizen user, | ||
| 25 | + avec liste blanche par agent et journal. | ||
| 26 | + - Quelles actions en premier, et lesquelles jamais. | ||
| 27 | + - Lien avec la détection de prompt injection (#80) : une action vers l'extérieur est ce qu'un contenu | ||
| 28 | + malveillant chercherait à déclencher. | ||
| 29 | + | ||
| 30 | + Résultat attendu : une décision (ADR) et une liste d'actions possibles. | ||
| 31 | +tasks: [] | ||
| 32 | +comments: [] | ||
added
.tickets/issues/0080-reflechir-a-comment-sidekicks-pourrait-aider-a-detec.yaml +30 -0 | new file mode 100644 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 80 | |
| 3 | +title: "Réfléchir à comment Sidekicks pourrait aider à la détection des prompt injections" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | |
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::spike | |
| 12 | +epic: External applications | |
| 13 | +body: | | |
| 14 | + Les agents lisent des fichiers, des pages, des messages d'autres agents : autant de portes pour une | |
| 15 | + **prompt injection** (et autres contenus malveillants). Sidekicks pourrait-il aider à les détecter ? | |
| 16 | + | |
| 17 | + > Note : c'est sans doute d'abord un problème d'agent. Ce ticket sert à voir ce que Sidekicks, | |
| 18 | + > qui voit passer les messages et les tool calls, peut apporter en plus. | |
| 19 | + | |
| 20 | + ## Pistes | |
| 21 | + - Analyser ce qui transite : messages entre agents (channels multi-agents), résultats de tool calls, | |
| 22 | + fichiers liés ; signaler plutôt que bloquer. | |
| 23 | + - Un petit modèle local de classification (guard models : Llama Guard, Prompt Guard, Qwen3Guard…) | |
| 24 | + lancé en option. | |
| 25 | + - Rendre visibles les actions sensibles (permissions plus explicites quand le contexte vient de l'extérieur). | |
| 26 | + - Ce qui relève de l'agent, ce qui relève de Sidekicks : à trancher. | |
| 27 | + | |
| 28 | + Résultat attendu : une décision (ADR) — rien / signalement / filtrage optionnel. | |
| 29 | +tasks: [] | |
| 30 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 80 | ||
| 3 | +title: "Réfléchir à comment Sidekicks pourrait aider à la détection des prompt injections" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T05:05:49.000Z | ||
| 9 | +updatedAt: 2026-11-09T05:05:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::spike | ||
| 12 | +epic: External applications | ||
| 13 | +body: | | ||
| 14 | + Les agents lisent des fichiers, des pages, des messages d'autres agents : autant de portes pour une | ||
| 15 | + **prompt injection** (et autres contenus malveillants). Sidekicks pourrait-il aider à les détecter ? | ||
| 16 | + | ||
| 17 | + > Note : c'est sans doute d'abord un problème d'agent. Ce ticket sert à voir ce que Sidekicks, | ||
| 18 | + > qui voit passer les messages et les tool calls, peut apporter en plus. | ||
| 19 | + | ||
| 20 | + ## Pistes | ||
| 21 | + - Analyser ce qui transite : messages entre agents (channels multi-agents), résultats de tool calls, | ||
| 22 | + fichiers liés ; signaler plutôt que bloquer. | ||
| 23 | + - Un petit modèle local de classification (guard models : Llama Guard, Prompt Guard, Qwen3Guard…) | ||
| 24 | + lancé en option. | ||
| 25 | + - Rendre visibles les actions sensibles (permissions plus explicites quand le contexte vient de l'extérieur). | ||
| 26 | + - Ce qui relève de l'agent, ce qui relève de Sidekicks : à trancher. | ||
| 27 | + | ||
| 28 | + Résultat attendu : une décision (ADR) — rien / signalement / filtrage optionnel. | ||
| 29 | +tasks: [] | ||
| 30 | +comments: [] | ||
added
.tickets/issues/0081-simplifier-l-ajout-d-une-sbx-avec-claude-acp.yaml +144 -0 | new file mode 100644 | ||
| @@ -0,0 +1,144 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 81 | |
| 3 | +title: "Simplifier l'ajout d'une sbx avec Claude ACP" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T06:11:54.000Z | |
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::config | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Docker SBX | |
| 17 | +related: | |
| 18 | + - 69 | |
| 19 | + - 83 | |
| 20 | +body: | | |
| 21 | + Aujourd'hui, ajouter un agent **Claude** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | |
| 22 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | |
| 23 | + suppression), la commande du wrapper ACP de Claude Code (`claude-agent-acp`, ex `claude-code-acp`) dans la sandbox, et l'authentification. | |
| 24 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | |
| 25 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | |
| 26 | + doit proposer ce cas tout prêt. | |
| 27 | + | |
| 28 | + ## Approche retenue | |
| 29 | + Dans l'assistant, en mode **Dans une sandbox sbx**, la liste **Programme** propose aussi `claude-agent-acp` | |
| 30 | + (à côté de `mm`, `docker-agent`, `docker agent` : `knownPrograms` dans [agentform.ts](frontend/src/lib/agentform.ts)). | |
| 31 | + Quand on le choisit, Sidekicks **génère la configuration qui va bien**, celle de l'exemple | |
| 32 | + [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) et du guide #83 : | |
| 33 | + - un `sbxenv.yaml` dans le dossier choisi (nom de sandbox dérivé du nom de l'agent, `agent: claude`, | |
| 34 | + `workspace: ./workspace`, kit `docker.io/sbx/claude-acp`, `bindings` Anthropic), s'il n'existe pas déjà ; | |
| 35 | + - le dossier `workspace/` ; | |
| 36 | + - l'entrée de l'agent : `sbx exec -i <sandbox> claude-agent-acp`, `runtime: {type: sbx, sandbox}`, | |
| 37 | + `lifecycle` (`sbx env create/rm --force`, `sbx stop <sandbox>`), comme quand on dépose un `sbxenv.yaml`. | |
| 38 | + Les arguments restent vides ; tous les champs restent modifiables. | |
| 39 | + | |
| 40 | + ## À vérifier | |
| 41 | + - L'image / le kit sbx à utiliser, et comment y installer le wrapper ACP de Claude Code (`claude-agent-acp`, ex `claude-code-acp`) : préinstallé dans un kit, ou installé | |
| 42 | + à la création de la sandbox. | |
| 43 | + - L'authentification : connexion au compte Claude ou clé `ANTHROPIC_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | |
| 44 | + - Les commandes et capacités annoncées par le wrapper (lien avec #69 pour Claude). | |
| 45 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | |
| 46 | + | |
| 47 | + ## Critères d'acceptation | |
| 48 | + - Depuis une installation neuve, un agent Claude en sbx est ajouté en quelques clics, démarre et répond. | |
| 49 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | |
| 50 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | |
| 51 | +tasks: | |
| 52 | + - id: 1 | |
| 53 | + title: "Proposer claude-agent-acp dans la liste des programmes en mode sbx (seulement en sbx)" | |
| 54 | + state: closed | |
| 55 | + priority: high | |
| 56 | + author: | |
| 57 | + name: k33g | |
| 58 | + email: ph.charriere@gmail.com | |
| 59 | + createdAt: 2026-11-09T06:50:18.000Z | |
| 60 | + updatedAt: 2026-11-09T06:56:37.000Z | |
| 61 | + closedAt: 2026-11-09T06:56:37.000Z | |
| 62 | + - id: 2 | |
| 63 | + title: "Go : générer le sbxenv.yaml Claude (modèle de agents/snippets/claude-acp) et le dossier workspace/, sans écraser un fichier existant" | |
| 64 | + state: closed | |
| 65 | + priority: high | |
| 66 | + author: | |
| 67 | + name: k33g | |
| 68 | + email: ph.charriere@gmail.com | |
| 69 | + createdAt: 2026-11-09T06:50:18.000Z | |
| 70 | + updatedAt: 2026-11-09T06:56:37.000Z | |
| 71 | + closedAt: 2026-11-09T06:56:37.000Z | |
| 72 | + - id: 3 | |
| 73 | + title: "Assistant : remplir sandbox, dossier de l'agent et commandes lifecycle à partir du fichier généré" | |
| 74 | + state: closed | |
| 75 | + priority: high | |
| 76 | + author: | |
| 77 | + name: k33g | |
| 78 | + email: ph.charriere@gmail.com | |
| 79 | + createdAt: 2026-11-09T06:50:18.000Z | |
| 80 | + updatedAt: 2026-11-09T06:56:37.000Z | |
| 81 | + closedAt: 2026-11-09T06:56:37.000Z | |
| 82 | + - id: 4 | |
| 83 | + title: "Rappeler d'enregistrer la clé Anthropic dans sbx (lien vers le guide #83)" | |
| 84 | + state: closed | |
| 85 | + priority: medium | |
| 86 | + author: | |
| 87 | + name: k33g | |
| 88 | + email: ph.charriere@gmail.com | |
| 89 | + createdAt: 2026-11-09T06:50:18.000Z | |
| 90 | + updatedAt: 2026-11-09T06:56:37.000Z | |
| 91 | + closedAt: 2026-11-09T06:56:37.000Z | |
| 92 | + - id: 5 | |
| 93 | + title: "Tests Go + vitest ; textes EN + FR ; guides « ajouter un agent » et #83 mis à jour" | |
| 94 | + state: closed | |
| 95 | + priority: medium | |
| 96 | + author: | |
| 97 | + name: k33g | |
| 98 | + email: ph.charriere@gmail.com | |
| 99 | + createdAt: 2026-11-09T06:50:18.000Z | |
| 100 | + updatedAt: 2026-11-09T06:56:37.000Z | |
| 101 | + closedAt: 2026-11-09T06:56:37.000Z | |
| 102 | +comments: | |
| 103 | + - id: 1 | |
| 104 | + author: | |
| 105 | + name: k33g | |
| 106 | + email: ph.charriere@gmail.com | |
| 107 | + createdAt: 2026-11-09T06:56:37.000Z | |
| 108 | + body: | | |
| 109 | + Fait, selon l'approche retenue. | |
| 110 | + - Go : `ConfigService.PrepareClaudeSandbox(folder, sandbox)` ([claudesandbox.go](internal/app/claudesandbox.go)) écrit | |
| 111 | + le `sbxenv.yaml` de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) (nom de sandbox remplacé), | |
| 112 | + sans jamais écraser un fichier existant, crée `workspace/`, et renvoie ce que `ReadSandboxEnv` renvoie. Un test | |
| 113 | + vérifie que le fichier généré reste identique à l'exemple (hors `name`). | |
| 114 | + - Assistant : en mode sbx, `claude-agent-acp` est proposé dans **Programme** (`programsFor`, [agentform.ts](frontend/src/lib/agentform.ts)) ; | |
| 115 | + une zone **Claude dans une sandbox sbx** propose le dossier (`~/agents/<nom>`) et le nom de sandbox (`<nom>-sbx`), | |
| 116 | + **Préparer la sandbox** remplit le formulaire (`withPreparedSandbox`) ; **Ajouter l'agent** prépare d'abord si besoin. | |
| 117 | + Le bloc « fichier de configuration de l'agent » est caché pour Claude. Rappel de la clé Anthropic et mention du kit tiers. | |
| 118 | + - Vérifié dans l'application (Xvfb) : l'entrée écrite est celle du README de l'exemple. | |
| 119 | + - Docs EN + FR : guide #83 (voie « assistant » en premier, section « Un kit fourni par un tiers »), « Ajouter un agent », référence. | |
| 120 | + - Non vérifié : démarrage réel de Claude (pas de sbx ici). | |
| 121 | + - id: 2 | |
| 122 | + author: | |
| 123 | + name: k33g | |
| 124 | + email: ph.charriere@gmail.com | |
| 125 | + createdAt: 2026-11-09T07:06:11.000Z | |
| 126 | + body: | | |
| 127 | + Simplifié à la demande : le cadre « Claude dans une sandbox sbx » est retiré, le `sbxenv.yaml` déposé sur | |
| 128 | + l'assistant donne déjà la sandbox, le dossier et les commandes. | |
| 129 | + - Reste : `claude-agent-acp` dans la liste **Programme** en mode sbx, une note sous le programme (kit tiers, | |
| 130 | + clé Anthropic, lien vers le guide #83) et le bloc « fichier de configuration de l'agent » caché pour Claude. | |
| 131 | + - Retiré : `ConfigService.PrepareClaudeSandbox` et ses tests, la génération du `sbxenv.yaml`. | |
| 132 | + - Guide #83 (EN + FR) : la voie « assistant » part d'une copie de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) ; | |
| 133 | + « Ajouter un agent » et la référence mis à jour. | |
| 134 | + - Vérifié dans l'application : `sbxenv.yaml` de l'exemple choisi + `claude-agent-acp` → l'entrée du README de l'exemple. | |
| 135 | + - id: 3 | |
| 136 | + author: | |
| 137 | + name: k33g | |
| 138 | + email: ph.charriere@gmail.com | |
| 139 | + createdAt: 2026-11-10T05:31:48.000Z | |
| 140 | + body: | | |
| 141 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | |
| 142 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | |
| 143 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | |
| 144 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | |
| new file mode 100644 | |||
| @@ -0,0 +1,144 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 81 | ||
| 3 | +title: "Simplifier l'ajout d'une sbx avec Claude ACP" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T06:11:54.000Z | ||
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::config | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Docker SBX | ||
| 17 | +related: | ||
| 18 | + - 69 | ||
| 19 | + - 83 | ||
| 20 | +body: | | ||
| 21 | + Aujourd'hui, ajouter un agent **Claude** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | ||
| 22 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | ||
| 23 | + suppression), la commande du wrapper ACP de Claude Code (`claude-agent-acp`, ex `claude-code-acp`) dans la sandbox, et l'authentification. | ||
| 24 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | ||
| 25 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | ||
| 26 | + doit proposer ce cas tout prêt. | ||
| 27 | + | ||
| 28 | + ## Approche retenue | ||
| 29 | + Dans l'assistant, en mode **Dans une sandbox sbx**, la liste **Programme** propose aussi `claude-agent-acp` | ||
| 30 | + (à côté de `mm`, `docker-agent`, `docker agent` : `knownPrograms` dans [agentform.ts](frontend/src/lib/agentform.ts)). | ||
| 31 | + Quand on le choisit, Sidekicks **génère la configuration qui va bien**, celle de l'exemple | ||
| 32 | + [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) et du guide #83 : | ||
| 33 | + - un `sbxenv.yaml` dans le dossier choisi (nom de sandbox dérivé du nom de l'agent, `agent: claude`, | ||
| 34 | + `workspace: ./workspace`, kit `docker.io/sbx/claude-acp`, `bindings` Anthropic), s'il n'existe pas déjà ; | ||
| 35 | + - le dossier `workspace/` ; | ||
| 36 | + - l'entrée de l'agent : `sbx exec -i <sandbox> claude-agent-acp`, `runtime: {type: sbx, sandbox}`, | ||
| 37 | + `lifecycle` (`sbx env create/rm --force`, `sbx stop <sandbox>`), comme quand on dépose un `sbxenv.yaml`. | ||
| 38 | + Les arguments restent vides ; tous les champs restent modifiables. | ||
| 39 | + | ||
| 40 | + ## À vérifier | ||
| 41 | + - L'image / le kit sbx à utiliser, et comment y installer le wrapper ACP de Claude Code (`claude-agent-acp`, ex `claude-code-acp`) : préinstallé dans un kit, ou installé | ||
| 42 | + à la création de la sandbox. | ||
| 43 | + - L'authentification : connexion au compte Claude ou clé `ANTHROPIC_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | ||
| 44 | + - Les commandes et capacités annoncées par le wrapper (lien avec #69 pour Claude). | ||
| 45 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | ||
| 46 | + | ||
| 47 | + ## Critères d'acceptation | ||
| 48 | + - Depuis une installation neuve, un agent Claude en sbx est ajouté en quelques clics, démarre et répond. | ||
| 49 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | ||
| 50 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | ||
| 51 | +tasks: | ||
| 52 | + - id: 1 | ||
| 53 | + title: "Proposer claude-agent-acp dans la liste des programmes en mode sbx (seulement en sbx)" | ||
| 54 | + state: closed | ||
| 55 | + priority: high | ||
| 56 | + author: | ||
| 57 | + name: k33g | ||
| 58 | + email: ph.charriere@gmail.com | ||
| 59 | + createdAt: 2026-11-09T06:50:18.000Z | ||
| 60 | + updatedAt: 2026-11-09T06:56:37.000Z | ||
| 61 | + closedAt: 2026-11-09T06:56:37.000Z | ||
| 62 | + - id: 2 | ||
| 63 | + title: "Go : générer le sbxenv.yaml Claude (modèle de agents/snippets/claude-acp) et le dossier workspace/, sans écraser un fichier existant" | ||
| 64 | + state: closed | ||
| 65 | + priority: high | ||
| 66 | + author: | ||
| 67 | + name: k33g | ||
| 68 | + email: ph.charriere@gmail.com | ||
| 69 | + createdAt: 2026-11-09T06:50:18.000Z | ||
| 70 | + updatedAt: 2026-11-09T06:56:37.000Z | ||
| 71 | + closedAt: 2026-11-09T06:56:37.000Z | ||
| 72 | + - id: 3 | ||
| 73 | + title: "Assistant : remplir sandbox, dossier de l'agent et commandes lifecycle à partir du fichier généré" | ||
| 74 | + state: closed | ||
| 75 | + priority: high | ||
| 76 | + author: | ||
| 77 | + name: k33g | ||
| 78 | + email: ph.charriere@gmail.com | ||
| 79 | + createdAt: 2026-11-09T06:50:18.000Z | ||
| 80 | + updatedAt: 2026-11-09T06:56:37.000Z | ||
| 81 | + closedAt: 2026-11-09T06:56:37.000Z | ||
| 82 | + - id: 4 | ||
| 83 | + title: "Rappeler d'enregistrer la clé Anthropic dans sbx (lien vers le guide #83)" | ||
| 84 | + state: closed | ||
| 85 | + priority: medium | ||
| 86 | + author: | ||
| 87 | + name: k33g | ||
| 88 | + email: ph.charriere@gmail.com | ||
| 89 | + createdAt: 2026-11-09T06:50:18.000Z | ||
| 90 | + updatedAt: 2026-11-09T06:56:37.000Z | ||
| 91 | + closedAt: 2026-11-09T06:56:37.000Z | ||
| 92 | + - id: 5 | ||
| 93 | + title: "Tests Go + vitest ; textes EN + FR ; guides « ajouter un agent » et #83 mis à jour" | ||
| 94 | + state: closed | ||
| 95 | + priority: medium | ||
| 96 | + author: | ||
| 97 | + name: k33g | ||
| 98 | + email: ph.charriere@gmail.com | ||
| 99 | + createdAt: 2026-11-09T06:50:18.000Z | ||
| 100 | + updatedAt: 2026-11-09T06:56:37.000Z | ||
| 101 | + closedAt: 2026-11-09T06:56:37.000Z | ||
| 102 | +comments: | ||
| 103 | + - id: 1 | ||
| 104 | + author: | ||
| 105 | + name: k33g | ||
| 106 | + email: ph.charriere@gmail.com | ||
| 107 | + createdAt: 2026-11-09T06:56:37.000Z | ||
| 108 | + body: | | ||
| 109 | + Fait, selon l'approche retenue. | ||
| 110 | + - Go : `ConfigService.PrepareClaudeSandbox(folder, sandbox)` ([claudesandbox.go](internal/app/claudesandbox.go)) écrit | ||
| 111 | + le `sbxenv.yaml` de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) (nom de sandbox remplacé), | ||
| 112 | + sans jamais écraser un fichier existant, crée `workspace/`, et renvoie ce que `ReadSandboxEnv` renvoie. Un test | ||
| 113 | + vérifie que le fichier généré reste identique à l'exemple (hors `name`). | ||
| 114 | + - Assistant : en mode sbx, `claude-agent-acp` est proposé dans **Programme** (`programsFor`, [agentform.ts](frontend/src/lib/agentform.ts)) ; | ||
| 115 | + une zone **Claude dans une sandbox sbx** propose le dossier (`~/agents/<nom>`) et le nom de sandbox (`<nom>-sbx`), | ||
| 116 | + **Préparer la sandbox** remplit le formulaire (`withPreparedSandbox`) ; **Ajouter l'agent** prépare d'abord si besoin. | ||
| 117 | + Le bloc « fichier de configuration de l'agent » est caché pour Claude. Rappel de la clé Anthropic et mention du kit tiers. | ||
| 118 | + - Vérifié dans l'application (Xvfb) : l'entrée écrite est celle du README de l'exemple. | ||
| 119 | + - Docs EN + FR : guide #83 (voie « assistant » en premier, section « Un kit fourni par un tiers »), « Ajouter un agent », référence. | ||
| 120 | + - Non vérifié : démarrage réel de Claude (pas de sbx ici). | ||
| 121 | + - id: 2 | ||
| 122 | + author: | ||
| 123 | + name: k33g | ||
| 124 | + email: ph.charriere@gmail.com | ||
| 125 | + createdAt: 2026-11-09T07:06:11.000Z | ||
| 126 | + body: | | ||
| 127 | + Simplifié à la demande : le cadre « Claude dans une sandbox sbx » est retiré, le `sbxenv.yaml` déposé sur | ||
| 128 | + l'assistant donne déjà la sandbox, le dossier et les commandes. | ||
| 129 | + - Reste : `claude-agent-acp` dans la liste **Programme** en mode sbx, une note sous le programme (kit tiers, | ||
| 130 | + clé Anthropic, lien vers le guide #83) et le bloc « fichier de configuration de l'agent » caché pour Claude. | ||
| 131 | + - Retiré : `ConfigService.PrepareClaudeSandbox` et ses tests, la génération du `sbxenv.yaml`. | ||
| 132 | + - Guide #83 (EN + FR) : la voie « assistant » part d'une copie de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) ; | ||
| 133 | + « Ajouter un agent » et la référence mis à jour. | ||
| 134 | + - Vérifié dans l'application : `sbxenv.yaml` de l'exemple choisi + `claude-agent-acp` → l'entrée du README de l'exemple. | ||
| 135 | + - id: 3 | ||
| 136 | + author: | ||
| 137 | + name: k33g | ||
| 138 | + email: ph.charriere@gmail.com | ||
| 139 | + createdAt: 2026-11-10T05:31:48.000Z | ||
| 140 | + body: | | ||
| 141 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | ||
| 142 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | ||
| 143 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | ||
| 144 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | ||
added
.tickets/issues/0082-simplifier-l-ajout-d-une-sbx-avec-codex-acp.yaml +135 -0 | new file mode 100644 | ||
| @@ -0,0 +1,135 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 82 | |
| 3 | +title: "Simplifier l'ajout d'une sbx avec Codex ACP" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T06:11:54.000Z | |
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::config | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Docker SBX | |
| 17 | +related: | |
| 18 | + - 81 | |
| 19 | +body: | | |
| 20 | + Aujourd'hui, ajouter un agent **Codex** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | |
| 21 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | |
| 22 | + suppression), la commande du wrapper ACP de Codex (`codex-acp`) dans la sandbox, et l'authentification. | |
| 23 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | |
| 24 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | |
| 25 | + doit proposer ce cas tout prêt. | |
| 26 | + | |
| 27 | + ## Idée | |
| 28 | + - Dans l'assistant, un choix **Codex dans une sandbox sbx** : l'utilisateur donne un nom et un dossier, Sidekicks | |
| 29 | + remplit le reste (`sbxenv.yaml`, `runtime` de type `sbx`, `lifecycle`, commande ACP, protections). | |
| 30 | + - Un modèle de configuration (« preset ») versionné dans Sidekicks, pour pouvoir le mettre à jour. | |
| 31 | + | |
| 32 | + ## À vérifier | |
| 33 | + - L'image / le kit sbx à utiliser, et comment y installer le wrapper ACP de Codex (`codex-acp`) : préinstallé dans un kit, ou installé | |
| 34 | + à la création de la sandbox. | |
| 35 | + - L'authentification : connexion au compte ChatGPT ou clé `OPENAI_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | |
| 36 | + - Les commandes et capacités annoncées par le wrapper (lien avec #69 pour Claude). | |
| 37 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | |
| 38 | + | |
| 39 | + ## Critères d'acceptation | |
| 40 | + - Depuis une installation neuve, un agent Codex en sbx est ajouté en quelques clics, démarre et répond. | |
| 41 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | |
| 42 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | |
| 43 | +tasks: | |
| 44 | + - id: 1 | |
| 45 | + title: "Proposer codex-acp dans la liste des programmes en mode sbx" | |
| 46 | + state: closed | |
| 47 | + priority: high | |
| 48 | + author: | |
| 49 | + name: k33g | |
| 50 | + email: ph.charriere@gmail.com | |
| 51 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 52 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 53 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 54 | + - id: 2 | |
| 55 | + title: "Note sous le programme (kit tiers, identifiants OpenAI, guide) et bloc « fichier de configuration » caché" | |
| 56 | + state: closed | |
| 57 | + priority: medium | |
| 58 | + author: | |
| 59 | + name: k33g | |
| 60 | + email: ph.charriere@gmail.com | |
| 61 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 62 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 63 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 64 | + - id: 3 | |
| 65 | + title: "README de l'exemple agents/snippets/codex-acp" | |
| 66 | + state: closed | |
| 67 | + priority: medium | |
| 68 | + author: | |
| 69 | + name: k33g | |
| 70 | + email: ph.charriere@gmail.com | |
| 71 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 72 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 73 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 74 | + - id: 4 | |
| 75 | + title: "Tests vitest + lecture des sbxenv.yaml des exemples ; guide « Ajouter un agent Codex dans une sandbox sbx » EN + FR" | |
| 76 | + state: closed | |
| 77 | + priority: medium | |
| 78 | + author: | |
| 79 | + name: k33g | |
| 80 | + email: ph.charriere@gmail.com | |
| 81 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 82 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 83 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 84 | +comments: | |
| 85 | + - id: 1 | |
| 86 | + author: | |
| 87 | + name: k33g | |
| 88 | + email: ph.charriere@gmail.com | |
| 89 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 90 | + body: | | |
| 91 | + Fait comme #81. | |
| 92 | + - Assistant : en mode sbx, la liste **Programme** propose `/home/agent/.local/bin/codex-acp` (le kit `docker.io/sbx/codex-acp-kit` l'installe hors du `PATH`) ; `codex-acp` seul est reconnu aussi. Une note rappelle le kit tiers et les identifiants OpenAI (`sbx secret set -g openai --oauth` ou clé), et le bloc « fichier de configuration de l'agent » est caché. Généralisé : `sbxPrograms` / `sbxAgentOf` dans [agentform.ts](frontend/src/lib/agentform.ts) pour Claude, Codex et Gemini. | |
| 93 | + - Exemple : [agents/snippets/codex-acp](agents/snippets/codex-acp/README.md) (le `sbxenv.yaml` fourni + un README avec l'entrée de l'agent). | |
| 94 | + - Docs EN + FR : guide « Ajouter un agent Codex dans une sandbox sbx », « Ajouter un agent », « Lancer un agent dans une sandbox sbx », index. | |
| 95 | + - Non vérifié : démarrage réel de Codex (pas de sbx ici). | |
| 96 | + - id: 2 | |
| 97 | + author: | |
| 98 | + name: k33g | |
| 99 | + email: ph.charriere@gmail.com | |
| 100 | + createdAt: 2026-11-10T05:12:35.000Z | |
| 101 | + body: | | |
| 102 | + Essayé sur le Mac : `sbx env create` refuse `docker.io/sbx/codex-acp-kit` (« cannot mix v3 kits with v1/v2 kits in one sandbox » : | |
| 103 | + l'agent `codex` est maintenant le kit v3 `docker.io/sbx/codex`). Remplacé par le kit v3 `docker.io/sbx/codex-acp:latest` | |
| 104 | + (même programme `/home/agent/.local/bin/codex-acp`) dans l'exemple, la note de l'assistant et les guides EN + FR, | |
| 105 | + avec l'erreur et sa solution dans le guide. | |
| 106 | + - id: 3 | |
| 107 | + author: | |
| 108 | + name: k33g | |
| 109 | + email: ph.charriere@gmail.com | |
| 110 | + createdAt: 2026-11-10T05:21:14.000Z | |
| 111 | + body: | | |
| 112 | + Sur le Mac, l'entrée Codex produite par l'assistant pointait sur la sandbox `claude-acp` (args, runtime, lifecycle, workspace) : | |
| 113 | + le `sbxenv.yaml` lu était celui de Claude, et `codex-acp` n'existe pas dans cette sandbox (exit status 127). | |
| 114 | + Garde-fou : `ReadSandboxEnv` renvoie aussi l'`agent:` du fichier ; l'assistant refuse d'ajouter l'agent quand il ne | |
| 115 | + correspond pas au programme (`sandboxMismatch` dans [agentform.ts](frontend/src/lib/agentform.ts)) et le dit sous le programme. | |
| 116 | + Guide Codex EN + FR : l'erreur et quoi vérifier. | |
| 117 | + - id: 4 | |
| 118 | + author: | |
| 119 | + name: k33g | |
| 120 | + email: ph.charriere@gmail.com | |
| 121 | + createdAt: 2026-11-10T05:27:33.000Z | |
| 122 | + body: | | |
| 123 | + Vérifié sur le Mac : Codex démarre et répond avec `codex-acp` seul. Le kit v3 `docker.io/sbx/codex-acp` (image Docker Hardened Images) | |
| 124 | + met l'adaptateur dans le `PATH` ; `/home/agent/.local/bin/codex-acp` était le script de l'ancien kit v2. | |
| 125 | + L'assistant propose `codex-acp` (l'ancien chemin reste reconnu) ; exemple, guides EN + FR et « Ajouter un agent » mis à jour. | |
| 126 | + - id: 5 | |
| 127 | + author: | |
| 128 | + name: k33g | |
| 129 | + email: ph.charriere@gmail.com | |
| 130 | + createdAt: 2026-11-10T05:31:48.000Z | |
| 131 | + body: | | |
| 132 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | |
| 133 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | |
| 134 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | |
| 135 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | |
| new file mode 100644 | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 82 | ||
| 3 | +title: "Simplifier l'ajout d'une sbx avec Codex ACP" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T06:11:54.000Z | ||
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::config | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Docker SBX | ||
| 17 | +related: | ||
| 18 | + - 81 | ||
| 19 | +body: | | ||
| 20 | + Aujourd'hui, ajouter un agent **Codex** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | ||
| 21 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | ||
| 22 | + suppression), la commande du wrapper ACP de Codex (`codex-acp`) dans la sandbox, et l'authentification. | ||
| 23 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | ||
| 24 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | ||
| 25 | + doit proposer ce cas tout prêt. | ||
| 26 | + | ||
| 27 | + ## Idée | ||
| 28 | + - Dans l'assistant, un choix **Codex dans une sandbox sbx** : l'utilisateur donne un nom et un dossier, Sidekicks | ||
| 29 | + remplit le reste (`sbxenv.yaml`, `runtime` de type `sbx`, `lifecycle`, commande ACP, protections). | ||
| 30 | + - Un modèle de configuration (« preset ») versionné dans Sidekicks, pour pouvoir le mettre à jour. | ||
| 31 | + | ||
| 32 | + ## À vérifier | ||
| 33 | + - L'image / le kit sbx à utiliser, et comment y installer le wrapper ACP de Codex (`codex-acp`) : préinstallé dans un kit, ou installé | ||
| 34 | + à la création de la sandbox. | ||
| 35 | + - L'authentification : connexion au compte ChatGPT ou clé `OPENAI_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | ||
| 36 | + - Les commandes et capacités annoncées par le wrapper (lien avec #69 pour Claude). | ||
| 37 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | ||
| 38 | + | ||
| 39 | + ## Critères d'acceptation | ||
| 40 | + - Depuis une installation neuve, un agent Codex en sbx est ajouté en quelques clics, démarre et répond. | ||
| 41 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | ||
| 42 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | ||
| 43 | +tasks: | ||
| 44 | + - id: 1 | ||
| 45 | + title: "Proposer codex-acp dans la liste des programmes en mode sbx" | ||
| 46 | + state: closed | ||
| 47 | + priority: high | ||
| 48 | + author: | ||
| 49 | + name: k33g | ||
| 50 | + email: ph.charriere@gmail.com | ||
| 51 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 52 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 53 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 54 | + - id: 2 | ||
| 55 | + title: "Note sous le programme (kit tiers, identifiants OpenAI, guide) et bloc « fichier de configuration » caché" | ||
| 56 | + state: closed | ||
| 57 | + priority: medium | ||
| 58 | + author: | ||
| 59 | + name: k33g | ||
| 60 | + email: ph.charriere@gmail.com | ||
| 61 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 62 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 63 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 64 | + - id: 3 | ||
| 65 | + title: "README de l'exemple agents/snippets/codex-acp" | ||
| 66 | + state: closed | ||
| 67 | + priority: medium | ||
| 68 | + author: | ||
| 69 | + name: k33g | ||
| 70 | + email: ph.charriere@gmail.com | ||
| 71 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 72 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 73 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 74 | + - id: 4 | ||
| 75 | + title: "Tests vitest + lecture des sbxenv.yaml des exemples ; guide « Ajouter un agent Codex dans une sandbox sbx » EN + FR" | ||
| 76 | + state: closed | ||
| 77 | + priority: medium | ||
| 78 | + author: | ||
| 79 | + name: k33g | ||
| 80 | + email: ph.charriere@gmail.com | ||
| 81 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 82 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 83 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 84 | +comments: | ||
| 85 | + - id: 1 | ||
| 86 | + author: | ||
| 87 | + name: k33g | ||
| 88 | + email: ph.charriere@gmail.com | ||
| 89 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 90 | + body: | | ||
| 91 | + Fait comme #81. | ||
| 92 | + - Assistant : en mode sbx, la liste **Programme** propose `/home/agent/.local/bin/codex-acp` (le kit `docker.io/sbx/codex-acp-kit` l'installe hors du `PATH`) ; `codex-acp` seul est reconnu aussi. Une note rappelle le kit tiers et les identifiants OpenAI (`sbx secret set -g openai --oauth` ou clé), et le bloc « fichier de configuration de l'agent » est caché. Généralisé : `sbxPrograms` / `sbxAgentOf` dans [agentform.ts](frontend/src/lib/agentform.ts) pour Claude, Codex et Gemini. | ||
| 93 | + - Exemple : [agents/snippets/codex-acp](agents/snippets/codex-acp/README.md) (le `sbxenv.yaml` fourni + un README avec l'entrée de l'agent). | ||
| 94 | + - Docs EN + FR : guide « Ajouter un agent Codex dans une sandbox sbx », « Ajouter un agent », « Lancer un agent dans une sandbox sbx », index. | ||
| 95 | + - Non vérifié : démarrage réel de Codex (pas de sbx ici). | ||
| 96 | + - id: 2 | ||
| 97 | + author: | ||
| 98 | + name: k33g | ||
| 99 | + email: ph.charriere@gmail.com | ||
| 100 | + createdAt: 2026-11-10T05:12:35.000Z | ||
| 101 | + body: | | ||
| 102 | + Essayé sur le Mac : `sbx env create` refuse `docker.io/sbx/codex-acp-kit` (« cannot mix v3 kits with v1/v2 kits in one sandbox » : | ||
| 103 | + l'agent `codex` est maintenant le kit v3 `docker.io/sbx/codex`). Remplacé par le kit v3 `docker.io/sbx/codex-acp:latest` | ||
| 104 | + (même programme `/home/agent/.local/bin/codex-acp`) dans l'exemple, la note de l'assistant et les guides EN + FR, | ||
| 105 | + avec l'erreur et sa solution dans le guide. | ||
| 106 | + - id: 3 | ||
| 107 | + author: | ||
| 108 | + name: k33g | ||
| 109 | + email: ph.charriere@gmail.com | ||
| 110 | + createdAt: 2026-11-10T05:21:14.000Z | ||
| 111 | + body: | | ||
| 112 | + Sur le Mac, l'entrée Codex produite par l'assistant pointait sur la sandbox `claude-acp` (args, runtime, lifecycle, workspace) : | ||
| 113 | + le `sbxenv.yaml` lu était celui de Claude, et `codex-acp` n'existe pas dans cette sandbox (exit status 127). | ||
| 114 | + Garde-fou : `ReadSandboxEnv` renvoie aussi l'`agent:` du fichier ; l'assistant refuse d'ajouter l'agent quand il ne | ||
| 115 | + correspond pas au programme (`sandboxMismatch` dans [agentform.ts](frontend/src/lib/agentform.ts)) et le dit sous le programme. | ||
| 116 | + Guide Codex EN + FR : l'erreur et quoi vérifier. | ||
| 117 | + - id: 4 | ||
| 118 | + author: | ||
| 119 | + name: k33g | ||
| 120 | + email: ph.charriere@gmail.com | ||
| 121 | + createdAt: 2026-11-10T05:27:33.000Z | ||
| 122 | + body: | | ||
| 123 | + Vérifié sur le Mac : Codex démarre et répond avec `codex-acp` seul. Le kit v3 `docker.io/sbx/codex-acp` (image Docker Hardened Images) | ||
| 124 | + met l'adaptateur dans le `PATH` ; `/home/agent/.local/bin/codex-acp` était le script de l'ancien kit v2. | ||
| 125 | + L'assistant propose `codex-acp` (l'ancien chemin reste reconnu) ; exemple, guides EN + FR et « Ajouter un agent » mis à jour. | ||
| 126 | + - id: 5 | ||
| 127 | + author: | ||
| 128 | + name: k33g | ||
| 129 | + email: ph.charriere@gmail.com | ||
| 130 | + createdAt: 2026-11-10T05:31:48.000Z | ||
| 131 | + body: | | ||
| 132 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | ||
| 133 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | ||
| 134 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | ||
| 135 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | ||
added
.tickets/issues/0083-guide-ajouter-un-agent-claude-acp-dans-une-sandbox.yaml +44 -0 | new file mode 100644 | ||
| @@ -0,0 +1,44 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 83 | |
| 3 | +title: "Guide : ajouter un agent Claude ACP dans une sandbox sbx" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-09T06:48:45.000Z | |
| 9 | +updatedAt: 2026-11-09T06:50:02.000Z | |
| 10 | +labels: | |
| 11 | + - documentation | |
| 12 | + - citizen-ux | |
| 13 | +milestone: "M8 · Divers ajouts" | |
| 14 | +epic: Docker SBX | |
| 15 | +related: | |
| 16 | + - 81 | |
| 17 | +body: | | |
| 18 | + Un exemple existe dans [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) : un `sbxenv.yaml` | |
| 19 | + (kit `docker.io/sbx/claude-acp`, clé Anthropic injectée par sbx via `bindings`) et l'entrée à ajouter | |
| 20 | + dans la liste des agents de Sidekicks (`sbx exec -i claude-acp claude-agent-acp`, `runtime.lifecycle`). | |
| 21 | + | |
| 22 | + Écrire un guide pratique (EN + FR) qui explique, pas à pas, comment ajouter ce type d'agent : | |
| 23 | + avec l'assistant **Add an agent** (dépôt du `sbxenv.yaml`), ou à la main dans **Settings**. | |
| 24 | + | |
| 25 | + ## Critères d'acceptation | |
| 26 | + - Guide EN `docs/en/how-to/add-a-claude-agent-in-a-sandbox.md` et FR | |
| 27 | + `docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md`, au format Diátaxis (how-to). | |
| 28 | + - Le `sbxenv.yaml` et l'entrée YAML complets, la clé Anthropic hors de la configuration de Sidekicks. | |
| 29 | + - Vérifier que tout marche, variantes, et liens vers le guide sbx général ; guide listé dans les index EN + FR. | |
| 30 | +tasks: [] | |
| 31 | +comments: | |
| 32 | + - id: 1 | |
| 33 | + author: | |
| 34 | + name: k33g | |
| 35 | + email: ph.charriere@gmail.com | |
| 36 | + createdAt: 2026-11-09T06:50:02.000Z | |
| 37 | + body: | | |
| 38 | + Fait : [guide EN](docs/en/how-to/add-a-claude-agent-in-a-sandbox.md) et [guide FR](docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md), | |
| 39 | + listés dans les index et liés depuis le guide sbx général. | |
| 40 | + - Deux chemins : l'assistant (dépôt du `sbxenv.yaml`, programme `claude-agent-acp`, arguments vides — il produit | |
| 41 | + exactement l'entrée de l'exemple) ou l'entrée YAML dans **Settings**. | |
| 42 | + - L'exemple [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) est versionné avec le guide. | |
| 43 | + - Non vérifié (pas de sbx ici) : la commande exacte qui enregistre la clé Anthropic dans sbx ; le guide renvoie à | |
| 44 | + `sbx secret --help`. À compléter après un essai sur le Mac. | |
| new file mode 100644 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 83 | ||
| 3 | +title: "Guide : ajouter un agent Claude ACP dans une sandbox sbx" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-09T06:48:45.000Z | ||
| 9 | +updatedAt: 2026-11-09T06:50:02.000Z | ||
| 10 | +labels: | ||
| 11 | + - documentation | ||
| 12 | + - citizen-ux | ||
| 13 | +milestone: "M8 · Divers ajouts" | ||
| 14 | +epic: Docker SBX | ||
| 15 | +related: | ||
| 16 | + - 81 | ||
| 17 | +body: | | ||
| 18 | + Un exemple existe dans [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) : un `sbxenv.yaml` | ||
| 19 | + (kit `docker.io/sbx/claude-acp`, clé Anthropic injectée par sbx via `bindings`) et l'entrée à ajouter | ||
| 20 | + dans la liste des agents de Sidekicks (`sbx exec -i claude-acp claude-agent-acp`, `runtime.lifecycle`). | ||
| 21 | + | ||
| 22 | + Écrire un guide pratique (EN + FR) qui explique, pas à pas, comment ajouter ce type d'agent : | ||
| 23 | + avec l'assistant **Add an agent** (dépôt du `sbxenv.yaml`), ou à la main dans **Settings**. | ||
| 24 | + | ||
| 25 | + ## Critères d'acceptation | ||
| 26 | + - Guide EN `docs/en/how-to/add-a-claude-agent-in-a-sandbox.md` et FR | ||
| 27 | + `docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md`, au format Diátaxis (how-to). | ||
| 28 | + - Le `sbxenv.yaml` et l'entrée YAML complets, la clé Anthropic hors de la configuration de Sidekicks. | ||
| 29 | + - Vérifier que tout marche, variantes, et liens vers le guide sbx général ; guide listé dans les index EN + FR. | ||
| 30 | +tasks: [] | ||
| 31 | +comments: | ||
| 32 | + - id: 1 | ||
| 33 | + author: | ||
| 34 | + name: k33g | ||
| 35 | + email: ph.charriere@gmail.com | ||
| 36 | + createdAt: 2026-11-09T06:50:02.000Z | ||
| 37 | + body: | | ||
| 38 | + Fait : [guide EN](docs/en/how-to/add-a-claude-agent-in-a-sandbox.md) et [guide FR](docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md), | ||
| 39 | + listés dans les index et liés depuis le guide sbx général. | ||
| 40 | + - Deux chemins : l'assistant (dépôt du `sbxenv.yaml`, programme `claude-agent-acp`, arguments vides — il produit | ||
| 41 | + exactement l'entrée de l'exemple) ou l'entrée YAML dans **Settings**. | ||
| 42 | + - L'exemple [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) est versionné avec le guide. | ||
| 43 | + - Non vérifié (pas de sbx ici) : la commande exacte qui enregistre la clé Anthropic dans sbx ; le guide renvoie à | ||
| 44 | + `sbx secret --help`. À compléter après un essai sur le Mac. | ||
added
.tickets/issues/0084-simplifier-l-ajout-d-une-sbx-avec-gemini-acp.yaml +118 -0 | new file mode 100644 | ||
| @@ -0,0 +1,118 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 84 | |
| 3 | +title: "Simplifier l'ajout d'une sbx avec Gemini ACP" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-10T04:26:00.000Z | |
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::config | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Docker SBX | |
| 17 | +related: | |
| 18 | + - 81 | |
| 19 | + - 82 | |
| 20 | +body: | | |
| 21 | + Aujourd'hui, ajouter un agent **Gemini** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | |
| 22 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | |
| 23 | + suppression), la commande ACP de Gemini CLI dans la sandbox, et l'authentification. | |
| 24 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | |
| 25 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | |
| 26 | + doit proposer ce cas tout prêt, comme pour Claude (#81, déjà fait). | |
| 27 | + | |
| 28 | + ## Idée | |
| 29 | + - Suivre ce qui a été fait pour Claude (#81) : un exemple `agents/snippets/gemini-acp` (`sbxenv.yaml` + README), | |
| 30 | + le programme Gemini proposé dans la liste **Programme** en mode sbx, une note sous le programme (kit, clé, lien vers le guide), | |
| 31 | + et l'entrée produite à partir du `sbxenv.yaml` déposé sur l'assistant. | |
| 32 | + - Un guide « Ajouter un agent Gemini dans une sandbox » EN + FR, sur le modèle du guide #83. | |
| 33 | + | |
| 34 | + ## À vérifier | |
| 35 | + - Gemini CLI parle ACP lui-même, sans wrapper : vérifier l'option de la version à utiliser (`gemini --experimental-acp`, ou `--acp` dans les versions récentes). | |
| 36 | + - L'image / le kit sbx à utiliser, et comment y installer Gemini CLI : préinstallé dans un kit, ou installé | |
| 37 | + à la création de la sandbox. | |
| 38 | + - L'authentification : connexion au compte Google ou clé `GEMINI_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | |
| 39 | + - Les commandes et capacités annoncées par Gemini CLI (slash commands, `session/load`, permissions). | |
| 40 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | |
| 41 | + | |
| 42 | + ## Critères d'acceptation | |
| 43 | + - Depuis une installation neuve, un agent Gemini en sbx est ajouté en quelques clics, démarre et répond. | |
| 44 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | |
| 45 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | |
| 46 | +tasks: | |
| 47 | + - id: 1 | |
| 48 | + title: "Créer l'exemple agents/snippets/gemini-acp (sbxenv.yaml, README, workspace/)" | |
| 49 | + state: closed | |
| 50 | + priority: high | |
| 51 | + author: | |
| 52 | + name: k33g | |
| 53 | + email: ph.charriere@gmail.com | |
| 54 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 55 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 56 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 57 | + - id: 2 | |
| 58 | + title: "Proposer gemini dans la liste des programmes en mode sbx, avec --acp dans les arguments" | |
| 59 | + state: closed | |
| 60 | + priority: high | |
| 61 | + author: | |
| 62 | + name: k33g | |
| 63 | + email: ph.charriere@gmail.com | |
| 64 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 65 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 66 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 67 | + - id: 3 | |
| 68 | + title: "Note sous le programme (kit tiers, clé Gemini, guide) et bloc « fichier de configuration » caché" | |
| 69 | + state: closed | |
| 70 | + priority: medium | |
| 71 | + author: | |
| 72 | + name: k33g | |
| 73 | + email: ph.charriere@gmail.com | |
| 74 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 75 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 76 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 77 | + - id: 4 | |
| 78 | + title: "Tests ; guide « Ajouter un agent Gemini dans une sandbox sbx » EN + FR" | |
| 79 | + state: closed | |
| 80 | + priority: medium | |
| 81 | + author: | |
| 82 | + name: k33g | |
| 83 | + email: ph.charriere@gmail.com | |
| 84 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 85 | + updatedAt: 2026-11-10T04:43:20.000Z | |
| 86 | + closedAt: 2026-11-10T04:43:20.000Z | |
| 87 | +comments: | |
| 88 | + - id: 1 | |
| 89 | + author: | |
| 90 | + name: k33g | |
| 91 | + email: ph.charriere@gmail.com | |
| 92 | + createdAt: 2026-11-10T04:43:20.000Z | |
| 93 | + body: | | |
| 94 | + Fait comme #81 et #82. | |
| 95 | + - Exemple : [agents/snippets/gemini-acp](agents/snippets/gemini-acp/README.md) — kit `docker.io/sbx/gemini-kit` (Gemini CLI à jour, image Docker vérifiée), `agent: gemini`, `bindings.google` (clé : `sbx secret set google`, domaines `generativelanguage.googleapis.com`, `aiplatform.googleapis.com`, `vertexai.googleapis.com` ; OAuth `accounts.google.com`, `oauth2.googleapis.com`). | |
| 96 | + - Gemini CLI parle ACP lui-même : programme `gemini --acp` (`--experimental-acp` pour les anciennes versions, reconnu aussi). | |
| 97 | + - Docker indique `gemini-kit` comme déprécié au profit du kit `antigravity` : signalé dans le guide. | |
| 98 | + - Docs EN + FR : guide « Ajouter un agent Gemini dans une sandbox sbx », « Ajouter un agent », index. | |
| 99 | + - À vérifier sur le Mac : le nom `google` des `bindings` (repris de la page du kit) et le démarrage réel. | |
| 100 | + - id: 2 | |
| 101 | + author: | |
| 102 | + name: k33g | |
| 103 | + email: ph.charriere@gmail.com | |
| 104 | + createdAt: 2026-11-10T04:51:02.000Z | |
| 105 | + body: | | |
| 106 | + Corrigé à la demande : la liste **Programme** propose `gemini` seul ; le choisir remplit **Arguments** avec `--acp` | |
| 107 | + (sauf si d'autres arguments ont été tapés). `sbxArguments` dans [agentform.ts](frontend/src/lib/agentform.ts) ; guides EN + FR et README de l'exemple mis à jour. | |
| 108 | + - id: 3 | |
| 109 | + author: | |
| 110 | + name: k33g | |
| 111 | + email: ph.charriere@gmail.com | |
| 112 | + createdAt: 2026-11-10T05:31:48.000Z | |
| 113 | + body: | | |
| 114 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | |
| 115 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | |
| 116 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | |
| 117 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | |
| 118 | + Vérifié sur le Mac : Gemini fonctionne (`gemini` + `--acp`, kit `docker.io/sbx/gemini-kit`). | |
| new file mode 100644 | |||
| @@ -0,0 +1,118 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 84 | ||
| 3 | +title: "Simplifier l'ajout d'une sbx avec Gemini ACP" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-10T04:26:00.000Z | ||
| 9 | +updatedAt: 2026-11-10T05:31:48.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::config | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Docker SBX | ||
| 17 | +related: | ||
| 18 | + - 81 | ||
| 19 | + - 82 | ||
| 20 | +body: | | ||
| 21 | + Aujourd'hui, ajouter un agent **Gemini** qui tourne dans une sandbox **sbx** demande de tout écrire à la main : | ||
| 22 | + le fichier `sbxenv.yaml` (nom, kit, dossier partagé), les commandes `runtime.lifecycle` (création, | ||
| 23 | + suppression), la commande ACP de Gemini CLI dans la sandbox, et l'authentification. | ||
| 24 | + C'est hors de portée d'un citizen user. L'assistant **Ajouter un agent** | ||
| 25 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)) | ||
| 26 | + doit proposer ce cas tout prêt, comme pour Claude (#81, déjà fait). | ||
| 27 | + | ||
| 28 | + ## Idée | ||
| 29 | + - Suivre ce qui a été fait pour Claude (#81) : un exemple `agents/snippets/gemini-acp` (`sbxenv.yaml` + README), | ||
| 30 | + le programme Gemini proposé dans la liste **Programme** en mode sbx, une note sous le programme (kit, clé, lien vers le guide), | ||
| 31 | + et l'entrée produite à partir du `sbxenv.yaml` déposé sur l'assistant. | ||
| 32 | + - Un guide « Ajouter un agent Gemini dans une sandbox » EN + FR, sur le modèle du guide #83. | ||
| 33 | + | ||
| 34 | + ## À vérifier | ||
| 35 | + - Gemini CLI parle ACP lui-même, sans wrapper : vérifier l'option de la version à utiliser (`gemini --experimental-acp`, ou `--acp` dans les versions récentes). | ||
| 36 | + - L'image / le kit sbx à utiliser, et comment y installer Gemini CLI : préinstallé dans un kit, ou installé | ||
| 37 | + à la création de la sandbox. | ||
| 38 | + - L'authentification : connexion au compte Google ou clé `GEMINI_API_KEY`, via les secrets de sbx — sans jamais écrire de secret dans le YAML de Sidekicks. | ||
| 39 | + - Les commandes et capacités annoncées par Gemini CLI (slash commands, `session/load`, permissions). | ||
| 40 | + - Le dossier de travail monté depuis l'hôte, pour que **Files**, le terminal et **Show where it is** marchent. | ||
| 41 | + | ||
| 42 | + ## Critères d'acceptation | ||
| 43 | + - Depuis une installation neuve, un agent Gemini en sbx est ajouté en quelques clics, démarre et répond. | ||
| 44 | + - Un message clair si sbx, le kit ou l'authentification manque, avec quoi faire. | ||
| 45 | + - Tests (formulaire, YAML produit) ; textes EN + FR ; guide « ajouter un agent » et « agent dans une sandbox » EN + FR. | ||
| 46 | +tasks: | ||
| 47 | + - id: 1 | ||
| 48 | + title: "Créer l'exemple agents/snippets/gemini-acp (sbxenv.yaml, README, workspace/)" | ||
| 49 | + state: closed | ||
| 50 | + priority: high | ||
| 51 | + author: | ||
| 52 | + name: k33g | ||
| 53 | + email: ph.charriere@gmail.com | ||
| 54 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 55 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 56 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 57 | + - id: 2 | ||
| 58 | + title: "Proposer gemini dans la liste des programmes en mode sbx, avec --acp dans les arguments" | ||
| 59 | + state: closed | ||
| 60 | + priority: high | ||
| 61 | + author: | ||
| 62 | + name: k33g | ||
| 63 | + email: ph.charriere@gmail.com | ||
| 64 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 65 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 66 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 67 | + - id: 3 | ||
| 68 | + title: "Note sous le programme (kit tiers, clé Gemini, guide) et bloc « fichier de configuration » caché" | ||
| 69 | + state: closed | ||
| 70 | + priority: medium | ||
| 71 | + author: | ||
| 72 | + name: k33g | ||
| 73 | + email: ph.charriere@gmail.com | ||
| 74 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 75 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 76 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 77 | + - id: 4 | ||
| 78 | + title: "Tests ; guide « Ajouter un agent Gemini dans une sandbox sbx » EN + FR" | ||
| 79 | + state: closed | ||
| 80 | + priority: medium | ||
| 81 | + author: | ||
| 82 | + name: k33g | ||
| 83 | + email: ph.charriere@gmail.com | ||
| 84 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 85 | + updatedAt: 2026-11-10T04:43:20.000Z | ||
| 86 | + closedAt: 2026-11-10T04:43:20.000Z | ||
| 87 | +comments: | ||
| 88 | + - id: 1 | ||
| 89 | + author: | ||
| 90 | + name: k33g | ||
| 91 | + email: ph.charriere@gmail.com | ||
| 92 | + createdAt: 2026-11-10T04:43:20.000Z | ||
| 93 | + body: | | ||
| 94 | + Fait comme #81 et #82. | ||
| 95 | + - Exemple : [agents/snippets/gemini-acp](agents/snippets/gemini-acp/README.md) — kit `docker.io/sbx/gemini-kit` (Gemini CLI à jour, image Docker vérifiée), `agent: gemini`, `bindings.google` (clé : `sbx secret set google`, domaines `generativelanguage.googleapis.com`, `aiplatform.googleapis.com`, `vertexai.googleapis.com` ; OAuth `accounts.google.com`, `oauth2.googleapis.com`). | ||
| 96 | + - Gemini CLI parle ACP lui-même : programme `gemini --acp` (`--experimental-acp` pour les anciennes versions, reconnu aussi). | ||
| 97 | + - Docker indique `gemini-kit` comme déprécié au profit du kit `antigravity` : signalé dans le guide. | ||
| 98 | + - Docs EN + FR : guide « Ajouter un agent Gemini dans une sandbox sbx », « Ajouter un agent », index. | ||
| 99 | + - À vérifier sur le Mac : le nom `google` des `bindings` (repris de la page du kit) et le démarrage réel. | ||
| 100 | + - id: 2 | ||
| 101 | + author: | ||
| 102 | + name: k33g | ||
| 103 | + email: ph.charriere@gmail.com | ||
| 104 | + createdAt: 2026-11-10T04:51:02.000Z | ||
| 105 | + body: | | ||
| 106 | + Corrigé à la demande : la liste **Programme** propose `gemini` seul ; le choisir remplit **Arguments** avec `--acp` | ||
| 107 | + (sauf si d'autres arguments ont été tapés). `sbxArguments` dans [agentform.ts](frontend/src/lib/agentform.ts) ; guides EN + FR et README de l'exemple mis à jour. | ||
| 108 | + - id: 3 | ||
| 109 | + author: | ||
| 110 | + name: k33g | ||
| 111 | + email: ph.charriere@gmail.com | ||
| 112 | + createdAt: 2026-11-10T05:31:48.000Z | ||
| 113 | + body: | | ||
| 114 | + Le programme suit maintenant le `sbxenv.yaml` : déposé ou choisi dans l'assistant, son `agent:` (`claude`, `codex` ou `gemini`) | ||
| 115 | + choisit le programme (`claude-agent-acp`, `codex-acp`, `gemini` + `--acp`) quand le champ est vide ou contient un programme de la liste ; | ||
| 116 | + un programme tapé à la main est gardé (`withSbxProgram` dans [agentform.ts](frontend/src/lib/agentform.ts)). Et l'assistant refuse un `sbxenv.yaml` | ||
| 117 | + dont l'`agent:` n'est pas celui du programme (`sandboxMismatch`). Guides EN + FR mis à jour. | ||
| 118 | + Vérifié sur le Mac : Gemini fonctionne (`gemini` + `--acp`, kit `docker.io/sbx/gemini-kit`). | ||
added
.tickets/issues/0085-verifier-le-mode-yolo-des-agents-avec-acp.yaml +41 -0 | new file mode 100644 | ||
| @@ -0,0 +1,41 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 85 | |
| 3 | +title: Vérifier le mode yolo des agents avec ACP | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-10T04:56:42.000Z | |
| 9 | +updatedAt: 2026-11-10T04:56:42.000Z | |
| 10 | +labels: | |
| 11 | + - kind::spike | |
| 12 | + - area::acp | |
| 13 | + - real-agents | |
| 14 | +epic: Client ACP | |
| 15 | +related: | |
| 16 | + - 81 | |
| 17 | + - 82 | |
| 18 | + - 84 | |
| 19 | +body: | | |
| 20 | + Plusieurs agents ont un mode « yolo » qui exécute les outils (écrire un fichier, lancer une commande) | |
| 21 | + sans demander l'accord de l'utilisateur. Par exemple, le kit `docker.io/sbx/gemini-kit` lance `gemini --yolo` | |
| 22 | + et autorise ce mode dans `~/.gemini/settings.json`. Claude Code a `bypassPermissions` et Codex sa politique d'approbation. | |
| 23 | + Il faut savoir ce que devient ce mode quand l'agent parle ACP à Sidekicks. | |
| 24 | + | |
| 25 | + ## À vérifier | |
| 26 | + - Avec `--acp`, l'agent envoie-t-il encore `session/request_permission`, ou exécute-t-il tout sans rien demander ? | |
| 27 | + Est-ce que `gemini --acp --yolo` (ou le réglage du kit) change ce comportement ? | |
| 28 | + - Les mêmes questions pour `claude-agent-acp` (mode `bypassPermissions`) et `codex-acp` (politique d'approbation), | |
| 29 | + dans leurs kits sbx (#81, #82, #84). | |
| 30 | + - Les modes que l'agent annonce par ACP (`modes` dans la réponse à `session/new`, `session/set_mode`) : | |
| 31 | + le yolo en fait-il partie, et Sidekicks devrait-il permettre d'en changer ? | |
| 32 | + - Ce que voit l'utilisateur dans Sidekicks en mode yolo : les appels d'outils restent-ils affichés dans la conversation ? | |
| 33 | + - Le risque dans une sandbox sbx (dossier `workspace/` partagé avec l'hôte) par rapport à un agent lancé sur l'ordinateur. | |
| 34 | + | |
| 35 | + ## Résultat attendu | |
| 36 | + - Un tableau par agent (Gemini, Claude, Codex, mm) : demande d'accord ou non, avec quelle option, et ce que Sidekicks affiche. | |
| 37 | + - Une décision : dans Sidekicks, laisser le yolo à la configuration de l'agent, l'afficher (un badge sur l'agent), | |
| 38 | + ou le bloquer hors sandbox. Si du travail en découle, des tickets séparés. | |
| 39 | + - Les guides « Ajouter un agent … dans une sandbox sbx » complétés (EN + FR). | |
| 40 | +tasks: [] | |
| 41 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 85 | ||
| 3 | +title: Vérifier le mode yolo des agents avec ACP | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-10T04:56:42.000Z | ||
| 9 | +updatedAt: 2026-11-10T04:56:42.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::spike | ||
| 12 | + - area::acp | ||
| 13 | + - real-agents | ||
| 14 | +epic: Client ACP | ||
| 15 | +related: | ||
| 16 | + - 81 | ||
| 17 | + - 82 | ||
| 18 | + - 84 | ||
| 19 | +body: | | ||
| 20 | + Plusieurs agents ont un mode « yolo » qui exécute les outils (écrire un fichier, lancer une commande) | ||
| 21 | + sans demander l'accord de l'utilisateur. Par exemple, le kit `docker.io/sbx/gemini-kit` lance `gemini --yolo` | ||
| 22 | + et autorise ce mode dans `~/.gemini/settings.json`. Claude Code a `bypassPermissions` et Codex sa politique d'approbation. | ||
| 23 | + Il faut savoir ce que devient ce mode quand l'agent parle ACP à Sidekicks. | ||
| 24 | + | ||
| 25 | + ## À vérifier | ||
| 26 | + - Avec `--acp`, l'agent envoie-t-il encore `session/request_permission`, ou exécute-t-il tout sans rien demander ? | ||
| 27 | + Est-ce que `gemini --acp --yolo` (ou le réglage du kit) change ce comportement ? | ||
| 28 | + - Les mêmes questions pour `claude-agent-acp` (mode `bypassPermissions`) et `codex-acp` (politique d'approbation), | ||
| 29 | + dans leurs kits sbx (#81, #82, #84). | ||
| 30 | + - Les modes que l'agent annonce par ACP (`modes` dans la réponse à `session/new`, `session/set_mode`) : | ||
| 31 | + le yolo en fait-il partie, et Sidekicks devrait-il permettre d'en changer ? | ||
| 32 | + - Ce que voit l'utilisateur dans Sidekicks en mode yolo : les appels d'outils restent-ils affichés dans la conversation ? | ||
| 33 | + - Le risque dans une sandbox sbx (dossier `workspace/` partagé avec l'hôte) par rapport à un agent lancé sur l'ordinateur. | ||
| 34 | + | ||
| 35 | + ## Résultat attendu | ||
| 36 | + - Un tableau par agent (Gemini, Claude, Codex, mm) : demande d'accord ou non, avec quelle option, et ce que Sidekicks affiche. | ||
| 37 | + - Une décision : dans Sidekicks, laisser le yolo à la configuration de l'agent, l'afficher (un badge sur l'agent), | ||
| 38 | + ou le bloquer hors sandbox. Si du travail en découle, des tickets séparés. | ||
| 39 | + - Les guides « Ajouter un agent … dans une sandbox sbx » complétés (EN + FR). | ||
| 40 | +tasks: [] | ||
| 41 | +comments: [] | ||
added
.tickets/issues/0086-simplifier-l-ajout-d-une-sbx-avec-mistral-vibe-acp.yaml +45 -0 | new file mode 100644 | ||
| @@ -0,0 +1,45 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 86 | |
| 3 | +title: "Simplifier l'ajout d'une sbx avec Mistral Vibe ACP" | |
| 4 | +state: open | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-10T05:33:49.000Z | |
| 9 | +updatedAt: 2026-11-10T05:33:49.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::config | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +epic: Docker SBX | |
| 16 | +related: | |
| 17 | + - 81 | |
| 18 | + - 82 | |
| 19 | + - 84 | |
| 20 | +body: | | |
| 21 | + Faire pour **Mistral Vibe** ce qui a été fait pour Claude (#81), Codex (#82) et Gemini (#84) : ajouter en quelques clics | |
| 22 | + un agent Vibe qui tourne dans une sandbox **sbx**, depuis l'assistant **Ajouter un agent** | |
| 23 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)). | |
| 24 | + | |
| 25 | + ## Idée | |
| 26 | + - Un exemple `agents/snippets/vibe-acp` (`sbxenv.yaml`, README avec l'entrée de l'agent, `workspace/`). | |
| 27 | + - Ajouter Vibe à `sbxPrograms` / `sbxArguments` : le programme proposé en mode sbx, choisi automatiquement d'après | |
| 28 | + l'`agent:` du `sbxenv.yaml` déposé, une note sous le programme (kit tiers, clé, guide), le bloc « fichier de configuration » caché. | |
| 29 | + - Un guide « Ajouter un agent Vibe dans une sandbox sbx » EN + FR, sur le modèle des guides Claude, Codex et Gemini. | |
| 30 | + | |
| 31 | + ## À vérifier | |
| 32 | + - Le kit : `docker.io/sbx/vibe` (kit v3 de [sbx-kits-contrib](https://github.com/docker/sbx-kits-contrib), branche `v3`, dossier `vibe`), | |
| 33 | + et le nom de l'agent sbx à mettre dans `agent:`. | |
| 34 | + - Le programme ACP : `vibe-acp` (installé avec le paquet `mistral-vibe`), ou `vibe` avec une option ; présent dans le `PATH` de la sandbox ? | |
| 35 | + - L'authentification : clé Mistral enregistrée dans sbx (`sbx secret set mistral`, injectée pour `api.mistral.ai`), | |
| 36 | + jamais écrite dans le YAML de Sidekicks ; les `bindings` à mettre dans le `sbxenv.yaml`. | |
| 37 | + - Le kit pré-accorde l'approbation des outils : lien avec #85 (mode yolo et ACP). | |
| 38 | + - Les commandes et capacités annoncées par Vibe (slash commands, `session/load`, permissions). | |
| 39 | + | |
| 40 | + ## Critères d'acceptation | |
| 41 | + - Depuis une installation neuve, un agent Vibe en sbx est ajouté en quelques clics, démarre et répond. | |
| 42 | + - Un message clair si sbx, le kit ou la clé manque, avec quoi faire. | |
| 43 | + - Tests (formulaire, programme choisi d'après le `sbxenv.yaml`) ; textes EN + FR ; guides EN + FR. | |
| 44 | +tasks: [] | |
| 45 | +comments: [] | |
| new file mode 100644 | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 86 | ||
| 3 | +title: "Simplifier l'ajout d'une sbx avec Mistral Vibe ACP" | ||
| 4 | +state: open | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-10T05:33:49.000Z | ||
| 9 | +updatedAt: 2026-11-10T05:33:49.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::config | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +epic: Docker SBX | ||
| 16 | +related: | ||
| 17 | + - 81 | ||
| 18 | + - 82 | ||
| 19 | + - 84 | ||
| 20 | +body: | | ||
| 21 | + Faire pour **Mistral Vibe** ce qui a été fait pour Claude (#81), Codex (#82) et Gemini (#84) : ajouter en quelques clics | ||
| 22 | + un agent Vibe qui tourne dans une sandbox **sbx**, depuis l'assistant **Ajouter un agent** | ||
| 23 | + ([AddAgentForm.svelte](frontend/src/lib/agent/AddAgentForm.svelte), [agentform.ts](frontend/src/lib/agentform.ts)). | ||
| 24 | + | ||
| 25 | + ## Idée | ||
| 26 | + - Un exemple `agents/snippets/vibe-acp` (`sbxenv.yaml`, README avec l'entrée de l'agent, `workspace/`). | ||
| 27 | + - Ajouter Vibe à `sbxPrograms` / `sbxArguments` : le programme proposé en mode sbx, choisi automatiquement d'après | ||
| 28 | + l'`agent:` du `sbxenv.yaml` déposé, une note sous le programme (kit tiers, clé, guide), le bloc « fichier de configuration » caché. | ||
| 29 | + - Un guide « Ajouter un agent Vibe dans une sandbox sbx » EN + FR, sur le modèle des guides Claude, Codex et Gemini. | ||
| 30 | + | ||
| 31 | + ## À vérifier | ||
| 32 | + - Le kit : `docker.io/sbx/vibe` (kit v3 de [sbx-kits-contrib](https://github.com/docker/sbx-kits-contrib), branche `v3`, dossier `vibe`), | ||
| 33 | + et le nom de l'agent sbx à mettre dans `agent:`. | ||
| 34 | + - Le programme ACP : `vibe-acp` (installé avec le paquet `mistral-vibe`), ou `vibe` avec une option ; présent dans le `PATH` de la sandbox ? | ||
| 35 | + - L'authentification : clé Mistral enregistrée dans sbx (`sbx secret set mistral`, injectée pour `api.mistral.ai`), | ||
| 36 | + jamais écrite dans le YAML de Sidekicks ; les `bindings` à mettre dans le `sbxenv.yaml`. | ||
| 37 | + - Le kit pré-accorde l'approbation des outils : lien avec #85 (mode yolo et ACP). | ||
| 38 | + - Les commandes et capacités annoncées par Vibe (slash commands, `session/load`, permissions). | ||
| 39 | + | ||
| 40 | + ## Critères d'acceptation | ||
| 41 | + - Depuis une installation neuve, un agent Vibe en sbx est ajouté en quelques clics, démarre et répond. | ||
| 42 | + - Un message clair si sbx, le kit ou la clé manque, avec quoi faire. | ||
| 43 | + - Tests (formulaire, programme choisi d'après le `sbxenv.yaml`) ; textes EN + FR ; guides EN + FR. | ||
| 44 | +tasks: [] | ||
| 45 | +comments: [] | ||
added
.tickets/issues/0087-simplifier-l-ajout-d-une-sbx-avec-docker-agent.yaml +102 -0 | new file mode 100644 | ||
| @@ -0,0 +1,102 @@ | ||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | |
| 2 | +id: 87 | |
| 3 | +title: "Simplifier l'ajout d'une sbx avec Docker Agent (docker-agent)" | |
| 4 | +state: closed | |
| 5 | +author: | |
| 6 | + name: k33g | |
| 7 | + email: ph.charriere@gmail.com | |
| 8 | +createdAt: 2026-11-10T05:40:48.000Z | |
| 9 | +updatedAt: 2026-11-10T06:18:51.000Z | |
| 10 | +labels: | |
| 11 | + - kind::feature | |
| 12 | + - area::config | |
| 13 | + - citizen-ux | |
| 14 | + - real-agents | |
| 15 | +milestone: "M8 · Divers ajouts" | |
| 16 | +epic: Docker SBX | |
| 17 | +related: | |
| 18 | + - 81 | |
| 19 | + - 82 | |
| 20 | + - 84 | |
| 21 | +body: | | |
| 22 | + Faire pour **Docker Agent** (`docker-agent`) ce qui a été fait pour Claude (#81), Codex (#82), Gemini (#84) et mini-me : | |
| 23 | + déposer ou choisir le `sbxenv.yaml` dans l'assistant **Ajouter un agent** choisit le programme, et un exemple | |
| 24 | + prêt à l'emploi est dans `agents/snippets`. | |
| 25 | + | |
| 26 | + ## Approche | |
| 27 | + - `docker-agent` est un agent connu de sbx (`agent: docker-agent`, alias `cagent`) : la sandbox n'a besoin d'aucun kit. | |
| 28 | + Le kit v3 `docker.io/sbx/docker-agent` de sbx-kits-contrib ne se charge pas encore tant que l'agent intégré existe. | |
| 29 | + - Le programme est `docker-agent` avec `serve acp` ; comme pour mm, le fichier de l'agent (`agent.yaml`) déposé | |
| 30 | + ensuite s'ajoute aux arguments (`serve acp …/agent.yaml`). | |
| 31 | + - La clé du fournisseur du modèle reste dans sbx (`sbx secret set anthropic`…), jamais dans le YAML. | |
| 32 | + | |
| 33 | + ## Critères d'acceptation | |
| 34 | + - Le `sbxenv.yaml` d'une sandbox `docker-agent` choisit le programme et ses arguments ; un programme tapé à la main est gardé. | |
| 35 | + - Un exemple `agents/snippets/docker-agent-acp` (`sbxenv.yaml`, `workspace/agent.yaml`, README). | |
| 36 | + - Tests ; docs EN + FR. | |
| 37 | +tasks: | |
| 38 | + - id: 1 | |
| 39 | + title: "Choisir docker-agent (serve acp) d'après agent: docker-agent ou cagent" | |
| 40 | + state: closed | |
| 41 | + priority: high | |
| 42 | + author: | |
| 43 | + name: k33g | |
| 44 | + email: ph.charriere@gmail.com | |
| 45 | + createdAt: 2026-11-10T05:40:48.000Z | |
| 46 | + updatedAt: 2026-11-10T05:40:48.000Z | |
| 47 | + closedAt: 2026-11-10T05:40:48.000Z | |
| 48 | + - id: 2 | |
| 49 | + title: "Exemple agents/snippets/docker-agent-acp" | |
| 50 | + state: closed | |
| 51 | + priority: medium | |
| 52 | + author: | |
| 53 | + name: k33g | |
| 54 | + email: ph.charriere@gmail.com | |
| 55 | + createdAt: 2026-11-10T05:40:48.000Z | |
| 56 | + updatedAt: 2026-11-10T05:40:48.000Z | |
| 57 | + closedAt: 2026-11-10T05:40:48.000Z | |
| 58 | + - id: 3 | |
| 59 | + title: "Tests vitest ; docs EN + FR (lancer un agent dans une sandbox, ajouter un agent)" | |
| 60 | + state: closed | |
| 61 | + priority: medium | |
| 62 | + author: | |
| 63 | + name: k33g | |
| 64 | + email: ph.charriere@gmail.com | |
| 65 | + createdAt: 2026-11-10T05:40:48.000Z | |
| 66 | + updatedAt: 2026-11-10T05:40:48.000Z | |
| 67 | + closedAt: 2026-11-10T05:40:48.000Z | |
| 68 | +comments: | |
| 69 | + - id: 1 | |
| 70 | + author: | |
| 71 | + name: k33g | |
| 72 | + email: ph.charriere@gmail.com | |
| 73 | + createdAt: 2026-11-10T05:40:48.000Z | |
| 74 | + body: | | |
| 75 | + Fait. | |
| 76 | + - [agentform.ts](frontend/src/lib/agentform.ts) : `programOfSandbox` donne `docker-agent` + `serve acp` pour `agent: docker-agent` ou `cagent` | |
| 77 | + (et `mm` + `--acp` pour un kit mini-me) ; `withSbxProgram` remplace un programme de la liste (`docker agent` compris), garde un programme tapé. | |
| 78 | + Un fichier d'agent donné avant le `sbxenv.yaml` est repris dans les arguments. | |
| 79 | + - Exemples : [agents/snippets/docker-agent-acp](agents/snippets/docker-agent-acp/README.md) (modèle `anthropic/claude-sonnet-4-5`, clé dans sbx) | |
| 80 | + et [agents/snippets/mini-me-acp](agents/snippets/mini-me-acp/README.md). | |
| 81 | + - Docs EN + FR : « Lancer un agent dans une sandbox sbx », « Ajouter un agent ». | |
| 82 | + - Non vérifié : démarrage réel dans sbx (pas de sbx ici). | |
| 83 | + - id: 2 | |
| 84 | + author: | |
| 85 | + name: k33g | |
| 86 | + email: ph.charriere@gmail.com | |
| 87 | + createdAt: 2026-11-10T05:54:51.000Z | |
| 88 | + body: | | |
| 89 | + Essayé sur le Mac : la sandbox est créée (sbx résout `agent: docker-agent` vers le kit `docker.io/sbx/docker-agent`), | |
| 90 | + mais l'agent s'arrête avec « Error: accepts 1 arg(s), received 0 » : l'entrée avait `serve acp` sans le fichier d'agent. | |
| 91 | + L'assistant refuse maintenant `docker-agent serve acp` sans fichier (problème `agentFile` dans `problemsOf`), et le | |
| 92 | + message d'erreur est expliqué (`error.agentFileMissing`). Doc EN + FR : la variante dans « Lancer un agent dans une sandbox sbx ». | |
| 93 | + - id: 3 | |
| 94 | + author: | |
| 95 | + name: k33g | |
| 96 | + email: ph.charriere@gmail.com | |
| 97 | + createdAt: 2026-11-10T06:03:23.000Z | |
| 98 | + body: | | |
| 99 | + À la demande : le fichier d'agent est ajouté automatiquement d'après le `workspace` du `sbxenv.yaml`. | |
| 100 | + `ReadSandboxEnv` renvoie `agentFile`, l'`agent.yaml` (ou `agent.yml`) trouvé dans le workspace ; l'assistant en fait les | |
| 101 | + arguments (`serve acp …/agent.yaml` pour docker-agent, `--acp --config …/agent.yaml` pour mm), sauf si un fichier a déjà été déposé. | |
| 102 | + Exemples et doc EN + FR mis à jour. | |
| new file mode 100644 | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | +# Managed by IssueSpec. Hand edits are welcome; keep the schema valid. | ||
| 2 | +id: 87 | ||
| 3 | +title: "Simplifier l'ajout d'une sbx avec Docker Agent (docker-agent)" | ||
| 4 | +state: closed | ||
| 5 | +author: | ||
| 6 | + name: k33g | ||
| 7 | + email: ph.charriere@gmail.com | ||
| 8 | +createdAt: 2026-11-10T05:40:48.000Z | ||
| 9 | +updatedAt: 2026-11-10T06:18:51.000Z | ||
| 10 | +labels: | ||
| 11 | + - kind::feature | ||
| 12 | + - area::config | ||
| 13 | + - citizen-ux | ||
| 14 | + - real-agents | ||
| 15 | +milestone: "M8 · Divers ajouts" | ||
| 16 | +epic: Docker SBX | ||
| 17 | +related: | ||
| 18 | + - 81 | ||
| 19 | + - 82 | ||
| 20 | + - 84 | ||
| 21 | +body: | | ||
| 22 | + Faire pour **Docker Agent** (`docker-agent`) ce qui a été fait pour Claude (#81), Codex (#82), Gemini (#84) et mini-me : | ||
| 23 | + déposer ou choisir le `sbxenv.yaml` dans l'assistant **Ajouter un agent** choisit le programme, et un exemple | ||
| 24 | + prêt à l'emploi est dans `agents/snippets`. | ||
| 25 | + | ||
| 26 | + ## Approche | ||
| 27 | + - `docker-agent` est un agent connu de sbx (`agent: docker-agent`, alias `cagent`) : la sandbox n'a besoin d'aucun kit. | ||
| 28 | + Le kit v3 `docker.io/sbx/docker-agent` de sbx-kits-contrib ne se charge pas encore tant que l'agent intégré existe. | ||
| 29 | + - Le programme est `docker-agent` avec `serve acp` ; comme pour mm, le fichier de l'agent (`agent.yaml`) déposé | ||
| 30 | + ensuite s'ajoute aux arguments (`serve acp …/agent.yaml`). | ||
| 31 | + - La clé du fournisseur du modèle reste dans sbx (`sbx secret set anthropic`…), jamais dans le YAML. | ||
| 32 | + | ||
| 33 | + ## Critères d'acceptation | ||
| 34 | + - Le `sbxenv.yaml` d'une sandbox `docker-agent` choisit le programme et ses arguments ; un programme tapé à la main est gardé. | ||
| 35 | + - Un exemple `agents/snippets/docker-agent-acp` (`sbxenv.yaml`, `workspace/agent.yaml`, README). | ||
| 36 | + - Tests ; docs EN + FR. | ||
| 37 | +tasks: | ||
| 38 | + - id: 1 | ||
| 39 | + title: "Choisir docker-agent (serve acp) d'après agent: docker-agent ou cagent" | ||
| 40 | + state: closed | ||
| 41 | + priority: high | ||
| 42 | + author: | ||
| 43 | + name: k33g | ||
| 44 | + email: ph.charriere@gmail.com | ||
| 45 | + createdAt: 2026-11-10T05:40:48.000Z | ||
| 46 | + updatedAt: 2026-11-10T05:40:48.000Z | ||
| 47 | + closedAt: 2026-11-10T05:40:48.000Z | ||
| 48 | + - id: 2 | ||
| 49 | + title: "Exemple agents/snippets/docker-agent-acp" | ||
| 50 | + state: closed | ||
| 51 | + priority: medium | ||
| 52 | + author: | ||
| 53 | + name: k33g | ||
| 54 | + email: ph.charriere@gmail.com | ||
| 55 | + createdAt: 2026-11-10T05:40:48.000Z | ||
| 56 | + updatedAt: 2026-11-10T05:40:48.000Z | ||
| 57 | + closedAt: 2026-11-10T05:40:48.000Z | ||
| 58 | + - id: 3 | ||
| 59 | + title: "Tests vitest ; docs EN + FR (lancer un agent dans une sandbox, ajouter un agent)" | ||
| 60 | + state: closed | ||
| 61 | + priority: medium | ||
| 62 | + author: | ||
| 63 | + name: k33g | ||
| 64 | + email: ph.charriere@gmail.com | ||
| 65 | + createdAt: 2026-11-10T05:40:48.000Z | ||
| 66 | + updatedAt: 2026-11-10T05:40:48.000Z | ||
| 67 | + closedAt: 2026-11-10T05:40:48.000Z | ||
| 68 | +comments: | ||
| 69 | + - id: 1 | ||
| 70 | + author: | ||
| 71 | + name: k33g | ||
| 72 | + email: ph.charriere@gmail.com | ||
| 73 | + createdAt: 2026-11-10T05:40:48.000Z | ||
| 74 | + body: | | ||
| 75 | + Fait. | ||
| 76 | + - [agentform.ts](frontend/src/lib/agentform.ts) : `programOfSandbox` donne `docker-agent` + `serve acp` pour `agent: docker-agent` ou `cagent` | ||
| 77 | + (et `mm` + `--acp` pour un kit mini-me) ; `withSbxProgram` remplace un programme de la liste (`docker agent` compris), garde un programme tapé. | ||
| 78 | + Un fichier d'agent donné avant le `sbxenv.yaml` est repris dans les arguments. | ||
| 79 | + - Exemples : [agents/snippets/docker-agent-acp](agents/snippets/docker-agent-acp/README.md) (modèle `anthropic/claude-sonnet-4-5`, clé dans sbx) | ||
| 80 | + et [agents/snippets/mini-me-acp](agents/snippets/mini-me-acp/README.md). | ||
| 81 | + - Docs EN + FR : « Lancer un agent dans une sandbox sbx », « Ajouter un agent ». | ||
| 82 | + - Non vérifié : démarrage réel dans sbx (pas de sbx ici). | ||
| 83 | + - id: 2 | ||
| 84 | + author: | ||
| 85 | + name: k33g | ||
| 86 | + email: ph.charriere@gmail.com | ||
| 87 | + createdAt: 2026-11-10T05:54:51.000Z | ||
| 88 | + body: | | ||
| 89 | + Essayé sur le Mac : la sandbox est créée (sbx résout `agent: docker-agent` vers le kit `docker.io/sbx/docker-agent`), | ||
| 90 | + mais l'agent s'arrête avec « Error: accepts 1 arg(s), received 0 » : l'entrée avait `serve acp` sans le fichier d'agent. | ||
| 91 | + L'assistant refuse maintenant `docker-agent serve acp` sans fichier (problème `agentFile` dans `problemsOf`), et le | ||
| 92 | + message d'erreur est expliqué (`error.agentFileMissing`). Doc EN + FR : la variante dans « Lancer un agent dans une sandbox sbx ». | ||
| 93 | + - id: 3 | ||
| 94 | + author: | ||
| 95 | + name: k33g | ||
| 96 | + email: ph.charriere@gmail.com | ||
| 97 | + createdAt: 2026-11-10T06:03:23.000Z | ||
| 98 | + body: | | ||
| 99 | + À la demande : le fichier d'agent est ajouté automatiquement d'après le `workspace` du `sbxenv.yaml`. | ||
| 100 | + `ReadSandboxEnv` renvoie `agentFile`, l'`agent.yaml` (ou `agent.yml`) trouvé dans le workspace ; l'assistant en fait les | ||
| 101 | + arguments (`serve acp …/agent.yaml` pour docker-agent, `--acp --config …/agent.yaml` pour mm), sauf si un fichier a déjà été déposé. | ||
| 102 | + Exemples et doc EN + FR mis à jour. | ||
added
agents/snippets/claude-acp/README.md +18 -0 | new file mode 100644 | ||
| @@ -0,0 +1,18 @@ | ||
| 1 | +# Add Claude ACP Agent | |
| 2 | + | |
| 3 | +```yaml | |
| 4 | + - name: claude | |
| 5 | + title: Claude | |
| 6 | + icon: "📙" | |
| 7 | + command: sbx | |
| 8 | + args: [exec, -i, claude-acp, claude-agent-acp] | |
| 9 | + workspace: /Users/k33g/kDrive/citizen-developers/claude-acp/workspace | |
| 10 | + runtime: | |
| 11 | + type: sbx | |
| 12 | + sandbox: claude-acp | |
| 13 | + lifecycle: | |
| 14 | + folder: /Users/k33g/kDrive/citizen-developers/claude-acp | |
| 15 | + create: [sbx, env, create, --force] | |
| 16 | + stop: [sbx, stop, claude-acp] | |
| 17 | + remove: [sbx, env, rm, --force] | |
| 18 | +``` | |
| \ No newline at end of file | ||
| new file mode 100644 | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | +# Add Claude ACP Agent | ||
| 2 | + | ||
| 3 | +```yaml | ||
| 4 | + - name: claude | ||
| 5 | + title: Claude | ||
| 6 | + icon: "📙" | ||
| 7 | + command: sbx | ||
| 8 | + args: [exec, -i, claude-acp, claude-agent-acp] | ||
| 9 | + workspace: /Users/k33g/kDrive/citizen-developers/claude-acp/workspace | ||
| 10 | + runtime: | ||
| 11 | + type: sbx | ||
| 12 | + sandbox: claude-acp | ||
| 13 | + lifecycle: | ||
| 14 | + folder: /Users/k33g/kDrive/citizen-developers/claude-acp | ||
| 15 | + create: [sbx, env, create, --force] | ||
| 16 | + stop: [sbx, stop, claude-acp] | ||
| 17 | + remove: [sbx, env, rm, --force] | ||
| 18 | +``` | ||
| \ No newline at end of file | \ No newline at end of file | ||
added
agents/snippets/claude-acp/sbxenv.yaml +21 -0 | new file mode 100644 | ||
| @@ -0,0 +1,21 @@ | ||
| 1 | +schemaVersion: "1" | |
| 2 | + | |
| 3 | +name: claude-acp | |
| 4 | +agent: claude | |
| 5 | + | |
| 6 | +# Répertoire du projet, relatif à ce fichier. | |
| 7 | +workspace: ./workspace | |
| 8 | + | |
| 9 | +kits: | |
| 10 | + - docker.io/sbx/claude-acp:latest | |
| 11 | + | |
| 12 | +# Autorise l’injection de la clé Anthropic pour ces domaines. | |
| 13 | +bindings: | |
| 14 | + anthropic: | |
| 15 | + apiKey: | |
| 16 | + domains: | |
| 17 | + - api.anthropic.com | |
| 18 | + - console.anthropic.com | |
| 19 | + | |
| 20 | +sandboxOptions: | |
| 21 | + pullPolicy: always | |
| new file mode 100644 | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | +schemaVersion: "1" | ||
| 2 | + | ||
| 3 | +name: claude-acp | ||
| 4 | +agent: claude | ||
| 5 | + | ||
| 6 | +# Répertoire du projet, relatif à ce fichier. | ||
| 7 | +workspace: ./workspace | ||
| 8 | + | ||
| 9 | +kits: | ||
| 10 | + - docker.io/sbx/claude-acp:latest | ||
| 11 | + | ||
| 12 | +# Autorise l’injection de la clé Anthropic pour ces domaines. | ||
| 13 | +bindings: | ||
| 14 | + anthropic: | ||
| 15 | + apiKey: | ||
| 16 | + domains: | ||
| 17 | + - api.anthropic.com | ||
| 18 | + - console.anthropic.com | ||
| 19 | + | ||
| 20 | +sandboxOptions: | ||
| 21 | + pullPolicy: always | ||
added
agents/snippets/claude-acp/workspace/notes/hello.txt +0 -0 | new file mode 100644 |
| new file mode 100644 |
added
agents/snippets/docker-agent-acp/README.md +24 -0 | new file mode 100644 | ||
| @@ -0,0 +1,24 @@ | ||
| 1 | +# Add a Docker Agent (docker-agent) agent in an sbx sandbox | |
| 2 | + | |
| 3 | +`docker-agent` is an agent sbx knows (`agent: docker-agent`): the sandbox needs no kit. Sidekicks starts it with `docker-agent serve acp <agent.yaml>`; the agent's file is `workspace/agent.yaml`. | |
| 4 | + | |
| 5 | +Before starting it, store the key of the model's provider in sbx, never in a file: `sbx secret set anthropic` for the model of `agent.yaml`. | |
| 6 | + | |
| 7 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `docker-agent` is chosen from `agent: docker-agent`, and its arguments are `serve acp …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | |
| 8 | + | |
| 9 | +```yaml | |
| 10 | + - name: docker-agent | |
| 11 | + title: Docker Agent | |
| 12 | + icon: "🐳" | |
| 13 | + command: sbx | |
| 14 | + args: [exec, -i, docker-agent-acp, docker-agent, serve, acp, /Users/me/agents/docker-agent-acp/workspace/agent.yaml] | |
| 15 | + workspace: /Users/me/agents/docker-agent-acp/workspace | |
| 16 | + runtime: | |
| 17 | + type: sbx | |
| 18 | + sandbox: docker-agent-acp | |
| 19 | + lifecycle: | |
| 20 | + folder: /Users/me/agents/docker-agent-acp | |
| 21 | + create: [sbx, env, create, --force] | |
| 22 | + stop: [sbx, stop, docker-agent-acp] | |
| 23 | + remove: [sbx, env, rm, --force] | |
| 24 | +``` | |
| new file mode 100644 | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | +# Add a Docker Agent (docker-agent) agent in an sbx sandbox | ||
| 2 | + | ||
| 3 | +`docker-agent` is an agent sbx knows (`agent: docker-agent`): the sandbox needs no kit. Sidekicks starts it with `docker-agent serve acp <agent.yaml>`; the agent's file is `workspace/agent.yaml`. | ||
| 4 | + | ||
| 5 | +Before starting it, store the key of the model's provider in sbx, never in a file: `sbx secret set anthropic` for the model of `agent.yaml`. | ||
| 6 | + | ||
| 7 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `docker-agent` is chosen from `agent: docker-agent`, and its arguments are `serve acp …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | ||
| 8 | + | ||
| 9 | +```yaml | ||
| 10 | + - name: docker-agent | ||
| 11 | + title: Docker Agent | ||
| 12 | + icon: "🐳" | ||
| 13 | + command: sbx | ||
| 14 | + args: [exec, -i, docker-agent-acp, docker-agent, serve, acp, /Users/me/agents/docker-agent-acp/workspace/agent.yaml] | ||
| 15 | + workspace: /Users/me/agents/docker-agent-acp/workspace | ||
| 16 | + runtime: | ||
| 17 | + type: sbx | ||
| 18 | + sandbox: docker-agent-acp | ||
| 19 | + lifecycle: | ||
| 20 | + folder: /Users/me/agents/docker-agent-acp | ||
| 21 | + create: [sbx, env, create, --force] | ||
| 22 | + stop: [sbx, stop, docker-agent-acp] | ||
| 23 | + remove: [sbx, env, rm, --force] | ||
| 24 | +``` | ||
added
agents/snippets/docker-agent-acp/sbxenv.yaml +10 -0 | new file mode 100644 | ||
| @@ -0,0 +1,10 @@ | ||
| 1 | +schemaVersion: "1" | |
| 2 | + | |
| 3 | +name: docker-agent-acp | |
| 4 | + | |
| 5 | +# docker-agent is an sbx agent of its own: no kit to add. Sidekicks chooses | |
| 6 | +# the program docker-agent (serve acp) from it. | |
| 7 | +agent: docker-agent | |
| 8 | + | |
| 9 | +# The folder Docker Agent works in, relative to this file; agent.yaml is in it. | |
| 10 | +workspace: ./workspace | |
| new file mode 100644 | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | +schemaVersion: "1" | ||
| 2 | + | ||
| 3 | +name: docker-agent-acp | ||
| 4 | + | ||
| 5 | +# docker-agent is an sbx agent of its own: no kit to add. Sidekicks chooses | ||
| 6 | +# the program docker-agent (serve acp) from it. | ||
| 7 | +agent: docker-agent | ||
| 8 | + | ||
| 9 | +# The folder Docker Agent works in, relative to this file; agent.yaml is in it. | ||
| 10 | +workspace: ./workspace | ||
added
agents/snippets/docker-agent-acp/workspace/agent.yaml +32 -0 | new file mode 100644 | ||
| @@ -0,0 +1,32 @@ | ||
| 1 | +providers: | |
| 2 | + llmman: | |
| 3 | + api_type: openai_chatcompletions | |
| 4 | + #base_url: http://127.0.0.1:17434/v1 | |
| 5 | + base_url: http://host.docker.internal:17434/v1 | |
| 6 | + | |
| 7 | +agents: | |
| 8 | + | |
| 9 | + root: | |
| 10 | + model: mellum | |
| 11 | + description: A local code agent, powered by a small LLM. | |
| 12 | + instruction: | | |
| 13 | + Your name is Ralph. You are a developer expert. | |
| 14 | + You act as a mentor and coding partner. | |
| 15 | + | |
| 16 | + # Tool discipline | |
| 17 | + | |
| 18 | + Built-in tools: | |
| 19 | + - shell: use the `shell` tool to explore the project, read files, or run commands. | |
| 20 | + Chain commands as long as it is useful, then give a clear final answer. | |
| 21 | + | |
| 22 | + # Style | |
| 23 | + | |
| 24 | + Be concise. Prefer a small, correct, compilable example over prose. | |
| 25 | + | |
| 26 | + toolsets: | |
| 27 | + - type: shell | |
| 28 | + | |
| 29 | +models: | |
| 30 | + mellum: | |
| 31 | + provider: llmman | |
| 32 | + model: huggingface.co/jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M | |
| new file mode 100644 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | +providers: | ||
| 2 | + llmman: | ||
| 3 | + api_type: openai_chatcompletions | ||
| 4 | + #base_url: http://127.0.0.1:17434/v1 | ||
| 5 | + base_url: http://host.docker.internal:17434/v1 | ||
| 6 | + | ||
| 7 | +agents: | ||
| 8 | + | ||
| 9 | + root: | ||
| 10 | + model: mellum | ||
| 11 | + description: A local code agent, powered by a small LLM. | ||
| 12 | + instruction: | | ||
| 13 | + Your name is Ralph. You are a developer expert. | ||
| 14 | + You act as a mentor and coding partner. | ||
| 15 | + | ||
| 16 | + # Tool discipline | ||
| 17 | + | ||
| 18 | + Built-in tools: | ||
| 19 | + - shell: use the `shell` tool to explore the project, read files, or run commands. | ||
| 20 | + Chain commands as long as it is useful, then give a clear final answer. | ||
| 21 | + | ||
| 22 | + # Style | ||
| 23 | + | ||
| 24 | + Be concise. Prefer a small, correct, compilable example over prose. | ||
| 25 | + | ||
| 26 | + toolsets: | ||
| 27 | + - type: shell | ||
| 28 | + | ||
| 29 | +models: | ||
| 30 | + mellum: | ||
| 31 | + provider: llmman | ||
| 32 | + model: huggingface.co/jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M | ||
added
agents/snippets/gemini-acp/README.md +22 -0 | new file mode 100644 | ||
| @@ -0,0 +1,22 @@ | ||
| 1 | +# Add Gemini ACP Agent | |
| 2 | + | |
| 3 | +Before creating the sandbox, give your Gemini API key to sbx (never in a file): `sbx secret set google`. | |
| 4 | + | |
| 5 | +Gemini CLI speaks ACP itself: the program is `gemini`, with the argument `--acp` (`--experimental-acp` with older versions of Gemini CLI). The kit `docker.io/sbx/gemini-kit` installs the latest Gemini CLI. | |
| 6 | + | |
| 7 | +```yaml | |
| 8 | + - name: gemini | |
| 9 | + title: Gemini | |
| 10 | + icon: "📘" | |
| 11 | + command: sbx | |
| 12 | + args: [exec, -i, gemini-acp, gemini, --acp] | |
| 13 | + workspace: /Users/me/agents/gemini-acp/workspace | |
| 14 | + runtime: | |
| 15 | + type: sbx | |
| 16 | + sandbox: gemini-acp | |
| 17 | + lifecycle: | |
| 18 | + folder: /Users/me/agents/gemini-acp | |
| 19 | + create: [sbx, env, create, --force] | |
| 20 | + stop: [sbx, stop, gemini-acp] | |
| 21 | + remove: [sbx, env, rm, --force] | |
| 22 | +``` | |
| new file mode 100644 | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | +# Add Gemini ACP Agent | ||
| 2 | + | ||
| 3 | +Before creating the sandbox, give your Gemini API key to sbx (never in a file): `sbx secret set google`. | ||
| 4 | + | ||
| 5 | +Gemini CLI speaks ACP itself: the program is `gemini`, with the argument `--acp` (`--experimental-acp` with older versions of Gemini CLI). The kit `docker.io/sbx/gemini-kit` installs the latest Gemini CLI. | ||
| 6 | + | ||
| 7 | +```yaml | ||
| 8 | + - name: gemini | ||
| 9 | + title: Gemini | ||
| 10 | + icon: "📘" | ||
| 11 | + command: sbx | ||
| 12 | + args: [exec, -i, gemini-acp, gemini, --acp] | ||
| 13 | + workspace: /Users/me/agents/gemini-acp/workspace | ||
| 14 | + runtime: | ||
| 15 | + type: sbx | ||
| 16 | + sandbox: gemini-acp | ||
| 17 | + lifecycle: | ||
| 18 | + folder: /Users/me/agents/gemini-acp | ||
| 19 | + create: [sbx, env, create, --force] | ||
| 20 | + stop: [sbx, stop, gemini-acp] | ||
| 21 | + remove: [sbx, env, rm, --force] | ||
| 22 | +``` | ||
added
agents/snippets/gemini-acp/sbxenv.yaml +27 -0 | new file mode 100644 | ||
| @@ -0,0 +1,27 @@ | ||
| 1 | +schemaVersion: "1" | |
| 2 | + | |
| 3 | +name: gemini-acp | |
| 4 | +agent: gemini | |
| 5 | + | |
| 6 | +# Répertoire du projet, relatif à ce fichier. | |
| 7 | +workspace: ./workspace | |
| 8 | + | |
| 9 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | |
| 10 | +kits: | |
| 11 | + - docker.io/sbx/gemini-kit:latest | |
| 12 | + | |
| 13 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | |
| 14 | +bindings: | |
| 15 | + google: | |
| 16 | + apiKey: | |
| 17 | + domains: | |
| 18 | + - generativelanguage.googleapis.com | |
| 19 | + - aiplatform.googleapis.com | |
| 20 | + - vertexai.googleapis.com | |
| 21 | + oauth: | |
| 22 | + domains: | |
| 23 | + - accounts.google.com | |
| 24 | + - oauth2.googleapis.com | |
| 25 | + | |
| 26 | +sandboxOptions: | |
| 27 | + pullPolicy: always | |
| new file mode 100644 | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | +schemaVersion: "1" | ||
| 2 | + | ||
| 3 | +name: gemini-acp | ||
| 4 | +agent: gemini | ||
| 5 | + | ||
| 6 | +# Répertoire du projet, relatif à ce fichier. | ||
| 7 | +workspace: ./workspace | ||
| 8 | + | ||
| 9 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | ||
| 10 | +kits: | ||
| 11 | + - docker.io/sbx/gemini-kit:latest | ||
| 12 | + | ||
| 13 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | ||
| 14 | +bindings: | ||
| 15 | + google: | ||
| 16 | + apiKey: | ||
| 17 | + domains: | ||
| 18 | + - generativelanguage.googleapis.com | ||
| 19 | + - aiplatform.googleapis.com | ||
| 20 | + - vertexai.googleapis.com | ||
| 21 | + oauth: | ||
| 22 | + domains: | ||
| 23 | + - accounts.google.com | ||
| 24 | + - oauth2.googleapis.com | ||
| 25 | + | ||
| 26 | +sandboxOptions: | ||
| 27 | + pullPolicy: always | ||
added
agents/snippets/gemini-acp/workspace/.gitkeep +0 -0 | new file mode 100644 |
| new file mode 100644 |
added
agents/snippets/mini-me-acp/README.md +22 -0 | new file mode 100644 | ||
| @@ -0,0 +1,22 @@ | ||
| 1 | +# Add a mini-me (mm) agent in an sbx sandbox | |
| 2 | + | |
| 3 | +The sandbox is built from the `docker.io/k33g/mini-me-kit` kit (`agent: mini-me-kit`): mm runs in it, with `workspace/agent.yaml` as its configuration. mm talks to llmman on this computer (`host.docker.internal`), so no key is needed. | |
| 4 | + | |
| 5 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `mm` is chosen from `agent: mini-me-kit`, and its arguments are `--acp --config …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | |
| 6 | + | |
| 7 | +```yaml | |
| 8 | + - name: mini-me | |
| 9 | + title: Mini-me | |
| 10 | + icon: "🤏" | |
| 11 | + command: sbx | |
| 12 | + args: [exec, -i, mini-me-acp, mm, --acp, --config, /Users/me/agents/mini-me-acp/workspace/agent.yaml] | |
| 13 | + workspace: /Users/me/agents/mini-me-acp/workspace | |
| 14 | + runtime: | |
| 15 | + type: sbx | |
| 16 | + sandbox: mini-me-acp | |
| 17 | + lifecycle: | |
| 18 | + folder: /Users/me/agents/mini-me-acp | |
| 19 | + create: [sbx, env, create, --force] | |
| 20 | + stop: [sbx, stop, mini-me-acp] | |
| 21 | + remove: [sbx, env, rm, --force] | |
| 22 | +``` | |
| new file mode 100644 | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | +# Add a mini-me (mm) agent in an sbx sandbox | ||
| 2 | + | ||
| 3 | +The sandbox is built from the `docker.io/k33g/mini-me-kit` kit (`agent: mini-me-kit`): mm runs in it, with `workspace/agent.yaml` as its configuration. mm talks to llmman on this computer (`host.docker.internal`), so no key is needed. | ||
| 4 | + | ||
| 5 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `mm` is chosen from `agent: mini-me-kit`, and its arguments are `--acp --config …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | ||
| 6 | + | ||
| 7 | +```yaml | ||
| 8 | + - name: mini-me | ||
| 9 | + title: Mini-me | ||
| 10 | + icon: "🤏" | ||
| 11 | + command: sbx | ||
| 12 | + args: [exec, -i, mini-me-acp, mm, --acp, --config, /Users/me/agents/mini-me-acp/workspace/agent.yaml] | ||
| 13 | + workspace: /Users/me/agents/mini-me-acp/workspace | ||
| 14 | + runtime: | ||
| 15 | + type: sbx | ||
| 16 | + sandbox: mini-me-acp | ||
| 17 | + lifecycle: | ||
| 18 | + folder: /Users/me/agents/mini-me-acp | ||
| 19 | + create: [sbx, env, create, --force] | ||
| 20 | + stop: [sbx, stop, mini-me-acp] | ||
| 21 | + remove: [sbx, env, rm, --force] | ||
| 22 | +``` | ||
added
agents/snippets/mini-me-acp/sbxenv.yaml +12 -0 | new file mode 100644 | ||
| @@ -0,0 +1,12 @@ | ||
| 1 | +schemaVersion: "1" | |
| 2 | + | |
| 3 | +name: mini-me-acp | |
| 4 | + | |
| 5 | +# The workload kit is the base "agent": Sidekicks chooses the program mm from it. | |
| 6 | +agent: mini-me-kit | |
| 7 | + | |
| 8 | +kits: | |
| 9 | + - docker.io/k33g/mini-me-kit:0.1.1 | |
| 10 | + | |
| 11 | +# The folder mm works in, relative to this file; agent.yaml is in it. | |
| 12 | +workspace: ./workspace | |
| new file mode 100644 | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | +schemaVersion: "1" | ||
| 2 | + | ||
| 3 | +name: mini-me-acp | ||
| 4 | + | ||
| 5 | +# The workload kit is the base "agent": Sidekicks chooses the program mm from it. | ||
| 6 | +agent: mini-me-kit | ||
| 7 | + | ||
| 8 | +kits: | ||
| 9 | + - docker.io/k33g/mini-me-kit:0.1.1 | ||
| 10 | + | ||
| 11 | +# The folder mm works in, relative to this file; agent.yaml is in it. | ||
| 12 | +workspace: ./workspace | ||
added
agents/snippets/mini-me-acp/workspace/agent.yaml +93 -0 | new file mode 100644 | ||
| @@ -0,0 +1,93 @@ | ||
| 1 | +# mini-me — a coding agent: reads and changes the project, runs commands. | |
| 2 | +# | |
| 3 | +# Written by `mm init`. Every value says why it has that value; change | |
| 4 | +# them as you watch the agent work (guides/agent-settings-for-small-models.md). | |
| 5 | +# | |
| 6 | +# model family: gemma | |
| 7 | +# usage: developer | |
| 8 | +# machine: small — a laptop, models up to about 8B | |
| 9 | +# model facts: read from llmman: native window 131072 tokens; GGUF sampling temperature 1.0, top_p 0.95, top_k 64; reasoning switch enable_thinking (default off) | |
| 10 | +# | |
| 11 | +# Where the numbers come from (the tag before their comment): | |
| 12 | +# [server] read from the server — run mm init again after a change | |
| 13 | +# [guide] the settings guide's row for this machine | |
| 14 | +# [rule] a rule of thumb, not specific to this model | |
| 15 | +# | |
| 16 | +# mm -config <this file> or mm -tui <this file> | |
| 17 | + | |
| 18 | +provider: llmman | |
| 19 | +# The model. Chosen for it (family gemma): sampling (temperature, top_p, | |
| 20 | +# top_k, max_tokens) and sampling.chat_template_kwargs (enable_thinking). | |
| 21 | +# Change the model and redo them together — running mm init again is the | |
| 22 | +# quick way. | |
| 23 | +model: "hf.co/unsloth/gemma-4-E2B-it-GGUF:Q4_K_M" | |
| 24 | +# No baseUrl: llmman's defaults apply. For the record: | |
| 25 | +# baseUrl: "http://127.0.0.1:17434/v1" | |
| 26 | +# fallback: "http://host.docker.internal:17434/v1" # tried when baseUrl does not answer | |
| 27 | + | |
| 28 | +# 0 = mm asks the server for the window it serves (the model's native window | |
| 29 | +# is 131072 tokens; the server may serve less) | |
| 30 | +contextWindow: 0 | |
| 31 | +# your answer: tools run without asking | |
| 32 | +yolo: true | |
| 33 | +# usage developer | |
| 34 | +bashTool: true | |
| 35 | +editTools: true | |
| 36 | +planTool: true | |
| 37 | +askUserTool: true | |
| 38 | +# no skills: add a skills/ folder and set skillsDir to use some (see | |
| 39 | +# docs/en/how-to/add-a-skill.md) | |
| 40 | +skillsDir: no-skills | |
| 41 | +# usage developer | |
| 42 | +maxTurns: 40 | |
| 43 | +# [guide] settings guide, row "Small model (≤ 8B), short tasks" | |
| 44 | +maxOutput: 8000 | |
| 45 | +firstTokenTimeout: 3m | |
| 46 | +# [guide] aligned on bashTimeout, as the settings guide says when bash is on | |
| 47 | +# (section 3) | |
| 48 | +watchdogTimeout: 30s | |
| 49 | +# [guide] settings guide, row "Small model (≤ 8B), short tasks" | |
| 50 | +bashTimeout: 30s | |
| 51 | + | |
| 52 | +sampling: | |
| 53 | + # [server] the GGUF's own sampling, read from the server | |
| 54 | + temperature: 1.0 | |
| 55 | + top_p: 0.95 | |
| 56 | + top_k: 64 | |
| 57 | + # [rule] reasoning on: room for the thoughts plus a whole tool call | |
| 58 | + max_tokens: 16384 | |
| 59 | + # one tool call per reply: small models run a check before the change it | |
| 60 | + # checks has landed otherwise | |
| 61 | + parallel_tool_calls: false | |
| 62 | + chat_template_kwargs: | |
| 63 | + # reasoning on: code and multi-step work; the template's default is off | |
| 64 | + # (read from the chat template) | |
| 65 | + enable_thinking: true | |
| 66 | + | |
| 67 | +context: | |
| 68 | + # compress the history before the window is full (settings guide, every row) | |
| 69 | + enabled: true | |
| 70 | + # mm's default: 75 % of the window the server serves, a quarter left for the | |
| 71 | + # next question and its tool outputs | |
| 72 | + threshold: 75 | |
| 73 | + | |
| 74 | +agentsMd: | |
| 75 | + # An AGENTS.md in the project directory is added to the system prompt. | |
| 76 | + enabled: true | |
| 77 | + | |
| 78 | +acp: | |
| 79 | + name: mini-me | |
| 80 | + title: "Mini-me (developer)" | |
| 81 | + | |
| 82 | +system: | | |
| 83 | + Your name is Mini-me. You are a coding agent working in a terminal, in the user's project. | |
| 84 | + You have a bash tool, file tools (read_file, write_file, edit_file) and a | |
| 85 | + plan tool. | |
| 86 | + Read before you change: look at the files and run the commands that tell | |
| 87 | + you how the project works. Make the smallest change that does the job, | |
| 88 | + then run the tests or the build to check it. | |
| 89 | + Never state the output of a command you did not run in this answer. | |
| 90 | + When a task has several steps, make a plan and update it as you go. | |
| 91 | + | |
| 92 | +# Next: skills (docs/en/how-to/add-a-skill.md), MCP servers (docs/en/tutorials/mcp-getting-started.md), | |
| 93 | +# hooks (docs/en/how-to/guard-the-agent-with-hooks.md), sessions (docs/en/how-to/keep-sessions.md). | |
| new file mode 100644 | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | +# mini-me — a coding agent: reads and changes the project, runs commands. | ||
| 2 | +# | ||
| 3 | +# Written by `mm init`. Every value says why it has that value; change | ||
| 4 | +# them as you watch the agent work (guides/agent-settings-for-small-models.md). | ||
| 5 | +# | ||
| 6 | +# model family: gemma | ||
| 7 | +# usage: developer | ||
| 8 | +# machine: small — a laptop, models up to about 8B | ||
| 9 | +# model facts: read from llmman: native window 131072 tokens; GGUF sampling temperature 1.0, top_p 0.95, top_k 64; reasoning switch enable_thinking (default off) | ||
| 10 | +# | ||
| 11 | +# Where the numbers come from (the tag before their comment): | ||
| 12 | +# [server] read from the server — run mm init again after a change | ||
| 13 | +# [guide] the settings guide's row for this machine | ||
| 14 | +# [rule] a rule of thumb, not specific to this model | ||
| 15 | +# | ||
| 16 | +# mm -config <this file> or mm -tui <this file> | ||
| 17 | + | ||
| 18 | +provider: llmman | ||
| 19 | +# The model. Chosen for it (family gemma): sampling (temperature, top_p, | ||
| 20 | +# top_k, max_tokens) and sampling.chat_template_kwargs (enable_thinking). | ||
| 21 | +# Change the model and redo them together — running mm init again is the | ||
| 22 | +# quick way. | ||
| 23 | +model: "hf.co/unsloth/gemma-4-E2B-it-GGUF:Q4_K_M" | ||
| 24 | +# No baseUrl: llmman's defaults apply. For the record: | ||
| 25 | +# baseUrl: "http://127.0.0.1:17434/v1" | ||
| 26 | +# fallback: "http://host.docker.internal:17434/v1" # tried when baseUrl does not answer | ||
| 27 | + | ||
| 28 | +# 0 = mm asks the server for the window it serves (the model's native window | ||
| 29 | +# is 131072 tokens; the server may serve less) | ||
| 30 | +contextWindow: 0 | ||
| 31 | +# your answer: tools run without asking | ||
| 32 | +yolo: true | ||
| 33 | +# usage developer | ||
| 34 | +bashTool: true | ||
| 35 | +editTools: true | ||
| 36 | +planTool: true | ||
| 37 | +askUserTool: true | ||
| 38 | +# no skills: add a skills/ folder and set skillsDir to use some (see | ||
| 39 | +# docs/en/how-to/add-a-skill.md) | ||
| 40 | +skillsDir: no-skills | ||
| 41 | +# usage developer | ||
| 42 | +maxTurns: 40 | ||
| 43 | +# [guide] settings guide, row "Small model (≤ 8B), short tasks" | ||
| 44 | +maxOutput: 8000 | ||
| 45 | +firstTokenTimeout: 3m | ||
| 46 | +# [guide] aligned on bashTimeout, as the settings guide says when bash is on | ||
| 47 | +# (section 3) | ||
| 48 | +watchdogTimeout: 30s | ||
| 49 | +# [guide] settings guide, row "Small model (≤ 8B), short tasks" | ||
| 50 | +bashTimeout: 30s | ||
| 51 | + | ||
| 52 | +sampling: | ||
| 53 | + # [server] the GGUF's own sampling, read from the server | ||
| 54 | + temperature: 1.0 | ||
| 55 | + top_p: 0.95 | ||
| 56 | + top_k: 64 | ||
| 57 | + # [rule] reasoning on: room for the thoughts plus a whole tool call | ||
| 58 | + max_tokens: 16384 | ||
| 59 | + # one tool call per reply: small models run a check before the change it | ||
| 60 | + # checks has landed otherwise | ||
| 61 | + parallel_tool_calls: false | ||
| 62 | + chat_template_kwargs: | ||
| 63 | + # reasoning on: code and multi-step work; the template's default is off | ||
| 64 | + # (read from the chat template) | ||
| 65 | + enable_thinking: true | ||
| 66 | + | ||
| 67 | +context: | ||
| 68 | + # compress the history before the window is full (settings guide, every row) | ||
| 69 | + enabled: true | ||
| 70 | + # mm's default: 75 % of the window the server serves, a quarter left for the | ||
| 71 | + # next question and its tool outputs | ||
| 72 | + threshold: 75 | ||
| 73 | + | ||
| 74 | +agentsMd: | ||
| 75 | + # An AGENTS.md in the project directory is added to the system prompt. | ||
| 76 | + enabled: true | ||
| 77 | + | ||
| 78 | +acp: | ||
| 79 | + name: mini-me | ||
| 80 | + title: "Mini-me (developer)" | ||
| 81 | + | ||
| 82 | +system: | | ||
| 83 | + Your name is Mini-me. You are a coding agent working in a terminal, in the user's project. | ||
| 84 | + You have a bash tool, file tools (read_file, write_file, edit_file) and a | ||
| 85 | + plan tool. | ||
| 86 | + Read before you change: look at the files and run the commands that tell | ||
| 87 | + you how the project works. Make the smallest change that does the job, | ||
| 88 | + then run the tests or the build to check it. | ||
| 89 | + Never state the output of a command you did not run in this answer. | ||
| 90 | + When a task has several steps, make a plan and update it as you go. | ||
| 91 | + | ||
| 92 | +# Next: skills (docs/en/how-to/add-a-skill.md), MCP servers (docs/en/tutorials/mcp-getting-started.md), | ||
| 93 | +# hooks (docs/en/how-to/guard-the-agent-with-hooks.md), sessions (docs/en/how-to/keep-sessions.md). | ||
modified
docs/en/README.md +1 -1 | @@ -7,7 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | ||
| 7 | 7 | | You want to… | Section | Pages | |
| 8 | 8 | | --- | --- | --- | |
| 9 | 9 | | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) | |
| 10 | -| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) | | |
| 10 | +| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) | | |
| 11 | 11 | | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) | |
| 12 | 12 | | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) | |
| 13 | 13 | |
| @@ -7,7 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th | |||
| 7 | | You want to… | Section | Pages | | 7 | | You want to… | Section | Pages | |
| 8 | | --- | --- | --- | | 8 | | --- | --- | --- | |
| 9 | | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) | | 9 | | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) | |
| 10 | -| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) | | 10 | +| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) | |
| 11 | | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) | | 11 | | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) | |
| 12 | | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) | | 12 | | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) | |
| 13 | 13 | ||
modified
docs/en/explanation/channels-and-context.md +9 -1 | @@ -16,7 +16,15 @@ The alternative, one shared session that every agent reads, does not exist in AC | ||
| 16 | 16 | |
| 17 | 17 | A message goes to the agents it mentions, in order; without a mention, to the last agent who spoke. That is how people talk in a group: you name someone, or you carry on with the person you were talking to. Nobody answers a message that names nobody in a channel where several agents have not spoken yet — guessing would surprise the user more than asking them to choose. |
| 18 | 18 | |
| 19 | -Agents answer one after the other, never at the same time. On a laptop, two local models generating together are each slower than one after the other, and memory is the real limit (two small models on the reference machine). Answering in turn also lets the second agent read the first one's answer: "@alice @bob compare" gives Bob Alice's answer to compare with. For the same reason an agent answers one channel at a time: a second channel waits, and shows whose turn it is. | |
| 19 | +Agents answer one after the other, never at the same time. On a laptop, two local models generating together are each slower than one after the other, and memory is the real limit (two small models on the reference machine). Answering in turn also lets the second agent read the first one's answer: "@alice @bob compare" gives Bob Alice's answer to compare with. A small model does not know its own name, though: given "@alice write a story, then @bob sum it up", Alice may wait for a story, and Bob may write it and sum it up. Telling each one its name and its part was not enough either: a small model repeated its part instead of doing it. So when a message addresses several agents, each one receives only its part, as if the user had written it to it alone — the words after its name, up to the next agent's name, without the "then" that links them. Bob still reads Alice's answer before his part. A part shorter than two words ("@alice and @bob, tell a joke") means the request is for everyone: each agent receives the whole message. For the same reason an agent answers one channel at a time: a second channel waits, and shows whose turn it is. | |
| 20 | + | |
| 21 | +## When an agent calls another one | |
| 22 | + | |
| 23 | +An agent may need another one: Alice plans a trip, Bob knows the trains. Sidekicks lets an agent hand the floor on the way the user does — by mentioning a member with `@name` in its answer (issue #26). The mentioned agent answers next, reads the channel as usual (the user's message and Alice's answer among what it has not seen) and is told that Alice addressed it, so it answers her rather than the user. | |
| 24 | + | |
| 25 | +Mentions were preferred to a tool offered to the agents (an MCP server "ask an agent"): it needs nothing from the agent — mm ignores the MCP servers a client offers — and the user sees the whole exchange in the channel, as if they had written the mention themselves. | |
| 26 | + | |
| 27 | +The risk is a loop: two polite agents can thank each other forever, and each turn keeps a model busy. So the chain is bounded: a message is handed on `limits.maxAgentHandoffs` times at most (3 by default), then the channel says it stops. Only members can be called — an agent never brings a new one in, which would load another model — an agent cannot call itself, and **■** stops the whole chain. In a direct conversation, there is nobody to call. | |
| 20 | 28 | |
| 21 | 29 | ## Commands are sent alone |
| 22 | 30 | |
| @@ -16,7 +16,15 @@ The alternative, one shared session that every agent reads, does not exist in AC | |||
| 16 | 16 | ||
| 17 | A message goes to the agents it mentions, in order; without a mention, to the last agent who spoke. That is how people talk in a group: you name someone, or you carry on with the person you were talking to. Nobody answers a message that names nobody in a channel where several agents have not spoken yet — guessing would surprise the user more than asking them to choose. | 17 | A message goes to the agents it mentions, in order; without a mention, to the last agent who spoke. That is how people talk in a group: you name someone, or you carry on with the person you were talking to. Nobody answers a message that names nobody in a channel where several agents have not spoken yet — guessing would surprise the user more than asking them to choose. |
| 18 | 18 | ||
| 19 | -Agents answer one after the other, never at the same time. On a laptop, two local models generating together are each slower than one after the other, and memory is the real limit (two small models on the reference machine). Answering in turn also lets the second agent read the first one's answer: "@alice @bob compare" gives Bob Alice's answer to compare with. For the same reason an agent answers one channel at a time: a second channel waits, and shows whose turn it is. | 19 | +Agents answer one after the other, never at the same time. On a laptop, two local models generating together are each slower than one after the other, and memory is the real limit (two small models on the reference machine). Answering in turn also lets the second agent read the first one's answer: "@alice @bob compare" gives Bob Alice's answer to compare with. A small model does not know its own name, though: given "@alice write a story, then @bob sum it up", Alice may wait for a story, and Bob may write it and sum it up. Telling each one its name and its part was not enough either: a small model repeated its part instead of doing it. So when a message addresses several agents, each one receives only its part, as if the user had written it to it alone — the words after its name, up to the next agent's name, without the "then" that links them. Bob still reads Alice's answer before his part. A part shorter than two words ("@alice and @bob, tell a joke") means the request is for everyone: each agent receives the whole message. For the same reason an agent answers one channel at a time: a second channel waits, and shows whose turn it is. |
| 20 | + | ||
| 21 | +## When an agent calls another one | ||
| 22 | + | ||
| 23 | +An agent may need another one: Alice plans a trip, Bob knows the trains. Sidekicks lets an agent hand the floor on the way the user does — by mentioning a member with `@name` in its answer (issue #26). The mentioned agent answers next, reads the channel as usual (the user's message and Alice's answer among what it has not seen) and is told that Alice addressed it, so it answers her rather than the user. | ||
| 24 | + | ||
| 25 | +Mentions were preferred to a tool offered to the agents (an MCP server "ask an agent"): it needs nothing from the agent — mm ignores the MCP servers a client offers — and the user sees the whole exchange in the channel, as if they had written the mention themselves. | ||
| 26 | + | ||
| 27 | +The risk is a loop: two polite agents can thank each other forever, and each turn keeps a model busy. So the chain is bounded: a message is handed on `limits.maxAgentHandoffs` times at most (3 by default), then the channel says it stops. Only members can be called — an agent never brings a new one in, which would load another model — an agent cannot call itself, and **■** stops the whole chain. In a direct conversation, there is nobody to call. | ||
| 20 | 28 | ||
| 21 | ## Commands are sent alone | 29 | ## Commands are sent alone |
| 22 | 30 | ||
modified
docs/en/explanation/memory-and-local-models.md +9 -2 | @@ -21,10 +21,17 @@ The same reasoning applies to the people who will use Sidekicks on their laptops | ||
| 21 | 21 | |
| 22 | 22 | The price of stopping idle agents is memory of another kind: mm cannot reload a session, so an agent restarted after a pause no longer remembers the beginning of the conversation. Sidekicks says so in the conversation (milestone M2) and will give the agent the context back with channels (issue #25). |
| 23 | 23 | |
| 24 | -## Rejected alternatives | |
| 24 | +## Unloading a model on request | |
| 25 | + | |
| 26 | +Stopping an agent frees its model, but also its sessions. When the memory pressure rises (see [How to watch the memory pressure](../how-to/watch-the-memory-pressure.md)), the user can instead have an agent **unload its model** and keep running (issue #51): the model is loaded again with the next message. | |
| 27 | + | |
| 28 | +Sidekicks does not talk to the model server: it does not know which model an agent uses, nor where it is served. The agent knows, so the agent does it. ACP has no standard method for that, hence a convention: **an agent that announces a slash command named `unload` can unload its model**. mm announces it right after `session/new`, and checks that the model is loaded before unloading it (it never loads a model to unload it). | |
| 29 | + | |
| 30 | +Sidekicks sends `/unload` in a session of its own, opened for it and forgotten afterwards, so that nothing appears in the conversations; the agent's answer goes to its log. It does so only while the agent runs and answers nothing: a stopped agent has nothing loaded (`afterStop` is the place to unload on stop), and an agent that is answering would load its model again at once. If ACP or mm offer an extension method one day, it can replace the command without changing the interface. | |
| 31 | + | |
| 25 | 32 | |
| 26 | 33 | - **Starting every configured agent at launch**: simple, and unusable with four local models. |
| 27 | -- **Letting each agent unload its own model**: mm can (`/unload`), but only Sidekicks knows whether another agent still needs the same model. | |
| 34 | +- **Letting each agent unload its own model on its own**: mm can (`/unload`), but only Sidekicks knows whether another agent still needs the same model. Unloading stays a choice of the user (above). | |
| 28 | 35 | |
| 29 | 36 | ## How it relates to the rest |
| 30 | 37 | |
| @@ -21,10 +21,17 @@ The same reasoning applies to the people who will use Sidekicks on their laptops | |||
| 21 | 21 | ||
| 22 | The price of stopping idle agents is memory of another kind: mm cannot reload a session, so an agent restarted after a pause no longer remembers the beginning of the conversation. Sidekicks says so in the conversation (milestone M2) and will give the agent the context back with channels (issue #25). | 22 | The price of stopping idle agents is memory of another kind: mm cannot reload a session, so an agent restarted after a pause no longer remembers the beginning of the conversation. Sidekicks says so in the conversation (milestone M2) and will give the agent the context back with channels (issue #25). |
| 23 | 23 | ||
| 24 | -## Rejected alternatives | 24 | +## Unloading a model on request |
| 25 | + | ||
| 26 | +Stopping an agent frees its model, but also its sessions. When the memory pressure rises (see [How to watch the memory pressure](../how-to/watch-the-memory-pressure.md)), the user can instead have an agent **unload its model** and keep running (issue #51): the model is loaded again with the next message. | ||
| 27 | + | ||
| 28 | +Sidekicks does not talk to the model server: it does not know which model an agent uses, nor where it is served. The agent knows, so the agent does it. ACP has no standard method for that, hence a convention: **an agent that announces a slash command named `unload` can unload its model**. mm announces it right after `session/new`, and checks that the model is loaded before unloading it (it never loads a model to unload it). | ||
| 29 | + | ||
| 30 | +Sidekicks sends `/unload` in a session of its own, opened for it and forgotten afterwards, so that nothing appears in the conversations; the agent's answer goes to its log. It does so only while the agent runs and answers nothing: a stopped agent has nothing loaded (`afterStop` is the place to unload on stop), and an agent that is answering would load its model again at once. If ACP or mm offer an extension method one day, it can replace the command without changing the interface. | ||
| 31 | + | ||
| 25 | 32 | ||
| 26 | - **Starting every configured agent at launch**: simple, and unusable with four local models. | 33 | - **Starting every configured agent at launch**: simple, and unusable with four local models. |
| 27 | -- **Letting each agent unload its own model**: mm can (`/unload`), but only Sidekicks knows whether another agent still needs the same model. | 34 | +- **Letting each agent unload its own model on its own**: mm can (`/unload`), but only Sidekicks knows whether another agent still needs the same model. Unloading stays a choice of the user (above). |
| 28 | 35 | ||
| 29 | ## How it relates to the rest | 36 | ## How it relates to the rest |
| 30 | 37 | ||
modified
docs/en/explanation/workspaces-and-terminals.md +2 -0 | @@ -24,6 +24,8 @@ A deletion from a graphical tool is expected to be reversible. On this computer, | ||
| 24 | 24 | |
| 25 | 25 | A terminal is a real shell behind a pseudo-terminal, so full-screen programs work and the size follows the panel. Closing it must end what was started from it — including programs sent to the background, which a simple "kill the shell" misses. In a container there is a trap: stopping the `docker exec` client leaves the shell running inside the container. Sidekicks therefore ends the shell's whole session on the container's side too. Both cases were found by testing, not by reading. |
| 26 | 26 | |
| 27 | +A terminal belongs to its agent, not to the view that shows it: a long build or a server is often started in one, then the user goes back to the conversation. So the terminals, and their screens, live outside the agent's view: they go on running, and printing, while the user looks elsewhere, and an agent may have several (issues #72 and #73). Closing one is always the user's decision; only quitting Sidekicks or opening another configuration file closes them all. | |
| 28 | + | |
| 27 | 29 | ## How it relates to the rest |
| 28 | 30 | |
| 29 | 31 | - [Channels and what each agent knows](channels-and-context.md): the conversation is the main way to work with an agent; the workspace is where to look when something needs checking. |
| @@ -24,6 +24,8 @@ A deletion from a graphical tool is expected to be reversible. On this computer, | |||
| 24 | 24 | ||
| 25 | A terminal is a real shell behind a pseudo-terminal, so full-screen programs work and the size follows the panel. Closing it must end what was started from it — including programs sent to the background, which a simple "kill the shell" misses. In a container there is a trap: stopping the `docker exec` client leaves the shell running inside the container. Sidekicks therefore ends the shell's whole session on the container's side too. Both cases were found by testing, not by reading. | 25 | A terminal is a real shell behind a pseudo-terminal, so full-screen programs work and the size follows the panel. Closing it must end what was started from it — including programs sent to the background, which a simple "kill the shell" misses. In a container there is a trap: stopping the `docker exec` client leaves the shell running inside the container. Sidekicks therefore ends the shell's whole session on the container's side too. Both cases were found by testing, not by reading. |
| 26 | 26 | ||
| 27 | +A terminal belongs to its agent, not to the view that shows it: a long build or a server is often started in one, then the user goes back to the conversation. So the terminals, and their screens, live outside the agent's view: they go on running, and printing, while the user looks elsewhere, and an agent may have several (issues #72 and #73). Closing one is always the user's decision; only quitting Sidekicks or opening another configuration file closes them all. | ||
| 28 | + | ||
| 27 | ## How it relates to the rest | 29 | ## How it relates to the rest |
| 28 | 30 | ||
| 29 | - [Channels and what each agent knows](channels-and-context.md): the conversation is the main way to work with an agent; the workspace is where to look when something needs checking. | 31 | - [Channels and what each agent knows](channels-and-context.md): the conversation is the main way to work with an agent; the workspace is where to look when something needs checking. |
added
docs/en/how-to/add-a-claude-agent-in-a-sandbox.md +117 -0 | new file mode 100644 | ||
| @@ -0,0 +1,117 @@ | ||
| 1 | +# How to add a Claude agent in an sbx sandbox | |
| 2 | + | |
| 3 | +This guide shows how to add Claude (Claude Code, through its ACP adapter `claude-agent-acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Claude then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have an Anthropic API key. | |
| 4 | + | |
| 5 | +A ready-made example is in the repository: [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/README.md). | |
| 6 | + | |
| 7 | +## A kit provided by a third party | |
| 8 | + | |
| 9 | +The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. | |
| 10 | + | |
| 11 | +## What you need | |
| 12 | + | |
| 13 | +| | Role | | |
| 14 | +| --- | --- | | |
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/claude-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Claude works in. | | |
| 16 | +| The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. | | |
| 17 | +| Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. | | |
| 18 | + | |
| 19 | +## The simplest way: with the assistant | |
| 20 | + | |
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/claude-acp`, or write them as in steps 1 and 2 below. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | |
| 22 | +2. **Give your Anthropic API key to sbx** (step 3 below). | |
| 23 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). | |
| 24 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | |
| 25 | +5. **Program**: `claude-agent-acp` is chosen for you, from `agent: claude` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave **Arguments** empty. | |
| 26 | +6. Click **Add the agent**, then start Claude (step 5 below). | |
| 27 | + | |
| 28 | +## By hand | |
| 29 | + | |
| 30 | +The same result, step by step — or to adapt an existing sandbox. | |
| 31 | + | |
| 32 | +1. **Create the agent's folder** with an empty `workspace/` inside: | |
| 33 | + | |
| 34 | + ```bash | |
| 35 | + mkdir -p /Users/me/agents/claude-acp/workspace | |
| 36 | + ``` | |
| 37 | + | |
| 38 | +2. **Write the sandbox's `sbxenv.yaml`** in `/Users/me/agents/claude-acp`: | |
| 39 | + | |
| 40 | + ```yaml | |
| 41 | + schemaVersion: "1" | |
| 42 | + | |
| 43 | + name: claude-acp | |
| 44 | + agent: claude | |
| 45 | + | |
| 46 | + # The folder Claude works in, relative to this file. | |
| 47 | + workspace: ./workspace | |
| 48 | + | |
| 49 | + kits: | |
| 50 | + - docker.io/sbx/claude-acp:latest | |
| 51 | + | |
| 52 | + # sbx injects the Anthropic key into the requests to these domains. | |
| 53 | + bindings: | |
| 54 | + anthropic: | |
| 55 | + apiKey: | |
| 56 | + domains: | |
| 57 | + - api.anthropic.com | |
| 58 | + - console.anthropic.com | |
| 59 | + | |
| 60 | + sandboxOptions: | |
| 61 | + pullPolicy: always | |
| 62 | + ``` | |
| 63 | + | |
| 64 | + `name` is the name of the sandbox: Sidekicks uses the same one. | |
| 65 | + | |
| 66 | +3. **Give your Anthropic API key to sbx**, so that it can inject it (the `bindings` above). The key is kept by sbx, on this computer, never in a file of the folder. See `sbx secret --help` for the exact command of your sbx version. | |
| 67 | + | |
| 68 | +4. **Add the agent with the assistant**: in the **Agents** panel, click **+ Add an agent**, then: | |
| 69 | + 1. Title `Claude`, an icon if you like (📙). | |
| 70 | + 2. **Where does it run?** **In an sbx sandbox**. | |
| 71 | + 3. Drop `/Users/me/agents/claude-acp/sbxenv.yaml` on the **Recreate the sandbox when it is gone (optional)** area (or click **Choose an sbxenv.yaml…**). The sandbox (`claude-acp`), the agent's folder (`/Users/me/agents/claude-acp/workspace`) and the `sbx env` commands are filled in. | |
| 72 | + 4. **Program**: type `claude-agent-acp`. Leave **Arguments** empty. | |
| 73 | + 5. Click **Add the agent**. | |
| 74 | + | |
| 75 | + Or **in Settings**, add this entry under `agents:` and save: | |
| 76 | + | |
| 77 | + ```yaml | |
| 78 | + - name: claude | |
| 79 | + title: Claude | |
| 80 | + icon: "📙" | |
| 81 | + command: sbx | |
| 82 | + args: [exec, -i, claude-acp, claude-agent-acp] | |
| 83 | + workspace: /Users/me/agents/claude-acp/workspace | |
| 84 | + runtime: | |
| 85 | + type: sbx | |
| 86 | + sandbox: claude-acp | |
| 87 | + lifecycle: | |
| 88 | + folder: /Users/me/agents/claude-acp | |
| 89 | + create: [sbx, env, create, --force] | |
| 90 | + stop: [sbx, stop, claude-acp] | |
| 91 | + remove: [sbx, env, rm, --force] | |
| 92 | + ``` | |
| 93 | + | |
| 94 | + `workspace` is the folder Claude works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. | |
| 95 | + | |
| 96 | +5. **Start Claude** from the **Agents** panel (▶), or write to it. The first time, the sandbox does not exist yet: the **Log** tab shows `sandbox claude-acp not found: creating it`, then the kit being pulled — this can take a minute or two. Then Claude answers. | |
| 97 | + | |
| 98 | +## Check that it works | |
| 99 | + | |
| 100 | +- Ask Claude to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/claude-acp/workspace` on this computer. | |
| 101 | +- In the **Terminal** tab, `ls` shows the same folder, from inside the sandbox. | |
| 102 | +- When Claude asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | |
| 103 | + | |
| 104 | +## Variants | |
| 105 | + | |
| 106 | +- **Another name for the sandbox**: change `name:` in the `sbxenv.yaml` and, in the agent's entry, the sandbox name in `args`, `runtime.sandbox` and `lifecycle.stop`. All of them must be the same. | |
| 107 | +- **Several Claude agents**: one folder, one `sbxenv.yaml` and one sandbox name each, and a different `name` for each agent (`claude`, `claude-docs`…). | |
| 108 | +- **Claude answers with an authentication error** (see the **Log** tab): the key is not stored in sbx, or not where the `bindings` expect it. Store it again, then **🗑 Remove the sandbox** and start the agent: the sandbox is created again with the key. | |
| 109 | +- **Sidekicks opened from the Finder does not find `sbx`**: write its full path in `command` (see `which sbx`), as in [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md#variants). | |
| 110 | +- **Start from scratch**: **🗑 Remove the sandbox** in the agent's header removes it; the files of `workspace/` stay on this computer. | |
| 111 | + | |
| 112 | +## See also | |
| 113 | + | |
| 114 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | |
| 115 | +- [How to add an agent](add-an-agent.md) | |
| 116 | +- [How to work with an agent's files and terminal](work-with-an-agents-files.md) | |
| 117 | +- [Reference: `runtime.lifecycle`](../reference/configuration.md#runtimelifecycle-container-and-sbx) | |
| new file mode 100644 | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | +# How to add a Claude agent in an sbx sandbox | ||
| 2 | + | ||
| 3 | +This guide shows how to add Claude (Claude Code, through its ACP adapter `claude-agent-acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Claude then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have an Anthropic API key. | ||
| 4 | + | ||
| 5 | +A ready-made example is in the repository: [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/README.md). | ||
| 6 | + | ||
| 7 | +## A kit provided by a third party | ||
| 8 | + | ||
| 9 | +The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. | ||
| 10 | + | ||
| 11 | +## What you need | ||
| 12 | + | ||
| 13 | +| | Role | | ||
| 14 | +| --- | --- | | ||
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/claude-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Claude works in. | | ||
| 16 | +| The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. | | ||
| 17 | +| Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. | | ||
| 18 | + | ||
| 19 | +## The simplest way: with the assistant | ||
| 20 | + | ||
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/claude-acp`, or write them as in steps 1 and 2 below. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | ||
| 22 | +2. **Give your Anthropic API key to sbx** (step 3 below). | ||
| 23 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). | ||
| 24 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | ||
| 25 | +5. **Program**: `claude-agent-acp` is chosen for you, from `agent: claude` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave **Arguments** empty. | ||
| 26 | +6. Click **Add the agent**, then start Claude (step 5 below). | ||
| 27 | + | ||
| 28 | +## By hand | ||
| 29 | + | ||
| 30 | +The same result, step by step — or to adapt an existing sandbox. | ||
| 31 | + | ||
| 32 | +1. **Create the agent's folder** with an empty `workspace/` inside: | ||
| 33 | + | ||
| 34 | + ```bash | ||
| 35 | + mkdir -p /Users/me/agents/claude-acp/workspace | ||
| 36 | + ``` | ||
| 37 | + | ||
| 38 | +2. **Write the sandbox's `sbxenv.yaml`** in `/Users/me/agents/claude-acp`: | ||
| 39 | + | ||
| 40 | + ```yaml | ||
| 41 | + schemaVersion: "1" | ||
| 42 | + | ||
| 43 | + name: claude-acp | ||
| 44 | + agent: claude | ||
| 45 | + | ||
| 46 | + # The folder Claude works in, relative to this file. | ||
| 47 | + workspace: ./workspace | ||
| 48 | + | ||
| 49 | + kits: | ||
| 50 | + - docker.io/sbx/claude-acp:latest | ||
| 51 | + | ||
| 52 | + # sbx injects the Anthropic key into the requests to these domains. | ||
| 53 | + bindings: | ||
| 54 | + anthropic: | ||
| 55 | + apiKey: | ||
| 56 | + domains: | ||
| 57 | + - api.anthropic.com | ||
| 58 | + - console.anthropic.com | ||
| 59 | + | ||
| 60 | + sandboxOptions: | ||
| 61 | + pullPolicy: always | ||
| 62 | + ``` | ||
| 63 | + | ||
| 64 | + `name` is the name of the sandbox: Sidekicks uses the same one. | ||
| 65 | + | ||
| 66 | +3. **Give your Anthropic API key to sbx**, so that it can inject it (the `bindings` above). The key is kept by sbx, on this computer, never in a file of the folder. See `sbx secret --help` for the exact command of your sbx version. | ||
| 67 | + | ||
| 68 | +4. **Add the agent with the assistant**: in the **Agents** panel, click **+ Add an agent**, then: | ||
| 69 | + 1. Title `Claude`, an icon if you like (📙). | ||
| 70 | + 2. **Where does it run?** **In an sbx sandbox**. | ||
| 71 | + 3. Drop `/Users/me/agents/claude-acp/sbxenv.yaml` on the **Recreate the sandbox when it is gone (optional)** area (or click **Choose an sbxenv.yaml…**). The sandbox (`claude-acp`), the agent's folder (`/Users/me/agents/claude-acp/workspace`) and the `sbx env` commands are filled in. | ||
| 72 | + 4. **Program**: type `claude-agent-acp`. Leave **Arguments** empty. | ||
| 73 | + 5. Click **Add the agent**. | ||
| 74 | + | ||
| 75 | + Or **in Settings**, add this entry under `agents:` and save: | ||
| 76 | + | ||
| 77 | + ```yaml | ||
| 78 | + - name: claude | ||
| 79 | + title: Claude | ||
| 80 | + icon: "📙" | ||
| 81 | + command: sbx | ||
| 82 | + args: [exec, -i, claude-acp, claude-agent-acp] | ||
| 83 | + workspace: /Users/me/agents/claude-acp/workspace | ||
| 84 | + runtime: | ||
| 85 | + type: sbx | ||
| 86 | + sandbox: claude-acp | ||
| 87 | + lifecycle: | ||
| 88 | + folder: /Users/me/agents/claude-acp | ||
| 89 | + create: [sbx, env, create, --force] | ||
| 90 | + stop: [sbx, stop, claude-acp] | ||
| 91 | + remove: [sbx, env, rm, --force] | ||
| 92 | + ``` | ||
| 93 | + | ||
| 94 | + `workspace` is the folder Claude works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. | ||
| 95 | + | ||
| 96 | +5. **Start Claude** from the **Agents** panel (▶), or write to it. The first time, the sandbox does not exist yet: the **Log** tab shows `sandbox claude-acp not found: creating it`, then the kit being pulled — this can take a minute or two. Then Claude answers. | ||
| 97 | + | ||
| 98 | +## Check that it works | ||
| 99 | + | ||
| 100 | +- Ask Claude to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/claude-acp/workspace` on this computer. | ||
| 101 | +- In the **Terminal** tab, `ls` shows the same folder, from inside the sandbox. | ||
| 102 | +- When Claude asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | ||
| 103 | + | ||
| 104 | +## Variants | ||
| 105 | + | ||
| 106 | +- **Another name for the sandbox**: change `name:` in the `sbxenv.yaml` and, in the agent's entry, the sandbox name in `args`, `runtime.sandbox` and `lifecycle.stop`. All of them must be the same. | ||
| 107 | +- **Several Claude agents**: one folder, one `sbxenv.yaml` and one sandbox name each, and a different `name` for each agent (`claude`, `claude-docs`…). | ||
| 108 | +- **Claude answers with an authentication error** (see the **Log** tab): the key is not stored in sbx, or not where the `bindings` expect it. Store it again, then **🗑 Remove the sandbox** and start the agent: the sandbox is created again with the key. | ||
| 109 | +- **Sidekicks opened from the Finder does not find `sbx`**: write its full path in `command` (see `which sbx`), as in [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md#variants). | ||
| 110 | +- **Start from scratch**: **🗑 Remove the sandbox** in the agent's header removes it; the files of `workspace/` stay on this computer. | ||
| 111 | + | ||
| 112 | +## See also | ||
| 113 | + | ||
| 114 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | ||
| 115 | +- [How to add an agent](add-an-agent.md) | ||
| 116 | +- [How to work with an agent's files and terminal](work-with-an-agents-files.md) | ||
| 117 | +- [Reference: `runtime.lifecycle`](../reference/configuration.md#runtimelifecycle-container-and-sbx) | ||
added
docs/en/how-to/add-a-codex-agent-in-a-sandbox.md +96 -0 | new file mode 100644 | ||
| @@ -0,0 +1,96 @@ | ||
| 1 | +# How to add a Codex agent in an sbx sandbox | |
| 2 | + | |
| 3 | +This guide shows how to add Codex (OpenAI's coding agent, through its ACP adapter `codex-acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Codex then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have a ChatGPT account or an OpenAI API key. It follows the same steps as [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | |
| 4 | + | |
| 5 | +A ready-made example is in the repository: [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/README.md). | |
| 6 | + | |
| 7 | +## A kit provided by a third party | |
| 8 | + | |
| 9 | +The sandbox is built from the `docker.io/sbx/codex-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Codex, `codex-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `codex-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Codex may no longer start: the **Log** tab then shows what sbx said. | |
| 10 | + | |
| 11 | +## What you need | |
| 12 | + | |
| 13 | +| | Role | | |
| 14 | +| --- | --- | | |
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/codex-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Codex works in. | | |
| 16 | +| The `docker.io/sbx/codex-acp` kit | the sandbox's image, with Codex and `codex-acp` installed. | | |
| 17 | +| Your OpenAI credentials, stored in sbx | sbx adds them to Codex's requests to OpenAI: they are written neither in the sandbox nor in Sidekicks' configuration. | | |
| 18 | + | |
| 19 | +## With the assistant | |
| 20 | + | |
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/codex-acp`. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | |
| 22 | +2. **Give your OpenAI credentials to sbx**, before the sandbox is created: the `codex` kit reads them when the sandbox is created. | |
| 23 | + | |
| 24 | + ```bash | |
| 25 | + sbx secret set -g openai --oauth # sign in with your ChatGPT account | |
| 26 | + echo "$OPENAI_API_KEY" | sbx secret set -g openai # or: an API key | |
| 27 | + ``` | |
| 28 | + | |
| 29 | + If you store them after the sandbox exists, **🗑 Remove the sandbox** in the agent's header, then start the agent again. | |
| 30 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Codex`) and, if you like, an icon (📗). | |
| 31 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | |
| 32 | +5. **Program**: `codex-acp` is chosen for you, from `agent: codex` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave **Arguments** empty. | |
| 33 | +6. Click **Add the agent**, then start Codex from the **Agents** panel (▶), or write to it. The first time, the **Log** tab shows `sandbox codex-acp not found: creating it`, then the kit being pulled — this can take a minute or two. | |
| 34 | + | |
| 35 | +## By hand | |
| 36 | + | |
| 37 | +The `sbxenv.yaml` of the example: | |
| 38 | + | |
| 39 | +```yaml | |
| 40 | +schemaVersion: "1" | |
| 41 | + | |
| 42 | +name: codex-acp | |
| 43 | +agent: codex | |
| 44 | + | |
| 45 | +workspace: ./workspace | |
| 46 | + | |
| 47 | +kits: | |
| 48 | + - docker.io/sbx/codex-acp:latest | |
| 49 | + | |
| 50 | +bindings: | |
| 51 | + openai: | |
| 52 | + apiKey: | |
| 53 | + domains: | |
| 54 | + - api.openai.com | |
| 55 | + - openai.com | |
| 56 | + oauth: | |
| 57 | + domains: | |
| 58 | + - auth.openai.com | |
| 59 | + - chatgpt.com | |
| 60 | +``` | |
| 61 | + | |
| 62 | +And the agent's entry, under `agents:` in **Settings**: | |
| 63 | + | |
| 64 | +```yaml | |
| 65 | + - name: codex | |
| 66 | + title: Codex | |
| 67 | + icon: "📗" | |
| 68 | + command: sbx | |
| 69 | + args: [exec, -i, codex-acp, codex-acp] | |
| 70 | + workspace: /Users/me/agents/codex-acp/workspace | |
| 71 | + runtime: | |
| 72 | + type: sbx | |
| 73 | + sandbox: codex-acp | |
| 74 | + lifecycle: | |
| 75 | + folder: /Users/me/agents/codex-acp | |
| 76 | + create: [sbx, env, create, --force] | |
| 77 | + stop: [sbx, stop, codex-acp] | |
| 78 | + remove: [sbx, env, rm, --force] | |
| 79 | +``` | |
| 80 | + | |
| 81 | +`workspace` is the folder Codex works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. The sandbox name must be the same in `name:`, `args`, `runtime.sandbox` and `lifecycle.stop`. | |
| 82 | + | |
| 83 | +## Check that it works | |
| 84 | + | |
| 85 | +- Ask Codex to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/codex-acp/workspace` on this computer. | |
| 86 | +- When Codex asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | |
| 87 | +- **`cannot mix v3 kits with v1/v2 kits in one sandbox`** when the sandbox is created: the `sbxenv.yaml` names the older `docker.io/sbx/codex-acp-kit`. sbx now gives the `codex` agent as a kit of the new format (v3), which only composes with v3 kits: name `docker.io/sbx/codex-acp:latest` instead, then start the agent again. | |
| 88 | +- **`executable file … codex-acp not found`** (exit status 127): the agent runs in another sandbox — the log then shows another sandbox being started, such as `claude-acp`. The assistant now refuses an `sbxenv.yaml` whose `agent:` is not the program's; in **Settings**, check that the sandbox name is `codex-acp` in `args`, `runtime.sandbox` and `lifecycle`, and that `workspace` and `lifecycle.folder` are Codex's folders. | |
| 89 | +- **``executable file `/home/agent/.local/bin/codex-acp` not found``** with the right sandbox: the agent's entry was made for the older `docker.io/sbx/codex-acp-kit`. The v3 kit puts `codex-acp` in the `PATH`: write `codex-acp` alone as the last argument. | |
| 90 | +- **An authentication error** in the **Log** tab: the credentials are not stored in sbx, or were stored after the sandbox was created. Store them again, then **🗑 Remove the sandbox** and start the agent. | |
| 91 | + | |
| 92 | +## See also | |
| 93 | + | |
| 94 | +- [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md) | |
| 95 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | |
| 96 | +- [How to add an agent](add-an-agent.md) | |
| new file mode 100644 | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | +# How to add a Codex agent in an sbx sandbox | ||
| 2 | + | ||
| 3 | +This guide shows how to add Codex (OpenAI's coding agent, through its ACP adapter `codex-acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Codex then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have a ChatGPT account or an OpenAI API key. It follows the same steps as [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | ||
| 4 | + | ||
| 5 | +A ready-made example is in the repository: [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/README.md). | ||
| 6 | + | ||
| 7 | +## A kit provided by a third party | ||
| 8 | + | ||
| 9 | +The sandbox is built from the `docker.io/sbx/codex-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Codex, `codex-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `codex-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Codex may no longer start: the **Log** tab then shows what sbx said. | ||
| 10 | + | ||
| 11 | +## What you need | ||
| 12 | + | ||
| 13 | +| | Role | | ||
| 14 | +| --- | --- | | ||
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/codex-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Codex works in. | | ||
| 16 | +| The `docker.io/sbx/codex-acp` kit | the sandbox's image, with Codex and `codex-acp` installed. | | ||
| 17 | +| Your OpenAI credentials, stored in sbx | sbx adds them to Codex's requests to OpenAI: they are written neither in the sandbox nor in Sidekicks' configuration. | | ||
| 18 | + | ||
| 19 | +## With the assistant | ||
| 20 | + | ||
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/codex-acp`. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | ||
| 22 | +2. **Give your OpenAI credentials to sbx**, before the sandbox is created: the `codex` kit reads them when the sandbox is created. | ||
| 23 | + | ||
| 24 | + ```bash | ||
| 25 | + sbx secret set -g openai --oauth # sign in with your ChatGPT account | ||
| 26 | + echo "$OPENAI_API_KEY" | sbx secret set -g openai # or: an API key | ||
| 27 | + ``` | ||
| 28 | + | ||
| 29 | + If you store them after the sandbox exists, **🗑 Remove the sandbox** in the agent's header, then start the agent again. | ||
| 30 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Codex`) and, if you like, an icon (📗). | ||
| 31 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | ||
| 32 | +5. **Program**: `codex-acp` is chosen for you, from `agent: codex` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). Leave **Arguments** empty. | ||
| 33 | +6. Click **Add the agent**, then start Codex from the **Agents** panel (▶), or write to it. The first time, the **Log** tab shows `sandbox codex-acp not found: creating it`, then the kit being pulled — this can take a minute or two. | ||
| 34 | + | ||
| 35 | +## By hand | ||
| 36 | + | ||
| 37 | +The `sbxenv.yaml` of the example: | ||
| 38 | + | ||
| 39 | +```yaml | ||
| 40 | +schemaVersion: "1" | ||
| 41 | + | ||
| 42 | +name: codex-acp | ||
| 43 | +agent: codex | ||
| 44 | + | ||
| 45 | +workspace: ./workspace | ||
| 46 | + | ||
| 47 | +kits: | ||
| 48 | + - docker.io/sbx/codex-acp:latest | ||
| 49 | + | ||
| 50 | +bindings: | ||
| 51 | + openai: | ||
| 52 | + apiKey: | ||
| 53 | + domains: | ||
| 54 | + - api.openai.com | ||
| 55 | + - openai.com | ||
| 56 | + oauth: | ||
| 57 | + domains: | ||
| 58 | + - auth.openai.com | ||
| 59 | + - chatgpt.com | ||
| 60 | +``` | ||
| 61 | + | ||
| 62 | +And the agent's entry, under `agents:` in **Settings**: | ||
| 63 | + | ||
| 64 | +```yaml | ||
| 65 | + - name: codex | ||
| 66 | + title: Codex | ||
| 67 | + icon: "📗" | ||
| 68 | + command: sbx | ||
| 69 | + args: [exec, -i, codex-acp, codex-acp] | ||
| 70 | + workspace: /Users/me/agents/codex-acp/workspace | ||
| 71 | + runtime: | ||
| 72 | + type: sbx | ||
| 73 | + sandbox: codex-acp | ||
| 74 | + lifecycle: | ||
| 75 | + folder: /Users/me/agents/codex-acp | ||
| 76 | + create: [sbx, env, create, --force] | ||
| 77 | + stop: [sbx, stop, codex-acp] | ||
| 78 | + remove: [sbx, env, rm, --force] | ||
| 79 | +``` | ||
| 80 | + | ||
| 81 | +`workspace` is the folder Codex works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. The sandbox name must be the same in `name:`, `args`, `runtime.sandbox` and `lifecycle.stop`. | ||
| 82 | + | ||
| 83 | +## Check that it works | ||
| 84 | + | ||
| 85 | +- Ask Codex to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/codex-acp/workspace` on this computer. | ||
| 86 | +- When Codex asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | ||
| 87 | +- **`cannot mix v3 kits with v1/v2 kits in one sandbox`** when the sandbox is created: the `sbxenv.yaml` names the older `docker.io/sbx/codex-acp-kit`. sbx now gives the `codex` agent as a kit of the new format (v3), which only composes with v3 kits: name `docker.io/sbx/codex-acp:latest` instead, then start the agent again. | ||
| 88 | +- **`executable file … codex-acp not found`** (exit status 127): the agent runs in another sandbox — the log then shows another sandbox being started, such as `claude-acp`. The assistant now refuses an `sbxenv.yaml` whose `agent:` is not the program's; in **Settings**, check that the sandbox name is `codex-acp` in `args`, `runtime.sandbox` and `lifecycle`, and that `workspace` and `lifecycle.folder` are Codex's folders. | ||
| 89 | +- **``executable file `/home/agent/.local/bin/codex-acp` not found``** with the right sandbox: the agent's entry was made for the older `docker.io/sbx/codex-acp-kit`. The v3 kit puts `codex-acp` in the `PATH`: write `codex-acp` alone as the last argument. | ||
| 90 | +- **An authentication error** in the **Log** tab: the credentials are not stored in sbx, or were stored after the sandbox was created. Store them again, then **🗑 Remove the sandbox** and start the agent. | ||
| 91 | + | ||
| 92 | +## See also | ||
| 93 | + | ||
| 94 | +- [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md) | ||
| 95 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | ||
| 96 | +- [How to add an agent](add-an-agent.md) | ||
added
docs/en/how-to/add-a-gemini-agent-in-a-sandbox.md +99 -0 | new file mode 100644 | ||
| @@ -0,0 +1,99 @@ | ||
| 1 | +# How to add a Gemini agent in an sbx sandbox | |
| 2 | + | |
| 3 | +This guide shows how to add Gemini (Google's Gemini CLI, which speaks ACP itself with `gemini --acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Gemini then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have a Gemini API key. It follows the same steps as [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | |
| 4 | + | |
| 5 | +A ready-made example is in the repository: [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/README.md). | |
| 6 | + | |
| 7 | +## A kit provided by a third party | |
| 8 | + | |
| 9 | +The sandbox is built from the `docker.io/sbx/gemini-kit` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Gemini CLI, at its latest version), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `gemini --acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Gemini may no longer start: the **Log** tab then shows what sbx said. | |
| 10 | + | |
| 11 | +## What you need | |
| 12 | + | |
| 13 | +| | Role | | |
| 14 | +| --- | --- | | |
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/gemini-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Gemini works in. | | |
| 16 | +| The `docker.io/sbx/gemini-kit` kit | the sandbox's image, with the latest Gemini CLI. Docker marks this kit as deprecated in favour of its `antigravity` kit: it may disappear one day. | | |
| 17 | +| Your Gemini API key, stored in sbx | sbx adds it to Gemini's requests to Google: it is written neither in the sandbox nor in Sidekicks' configuration. | | |
| 18 | + | |
| 19 | +## With the assistant | |
| 20 | + | |
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/gemini-acp`. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | |
| 22 | +2. **Give your Gemini API key to sbx**, under the name `google` (the `bindings` of the `sbxenv.yaml`): | |
| 23 | + | |
| 24 | + ```bash | |
| 25 | + sbx secret set google | |
| 26 | + ``` | |
| 27 | + | |
| 28 | + The key is kept by sbx, on this computer, never in a file of the folder. | |
| 29 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Gemini`) and, if you like, an icon (📘). | |
| 30 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | |
| 31 | +5. **Program**: `gemini` is chosen for you, from `agent: gemini` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). **Arguments** is filled with `--acp`; with an older Gemini CLI, write `--experimental-acp` instead. | |
| 32 | +6. Click **Add the agent**, then start Gemini from the **Agents** panel (▶), or write to it. The first time, the **Log** tab shows `sandbox gemini-acp not found: creating it`, then the kit being pulled — this can take a minute or two. | |
| 33 | + | |
| 34 | +## By hand | |
| 35 | + | |
| 36 | +The `sbxenv.yaml` of the example: | |
| 37 | + | |
| 38 | +```yaml | |
| 39 | +schemaVersion: "1" | |
| 40 | + | |
| 41 | +name: gemini-acp | |
| 42 | +agent: gemini | |
| 43 | + | |
| 44 | +# Répertoire du projet, relatif à ce fichier. | |
| 45 | +workspace: ./workspace | |
| 46 | + | |
| 47 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | |
| 48 | +kits: | |
| 49 | + - docker.io/sbx/gemini-kit:latest | |
| 50 | + | |
| 51 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | |
| 52 | +bindings: | |
| 53 | + google: | |
| 54 | + apiKey: | |
| 55 | + domains: | |
| 56 | + - generativelanguage.googleapis.com | |
| 57 | + - aiplatform.googleapis.com | |
| 58 | + - vertexai.googleapis.com | |
| 59 | + oauth: | |
| 60 | + domains: | |
| 61 | + - accounts.google.com | |
| 62 | + - oauth2.googleapis.com | |
| 63 | + | |
| 64 | +sandboxOptions: | |
| 65 | + pullPolicy: always | |
| 66 | +``` | |
| 67 | + | |
| 68 | +And the agent's entry, under `agents:` in **Settings**: | |
| 69 | + | |
| 70 | +```yaml | |
| 71 | + - name: gemini | |
| 72 | + title: Gemini | |
| 73 | + icon: "📘" | |
| 74 | + command: sbx | |
| 75 | + args: [exec, -i, gemini-acp, gemini, --acp] | |
| 76 | + workspace: /Users/me/agents/gemini-acp/workspace | |
| 77 | + runtime: | |
| 78 | + type: sbx | |
| 79 | + sandbox: gemini-acp | |
| 80 | + lifecycle: | |
| 81 | + folder: /Users/me/agents/gemini-acp | |
| 82 | + create: [sbx, env, create, --force] | |
| 83 | + stop: [sbx, stop, gemini-acp] | |
| 84 | + remove: [sbx, env, rm, --force] | |
| 85 | +``` | |
| 86 | + | |
| 87 | +`workspace` is the folder Gemini works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. The sandbox name must be the same in `name:`, `args`, `runtime.sandbox` and `lifecycle.stop`. | |
| 88 | + | |
| 89 | +## Check that it works | |
| 90 | + | |
| 91 | +- Ask Gemini to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/gemini-acp/workspace` on this computer. | |
| 92 | +- When Gemini asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | |
| 93 | +- **An authentication error** in the **Log** tab: the key is not stored in sbx under the name `google`. Store it again, then **🗑 Remove the sandbox** and start the agent. | |
| 94 | + | |
| 95 | +## See also | |
| 96 | + | |
| 97 | +- [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md) | |
| 98 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | |
| 99 | +- [How to add an agent](add-an-agent.md) | |
| new file mode 100644 | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | +# How to add a Gemini agent in an sbx sandbox | ||
| 2 | + | ||
| 3 | +This guide shows how to add Gemini (Google's Gemini CLI, which speaks ACP itself with `gemini --acp`) as a Sidekicks agent that runs inside a Docker sandbox (`sbx`). Gemini then works in its own folder, isolated from the rest of your computer, and Sidekicks shows its files and a terminal like for any other agent. It assumes `sbx` is installed and that you have a Gemini API key. It follows the same steps as [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | ||
| 4 | + | ||
| 5 | +A ready-made example is in the repository: [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/README.md). | ||
| 6 | + | ||
| 7 | +## A kit provided by a third party | ||
| 8 | + | ||
| 9 | +The sandbox is built from the `docker.io/sbx/gemini-kit` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Gemini CLI, at its latest version), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `gemini --acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Gemini may no longer start: the **Log** tab then shows what sbx said. | ||
| 10 | + | ||
| 11 | +## What you need | ||
| 12 | + | ||
| 13 | +| | Role | | ||
| 14 | +| --- | --- | | ||
| 15 | +| A folder for the agent, e.g. `/Users/me/agents/gemini-acp` | holds the sandbox's `sbxenv.yaml` and the `workspace/` folder Gemini works in. | | ||
| 16 | +| The `docker.io/sbx/gemini-kit` kit | the sandbox's image, with the latest Gemini CLI. Docker marks this kit as deprecated in favour of its `antigravity` kit: it may disappear one day. | | ||
| 17 | +| Your Gemini API key, stored in sbx | sbx adds it to Gemini's requests to Google: it is written neither in the sandbox nor in Sidekicks' configuration. | | ||
| 18 | + | ||
| 19 | +## With the assistant | ||
| 20 | + | ||
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/gemini-acp`. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | ||
| 22 | +2. **Give your Gemini API key to sbx**, under the name `google` (the `bindings` of the `sbxenv.yaml`): | ||
| 23 | + | ||
| 24 | + ```bash | ||
| 25 | + sbx secret set google | ||
| 26 | + ``` | ||
| 27 | + | ||
| 28 | + The key is kept by sbx, on this computer, never in a file of the folder. | ||
| 29 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Gemini`) and, if you like, an icon (📘). | ||
| 30 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | ||
| 31 | +5. **Program**: `gemini` is chosen for you, from `agent: gemini` in the `sbxenv.yaml` (otherwise choose it in the list; it is offered in an sbx sandbox only). **Arguments** is filled with `--acp`; with an older Gemini CLI, write `--experimental-acp` instead. | ||
| 32 | +6. Click **Add the agent**, then start Gemini from the **Agents** panel (▶), or write to it. The first time, the **Log** tab shows `sandbox gemini-acp not found: creating it`, then the kit being pulled — this can take a minute or two. | ||
| 33 | + | ||
| 34 | +## By hand | ||
| 35 | + | ||
| 36 | +The `sbxenv.yaml` of the example: | ||
| 37 | + | ||
| 38 | +```yaml | ||
| 39 | +schemaVersion: "1" | ||
| 40 | + | ||
| 41 | +name: gemini-acp | ||
| 42 | +agent: gemini | ||
| 43 | + | ||
| 44 | +# Répertoire du projet, relatif à ce fichier. | ||
| 45 | +workspace: ./workspace | ||
| 46 | + | ||
| 47 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | ||
| 48 | +kits: | ||
| 49 | + - docker.io/sbx/gemini-kit:latest | ||
| 50 | + | ||
| 51 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | ||
| 52 | +bindings: | ||
| 53 | + google: | ||
| 54 | + apiKey: | ||
| 55 | + domains: | ||
| 56 | + - generativelanguage.googleapis.com | ||
| 57 | + - aiplatform.googleapis.com | ||
| 58 | + - vertexai.googleapis.com | ||
| 59 | + oauth: | ||
| 60 | + domains: | ||
| 61 | + - accounts.google.com | ||
| 62 | + - oauth2.googleapis.com | ||
| 63 | + | ||
| 64 | +sandboxOptions: | ||
| 65 | + pullPolicy: always | ||
| 66 | +``` | ||
| 67 | + | ||
| 68 | +And the agent's entry, under `agents:` in **Settings**: | ||
| 69 | + | ||
| 70 | +```yaml | ||
| 71 | + - name: gemini | ||
| 72 | + title: Gemini | ||
| 73 | + icon: "📘" | ||
| 74 | + command: sbx | ||
| 75 | + args: [exec, -i, gemini-acp, gemini, --acp] | ||
| 76 | + workspace: /Users/me/agents/gemini-acp/workspace | ||
| 77 | + runtime: | ||
| 78 | + type: sbx | ||
| 79 | + sandbox: gemini-acp | ||
| 80 | + lifecycle: | ||
| 81 | + folder: /Users/me/agents/gemini-acp | ||
| 82 | + create: [sbx, env, create, --force] | ||
| 83 | + stop: [sbx, stop, gemini-acp] | ||
| 84 | + remove: [sbx, env, rm, --force] | ||
| 85 | +``` | ||
| 86 | + | ||
| 87 | +`workspace` is the folder Gemini works in, on this computer; sbx shares it with the sandbox at the same path. `lifecycle.folder` is the folder of the `sbxenv.yaml`, where the `sbx env` commands run. The sandbox name must be the same in `name:`, `args`, `runtime.sandbox` and `lifecycle.stop`. | ||
| 88 | + | ||
| 89 | +## Check that it works | ||
| 90 | + | ||
| 91 | +- Ask Gemini to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/gemini-acp/workspace` on this computer. | ||
| 92 | +- When Gemini asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer. | ||
| 93 | +- **An authentication error** in the **Log** tab: the key is not stored in sbx under the name `google`. Store it again, then **🗑 Remove the sandbox** and start the agent. | ||
| 94 | + | ||
| 95 | +## See also | ||
| 96 | + | ||
| 97 | +- [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md) | ||
| 98 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) | ||
| 99 | +- [How to add an agent](add-an-agent.md) | ||
modified
docs/en/how-to/add-an-agent.md +4 -2 | @@ -7,7 +7,7 @@ This guide shows how to add an agent from the Sidekicks window, with the "Add an | ||
| 7 | 7 | 1. Open the assistant: **+ Add my first agent** on the welcome screen, **+ Add an agent** under the agents list, or **⇧⌘N** (Ctrl+Shift+N on Linux and Windows). |
| 8 | 8 | 2. **Who is it?** Fill in **Name shown** (e.g. `Garfield (translator)`). **Name used with @** follows it; change it if you want a shorter one (lowercase letters, digits, `-` and `_`, starting with a letter). The icon and the description are optional: the icon is an emoji, or a letter shown in a coloured circle; left empty, the circle holds the first letter of the name shown. |
| 9 | 9 | 3. **Where does it run?** Choose the environment, then fill in what it asks for (see below). |
| 10 | -4. **How is it started?** Fill in **Program** (choose `mm`, `docker-agent` or `docker agent` in the list, or type another), **Arguments** (on one line, as in a terminal; quotes group words) and **Agent's folder**. The folder is created when it does not exist. | |
| 10 | +4. **How is it started?** Fill in **Program** (choose `mm`, `docker-agent` or `docker agent` in the list — plus `claude-agent-acp`, `codex-acp` and `gemini` in an sbx sandbox — or type another), **Arguments** (on one line, as in a terminal; quotes group words) and **Agent's folder**. The folder is created when it does not exist. | |
| 11 | 11 | 5. Click **Add the agent**. Its direct conversation opens once the configuration is reloaded. |
| 12 | 12 | |
| 13 | 13 | When the agent cannot be added (a name already used, for instance), the assistant says why and writes nothing. |
| @@ -17,7 +17,9 @@ When the agent cannot be added (a name already used, for instance), the assistan | ||
| 17 | 17 | - **On this computer, from the agent's configuration file**: choose the program, then drop the agent's YAML file on **The agent's configuration file** (or click **Choose a file…**). The agent's folder becomes the file's folder; for `mm`, `docker-agent` and `docker agent` the arguments are filled in (`--acp --config <file>`, `serve acp <file>`). For another program, type the arguments. Changing the program afterwards fills them again. Every field stays editable. The same works **in an sbx sandbox** or **in a Docker container**, as long as the file is in a folder the sandbox shares, or the container mounts, at the same path (it is read there). |
| 18 | 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. |
| 19 | 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). |
| 20 | -- **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). | |
| 20 | +- **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). The file also chooses the program from its `agent:` line (`mm` for a mini-me kit, `docker-agent` for `agent: docker-agent`, Claude, Codex or Gemini). | |
| 21 | +- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, drop the sandbox's `sbxenv.yaml` (the sandbox, the folder and the commands are filled in, and the program `claude-agent-acp` is chosen from its `agent: claude`), with no arguments. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | |
| 22 | +- **Codex or Gemini in an sbx sandbox**: the same, with the program `codex-acp` (kit `docker.io/sbx/codex-acp`) or `gemini` with the argument `--acp` (kit `docker.io/sbx/gemini-kit`). See [How to add a Codex agent in an sbx sandbox](add-a-codex-agent-in-a-sandbox.md) and [How to add a Gemini agent in an sbx sandbox](add-a-gemini-agent-in-a-sandbox.md). | |
| 21 | 23 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. |
| 22 | 24 | |
| 23 | 25 | ## See also |
| @@ -7,7 +7,7 @@ This guide shows how to add an agent from the Sidekicks window, with the "Add an | |||
| 7 | 1. Open the assistant: **+ Add my first agent** on the welcome screen, **+ Add an agent** under the agents list, or **⇧⌘N** (Ctrl+Shift+N on Linux and Windows). | 7 | 1. Open the assistant: **+ Add my first agent** on the welcome screen, **+ Add an agent** under the agents list, or **⇧⌘N** (Ctrl+Shift+N on Linux and Windows). |
| 8 | 2. **Who is it?** Fill in **Name shown** (e.g. `Garfield (translator)`). **Name used with @** follows it; change it if you want a shorter one (lowercase letters, digits, `-` and `_`, starting with a letter). The icon and the description are optional: the icon is an emoji, or a letter shown in a coloured circle; left empty, the circle holds the first letter of the name shown. | 8 | 2. **Who is it?** Fill in **Name shown** (e.g. `Garfield (translator)`). **Name used with @** follows it; change it if you want a shorter one (lowercase letters, digits, `-` and `_`, starting with a letter). The icon and the description are optional: the icon is an emoji, or a letter shown in a coloured circle; left empty, the circle holds the first letter of the name shown. |
| 9 | 3. **Where does it run?** Choose the environment, then fill in what it asks for (see below). | 9 | 3. **Where does it run?** Choose the environment, then fill in what it asks for (see below). |
| 10 | -4. **How is it started?** Fill in **Program** (choose `mm`, `docker-agent` or `docker agent` in the list, or type another), **Arguments** (on one line, as in a terminal; quotes group words) and **Agent's folder**. The folder is created when it does not exist. | 10 | +4. **How is it started?** Fill in **Program** (choose `mm`, `docker-agent` or `docker agent` in the list — plus `claude-agent-acp`, `codex-acp` and `gemini` in an sbx sandbox — or type another), **Arguments** (on one line, as in a terminal; quotes group words) and **Agent's folder**. The folder is created when it does not exist. |
| 11 | 5. Click **Add the agent**. Its direct conversation opens once the configuration is reloaded. | 11 | 5. Click **Add the agent**. Its direct conversation opens once the configuration is reloaded. |
| 12 | 12 | ||
| 13 | When the agent cannot be added (a name already used, for instance), the assistant says why and writes nothing. | 13 | When the agent cannot be added (a name already used, for instance), the assistant says why and writes nothing. |
| @@ -17,7 +17,9 @@ When the agent cannot be added (a name already used, for instance), the assistan | |||
| 17 | - **On this computer, from the agent's configuration file**: choose the program, then drop the agent's YAML file on **The agent's configuration file** (or click **Choose a file…**). The agent's folder becomes the file's folder; for `mm`, `docker-agent` and `docker agent` the arguments are filled in (`--acp --config <file>`, `serve acp <file>`). For another program, type the arguments. Changing the program afterwards fills them again. Every field stays editable. The same works **in an sbx sandbox** or **in a Docker container**, as long as the file is in a folder the sandbox shares, or the container mounts, at the same path (it is read there). | 17 | - **On this computer, from the agent's configuration file**: choose the program, then drop the agent's YAML file on **The agent's configuration file** (or click **Choose a file…**). The agent's folder becomes the file's folder; for `mm`, `docker-agent` and `docker agent` the arguments are filled in (`--acp --config <file>`, `serve acp <file>`). For another program, type the arguments. Changing the program afterwards fills them again. Every field stays editable. The same works **in an sbx sandbox** or **in a Docker container**, as long as the file is in a folder the sandbox shares, or the container mounts, at the same path (it is read there). |
| 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. | 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. |
| 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). | 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). |
| 20 | -- **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). | 20 | +- **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). The file also chooses the program from its `agent:` line (`mm` for a mini-me kit, `docker-agent` for `agent: docker-agent`, Claude, Codex or Gemini). |
| 21 | +- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, drop the sandbox's `sbxenv.yaml` (the sandbox, the folder and the commands are filled in, and the program `claude-agent-acp` is chosen from its `agent: claude`), with no arguments. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | ||
| 22 | +- **Codex or Gemini in an sbx sandbox**: the same, with the program `codex-acp` (kit `docker.io/sbx/codex-acp`) or `gemini` with the argument `--acp` (kit `docker.io/sbx/gemini-kit`). See [How to add a Codex agent in an sbx sandbox](add-a-codex-agent-in-a-sandbox.md) and [How to add a Gemini agent in an sbx sandbox](add-a-gemini-agent-in-a-sandbox.md). | ||
| 21 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. | 23 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. |
| 22 | 24 | ||
| 23 | ## See also | 25 | ## See also |
modified
docs/en/how-to/install-sidekicks.md +4 -4 | @@ -10,10 +10,9 @@ Sidekicks needs a Mac with Apple Silicon (M1 or later) and macOS 13 (Ventura) or | ||
| 10 | 10 | |
| 11 | 11 | 1. Download `Sidekicks-<version>-macos-arm64.dmg` and open it. |
| 12 | 12 | 2. Drag **sidekicks** into **Applications**. |
| 13 | -3. Open it once from **Applications**. The application is not signed by an Apple developer account, so macOS refuses it the first time ("Apple could not verify…"). | |
| 14 | -4. Open **System Settings → Privacy & Security**, scroll to the message about Sidekicks and click **Open Anyway**, then confirm. | |
| 13 | +3. Open it from **Applications**. The application is signed with a Developer ID certificate and notarized by Apple: macOS asks once whether to open an application downloaded from the Internet; click **Open**. | |
| 15 | 14 | |
| 16 | -From then on, Sidekicks opens normally. | |
| 15 | +To update, drag the new **sidekicks** into **Applications** and confirm the replacement: your configuration and your history are kept. | |
| 17 | 16 | |
| 18 | 17 | ## Windows (x86-64 and Arm) |
| 19 | 18 | |
| @@ -38,7 +37,8 @@ Sidekicks needs GTK 4 and WebKitGTK 6 (Ubuntu 24.04 or later, Debian 13, Fedora | ||
| 38 | 37 | ## Variants |
| 39 | 38 | |
| 40 | 39 | - **Check a download**: `shasum -a 256 <file>` (macOS) or `Get-FileHash <file>` in PowerShell (Windows), and compare with `SHA256SUMS`. |
| 41 | -- **macOS, from a terminal**: `xattr -dr com.apple.quarantine /Applications/sidekicks.app` lifts the quarantine instead of step 4. | |
| 40 | +- **macOS, check the signature**: `spctl -a -vvv /Applications/sidekicks.app` says `accepted` and `source=Notarized Developer ID`. | |
| 41 | +- **macOS, an older package (0.1.0 or 1.0.0)**: these are not signed, so macOS refuses them the first time ("Apple could not verify…"). Open **System Settings → Privacy & Security**, scroll to the message about Sidekicks, click **Open Anyway** and confirm; or, from a terminal, `xattr -dr com.apple.quarantine /Applications/sidekicks.app`. The `1.0.0-macos` package and later ones are signed. | |
| 42 | 42 | - **Build it yourself**: `make package-macos` or `make package-windows` (see [How to publish a release](publish-a-release.md)). |
| 43 | 43 | |
| 44 | 44 | ## See also |
| @@ -10,10 +10,9 @@ Sidekicks needs a Mac with Apple Silicon (M1 or later) and macOS 13 (Ventura) or | |||
| 10 | 10 | ||
| 11 | 1. Download `Sidekicks-<version>-macos-arm64.dmg` and open it. | 11 | 1. Download `Sidekicks-<version>-macos-arm64.dmg` and open it. |
| 12 | 2. Drag **sidekicks** into **Applications**. | 12 | 2. Drag **sidekicks** into **Applications**. |
| 13 | -3. Open it once from **Applications**. The application is not signed by an Apple developer account, so macOS refuses it the first time ("Apple could not verify…"). | 13 | +3. Open it from **Applications**. The application is signed with a Developer ID certificate and notarized by Apple: macOS asks once whether to open an application downloaded from the Internet; click **Open**. |
| 14 | -4. Open **System Settings → Privacy & Security**, scroll to the message about Sidekicks and click **Open Anyway**, then confirm. | ||
| 15 | 14 | ||
| 16 | -From then on, Sidekicks opens normally. | 15 | +To update, drag the new **sidekicks** into **Applications** and confirm the replacement: your configuration and your history are kept. |
| 17 | 16 | ||
| 18 | ## Windows (x86-64 and Arm) | 17 | ## Windows (x86-64 and Arm) |
| 19 | 18 | ||
| @@ -38,7 +37,8 @@ Sidekicks needs GTK 4 and WebKitGTK 6 (Ubuntu 24.04 or later, Debian 13, Fedora | |||
| 38 | ## Variants | 37 | ## Variants |
| 39 | 38 | ||
| 40 | - **Check a download**: `shasum -a 256 <file>` (macOS) or `Get-FileHash <file>` in PowerShell (Windows), and compare with `SHA256SUMS`. | 39 | - **Check a download**: `shasum -a 256 <file>` (macOS) or `Get-FileHash <file>` in PowerShell (Windows), and compare with `SHA256SUMS`. |
| 41 | -- **macOS, from a terminal**: `xattr -dr com.apple.quarantine /Applications/sidekicks.app` lifts the quarantine instead of step 4. | 40 | +- **macOS, check the signature**: `spctl -a -vvv /Applications/sidekicks.app` says `accepted` and `source=Notarized Developer ID`. |
| 41 | +- **macOS, an older package (0.1.0 or 1.0.0)**: these are not signed, so macOS refuses them the first time ("Apple could not verify…"). Open **System Settings → Privacy & Security**, scroll to the message about Sidekicks, click **Open Anyway** and confirm; or, from a terminal, `xattr -dr com.apple.quarantine /Applications/sidekicks.app`. The `1.0.0-macos` package and later ones are signed. | ||
| 42 | - **Build it yourself**: `make package-macos` or `make package-windows` (see [How to publish a release](publish-a-release.md)). | 42 | - **Build it yourself**: `make package-macos` or `make package-windows` (see [How to publish a release](publish-a-release.md)). |
| 43 | 43 | ||
| 44 | ## See also | 44 | ## See also |
modified
docs/en/how-to/manage-channels.md +12 -0 | @@ -44,9 +44,21 @@ While an agent is answering, the history cannot be cleared: stop it (**■**) or | ||
| 44 | 44 | | --- | --- | |
| 45 | 45 | | a specific agent to answer | `@name your message` (the list after `@` filters as you type; Tab or Enter picks) | |
| 46 | 46 | | several agents to answer in turn | `@alice @bob compare your answers` | |
| 47 | +| each agent to do its own part | `@alice write a story about Picard, then @bob sum it up`: each agent receives only the words after its name | | |
| 48 | +| an agent to involve another one | ask it: `@alice …, and ask @bob` ([below](#let-the-agents-call-each-other)) | | |
| 47 | 49 | | the agent you were talking with | your message, without mention | |
| 48 | 50 | | an agent's command | `/` then pick it in the list; with several agents, `/agent:command` | |
| 49 | 51 | |
| 52 | +## Let the agents call each other | |
| 53 | + | |
| 54 | +In a channel, an agent can hand the floor to another member by mentioning it in its answer: when Alice answers "@bob knows the trains better", Bob answers right after, told that Alice addressed him (he also reads your message and Alice's answer). | |
| 55 | + | |
| 56 | +1. Put the agents in the same channel (only **members** can be called this way: an agent never brings a new one in). | |
| 57 | +2. Ask one of them, e.g. `@alice plan a trip to Lyon, and ask @bob for the trains`. Most agents only mention another one when asked to, or when their instructions say who is in the team. | |
| 58 | +3. To stop a chain, click **■**: the agent answering stops, and the others do not answer. | |
| 59 | + | |
| 60 | +An agent does not call itself, an agent that answers your message anyway is not asked twice, a mention inside code does not count, and the answer to a `/command` calls nobody. A message is handed from agent to agent **3 times at most**; then the channel says the chain stops, and you can mention the next agent yourself. Change the limit with `limits.maxAgentHandoffs` in the [configuration](../reference/configuration.md#limits) (`0` turns it off). In a direct conversation, mentions stay plain text. | |
| 61 | + | |
| 50 | 62 | ## Variants |
| 51 | 63 | |
| 52 | 64 | - **Fold the lists of the left panel**: click the heading **AGENTS** or **CHANNELS** to fold the list under it, again to unfold it. Folded, the heading still shows how many agents or channels there are and, in blue, the answers you have not read yet. Sidekicks remembers it at the next launch. ⌘N unfolds the channels to create one; **Add an agent** stays in the command palette (⌘K) and on ⇧⌘N. |
| @@ -44,9 +44,21 @@ While an agent is answering, the history cannot be cleared: stop it (**■**) or | |||
| 44 | | --- | --- | | 44 | | --- | --- | |
| 45 | | a specific agent to answer | `@name your message` (the list after `@` filters as you type; Tab or Enter picks) | | 45 | | a specific agent to answer | `@name your message` (the list after `@` filters as you type; Tab or Enter picks) | |
| 46 | | several agents to answer in turn | `@alice @bob compare your answers` | | 46 | | several agents to answer in turn | `@alice @bob compare your answers` | |
| 47 | +| each agent to do its own part | `@alice write a story about Picard, then @bob sum it up`: each agent receives only the words after its name | | ||
| 48 | +| an agent to involve another one | ask it: `@alice …, and ask @bob` ([below](#let-the-agents-call-each-other)) | | ||
| 47 | | the agent you were talking with | your message, without mention | | 49 | | the agent you were talking with | your message, without mention | |
| 48 | | an agent's command | `/` then pick it in the list; with several agents, `/agent:command` | | 50 | | an agent's command | `/` then pick it in the list; with several agents, `/agent:command` | |
| 49 | 51 | ||
| 52 | +## Let the agents call each other | ||
| 53 | + | ||
| 54 | +In a channel, an agent can hand the floor to another member by mentioning it in its answer: when Alice answers "@bob knows the trains better", Bob answers right after, told that Alice addressed him (he also reads your message and Alice's answer). | ||
| 55 | + | ||
| 56 | +1. Put the agents in the same channel (only **members** can be called this way: an agent never brings a new one in). | ||
| 57 | +2. Ask one of them, e.g. `@alice plan a trip to Lyon, and ask @bob for the trains`. Most agents only mention another one when asked to, or when their instructions say who is in the team. | ||
| 58 | +3. To stop a chain, click **■**: the agent answering stops, and the others do not answer. | ||
| 59 | + | ||
| 60 | +An agent does not call itself, an agent that answers your message anyway is not asked twice, a mention inside code does not count, and the answer to a `/command` calls nobody. A message is handed from agent to agent **3 times at most**; then the channel says the chain stops, and you can mention the next agent yourself. Change the limit with `limits.maxAgentHandoffs` in the [configuration](../reference/configuration.md#limits) (`0` turns it off). In a direct conversation, mentions stay plain text. | ||
| 61 | + | ||
| 50 | ## Variants | 62 | ## Variants |
| 51 | 63 | ||
| 52 | - **Fold the lists of the left panel**: click the heading **AGENTS** or **CHANNELS** to fold the list under it, again to unfold it. Folded, the heading still shows how many agents or channels there are and, in blue, the answers you have not read yet. Sidekicks remembers it at the next launch. ⌘N unfolds the channels to create one; **Add an agent** stays in the command palette (⌘K) and on ⇧⌘N. | 64 | - **Fold the lists of the left panel**: click the heading **AGENTS** or **CHANNELS** to fold the list under it, again to unfold it. Folded, the heading still shows how many agents or channels there are and, in blue, the answers you have not read yet. Sidekicks remembers it at the next launch. ⌘N unfolds the channels to create one; **Add an agent** stays in the command palette (⌘K) and on ⇧⌘N. |
modified
docs/en/how-to/run-an-agent-in-a-sandbox.md +3 -2 | @@ -41,7 +41,7 @@ This guide shows how to declare an agent that runs inside a Docker sandbox (`sbx | ||
| 41 | 41 | |
| 42 | 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: |
| 43 | 43 | |
| 44 | -1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. | |
| 44 | +1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp --config <file>` for a mini-me kit (`agent: mini-me-kit`), `docker-agent` with `serve acp <file>` for `agent: docker-agent` — `<file>` is the `agent.yaml` (or `agent.yml`) of the sandbox's `workspace`, or the configuration file you drop —, `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). | |
| 45 | 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: |
| 46 | 46 | |
| 47 | 47 | ```yaml |
| @@ -64,7 +64,8 @@ The **■ Stop the sandbox** and **🗑 Remove the sandbox** buttons appear in t | ||
| 64 | 64 | - **The sandbox name is not the `name:` of the sbxenv.yaml**: after `create`, Sidekicks still finds no sandbox and says so. Make `sandbox` and `name:` the same. |
| 65 | 65 | - **Sidekicks opened from the Finder**: it may not find `sbx` in its short `PATH`. Write its full path (`command: /usr/local/bin/sbx`, see `which sbx`) or add `env: {PATH: "…"}` to the agent. |
| 66 | 66 | - **The model server runs on this computer**: from inside the sandbox, reach it through `host.docker.internal`, as from a container. |
| 67 | -- **Another program than mm** (docker-agent, for instance): only `args` change, e.g. `[exec, -i, my-sandbox, docker-agent, serve, acp, /path/to/agent.yaml]`. | |
| 67 | +- **Docker Agent stops with `Error: accepts 1 arg(s), received 0`**: it was started with `serve acp` but no agent file. Add the file's path after `serve acp` in its `args` (the assistant now refuses to add it without one). | |
| 68 | +- **Another program than mm** (docker-agent, for instance): only `args` change, e.g. `[exec, -i, my-sandbox, docker-agent, serve, acp, /path/to/agent.yaml]`. For Claude, Codex or Gemini, see [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md), [a Codex agent](add-a-codex-agent-in-a-sandbox.md) or [a Gemini agent](add-a-gemini-agent-in-a-sandbox.md). | |
| 68 | 69 | - **Check without Sidekicks**: `sbx exec -it <sandbox> bash` opens the same kind of shell as the Terminal tab. |
| 69 | 70 | |
| 70 | 71 | ## See also |
| @@ -41,7 +41,7 @@ This guide shows how to declare an agent that runs inside a Docker sandbox (`sbx | |||
| 41 | 41 | ||
| 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: | 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: |
| 43 | 43 | ||
| 44 | -1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. | 44 | +1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp --config <file>` for a mini-me kit (`agent: mini-me-kit`), `docker-agent` with `serve acp <file>` for `agent: docker-agent` — `<file>` is the `agent.yaml` (or `agent.yml`) of the sandbox's `workspace`, or the configuration file you drop —, `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). |
| 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: | 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: |
| 46 | 46 | ||
| 47 | ```yaml | 47 | ```yaml |
| @@ -64,7 +64,8 @@ The **■ Stop the sandbox** and **🗑 Remove the sandbox** buttons appear in t | |||
| 64 | - **The sandbox name is not the `name:` of the sbxenv.yaml**: after `create`, Sidekicks still finds no sandbox and says so. Make `sandbox` and `name:` the same. | 64 | - **The sandbox name is not the `name:` of the sbxenv.yaml**: after `create`, Sidekicks still finds no sandbox and says so. Make `sandbox` and `name:` the same. |
| 65 | - **Sidekicks opened from the Finder**: it may not find `sbx` in its short `PATH`. Write its full path (`command: /usr/local/bin/sbx`, see `which sbx`) or add `env: {PATH: "…"}` to the agent. | 65 | - **Sidekicks opened from the Finder**: it may not find `sbx` in its short `PATH`. Write its full path (`command: /usr/local/bin/sbx`, see `which sbx`) or add `env: {PATH: "…"}` to the agent. |
| 66 | - **The model server runs on this computer**: from inside the sandbox, reach it through `host.docker.internal`, as from a container. | 66 | - **The model server runs on this computer**: from inside the sandbox, reach it through `host.docker.internal`, as from a container. |
| 67 | -- **Another program than mm** (docker-agent, for instance): only `args` change, e.g. `[exec, -i, my-sandbox, docker-agent, serve, acp, /path/to/agent.yaml]`. | 67 | +- **Docker Agent stops with `Error: accepts 1 arg(s), received 0`**: it was started with `serve acp` but no agent file. Add the file's path after `serve acp` in its `args` (the assistant now refuses to add it without one). |
| 68 | +- **Another program than mm** (docker-agent, for instance): only `args` change, e.g. `[exec, -i, my-sandbox, docker-agent, serve, acp, /path/to/agent.yaml]`. For Claude, Codex or Gemini, see [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md), [a Codex agent](add-a-codex-agent-in-a-sandbox.md) or [a Gemini agent](add-a-gemini-agent-in-a-sandbox.md). | ||
| 68 | - **Check without Sidekicks**: `sbx exec -it <sandbox> bash` opens the same kind of shell as the Terminal tab. | 69 | - **Check without Sidekicks**: `sbx exec -it <sandbox> bash` opens the same kind of shell as the Terminal tab. |
| 69 | 70 | ||
| 70 | ## See also | 71 | ## See also |
modified
docs/en/how-to/watch-the-memory-pressure.md +7 -1 | @@ -9,6 +9,8 @@ Local models and agents take a lot of memory. When the computer runs short of it | ||
| 9 | 9 | |
| 10 | 10 | Hover over the level for a reminder of what to do. The line is refreshed every 5 seconds while the panel is open. |
| 11 | 11 | 3. When the level is **high** or **critical**, free memory: |
| 12 | + - unload the model of the agent whose log is shown: **⏏ Unload the model**, next to the agent's name in the panel. The agent keeps running; its model is loaded again with its next message. What the agent answers is written in its log (`unload: …`). The button is there only for an agent that offers the `/unload` command (mm does), and it can be used only while the agent is running and not answering; | |
| 13 | + - or unload every model at once: **⏏ Unload all**. Each running agent that can is asked; a line under the bar names the agents unloaded and the ones left alone (answering, or without `/unload`). Stopped agents are not started for it; | |
| 12 | 14 | - stop an agent you do not need: **■** next to it in the **Agents** panel; |
| 13 | 15 | - close the applications you do not use. |
| 14 | 16 | |
| @@ -17,8 +19,12 @@ Local models and agents take a lot of memory. When the computer runs short of it | ||
| 17 | 19 | - **On macOS**, the level is the one the system gives, the same as the *Memory Pressure* graph of Activity Monitor. The memory used is counted as Activity Monitor does: app memory, wired memory and compressed memory. The memory "cached" by macOS is not counted: it is given back as soon as an application needs it. |
| 18 | 20 | - **On Windows** (and Linux), the level is worked out from the memory still available: **high** under 20 %, **critical** under 10 %. |
| 19 | 21 | - If the memory cannot be measured, the line is not shown. |
| 22 | +- Unloading a model frees its memory within a few seconds, when the model server applies it. Typing `/unload` in a conversation with the agent has the same effect, but leaves the command and its answer in the conversation. | |
| 23 | + | |
| 24 | +**⏏** is also in the agent's row of the **Agents** panel (on hover) and in the header of the agent's view. | |
| 20 | 25 | |
| 21 | 26 | ## See also |
| 22 | 27 | |
| 23 | -- [Reference: services called by the interface](../reference/agents-and-events.md#services-called-by-the-interface) (`SystemService.Memory`) | |
| 28 | +- [Reference: services called by the interface](../reference/agents-and-events.md#services-called-by-the-interface) (`SystemService.Memory`, `AgentService.Unload`, `AgentService.UnloadAll`) | |
| 29 | +- [Explanation: memory and local models](../explanation/memory-and-local-models.md#unloading-a-model-on-request) | |
| 24 | 30 | - [Work with an agent's files and terminal](work-with-an-agents-files.md) |
| @@ -9,6 +9,8 @@ Local models and agents take a lot of memory. When the computer runs short of it | |||
| 9 | 9 | ||
| 10 | Hover over the level for a reminder of what to do. The line is refreshed every 5 seconds while the panel is open. | 10 | Hover over the level for a reminder of what to do. The line is refreshed every 5 seconds while the panel is open. |
| 11 | 3. When the level is **high** or **critical**, free memory: | 11 | 3. When the level is **high** or **critical**, free memory: |
| 12 | + - unload the model of the agent whose log is shown: **⏏ Unload the model**, next to the agent's name in the panel. The agent keeps running; its model is loaded again with its next message. What the agent answers is written in its log (`unload: …`). The button is there only for an agent that offers the `/unload` command (mm does), and it can be used only while the agent is running and not answering; | ||
| 13 | + - or unload every model at once: **⏏ Unload all**. Each running agent that can is asked; a line under the bar names the agents unloaded and the ones left alone (answering, or without `/unload`). Stopped agents are not started for it; | ||
| 12 | - stop an agent you do not need: **■** next to it in the **Agents** panel; | 14 | - stop an agent you do not need: **■** next to it in the **Agents** panel; |
| 13 | - close the applications you do not use. | 15 | - close the applications you do not use. |
| 14 | 16 | ||
| @@ -17,8 +19,12 @@ Local models and agents take a lot of memory. When the computer runs short of it | |||
| 17 | - **On macOS**, the level is the one the system gives, the same as the *Memory Pressure* graph of Activity Monitor. The memory used is counted as Activity Monitor does: app memory, wired memory and compressed memory. The memory "cached" by macOS is not counted: it is given back as soon as an application needs it. | 19 | - **On macOS**, the level is the one the system gives, the same as the *Memory Pressure* graph of Activity Monitor. The memory used is counted as Activity Monitor does: app memory, wired memory and compressed memory. The memory "cached" by macOS is not counted: it is given back as soon as an application needs it. |
| 18 | - **On Windows** (and Linux), the level is worked out from the memory still available: **high** under 20 %, **critical** under 10 %. | 20 | - **On Windows** (and Linux), the level is worked out from the memory still available: **high** under 20 %, **critical** under 10 %. |
| 19 | - If the memory cannot be measured, the line is not shown. | 21 | - If the memory cannot be measured, the line is not shown. |
| 22 | +- Unloading a model frees its memory within a few seconds, when the model server applies it. Typing `/unload` in a conversation with the agent has the same effect, but leaves the command and its answer in the conversation. | ||
| 23 | + | ||
| 24 | +**⏏** is also in the agent's row of the **Agents** panel (on hover) and in the header of the agent's view. | ||
| 20 | 25 | ||
| 21 | ## See also | 26 | ## See also |
| 22 | 27 | ||
| 23 | -- [Reference: services called by the interface](../reference/agents-and-events.md#services-called-by-the-interface) (`SystemService.Memory`) | 28 | +- [Reference: services called by the interface](../reference/agents-and-events.md#services-called-by-the-interface) (`SystemService.Memory`, `AgentService.Unload`, `AgentService.UnloadAll`) |
| 29 | +- [Explanation: memory and local models](../explanation/memory-and-local-models.md#unloading-a-model-on-request) | ||
| 24 | - [Work with an agent's files and terminal](work-with-an-agents-files.md) | 30 | - [Work with an agent's files and terminal](work-with-an-agents-files.md) |
modified
docs/en/how-to/work-with-an-agents-files.md +17 -5 | @@ -12,8 +12,11 @@ This guide shows how to look at what an agent produced, change its instructions, | ||
| 12 | 12 | |
| 13 | 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. |
| 14 | 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. |
| 15 | + Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. | |
| 15 | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 16 | 17 | |
| 18 | +To find a file or a folder in the Finder (macOS), the Explorer (Windows) or the file manager (Linux), hover it in the tree and click **📂**, or click **📂 Show where it is** above the open file. The button shows only when the agent's folder is on this computer: an agent on this computer, or in a container or sandbox whose folder is mounted from here. | |
| 19 | + | |
| 17 | 20 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
| 18 | 21 | |
| 19 | 22 | ## Preview a document or an image |
| @@ -36,10 +39,15 @@ When an agent writes a document and gives a link to it in its answer, click the | ||
| 36 | 39 | |
| 37 | 40 | The link must lead to a file of the agent's folder: a path relative to the folder (`notes/plan.md`), an absolute path inside it (as the agent or this computer sees it), or a `file://` address of such a path. A link to a site opens the browser; any other link shows why the file cannot be shown, and nothing outside the folder is read. To get links that open, tell the agent in its `AGENTS.md`, e.g. "When you write a file, give a Markdown link to it, relative to your folder". |
| 38 | 41 | |
| 39 | -## Create or delete a file | |
| 42 | +## Create, rename, move or delete files | |
| 40 | 43 | |
| 41 | -- **Create**: select a folder (or a file in it), click **+ New file**, type a name, Enter. The file opens, empty. | |
| 42 | -- **Delete**: hover the entry and click **🗑** (or **Delete** under the editor), then confirm. On this computer the file goes to the trash — restore it from the Finder if needed. In a container the deletion is final, and the confirmation says so. | |
| 44 | +- **Create**: select a folder (or a file in it), click **+ New file** (or **+ New folder**), type a name, Enter. A new file opens, empty. | |
| 45 | +- **Select several entries**: ⌘-click (Ctrl-click on Windows and Linux) adds an entry to the selection or takes it out; ⇧-click selects every row up to it; ⌘A (Ctrl+A) selects every row shown. The actions below then apply to the whole selection. | |
| 46 | +- **Rename**: hover the entry and click **✏️**, double-click it, or select it and press **F2**. Type the new name, Enter (Escape cancels). An open file follows its new name, even with unsaved changes. | |
| 47 | +- **Move**: drag entries onto a folder (or onto a file, to go next to it; below the rows for the top of the folder). Without the mouse, right-click → **Move to…** and type the folder (empty for the top). A folder never goes inside itself, and nothing replaces an entry that already has the name. | |
| 48 | +- **Duplicate**: right-click → **Duplicate**, or select and press ⌘D (Ctrl+D). The copy goes next to the original, with `-copy` before the extension (`plan.md` → `plan-copy.md`, then `plan-copy-2.md`…); a folder is copied with its content. A protected file can be duplicated, and its copy is not protected — unless it lands in a protected folder, which is refused. | |
| 49 | +- **Right-click** an entry for a menu with all these actions, and **Show where it is**. | |
| 50 | +- **Delete**: hover the entry and click **🗑** (or **Delete** under the editor, or press **Delete** — ⌘⌫ on a Mac — in the tree), then confirm; with several entries selected, one confirmation covers them all. On this computer the file goes to the trash — restore it from the Finder if needed. In a container the deletion is final, and the confirmation says so. | |
| 43 | 51 | |
| 44 | 52 | ## Protect files |
| 45 | 53 | |
| @@ -50,11 +58,15 @@ Some files must not be changed or deleted by mistake. Without writing anything, | ||
| 50 | 58 | protect: [notes/plan.md, "prompts/**"] |
| 51 | 59 | ``` |
| 52 | 60 | |
| 53 | -A protected file shows 🔒 instead of 🗑 and opens read only; a folder holding one cannot be deleted. Only the configuration lifts a protection (the ones always applied cannot be lifted): the interface never does. The agent, the terminal and the Finder can still change these files. | |
| 61 | +A protected file shows 🔒 instead of ✏️ and 🗑 and opens read only; it can be neither renamed nor moved, and a folder holding one can be neither deleted nor moved. When one of several selected entries is protected, nothing is deleted. Only the configuration lifts a protection (the ones always applied cannot be lifted): the interface never does. The agent, the terminal and the Finder can still change these files. | |
| 54 | 62 | |
| 55 | 63 | ## Run commands in the agent's folder |
| 56 | 64 | |
| 57 | -Click **Terminal**: a shell opens in the agent's folder — yours on this computer, bash or sh inside a container. Full-screen programs (`vim`, `htop`) work and follow the size of the panel. The shell keeps running while you look at **Files**; leaving the agent's view ends it, with everything it started. When the shell ends (`exit`), **Open a new shell** starts another one. | |
| 65 | +Click **Terminal**: a shell opens in the agent's folder — yours on this computer, bash or sh inside a container. Full-screen programs (`vim`, `htop`) work and follow the size of the panel. When the shell ends (`exit`), **Open a new shell** starts another one. | |
| 66 | + | |
| 67 | +- **Several terminals**: **+** next to the terminals opens another one (8 at most per agent), named *Terminal 1*, *Terminal 2*…; click a name to show it. **×** closes a terminal: its shell ends, with everything it started; the others go on. | |
| 68 | +- **They keep running**: go to **Files**, a conversation, a channel or another agent — the terminals go on, with what runs in them, and what they print meanwhile is kept. Coming back to the agent shows its terminals as they are. The **Terminal** tab shows how many are running, and the agent's row in the **Agents** panel shows **⌨ 2**. | |
| 69 | +- A terminal ends only when you close it, when its shell exits, when another configuration file is opened, or when Sidekicks quits. | |
| 58 | 70 | |
| 59 | 71 | ## Read the agent's log |
| 60 | 72 | |
| @@ -12,8 +12,11 @@ This guide shows how to look at what an agent produced, change its instructions, | |||
| 12 | 12 | ||
| 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. | 13 | 1. In **Files**, click a folder to open it, a file to read it. Dot files (`.git`, `.mm`…) and `node_modules` are hidden: tick **Show hidden files** to see them. |
| 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. | 14 | 2. Edit the text. **● modified** appears; **Save** (or ⌘S) writes the file, **Revert** brings back what is on disk. |
| 15 | + Source code is coloured according to its language, told by the extension or the name of the file: Go, JavaScript and TypeScript (with JSX), Python, Rust, Java, C and C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, shell scripts and `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, `.env` and `.ini` files, diffs, PowerShell. Any other file, and a file larger than 512 KB, stays plain text. | ||
| 15 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. | 16 | 3. If the agent changes the file while you edit it, a banner says so: **Take their version** reloads it (your changes are lost), **Keep mine** saves yours over it. |
| 16 | 17 | ||
| 18 | +To find a file or a folder in the Finder (macOS), the Explorer (Windows) or the file manager (Linux), hover it in the tree and click **📂**, or click **📂 Show where it is** above the open file. The button shows only when the agent's folder is on this computer: an agent on this computer, or in a container or sandbox whose folder is mounted from here. | ||
| 19 | + | ||
| 17 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). | 20 | The tree and the open file follow the agent's changes by themselves: a file it creates appears within a second (two in a container). |
| 18 | 21 | ||
| 19 | ## Preview a document or an image | 22 | ## Preview a document or an image |
| @@ -36,10 +39,15 @@ When an agent writes a document and gives a link to it in its answer, click the | |||
| 36 | 39 | ||
| 37 | The link must lead to a file of the agent's folder: a path relative to the folder (`notes/plan.md`), an absolute path inside it (as the agent or this computer sees it), or a `file://` address of such a path. A link to a site opens the browser; any other link shows why the file cannot be shown, and nothing outside the folder is read. To get links that open, tell the agent in its `AGENTS.md`, e.g. "When you write a file, give a Markdown link to it, relative to your folder". | 40 | The link must lead to a file of the agent's folder: a path relative to the folder (`notes/plan.md`), an absolute path inside it (as the agent or this computer sees it), or a `file://` address of such a path. A link to a site opens the browser; any other link shows why the file cannot be shown, and nothing outside the folder is read. To get links that open, tell the agent in its `AGENTS.md`, e.g. "When you write a file, give a Markdown link to it, relative to your folder". |
| 38 | 41 | ||
| 39 | -## Create or delete a file | 42 | +## Create, rename, move or delete files |
| 40 | 43 | ||
| 41 | -- **Create**: select a folder (or a file in it), click **+ New file**, type a name, Enter. The file opens, empty. | 44 | +- **Create**: select a folder (or a file in it), click **+ New file** (or **+ New folder**), type a name, Enter. A new file opens, empty. |
| 42 | -- **Delete**: hover the entry and click **🗑** (or **Delete** under the editor), then confirm. On this computer the file goes to the trash — restore it from the Finder if needed. In a container the deletion is final, and the confirmation says so. | 45 | +- **Select several entries**: ⌘-click (Ctrl-click on Windows and Linux) adds an entry to the selection or takes it out; ⇧-click selects every row up to it; ⌘A (Ctrl+A) selects every row shown. The actions below then apply to the whole selection. |
| 46 | +- **Rename**: hover the entry and click **✏️**, double-click it, or select it and press **F2**. Type the new name, Enter (Escape cancels). An open file follows its new name, even with unsaved changes. | ||
| 47 | +- **Move**: drag entries onto a folder (or onto a file, to go next to it; below the rows for the top of the folder). Without the mouse, right-click → **Move to…** and type the folder (empty for the top). A folder never goes inside itself, and nothing replaces an entry that already has the name. | ||
| 48 | +- **Duplicate**: right-click → **Duplicate**, or select and press ⌘D (Ctrl+D). The copy goes next to the original, with `-copy` before the extension (`plan.md` → `plan-copy.md`, then `plan-copy-2.md`…); a folder is copied with its content. A protected file can be duplicated, and its copy is not protected — unless it lands in a protected folder, which is refused. | ||
| 49 | +- **Right-click** an entry for a menu with all these actions, and **Show where it is**. | ||
| 50 | +- **Delete**: hover the entry and click **🗑** (or **Delete** under the editor, or press **Delete** — ⌘⌫ on a Mac — in the tree), then confirm; with several entries selected, one confirmation covers them all. On this computer the file goes to the trash — restore it from the Finder if needed. In a container the deletion is final, and the confirmation says so. | ||
| 43 | 51 | ||
| 44 | ## Protect files | 52 | ## Protect files |
| 45 | 53 | ||
| @@ -50,11 +58,15 @@ Some files must not be changed or deleted by mistake. Without writing anything, | |||
| 50 | protect: [notes/plan.md, "prompts/**"] | 58 | protect: [notes/plan.md, "prompts/**"] |
| 51 | ``` | 59 | ``` |
| 52 | 60 | ||
| 53 | -A protected file shows 🔒 instead of 🗑 and opens read only; a folder holding one cannot be deleted. Only the configuration lifts a protection (the ones always applied cannot be lifted): the interface never does. The agent, the terminal and the Finder can still change these files. | 61 | +A protected file shows 🔒 instead of ✏️ and 🗑 and opens read only; it can be neither renamed nor moved, and a folder holding one can be neither deleted nor moved. When one of several selected entries is protected, nothing is deleted. Only the configuration lifts a protection (the ones always applied cannot be lifted): the interface never does. The agent, the terminal and the Finder can still change these files. |
| 54 | 62 | ||
| 55 | ## Run commands in the agent's folder | 63 | ## Run commands in the agent's folder |
| 56 | 64 | ||
| 57 | -Click **Terminal**: a shell opens in the agent's folder — yours on this computer, bash or sh inside a container. Full-screen programs (`vim`, `htop`) work and follow the size of the panel. The shell keeps running while you look at **Files**; leaving the agent's view ends it, with everything it started. When the shell ends (`exit`), **Open a new shell** starts another one. | 65 | +Click **Terminal**: a shell opens in the agent's folder — yours on this computer, bash or sh inside a container. Full-screen programs (`vim`, `htop`) work and follow the size of the panel. When the shell ends (`exit`), **Open a new shell** starts another one. |
| 66 | + | ||
| 67 | +- **Several terminals**: **+** next to the terminals opens another one (8 at most per agent), named *Terminal 1*, *Terminal 2*…; click a name to show it. **×** closes a terminal: its shell ends, with everything it started; the others go on. | ||
| 68 | +- **They keep running**: go to **Files**, a conversation, a channel or another agent — the terminals go on, with what runs in them, and what they print meanwhile is kept. Coming back to the agent shows its terminals as they are. The **Terminal** tab shows how many are running, and the agent's row in the **Agents** panel shows **⌨ 2**. | ||
| 69 | +- A terminal ends only when you close it, when its shell exits, when another configuration file is opened, or when Sidekicks quits. | ||
| 58 | 70 | ||
| 59 | ## Read the agent's log | 71 | ## Read the agent's log |
| 60 | 72 | ||
modified
docs/en/reference/agents-and-events.md +11 -3 | @@ -49,6 +49,8 @@ The Go names and types are in `internal/events`; the TypeScript constants and ty | ||
| 49 | 49 | | `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, in configuration order. | |
| 50 | 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | |
| 51 | 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | |
| 52 | +| | `Unload(name)` | Has a running, idle agent that announced the `unload` command unload its model (issue #51): `/unload` is sent in a session of its own, which no conversation shows; the answer goes to the agent's log as `unload: …` lines. Errors: unknown agent, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | |
| 53 | +| | `UnloadAll()` | `Unload` for every running agent: returns `{unloaded[], skipped[]}` (agent names); stopped agents are left out. | | |
| 52 | 54 | | | `Logs(name)` | The last 200 stderr lines of the agent. | |
| 53 | 55 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | |
| 54 | 56 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` and `total` in bytes; all empty (`total` 0) where the memory cannot be measured. macOS: the level of `kern.memorystatus_vm_pressure_level`, used = app + wired + compressed memory (`vm_stat`), as in Activity Monitor. Linux and Windows: worked out from the available memory, `warning` under 20 %, `critical` under 10 %. The Log panel calls it every 5 seconds while it is open (issue #61). | |
| @@ -71,10 +73,11 @@ A channel holds a conversation between the user and one or several agents. A dir | ||
| 71 | 73 | | The message | Answered by | |
| 72 | 74 | | --- | --- | |
| 73 | 75 | | `/agent:command arguments` (`agent` is a configured agent) | that agent, which receives `/command arguments` | |
| 74 | -| contains `@name` mentions of configured agents | the mentioned agents, one after the other, in the order of the mentions; a mentioned agent that is not a member joins first | | |
| 76 | +| contains `@name` mentions of configured agents | the mentioned agents, one after the other, in the order of the mentions; a mentioned agent that is not a member joins first. With several agents, each one receives only its part instead of the text: the words after its mention, up to the next answering agent's mention, without a linking word (then, and, puis, et…); the whole text when the part has fewer than two words | | |
| 75 | 77 | | no mention | the last agent who answered in the channel; with a single member, that member | |
| 76 | 78 | | no mention and nobody answered yet, several members | nobody: system message `no-recipient` | |
| 77 | 79 | | any message in a direct conversation | its agent; mentions are plain text there | |
| 80 | +| an agent's answer, in a channel, mentions other **members** with `@name` (issue #26) | those members answer next, in order, each told who addressed it; not the agent itself, not an agent that answers the message anyway, not a non-member, not a mention inside code, not the answer to a command. At most `limits.maxAgentHandoffs` hand-offs per user message (3 by default; `0` turns it off), then the system message `handoff-limit`; **■** stops the whole chain | | |
| 78 | 81 | |
| 79 | 82 | A message starting with `/` (possibly after mentions) is a command: it is sent alone. Any other message is sent with the channel messages the agent has not seen yet (at most the last 20, each cut at 1500 characters). An agent answers one channel at a time; a channel waiting for it shows whose turn it is. |
| 80 | 83 | |
| @@ -105,7 +108,7 @@ A file is read when the agent's turn comes (5 MB at most); one that cannot be re | ||
| 105 | 108 | | `queued` | a user message waiting for the current answers | |
| 106 | 109 | | `stopReason` | how an agent message ended: `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | |
| 107 | 110 | | `error` | why an agent message ended without a stop reason (the agent's own explanation), or `cancelled` for a queued message dropped by Stop | |
| 108 | -| `code` | system messages: `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (could not start or reach it; `error` says why), `attachment-unavailable` (a joined file was not sent to `agent`; `error` names it and says why) | | |
| 111 | +| `code` | system messages: `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (could not start or reach it; `error` says why), `attachment-unavailable` (a joined file was not sent to `agent`; `error` names it and says why), `handoff-limit` (`agent` mentioned a member, but the message was already handed on `limits.maxAgentHandoffs` times) | | |
| 109 | 112 | | `attachments` | user messages: the files joined with `$path`, as `{agent, path}` (the agent whose folder holds it). Only the reference is kept, never the content. | |
| 110 | 113 | |
| 111 | 114 | A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (compact JSON), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). |
| @@ -178,12 +181,17 @@ A file opened for editing has `path, content, version`; `version` identifies the | ||
| 178 | 181 | |
| 179 | 182 | | Method | Effect | |
| 180 | 183 | | --- | --- | |
| 181 | -| `Info(agent)` | `{location, problem}`: where the folder is (`local · /path`, `container name · /path`), or why it cannot be shown. | | |
| 184 | +| `Info(agent)` | `{location, problem, revealable}`: where the folder is (`local · /path`, `container name · /path`), or why it cannot be shown; `revealable` when the folder is on this computer (issue #74). | | |
| 182 | 185 | | `List(agent, dir)` | The entries of `dir` (`""` is the folder), folders first, then by name. | |
| 183 | 186 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | |
| 184 | 187 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | |
| 185 | 188 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | |
| 186 | 189 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | |
| 190 | +| `RemoveAll(agent, paths)` | Deletes several files and folders (a path inside another one of the list is skipped); nothing is deleted when one of them is protected or holds a protected file. Issue #70. | | |
| 191 | +| `Rename(agent, from, to)` | Renames or moves a file or a folder to the path `to` (its folders are created); returns the new path. Refused when `to` exists, leaves the folder, is inside `from`, or when `from` or `to` is protected. Issue #70. | | |
| 192 | +| `Move(agent, paths, dir)` | Moves files and folders into `dir` (`""` is the top), keeping their names; returns their new paths. Stops at the first that cannot move. Issue #70. | | |
| 193 | +| `Duplicate(agent, paths)` | Copies files and folders next to themselves under a free name with `-copy` before the extension; returns the copies' paths. A copy whose path is protected is refused. Issue #70. | | |
| 194 | +| `CreateFolder(agent, dir, name)` | Creates an empty folder; refused if the name exists or contains `/`. Issue #70. | | |
| 187 | 195 | | `Attach(agent, hostPath)` | Joins a file of this computer to a message: returns its path in the agent's folder, to write after `$`. A file already in the folder is used where it is; any other is copied into `attachments/` (a free name, spaces turned into `-`, 5 MB at most). | |
| 188 | 196 | | `ChooseAttachment()` | Shows the native file dialog, from the home folder; returns the chosen path, or `""`. | |
| 189 | 197 | | `Image(agent, path)` | An image of the folder (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 MB at most) as a `data:` URL, for the preview. Any other file is an error. | |
| @@ -49,6 +49,8 @@ The Go names and types are in `internal/events`; the TypeScript constants and ty | |||
| 49 | | `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, in configuration order. | | 49 | | `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, in configuration order. | |
| 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | | 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | |
| 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | | 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | |
| 52 | +| | `Unload(name)` | Has a running, idle agent that announced the `unload` command unload its model (issue #51): `/unload` is sent in a session of its own, which no conversation shows; the answer goes to the agent's log as `unload: …` lines. Errors: unknown agent, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | ||
| 53 | +| | `UnloadAll()` | `Unload` for every running agent: returns `{unloaded[], skipped[]}` (agent names); stopped agents are left out. | | ||
| 52 | | | `Logs(name)` | The last 200 stderr lines of the agent. | | 54 | | | `Logs(name)` | The last 200 stderr lines of the agent. | |
| 53 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | | 55 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | |
| 54 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` and `total` in bytes; all empty (`total` 0) where the memory cannot be measured. macOS: the level of `kern.memorystatus_vm_pressure_level`, used = app + wired + compressed memory (`vm_stat`), as in Activity Monitor. Linux and Windows: worked out from the available memory, `warning` under 20 %, `critical` under 10 %. The Log panel calls it every 5 seconds while it is open (issue #61). | | 56 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` and `total` in bytes; all empty (`total` 0) where the memory cannot be measured. macOS: the level of `kern.memorystatus_vm_pressure_level`, used = app + wired + compressed memory (`vm_stat`), as in Activity Monitor. Linux and Windows: worked out from the available memory, `warning` under 20 %, `critical` under 10 %. The Log panel calls it every 5 seconds while it is open (issue #61). | |
| @@ -71,10 +73,11 @@ A channel holds a conversation between the user and one or several agents. A dir | |||
| 71 | | The message | Answered by | | 73 | | The message | Answered by | |
| 72 | | --- | --- | | 74 | | --- | --- | |
| 73 | | `/agent:command arguments` (`agent` is a configured agent) | that agent, which receives `/command arguments` | | 75 | | `/agent:command arguments` (`agent` is a configured agent) | that agent, which receives `/command arguments` | |
| 74 | -| contains `@name` mentions of configured agents | the mentioned agents, one after the other, in the order of the mentions; a mentioned agent that is not a member joins first | | 76 | +| contains `@name` mentions of configured agents | the mentioned agents, one after the other, in the order of the mentions; a mentioned agent that is not a member joins first. With several agents, each one receives only its part instead of the text: the words after its mention, up to the next answering agent's mention, without a linking word (then, and, puis, et…); the whole text when the part has fewer than two words | |
| 75 | | no mention | the last agent who answered in the channel; with a single member, that member | | 77 | | no mention | the last agent who answered in the channel; with a single member, that member | |
| 76 | | no mention and nobody answered yet, several members | nobody: system message `no-recipient` | | 78 | | no mention and nobody answered yet, several members | nobody: system message `no-recipient` | |
| 77 | | any message in a direct conversation | its agent; mentions are plain text there | | 79 | | any message in a direct conversation | its agent; mentions are plain text there | |
| 80 | +| an agent's answer, in a channel, mentions other **members** with `@name` (issue #26) | those members answer next, in order, each told who addressed it; not the agent itself, not an agent that answers the message anyway, not a non-member, not a mention inside code, not the answer to a command. At most `limits.maxAgentHandoffs` hand-offs per user message (3 by default; `0` turns it off), then the system message `handoff-limit`; **■** stops the whole chain | | ||
| 78 | 81 | ||
| 79 | A message starting with `/` (possibly after mentions) is a command: it is sent alone. Any other message is sent with the channel messages the agent has not seen yet (at most the last 20, each cut at 1500 characters). An agent answers one channel at a time; a channel waiting for it shows whose turn it is. | 82 | A message starting with `/` (possibly after mentions) is a command: it is sent alone. Any other message is sent with the channel messages the agent has not seen yet (at most the last 20, each cut at 1500 characters). An agent answers one channel at a time; a channel waiting for it shows whose turn it is. |
| 80 | 83 | ||
| @@ -105,7 +108,7 @@ A file is read when the agent's turn comes (5 MB at most); one that cannot be re | |||
| 105 | | `queued` | a user message waiting for the current answers | | 108 | | `queued` | a user message waiting for the current answers | |
| 106 | | `stopReason` | how an agent message ended: `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | | 109 | | `stopReason` | how an agent message ended: `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | |
| 107 | | `error` | why an agent message ended without a stop reason (the agent's own explanation), or `cancelled` for a queued message dropped by Stop | | 110 | | `error` | why an agent message ended without a stop reason (the agent's own explanation), or `cancelled` for a queued message dropped by Stop | |
| 108 | -| `code` | system messages: `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (could not start or reach it; `error` says why), `attachment-unavailable` (a joined file was not sent to `agent`; `error` names it and says why) | | 111 | +| `code` | system messages: `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (could not start or reach it; `error` says why), `attachment-unavailable` (a joined file was not sent to `agent`; `error` names it and says why), `handoff-limit` (`agent` mentioned a member, but the message was already handed on `limits.maxAgentHandoffs` times) | |
| 109 | | `attachments` | user messages: the files joined with `$path`, as `{agent, path}` (the agent whose folder holds it). Only the reference is kept, never the content. | | 112 | | `attachments` | user messages: the files joined with `$path`, as `{agent, path}` (the agent whose folder holds it). Only the reference is kept, never the content. | |
| 110 | 113 | ||
| 111 | A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (compact JSON), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). | 114 | A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (compact JSON), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). |
| @@ -178,12 +181,17 @@ A file opened for editing has `path, content, version`; `version` identifies the | |||
| 178 | 181 | ||
| 179 | | Method | Effect | | 182 | | Method | Effect | |
| 180 | | --- | --- | | 183 | | --- | --- | |
| 181 | -| `Info(agent)` | `{location, problem}`: where the folder is (`local · /path`, `container name · /path`), or why it cannot be shown. | | 184 | +| `Info(agent)` | `{location, problem, revealable}`: where the folder is (`local · /path`, `container name · /path`), or why it cannot be shown; `revealable` when the folder is on this computer (issue #74). | |
| 182 | | `List(agent, dir)` | The entries of `dir` (`""` is the folder), folders first, then by name. | | 185 | | `List(agent, dir)` | The entries of `dir` (`""` is the folder), folders first, then by name. | |
| 183 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | | 186 | | `Read(agent, path)` | A text file of at most 1 MB; a binary or larger file is an error. | |
| 184 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | | 187 | | `Save(agent, path, content, version)` | Writes the file if it still has `version`; otherwise `{conflict: true}` and nothing is written. An empty `version` overwrites. The file is written next to its place and moved over it. | |
| 185 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | | 188 | | `Create(agent, dir, name)` | Creates an empty file; refused if the name exists or contains `/`. | |
| 186 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | | 189 | | `Remove(agent, path)` | Deletes a file or a folder with its content (see the table above). | |
| 190 | +| `RemoveAll(agent, paths)` | Deletes several files and folders (a path inside another one of the list is skipped); nothing is deleted when one of them is protected or holds a protected file. Issue #70. | | ||
| 191 | +| `Rename(agent, from, to)` | Renames or moves a file or a folder to the path `to` (its folders are created); returns the new path. Refused when `to` exists, leaves the folder, is inside `from`, or when `from` or `to` is protected. Issue #70. | | ||
| 192 | +| `Move(agent, paths, dir)` | Moves files and folders into `dir` (`""` is the top), keeping their names; returns their new paths. Stops at the first that cannot move. Issue #70. | | ||
| 193 | +| `Duplicate(agent, paths)` | Copies files and folders next to themselves under a free name with `-copy` before the extension; returns the copies' paths. A copy whose path is protected is refused. Issue #70. | | ||
| 194 | +| `CreateFolder(agent, dir, name)` | Creates an empty folder; refused if the name exists or contains `/`. Issue #70. | | ||
| 187 | | `Attach(agent, hostPath)` | Joins a file of this computer to a message: returns its path in the agent's folder, to write after `$`. A file already in the folder is used where it is; any other is copied into `attachments/` (a free name, spaces turned into `-`, 5 MB at most). | | 195 | | `Attach(agent, hostPath)` | Joins a file of this computer to a message: returns its path in the agent's folder, to write after `$`. A file already in the folder is used where it is; any other is copied into `attachments/` (a free name, spaces turned into `-`, 5 MB at most). | |
| 188 | | `ChooseAttachment()` | Shows the native file dialog, from the home folder; returns the chosen path, or `""`. | | 196 | | `ChooseAttachment()` | Shows the native file dialog, from the home folder; returns the chosen path, or `""`. | |
| 189 | | `Image(agent, path)` | An image of the folder (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 MB at most) as a `data:` URL, for the preview. Any other file is an error. | | 197 | | `Image(agent, path)` | An image of the folder (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 MB at most) as a `data:` URL, for the preview. Any other file is an error. | |
modified
docs/en/reference/configuration.md +1 -0 | @@ -56,6 +56,7 @@ Unknown keys are **errors**, at every level: a misspelt `comand:` must be report | ||
| 56 | 56 | | --- | --- | --- | --- | |
| 57 | 57 | | `maxRunningAgents` | integer ≥ 1 | `2` | Agents running at the same time. Each local agent keeps a model in memory; the default fits a 32 GB laptop with small models. | |
| 58 | 58 | | `stopIdleAgentsAfter` | Go duration (`30s`, `10m`, `1h30m`), or `0` (number or text) | `10m` | Stops an agent unused for this long, to free its memory. `0` never stops it. | |
| 59 | +| `maxAgentHandoffs` | integer, 0 to 10 | `3` | In a channel, how many times one message may be handed from agent to agent: an agent whose answer mentions another member with `@name` gives it the floor ([Manage channels](../how-to/manage-channels.md#let-the-agents-call-each-other)). Once the limit is reached the chain stops, and says so. `0` turns it off. | | |
| 59 | 60 | |
| 60 | 61 | ### An agent |
| 61 | 62 | |
| @@ -56,6 +56,7 @@ Unknown keys are **errors**, at every level: a misspelt `comand:` must be report | |||
| 56 | | --- | --- | --- | --- | | 56 | | --- | --- | --- | --- | |
| 57 | | `maxRunningAgents` | integer ≥ 1 | `2` | Agents running at the same time. Each local agent keeps a model in memory; the default fits a 32 GB laptop with small models. | | 57 | | `maxRunningAgents` | integer ≥ 1 | `2` | Agents running at the same time. Each local agent keeps a model in memory; the default fits a 32 GB laptop with small models. | |
| 58 | | `stopIdleAgentsAfter` | Go duration (`30s`, `10m`, `1h30m`), or `0` (number or text) | `10m` | Stops an agent unused for this long, to free its memory. `0` never stops it. | | 58 | | `stopIdleAgentsAfter` | Go duration (`30s`, `10m`, `1h30m`), or `0` (number or text) | `10m` | Stops an agent unused for this long, to free its memory. `0` never stops it. | |
| 59 | +| `maxAgentHandoffs` | integer, 0 to 10 | `3` | In a channel, how many times one message may be handed from agent to agent: an agent whose answer mentions another member with `@name` gives it the floor ([Manage channels](../how-to/manage-channels.md#let-the-agents-call-each-other)). Once the limit is reached the chain stops, and says so. `0` turns it off. | | ||
| 59 | 60 | ||
| 60 | ### An agent | 61 | ### An agent |
| 61 | 62 | ||
modified
docs/fr/README.md +1 -1 | @@ -7,7 +7,7 @@ Cette documentation suit la méthode [Diátaxis](https://diataxis.fr) : choisiss | ||
| 7 | 7 | | Vous voulez… | Section | Pages | |
| 8 | 8 | | --- | --- | --- | |
| 9 | 9 | | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) | |
| 10 | -| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) | | |
| 10 | +| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) | | |
| 11 | 11 | | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) | |
| 12 | 12 | | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) | |
| 13 | 13 | |
| @@ -7,7 +7,7 @@ Cette documentation suit la méthode [Diátaxis](https://diataxis.fr) : choisiss | |||
| 7 | | Vous voulez… | Section | Pages | | 7 | | Vous voulez… | Section | Pages | |
| 8 | | --- | --- | --- | | 8 | | --- | --- | --- | |
| 9 | | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) | | 9 | | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) | |
| 10 | -| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) | | 10 | +| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) | |
| 11 | | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) | | 11 | | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) | |
| 12 | | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) | | 12 | | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) | |
| 13 | 13 | ||
modified
docs/fr/explanation/channels-et-contexte.md +9 -1 | @@ -16,7 +16,15 @@ L'alternative, une session commune lue par tous les agents, n'existe pas dans AC | ||
| 16 | 16 | |
| 17 | 17 | Un message va aux agents qu'il mentionne, dans l'ordre ; sans mention, au dernier agent qui a parlé. C'est ainsi qu'on parle en groupe : on nomme quelqu'un, ou on continue avec la personne à qui l'on parlait. Personne ne répond à un message qui ne nomme personne dans un channel où plusieurs agents n'ont pas encore parlé — deviner surprendrait davantage l'utilisateur que lui demander de choisir. |
| 18 | 18 | |
| 19 | -Les agents répondent l'un après l'autre, jamais en même temps. Sur un portable, deux modèles locaux qui génèrent ensemble sont chacun plus lents qu'à tour de rôle, et la mémoire est la vraie limite (deux petits modèles sur la machine de référence). Répondre à tour de rôle permet aussi au second agent de lire la réponse du premier : « @alice @bob comparez » donne à Bob la réponse d'Alice à comparer. Pour la même raison, un agent répond à un seul channel à la fois : un second channel attend, et indique à qui c'est le tour. | |
| 19 | +Les agents répondent l'un après l'autre, jamais en même temps. Sur un portable, deux modèles locaux qui génèrent ensemble sont chacun plus lents qu'à tour de rôle, et la mémoire est la vraie limite (deux petits modèles sur la machine de référence). Répondre à tour de rôle permet aussi au second agent de lire la réponse du premier : « @alice @bob comparez » donne à Bob la réponse d'Alice à comparer. Mais un petit modèle ne connaît pas son propre nom : devant « @alice écris une histoire, puis @bob résume-la », Alice peut attendre qu'on lui donne une histoire, et Bob l'écrire puis la résumer. Lui dire son nom et sa part ne suffisait pas non plus : un petit modèle répétait sa part au lieu de la faire. Quand un message s'adresse à plusieurs agents, chacun ne reçoit donc que sa part, comme si l'utilisateur l'avait écrite pour lui seul : les mots qui suivent son nom, jusqu'au nom de l'agent suivant, sans le « puis » qui les relie. Bob lit toujours la réponse d'Alice avant sa part. Une part de moins de deux mots (« @alice et @bob, une blague ») veut dire que la demande est pour tous : chaque agent reçoit le message entier. Pour la même raison, un agent répond à un seul channel à la fois : un second channel attend, et indique à qui c'est le tour. | |
| 20 | + | |
| 21 | +## Quand un agent en appelle un autre | |
| 22 | + | |
| 23 | +Un agent peut avoir besoin d'un autre : Alice prépare un voyage, Bob connaît les trains. Sidekicks laisse un agent passer la parole comme le fait l'utilisateur — en mentionnant un membre avec `@nom` dans sa réponse (ticket #26). L'agent mentionné répond ensuite, lit le channel comme d'habitude (le message de l'utilisateur et la réponse d'Alice parmi ce qu'il n'a pas vu) et apprend qu'Alice s'adresse à lui : il lui répond, à elle, plutôt qu'à l'utilisateur. | |
| 24 | + | |
| 25 | +Les mentions ont été préférées à un outil offert aux agents (un serveur MCP « demander à un agent ») : elles ne demandent rien à l'agent — mm ignore les serveurs MCP qu'un client lui propose — et l'utilisateur voit tout l'échange dans le channel, comme s'il avait écrit la mention lui-même. | |
| 26 | + | |
| 27 | +Le risque est la boucle : deux agents polis peuvent se remercier sans fin, et chaque tour occupe un modèle. La chaîne est donc bornée : un message passe au plus `limits.maxAgentHandoffs` fois d'agent en agent (3 par défaut), puis le channel indique qu'elle s'arrête. Seuls les membres peuvent être appelés — un agent n'en fait jamais entrer un nouveau, ce qui chargerait un autre modèle —, un agent ne peut pas s'appeler lui-même, et **■** arrête toute la chaîne. Dans une conversation directe, il n'y a personne à appeler. | |
| 20 | 28 | |
| 21 | 29 | ## Les commandes partent seules |
| 22 | 30 | |
| @@ -16,7 +16,15 @@ L'alternative, une session commune lue par tous les agents, n'existe pas dans AC | |||
| 16 | 16 | ||
| 17 | Un message va aux agents qu'il mentionne, dans l'ordre ; sans mention, au dernier agent qui a parlé. C'est ainsi qu'on parle en groupe : on nomme quelqu'un, ou on continue avec la personne à qui l'on parlait. Personne ne répond à un message qui ne nomme personne dans un channel où plusieurs agents n'ont pas encore parlé — deviner surprendrait davantage l'utilisateur que lui demander de choisir. | 17 | Un message va aux agents qu'il mentionne, dans l'ordre ; sans mention, au dernier agent qui a parlé. C'est ainsi qu'on parle en groupe : on nomme quelqu'un, ou on continue avec la personne à qui l'on parlait. Personne ne répond à un message qui ne nomme personne dans un channel où plusieurs agents n'ont pas encore parlé — deviner surprendrait davantage l'utilisateur que lui demander de choisir. |
| 18 | 18 | ||
| 19 | -Les agents répondent l'un après l'autre, jamais en même temps. Sur un portable, deux modèles locaux qui génèrent ensemble sont chacun plus lents qu'à tour de rôle, et la mémoire est la vraie limite (deux petits modèles sur la machine de référence). Répondre à tour de rôle permet aussi au second agent de lire la réponse du premier : « @alice @bob comparez » donne à Bob la réponse d'Alice à comparer. Pour la même raison, un agent répond à un seul channel à la fois : un second channel attend, et indique à qui c'est le tour. | 19 | +Les agents répondent l'un après l'autre, jamais en même temps. Sur un portable, deux modèles locaux qui génèrent ensemble sont chacun plus lents qu'à tour de rôle, et la mémoire est la vraie limite (deux petits modèles sur la machine de référence). Répondre à tour de rôle permet aussi au second agent de lire la réponse du premier : « @alice @bob comparez » donne à Bob la réponse d'Alice à comparer. Mais un petit modèle ne connaît pas son propre nom : devant « @alice écris une histoire, puis @bob résume-la », Alice peut attendre qu'on lui donne une histoire, et Bob l'écrire puis la résumer. Lui dire son nom et sa part ne suffisait pas non plus : un petit modèle répétait sa part au lieu de la faire. Quand un message s'adresse à plusieurs agents, chacun ne reçoit donc que sa part, comme si l'utilisateur l'avait écrite pour lui seul : les mots qui suivent son nom, jusqu'au nom de l'agent suivant, sans le « puis » qui les relie. Bob lit toujours la réponse d'Alice avant sa part. Une part de moins de deux mots (« @alice et @bob, une blague ») veut dire que la demande est pour tous : chaque agent reçoit le message entier. Pour la même raison, un agent répond à un seul channel à la fois : un second channel attend, et indique à qui c'est le tour. |
| 20 | + | ||
| 21 | +## Quand un agent en appelle un autre | ||
| 22 | + | ||
| 23 | +Un agent peut avoir besoin d'un autre : Alice prépare un voyage, Bob connaît les trains. Sidekicks laisse un agent passer la parole comme le fait l'utilisateur — en mentionnant un membre avec `@nom` dans sa réponse (ticket #26). L'agent mentionné répond ensuite, lit le channel comme d'habitude (le message de l'utilisateur et la réponse d'Alice parmi ce qu'il n'a pas vu) et apprend qu'Alice s'adresse à lui : il lui répond, à elle, plutôt qu'à l'utilisateur. | ||
| 24 | + | ||
| 25 | +Les mentions ont été préférées à un outil offert aux agents (un serveur MCP « demander à un agent ») : elles ne demandent rien à l'agent — mm ignore les serveurs MCP qu'un client lui propose — et l'utilisateur voit tout l'échange dans le channel, comme s'il avait écrit la mention lui-même. | ||
| 26 | + | ||
| 27 | +Le risque est la boucle : deux agents polis peuvent se remercier sans fin, et chaque tour occupe un modèle. La chaîne est donc bornée : un message passe au plus `limits.maxAgentHandoffs` fois d'agent en agent (3 par défaut), puis le channel indique qu'elle s'arrête. Seuls les membres peuvent être appelés — un agent n'en fait jamais entrer un nouveau, ce qui chargerait un autre modèle —, un agent ne peut pas s'appeler lui-même, et **■** arrête toute la chaîne. Dans une conversation directe, il n'y a personne à appeler. | ||
| 20 | 28 | ||
| 21 | ## Les commandes partent seules | 29 | ## Les commandes partent seules |
| 22 | 30 | ||
modified
docs/fr/explanation/memoire-et-modeles-locaux.md +9 -2 | @@ -21,10 +21,17 @@ Le même raisonnement s'applique aux personnes qui utiliseront Sidekicks sur leu | ||
| 21 | 21 | |
| 22 | 22 | Le prix de l'arrêt des agents inactifs est une mémoire d'un autre genre : mm ne sait pas recharger une session, donc un agent redémarré après une pause ne se souvient plus du début de la conversation. Sidekicks le dit dans la conversation (milestone M2) et redonnera le contexte à l'agent avec les channels (issue #25). |
| 23 | 23 | |
| 24 | -## Alternatives écartées | |
| 24 | +## Décharger un modèle à la demande | |
| 25 | + | |
| 26 | +Arrêter un agent libère son modèle, mais aussi ses sessions. Quand la pression mémoire monte (voir [Surveiller la pression mémoire](../how-to/surveiller-la-pression-memoire.md)), l'utilisateur peut plutôt demander à un agent de **décharger son modèle** sans s'arrêter (ticket #51) : le modèle est rechargé au message suivant. | |
| 27 | + | |
| 28 | +Sidekicks ne parle pas au serveur de modèles : il ne sait pas quel modèle un agent utilise, ni où il est servi. L'agent le sait, c'est donc lui qui le fait. ACP n'a pas de méthode standard pour ça, d'où une convention : **un agent qui annonce une commande slash nommée `unload` sait décharger son modèle**. mm l'annonce juste après `session/new`, et vérifie que le modèle est chargé avant de le décharger (il ne charge jamais un modèle pour le décharger). | |
| 29 | + | |
| 30 | +Sidekicks envoie `/unload` dans une session à part, ouverte pour l'occasion puis oubliée, pour que rien n'apparaisse dans les conversations ; la réponse de l'agent va dans son journal. Il ne le fait que quand l'agent tourne et ne répond à rien : un agent arrêté n'a rien de chargé (`afterStop` sert à décharger à l'arrêt), et un agent en train de répondre rechargerait aussitôt son modèle. Si ACP ou mm proposent un jour une méthode d'extension, elle pourra remplacer la commande sans changer l'interface. | |
| 31 | + | |
| 25 | 32 | |
| 26 | 33 | - **Démarrer tous les agents configurés au lancement** : simple, et inutilisable avec quatre modèles locaux. |
| 27 | -- **Laisser chaque agent décharger son propre modèle** : mm le sait faire (`/unload`), mais seul Sidekicks sait si un autre agent a encore besoin du même modèle. | |
| 34 | +- **Laisser chaque agent décharger son propre modèle de lui-même** : mm le sait faire (`/unload`), mais seul Sidekicks sait si un autre agent a encore besoin du même modèle. Décharger reste un choix de l'utilisateur (ci-dessus). | |
| 28 | 35 | |
| 29 | 36 | ## Lien avec le reste |
| 30 | 37 | |
| @@ -21,10 +21,17 @@ Le même raisonnement s'applique aux personnes qui utiliseront Sidekicks sur leu | |||
| 21 | 21 | ||
| 22 | Le prix de l'arrêt des agents inactifs est une mémoire d'un autre genre : mm ne sait pas recharger une session, donc un agent redémarré après une pause ne se souvient plus du début de la conversation. Sidekicks le dit dans la conversation (milestone M2) et redonnera le contexte à l'agent avec les channels (issue #25). | 22 | Le prix de l'arrêt des agents inactifs est une mémoire d'un autre genre : mm ne sait pas recharger une session, donc un agent redémarré après une pause ne se souvient plus du début de la conversation. Sidekicks le dit dans la conversation (milestone M2) et redonnera le contexte à l'agent avec les channels (issue #25). |
| 23 | 23 | ||
| 24 | -## Alternatives écartées | 24 | +## Décharger un modèle à la demande |
| 25 | + | ||
| 26 | +Arrêter un agent libère son modèle, mais aussi ses sessions. Quand la pression mémoire monte (voir [Surveiller la pression mémoire](../how-to/surveiller-la-pression-memoire.md)), l'utilisateur peut plutôt demander à un agent de **décharger son modèle** sans s'arrêter (ticket #51) : le modèle est rechargé au message suivant. | ||
| 27 | + | ||
| 28 | +Sidekicks ne parle pas au serveur de modèles : il ne sait pas quel modèle un agent utilise, ni où il est servi. L'agent le sait, c'est donc lui qui le fait. ACP n'a pas de méthode standard pour ça, d'où une convention : **un agent qui annonce une commande slash nommée `unload` sait décharger son modèle**. mm l'annonce juste après `session/new`, et vérifie que le modèle est chargé avant de le décharger (il ne charge jamais un modèle pour le décharger). | ||
| 29 | + | ||
| 30 | +Sidekicks envoie `/unload` dans une session à part, ouverte pour l'occasion puis oubliée, pour que rien n'apparaisse dans les conversations ; la réponse de l'agent va dans son journal. Il ne le fait que quand l'agent tourne et ne répond à rien : un agent arrêté n'a rien de chargé (`afterStop` sert à décharger à l'arrêt), et un agent en train de répondre rechargerait aussitôt son modèle. Si ACP ou mm proposent un jour une méthode d'extension, elle pourra remplacer la commande sans changer l'interface. | ||
| 31 | + | ||
| 25 | 32 | ||
| 26 | - **Démarrer tous les agents configurés au lancement** : simple, et inutilisable avec quatre modèles locaux. | 33 | - **Démarrer tous les agents configurés au lancement** : simple, et inutilisable avec quatre modèles locaux. |
| 27 | -- **Laisser chaque agent décharger son propre modèle** : mm le sait faire (`/unload`), mais seul Sidekicks sait si un autre agent a encore besoin du même modèle. | 34 | +- **Laisser chaque agent décharger son propre modèle de lui-même** : mm le sait faire (`/unload`), mais seul Sidekicks sait si un autre agent a encore besoin du même modèle. Décharger reste un choix de l'utilisateur (ci-dessus). |
| 28 | 35 | ||
| 29 | ## Lien avec le reste | 36 | ## Lien avec le reste |
| 30 | 37 | ||
modified
docs/fr/explanation/workspaces-et-terminaux.md +2 -0 | @@ -24,6 +24,8 @@ Une suppression depuis un outil graphique est censée être réversible. Sur cet | ||
| 24 | 24 | |
| 25 | 25 | Un terminal est un vrai shell derrière un pseudo-terminal : les programmes plein écran fonctionnent et la taille suit le panneau. Le fermer doit terminer ce qui y a été lancé — y compris les programmes mis en arrière-plan, qu'un simple « tuer le shell » rate. Dans un conteneur, il y a un piège : arrêter le client `docker exec` laisse le shell tourner dans le conteneur. Sidekicks termine donc toute la session du shell, côté conteneur aussi. Les deux cas ont été trouvés en testant, pas en lisant. |
| 26 | 26 | |
| 27 | +Un terminal appartient à son agent, pas à la vue qui l'affiche : on y lance souvent un long build ou un serveur, puis on retourne à la conversation. Les terminaux, et leurs écrans, vivent donc en dehors de la vue de l'agent : ils continuent de tourner, et d'afficher, pendant que l'utilisateur regarde ailleurs, et un agent peut en avoir plusieurs (issues #72 et #73). En fermer un est toujours la décision de l'utilisateur ; seuls la fermeture de Sidekicks ou l'ouverture d'un autre fichier de configuration les ferment tous. | |
| 28 | + | |
| 27 | 29 | ## Les liens avec le reste |
| 28 | 30 | |
| 29 | 31 | - [Les channels et ce que sait chaque agent](channels-et-contexte.md) : la conversation est la façon principale de travailler avec un agent ; le workspace est l'endroit où regarder quand il faut vérifier quelque chose. |
| @@ -24,6 +24,8 @@ Une suppression depuis un outil graphique est censée être réversible. Sur cet | |||
| 24 | 24 | ||
| 25 | Un terminal est un vrai shell derrière un pseudo-terminal : les programmes plein écran fonctionnent et la taille suit le panneau. Le fermer doit terminer ce qui y a été lancé — y compris les programmes mis en arrière-plan, qu'un simple « tuer le shell » rate. Dans un conteneur, il y a un piège : arrêter le client `docker exec` laisse le shell tourner dans le conteneur. Sidekicks termine donc toute la session du shell, côté conteneur aussi. Les deux cas ont été trouvés en testant, pas en lisant. | 25 | Un terminal est un vrai shell derrière un pseudo-terminal : les programmes plein écran fonctionnent et la taille suit le panneau. Le fermer doit terminer ce qui y a été lancé — y compris les programmes mis en arrière-plan, qu'un simple « tuer le shell » rate. Dans un conteneur, il y a un piège : arrêter le client `docker exec` laisse le shell tourner dans le conteneur. Sidekicks termine donc toute la session du shell, côté conteneur aussi. Les deux cas ont été trouvés en testant, pas en lisant. |
| 26 | 26 | ||
| 27 | +Un terminal appartient à son agent, pas à la vue qui l'affiche : on y lance souvent un long build ou un serveur, puis on retourne à la conversation. Les terminaux, et leurs écrans, vivent donc en dehors de la vue de l'agent : ils continuent de tourner, et d'afficher, pendant que l'utilisateur regarde ailleurs, et un agent peut en avoir plusieurs (issues #72 et #73). En fermer un est toujours la décision de l'utilisateur ; seuls la fermeture de Sidekicks ou l'ouverture d'un autre fichier de configuration les ferment tous. | ||
| 28 | + | ||
| 27 | ## Les liens avec le reste | 29 | ## Les liens avec le reste |
| 28 | 30 | ||
| 29 | - [Les channels et ce que sait chaque agent](channels-et-contexte.md) : la conversation est la façon principale de travailler avec un agent ; le workspace est l'endroit où regarder quand il faut vérifier quelque chose. | 31 | - [Les channels et ce que sait chaque agent](channels-et-contexte.md) : la conversation est la façon principale de travailler avec un agent ; le workspace est l'endroit où regarder quand il faut vérifier quelque chose. |
added
docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md +117 -0 | new file mode 100644 | ||
| @@ -0,0 +1,117 @@ | ||
| 1 | +# Ajouter un agent Claude dans une sandbox sbx | |
| 2 | + | |
| 3 | +Ce guide montre comment ajouter Claude (Claude Code, via son adaptateur ACP `claude-agent-acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Claude travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez une clé d'API Anthropic. | |
| 4 | + | |
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/README.md). | |
| 6 | + | |
| 7 | +## Un kit fourni par un tiers | |
| 8 | + | |
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | |
| 10 | + | |
| 11 | +## Ce qu'il faut | |
| 12 | + | |
| 13 | +| | Rôle | | |
| 14 | +| --- | --- | | |
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/claude-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Claude travaille. | | |
| 16 | +| Le kit `docker.io/sbx/claude-acp` | l'image de la sandbox, avec Claude Code et `claude-agent-acp` installés. | | |
| 17 | +| Votre clé d'API Anthropic, enregistrée dans sbx | sbx l'ajoute aux requêtes de Claude vers Anthropic : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | | |
| 18 | + | |
| 19 | +## Le plus simple : avec l'assistant | |
| 20 | + | |
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/claude-acp`, ou écrivez-les comme aux étapes 1 et 2 ci-dessous. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | |
| 22 | +2. **Donnez votre clé d'API Anthropic à sbx** (étape 3 ci-dessous). | |
| 23 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). | |
| 24 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | |
| 25 | +5. **Programme** : `claude-agent-acp` est choisi pour vous, d'après `agent: claude` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. | |
| 26 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Claude (étape 5 ci-dessous). | |
| 27 | + | |
| 28 | +## À la main | |
| 29 | + | |
| 30 | +Le même résultat, étape par étape — ou pour adapter une sandbox existante. | |
| 31 | + | |
| 32 | +1. **Créez le dossier de l'agent**, avec un `workspace/` vide dedans : | |
| 33 | + | |
| 34 | + ```bash | |
| 35 | + mkdir -p /Users/moi/agents/claude-acp/workspace | |
| 36 | + ``` | |
| 37 | + | |
| 38 | +2. **Écrivez le `sbxenv.yaml` de la sandbox** dans `/Users/moi/agents/claude-acp` : | |
| 39 | + | |
| 40 | + ```yaml | |
| 41 | + schemaVersion: "1" | |
| 42 | + | |
| 43 | + name: claude-acp | |
| 44 | + agent: claude | |
| 45 | + | |
| 46 | + # Le dossier où Claude travaille, relatif à ce fichier. | |
| 47 | + workspace: ./workspace | |
| 48 | + | |
| 49 | + kits: | |
| 50 | + - docker.io/sbx/claude-acp:latest | |
| 51 | + | |
| 52 | + # sbx injecte la clé Anthropic dans les requêtes vers ces domaines. | |
| 53 | + bindings: | |
| 54 | + anthropic: | |
| 55 | + apiKey: | |
| 56 | + domains: | |
| 57 | + - api.anthropic.com | |
| 58 | + - console.anthropic.com | |
| 59 | + | |
| 60 | + sandboxOptions: | |
| 61 | + pullPolicy: always | |
| 62 | + ``` | |
| 63 | + | |
| 64 | + `name` est le nom de la sandbox : Sidekicks utilise le même. | |
| 65 | + | |
| 66 | +3. **Donnez votre clé d'API Anthropic à sbx**, pour qu'il puisse l'injecter (les `bindings` ci-dessus). La clé est gardée par sbx, sur cet ordinateur, jamais dans un fichier du dossier. Voyez `sbx secret --help` pour la commande exacte de votre version de sbx. | |
| 67 | + | |
| 68 | +4. **Ajoutez l'agent avec l'assistant** : dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**, puis : | |
| 69 | + 1. Titre `Claude`, une icône si vous voulez (📙). | |
| 70 | + 2. **Où tourne-t-il ?** **Dans une sandbox sbx**. | |
| 71 | + 3. Déposez `/Users/moi/agents/claude-acp/sbxenv.yaml` sur la zone **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox (`claude-acp`), le dossier de l'agent (`/Users/moi/agents/claude-acp/workspace`) et les commandes `sbx env` sont remplis. | |
| 72 | + 4. **Programme** : tapez `claude-agent-acp`. Laissez **Arguments** vide. | |
| 73 | + 5. Cliquez sur **Ajouter l'agent**. | |
| 74 | + | |
| 75 | + Ou **dans Settings**, ajoutez cette entrée sous `agents:` et enregistrez : | |
| 76 | + | |
| 77 | + ```yaml | |
| 78 | + - name: claude | |
| 79 | + title: Claude | |
| 80 | + icon: "📙" | |
| 81 | + command: sbx | |
| 82 | + args: [exec, -i, claude-acp, claude-agent-acp] | |
| 83 | + workspace: /Users/moi/agents/claude-acp/workspace | |
| 84 | + runtime: | |
| 85 | + type: sbx | |
| 86 | + sandbox: claude-acp | |
| 87 | + lifecycle: | |
| 88 | + folder: /Users/moi/agents/claude-acp | |
| 89 | + create: [sbx, env, create, --force] | |
| 90 | + stop: [sbx, stop, claude-acp] | |
| 91 | + remove: [sbx, env, rm, --force] | |
| 92 | + ``` | |
| 93 | + | |
| 94 | + `workspace` est le dossier où Claude travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` s'exécutent. | |
| 95 | + | |
| 96 | +5. **Démarrez Claude** depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, la sandbox n'existe pas encore : l'onglet **Log** affiche `sandbox claude-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une ou deux minutes. Ensuite Claude répond. | |
| 97 | + | |
| 98 | +## Vérifier que tout marche | |
| 99 | + | |
| 100 | +- Demandez à Claude d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec une salutation ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/claude-acp/workspace` sur cet ordinateur. | |
| 101 | +- Dans l'onglet **Terminal**, `ls` montre le même dossier, depuis l'intérieur de la sandbox. | |
| 102 | +- Quand Claude demande la permission de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | |
| 103 | + | |
| 104 | +## Variantes | |
| 105 | + | |
| 106 | +- **Un autre nom de sandbox** : changez `name:` dans le `sbxenv.yaml` et, dans l'entrée de l'agent, le nom de la sandbox dans `args`, `runtime.sandbox` et `lifecycle.stop`. Tous doivent être identiques. | |
| 107 | +- **Plusieurs agents Claude** : un dossier, un `sbxenv.yaml` et un nom de sandbox chacun, et un `name` différent pour chaque agent (`claude`, `claude-docs`…). | |
| 108 | +- **Claude répond par une erreur d'authentification** (voir l'onglet **Log**) : la clé n'est pas enregistrée dans sbx, ou pas là où les `bindings` l'attendent. Enregistrez-la à nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent : la sandbox est recréée avec la clé. | |
| 109 | +- **Sidekicks ouvert depuis le Finder ne trouve pas `sbx`** : écrivez son chemin complet dans `command` (voir `which sbx`), comme dans [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md#variantes). | |
| 110 | +- **Repartir de zéro** : **🗑 Supprimer la sandbox** dans l'en-tête de l'agent la supprime ; les fichiers de `workspace/` restent sur cet ordinateur. | |
| 111 | + | |
| 112 | +## Voir aussi | |
| 113 | + | |
| 114 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | |
| 115 | +- [Ajouter un agent](ajouter-un-agent.md) | |
| 116 | +- [Travailler avec les fichiers et le terminal d'un agent](fichiers-et-terminal-d-un-agent.md) | |
| 117 | +- [Référence : `runtime.lifecycle`](../reference/configuration.md#runtimelifecycle-conteneur-et-sbx) | |
| new file mode 100644 | |||
| @@ -0,0 +1,117 @@ | |||
| 1 | +# Ajouter un agent Claude dans une sandbox sbx | ||
| 2 | + | ||
| 3 | +Ce guide montre comment ajouter Claude (Claude Code, via son adaptateur ACP `claude-agent-acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Claude travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez une clé d'API Anthropic. | ||
| 4 | + | ||
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/README.md). | ||
| 6 | + | ||
| 7 | +## Un kit fourni par un tiers | ||
| 8 | + | ||
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | ||
| 10 | + | ||
| 11 | +## Ce qu'il faut | ||
| 12 | + | ||
| 13 | +| | Rôle | | ||
| 14 | +| --- | --- | | ||
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/claude-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Claude travaille. | | ||
| 16 | +| Le kit `docker.io/sbx/claude-acp` | l'image de la sandbox, avec Claude Code et `claude-agent-acp` installés. | | ||
| 17 | +| Votre clé d'API Anthropic, enregistrée dans sbx | sbx l'ajoute aux requêtes de Claude vers Anthropic : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | | ||
| 18 | + | ||
| 19 | +## Le plus simple : avec l'assistant | ||
| 20 | + | ||
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/claude-acp`, ou écrivez-les comme aux étapes 1 et 2 ci-dessous. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | ||
| 22 | +2. **Donnez votre clé d'API Anthropic à sbx** (étape 3 ci-dessous). | ||
| 23 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). | ||
| 24 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | ||
| 25 | +5. **Programme** : `claude-agent-acp` est choisi pour vous, d'après `agent: claude` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. | ||
| 26 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Claude (étape 5 ci-dessous). | ||
| 27 | + | ||
| 28 | +## À la main | ||
| 29 | + | ||
| 30 | +Le même résultat, étape par étape — ou pour adapter une sandbox existante. | ||
| 31 | + | ||
| 32 | +1. **Créez le dossier de l'agent**, avec un `workspace/` vide dedans : | ||
| 33 | + | ||
| 34 | + ```bash | ||
| 35 | + mkdir -p /Users/moi/agents/claude-acp/workspace | ||
| 36 | + ``` | ||
| 37 | + | ||
| 38 | +2. **Écrivez le `sbxenv.yaml` de la sandbox** dans `/Users/moi/agents/claude-acp` : | ||
| 39 | + | ||
| 40 | + ```yaml | ||
| 41 | + schemaVersion: "1" | ||
| 42 | + | ||
| 43 | + name: claude-acp | ||
| 44 | + agent: claude | ||
| 45 | + | ||
| 46 | + # Le dossier où Claude travaille, relatif à ce fichier. | ||
| 47 | + workspace: ./workspace | ||
| 48 | + | ||
| 49 | + kits: | ||
| 50 | + - docker.io/sbx/claude-acp:latest | ||
| 51 | + | ||
| 52 | + # sbx injecte la clé Anthropic dans les requêtes vers ces domaines. | ||
| 53 | + bindings: | ||
| 54 | + anthropic: | ||
| 55 | + apiKey: | ||
| 56 | + domains: | ||
| 57 | + - api.anthropic.com | ||
| 58 | + - console.anthropic.com | ||
| 59 | + | ||
| 60 | + sandboxOptions: | ||
| 61 | + pullPolicy: always | ||
| 62 | + ``` | ||
| 63 | + | ||
| 64 | + `name` est le nom de la sandbox : Sidekicks utilise le même. | ||
| 65 | + | ||
| 66 | +3. **Donnez votre clé d'API Anthropic à sbx**, pour qu'il puisse l'injecter (les `bindings` ci-dessus). La clé est gardée par sbx, sur cet ordinateur, jamais dans un fichier du dossier. Voyez `sbx secret --help` pour la commande exacte de votre version de sbx. | ||
| 67 | + | ||
| 68 | +4. **Ajoutez l'agent avec l'assistant** : dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**, puis : | ||
| 69 | + 1. Titre `Claude`, une icône si vous voulez (📙). | ||
| 70 | + 2. **Où tourne-t-il ?** **Dans une sandbox sbx**. | ||
| 71 | + 3. Déposez `/Users/moi/agents/claude-acp/sbxenv.yaml` sur la zone **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox (`claude-acp`), le dossier de l'agent (`/Users/moi/agents/claude-acp/workspace`) et les commandes `sbx env` sont remplis. | ||
| 72 | + 4. **Programme** : tapez `claude-agent-acp`. Laissez **Arguments** vide. | ||
| 73 | + 5. Cliquez sur **Ajouter l'agent**. | ||
| 74 | + | ||
| 75 | + Ou **dans Settings**, ajoutez cette entrée sous `agents:` et enregistrez : | ||
| 76 | + | ||
| 77 | + ```yaml | ||
| 78 | + - name: claude | ||
| 79 | + title: Claude | ||
| 80 | + icon: "📙" | ||
| 81 | + command: sbx | ||
| 82 | + args: [exec, -i, claude-acp, claude-agent-acp] | ||
| 83 | + workspace: /Users/moi/agents/claude-acp/workspace | ||
| 84 | + runtime: | ||
| 85 | + type: sbx | ||
| 86 | + sandbox: claude-acp | ||
| 87 | + lifecycle: | ||
| 88 | + folder: /Users/moi/agents/claude-acp | ||
| 89 | + create: [sbx, env, create, --force] | ||
| 90 | + stop: [sbx, stop, claude-acp] | ||
| 91 | + remove: [sbx, env, rm, --force] | ||
| 92 | + ``` | ||
| 93 | + | ||
| 94 | + `workspace` est le dossier où Claude travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` s'exécutent. | ||
| 95 | + | ||
| 96 | +5. **Démarrez Claude** depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, la sandbox n'existe pas encore : l'onglet **Log** affiche `sandbox claude-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une ou deux minutes. Ensuite Claude répond. | ||
| 97 | + | ||
| 98 | +## Vérifier que tout marche | ||
| 99 | + | ||
| 100 | +- Demandez à Claude d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec une salutation ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/claude-acp/workspace` sur cet ordinateur. | ||
| 101 | +- Dans l'onglet **Terminal**, `ls` montre le même dossier, depuis l'intérieur de la sandbox. | ||
| 102 | +- Quand Claude demande la permission de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | ||
| 103 | + | ||
| 104 | +## Variantes | ||
| 105 | + | ||
| 106 | +- **Un autre nom de sandbox** : changez `name:` dans le `sbxenv.yaml` et, dans l'entrée de l'agent, le nom de la sandbox dans `args`, `runtime.sandbox` et `lifecycle.stop`. Tous doivent être identiques. | ||
| 107 | +- **Plusieurs agents Claude** : un dossier, un `sbxenv.yaml` et un nom de sandbox chacun, et un `name` différent pour chaque agent (`claude`, `claude-docs`…). | ||
| 108 | +- **Claude répond par une erreur d'authentification** (voir l'onglet **Log**) : la clé n'est pas enregistrée dans sbx, ou pas là où les `bindings` l'attendent. Enregistrez-la à nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent : la sandbox est recréée avec la clé. | ||
| 109 | +- **Sidekicks ouvert depuis le Finder ne trouve pas `sbx`** : écrivez son chemin complet dans `command` (voir `which sbx`), comme dans [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md#variantes). | ||
| 110 | +- **Repartir de zéro** : **🗑 Supprimer la sandbox** dans l'en-tête de l'agent la supprime ; les fichiers de `workspace/` restent sur cet ordinateur. | ||
| 111 | + | ||
| 112 | +## Voir aussi | ||
| 113 | + | ||
| 114 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | ||
| 115 | +- [Ajouter un agent](ajouter-un-agent.md) | ||
| 116 | +- [Travailler avec les fichiers et le terminal d'un agent](fichiers-et-terminal-d-un-agent.md) | ||
| 117 | +- [Référence : `runtime.lifecycle`](../reference/configuration.md#runtimelifecycle-conteneur-et-sbx) | ||
added
docs/fr/how-to/ajouter-un-agent-codex-dans-une-sandbox.md +96 -0 | new file mode 100644 | ||
| @@ -0,0 +1,96 @@ | ||
| 1 | +# Ajouter un agent Codex dans une sandbox sbx | |
| 2 | + | |
| 3 | +Ce guide montre comment ajouter Codex (l'agent de code d'OpenAI, via son adaptateur ACP `codex-acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Codex travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez un compte ChatGPT ou une clé d'API OpenAI. Il suit les mêmes étapes que [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | |
| 4 | + | |
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/README.md). | |
| 6 | + | |
| 7 | +## Un kit fourni par un tiers | |
| 8 | + | |
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/codex-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Codex, `codex-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `codex-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Codex ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | |
| 10 | + | |
| 11 | +## Ce qu'il faut | |
| 12 | + | |
| 13 | +| | Rôle | | |
| 14 | +| --- | --- | | |
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/codex-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Codex travaille. | | |
| 16 | +| Le kit `docker.io/sbx/codex-acp` | l'image de la sandbox, avec Codex et `codex-acp` installés. | | |
| 17 | +| Vos identifiants OpenAI, enregistrés dans sbx | sbx les ajoute aux requêtes de Codex vers OpenAI : ils ne sont écrits ni dans la sandbox, ni dans la configuration de Sidekicks. | | |
| 18 | + | |
| 19 | +## Avec l'assistant | |
| 20 | + | |
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/codex-acp`. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | |
| 22 | +2. **Donnez vos identifiants OpenAI à sbx**, avant la création de la sandbox : le kit `codex` les lit quand la sandbox est créée. | |
| 23 | + | |
| 24 | + ```bash | |
| 25 | + sbx secret set -g openai --oauth # connexion avec votre compte ChatGPT | |
| 26 | + echo "$OPENAI_API_KEY" | sbx secret set -g openai # ou : une clé d'API | |
| 27 | + ``` | |
| 28 | + | |
| 29 | + Si vous les enregistrez alors que la sandbox existe déjà, cliquez sur **🗑 Supprimer la sandbox** dans l'en-tête de l'agent, puis redémarrez l'agent. | |
| 30 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Codex`) et, si vous voulez, une icône (📗). | |
| 31 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | |
| 32 | +5. **Programme** : `codex-acp` est choisi pour vous, d'après `agent: codex` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. | |
| 33 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Codex depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, l'onglet **Log** montre `sandbox codex-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une minute ou deux. | |
| 34 | + | |
| 35 | +## À la main | |
| 36 | + | |
| 37 | +Le `sbxenv.yaml` de l'exemple : | |
| 38 | + | |
| 39 | +```yaml | |
| 40 | +schemaVersion: "1" | |
| 41 | + | |
| 42 | +name: codex-acp | |
| 43 | +agent: codex | |
| 44 | + | |
| 45 | +workspace: ./workspace | |
| 46 | + | |
| 47 | +kits: | |
| 48 | + - docker.io/sbx/codex-acp:latest | |
| 49 | + | |
| 50 | +bindings: | |
| 51 | + openai: | |
| 52 | + apiKey: | |
| 53 | + domains: | |
| 54 | + - api.openai.com | |
| 55 | + - openai.com | |
| 56 | + oauth: | |
| 57 | + domains: | |
| 58 | + - auth.openai.com | |
| 59 | + - chatgpt.com | |
| 60 | +``` | |
| 61 | + | |
| 62 | +Et l'entrée de l'agent, sous `agents:` dans **Settings** : | |
| 63 | + | |
| 64 | +```yaml | |
| 65 | + - name: codex | |
| 66 | + title: Codex | |
| 67 | + icon: "📗" | |
| 68 | + command: sbx | |
| 69 | + args: [exec, -i, codex-acp, codex-acp] | |
| 70 | + workspace: /Users/moi/agents/codex-acp/workspace | |
| 71 | + runtime: | |
| 72 | + type: sbx | |
| 73 | + sandbox: codex-acp | |
| 74 | + lifecycle: | |
| 75 | + folder: /Users/moi/agents/codex-acp | |
| 76 | + create: [sbx, env, create, --force] | |
| 77 | + stop: [sbx, stop, codex-acp] | |
| 78 | + remove: [sbx, env, rm, --force] | |
| 79 | +``` | |
| 80 | + | |
| 81 | +`workspace` est le dossier où Codex travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` sont lancées. Le nom de la sandbox doit être le même dans `name:`, `args`, `runtime.sandbox` et `lifecycle.stop`. | |
| 82 | + | |
| 83 | +## Vérifier que ça marche | |
| 84 | + | |
| 85 | +- Demandez à Codex d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/codex-acp/workspace` sur cet ordinateur. | |
| 86 | +- Quand Codex demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | |
| 87 | +- **`cannot mix v3 kits with v1/v2 kits in one sandbox`** à la création de la sandbox : le `sbxenv.yaml` nomme l'ancien kit `docker.io/sbx/codex-acp-kit`. sbx fournit maintenant l'agent `codex` sous forme de kit au nouveau format (v3), qui ne se combine qu'avec des kits v3 : nommez plutôt `docker.io/sbx/codex-acp:latest`, puis redémarrez l'agent. | |
| 88 | +- **`executable file … codex-acp not found`** (exit status 127) : l'agent tourne dans une autre sandbox — le log montre alors le démarrage d'une autre sandbox, par exemple `claude-acp`. L'assistant refuse désormais un `sbxenv.yaml` dont l'`agent:` n'est pas celui du programme ; dans **Settings**, vérifiez que le nom de la sandbox est `codex-acp` dans `args`, `runtime.sandbox` et `lifecycle`, et que `workspace` et `lifecycle.folder` sont les dossiers de Codex. | |
| 89 | +- **``executable file `/home/agent/.local/bin/codex-acp` not found``** avec la bonne sandbox : l'entrée de l'agent a été faite pour l'ancien kit `docker.io/sbx/codex-acp-kit`. Le kit v3 met `codex-acp` dans le `PATH` : écrivez `codex-acp` seul comme dernier argument. | |
| 90 | +- **Une erreur d'authentification** dans l'onglet **Log** : les identifiants ne sont pas enregistrés dans sbx, ou l'ont été après la création de la sandbox. Enregistrez-les de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent. | |
| 91 | + | |
| 92 | +## Voir aussi | |
| 93 | + | |
| 94 | +- [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md) | |
| 95 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | |
| 96 | +- [Ajouter un agent](ajouter-un-agent.md) | |
| new file mode 100644 | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | +# Ajouter un agent Codex dans une sandbox sbx | ||
| 2 | + | ||
| 3 | +Ce guide montre comment ajouter Codex (l'agent de code d'OpenAI, via son adaptateur ACP `codex-acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Codex travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez un compte ChatGPT ou une clé d'API OpenAI. Il suit les mêmes étapes que [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | ||
| 4 | + | ||
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/README.md). | ||
| 6 | + | ||
| 7 | +## Un kit fourni par un tiers | ||
| 8 | + | ||
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/codex-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Codex, `codex-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `codex-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Codex ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | ||
| 10 | + | ||
| 11 | +## Ce qu'il faut | ||
| 12 | + | ||
| 13 | +| | Rôle | | ||
| 14 | +| --- | --- | | ||
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/codex-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Codex travaille. | | ||
| 16 | +| Le kit `docker.io/sbx/codex-acp` | l'image de la sandbox, avec Codex et `codex-acp` installés. | | ||
| 17 | +| Vos identifiants OpenAI, enregistrés dans sbx | sbx les ajoute aux requêtes de Codex vers OpenAI : ils ne sont écrits ni dans la sandbox, ni dans la configuration de Sidekicks. | | ||
| 18 | + | ||
| 19 | +## Avec l'assistant | ||
| 20 | + | ||
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/codex-acp`](../../../agents/snippets/codex-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/codex-acp`. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | ||
| 22 | +2. **Donnez vos identifiants OpenAI à sbx**, avant la création de la sandbox : le kit `codex` les lit quand la sandbox est créée. | ||
| 23 | + | ||
| 24 | + ```bash | ||
| 25 | + sbx secret set -g openai --oauth # connexion avec votre compte ChatGPT | ||
| 26 | + echo "$OPENAI_API_KEY" | sbx secret set -g openai # ou : une clé d'API | ||
| 27 | + ``` | ||
| 28 | + | ||
| 29 | + Si vous les enregistrez alors que la sandbox existe déjà, cliquez sur **🗑 Supprimer la sandbox** dans l'en-tête de l'agent, puis redémarrez l'agent. | ||
| 30 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Codex`) et, si vous voulez, une icône (📗). | ||
| 31 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | ||
| 32 | +5. **Programme** : `codex-acp` est choisi pour vous, d'après `agent: codex` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. | ||
| 33 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Codex depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, l'onglet **Log** montre `sandbox codex-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une minute ou deux. | ||
| 34 | + | ||
| 35 | +## À la main | ||
| 36 | + | ||
| 37 | +Le `sbxenv.yaml` de l'exemple : | ||
| 38 | + | ||
| 39 | +```yaml | ||
| 40 | +schemaVersion: "1" | ||
| 41 | + | ||
| 42 | +name: codex-acp | ||
| 43 | +agent: codex | ||
| 44 | + | ||
| 45 | +workspace: ./workspace | ||
| 46 | + | ||
| 47 | +kits: | ||
| 48 | + - docker.io/sbx/codex-acp:latest | ||
| 49 | + | ||
| 50 | +bindings: | ||
| 51 | + openai: | ||
| 52 | + apiKey: | ||
| 53 | + domains: | ||
| 54 | + - api.openai.com | ||
| 55 | + - openai.com | ||
| 56 | + oauth: | ||
| 57 | + domains: | ||
| 58 | + - auth.openai.com | ||
| 59 | + - chatgpt.com | ||
| 60 | +``` | ||
| 61 | + | ||
| 62 | +Et l'entrée de l'agent, sous `agents:` dans **Settings** : | ||
| 63 | + | ||
| 64 | +```yaml | ||
| 65 | + - name: codex | ||
| 66 | + title: Codex | ||
| 67 | + icon: "📗" | ||
| 68 | + command: sbx | ||
| 69 | + args: [exec, -i, codex-acp, codex-acp] | ||
| 70 | + workspace: /Users/moi/agents/codex-acp/workspace | ||
| 71 | + runtime: | ||
| 72 | + type: sbx | ||
| 73 | + sandbox: codex-acp | ||
| 74 | + lifecycle: | ||
| 75 | + folder: /Users/moi/agents/codex-acp | ||
| 76 | + create: [sbx, env, create, --force] | ||
| 77 | + stop: [sbx, stop, codex-acp] | ||
| 78 | + remove: [sbx, env, rm, --force] | ||
| 79 | +``` | ||
| 80 | + | ||
| 81 | +`workspace` est le dossier où Codex travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` sont lancées. Le nom de la sandbox doit être le même dans `name:`, `args`, `runtime.sandbox` et `lifecycle.stop`. | ||
| 82 | + | ||
| 83 | +## Vérifier que ça marche | ||
| 84 | + | ||
| 85 | +- Demandez à Codex d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/codex-acp/workspace` sur cet ordinateur. | ||
| 86 | +- Quand Codex demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | ||
| 87 | +- **`cannot mix v3 kits with v1/v2 kits in one sandbox`** à la création de la sandbox : le `sbxenv.yaml` nomme l'ancien kit `docker.io/sbx/codex-acp-kit`. sbx fournit maintenant l'agent `codex` sous forme de kit au nouveau format (v3), qui ne se combine qu'avec des kits v3 : nommez plutôt `docker.io/sbx/codex-acp:latest`, puis redémarrez l'agent. | ||
| 88 | +- **`executable file … codex-acp not found`** (exit status 127) : l'agent tourne dans une autre sandbox — le log montre alors le démarrage d'une autre sandbox, par exemple `claude-acp`. L'assistant refuse désormais un `sbxenv.yaml` dont l'`agent:` n'est pas celui du programme ; dans **Settings**, vérifiez que le nom de la sandbox est `codex-acp` dans `args`, `runtime.sandbox` et `lifecycle`, et que `workspace` et `lifecycle.folder` sont les dossiers de Codex. | ||
| 89 | +- **``executable file `/home/agent/.local/bin/codex-acp` not found``** avec la bonne sandbox : l'entrée de l'agent a été faite pour l'ancien kit `docker.io/sbx/codex-acp-kit`. Le kit v3 met `codex-acp` dans le `PATH` : écrivez `codex-acp` seul comme dernier argument. | ||
| 90 | +- **Une erreur d'authentification** dans l'onglet **Log** : les identifiants ne sont pas enregistrés dans sbx, ou l'ont été après la création de la sandbox. Enregistrez-les de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent. | ||
| 91 | + | ||
| 92 | +## Voir aussi | ||
| 93 | + | ||
| 94 | +- [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md) | ||
| 95 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | ||
| 96 | +- [Ajouter un agent](ajouter-un-agent.md) | ||
added
docs/fr/how-to/ajouter-un-agent-gemini-dans-une-sandbox.md +99 -0 | new file mode 100644 | ||
| @@ -0,0 +1,99 @@ | ||
| 1 | +# Ajouter un agent Gemini dans une sandbox sbx | |
| 2 | + | |
| 3 | +Ce guide montre comment ajouter Gemini (Gemini CLI de Google, qui parle ACP lui-même avec `gemini --acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Gemini travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez une clé d'API Gemini. Il suit les mêmes étapes que [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | |
| 4 | + | |
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/README.md). | |
| 6 | + | |
| 7 | +## Un kit fourni par un tiers | |
| 8 | + | |
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/gemini-kit`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Gemini CLI, dans sa dernière version), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `gemini --acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Gemini ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | |
| 10 | + | |
| 11 | +## Ce qu'il faut | |
| 12 | + | |
| 13 | +| | Rôle | | |
| 14 | +| --- | --- | | |
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/gemini-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Gemini travaille. | | |
| 16 | +| Le kit `docker.io/sbx/gemini-kit` | l'image de la sandbox, avec la dernière version de Gemini CLI. Docker indique ce kit comme déprécié au profit de son kit `antigravity` : il peut disparaître un jour. | | |
| 17 | +| Votre clé d'API Gemini, enregistrée dans sbx | sbx l'ajoute aux requêtes de Gemini vers Google : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | | |
| 18 | + | |
| 19 | +## Avec l'assistant | |
| 20 | + | |
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/gemini-acp`. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | |
| 22 | +2. **Donnez votre clé d'API Gemini à sbx**, sous le nom `google` (les `bindings` du `sbxenv.yaml`) : | |
| 23 | + | |
| 24 | + ```bash | |
| 25 | + sbx secret set google | |
| 26 | + ``` | |
| 27 | + | |
| 28 | + La clé est gardée par sbx, sur cet ordinateur, jamais dans un fichier du dossier. | |
| 29 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Gemini`) et, si vous voulez, une icône (📘). | |
| 30 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | |
| 31 | +5. **Programme** : `gemini` est choisi pour vous, d'après `agent: gemini` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). **Arguments** est rempli avec `--acp` ; avec une ancienne version de Gemini CLI, écrivez plutôt `--experimental-acp`. | |
| 32 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Gemini depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, l'onglet **Log** montre `sandbox gemini-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une minute ou deux. | |
| 33 | + | |
| 34 | +## À la main | |
| 35 | + | |
| 36 | +Le `sbxenv.yaml` de l'exemple : | |
| 37 | + | |
| 38 | +```yaml | |
| 39 | +schemaVersion: "1" | |
| 40 | + | |
| 41 | +name: gemini-acp | |
| 42 | +agent: gemini | |
| 43 | + | |
| 44 | +# Répertoire du projet, relatif à ce fichier. | |
| 45 | +workspace: ./workspace | |
| 46 | + | |
| 47 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | |
| 48 | +kits: | |
| 49 | + - docker.io/sbx/gemini-kit:latest | |
| 50 | + | |
| 51 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | |
| 52 | +bindings: | |
| 53 | + google: | |
| 54 | + apiKey: | |
| 55 | + domains: | |
| 56 | + - generativelanguage.googleapis.com | |
| 57 | + - aiplatform.googleapis.com | |
| 58 | + - vertexai.googleapis.com | |
| 59 | + oauth: | |
| 60 | + domains: | |
| 61 | + - accounts.google.com | |
| 62 | + - oauth2.googleapis.com | |
| 63 | + | |
| 64 | +sandboxOptions: | |
| 65 | + pullPolicy: always | |
| 66 | +``` | |
| 67 | + | |
| 68 | +Et l'entrée de l'agent, sous `agents:` dans **Settings** : | |
| 69 | + | |
| 70 | +```yaml | |
| 71 | + - name: gemini | |
| 72 | + title: Gemini | |
| 73 | + icon: "📘" | |
| 74 | + command: sbx | |
| 75 | + args: [exec, -i, gemini-acp, gemini, --acp] | |
| 76 | + workspace: /Users/moi/agents/gemini-acp/workspace | |
| 77 | + runtime: | |
| 78 | + type: sbx | |
| 79 | + sandbox: gemini-acp | |
| 80 | + lifecycle: | |
| 81 | + folder: /Users/moi/agents/gemini-acp | |
| 82 | + create: [sbx, env, create, --force] | |
| 83 | + stop: [sbx, stop, gemini-acp] | |
| 84 | + remove: [sbx, env, rm, --force] | |
| 85 | +``` | |
| 86 | + | |
| 87 | +`workspace` est le dossier où Gemini travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` sont lancées. Le nom de la sandbox doit être le même dans `name:`, `args`, `runtime.sandbox` et `lifecycle.stop`. | |
| 88 | + | |
| 89 | +## Vérifier que ça marche | |
| 90 | + | |
| 91 | +- Demandez à Gemini d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/gemini-acp/workspace` sur cet ordinateur. | |
| 92 | +- Quand Gemini demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | |
| 93 | +- **Une erreur d'authentification** dans l'onglet **Log** : la clé n'est pas enregistrée dans sbx sous le nom `google`. Enregistrez-la de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent. | |
| 94 | + | |
| 95 | +## Voir aussi | |
| 96 | + | |
| 97 | +- [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md) | |
| 98 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | |
| 99 | +- [Ajouter un agent](ajouter-un-agent.md) | |
| new file mode 100644 | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | +# Ajouter un agent Gemini dans une sandbox sbx | ||
| 2 | + | ||
| 3 | +Ce guide montre comment ajouter Gemini (Gemini CLI de Google, qui parle ACP lui-même avec `gemini --acp`) comme agent de Sidekicks, dans une sandbox Docker (`sbx`). Gemini travaille alors dans son propre dossier, isolé du reste de votre ordinateur, et Sidekicks montre ses fichiers et un terminal comme pour tout autre agent. Il suppose que `sbx` est installé et que vous avez une clé d'API Gemini. Il suit les mêmes étapes que [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | ||
| 4 | + | ||
| 5 | +Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/README.md). | ||
| 6 | + | ||
| 7 | +## Un kit fourni par un tiers | ||
| 8 | + | ||
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/gemini-kit`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Gemini CLI, dans sa dernière version), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `gemini --acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Gemini ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | ||
| 10 | + | ||
| 11 | +## Ce qu'il faut | ||
| 12 | + | ||
| 13 | +| | Rôle | | ||
| 14 | +| --- | --- | | ||
| 15 | +| Un dossier pour l'agent, par exemple `/Users/moi/agents/gemini-acp` | contient le `sbxenv.yaml` de la sandbox et le dossier `workspace/` où Gemini travaille. | | ||
| 16 | +| Le kit `docker.io/sbx/gemini-kit` | l'image de la sandbox, avec la dernière version de Gemini CLI. Docker indique ce kit comme déprécié au profit de son kit `antigravity` : il peut disparaître un jour. | | ||
| 17 | +| Votre clé d'API Gemini, enregistrée dans sbx | sbx l'ajoute aux requêtes de Gemini vers Google : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | | ||
| 18 | + | ||
| 19 | +## Avec l'assistant | ||
| 20 | + | ||
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/gemini-acp`](../../../agents/snippets/gemini-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/gemini-acp`. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | ||
| 22 | +2. **Donnez votre clé d'API Gemini à sbx**, sous le nom `google` (les `bindings` du `sbxenv.yaml`) : | ||
| 23 | + | ||
| 24 | + ```bash | ||
| 25 | + sbx secret set google | ||
| 26 | + ``` | ||
| 27 | + | ||
| 28 | + La clé est gardée par sbx, sur cet ordinateur, jamais dans un fichier du dossier. | ||
| 29 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Gemini`) et, si vous voulez, une icône (📘). | ||
| 30 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | ||
| 31 | +5. **Programme** : `gemini` est choisi pour vous, d'après `agent: gemini` dans le `sbxenv.yaml` (sinon choisissez-le dans la liste ; il n'est proposé que dans une sandbox sbx). **Arguments** est rempli avec `--acp` ; avec une ancienne version de Gemini CLI, écrivez plutôt `--experimental-acp`. | ||
| 32 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Gemini depuis le panneau **Agents** (▶), ou écrivez-lui. La première fois, l'onglet **Log** montre `sandbox gemini-acp not found: creating it`, puis le téléchargement du kit — cela peut prendre une minute ou deux. | ||
| 33 | + | ||
| 34 | +## À la main | ||
| 35 | + | ||
| 36 | +Le `sbxenv.yaml` de l'exemple : | ||
| 37 | + | ||
| 38 | +```yaml | ||
| 39 | +schemaVersion: "1" | ||
| 40 | + | ||
| 41 | +name: gemini-acp | ||
| 42 | +agent: gemini | ||
| 43 | + | ||
| 44 | +# Répertoire du projet, relatif à ce fichier. | ||
| 45 | +workspace: ./workspace | ||
| 46 | + | ||
| 47 | +# Gemini CLI parle ACP lui-même (gemini --acp) : pas d'adaptateur. | ||
| 48 | +kits: | ||
| 49 | + - docker.io/sbx/gemini-kit:latest | ||
| 50 | + | ||
| 51 | +# Autorise l’injection de la clé Gemini (sbx secret set google) pour ces domaines. | ||
| 52 | +bindings: | ||
| 53 | + google: | ||
| 54 | + apiKey: | ||
| 55 | + domains: | ||
| 56 | + - generativelanguage.googleapis.com | ||
| 57 | + - aiplatform.googleapis.com | ||
| 58 | + - vertexai.googleapis.com | ||
| 59 | + oauth: | ||
| 60 | + domains: | ||
| 61 | + - accounts.google.com | ||
| 62 | + - oauth2.googleapis.com | ||
| 63 | + | ||
| 64 | +sandboxOptions: | ||
| 65 | + pullPolicy: always | ||
| 66 | +``` | ||
| 67 | + | ||
| 68 | +Et l'entrée de l'agent, sous `agents:` dans **Settings** : | ||
| 69 | + | ||
| 70 | +```yaml | ||
| 71 | + - name: gemini | ||
| 72 | + title: Gemini | ||
| 73 | + icon: "📘" | ||
| 74 | + command: sbx | ||
| 75 | + args: [exec, -i, gemini-acp, gemini, --acp] | ||
| 76 | + workspace: /Users/moi/agents/gemini-acp/workspace | ||
| 77 | + runtime: | ||
| 78 | + type: sbx | ||
| 79 | + sandbox: gemini-acp | ||
| 80 | + lifecycle: | ||
| 81 | + folder: /Users/moi/agents/gemini-acp | ||
| 82 | + create: [sbx, env, create, --force] | ||
| 83 | + stop: [sbx, stop, gemini-acp] | ||
| 84 | + remove: [sbx, env, rm, --force] | ||
| 85 | +``` | ||
| 86 | + | ||
| 87 | +`workspace` est le dossier où Gemini travaille, sur cet ordinateur ; sbx le partage avec la sandbox au même chemin. `lifecycle.folder` est le dossier du `sbxenv.yaml`, où les commandes `sbx env` sont lancées. Le nom de la sandbox doit être le même dans `name:`, `args`, `runtime.sandbox` et `lifecycle.stop`. | ||
| 88 | + | ||
| 89 | +## Vérifier que ça marche | ||
| 90 | + | ||
| 91 | +- Demandez à Gemini d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/gemini-acp/workspace` sur cet ordinateur. | ||
| 92 | +- Quand Gemini demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse. | ||
| 93 | +- **Une erreur d'authentification** dans l'onglet **Log** : la clé n'est pas enregistrée dans sbx sous le nom `google`. Enregistrez-la de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent. | ||
| 94 | + | ||
| 95 | +## Voir aussi | ||
| 96 | + | ||
| 97 | +- [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md) | ||
| 98 | +- [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md) | ||
| 99 | +- [Ajouter un agent](ajouter-un-agent.md) | ||
modified
docs/fr/how-to/ajouter-un-agent.md +4 -2 | @@ -7,7 +7,7 @@ Ce guide montre comment ajouter un agent depuis la fenêtre de Sidekicks, avec l | ||
| 7 | 7 | 1. Ouvrez l'assistant : **+ Ajouter mon premier agent** sur l'écran d'accueil, **+ Ajouter un agent** sous la liste des agents, ou **⇧⌘N** (Ctrl+Maj+N sous Linux et Windows). |
| 8 | 8 | 2. **Qui est-ce ?** Remplissez **Nom affiché** (par exemple `Garfield (traducteur)`). **Nom utilisé avec @** le suit ; changez-le si vous en voulez un plus court (minuscules, chiffres, `-` et `_`, en commençant par une lettre). L'icône et la description sont facultatives : l'icône est un emoji, ou une lettre affichée dans un rond coloré ; laissée vide, le rond contient la première lettre du nom affiché. |
| 9 | 9 | 3. **Où tourne-t-il ?** Choisissez l'environnement, puis remplissez ce qu'il demande (voir plus bas). |
| 10 | -4. **Comment le démarrer ?** Remplissez **Programme** (choisissez `mm`, `docker-agent` ou `docker agent` dans la liste, ou tapez-en un autre), **Arguments** (sur une ligne, comme dans un terminal ; les guillemets regroupent des mots) et **Dossier de l'agent**. Le dossier est créé s'il n'existe pas. | |
| 10 | +4. **Comment le démarrer ?** Remplissez **Programme** (choisissez `mm`, `docker-agent` ou `docker agent` dans la liste — plus `claude-agent-acp`, `codex-acp` et `gemini` dans une sandbox sbx — ou tapez-en un autre), **Arguments** (sur une ligne, comme dans un terminal ; les guillemets regroupent des mots) et **Dossier de l'agent**. Le dossier est créé s'il n'existe pas. | |
| 11 | 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre dès que la configuration est rechargée. |
| 12 | 12 | |
| 13 | 13 | Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'assistant dit pourquoi et n'écrit rien. |
| @@ -17,7 +17,9 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | ||
| 17 | 17 | - **Sur cet ordinateur, depuis le fichier de configuration de l'agent** : choisissez le programme, puis déposez le fichier YAML de l'agent sur **Le fichier de configuration de l'agent** (ou cliquez sur **Choisir un fichier…**). Le dossier de l'agent devient celui du fichier ; pour `mm`, `docker-agent` et `docker agent`, les arguments sont remplis (`--acp --config <fichier>`, `serve acp <fichier>`). Pour un autre programme, tapez les arguments. Changer de programme ensuite les remplit de nouveau. Chaque champ reste modifiable. Cela fonctionne aussi **dans une sandbox sbx** ou **dans un conteneur Docker**, si le fichier est dans un dossier que la sandbox partage, ou que le conteneur monte, au même chemin (il y est lu). |
| 18 | 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. |
| 19 | 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). |
| 20 | -- **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). | |
| 20 | +- **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). Le fichier choisit aussi le programme d'après sa ligne `agent:` (`mm` pour un kit mini-me, `docker-agent` pour `agent: docker-agent`, Claude, Codex ou Gemini). | |
| 21 | +- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, déposez le `sbxenv.yaml` de la sandbox (la sandbox, le dossier et les commandes sont remplis, et le programme `claude-agent-acp` est choisi d'après son `agent: claude`), sans argument. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | |
| 22 | +- **Codex ou Gemini dans une sandbox sbx** : de même, avec le programme `codex-acp` (kit `docker.io/sbx/codex-acp`) ou `gemini` avec l'argument `--acp` (kit `docker.io/sbx/gemini-kit`). Voir [Ajouter un agent Codex dans une sandbox sbx](ajouter-un-agent-codex-dans-une-sandbox.md) et [Ajouter un agent Gemini dans une sandbox sbx](ajouter-un-agent-gemini-dans-une-sandbox.md). | |
| 21 | 23 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. |
| 22 | 24 | |
| 23 | 25 | ## Voir aussi |
| @@ -7,7 +7,7 @@ Ce guide montre comment ajouter un agent depuis la fenêtre de Sidekicks, avec l | |||
| 7 | 1. Ouvrez l'assistant : **+ Ajouter mon premier agent** sur l'écran d'accueil, **+ Ajouter un agent** sous la liste des agents, ou **⇧⌘N** (Ctrl+Maj+N sous Linux et Windows). | 7 | 1. Ouvrez l'assistant : **+ Ajouter mon premier agent** sur l'écran d'accueil, **+ Ajouter un agent** sous la liste des agents, ou **⇧⌘N** (Ctrl+Maj+N sous Linux et Windows). |
| 8 | 2. **Qui est-ce ?** Remplissez **Nom affiché** (par exemple `Garfield (traducteur)`). **Nom utilisé avec @** le suit ; changez-le si vous en voulez un plus court (minuscules, chiffres, `-` et `_`, en commençant par une lettre). L'icône et la description sont facultatives : l'icône est un emoji, ou une lettre affichée dans un rond coloré ; laissée vide, le rond contient la première lettre du nom affiché. | 8 | 2. **Qui est-ce ?** Remplissez **Nom affiché** (par exemple `Garfield (traducteur)`). **Nom utilisé avec @** le suit ; changez-le si vous en voulez un plus court (minuscules, chiffres, `-` et `_`, en commençant par une lettre). L'icône et la description sont facultatives : l'icône est un emoji, ou une lettre affichée dans un rond coloré ; laissée vide, le rond contient la première lettre du nom affiché. |
| 9 | 3. **Où tourne-t-il ?** Choisissez l'environnement, puis remplissez ce qu'il demande (voir plus bas). | 9 | 3. **Où tourne-t-il ?** Choisissez l'environnement, puis remplissez ce qu'il demande (voir plus bas). |
| 10 | -4. **Comment le démarrer ?** Remplissez **Programme** (choisissez `mm`, `docker-agent` ou `docker agent` dans la liste, ou tapez-en un autre), **Arguments** (sur une ligne, comme dans un terminal ; les guillemets regroupent des mots) et **Dossier de l'agent**. Le dossier est créé s'il n'existe pas. | 10 | +4. **Comment le démarrer ?** Remplissez **Programme** (choisissez `mm`, `docker-agent` ou `docker agent` dans la liste — plus `claude-agent-acp`, `codex-acp` et `gemini` dans une sandbox sbx — ou tapez-en un autre), **Arguments** (sur une ligne, comme dans un terminal ; les guillemets regroupent des mots) et **Dossier de l'agent**. Le dossier est créé s'il n'existe pas. |
| 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre dès que la configuration est rechargée. | 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre dès que la configuration est rechargée. |
| 12 | 12 | ||
| 13 | Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'assistant dit pourquoi et n'écrit rien. | 13 | Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'assistant dit pourquoi et n'écrit rien. |
| @@ -17,7 +17,9 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | |||
| 17 | - **Sur cet ordinateur, depuis le fichier de configuration de l'agent** : choisissez le programme, puis déposez le fichier YAML de l'agent sur **Le fichier de configuration de l'agent** (ou cliquez sur **Choisir un fichier…**). Le dossier de l'agent devient celui du fichier ; pour `mm`, `docker-agent` et `docker agent`, les arguments sont remplis (`--acp --config <fichier>`, `serve acp <fichier>`). Pour un autre programme, tapez les arguments. Changer de programme ensuite les remplit de nouveau. Chaque champ reste modifiable. Cela fonctionne aussi **dans une sandbox sbx** ou **dans un conteneur Docker**, si le fichier est dans un dossier que la sandbox partage, ou que le conteneur monte, au même chemin (il y est lu). | 17 | - **Sur cet ordinateur, depuis le fichier de configuration de l'agent** : choisissez le programme, puis déposez le fichier YAML de l'agent sur **Le fichier de configuration de l'agent** (ou cliquez sur **Choisir un fichier…**). Le dossier de l'agent devient celui du fichier ; pour `mm`, `docker-agent` et `docker agent`, les arguments sont remplis (`--acp --config <fichier>`, `serve acp <fichier>`). Pour un autre programme, tapez les arguments. Changer de programme ensuite les remplit de nouveau. Chaque champ reste modifiable. Cela fonctionne aussi **dans une sandbox sbx** ou **dans un conteneur Docker**, si le fichier est dans un dossier que la sandbox partage, ou que le conteneur monte, au même chemin (il y est lu). |
| 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. | 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. |
| 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). | 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). |
| 20 | -- **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). | 20 | +- **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). Le fichier choisit aussi le programme d'après sa ligne `agent:` (`mm` pour un kit mini-me, `docker-agent` pour `agent: docker-agent`, Claude, Codex ou Gemini). |
| 21 | +- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, déposez le `sbxenv.yaml` de la sandbox (la sandbox, le dossier et les commandes sont remplis, et le programme `claude-agent-acp` est choisi d'après son `agent: claude`), sans argument. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | ||
| 22 | +- **Codex ou Gemini dans une sandbox sbx** : de même, avec le programme `codex-acp` (kit `docker.io/sbx/codex-acp`) ou `gemini` avec l'argument `--acp` (kit `docker.io/sbx/gemini-kit`). Voir [Ajouter un agent Codex dans une sandbox sbx](ajouter-un-agent-codex-dans-une-sandbox.md) et [Ajouter un agent Gemini dans une sandbox sbx](ajouter-un-agent-gemini-dans-une-sandbox.md). | ||
| 21 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. | 23 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. |
| 22 | 24 | ||
| 23 | ## Voir aussi | 25 | ## Voir aussi |
modified
docs/fr/how-to/fichiers-et-terminal-d-un-agent.md +17 -5 | @@ -12,8 +12,11 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | ||
| 12 | 12 | |
| 13 | 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. |
| 14 | 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. |
| 15 | + Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. | |
| 15 | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 16 | 17 | |
| 18 | +Pour retrouver un fichier ou un dossier dans le Finder (macOS), l'Explorateur (Windows) ou le gestionnaire de fichiers (Linux), survolez-le dans l'arbre et cliquez sur **📂**, ou cliquez sur **📂 Afficher l'emplacement** au-dessus du fichier ouvert. Le bouton n'apparaît que si le dossier de l'agent est sur cet ordinateur : un agent sur cet ordinateur, ou dans un conteneur ou une sandbox dont le dossier est monté depuis ici. | |
| 19 | + | |
| 17 | 20 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
| 18 | 21 | |
| 19 | 22 | ## Prévisualiser un document ou une image |
| @@ -36,10 +39,15 @@ Quand un agent écrit un document et donne un lien vers lui dans sa réponse, cl | ||
| 36 | 39 | |
| 37 | 40 | Le lien doit mener à un fichier du dossier de l'agent : un chemin relatif au dossier (`notes/plan.md`), un chemin absolu à l'intérieur (tel que l'agent ou cet ordinateur le voit), ou une adresse `file://` d'un tel chemin. Un lien vers un site ouvre le navigateur ; tout autre lien explique pourquoi le fichier ne peut pas être affiché, et rien n'est lu hors du dossier. Pour obtenir des liens qui s'ouvrent, dites-le à l'agent dans son `AGENTS.md`, par exemple « Quand tu écris un fichier, donne un lien Markdown vers lui, relatif à ton dossier ». |
| 38 | 41 | |
| 39 | -## Créer ou supprimer un fichier | |
| 42 | +## Créer, renommer, déplacer ou supprimer des fichiers | |
| 40 | 43 | |
| 41 | -- **Créer** : sélectionnez un dossier (ou un fichier qu'il contient), cliquez sur **+ New file**, tapez un nom, Entrée. Le fichier s'ouvre, vide. | |
| 42 | -- **Supprimer** : survolez l'entrée et cliquez sur **🗑** (ou **Delete** sous l'éditeur), puis confirmez. Sur cet ordinateur, le fichier part à la corbeille — récupérez-le depuis le Finder si besoin. Dans un conteneur, la suppression est définitive, et la confirmation le dit. | |
| 44 | +- **Créer** : sélectionnez un dossier (ou un fichier qu'il contient), cliquez sur **+ New file** (ou **+ New folder**), tapez un nom, Entrée. Un nouveau fichier s'ouvre, vide. | |
| 45 | +- **Sélectionner plusieurs entrées** : ⌘-clic (Ctrl-clic sous Windows et Linux) ajoute une entrée à la sélection ou l'en retire ; ⇧-clic sélectionne toutes les lignes jusqu'à elle ; ⌘A (Ctrl+A) sélectionne toutes les lignes affichées. Les actions ci-dessous s'appliquent alors à toute la sélection. | |
| 46 | +- **Renommer** : survolez l'entrée et cliquez sur **✏️**, double-cliquez dessus, ou sélectionnez-la et appuyez sur **F2**. Tapez le nouveau nom, Entrée (Échap annule). Un fichier ouvert suit son nouveau nom, même avec des modifications non enregistrées. | |
| 47 | +- **Déplacer** : glissez les entrées sur un dossier (ou sur un fichier, pour aller à côté ; sous les lignes pour la racine du dossier). Sans la souris : clic droit → **Move to…** et tapez le dossier (vide pour la racine). Un dossier ne va jamais dans lui-même, et rien ne remplace une entrée qui porte déjà ce nom. | |
| 48 | +- **Dupliquer** : clic droit → **Duplicate**, ou sélectionnez et appuyez sur ⌘D (Ctrl+D). La copie se place à côté de l'original, avec `-copy` avant l'extension (`plan.md` → `plan-copy.md`, puis `plan-copy-2.md`…) ; un dossier est copié avec son contenu. Un fichier protégé peut être dupliqué, et sa copie n'est pas protégée — sauf si elle tombe dans un dossier protégé, ce qui est refusé. | |
| 49 | +- **Clic droit** sur une entrée : un menu avec toutes ces actions, et **Afficher l'emplacement**. | |
| 50 | +- **Supprimer** : survolez l'entrée et cliquez sur **🗑** (ou **Delete** sous l'éditeur, ou appuyez sur **Suppr** — ⌘⌫ sur Mac — dans l'arbre), puis confirmez ; avec plusieurs entrées sélectionnées, une seule confirmation suffit. Sur cet ordinateur, le fichier part à la corbeille — récupérez-le depuis le Finder si besoin. Dans un conteneur, la suppression est définitive, et la confirmation le dit. | |
| 43 | 51 | |
| 44 | 52 | ## Protéger des fichiers |
| 45 | 53 | |
| @@ -50,11 +58,15 @@ Certains fichiers ne doivent pas être modifiés ou supprimés par erreur. Sans | ||
| 50 | 58 | protect: [notes/plan.md, "prompts/**"] |
| 51 | 59 | ``` |
| 52 | 60 | |
| 53 | -Un fichier protégé affiche 🔒 au lieu de 🗑 et s'ouvre en lecture seule ; un dossier qui en contient un ne peut pas être supprimé. Seule la configuration lève une protection (celles toujours appliquées ne se lèvent pas) : l'interface jamais. L'agent, le terminal et le Finder peuvent toujours modifier ces fichiers. | |
| 61 | +Un fichier protégé affiche 🔒 au lieu de ✏️ et 🗑 et s'ouvre en lecture seule ; il ne peut être ni renommé ni déplacé, et un dossier qui en contient un ne peut être ni supprimé ni déplacé. Si l'une des entrées sélectionnées est protégée, rien n'est supprimé. Seule la configuration lève une protection (celles toujours appliquées ne se lèvent pas) : l'interface jamais. L'agent, le terminal et le Finder peuvent toujours modifier ces fichiers. | |
| 54 | 62 | |
| 55 | 63 | ## Lancer des commandes dans le dossier de l'agent |
| 56 | 64 | |
| 57 | -Cliquez sur **Terminal** : un shell s'ouvre dans le dossier de l'agent — le vôtre sur cet ordinateur, bash ou sh dans un conteneur. Les programmes plein écran (`vim`, `htop`) fonctionnent et suivent la taille du panneau. Le shell continue de tourner pendant que vous regardez **Files** ; quitter la vue de l'agent le termine, avec tout ce qu'il a lancé. Quand le shell se termine (`exit`), **Open a new shell** en ouvre un autre. | |
| 65 | +Cliquez sur **Terminal** : un shell s'ouvre dans le dossier de l'agent — le vôtre sur cet ordinateur, bash ou sh dans un conteneur. Les programmes plein écran (`vim`, `htop`) fonctionnent et suivent la taille du panneau. Quand le shell se termine (`exit`), **Open a new shell** en ouvre un autre. | |
| 66 | + | |
| 67 | +- **Plusieurs terminaux** : **+** à côté des terminaux en ouvre un autre (8 au plus par agent), nommés *Terminal 1*, *Terminal 2*… ; cliquez sur un nom pour l'afficher. **×** ferme un terminal : son shell se termine, avec tout ce qu'il a lancé ; les autres continuent. | |
| 68 | +- **Ils continuent de tourner** : allez dans **Files**, une conversation, un channel ou un autre agent — les terminaux continuent, avec ce qui y tourne, et ce qu'ils affichent entre-temps est gardé. En revenant sur l'agent, ses terminaux sont tels quels. L'onglet **Terminal** indique combien tournent, et la ligne de l'agent dans le panneau **Agents** affiche **⌨ 2**. | |
| 69 | +- Un terminal ne s'arrête que si vous le fermez, si son shell se termine, si un autre fichier de configuration est ouvert, ou quand Sidekicks se ferme. | |
| 58 | 70 | |
| 59 | 71 | ## Lire le journal de l'agent |
| 60 | 72 | |
| @@ -12,8 +12,11 @@ Ce guide montre comment voir ce qu'un agent a produit, modifier ses instructions | |||
| 12 | 12 | ||
| 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. | 13 | 1. Dans **Files**, cliquez sur un dossier pour l'ouvrir, sur un fichier pour le lire. Les fichiers commençant par un point (`.git`, `.mm`…) et `node_modules` sont cachés : cochez **Show hidden files** pour les voir. |
| 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. | 14 | 2. Modifiez le texte. **● modified** apparaît ; **Save** (ou ⌘S) écrit le fichier, **Revert** remet ce qui est sur le disque. |
| 15 | + Le code source est colorisé selon son langage, reconnu à l'extension ou au nom du fichier : Go, JavaScript et TypeScript (avec JSX), Python, Rust, Java, C et C++, C#, Kotlin, Swift, Ruby, PHP, Lua, SQL, scripts shell et `Makefile`, `Dockerfile`, HTML, CSS, XML, YAML, JSON, TOML, fichiers `.env` et `.ini`, diffs, PowerShell. Tout autre fichier, et un fichier de plus de 512 Ko, reste en texte brut. | ||
| 15 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. | 16 | 3. Si l'agent modifie le fichier pendant que vous l'éditez, un bandeau le signale : **Take their version** le recharge (vos modifications sont perdues), **Keep mine** enregistre les vôtres par-dessus. |
| 16 | 17 | ||
| 18 | +Pour retrouver un fichier ou un dossier dans le Finder (macOS), l'Explorateur (Windows) ou le gestionnaire de fichiers (Linux), survolez-le dans l'arbre et cliquez sur **📂**, ou cliquez sur **📂 Afficher l'emplacement** au-dessus du fichier ouvert. Le bouton n'apparaît que si le dossier de l'agent est sur cet ordinateur : un agent sur cet ordinateur, ou dans un conteneur ou une sandbox dont le dossier est monté depuis ici. | ||
| 19 | + | ||
| 17 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). | 20 | L'arbre et le fichier ouvert suivent seuls les changements de l'agent : un fichier qu'il crée apparaît en une seconde (deux dans un conteneur). |
| 18 | 21 | ||
| 19 | ## Prévisualiser un document ou une image | 22 | ## Prévisualiser un document ou une image |
| @@ -36,10 +39,15 @@ Quand un agent écrit un document et donne un lien vers lui dans sa réponse, cl | |||
| 36 | 39 | ||
| 37 | Le lien doit mener à un fichier du dossier de l'agent : un chemin relatif au dossier (`notes/plan.md`), un chemin absolu à l'intérieur (tel que l'agent ou cet ordinateur le voit), ou une adresse `file://` d'un tel chemin. Un lien vers un site ouvre le navigateur ; tout autre lien explique pourquoi le fichier ne peut pas être affiché, et rien n'est lu hors du dossier. Pour obtenir des liens qui s'ouvrent, dites-le à l'agent dans son `AGENTS.md`, par exemple « Quand tu écris un fichier, donne un lien Markdown vers lui, relatif à ton dossier ». | 40 | Le lien doit mener à un fichier du dossier de l'agent : un chemin relatif au dossier (`notes/plan.md`), un chemin absolu à l'intérieur (tel que l'agent ou cet ordinateur le voit), ou une adresse `file://` d'un tel chemin. Un lien vers un site ouvre le navigateur ; tout autre lien explique pourquoi le fichier ne peut pas être affiché, et rien n'est lu hors du dossier. Pour obtenir des liens qui s'ouvrent, dites-le à l'agent dans son `AGENTS.md`, par exemple « Quand tu écris un fichier, donne un lien Markdown vers lui, relatif à ton dossier ». |
| 38 | 41 | ||
| 39 | -## Créer ou supprimer un fichier | 42 | +## Créer, renommer, déplacer ou supprimer des fichiers |
| 40 | 43 | ||
| 41 | -- **Créer** : sélectionnez un dossier (ou un fichier qu'il contient), cliquez sur **+ New file**, tapez un nom, Entrée. Le fichier s'ouvre, vide. | 44 | +- **Créer** : sélectionnez un dossier (ou un fichier qu'il contient), cliquez sur **+ New file** (ou **+ New folder**), tapez un nom, Entrée. Un nouveau fichier s'ouvre, vide. |
| 42 | -- **Supprimer** : survolez l'entrée et cliquez sur **🗑** (ou **Delete** sous l'éditeur), puis confirmez. Sur cet ordinateur, le fichier part à la corbeille — récupérez-le depuis le Finder si besoin. Dans un conteneur, la suppression est définitive, et la confirmation le dit. | 45 | +- **Sélectionner plusieurs entrées** : ⌘-clic (Ctrl-clic sous Windows et Linux) ajoute une entrée à la sélection ou l'en retire ; ⇧-clic sélectionne toutes les lignes jusqu'à elle ; ⌘A (Ctrl+A) sélectionne toutes les lignes affichées. Les actions ci-dessous s'appliquent alors à toute la sélection. |
| 46 | +- **Renommer** : survolez l'entrée et cliquez sur **✏️**, double-cliquez dessus, ou sélectionnez-la et appuyez sur **F2**. Tapez le nouveau nom, Entrée (Échap annule). Un fichier ouvert suit son nouveau nom, même avec des modifications non enregistrées. | ||
| 47 | +- **Déplacer** : glissez les entrées sur un dossier (ou sur un fichier, pour aller à côté ; sous les lignes pour la racine du dossier). Sans la souris : clic droit → **Move to…** et tapez le dossier (vide pour la racine). Un dossier ne va jamais dans lui-même, et rien ne remplace une entrée qui porte déjà ce nom. | ||
| 48 | +- **Dupliquer** : clic droit → **Duplicate**, ou sélectionnez et appuyez sur ⌘D (Ctrl+D). La copie se place à côté de l'original, avec `-copy` avant l'extension (`plan.md` → `plan-copy.md`, puis `plan-copy-2.md`…) ; un dossier est copié avec son contenu. Un fichier protégé peut être dupliqué, et sa copie n'est pas protégée — sauf si elle tombe dans un dossier protégé, ce qui est refusé. | ||
| 49 | +- **Clic droit** sur une entrée : un menu avec toutes ces actions, et **Afficher l'emplacement**. | ||
| 50 | +- **Supprimer** : survolez l'entrée et cliquez sur **🗑** (ou **Delete** sous l'éditeur, ou appuyez sur **Suppr** — ⌘⌫ sur Mac — dans l'arbre), puis confirmez ; avec plusieurs entrées sélectionnées, une seule confirmation suffit. Sur cet ordinateur, le fichier part à la corbeille — récupérez-le depuis le Finder si besoin. Dans un conteneur, la suppression est définitive, et la confirmation le dit. | ||
| 43 | 51 | ||
| 44 | ## Protéger des fichiers | 52 | ## Protéger des fichiers |
| 45 | 53 | ||
| @@ -50,11 +58,15 @@ Certains fichiers ne doivent pas être modifiés ou supprimés par erreur. Sans | |||
| 50 | protect: [notes/plan.md, "prompts/**"] | 58 | protect: [notes/plan.md, "prompts/**"] |
| 51 | ``` | 59 | ``` |
| 52 | 60 | ||
| 53 | -Un fichier protégé affiche 🔒 au lieu de 🗑 et s'ouvre en lecture seule ; un dossier qui en contient un ne peut pas être supprimé. Seule la configuration lève une protection (celles toujours appliquées ne se lèvent pas) : l'interface jamais. L'agent, le terminal et le Finder peuvent toujours modifier ces fichiers. | 61 | +Un fichier protégé affiche 🔒 au lieu de ✏️ et 🗑 et s'ouvre en lecture seule ; il ne peut être ni renommé ni déplacé, et un dossier qui en contient un ne peut être ni supprimé ni déplacé. Si l'une des entrées sélectionnées est protégée, rien n'est supprimé. Seule la configuration lève une protection (celles toujours appliquées ne se lèvent pas) : l'interface jamais. L'agent, le terminal et le Finder peuvent toujours modifier ces fichiers. |
| 54 | 62 | ||
| 55 | ## Lancer des commandes dans le dossier de l'agent | 63 | ## Lancer des commandes dans le dossier de l'agent |
| 56 | 64 | ||
| 57 | -Cliquez sur **Terminal** : un shell s'ouvre dans le dossier de l'agent — le vôtre sur cet ordinateur, bash ou sh dans un conteneur. Les programmes plein écran (`vim`, `htop`) fonctionnent et suivent la taille du panneau. Le shell continue de tourner pendant que vous regardez **Files** ; quitter la vue de l'agent le termine, avec tout ce qu'il a lancé. Quand le shell se termine (`exit`), **Open a new shell** en ouvre un autre. | 65 | +Cliquez sur **Terminal** : un shell s'ouvre dans le dossier de l'agent — le vôtre sur cet ordinateur, bash ou sh dans un conteneur. Les programmes plein écran (`vim`, `htop`) fonctionnent et suivent la taille du panneau. Quand le shell se termine (`exit`), **Open a new shell** en ouvre un autre. |
| 66 | + | ||
| 67 | +- **Plusieurs terminaux** : **+** à côté des terminaux en ouvre un autre (8 au plus par agent), nommés *Terminal 1*, *Terminal 2*… ; cliquez sur un nom pour l'afficher. **×** ferme un terminal : son shell se termine, avec tout ce qu'il a lancé ; les autres continuent. | ||
| 68 | +- **Ils continuent de tourner** : allez dans **Files**, une conversation, un channel ou un autre agent — les terminaux continuent, avec ce qui y tourne, et ce qu'ils affichent entre-temps est gardé. En revenant sur l'agent, ses terminaux sont tels quels. L'onglet **Terminal** indique combien tournent, et la ligne de l'agent dans le panneau **Agents** affiche **⌨ 2**. | ||
| 69 | +- Un terminal ne s'arrête que si vous le fermez, si son shell se termine, si un autre fichier de configuration est ouvert, ou quand Sidekicks se ferme. | ||
| 58 | 70 | ||
| 59 | ## Lire le journal de l'agent | 71 | ## Lire le journal de l'agent |
| 60 | 72 | ||
modified
docs/fr/how-to/gerer-les-channels.md +12 -0 | @@ -44,9 +44,21 @@ Pendant qu'un agent répond, l'historique ne peut pas être vidé : arrêtez-le | ||
| 44 | 44 | | --- | --- | |
| 45 | 45 | | qu'un agent précis réponde | `@nom votre message` (la liste après `@` se filtre pendant la frappe ; Tab ou Entrée choisit) | |
| 46 | 46 | | que plusieurs agents répondent à tour de rôle | `@alice @bob comparez vos réponses` | |
| 47 | +| que chaque agent fasse sa part | `@alice écris une histoire sur Picard, puis @bob résume-la` : chaque agent ne reçoit que les mots qui suivent son nom | | |
| 48 | +| qu'un agent en fasse intervenir un autre | demandez-le-lui : `@alice …, et demande à @bob` ([plus bas](#laisser-les-agents-sappeler-entre-eux)) | | |
| 47 | 49 | | continuer avec l'agent à qui vous parliez | votre message, sans mention | |
| 48 | 50 | | une commande d'un agent | `/` puis choisissez-la dans la liste ; avec plusieurs agents, `/agent:commande` | |
| 49 | 51 | |
| 52 | +## Laisser les agents s'appeler entre eux | |
| 53 | + | |
| 54 | +Dans un channel, un agent peut passer la parole à un autre membre en le mentionnant dans sa réponse : quand Alice répond « @bob connaît mieux les trains », Bob répond juste après, en sachant qu'Alice s'adresse à lui (il lit aussi votre message et la réponse d'Alice). | |
| 55 | + | |
| 56 | +1. Mettez les agents dans le même channel (seuls les **membres** peuvent être appelés ainsi : un agent n'en fait jamais entrer un nouveau). | |
| 57 | +2. Demandez à l'un d'eux, par exemple `@alice prépare un voyage à Lyon, et demande à @bob pour les trains`. La plupart des agents ne mentionnent un autre agent que si on le leur demande, ou si leurs instructions disent qui est dans l'équipe. | |
| 58 | +3. Pour arrêter une chaîne, cliquez sur **■** : l'agent qui répond s'arrête, et les autres ne répondent pas. | |
| 59 | + | |
| 60 | +Un agent ne s'appelle pas lui-même, un agent qui répond de toute façon à votre message n'est pas sollicité deux fois, une mention dans du code ne compte pas, et la réponse à une `/commande` n'appelle personne. Un message passe d'agent en agent **3 fois au plus** ; ensuite le channel indique que la chaîne s'arrête, et vous pouvez mentionner vous-même l'agent suivant. Changez la limite avec `limits.maxAgentHandoffs` dans la [configuration](../reference/configuration.md#limits) (`0` désactive). Dans une conversation directe, les mentions restent du simple texte. | |
| 61 | + | |
| 50 | 62 | ## Variantes |
| 51 | 63 | |
| 52 | 64 | - **Replier les listes du panneau de gauche** : cliquez sur le titre **AGENTS** ou **CHANNELS** pour replier la liste, à nouveau pour la déplier. Repliée, le titre indique toujours combien il y a d'agents ou de channels et, en bleu, les réponses pas encore lues. Sidekicks s'en souvient au lancement suivant. ⌘N déplie les channels pour en créer un ; **Ajouter un agent** reste dans la palette de commandes (⌘K) et sur ⇧⌘N. |
| @@ -44,9 +44,21 @@ Pendant qu'un agent répond, l'historique ne peut pas être vidé : arrêtez-le | |||
| 44 | | --- | --- | | 44 | | --- | --- | |
| 45 | | qu'un agent précis réponde | `@nom votre message` (la liste après `@` se filtre pendant la frappe ; Tab ou Entrée choisit) | | 45 | | qu'un agent précis réponde | `@nom votre message` (la liste après `@` se filtre pendant la frappe ; Tab ou Entrée choisit) | |
| 46 | | que plusieurs agents répondent à tour de rôle | `@alice @bob comparez vos réponses` | | 46 | | que plusieurs agents répondent à tour de rôle | `@alice @bob comparez vos réponses` | |
| 47 | +| que chaque agent fasse sa part | `@alice écris une histoire sur Picard, puis @bob résume-la` : chaque agent ne reçoit que les mots qui suivent son nom | | ||
| 48 | +| qu'un agent en fasse intervenir un autre | demandez-le-lui : `@alice …, et demande à @bob` ([plus bas](#laisser-les-agents-sappeler-entre-eux)) | | ||
| 47 | | continuer avec l'agent à qui vous parliez | votre message, sans mention | | 49 | | continuer avec l'agent à qui vous parliez | votre message, sans mention | |
| 48 | | une commande d'un agent | `/` puis choisissez-la dans la liste ; avec plusieurs agents, `/agent:commande` | | 50 | | une commande d'un agent | `/` puis choisissez-la dans la liste ; avec plusieurs agents, `/agent:commande` | |
| 49 | 51 | ||
| 52 | +## Laisser les agents s'appeler entre eux | ||
| 53 | + | ||
| 54 | +Dans un channel, un agent peut passer la parole à un autre membre en le mentionnant dans sa réponse : quand Alice répond « @bob connaît mieux les trains », Bob répond juste après, en sachant qu'Alice s'adresse à lui (il lit aussi votre message et la réponse d'Alice). | ||
| 55 | + | ||
| 56 | +1. Mettez les agents dans le même channel (seuls les **membres** peuvent être appelés ainsi : un agent n'en fait jamais entrer un nouveau). | ||
| 57 | +2. Demandez à l'un d'eux, par exemple `@alice prépare un voyage à Lyon, et demande à @bob pour les trains`. La plupart des agents ne mentionnent un autre agent que si on le leur demande, ou si leurs instructions disent qui est dans l'équipe. | ||
| 58 | +3. Pour arrêter une chaîne, cliquez sur **■** : l'agent qui répond s'arrête, et les autres ne répondent pas. | ||
| 59 | + | ||
| 60 | +Un agent ne s'appelle pas lui-même, un agent qui répond de toute façon à votre message n'est pas sollicité deux fois, une mention dans du code ne compte pas, et la réponse à une `/commande` n'appelle personne. Un message passe d'agent en agent **3 fois au plus** ; ensuite le channel indique que la chaîne s'arrête, et vous pouvez mentionner vous-même l'agent suivant. Changez la limite avec `limits.maxAgentHandoffs` dans la [configuration](../reference/configuration.md#limits) (`0` désactive). Dans une conversation directe, les mentions restent du simple texte. | ||
| 61 | + | ||
| 50 | ## Variantes | 62 | ## Variantes |
| 51 | 63 | ||
| 52 | - **Replier les listes du panneau de gauche** : cliquez sur le titre **AGENTS** ou **CHANNELS** pour replier la liste, à nouveau pour la déplier. Repliée, le titre indique toujours combien il y a d'agents ou de channels et, en bleu, les réponses pas encore lues. Sidekicks s'en souvient au lancement suivant. ⌘N déplie les channels pour en créer un ; **Ajouter un agent** reste dans la palette de commandes (⌘K) et sur ⇧⌘N. | 64 | - **Replier les listes du panneau de gauche** : cliquez sur le titre **AGENTS** ou **CHANNELS** pour replier la liste, à nouveau pour la déplier. Repliée, le titre indique toujours combien il y a d'agents ou de channels et, en bleu, les réponses pas encore lues. Sidekicks s'en souvient au lancement suivant. ⌘N déplie les channels pour en créer un ; **Ajouter un agent** reste dans la palette de commandes (⌘K) et sur ⇧⌘N. |
modified
docs/fr/how-to/installer-sidekicks.md +4 -4 | @@ -10,10 +10,9 @@ Sidekicks demande un Mac Apple Silicon (M1 ou plus récent) et macOS 13 (Ventura | ||
| 10 | 10 | |
| 11 | 11 | 1. Téléchargez `Sidekicks-<version>-macos-arm64.dmg` et ouvrez-le. |
| 12 | 12 | 2. Glissez **sidekicks** dans **Applications**. |
| 13 | -3. Ouvrez-le une fois depuis **Applications**. L'application n'est pas signée par un compte développeur Apple : macOS la refuse la première fois (« Apple n'a pas pu vérifier… »). | |
| 14 | -4. Ouvrez **Réglages Système → Confidentialité et sécurité**, descendez jusqu'au message sur Sidekicks, cliquez sur **Ouvrir quand même**, puis confirmez. | |
| 13 | +3. Ouvrez-le depuis **Applications**. L'application est signée avec un certificat Developer ID et notarisée par Apple : macOS demande une fois s'il faut ouvrir une application téléchargée sur Internet ; cliquez sur **Ouvrir**. | |
| 15 | 14 | |
| 16 | -Ensuite, Sidekicks s'ouvre normalement. | |
| 15 | +Pour mettre à jour, glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement : votre configuration et votre historique sont gardés. | |
| 17 | 16 | |
| 18 | 17 | ## Windows (x86-64 et Arm) |
| 19 | 18 | |
| @@ -38,7 +37,8 @@ Sidekicks a besoin de GTK 4 et de WebKitGTK 6 (Ubuntu 24.04 ou plus récent, Deb | ||
| 38 | 37 | ## Variantes |
| 39 | 38 | |
| 40 | 39 | - **Vérifier un téléchargement** : `shasum -a 256 <fichier>` (macOS) ou `Get-FileHash <fichier>` dans PowerShell (Windows), à comparer avec `SHA256SUMS`. |
| 41 | -- **macOS, depuis un terminal** : `xattr -dr com.apple.quarantine /Applications/sidekicks.app` lève la quarantaine, à la place de l'étape 4. | |
| 40 | +- **macOS, vérifier la signature** : `spctl -a -vvv /Applications/sidekicks.app` répond `accepted` et `source=Notarized Developer ID`. | |
| 41 | +- **macOS, un ancien paquet (0.1.0 ou 1.0.0)** : ils ne sont pas signés, macOS les refuse donc la première fois (« Apple n'a pas pu vérifier… »). Ouvrez **Réglages Système → Confidentialité et sécurité**, descendez jusqu'au message sur Sidekicks, cliquez sur **Ouvrir quand même** et confirmez ; ou, depuis un terminal, `xattr -dr com.apple.quarantine /Applications/sidekicks.app`. Le paquet `1.0.0-macos` et les suivants sont signés. | |
| 42 | 42 | - **Le construire soi-même** : `make package-macos` ou `make package-windows` (voir [Publier une release](publier-une-release.md)). |
| 43 | 43 | |
| 44 | 44 | ## Voir aussi |
| @@ -10,10 +10,9 @@ Sidekicks demande un Mac Apple Silicon (M1 ou plus récent) et macOS 13 (Ventura | |||
| 10 | 10 | ||
| 11 | 1. Téléchargez `Sidekicks-<version>-macos-arm64.dmg` et ouvrez-le. | 11 | 1. Téléchargez `Sidekicks-<version>-macos-arm64.dmg` et ouvrez-le. |
| 12 | 2. Glissez **sidekicks** dans **Applications**. | 12 | 2. Glissez **sidekicks** dans **Applications**. |
| 13 | -3. Ouvrez-le une fois depuis **Applications**. L'application n'est pas signée par un compte développeur Apple : macOS la refuse la première fois (« Apple n'a pas pu vérifier… »). | 13 | +3. Ouvrez-le depuis **Applications**. L'application est signée avec un certificat Developer ID et notarisée par Apple : macOS demande une fois s'il faut ouvrir une application téléchargée sur Internet ; cliquez sur **Ouvrir**. |
| 14 | -4. Ouvrez **Réglages Système → Confidentialité et sécurité**, descendez jusqu'au message sur Sidekicks, cliquez sur **Ouvrir quand même**, puis confirmez. | ||
| 15 | 14 | ||
| 16 | -Ensuite, Sidekicks s'ouvre normalement. | 15 | +Pour mettre à jour, glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement : votre configuration et votre historique sont gardés. |
| 17 | 16 | ||
| 18 | ## Windows (x86-64 et Arm) | 17 | ## Windows (x86-64 et Arm) |
| 19 | 18 | ||
| @@ -38,7 +37,8 @@ Sidekicks a besoin de GTK 4 et de WebKitGTK 6 (Ubuntu 24.04 ou plus récent, Deb | |||
| 38 | ## Variantes | 37 | ## Variantes |
| 39 | 38 | ||
| 40 | - **Vérifier un téléchargement** : `shasum -a 256 <fichier>` (macOS) ou `Get-FileHash <fichier>` dans PowerShell (Windows), à comparer avec `SHA256SUMS`. | 39 | - **Vérifier un téléchargement** : `shasum -a 256 <fichier>` (macOS) ou `Get-FileHash <fichier>` dans PowerShell (Windows), à comparer avec `SHA256SUMS`. |
| 41 | -- **macOS, depuis un terminal** : `xattr -dr com.apple.quarantine /Applications/sidekicks.app` lève la quarantaine, à la place de l'étape 4. | 40 | +- **macOS, vérifier la signature** : `spctl -a -vvv /Applications/sidekicks.app` répond `accepted` et `source=Notarized Developer ID`. |
| 41 | +- **macOS, un ancien paquet (0.1.0 ou 1.0.0)** : ils ne sont pas signés, macOS les refuse donc la première fois (« Apple n'a pas pu vérifier… »). Ouvrez **Réglages Système → Confidentialité et sécurité**, descendez jusqu'au message sur Sidekicks, cliquez sur **Ouvrir quand même** et confirmez ; ou, depuis un terminal, `xattr -dr com.apple.quarantine /Applications/sidekicks.app`. Le paquet `1.0.0-macos` et les suivants sont signés. | ||
| 42 | - **Le construire soi-même** : `make package-macos` ou `make package-windows` (voir [Publier une release](publier-une-release.md)). | 42 | - **Le construire soi-même** : `make package-macos` ou `make package-windows` (voir [Publier une release](publier-une-release.md)). |
| 43 | 43 | ||
| 44 | ## Voir aussi | 44 | ## Voir aussi |
modified
docs/fr/how-to/lancer-un-agent-dans-une-sandbox.md +3 -2 | @@ -41,7 +41,7 @@ Ce guide montre comment déclarer un agent qui tourne dans une sandbox Docker (` | ||
| 41 | 41 | |
| 42 | 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. |
| 43 | 43 | |
| 44 | -1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. | |
| 44 | +1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp --config <fichier>` pour un kit mini-me (`agent: mini-me-kit`), `docker-agent` avec `serve acp <fichier>` pour `agent: docker-agent` — `<fichier>` est l'`agent.yaml` (ou `agent.yml`) du `workspace` de la sandbox, ou le fichier de configuration que vous déposez —, `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). | |
| 45 | 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : |
| 46 | 46 | |
| 47 | 47 | ```yaml |
| @@ -64,7 +64,8 @@ Les boutons **■ Arrêter la sandbox** et **🗑 Supprimer la sandbox** apparai | ||
| 64 | 64 | - **Le nom de la sandbox n'est pas le `name:` du sbxenv.yaml** : après `create`, Sidekicks ne trouve toujours pas de sandbox et le dit. Donnez la même valeur à `sandbox` et à `name:`. |
| 65 | 65 | - **Sidekicks lancé depuis le Finder** : il peut ne pas trouver `sbx` dans son `PATH` réduit. Écrivez son chemin complet (`command: /usr/local/bin/sbx`, voir `which sbx`) ou ajoutez `env: {PATH: "…"}` à l'agent. |
| 66 | 66 | - **Le serveur de modèles tourne sur cet ordinateur** : depuis la sandbox, atteignez-le par `host.docker.internal`, comme depuis un conteneur. |
| 67 | -- **Un autre programme que mm** (docker-agent, par exemple) : seuls les `args` changent, par exemple `[exec, -i, ma-sandbox, docker-agent, serve, acp, /chemin/vers/agent.yaml]`. | |
| 67 | +- **Docker Agent s'arrête avec `Error: accepts 1 arg(s), received 0`** : il a été démarré avec `serve acp` mais sans fichier d'agent. Ajoutez le chemin du fichier après `serve acp` dans ses `args` (l'assistant refuse désormais de l'ajouter sans). | |
| 68 | +- **Un autre programme que mm** (docker-agent, par exemple) : seuls les `args` changent, par exemple `[exec, -i, ma-sandbox, docker-agent, serve, acp, /chemin/vers/agent.yaml]`. Pour Claude, Codex ou Gemini, voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md), [un agent Codex](ajouter-un-agent-codex-dans-une-sandbox.md) ou [un agent Gemini](ajouter-un-agent-gemini-dans-une-sandbox.md). | |
| 68 | 69 | - **Vérifier sans Sidekicks** : `sbx exec -it <sandbox> bash` ouvre le même genre de shell que l'onglet Terminal. |
| 69 | 70 | |
| 70 | 71 | ## Voir aussi |
| @@ -41,7 +41,7 @@ Ce guide montre comment déclarer un agent qui tourne dans une sandbox Docker (` | |||
| 41 | 41 | ||
| 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. | 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. |
| 43 | 43 | ||
| 44 | -1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. | 44 | +1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp --config <fichier>` pour un kit mini-me (`agent: mini-me-kit`), `docker-agent` avec `serve acp <fichier>` pour `agent: docker-agent` — `<fichier>` est l'`agent.yaml` (ou `agent.yml`) du `workspace` de la sandbox, ou le fichier de configuration que vous déposez —, `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). |
| 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : | 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : |
| 46 | 46 | ||
| 47 | ```yaml | 47 | ```yaml |
| @@ -64,7 +64,8 @@ Les boutons **■ Arrêter la sandbox** et **🗑 Supprimer la sandbox** apparai | |||
| 64 | - **Le nom de la sandbox n'est pas le `name:` du sbxenv.yaml** : après `create`, Sidekicks ne trouve toujours pas de sandbox et le dit. Donnez la même valeur à `sandbox` et à `name:`. | 64 | - **Le nom de la sandbox n'est pas le `name:` du sbxenv.yaml** : après `create`, Sidekicks ne trouve toujours pas de sandbox et le dit. Donnez la même valeur à `sandbox` et à `name:`. |
| 65 | - **Sidekicks lancé depuis le Finder** : il peut ne pas trouver `sbx` dans son `PATH` réduit. Écrivez son chemin complet (`command: /usr/local/bin/sbx`, voir `which sbx`) ou ajoutez `env: {PATH: "…"}` à l'agent. | 65 | - **Sidekicks lancé depuis le Finder** : il peut ne pas trouver `sbx` dans son `PATH` réduit. Écrivez son chemin complet (`command: /usr/local/bin/sbx`, voir `which sbx`) ou ajoutez `env: {PATH: "…"}` à l'agent. |
| 66 | - **Le serveur de modèles tourne sur cet ordinateur** : depuis la sandbox, atteignez-le par `host.docker.internal`, comme depuis un conteneur. | 66 | - **Le serveur de modèles tourne sur cet ordinateur** : depuis la sandbox, atteignez-le par `host.docker.internal`, comme depuis un conteneur. |
| 67 | -- **Un autre programme que mm** (docker-agent, par exemple) : seuls les `args` changent, par exemple `[exec, -i, ma-sandbox, docker-agent, serve, acp, /chemin/vers/agent.yaml]`. | 67 | +- **Docker Agent s'arrête avec `Error: accepts 1 arg(s), received 0`** : il a été démarré avec `serve acp` mais sans fichier d'agent. Ajoutez le chemin du fichier après `serve acp` dans ses `args` (l'assistant refuse désormais de l'ajouter sans). |
| 68 | +- **Un autre programme que mm** (docker-agent, par exemple) : seuls les `args` changent, par exemple `[exec, -i, ma-sandbox, docker-agent, serve, acp, /chemin/vers/agent.yaml]`. Pour Claude, Codex ou Gemini, voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md), [un agent Codex](ajouter-un-agent-codex-dans-une-sandbox.md) ou [un agent Gemini](ajouter-un-agent-gemini-dans-une-sandbox.md). | ||
| 68 | - **Vérifier sans Sidekicks** : `sbx exec -it <sandbox> bash` ouvre le même genre de shell que l'onglet Terminal. | 69 | - **Vérifier sans Sidekicks** : `sbx exec -it <sandbox> bash` ouvre le même genre de shell que l'onglet Terminal. |
| 69 | 70 | ||
| 70 | ## Voir aussi | 71 | ## Voir aussi |
modified
docs/fr/how-to/surveiller-la-pression-memoire.md +7 -1 | @@ -9,6 +9,8 @@ Les modèles locaux et les agents prennent beaucoup de mémoire. Quand l'ordinat | ||
| 9 | 9 | |
| 10 | 10 | Survolez le niveau pour un rappel de ce qu'il faut faire. La ligne est mise à jour toutes les 5 secondes tant que le panneau est ouvert. |
| 11 | 11 | 3. Quand le niveau est **élevée** ou **critique**, libérez de la mémoire : |
| 12 | + - déchargez le modèle de l'agent dont le journal est affiché : **⏏ Décharger le modèle**, à côté du nom de l'agent dans le panneau. L'agent continue de tourner ; son modèle est rechargé à son prochain message. Ce que l'agent répond est écrit dans son journal (`unload: …`). Le bouton n'est là que pour un agent qui propose la commande `/unload` (c'est le cas de mm), et ne sert que quand l'agent tourne et ne répond pas ; | |
| 13 | + - ou déchargez tous les modèles d'un coup : **⏏ Tout décharger**. Chaque agent en marche qui le sait faire est sollicité ; une ligne sous la barre nomme les agents déchargés et ceux laissés de côté (en train de répondre, ou sans `/unload`). Les agents arrêtés ne sont pas démarrés pour ça ; | |
| 12 | 14 | - arrêtez un agent dont vous n'avez pas besoin : **■** à côté de lui dans le panneau **Agents** ; |
| 13 | 15 | - fermez les applications dont vous ne vous servez pas. |
| 14 | 16 | |
| @@ -17,8 +19,12 @@ Les modèles locaux et les agents prennent beaucoup de mémoire. Quand l'ordinat | ||
| 17 | 19 | - **Sous macOS**, le niveau est celui que donne le système, le même que le graphique *Pression de la mémoire* de Moniteur d'activité. La mémoire utilisée est comptée comme dans Moniteur d'activité : mémoire des apps, mémoire résidente et mémoire compressée. La mémoire « en cache » de macOS n'est pas comptée : elle est rendue dès qu'une application en a besoin. |
| 18 | 20 | - **Sous Windows** (et Linux), le niveau est déduit de la mémoire encore disponible : **élevée** sous 20 %, **critique** sous 10 %. |
| 19 | 21 | - Si la mémoire ne peut pas être mesurée, la ligne n'est pas affichée. |
| 22 | +- Décharger un modèle libère sa mémoire en quelques secondes, quand le serveur de modèles l'applique. Taper `/unload` dans une conversation avec l'agent a le même effet, mais laisse la commande et sa réponse dans la conversation. | |
| 23 | + | |
| 24 | +**⏏** est aussi sur la ligne de l'agent dans le panneau **Agents** (au survol) et dans l'en-tête de la vue de l'agent. | |
| 20 | 25 | |
| 21 | 26 | ## Voir aussi |
| 22 | 27 | |
| 23 | -- [Référence : services appelés par l'interface](../reference/agents-et-evenements.md#services-appelés-par-linterface) (`SystemService.Memory`) | |
| 28 | +- [Référence : services appelés par l'interface](../reference/agents-et-evenements.md#services-appelés-par-linterface) (`SystemService.Memory`, `AgentService.Unload`, `AgentService.UnloadAll`) | |
| 29 | +- [Explication : mémoire et modèles locaux](../explanation/memoire-et-modeles-locaux.md#décharger-un-modèle-à-la-demande) | |
| 24 | 30 | - [Travailler avec les fichiers et le terminal d'un agent](fichiers-et-terminal-d-un-agent.md) |
| @@ -9,6 +9,8 @@ Les modèles locaux et les agents prennent beaucoup de mémoire. Quand l'ordinat | |||
| 9 | 9 | ||
| 10 | Survolez le niveau pour un rappel de ce qu'il faut faire. La ligne est mise à jour toutes les 5 secondes tant que le panneau est ouvert. | 10 | Survolez le niveau pour un rappel de ce qu'il faut faire. La ligne est mise à jour toutes les 5 secondes tant que le panneau est ouvert. |
| 11 | 3. Quand le niveau est **élevée** ou **critique**, libérez de la mémoire : | 11 | 3. Quand le niveau est **élevée** ou **critique**, libérez de la mémoire : |
| 12 | + - déchargez le modèle de l'agent dont le journal est affiché : **⏏ Décharger le modèle**, à côté du nom de l'agent dans le panneau. L'agent continue de tourner ; son modèle est rechargé à son prochain message. Ce que l'agent répond est écrit dans son journal (`unload: …`). Le bouton n'est là que pour un agent qui propose la commande `/unload` (c'est le cas de mm), et ne sert que quand l'agent tourne et ne répond pas ; | ||
| 13 | + - ou déchargez tous les modèles d'un coup : **⏏ Tout décharger**. Chaque agent en marche qui le sait faire est sollicité ; une ligne sous la barre nomme les agents déchargés et ceux laissés de côté (en train de répondre, ou sans `/unload`). Les agents arrêtés ne sont pas démarrés pour ça ; | ||
| 12 | - arrêtez un agent dont vous n'avez pas besoin : **■** à côté de lui dans le panneau **Agents** ; | 14 | - arrêtez un agent dont vous n'avez pas besoin : **■** à côté de lui dans le panneau **Agents** ; |
| 13 | - fermez les applications dont vous ne vous servez pas. | 15 | - fermez les applications dont vous ne vous servez pas. |
| 14 | 16 | ||
| @@ -17,8 +19,12 @@ Les modèles locaux et les agents prennent beaucoup de mémoire. Quand l'ordinat | |||
| 17 | - **Sous macOS**, le niveau est celui que donne le système, le même que le graphique *Pression de la mémoire* de Moniteur d'activité. La mémoire utilisée est comptée comme dans Moniteur d'activité : mémoire des apps, mémoire résidente et mémoire compressée. La mémoire « en cache » de macOS n'est pas comptée : elle est rendue dès qu'une application en a besoin. | 19 | - **Sous macOS**, le niveau est celui que donne le système, le même que le graphique *Pression de la mémoire* de Moniteur d'activité. La mémoire utilisée est comptée comme dans Moniteur d'activité : mémoire des apps, mémoire résidente et mémoire compressée. La mémoire « en cache » de macOS n'est pas comptée : elle est rendue dès qu'une application en a besoin. |
| 18 | - **Sous Windows** (et Linux), le niveau est déduit de la mémoire encore disponible : **élevée** sous 20 %, **critique** sous 10 %. | 20 | - **Sous Windows** (et Linux), le niveau est déduit de la mémoire encore disponible : **élevée** sous 20 %, **critique** sous 10 %. |
| 19 | - Si la mémoire ne peut pas être mesurée, la ligne n'est pas affichée. | 21 | - Si la mémoire ne peut pas être mesurée, la ligne n'est pas affichée. |
| 22 | +- Décharger un modèle libère sa mémoire en quelques secondes, quand le serveur de modèles l'applique. Taper `/unload` dans une conversation avec l'agent a le même effet, mais laisse la commande et sa réponse dans la conversation. | ||
| 23 | + | ||
| 24 | +**⏏** est aussi sur la ligne de l'agent dans le panneau **Agents** (au survol) et dans l'en-tête de la vue de l'agent. | ||
| 20 | 25 | ||
| 21 | ## Voir aussi | 26 | ## Voir aussi |
| 22 | 27 | ||
| 23 | -- [Référence : services appelés par l'interface](../reference/agents-et-evenements.md#services-appelés-par-linterface) (`SystemService.Memory`) | 28 | +- [Référence : services appelés par l'interface](../reference/agents-et-evenements.md#services-appelés-par-linterface) (`SystemService.Memory`, `AgentService.Unload`, `AgentService.UnloadAll`) |
| 29 | +- [Explication : mémoire et modèles locaux](../explanation/memoire-et-modeles-locaux.md#décharger-un-modèle-à-la-demande) | ||
| 24 | - [Travailler avec les fichiers et le terminal d'un agent](fichiers-et-terminal-d-un-agent.md) | 30 | - [Travailler avec les fichiers et le terminal d'un agent](fichiers-et-terminal-d-un-agent.md) |
modified
docs/fr/reference/agents-et-evenements.md +11 -3 | @@ -49,6 +49,8 @@ Les noms et types Go sont dans `internal/events` ; les constantes et types TypeS | ||
| 49 | 49 | | `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, dans l'ordre de la configuration. | |
| 50 | 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | |
| 51 | 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | |
| 52 | +| | `Unload(name)` | Demande à un agent en marche et inactif, qui a annoncé la commande `unload`, de décharger son modèle (ticket #51) : `/unload` est envoyé dans une session à part, qu'aucune conversation ne montre ; la réponse va dans le journal de l'agent, en lignes `unload: …`. Erreurs : agent inconnu, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | |
| 53 | +| | `UnloadAll()` | `Unload` pour chaque agent en marche : renvoie `{unloaded[], skipped[]}` (noms d'agents) ; les agents arrêtés sont laissés de côté. | | |
| 52 | 54 | | | `Logs(name)` | Les 200 dernières lignes stderr de l'agent. | |
| 53 | 55 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | |
| 54 | 56 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` et `total` en octets ; tout vide (`total` à 0) là où la mémoire ne peut pas être mesurée. macOS : le niveau de `kern.memorystatus_vm_pressure_level`, utilisée = mémoire des apps + résidente + compressée (`vm_stat`), comme dans Moniteur d'activité. Linux et Windows : déduit de la mémoire disponible, `warning` sous 20 %, `critical` sous 10 %. Le panneau Log l'appelle toutes les 5 secondes tant qu'il est ouvert (issue #61). | |
| @@ -71,10 +73,11 @@ Un channel contient une conversation entre l'utilisateur et un ou plusieurs agen | ||
| 71 | 73 | | Le message | Répondu par | |
| 72 | 74 | | --- | --- | |
| 73 | 75 | | `/agent:commande arguments` (`agent` est un agent de la configuration) | cet agent, qui reçoit `/commande arguments` | |
| 74 | -| contient des mentions `@nom` d'agents de la configuration | les agents mentionnés, l'un après l'autre, dans l'ordre des mentions ; un agent mentionné qui n'est pas membre rejoint d'abord le channel | | |
| 76 | +| contient des mentions `@nom` d'agents de la configuration | les agents mentionnés, l'un après l'autre, dans l'ordre des mentions ; un agent mentionné qui n'est pas membre rejoint d'abord le channel. Avec plusieurs agents, chacun ne reçoit que sa part au lieu du texte : les mots après sa mention, jusqu'à celle de l'agent suivant qui répond, sans mot de liaison (then, and, puis, et…) ; le texte entier quand la part fait moins de deux mots | | |
| 75 | 77 | | sans mention | le dernier agent qui a répondu dans le channel ; avec un seul membre, ce membre | |
| 76 | 78 | | sans mention, personne n'a encore répondu, plusieurs membres | personne : message système `no-recipient` | |
| 77 | 79 | | tout message d'une conversation directe | son agent ; les mentions y sont du simple texte | |
| 80 | +| la réponse d'un agent, dans un channel, mentionne d'autres **membres** avec `@nom` (ticket #26) | ces membres répondent ensuite, dans l'ordre, chacun informé de qui s'adresse à lui ; ni l'agent lui-même, ni un agent qui répond de toute façon au message, ni un non-membre, ni une mention dans du code, ni la réponse à une commande. Au plus `limits.maxAgentHandoffs` passages de parole par message de l'utilisateur (3 par défaut ; `0` désactive), puis le message système `handoff-limit` ; **■** arrête toute la chaîne | | |
| 78 | 81 | |
| 79 | 82 | Un message qui commence par `/` (éventuellement après des mentions) est une commande : il est envoyé seul. Tout autre message est envoyé avec les messages du channel que l'agent n'a pas encore vus (au plus les 20 derniers, chacun coupé à 1500 caractères). Un agent répond à un seul channel à la fois ; un channel qui l'attend indique à qui c'est le tour. |
| 80 | 83 | |
| @@ -105,7 +108,7 @@ Un fichier est lu quand vient le tour de l'agent (5 Mo au plus) ; un fichier ill | ||
| 105 | 108 | | `queued` | un message de l'utilisateur qui attend la fin des réponses en cours | |
| 106 | 109 | | `stopReason` | comment un message d'agent s'est terminé : `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | |
| 107 | 110 | | `error` | pourquoi un message d'agent s'est terminé sans raison d'arrêt (l'explication de l'agent), ou `cancelled` pour un message en attente abandonné par Stop | |
| 108 | -| `code` | messages système : `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (impossible de le démarrer ou de le joindre ; `error` dit pourquoi), `attachment-unavailable` (un fichier joint n'a pas été envoyé à `agent` ; `error` le nomme et dit pourquoi) | | |
| 111 | +| `code` | messages système : `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (impossible de le démarrer ou de le joindre ; `error` dit pourquoi), `attachment-unavailable` (un fichier joint n'a pas été envoyé à `agent` ; `error` le nomme et dit pourquoi), `handoff-limit` (`agent` a mentionné un membre, mais le message est déjà passé `limits.maxAgentHandoffs` fois d'agent en agent) | | |
| 109 | 112 | | `attachments` | messages de l'utilisateur : les fichiers joints avec `$chemin`, sous la forme `{agent, path}` (l'agent dont le dossier le contient). Seule la référence est gardée, jamais le contenu. | |
| 110 | 113 | |
| 111 | 114 | Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (JSON compact), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). |
| @@ -178,12 +181,17 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | ||
| 178 | 181 | |
| 179 | 182 | | Méthode | Effet | |
| 180 | 183 | | --- | --- | |
| 181 | -| `Info(agent)` | `{location, problem}` : où est le dossier (`local · /chemin`, `container nom · /chemin`), ou pourquoi il ne peut pas être affiché. | | |
| 184 | +| `Info(agent)` | `{location, problem, revealable}` : où est le dossier (`local · /chemin`, `container nom · /chemin`), ou pourquoi il ne peut pas être affiché ; `revealable` si le dossier est sur cet ordinateur (issue #74). | | |
| 182 | 185 | | `List(agent, dir)` | Les entrées de `dir` (`""` est le dossier), dossiers d'abord, puis par nom. | |
| 183 | 186 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | |
| 184 | 187 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | |
| 185 | 188 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | |
| 186 | 189 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | |
| 190 | +| `RemoveAll(agent, paths)` | Supprime plusieurs fichiers et dossiers (un chemin à l'intérieur d'un autre de la liste est ignoré) ; rien n'est supprimé si l'un d'eux est protégé ou contient un fichier protégé. Issue #70. | | |
| 191 | +| `Rename(agent, from, to)` | Renomme ou déplace un fichier ou un dossier vers le chemin `to` (ses dossiers sont créés) ; renvoie le nouveau chemin. Refusé si `to` existe, sort du dossier, est dans `from`, ou si `from` ou `to` est protégé. Issue #70. | | |
| 192 | +| `Move(agent, paths, dir)` | Déplace des fichiers et dossiers dans `dir` (`""` est la racine), sans changer leur nom ; renvoie leurs nouveaux chemins. S'arrête au premier qui ne peut pas être déplacé. Issue #70. | | |
| 193 | +| `Duplicate(agent, paths)` | Copie des fichiers et dossiers à côté d'eux-mêmes, sous un nom libre avec `-copy` avant l'extension ; renvoie les chemins des copies. Une copie dont le chemin est protégé est refusée. Issue #70. | | |
| 194 | +| `CreateFolder(agent, dir, name)` | Crée un dossier vide ; refusé si le nom existe ou contient `/`. Issue #70. | | |
| 187 | 195 | | `Attach(agent, hostPath)` | Joint un fichier de cet ordinateur à un message : renvoie son chemin dans le dossier de l'agent, à écrire après `$`. Un fichier déjà dans le dossier est utilisé sur place ; tout autre est copié dans `attachments/` (nom libre, espaces remplacés par `-`, 5 Mo au plus). | |
| 188 | 196 | | `ChooseAttachment()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel ; renvoie le chemin choisi, ou `""`. | |
| 189 | 197 | | `Image(agent, path)` | Une image du dossier (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 Mo au plus) sous forme d'URL `data:`, pour l'aperçu. Tout autre fichier est une erreur. | |
| @@ -49,6 +49,8 @@ Les noms et types Go sont dans `internal/events` ; les constantes et types TypeS | |||
| 49 | | `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, dans l'ordre de la configuration. | | 49 | | `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, dans l'ordre de la configuration. | |
| 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | | 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | |
| 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | | 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | |
| 52 | +| | `Unload(name)` | Demande à un agent en marche et inactif, qui a annoncé la commande `unload`, de décharger son modèle (ticket #51) : `/unload` est envoyé dans une session à part, qu'aucune conversation ne montre ; la réponse va dans le journal de l'agent, en lignes `unload: …`. Erreurs : agent inconnu, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | ||
| 53 | +| | `UnloadAll()` | `Unload` pour chaque agent en marche : renvoie `{unloaded[], skipped[]}` (noms d'agents) ; les agents arrêtés sont laissés de côté. | | ||
| 52 | | | `Logs(name)` | Les 200 dernières lignes stderr de l'agent. | | 54 | | | `Logs(name)` | Les 200 dernières lignes stderr de l'agent. | |
| 53 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | | 55 | | `ConfigService` | `Current()` | `path, source, created, valid, problems[], warnings[], theme, language, historyProblem`. | |
| 54 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` et `total` en octets ; tout vide (`total` à 0) là où la mémoire ne peut pas être mesurée. macOS : le niveau de `kern.memorystatus_vm_pressure_level`, utilisée = mémoire des apps + résidente + compressée (`vm_stat`), comme dans Moniteur d'activité. Linux et Windows : déduit de la mémoire disponible, `warning` sous 20 %, `critical` sous 10 %. Le panneau Log l'appelle toutes les 5 secondes tant qu'il est ouvert (issue #61). | | 56 | | `SystemService` | `Memory()` | `level` (`normal`, `warning`, `critical`), `used` et `total` en octets ; tout vide (`total` à 0) là où la mémoire ne peut pas être mesurée. macOS : le niveau de `kern.memorystatus_vm_pressure_level`, utilisée = mémoire des apps + résidente + compressée (`vm_stat`), comme dans Moniteur d'activité. Linux et Windows : déduit de la mémoire disponible, `warning` sous 20 %, `critical` sous 10 %. Le panneau Log l'appelle toutes les 5 secondes tant qu'il est ouvert (issue #61). | |
| @@ -71,10 +73,11 @@ Un channel contient une conversation entre l'utilisateur et un ou plusieurs agen | |||
| 71 | | Le message | Répondu par | | 73 | | Le message | Répondu par | |
| 72 | | --- | --- | | 74 | | --- | --- | |
| 73 | | `/agent:commande arguments` (`agent` est un agent de la configuration) | cet agent, qui reçoit `/commande arguments` | | 75 | | `/agent:commande arguments` (`agent` est un agent de la configuration) | cet agent, qui reçoit `/commande arguments` | |
| 74 | -| contient des mentions `@nom` d'agents de la configuration | les agents mentionnés, l'un après l'autre, dans l'ordre des mentions ; un agent mentionné qui n'est pas membre rejoint d'abord le channel | | 76 | +| contient des mentions `@nom` d'agents de la configuration | les agents mentionnés, l'un après l'autre, dans l'ordre des mentions ; un agent mentionné qui n'est pas membre rejoint d'abord le channel. Avec plusieurs agents, chacun ne reçoit que sa part au lieu du texte : les mots après sa mention, jusqu'à celle de l'agent suivant qui répond, sans mot de liaison (then, and, puis, et…) ; le texte entier quand la part fait moins de deux mots | |
| 75 | | sans mention | le dernier agent qui a répondu dans le channel ; avec un seul membre, ce membre | | 77 | | sans mention | le dernier agent qui a répondu dans le channel ; avec un seul membre, ce membre | |
| 76 | | sans mention, personne n'a encore répondu, plusieurs membres | personne : message système `no-recipient` | | 78 | | sans mention, personne n'a encore répondu, plusieurs membres | personne : message système `no-recipient` | |
| 77 | | tout message d'une conversation directe | son agent ; les mentions y sont du simple texte | | 79 | | tout message d'une conversation directe | son agent ; les mentions y sont du simple texte | |
| 80 | +| la réponse d'un agent, dans un channel, mentionne d'autres **membres** avec `@nom` (ticket #26) | ces membres répondent ensuite, dans l'ordre, chacun informé de qui s'adresse à lui ; ni l'agent lui-même, ni un agent qui répond de toute façon au message, ni un non-membre, ni une mention dans du code, ni la réponse à une commande. Au plus `limits.maxAgentHandoffs` passages de parole par message de l'utilisateur (3 par défaut ; `0` désactive), puis le message système `handoff-limit` ; **■** arrête toute la chaîne | | ||
| 78 | 81 | ||
| 79 | Un message qui commence par `/` (éventuellement après des mentions) est une commande : il est envoyé seul. Tout autre message est envoyé avec les messages du channel que l'agent n'a pas encore vus (au plus les 20 derniers, chacun coupé à 1500 caractères). Un agent répond à un seul channel à la fois ; un channel qui l'attend indique à qui c'est le tour. | 82 | Un message qui commence par `/` (éventuellement après des mentions) est une commande : il est envoyé seul. Tout autre message est envoyé avec les messages du channel que l'agent n'a pas encore vus (au plus les 20 derniers, chacun coupé à 1500 caractères). Un agent répond à un seul channel à la fois ; un channel qui l'attend indique à qui c'est le tour. |
| 80 | 83 | ||
| @@ -105,7 +108,7 @@ Un fichier est lu quand vient le tour de l'agent (5 Mo au plus) ; un fichier ill | |||
| 105 | | `queued` | un message de l'utilisateur qui attend la fin des réponses en cours | | 108 | | `queued` | un message de l'utilisateur qui attend la fin des réponses en cours | |
| 106 | | `stopReason` | comment un message d'agent s'est terminé : `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | | 109 | | `stopReason` | comment un message d'agent s'est terminé : `end_turn`, `cancelled`, `max_tokens`, `max_turn_requests`, `refusal` | |
| 107 | | `error` | pourquoi un message d'agent s'est terminé sans raison d'arrêt (l'explication de l'agent), ou `cancelled` pour un message en attente abandonné par Stop | | 110 | | `error` | pourquoi un message d'agent s'est terminé sans raison d'arrêt (l'explication de l'agent), ou `cancelled` pour un message en attente abandonné par Stop | |
| 108 | -| `code` | messages système : `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (impossible de le démarrer ou de le joindre ; `error` dit pourquoi), `attachment-unavailable` (un fichier joint n'a pas été envoyé à `agent` ; `error` le nomme et dit pourquoi) | | 111 | +| `code` | messages système : `agent-joined`, `agent-left`, `no-recipient`, `agent-unavailable` (impossible de le démarrer ou de le joindre ; `error` dit pourquoi), `attachment-unavailable` (un fichier joint n'a pas été envoyé à `agent` ; `error` le nomme et dit pourquoi), `handoff-limit` (`agent` a mentionné un membre, mais le message est déjà passé `limits.maxAgentHandoffs` fois d'agent en agent) | |
| 109 | | `attachments` | messages de l'utilisateur : les fichiers joints avec `$chemin`, sous la forme `{agent, path}` (l'agent dont le dossier le contient). Seule la référence est gardée, jamais le contenu. | | 112 | | `attachments` | messages de l'utilisateur : les fichiers joints avec `$chemin`, sous la forme `{agent, path}` (l'agent dont le dossier le contient). Seule la référence est gardée, jamais le contenu. | |
| 110 | 113 | ||
| 111 | Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (JSON compact), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). | 114 | Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute, think, fetch, other`), `status` (`pending, in_progress, completed, failed`), `input` (JSON compact), `output`, `locations`, `diffs` (`path, oldText, newText, newFile`). |
| @@ -178,12 +181,17 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | |||
| 178 | 181 | ||
| 179 | | Méthode | Effet | | 182 | | Méthode | Effet | |
| 180 | | --- | --- | | 183 | | --- | --- | |
| 181 | -| `Info(agent)` | `{location, problem}` : où est le dossier (`local · /chemin`, `container nom · /chemin`), ou pourquoi il ne peut pas être affiché. | | 184 | +| `Info(agent)` | `{location, problem, revealable}` : où est le dossier (`local · /chemin`, `container nom · /chemin`), ou pourquoi il ne peut pas être affiché ; `revealable` si le dossier est sur cet ordinateur (issue #74). | |
| 182 | | `List(agent, dir)` | Les entrées de `dir` (`""` est le dossier), dossiers d'abord, puis par nom. | | 185 | | `List(agent, dir)` | Les entrées de `dir` (`""` est le dossier), dossiers d'abord, puis par nom. | |
| 183 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | | 186 | | `Read(agent, path)` | Un fichier texte de 1 Mo au plus ; un fichier binaire ou plus gros est une erreur. | |
| 184 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | | 187 | | `Save(agent, path, content, version)` | Écrit le fichier s'il a toujours `version` ; sinon `{conflict: true}` et rien n'est écrit. Une `version` vide écrase. Le fichier est écrit à côté puis déplacé à sa place. | |
| 185 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | | 188 | | `Create(agent, dir, name)` | Crée un fichier vide ; refusé si le nom existe ou contient `/`. | |
| 186 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | | 189 | | `Remove(agent, path)` | Supprime un fichier ou un dossier avec son contenu (voir le tableau ci-dessus). | |
| 190 | +| `RemoveAll(agent, paths)` | Supprime plusieurs fichiers et dossiers (un chemin à l'intérieur d'un autre de la liste est ignoré) ; rien n'est supprimé si l'un d'eux est protégé ou contient un fichier protégé. Issue #70. | | ||
| 191 | +| `Rename(agent, from, to)` | Renomme ou déplace un fichier ou un dossier vers le chemin `to` (ses dossiers sont créés) ; renvoie le nouveau chemin. Refusé si `to` existe, sort du dossier, est dans `from`, ou si `from` ou `to` est protégé. Issue #70. | | ||
| 192 | +| `Move(agent, paths, dir)` | Déplace des fichiers et dossiers dans `dir` (`""` est la racine), sans changer leur nom ; renvoie leurs nouveaux chemins. S'arrête au premier qui ne peut pas être déplacé. Issue #70. | | ||
| 193 | +| `Duplicate(agent, paths)` | Copie des fichiers et dossiers à côté d'eux-mêmes, sous un nom libre avec `-copy` avant l'extension ; renvoie les chemins des copies. Une copie dont le chemin est protégé est refusée. Issue #70. | | ||
| 194 | +| `CreateFolder(agent, dir, name)` | Crée un dossier vide ; refusé si le nom existe ou contient `/`. Issue #70. | | ||
| 187 | | `Attach(agent, hostPath)` | Joint un fichier de cet ordinateur à un message : renvoie son chemin dans le dossier de l'agent, à écrire après `$`. Un fichier déjà dans le dossier est utilisé sur place ; tout autre est copié dans `attachments/` (nom libre, espaces remplacés par `-`, 5 Mo au plus). | | 195 | | `Attach(agent, hostPath)` | Joint un fichier de cet ordinateur à un message : renvoie son chemin dans le dossier de l'agent, à écrire après `$`. Un fichier déjà dans le dossier est utilisé sur place ; tout autre est copié dans `attachments/` (nom libre, espaces remplacés par `-`, 5 Mo au plus). | |
| 188 | | `ChooseAttachment()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel ; renvoie le chemin choisi, ou `""`. | | 196 | | `ChooseAttachment()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel ; renvoie le chemin choisi, ou `""`. | |
| 189 | | `Image(agent, path)` | Une image du dossier (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 Mo au plus) sous forme d'URL `data:`, pour l'aperçu. Tout autre fichier est une erreur. | | 197 | | `Image(agent, path)` | Une image du dossier (`.png`, `.jpg`, `.gif`, `.webp`, `.svg`…, 5 Mo au plus) sous forme d'URL `data:`, pour l'aperçu. Tout autre fichier est une erreur. | |
modified
docs/fr/reference/configuration.md +1 -0 | @@ -56,6 +56,7 @@ Les clés inconnues sont des **erreurs**, à tous les niveaux : une faute de fra | ||
| 56 | 56 | | --- | --- | --- | --- | |
| 57 | 57 | | `maxRunningAgents` | entier ≥ 1 | `2` | Agents actifs en même temps. Chaque agent local garde un modèle en mémoire ; la valeur par défaut convient à un portable de 32 Go avec de petits modèles. | |
| 58 | 58 | | `stopIdleAgentsAfter` | durée Go (`30s`, `10m`, `1h30m`), ou `0` (nombre ou texte) | `10m` | Arrête un agent inutilisé depuis ce délai pour libérer sa mémoire. `0` ne l'arrête jamais. | |
| 59 | +| `maxAgentHandoffs` | entier, de 0 à 10 | `3` | Dans un channel, combien de fois un même message peut passer d'agent en agent : un agent dont la réponse mentionne un autre membre avec `@nom` lui passe la parole ([Gérer les channels](../how-to/gerer-les-channels.md#laisser-les-agents-sappeler-entre-eux)). La limite atteinte, la chaîne s'arrête et le dit. `0` désactive. | | |
| 59 | 60 | |
| 60 | 61 | ### Un agent |
| 61 | 62 | |
| @@ -56,6 +56,7 @@ Les clés inconnues sont des **erreurs**, à tous les niveaux : une faute de fra | |||
| 56 | | --- | --- | --- | --- | | 56 | | --- | --- | --- | --- | |
| 57 | | `maxRunningAgents` | entier ≥ 1 | `2` | Agents actifs en même temps. Chaque agent local garde un modèle en mémoire ; la valeur par défaut convient à un portable de 32 Go avec de petits modèles. | | 57 | | `maxRunningAgents` | entier ≥ 1 | `2` | Agents actifs en même temps. Chaque agent local garde un modèle en mémoire ; la valeur par défaut convient à un portable de 32 Go avec de petits modèles. | |
| 58 | | `stopIdleAgentsAfter` | durée Go (`30s`, `10m`, `1h30m`), ou `0` (nombre ou texte) | `10m` | Arrête un agent inutilisé depuis ce délai pour libérer sa mémoire. `0` ne l'arrête jamais. | | 58 | | `stopIdleAgentsAfter` | durée Go (`30s`, `10m`, `1h30m`), ou `0` (nombre ou texte) | `10m` | Arrête un agent inutilisé depuis ce délai pour libérer sa mémoire. `0` ne l'arrête jamais. | |
| 59 | +| `maxAgentHandoffs` | entier, de 0 à 10 | `3` | Dans un channel, combien de fois un même message peut passer d'agent en agent : un agent dont la réponse mentionne un autre membre avec `@nom` lui passe la parole ([Gérer les channels](../how-to/gerer-les-channels.md#laisser-les-agents-sappeler-entre-eux)). La limite atteinte, la chaîne s'arrête et le dit. `0` désactive. | | ||
| 59 | 60 | ||
| 60 | ### Un agent | 61 | ### Un agent |
| 61 | 62 | ||
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/agentservice.ts +23 -0 | @@ -15,6 +15,10 @@ import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wails | ||
| 15 | 15 | // @ts-ignore: Unused imports |
| 16 | 16 | import * as agents$0 from "../agents/models.js"; |
| 17 | 17 | |
| 18 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
| 19 | +// @ts-ignore: Unused imports | |
| 20 | +import * as $models from "./models.js"; | |
| 21 | + | |
| 18 | 22 | /** |
| 19 | 23 | * List returns every agent of the configuration with its state. |
| 20 | 24 | */ |
| @@ -67,3 +71,22 @@ export function Stop(name: string): $CancellablePromise<void> { | ||
| 67 | 71 | export function StopSandbox(name: string): $CancellablePromise<void> { |
| 68 | 72 | return $Call.ByID(923009821, name); |
| 69 | 73 | } |
| 74 | + | |
| 75 | +/** | |
| 76 | + * Unload has the agent unload its model from memory, without stopping it | |
| 77 | + * (issue #51), when it offers the /unload command. Nothing appears in the | |
| 78 | + * conversations: what the agent answers goes to its log. The model is loaded | |
| 79 | + * again with the next message. | |
| 80 | + */ | |
| 81 | +export function Unload(name: string): $CancellablePromise<void> { | |
| 82 | + return $Call.ByID(3375635717, name); | |
| 83 | +} | |
| 84 | + | |
| 85 | +/** | |
| 86 | + * UnloadAll has every running agent that offers /unload unload its model. | |
| 87 | + * Stopped agents are not counted; running agents that are answering or | |
| 88 | + * cannot unload are skipped. | |
| 89 | + */ | |
| 90 | +export function UnloadAll(): $CancellablePromise<$models.UnloadResult> { | |
| 91 | + return $Call.ByID(3399716516); | |
| 92 | +} | |
| @@ -15,6 +15,10 @@ import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wails | |||
| 15 | // @ts-ignore: Unused imports | 15 | // @ts-ignore: Unused imports |
| 16 | import * as agents$0 from "../agents/models.js"; | 16 | import * as agents$0 from "../agents/models.js"; |
| 17 | 17 | ||
| 18 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| 19 | +// @ts-ignore: Unused imports | ||
| 20 | +import * as $models from "./models.js"; | ||
| 21 | + | ||
| 18 | /** | 22 | /** |
| 19 | * List returns every agent of the configuration with its state. | 23 | * List returns every agent of the configuration with its state. |
| 20 | */ | 24 | */ |
| @@ -67,3 +71,22 @@ export function Stop(name: string): $CancellablePromise<void> { | |||
| 67 | export function StopSandbox(name: string): $CancellablePromise<void> { | 71 | export function StopSandbox(name: string): $CancellablePromise<void> { |
| 68 | return $Call.ByID(923009821, name); | 72 | return $Call.ByID(923009821, name); |
| 69 | } | 73 | } |
| 74 | + | ||
| 75 | +/** | ||
| 76 | + * Unload has the agent unload its model from memory, without stopping it | ||
| 77 | + * (issue #51), when it offers the /unload command. Nothing appears in the | ||
| 78 | + * conversations: what the agent answers goes to its log. The model is loaded | ||
| 79 | + * again with the next message. | ||
| 80 | + */ | ||
| 81 | +export function Unload(name: string): $CancellablePromise<void> { | ||
| 82 | + return $Call.ByID(3375635717, name); | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +/** | ||
| 86 | + * UnloadAll has every running agent that offers /unload unload its model. | ||
| 87 | + * Stopped agents are not counted; running agents that are answering or | ||
| 88 | + * cannot unload are skipped. | ||
| 89 | + */ | ||
| 90 | +export function UnloadAll(): $CancellablePromise<$models.UnloadResult> { | ||
| 91 | + return $Call.ByID(3399716516); | ||
| 92 | +} | ||
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/index.ts +1 -0 | @@ -27,5 +27,6 @@ export type { | ||
| 27 | 27 | ResetResult, |
| 28 | 28 | SandboxEnv, |
| 29 | 29 | SaveResult, |
| 30 | + UnloadResult, | |
| 30 | 31 | WorkspaceInfo |
| 31 | 32 | } from "./models.js"; |
| @@ -27,5 +27,6 @@ export type { | |||
| 27 | ResetResult, | 27 | ResetResult, |
| 28 | SandboxEnv, | 28 | SandboxEnv, |
| 29 | SaveResult, | 29 | SaveResult, |
| 30 | + UnloadResult, | ||
| 30 | WorkspaceInfo | 31 | WorkspaceInfo |
| 31 | } from "./models.js"; | 32 | } from "./models.js"; |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +26 -0 | @@ -159,6 +159,17 @@ export interface ResetResult { | ||
| 159 | 159 | */ |
| 160 | 160 | export interface SandboxEnv { |
| 161 | 161 | "name": string; |
| 162 | + | |
| 163 | + /** | |
| 164 | + * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | |
| 165 | + */ | |
| 166 | + "agent": string; | |
| 167 | + | |
| 168 | + /** | |
| 169 | + * AgentFile is the agent's configuration file found in the workspace | |
| 170 | + * (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | |
| 171 | + */ | |
| 172 | + "agentFile": string; | |
| 162 | 173 | "workspace": string; |
| 163 | 174 | "sandboxFolder": string; |
| 164 | 175 | "createCommand": string; |
| @@ -175,10 +186,25 @@ export interface SaveResult { | ||
| 175 | 186 | "conflict": boolean; |
| 176 | 187 | } |
| 177 | 188 | |
| 189 | +/** | |
| 190 | + * UnloadResult says which agents unloaded their model, and which running | |
| 191 | + * agents were left alone: answering, unable to unload, or failing. | |
| 192 | + */ | |
| 193 | +export interface UnloadResult { | |
| 194 | + "unloaded": string[] | null; | |
| 195 | + "skipped": string[] | null; | |
| 196 | +} | |
| 197 | + | |
| 178 | 198 | /** |
| 179 | 199 | * WorkspaceInfo tells where an agent's folder is, or why it cannot be shown. |
| 180 | 200 | */ |
| 181 | 201 | export interface WorkspaceInfo { |
| 182 | 202 | "location": string; |
| 183 | 203 | "problem": string; |
| 204 | + | |
| 205 | + /** | |
| 206 | + * Revealable tells whether the folder is on this computer, so that its | |
| 207 | + * files can be shown in the Finder or the Explorer (issue #74). | |
| 208 | + */ | |
| 209 | + "revealable": boolean; | |
| 184 | 210 | } |
| @@ -159,6 +159,17 @@ export interface ResetResult { | |||
| 159 | */ | 159 | */ |
| 160 | export interface SandboxEnv { | 160 | export interface SandboxEnv { |
| 161 | "name": string; | 161 | "name": string; |
| 162 | + | ||
| 163 | + /** | ||
| 164 | + * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | ||
| 165 | + */ | ||
| 166 | + "agent": string; | ||
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * AgentFile is the agent's configuration file found in the workspace | ||
| 170 | + * (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | ||
| 171 | + */ | ||
| 172 | + "agentFile": string; | ||
| 162 | "workspace": string; | 173 | "workspace": string; |
| 163 | "sandboxFolder": string; | 174 | "sandboxFolder": string; |
| 164 | "createCommand": string; | 175 | "createCommand": string; |
| @@ -175,10 +186,25 @@ export interface SaveResult { | |||
| 175 | "conflict": boolean; | 186 | "conflict": boolean; |
| 176 | } | 187 | } |
| 177 | 188 | ||
| 189 | +/** | ||
| 190 | + * UnloadResult says which agents unloaded their model, and which running | ||
| 191 | + * agents were left alone: answering, unable to unload, or failing. | ||
| 192 | + */ | ||
| 193 | +export interface UnloadResult { | ||
| 194 | + "unloaded": string[] | null; | ||
| 195 | + "skipped": string[] | null; | ||
| 196 | +} | ||
| 197 | + | ||
| 178 | /** | 198 | /** |
| 179 | * WorkspaceInfo tells where an agent's folder is, or why it cannot be shown. | 199 | * WorkspaceInfo tells where an agent's folder is, or why it cannot be shown. |
| 180 | */ | 200 | */ |
| 181 | export interface WorkspaceInfo { | 201 | export interface WorkspaceInfo { |
| 182 | "location": string; | 202 | "location": string; |
| 183 | "problem": string; | 203 | "problem": string; |
| 204 | + | ||
| 205 | + /** | ||
| 206 | + * Revealable tells whether the folder is on this computer, so that its | ||
| 207 | + * files can be shown in the Finder or the Explorer (issue #74). | ||
| 208 | + */ | ||
| 209 | + "revealable": boolean; | ||
| 184 | } | 210 | } |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/workspaceservice.ts +45 -0 | @@ -49,6 +49,25 @@ export function Create(agent: string, dir: string, name: string): $CancellablePr | ||
| 49 | 49 | return $Call.ByID(1228380114, agent, dir, name); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | +/** | |
| 53 | + * CreateFolder creates an empty folder called name in folder dir and | |
| 54 | + * returns its path (issue #70). | |
| 55 | + */ | |
| 56 | +export function CreateFolder(agent: string, dir: string, name: string): $CancellablePromise<string> { | |
| 57 | + return $Call.ByID(3711526042, agent, dir, name); | |
| 58 | +} | |
| 59 | + | |
| 60 | +/** | |
| 61 | + * Duplicate copies files and folders next to themselves, under a free name | |
| 62 | + * with "-copy" before the extension (plan.md → plan-copy.md, then | |
| 63 | + * plan-copy-2.md…), and returns the paths of the copies (issue #70). A | |
| 64 | + * protected file may be duplicated; a copy whose path would be protected is | |
| 65 | + * refused. It stops at the first that cannot be copied. | |
| 66 | + */ | |
| 67 | +export function Duplicate(agent: string, files: string[] | null): $CancellablePromise<string[] | null> { | |
| 68 | + return $Call.ByID(2054803095, agent, files); | |
| 69 | +} | |
| 70 | + | |
| 52 | 71 | /** |
| 53 | 72 | * Image returns an image of the agent's folder as a data: URL, for the |
| 54 | 73 | * preview of the image itself or of a document that shows it. Shown in an |
| @@ -87,6 +106,15 @@ export function List(agent: string, dir: string): $CancellablePromise<workspace$ | ||
| 87 | 106 | return $Call.ByID(2507571650, agent, dir); |
| 88 | 107 | } |
| 89 | 108 | |
| 109 | +/** | |
| 110 | + * Move moves files and folders into folder dir ("" for the root), keeping | |
| 111 | + * their names (issue #70), and returns their new paths. It stops at the | |
| 112 | + * first one that cannot move: those before it have moved. | |
| 113 | + */ | |
| 114 | +export function Move(agent: string, files: string[] | null, dir: string): $CancellablePromise<string[] | null> { | |
| 115 | + return $Call.ByID(2757733347, agent, files, dir); | |
| 116 | +} | |
| 117 | + | |
| 90 | 118 | /** |
| 91 | 119 | * Read returns a text file of the agent; a protected one is read only. |
| 92 | 120 | */ |
| @@ -102,6 +130,23 @@ export function Remove(agent: string, file: string): $CancellablePromise<void> { | ||
| 102 | 130 | return $Call.ByID(2126785394, agent, file); |
| 103 | 131 | } |
| 104 | 132 | |
| 133 | +/** | |
| 134 | + * RemoveAll removes several files and folders at once (issue #70). Nothing | |
| 135 | + * is removed when one of them is protected, or holds a protected file. | |
| 136 | + */ | |
| 137 | +export function RemoveAll(agent: string, files: string[] | null): $CancellablePromise<void> { | |
| 138 | + return $Call.ByID(858143145, agent, files); | |
| 139 | +} | |
| 140 | + | |
| 141 | +/** | |
| 142 | + * Rename renames a file or a folder, or moves it when to is in another | |
| 143 | + * folder (issue #70); it returns the new path. A protected file, a folder | |
| 144 | + * that holds one, or a protected new path is refused. | |
| 145 | + */ | |
| 146 | +export function Rename(agent: string, $from: string, to: string): $CancellablePromise<string> { | |
| 147 | + return $Call.ByID(4252569200, agent, $from, to); | |
| 148 | +} | |
| 149 | + | |
| 105 | 150 | /** |
| 106 | 151 | * Reveal shows a file of agent's folder in the Finder (macOS), the Explorer |
| 107 | 152 | * (Windows) or the file manager (Linux). Only for a folder on this |
| @@ -49,6 +49,25 @@ export function Create(agent: string, dir: string, name: string): $CancellablePr | |||
| 49 | return $Call.ByID(1228380114, agent, dir, name); | 49 | return $Call.ByID(1228380114, agent, dir, name); |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | +/** | ||
| 53 | + * CreateFolder creates an empty folder called name in folder dir and | ||
| 54 | + * returns its path (issue #70). | ||
| 55 | + */ | ||
| 56 | +export function CreateFolder(agent: string, dir: string, name: string): $CancellablePromise<string> { | ||
| 57 | + return $Call.ByID(3711526042, agent, dir, name); | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +/** | ||
| 61 | + * Duplicate copies files and folders next to themselves, under a free name | ||
| 62 | + * with "-copy" before the extension (plan.md → plan-copy.md, then | ||
| 63 | + * plan-copy-2.md…), and returns the paths of the copies (issue #70). A | ||
| 64 | + * protected file may be duplicated; a copy whose path would be protected is | ||
| 65 | + * refused. It stops at the first that cannot be copied. | ||
| 66 | + */ | ||
| 67 | +export function Duplicate(agent: string, files: string[] | null): $CancellablePromise<string[] | null> { | ||
| 68 | + return $Call.ByID(2054803095, agent, files); | ||
| 69 | +} | ||
| 70 | + | ||
| 52 | /** | 71 | /** |
| 53 | * Image returns an image of the agent's folder as a data: URL, for the | 72 | * Image returns an image of the agent's folder as a data: URL, for the |
| 54 | * preview of the image itself or of a document that shows it. Shown in an | 73 | * preview of the image itself or of a document that shows it. Shown in an |
| @@ -87,6 +106,15 @@ export function List(agent: string, dir: string): $CancellablePromise<workspace$ | |||
| 87 | return $Call.ByID(2507571650, agent, dir); | 106 | return $Call.ByID(2507571650, agent, dir); |
| 88 | } | 107 | } |
| 89 | 108 | ||
| 109 | +/** | ||
| 110 | + * Move moves files and folders into folder dir ("" for the root), keeping | ||
| 111 | + * their names (issue #70), and returns their new paths. It stops at the | ||
| 112 | + * first one that cannot move: those before it have moved. | ||
| 113 | + */ | ||
| 114 | +export function Move(agent: string, files: string[] | null, dir: string): $CancellablePromise<string[] | null> { | ||
| 115 | + return $Call.ByID(2757733347, agent, files, dir); | ||
| 116 | +} | ||
| 117 | + | ||
| 90 | /** | 118 | /** |
| 91 | * Read returns a text file of the agent; a protected one is read only. | 119 | * Read returns a text file of the agent; a protected one is read only. |
| 92 | */ | 120 | */ |
| @@ -102,6 +130,23 @@ export function Remove(agent: string, file: string): $CancellablePromise<void> { | |||
| 102 | return $Call.ByID(2126785394, agent, file); | 130 | return $Call.ByID(2126785394, agent, file); |
| 103 | } | 131 | } |
| 104 | 132 | ||
| 133 | +/** | ||
| 134 | + * RemoveAll removes several files and folders at once (issue #70). Nothing | ||
| 135 | + * is removed when one of them is protected, or holds a protected file. | ||
| 136 | + */ | ||
| 137 | +export function RemoveAll(agent: string, files: string[] | null): $CancellablePromise<void> { | ||
| 138 | + return $Call.ByID(858143145, agent, files); | ||
| 139 | +} | ||
| 140 | + | ||
| 141 | +/** | ||
| 142 | + * Rename renames a file or a folder, or moves it when to is in another | ||
| 143 | + * folder (issue #70); it returns the new path. A protected file, a folder | ||
| 144 | + * that holds one, or a protected new path is refused. | ||
| 145 | + */ | ||
| 146 | +export function Rename(agent: string, $from: string, to: string): $CancellablePromise<string> { | ||
| 147 | + return $Call.ByID(4252569200, agent, $from, to); | ||
| 148 | +} | ||
| 149 | + | ||
| 105 | /** | 150 | /** |
| 106 | * Reveal shows a file of agent's folder in the Finder (macOS), the Explorer | 151 | * Reveal shows a file of agent's folder in the Finder (macOS), the Explorer |
| 107 | * (Windows) or the file manager (Linux). Only for a folder on this | 152 | * (Windows) or the file manager (Linux). Only for a folder on this |
modified
frontend/package.json +13 -0 | @@ -14,9 +14,22 @@ | ||
| 14 | 14 | "dependencies": { |
| 15 | 15 | "@asciidoctor/core": "4.1.1", |
| 16 | 16 | "@codemirror/autocomplete": "6.20.3", |
| 17 | + "@codemirror/lang-cpp": "6.0.3", | |
| 18 | + "@codemirror/lang-css": "6.3.1", | |
| 19 | + "@codemirror/lang-go": "6.0.1", | |
| 20 | + "@codemirror/lang-html": "6.4.12", | |
| 21 | + "@codemirror/lang-java": "6.0.2", | |
| 22 | + "@codemirror/lang-javascript": "6.2.5", | |
| 17 | 23 | "@codemirror/lang-json": "6.0.2", |
| 18 | 24 | "@codemirror/lang-markdown": "6.5.2", |
| 25 | + "@codemirror/lang-php": "6.0.2", | |
| 26 | + "@codemirror/lang-python": "6.2.1", | |
| 27 | + "@codemirror/lang-rust": "6.0.2", | |
| 28 | + "@codemirror/lang-sql": "6.10.0", | |
| 29 | + "@codemirror/lang-xml": "6.1.0", | |
| 19 | 30 | "@codemirror/lang-yaml": "6.1.3", |
| 31 | + "@codemirror/language": "6.13.1", | |
| 32 | + "@codemirror/legacy-modes": "6.5.5", | |
| 20 | 33 | "@codemirror/lint": "6.9.7", |
| 21 | 34 | "@codemirror/state": "6.7.6", |
| 22 | 35 | "@codemirror/theme-one-dark": "6.1.3", |
| @@ -14,9 +14,22 @@ | |||
| 14 | "dependencies": { | 14 | "dependencies": { |
| 15 | "@asciidoctor/core": "4.1.1", | 15 | "@asciidoctor/core": "4.1.1", |
| 16 | "@codemirror/autocomplete": "6.20.3", | 16 | "@codemirror/autocomplete": "6.20.3", |
| 17 | + "@codemirror/lang-cpp": "6.0.3", | ||
| 18 | + "@codemirror/lang-css": "6.3.1", | ||
| 19 | + "@codemirror/lang-go": "6.0.1", | ||
| 20 | + "@codemirror/lang-html": "6.4.12", | ||
| 21 | + "@codemirror/lang-java": "6.0.2", | ||
| 22 | + "@codemirror/lang-javascript": "6.2.5", | ||
| 17 | "@codemirror/lang-json": "6.0.2", | 23 | "@codemirror/lang-json": "6.0.2", |
| 18 | "@codemirror/lang-markdown": "6.5.2", | 24 | "@codemirror/lang-markdown": "6.5.2", |
| 25 | + "@codemirror/lang-php": "6.0.2", | ||
| 26 | + "@codemirror/lang-python": "6.2.1", | ||
| 27 | + "@codemirror/lang-rust": "6.0.2", | ||
| 28 | + "@codemirror/lang-sql": "6.10.0", | ||
| 29 | + "@codemirror/lang-xml": "6.1.0", | ||
| 19 | "@codemirror/lang-yaml": "6.1.3", | 30 | "@codemirror/lang-yaml": "6.1.3", |
| 31 | + "@codemirror/language": "6.13.1", | ||
| 32 | + "@codemirror/legacy-modes": "6.5.5", | ||
| 20 | "@codemirror/lint": "6.9.7", | 33 | "@codemirror/lint": "6.9.7", |
| 21 | "@codemirror/state": "6.7.6", | 34 | "@codemirror/state": "6.7.6", |
| 22 | "@codemirror/theme-one-dark": "6.1.3", | 35 | "@codemirror/theme-one-dark": "6.1.3", |
modified
frontend/pnpm-lock.yaml +190 -0 | @@ -172,15 +172,54 @@ importers: | ||
| 172 | 172 | '@codemirror/autocomplete': |
| 173 | 173 | specifier: 6.20.3 |
| 174 | 174 | version: 6.20.3 |
| 175 | + '@codemirror/lang-cpp': | |
| 176 | + specifier: 6.0.3 | |
| 177 | + version: 6.0.3 | |
| 178 | + '@codemirror/lang-css': | |
| 179 | + specifier: 6.3.1 | |
| 180 | + version: 6.3.1 | |
| 181 | + '@codemirror/lang-go': | |
| 182 | + specifier: 6.0.1 | |
| 183 | + version: 6.0.1 | |
| 184 | + '@codemirror/lang-html': | |
| 185 | + specifier: 6.4.12 | |
| 186 | + version: 6.4.12 | |
| 187 | + '@codemirror/lang-java': | |
| 188 | + specifier: 6.0.2 | |
| 189 | + version: 6.0.2 | |
| 190 | + '@codemirror/lang-javascript': | |
| 191 | + specifier: 6.2.5 | |
| 192 | + version: 6.2.5 | |
| 175 | 193 | '@codemirror/lang-json': |
| 176 | 194 | specifier: 6.0.2 |
| 177 | 195 | version: 6.0.2 |
| 178 | 196 | '@codemirror/lang-markdown': |
| 179 | 197 | specifier: 6.5.2 |
| 180 | 198 | version: 6.5.2 |
| 199 | + '@codemirror/lang-php': | |
| 200 | + specifier: 6.0.2 | |
| 201 | + version: 6.0.2 | |
| 202 | + '@codemirror/lang-python': | |
| 203 | + specifier: 6.2.1 | |
| 204 | + version: 6.2.1 | |
| 205 | + '@codemirror/lang-rust': | |
| 206 | + specifier: 6.0.2 | |
| 207 | + version: 6.0.2 | |
| 208 | + '@codemirror/lang-sql': | |
| 209 | + specifier: 6.10.0 | |
| 210 | + version: 6.10.0 | |
| 211 | + '@codemirror/lang-xml': | |
| 212 | + specifier: 6.1.0 | |
| 213 | + version: 6.1.0 | |
| 181 | 214 | '@codemirror/lang-yaml': |
| 182 | 215 | specifier: 6.1.3 |
| 183 | 216 | version: 6.1.3 |
| 217 | + '@codemirror/language': | |
| 218 | + specifier: 6.13.1 | |
| 219 | + version: 6.13.1 | |
| 220 | + '@codemirror/legacy-modes': | |
| 221 | + specifier: 6.5.5 | |
| 222 | + version: 6.5.5 | |
| 184 | 223 | '@codemirror/lint': |
| 185 | 224 | specifier: 6.9.7 |
| 186 | 225 | version: 6.9.7 |
| @@ -278,12 +317,21 @@ packages: | ||
| 278 | 317 | '@codemirror/commands@6.11.1': |
| 279 | 318 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} |
| 280 | 319 | |
| 320 | + '@codemirror/lang-cpp@6.0.3': | |
| 321 | + resolution: {integrity: sha512-URM26M3vunFFn9/sm6rzqrBzDgfWuDixp85uTY49wKudToc2jTHUrKIGGKs+QWND+YLofNNZpxcNGRynFJfvgA==} | |
| 322 | + | |
| 281 | 323 | '@codemirror/lang-css@6.3.1': |
| 282 | 324 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} |
| 283 | 325 | |
| 326 | + '@codemirror/lang-go@6.0.1': | |
| 327 | + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} | |
| 328 | + | |
| 284 | 329 | '@codemirror/lang-html@6.4.12': |
| 285 | 330 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} |
| 286 | 331 | |
| 332 | + '@codemirror/lang-java@6.0.2': | |
| 333 | + resolution: {integrity: sha512-m5Nt1mQ/cznJY7tMfQTJchmrjdjQ71IDs+55d1GAa8DGaB8JXWsVCkVT284C3RTASaY43YknrK2X3hPO/J3MOQ==} | |
| 334 | + | |
| 287 | 335 | '@codemirror/lang-javascript@6.2.5': |
| 288 | 336 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} |
| 289 | 337 | |
| @@ -293,12 +341,30 @@ packages: | ||
| 293 | 341 | '@codemirror/lang-markdown@6.5.2': |
| 294 | 342 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} |
| 295 | 343 | |
| 344 | + '@codemirror/lang-php@6.0.2': | |
| 345 | + resolution: {integrity: sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA==} | |
| 346 | + | |
| 347 | + '@codemirror/lang-python@6.2.1': | |
| 348 | + resolution: {integrity: sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==} | |
| 349 | + | |
| 350 | + '@codemirror/lang-rust@6.0.2': | |
| 351 | + resolution: {integrity: sha512-EZaGjCUegtiU7kSMvOfEZpaCReowEf3yNidYu7+vfuGTm9ow4mthAparY5hisJqOHmJowVH3Upu+eJlUji6qqA==} | |
| 352 | + | |
| 353 | + '@codemirror/lang-sql@6.10.0': | |
| 354 | + resolution: {integrity: sha512-6ayPkEd/yRw0XKBx5uAiToSgGECo/GY2NoJIHXIIQh1EVwLuKoU8BP/qK0qH5NLXAbtJRLuT73hx7P9X34iO4w==} | |
| 355 | + | |
| 356 | + '@codemirror/lang-xml@6.1.0': | |
| 357 | + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} | |
| 358 | + | |
| 296 | 359 | '@codemirror/lang-yaml@6.1.3': |
| 297 | 360 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} |
| 298 | 361 | |
| 299 | 362 | '@codemirror/language@6.13.1': |
| 300 | 363 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} |
| 301 | 364 | |
| 365 | + '@codemirror/legacy-modes@6.5.5': | |
| 366 | + resolution: {integrity: sha512-9ltT214oMb3Y1w5eAZMSigzrjzZnMI2Wa3Feq73rU/i4C56MkwrpfswfQYOr28C5pXr6dWwspNTMyeHXlzWMxg==} | |
| 367 | + | |
| 302 | 368 | '@codemirror/lint@6.9.7': |
| 303 | 369 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} |
| 304 | 370 | |
| @@ -381,15 +447,24 @@ packages: | ||
| 381 | 447 | '@lezer/common@1.5.4': |
| 382 | 448 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} |
| 383 | 449 | |
| 450 | + '@lezer/cpp@1.1.6': | |
| 451 | + resolution: {integrity: sha512-vh9gWWJOXFVY8HBHK3Twzq8MgwG2iN4GSyzBP9sCGTe37P15x2R14VaBQk0VA0ezTRN1KHYBBsHhvpGZ2Xy/pA==} | |
| 452 | + | |
| 384 | 453 | '@lezer/css@1.3.9': |
| 385 | 454 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} |
| 386 | 455 | |
| 456 | + '@lezer/go@1.0.1': | |
| 457 | + resolution: {integrity: sha512-xToRsYxwsgJNHTgNdStpcvmbVuKxTapV0dM0wey1geMMRc9aggoVyKgzYp41D2/vVOx+Ii4hmE206kvxIXBVXQ==} | |
| 458 | + | |
| 387 | 459 | '@lezer/highlight@1.2.5': |
| 388 | 460 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} |
| 389 | 461 | |
| 390 | 462 | '@lezer/html@1.3.13': |
| 391 | 463 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} |
| 392 | 464 | |
| 465 | + '@lezer/java@1.1.5': | |
| 466 | + resolution: {integrity: sha512-JppTd1iKHpeNlLYw/Zl8JX7zSY5HqAzK4zZ05lpn8l8Sk7Fo5KAKiDiMiezKoT5lfeC2xZf8HeKp1tSctj4G6Q==} | |
| 467 | + | |
| 393 | 468 | '@lezer/javascript@1.5.6': |
| 394 | 469 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} |
| 395 | 470 | |
| @@ -402,6 +477,18 @@ packages: | ||
| 402 | 477 | '@lezer/markdown@1.8.1': |
| 403 | 478 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} |
| 404 | 479 | |
| 480 | + '@lezer/php@1.0.6': | |
| 481 | + resolution: {integrity: sha512-QJ2xNXPmsm/Z3IpThq8fnJrEIVpxhsIoj6GZBW0JYEd/l9zxpJZW216X4fzqQY4vgpdGIumypvI4uQjd4tnYtw==} | |
| 482 | + | |
| 483 | + '@lezer/python@1.1.19': | |
| 484 | + resolution: {integrity: sha512-MhQIURHRytsNzP/YXnqpYKW6la6voAH3kyplTOOiCdjyFY6cWWGFVmYVdHIPrElqSDf4iCDktQCockB9FxuhzQ==} | |
| 485 | + | |
| 486 | + '@lezer/rust@1.0.3': | |
| 487 | + resolution: {integrity: sha512-XxErOjZzQ7yJt1agUT4fu9qQvESZ3acgoxpPaPTPOiUx+duCjaVAtZGFIgphkHxlN05djdVAIOy/wItShMEjqQ==} | |
| 488 | + | |
| 489 | + '@lezer/xml@1.0.6': | |
| 490 | + resolution: {integrity: sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==} | |
| 491 | + | |
| 405 | 492 | '@lezer/yaml@1.0.4': |
| 406 | 493 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} |
| 407 | 494 | |
| @@ -1255,6 +1342,11 @@ snapshots: | ||
| 1255 | 1342 | '@codemirror/view': 6.43.14 |
| 1256 | 1343 | '@lezer/common': 1.5.4 |
| 1257 | 1344 | |
| 1345 | + '@codemirror/lang-cpp@6.0.3': | |
| 1346 | + dependencies: | |
| 1347 | + '@codemirror/language': 6.13.1 | |
| 1348 | + '@lezer/cpp': 1.1.6 | |
| 1349 | + | |
| 1258 | 1350 | '@codemirror/lang-css@6.3.1': |
| 1259 | 1351 | dependencies: |
| 1260 | 1352 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1263,6 +1355,14 @@ snapshots: | ||
| 1263 | 1355 | '@lezer/common': 1.5.4 |
| 1264 | 1356 | '@lezer/css': 1.3.9 |
| 1265 | 1357 | |
| 1358 | + '@codemirror/lang-go@6.0.1': | |
| 1359 | + dependencies: | |
| 1360 | + '@codemirror/autocomplete': 6.20.3 | |
| 1361 | + '@codemirror/language': 6.13.1 | |
| 1362 | + '@codemirror/state': 6.7.6 | |
| 1363 | + '@lezer/common': 1.5.4 | |
| 1364 | + '@lezer/go': 1.0.1 | |
| 1365 | + | |
| 1266 | 1366 | '@codemirror/lang-html@6.4.12': |
| 1267 | 1367 | dependencies: |
| 1268 | 1368 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1275,6 +1375,11 @@ snapshots: | ||
| 1275 | 1375 | '@lezer/css': 1.3.9 |
| 1276 | 1376 | '@lezer/html': 1.3.13 |
| 1277 | 1377 | |
| 1378 | + '@codemirror/lang-java@6.0.2': | |
| 1379 | + dependencies: | |
| 1380 | + '@codemirror/language': 6.13.1 | |
| 1381 | + '@lezer/java': 1.1.5 | |
| 1382 | + | |
| 1278 | 1383 | '@codemirror/lang-javascript@6.2.5': |
| 1279 | 1384 | dependencies: |
| 1280 | 1385 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1300,6 +1405,45 @@ snapshots: | ||
| 1300 | 1405 | '@lezer/common': 1.5.4 |
| 1301 | 1406 | '@lezer/markdown': 1.8.1 |
| 1302 | 1407 | |
| 1408 | + '@codemirror/lang-php@6.0.2': | |
| 1409 | + dependencies: | |
| 1410 | + '@codemirror/lang-html': 6.4.12 | |
| 1411 | + '@codemirror/language': 6.13.1 | |
| 1412 | + '@codemirror/state': 6.7.6 | |
| 1413 | + '@lezer/common': 1.5.4 | |
| 1414 | + '@lezer/php': 1.0.6 | |
| 1415 | + | |
| 1416 | + '@codemirror/lang-python@6.2.1': | |
| 1417 | + dependencies: | |
| 1418 | + '@codemirror/autocomplete': 6.20.3 | |
| 1419 | + '@codemirror/language': 6.13.1 | |
| 1420 | + '@codemirror/state': 6.7.6 | |
| 1421 | + '@lezer/common': 1.5.4 | |
| 1422 | + '@lezer/python': 1.1.19 | |
| 1423 | + | |
| 1424 | + '@codemirror/lang-rust@6.0.2': | |
| 1425 | + dependencies: | |
| 1426 | + '@codemirror/language': 6.13.1 | |
| 1427 | + '@lezer/rust': 1.0.3 | |
| 1428 | + | |
| 1429 | + '@codemirror/lang-sql@6.10.0': | |
| 1430 | + dependencies: | |
| 1431 | + '@codemirror/autocomplete': 6.20.3 | |
| 1432 | + '@codemirror/language': 6.13.1 | |
| 1433 | + '@codemirror/state': 6.7.6 | |
| 1434 | + '@lezer/common': 1.5.4 | |
| 1435 | + '@lezer/highlight': 1.2.5 | |
| 1436 | + '@lezer/lr': 1.4.11 | |
| 1437 | + | |
| 1438 | + '@codemirror/lang-xml@6.1.0': | |
| 1439 | + dependencies: | |
| 1440 | + '@codemirror/autocomplete': 6.20.3 | |
| 1441 | + '@codemirror/language': 6.13.1 | |
| 1442 | + '@codemirror/state': 6.7.6 | |
| 1443 | + '@codemirror/view': 6.43.14 | |
| 1444 | + '@lezer/common': 1.5.4 | |
| 1445 | + '@lezer/xml': 1.0.6 | |
| 1446 | + | |
| 1303 | 1447 | '@codemirror/lang-yaml@6.1.3': |
| 1304 | 1448 | dependencies: |
| 1305 | 1449 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1320,6 +1464,10 @@ snapshots: | ||
| 1320 | 1464 | '@lezer/lr': 1.4.11 |
| 1321 | 1465 | style-mod: 4.1.4 |
| 1322 | 1466 | |
| 1467 | + '@codemirror/legacy-modes@6.5.5': | |
| 1468 | + dependencies: | |
| 1469 | + '@codemirror/streamparser': 6.0.0 | |
| 1470 | + | |
| 1323 | 1471 | '@codemirror/lint@6.9.7': |
| 1324 | 1472 | dependencies: |
| 1325 | 1473 | '@codemirror/state': 6.7.6 |
| @@ -1399,12 +1547,24 @@ snapshots: | ||
| 1399 | 1547 | |
| 1400 | 1548 | '@lezer/common@1.5.4': {} |
| 1401 | 1549 | |
| 1550 | + '@lezer/cpp@1.1.6': | |
| 1551 | + dependencies: | |
| 1552 | + '@lezer/common': 1.5.4 | |
| 1553 | + '@lezer/highlight': 1.2.5 | |
| 1554 | + '@lezer/lr': 1.4.11 | |
| 1555 | + | |
| 1402 | 1556 | '@lezer/css@1.3.9': |
| 1403 | 1557 | dependencies: |
| 1404 | 1558 | '@lezer/common': 1.5.4 |
| 1405 | 1559 | '@lezer/highlight': 1.2.5 |
| 1406 | 1560 | '@lezer/lr': 1.4.11 |
| 1407 | 1561 | |
| 1562 | + '@lezer/go@1.0.1': | |
| 1563 | + dependencies: | |
| 1564 | + '@lezer/common': 1.5.4 | |
| 1565 | + '@lezer/highlight': 1.2.5 | |
| 1566 | + '@lezer/lr': 1.4.11 | |
| 1567 | + | |
| 1408 | 1568 | '@lezer/highlight@1.2.5': |
| 1409 | 1569 | dependencies: |
| 1410 | 1570 | '@lezer/common': 1.5.4 |
| @@ -1415,6 +1575,12 @@ snapshots: | ||
| 1415 | 1575 | '@lezer/highlight': 1.2.5 |
| 1416 | 1576 | '@lezer/lr': 1.4.11 |
| 1417 | 1577 | |
| 1578 | + '@lezer/java@1.1.5': | |
| 1579 | + dependencies: | |
| 1580 | + '@lezer/common': 1.5.4 | |
| 1581 | + '@lezer/highlight': 1.2.5 | |
| 1582 | + '@lezer/lr': 1.4.11 | |
| 1583 | + | |
| 1418 | 1584 | '@lezer/javascript@1.5.6': |
| 1419 | 1585 | dependencies: |
| 1420 | 1586 | '@lezer/common': 1.5.4 |
| @@ -1436,6 +1602,30 @@ snapshots: | ||
| 1436 | 1602 | '@lezer/common': 1.5.4 |
| 1437 | 1603 | '@lezer/highlight': 1.2.5 |
| 1438 | 1604 | |
| 1605 | + '@lezer/php@1.0.6': | |
| 1606 | + dependencies: | |
| 1607 | + '@lezer/common': 1.5.4 | |
| 1608 | + '@lezer/highlight': 1.2.5 | |
| 1609 | + '@lezer/lr': 1.4.11 | |
| 1610 | + | |
| 1611 | + '@lezer/python@1.1.19': | |
| 1612 | + dependencies: | |
| 1613 | + '@lezer/common': 1.5.4 | |
| 1614 | + '@lezer/highlight': 1.2.5 | |
| 1615 | + '@lezer/lr': 1.4.11 | |
| 1616 | + | |
| 1617 | + '@lezer/rust@1.0.3': | |
| 1618 | + dependencies: | |
| 1619 | + '@lezer/common': 1.5.4 | |
| 1620 | + '@lezer/highlight': 1.2.5 | |
| 1621 | + '@lezer/lr': 1.4.11 | |
| 1622 | + | |
| 1623 | + '@lezer/xml@1.0.6': | |
| 1624 | + dependencies: | |
| 1625 | + '@lezer/common': 1.5.4 | |
| 1626 | + '@lezer/highlight': 1.2.5 | |
| 1627 | + '@lezer/lr': 1.4.11 | |
| 1628 | + | |
| 1439 | 1629 | '@lezer/yaml@1.0.4': |
| 1440 | 1630 | dependencies: |
| 1441 | 1631 | '@lezer/common': 1.5.4 |
| @@ -172,15 +172,54 @@ importers: | |||
| 172 | '@codemirror/autocomplete': | 172 | '@codemirror/autocomplete': |
| 173 | specifier: 6.20.3 | 173 | specifier: 6.20.3 |
| 174 | version: 6.20.3 | 174 | version: 6.20.3 |
| 175 | + '@codemirror/lang-cpp': | ||
| 176 | + specifier: 6.0.3 | ||
| 177 | + version: 6.0.3 | ||
| 178 | + '@codemirror/lang-css': | ||
| 179 | + specifier: 6.3.1 | ||
| 180 | + version: 6.3.1 | ||
| 181 | + '@codemirror/lang-go': | ||
| 182 | + specifier: 6.0.1 | ||
| 183 | + version: 6.0.1 | ||
| 184 | + '@codemirror/lang-html': | ||
| 185 | + specifier: 6.4.12 | ||
| 186 | + version: 6.4.12 | ||
| 187 | + '@codemirror/lang-java': | ||
| 188 | + specifier: 6.0.2 | ||
| 189 | + version: 6.0.2 | ||
| 190 | + '@codemirror/lang-javascript': | ||
| 191 | + specifier: 6.2.5 | ||
| 192 | + version: 6.2.5 | ||
| 175 | '@codemirror/lang-json': | 193 | '@codemirror/lang-json': |
| 176 | specifier: 6.0.2 | 194 | specifier: 6.0.2 |
| 177 | version: 6.0.2 | 195 | version: 6.0.2 |
| 178 | '@codemirror/lang-markdown': | 196 | '@codemirror/lang-markdown': |
| 179 | specifier: 6.5.2 | 197 | specifier: 6.5.2 |
| 180 | version: 6.5.2 | 198 | version: 6.5.2 |
| 199 | + '@codemirror/lang-php': | ||
| 200 | + specifier: 6.0.2 | ||
| 201 | + version: 6.0.2 | ||
| 202 | + '@codemirror/lang-python': | ||
| 203 | + specifier: 6.2.1 | ||
| 204 | + version: 6.2.1 | ||
| 205 | + '@codemirror/lang-rust': | ||
| 206 | + specifier: 6.0.2 | ||
| 207 | + version: 6.0.2 | ||
| 208 | + '@codemirror/lang-sql': | ||
| 209 | + specifier: 6.10.0 | ||
| 210 | + version: 6.10.0 | ||
| 211 | + '@codemirror/lang-xml': | ||
| 212 | + specifier: 6.1.0 | ||
| 213 | + version: 6.1.0 | ||
| 181 | '@codemirror/lang-yaml': | 214 | '@codemirror/lang-yaml': |
| 182 | specifier: 6.1.3 | 215 | specifier: 6.1.3 |
| 183 | version: 6.1.3 | 216 | version: 6.1.3 |
| 217 | + '@codemirror/language': | ||
| 218 | + specifier: 6.13.1 | ||
| 219 | + version: 6.13.1 | ||
| 220 | + '@codemirror/legacy-modes': | ||
| 221 | + specifier: 6.5.5 | ||
| 222 | + version: 6.5.5 | ||
| 184 | '@codemirror/lint': | 223 | '@codemirror/lint': |
| 185 | specifier: 6.9.7 | 224 | specifier: 6.9.7 |
| 186 | version: 6.9.7 | 225 | version: 6.9.7 |
| @@ -278,12 +317,21 @@ packages: | |||
| 278 | '@codemirror/commands@6.11.1': | 317 | '@codemirror/commands@6.11.1': |
| 279 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} | 318 | resolution: {integrity: sha512-O/4hG3SC1YwcmQ0d2UVNDs+AsaNWd1iHVxbTeEBuqH+6bExAiPK3iS/BvpY6rZGURALv4ZD3sIgcCmRvw3ehBg==} |
| 280 | 319 | ||
| 320 | + '@codemirror/lang-cpp@6.0.3': | ||
| 321 | + resolution: {integrity: sha512-URM26M3vunFFn9/sm6rzqrBzDgfWuDixp85uTY49wKudToc2jTHUrKIGGKs+QWND+YLofNNZpxcNGRynFJfvgA==} | ||
| 322 | + | ||
| 281 | '@codemirror/lang-css@6.3.1': | 323 | '@codemirror/lang-css@6.3.1': |
| 282 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} | 324 | resolution: {integrity: sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==} |
| 283 | 325 | ||
| 326 | + '@codemirror/lang-go@6.0.1': | ||
| 327 | + resolution: {integrity: sha512-7fNvbyNylvqCphW9HD6WFnRpcDjr+KXX/FgqXy5H5ZS0eC5edDljukm/yNgYkwTsgp2busdod50AOTIy6Jikfg==} | ||
| 328 | + | ||
| 284 | '@codemirror/lang-html@6.4.12': | 329 | '@codemirror/lang-html@6.4.12': |
| 285 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} | 330 | resolution: {integrity: sha512-pw2ReWKUqSkbvh76RAT4NYxiogRu+PWkR2ukAwO9uOgrm8uipkzjtKKtNpyeAQwHOqxEeSvAXZ6vr3AfyB9y/w==} |
| 286 | 331 | ||
| 332 | + '@codemirror/lang-java@6.0.2': | ||
| 333 | + resolution: {integrity: sha512-m5Nt1mQ/cznJY7tMfQTJchmrjdjQ71IDs+55d1GAa8DGaB8JXWsVCkVT284C3RTASaY43YknrK2X3hPO/J3MOQ==} | ||
| 334 | + | ||
| 287 | '@codemirror/lang-javascript@6.2.5': | 335 | '@codemirror/lang-javascript@6.2.5': |
| 288 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} | 336 | resolution: {integrity: sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==} |
| 289 | 337 | ||
| @@ -293,12 +341,30 @@ packages: | |||
| 293 | '@codemirror/lang-markdown@6.5.2': | 341 | '@codemirror/lang-markdown@6.5.2': |
| 294 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} | 342 | resolution: {integrity: sha512-AwBOdkWYuA//WcM0xO5PfHPUcmz/O2i5o0Nsg1U69SII/loCJlFI1Romd9xp2HYb1kYJRGZotyqRghuHH5n8Kw==} |
| 295 | 343 | ||
| 344 | + '@codemirror/lang-php@6.0.2': | ||
| 345 | + resolution: {integrity: sha512-ZKy2v1n8Fc8oEXj0Th0PUMXzQJ0AIR6TaZU+PbDHExFwdu+guzOA4jmCHS1Nz4vbFezwD7LyBdDnddSJeScMCA==} | ||
| 346 | + | ||
| 347 | + '@codemirror/lang-python@6.2.1': | ||
| 348 | + resolution: {integrity: sha512-IRjC8RUBhn9mGR9ywecNhB51yePWCGgvHfY1lWN/Mrp3cKuHr0isDKia+9HnvhiWNnMpbGhWrkhuWOc09exRyw==} | ||
| 349 | + | ||
| 350 | + '@codemirror/lang-rust@6.0.2': | ||
| 351 | + resolution: {integrity: sha512-EZaGjCUegtiU7kSMvOfEZpaCReowEf3yNidYu7+vfuGTm9ow4mthAparY5hisJqOHmJowVH3Upu+eJlUji6qqA==} | ||
| 352 | + | ||
| 353 | + '@codemirror/lang-sql@6.10.0': | ||
| 354 | + resolution: {integrity: sha512-6ayPkEd/yRw0XKBx5uAiToSgGECo/GY2NoJIHXIIQh1EVwLuKoU8BP/qK0qH5NLXAbtJRLuT73hx7P9X34iO4w==} | ||
| 355 | + | ||
| 356 | + '@codemirror/lang-xml@6.1.0': | ||
| 357 | + resolution: {integrity: sha512-3z0blhicHLfwi2UgkZYRPioSgVTo9PV5GP5ducFH6FaHy0IAJRg+ixj5gTR1gnT/glAIC8xv4w2VL1LoZfs+Jg==} | ||
| 358 | + | ||
| 296 | '@codemirror/lang-yaml@6.1.3': | 359 | '@codemirror/lang-yaml@6.1.3': |
| 297 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} | 360 | resolution: {integrity: sha512-AZ8DJBuXGVHybpBQhmZtgew5//4hv3tdkXnr3vDmOUMJRuB6vn/uuwtmTOTlqEaQFg3hQSVeA90NmvIQyUV6FQ==} |
| 298 | 361 | ||
| 299 | '@codemirror/language@6.13.1': | 362 | '@codemirror/language@6.13.1': |
| 300 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} | 363 | resolution: {integrity: sha512-zfvU2r3TyylQLMj/te+5CnQ0rSqZi8B1oTCBbQkagcLW4Xc6imab6qN+pEJhsuNOLaJqiRyBXp9UhWA1DhVvDw==} |
| 301 | 364 | ||
| 365 | + '@codemirror/legacy-modes@6.5.5': | ||
| 366 | + resolution: {integrity: sha512-9ltT214oMb3Y1w5eAZMSigzrjzZnMI2Wa3Feq73rU/i4C56MkwrpfswfQYOr28C5pXr6dWwspNTMyeHXlzWMxg==} | ||
| 367 | + | ||
| 302 | '@codemirror/lint@6.9.7': | 368 | '@codemirror/lint@6.9.7': |
| 303 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} | 369 | resolution: {integrity: sha512-28/+iWLYxKxsvGYhSYL7zaCZqLz5+FFFDq9tVsvGv9kv8RY4fFAchJ5WX9M3YrrRlTIsECjsXPqeNgnSmNP2dg==} |
| 304 | 370 | ||
| @@ -381,15 +447,24 @@ packages: | |||
| 381 | '@lezer/common@1.5.4': | 447 | '@lezer/common@1.5.4': |
| 382 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} | 448 | resolution: {integrity: sha512-xt3Q4z64xM+xhg4M7NXqw1N//1O74bUFo5kz6fwMeC4qwxSuRdwkYSmjcqCEEKYkNw5e67f2hcNqBoNERAEU0w==} |
| 383 | 449 | ||
| 450 | + '@lezer/cpp@1.1.6': | ||
| 451 | + resolution: {integrity: sha512-vh9gWWJOXFVY8HBHK3Twzq8MgwG2iN4GSyzBP9sCGTe37P15x2R14VaBQk0VA0ezTRN1KHYBBsHhvpGZ2Xy/pA==} | ||
| 452 | + | ||
| 384 | '@lezer/css@1.3.9': | 453 | '@lezer/css@1.3.9': |
| 385 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} | 454 | resolution: {integrity: sha512-ZmzgvTOBdJWGIsY/ItAfN7UW8DV802oZG+jeG6E508SwEzz5YhuAajptpWPICvIyqYAD2+VjMdOS40GgGkyEOQ==} |
| 386 | 455 | ||
| 456 | + '@lezer/go@1.0.1': | ||
| 457 | + resolution: {integrity: sha512-xToRsYxwsgJNHTgNdStpcvmbVuKxTapV0dM0wey1geMMRc9aggoVyKgzYp41D2/vVOx+Ii4hmE206kvxIXBVXQ==} | ||
| 458 | + | ||
| 387 | '@lezer/highlight@1.2.5': | 459 | '@lezer/highlight@1.2.5': |
| 388 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} | 460 | resolution: {integrity: sha512-O1GMVKgtf5YspFaRzpmqkVgMtIk2HG9uMAbH6wdAIdNh3TVzCsch/+cRi+6l2//UGDKe6NB9BW3cvuR5ezMQ0w==} |
| 389 | 461 | ||
| 390 | '@lezer/html@1.3.13': | 462 | '@lezer/html@1.3.13': |
| 391 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} | 463 | resolution: {integrity: sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==} |
| 392 | 464 | ||
| 465 | + '@lezer/java@1.1.5': | ||
| 466 | + resolution: {integrity: sha512-JppTd1iKHpeNlLYw/Zl8JX7zSY5HqAzK4zZ05lpn8l8Sk7Fo5KAKiDiMiezKoT5lfeC2xZf8HeKp1tSctj4G6Q==} | ||
| 467 | + | ||
| 393 | '@lezer/javascript@1.5.6': | 468 | '@lezer/javascript@1.5.6': |
| 394 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} | 469 | resolution: {integrity: sha512-sEvOqpl4vJQca0NugSQK02vQPbc5KrvoojnYGoqqFgFO0MtcYhwGiHKVEB+LuXYJnfyXo4QPA8ztbrEa4Fw5NA==} |
| 395 | 470 | ||
| @@ -402,6 +477,18 @@ packages: | |||
| 402 | '@lezer/markdown@1.8.1': | 477 | '@lezer/markdown@1.8.1': |
| 403 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} | 478 | resolution: {integrity: sha512-M5YmEcKWO4mJ45Y1hECwqyu8cLv25EiXOK554PVOvDOWOP0olwelHHQUWr9sjF+d1bENVhy0nfJ8E57XZUTiXg==} |
| 404 | 479 | ||
| 480 | + '@lezer/php@1.0.6': | ||
| 481 | + resolution: {integrity: sha512-QJ2xNXPmsm/Z3IpThq8fnJrEIVpxhsIoj6GZBW0JYEd/l9zxpJZW216X4fzqQY4vgpdGIumypvI4uQjd4tnYtw==} | ||
| 482 | + | ||
| 483 | + '@lezer/python@1.1.19': | ||
| 484 | + resolution: {integrity: sha512-MhQIURHRytsNzP/YXnqpYKW6la6voAH3kyplTOOiCdjyFY6cWWGFVmYVdHIPrElqSDf4iCDktQCockB9FxuhzQ==} | ||
| 485 | + | ||
| 486 | + '@lezer/rust@1.0.3': | ||
| 487 | + resolution: {integrity: sha512-XxErOjZzQ7yJt1agUT4fu9qQvESZ3acgoxpPaPTPOiUx+duCjaVAtZGFIgphkHxlN05djdVAIOy/wItShMEjqQ==} | ||
| 488 | + | ||
| 489 | + '@lezer/xml@1.0.6': | ||
| 490 | + resolution: {integrity: sha512-CdDwirL0OEaStFue/66ZmFSeppuL6Dwjlk8qk153mSQwiSH/Dlri4GNymrNWnUmPl2Um7QfV1FO9KFUyX3Twww==} | ||
| 491 | + | ||
| 405 | '@lezer/yaml@1.0.4': | 492 | '@lezer/yaml@1.0.4': |
| 406 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} | 493 | resolution: {integrity: sha512-2lrrHqxalACEbxIbsjhqGpSW8kWpUKuY6RHgnSAFZa6qK62wvnPxA8hGOwOoDbwHcOFs5M4o27mjGu+P7TvBmw==} |
| 407 | 494 | ||
| @@ -1255,6 +1342,11 @@ snapshots: | |||
| 1255 | '@codemirror/view': 6.43.14 | 1342 | '@codemirror/view': 6.43.14 |
| 1256 | '@lezer/common': 1.5.4 | 1343 | '@lezer/common': 1.5.4 |
| 1257 | 1344 | ||
| 1345 | + '@codemirror/lang-cpp@6.0.3': | ||
| 1346 | + dependencies: | ||
| 1347 | + '@codemirror/language': 6.13.1 | ||
| 1348 | + '@lezer/cpp': 1.1.6 | ||
| 1349 | + | ||
| 1258 | '@codemirror/lang-css@6.3.1': | 1350 | '@codemirror/lang-css@6.3.1': |
| 1259 | dependencies: | 1351 | dependencies: |
| 1260 | '@codemirror/autocomplete': 6.20.3 | 1352 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1263,6 +1355,14 @@ snapshots: | |||
| 1263 | '@lezer/common': 1.5.4 | 1355 | '@lezer/common': 1.5.4 |
| 1264 | '@lezer/css': 1.3.9 | 1356 | '@lezer/css': 1.3.9 |
| 1265 | 1357 | ||
| 1358 | + '@codemirror/lang-go@6.0.1': | ||
| 1359 | + dependencies: | ||
| 1360 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1361 | + '@codemirror/language': 6.13.1 | ||
| 1362 | + '@codemirror/state': 6.7.6 | ||
| 1363 | + '@lezer/common': 1.5.4 | ||
| 1364 | + '@lezer/go': 1.0.1 | ||
| 1365 | + | ||
| 1266 | '@codemirror/lang-html@6.4.12': | 1366 | '@codemirror/lang-html@6.4.12': |
| 1267 | dependencies: | 1367 | dependencies: |
| 1268 | '@codemirror/autocomplete': 6.20.3 | 1368 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1275,6 +1375,11 @@ snapshots: | |||
| 1275 | '@lezer/css': 1.3.9 | 1375 | '@lezer/css': 1.3.9 |
| 1276 | '@lezer/html': 1.3.13 | 1376 | '@lezer/html': 1.3.13 |
| 1277 | 1377 | ||
| 1378 | + '@codemirror/lang-java@6.0.2': | ||
| 1379 | + dependencies: | ||
| 1380 | + '@codemirror/language': 6.13.1 | ||
| 1381 | + '@lezer/java': 1.1.5 | ||
| 1382 | + | ||
| 1278 | '@codemirror/lang-javascript@6.2.5': | 1383 | '@codemirror/lang-javascript@6.2.5': |
| 1279 | dependencies: | 1384 | dependencies: |
| 1280 | '@codemirror/autocomplete': 6.20.3 | 1385 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1300,6 +1405,45 @@ snapshots: | |||
| 1300 | '@lezer/common': 1.5.4 | 1405 | '@lezer/common': 1.5.4 |
| 1301 | '@lezer/markdown': 1.8.1 | 1406 | '@lezer/markdown': 1.8.1 |
| 1302 | 1407 | ||
| 1408 | + '@codemirror/lang-php@6.0.2': | ||
| 1409 | + dependencies: | ||
| 1410 | + '@codemirror/lang-html': 6.4.12 | ||
| 1411 | + '@codemirror/language': 6.13.1 | ||
| 1412 | + '@codemirror/state': 6.7.6 | ||
| 1413 | + '@lezer/common': 1.5.4 | ||
| 1414 | + '@lezer/php': 1.0.6 | ||
| 1415 | + | ||
| 1416 | + '@codemirror/lang-python@6.2.1': | ||
| 1417 | + dependencies: | ||
| 1418 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1419 | + '@codemirror/language': 6.13.1 | ||
| 1420 | + '@codemirror/state': 6.7.6 | ||
| 1421 | + '@lezer/common': 1.5.4 | ||
| 1422 | + '@lezer/python': 1.1.19 | ||
| 1423 | + | ||
| 1424 | + '@codemirror/lang-rust@6.0.2': | ||
| 1425 | + dependencies: | ||
| 1426 | + '@codemirror/language': 6.13.1 | ||
| 1427 | + '@lezer/rust': 1.0.3 | ||
| 1428 | + | ||
| 1429 | + '@codemirror/lang-sql@6.10.0': | ||
| 1430 | + dependencies: | ||
| 1431 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1432 | + '@codemirror/language': 6.13.1 | ||
| 1433 | + '@codemirror/state': 6.7.6 | ||
| 1434 | + '@lezer/common': 1.5.4 | ||
| 1435 | + '@lezer/highlight': 1.2.5 | ||
| 1436 | + '@lezer/lr': 1.4.11 | ||
| 1437 | + | ||
| 1438 | + '@codemirror/lang-xml@6.1.0': | ||
| 1439 | + dependencies: | ||
| 1440 | + '@codemirror/autocomplete': 6.20.3 | ||
| 1441 | + '@codemirror/language': 6.13.1 | ||
| 1442 | + '@codemirror/state': 6.7.6 | ||
| 1443 | + '@codemirror/view': 6.43.14 | ||
| 1444 | + '@lezer/common': 1.5.4 | ||
| 1445 | + '@lezer/xml': 1.0.6 | ||
| 1446 | + | ||
| 1303 | '@codemirror/lang-yaml@6.1.3': | 1447 | '@codemirror/lang-yaml@6.1.3': |
| 1304 | dependencies: | 1448 | dependencies: |
| 1305 | '@codemirror/autocomplete': 6.20.3 | 1449 | '@codemirror/autocomplete': 6.20.3 |
| @@ -1320,6 +1464,10 @@ snapshots: | |||
| 1320 | '@lezer/lr': 1.4.11 | 1464 | '@lezer/lr': 1.4.11 |
| 1321 | style-mod: 4.1.4 | 1465 | style-mod: 4.1.4 |
| 1322 | 1466 | ||
| 1467 | + '@codemirror/legacy-modes@6.5.5': | ||
| 1468 | + dependencies: | ||
| 1469 | + '@codemirror/streamparser': 6.0.0 | ||
| 1470 | + | ||
| 1323 | '@codemirror/lint@6.9.7': | 1471 | '@codemirror/lint@6.9.7': |
| 1324 | dependencies: | 1472 | dependencies: |
| 1325 | '@codemirror/state': 6.7.6 | 1473 | '@codemirror/state': 6.7.6 |
| @@ -1399,12 +1547,24 @@ snapshots: | |||
| 1399 | 1547 | ||
| 1400 | '@lezer/common@1.5.4': {} | 1548 | '@lezer/common@1.5.4': {} |
| 1401 | 1549 | ||
| 1550 | + '@lezer/cpp@1.1.6': | ||
| 1551 | + dependencies: | ||
| 1552 | + '@lezer/common': 1.5.4 | ||
| 1553 | + '@lezer/highlight': 1.2.5 | ||
| 1554 | + '@lezer/lr': 1.4.11 | ||
| 1555 | + | ||
| 1402 | '@lezer/css@1.3.9': | 1556 | '@lezer/css@1.3.9': |
| 1403 | dependencies: | 1557 | dependencies: |
| 1404 | '@lezer/common': 1.5.4 | 1558 | '@lezer/common': 1.5.4 |
| 1405 | '@lezer/highlight': 1.2.5 | 1559 | '@lezer/highlight': 1.2.5 |
| 1406 | '@lezer/lr': 1.4.11 | 1560 | '@lezer/lr': 1.4.11 |
| 1407 | 1561 | ||
| 1562 | + '@lezer/go@1.0.1': | ||
| 1563 | + dependencies: | ||
| 1564 | + '@lezer/common': 1.5.4 | ||
| 1565 | + '@lezer/highlight': 1.2.5 | ||
| 1566 | + '@lezer/lr': 1.4.11 | ||
| 1567 | + | ||
| 1408 | '@lezer/highlight@1.2.5': | 1568 | '@lezer/highlight@1.2.5': |
| 1409 | dependencies: | 1569 | dependencies: |
| 1410 | '@lezer/common': 1.5.4 | 1570 | '@lezer/common': 1.5.4 |
| @@ -1415,6 +1575,12 @@ snapshots: | |||
| 1415 | '@lezer/highlight': 1.2.5 | 1575 | '@lezer/highlight': 1.2.5 |
| 1416 | '@lezer/lr': 1.4.11 | 1576 | '@lezer/lr': 1.4.11 |
| 1417 | 1577 | ||
| 1578 | + '@lezer/java@1.1.5': | ||
| 1579 | + dependencies: | ||
| 1580 | + '@lezer/common': 1.5.4 | ||
| 1581 | + '@lezer/highlight': 1.2.5 | ||
| 1582 | + '@lezer/lr': 1.4.11 | ||
| 1583 | + | ||
| 1418 | '@lezer/javascript@1.5.6': | 1584 | '@lezer/javascript@1.5.6': |
| 1419 | dependencies: | 1585 | dependencies: |
| 1420 | '@lezer/common': 1.5.4 | 1586 | '@lezer/common': 1.5.4 |
| @@ -1436,6 +1602,30 @@ snapshots: | |||
| 1436 | '@lezer/common': 1.5.4 | 1602 | '@lezer/common': 1.5.4 |
| 1437 | '@lezer/highlight': 1.2.5 | 1603 | '@lezer/highlight': 1.2.5 |
| 1438 | 1604 | ||
| 1605 | + '@lezer/php@1.0.6': | ||
| 1606 | + dependencies: | ||
| 1607 | + '@lezer/common': 1.5.4 | ||
| 1608 | + '@lezer/highlight': 1.2.5 | ||
| 1609 | + '@lezer/lr': 1.4.11 | ||
| 1610 | + | ||
| 1611 | + '@lezer/python@1.1.19': | ||
| 1612 | + dependencies: | ||
| 1613 | + '@lezer/common': 1.5.4 | ||
| 1614 | + '@lezer/highlight': 1.2.5 | ||
| 1615 | + '@lezer/lr': 1.4.11 | ||
| 1616 | + | ||
| 1617 | + '@lezer/rust@1.0.3': | ||
| 1618 | + dependencies: | ||
| 1619 | + '@lezer/common': 1.5.4 | ||
| 1620 | + '@lezer/highlight': 1.2.5 | ||
| 1621 | + '@lezer/lr': 1.4.11 | ||
| 1622 | + | ||
| 1623 | + '@lezer/xml@1.0.6': | ||
| 1624 | + dependencies: | ||
| 1625 | + '@lezer/common': 1.5.4 | ||
| 1626 | + '@lezer/highlight': 1.2.5 | ||
| 1627 | + '@lezer/lr': 1.4.11 | ||
| 1628 | + | ||
| 1439 | '@lezer/yaml@1.0.4': | 1629 | '@lezer/yaml@1.0.4': |
| 1440 | dependencies: | 1630 | dependencies: |
| 1441 | '@lezer/common': 1.5.4 | 1631 | '@lezer/common': 1.5.4 |
modified
frontend/src/lib/agent/AddAgentForm.svelte +42 -6 | @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 9 | 9 | import { FilesDropped } from '../../../bindings/events' |
| 10 | - import { argumentsFor, emptyForm, knownPrograms, nameFromTitle, problemsOf, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | |
| 10 | + import { argumentsFor, emptyForm, nameFromTitle, sandboxMismatch, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | |
| 11 | 11 | import { subscribe } from '../events' |
| 12 | 12 | import AgentAvatar from './AgentAvatar.svelte' |
| 13 | 13 | import { agentAdded, appState } from '../state.svelte' |
| @@ -23,6 +23,8 @@ | ||
| 23 | 23 | // Why the last sbx environment file could not be read, and which one was. |
| 24 | 24 | let envProblem = $state('') |
| 25 | 25 | let envFile = $state('') |
| 26 | + // The sbx agent of that file ("agent:"), to catch Codex given Claude's sandbox. | |
| 27 | + let envAgent = $state('') | |
| 26 | 28 | // The agent's configuration file dropped or chosen, and why one was refused. |
| 27 | 29 | let configFile = $state('') |
| 28 | 30 | let configProblem = $state('') |
| @@ -93,13 +95,29 @@ | ||
| 93 | 95 | try { |
| 94 | 96 | const env = await ConfigService.ReadSandboxEnv(path) |
| 95 | 97 | form = withSandboxEnv(form, env) |
| 98 | + // mm or docker-agent chosen from the file start with their configuration | |
| 99 | + // file: the one already given, or else the agent.yaml of the sandbox's | |
| 100 | + // workspace (issue #87). | |
| 101 | + const file = configFile || env.agentFile || '' | |
| 102 | + const args = file ? argumentsFor(form.program, file) : undefined | |
| 103 | + if (args !== undefined) { | |
| 104 | + form.arguments = args | |
| 105 | + configFile = file | |
| 106 | + configProblem = '' | |
| 107 | + } | |
| 96 | 108 | envFile = path |
| 109 | + envAgent = env.agent ?? '' | |
| 97 | 110 | } catch (error) { |
| 98 | 111 | envProblem = error instanceof Error ? error.message : String(error) |
| 99 | 112 | } |
| 100 | 113 | } |
| 101 | 114 | |
| 102 | 115 | |
| 116 | + // Claude, Codex or Gemini in an sbx sandbox (issues #81, #82, #84): its | |
| 117 | + // sbxenv.yaml, dropped above, gives the sandbox; it needs no configuration file. | |
| 118 | + const sbxAgent = $derived(sbxAgentOf(form)) | |
| 119 | + const mismatch = $derived(sandboxMismatch(form, envAgent)) | |
| 120 | + | |
| 103 | 121 | function useAgentConfig(path: string) { |
| 104 | 122 | if (!/\.ya?ml$/i.test(path)) { |
| 105 | 123 | configProblem = t('assistant.agentConfig.notYaml') |
| @@ -120,7 +138,15 @@ | ||
| 120 | 138 | } |
| 121 | 139 | |
| 122 | 140 | // Choosing another program after a file was given starts it with that file. |
| 141 | + // Claude, Codex or Gemini in a sandbox start with their own arguments | |
| 142 | + // (Gemini CLI: --acp), unless some were typed. | |
| 123 | 143 | function onProgram() { |
| 144 | + const agent = sbxAgentOf(form) | |
| 145 | + if (agent) { | |
| 146 | + const known = Object.values(sbxArguments) | |
| 147 | + if (!form.arguments.trim() || known.includes(form.arguments.trim())) form.arguments = sbxArguments[agent] | |
| 148 | + return | |
| 149 | + } | |
| 124 | 150 | if (!configFile) return |
| 125 | 151 | const args = argumentsFor(form.program, configFile) |
| 126 | 152 | if (args !== undefined) form.arguments = args |
| @@ -140,7 +166,7 @@ | ||
| 140 | 166 | tried = true |
| 141 | 167 | refused = [] |
| 142 | 168 | failure = '' |
| 143 | - if (missing.length > 0) return | |
| 169 | + if (missing.length > 0 || mismatch) return | |
| 144 | 170 | adding = true |
| 145 | 171 | try { |
| 146 | 172 | const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? [] |
| @@ -258,14 +284,21 @@ | ||
| 258 | 284 | {t('assistant.program')} |
| 259 | 285 | <input bind:value={form.program} oninput={onProgram} list="known-programs" placeholder={t('assistant.programPlaceholder')} aria-invalid={has('program')} aria-describedby="program-hint" spellcheck="false" autocapitalize="off" /> |
| 260 | 286 | <datalist id="known-programs"> |
| 261 | - {#each knownPrograms as program (program)}<option value={program}></option>{/each} | |
| 287 | + {#each programsFor(form.environment) as program (program)}<option value={program}></option>{/each} | |
| 262 | 288 | </datalist> |
| 263 | - <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : t('assistant.programHint')}</small> | |
| 289 | + <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : form.environment === 'sbx' ? t('assistant.programHintSbx') : t('assistant.programHint')}</small> | |
| 264 | 290 | </label> |
| 291 | + {#if sbxAgent} | |
| 292 | + <small class="note">{t(`assistant.${sbxAgent}Note`)}</small> | |
| 293 | + {/if} | |
| 294 | + {#if mismatch && sbxAgent} | |
| 295 | + <small class="problem" role="alert">{t('assistant.sandboxMismatch', { file: envFile, agent: mismatch, wanted: sbxAgent })}</small> | |
| 296 | + {/if} | |
| 265 | 297 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the |
| 266 | 298 | same path, and so must the container (as with docker exec today), so |
| 267 | 299 | the file's path on this computer is also its path there. --> |
| 268 | - <div id={configTarget} class="dropzone" data-file-drop-target> | |
| 300 | + <!-- Claude, Codex and Gemini have no configuration file to give. --> | |
| 301 | + <div id={configTarget} class="dropzone" class:hidden={sbxAgent !== undefined} data-file-drop-target> | |
| 269 | 302 | <div class="row centered"> |
| 270 | 303 | <p class="grow"> |
| 271 | 304 | <strong>{t('assistant.agentConfig.title')}</strong> |
| @@ -286,7 +319,8 @@ | ||
| 286 | 319 | </div> |
| 287 | 320 | <label> |
| 288 | 321 | {t('assistant.arguments')} |
| 289 | - <input bind:value={form.arguments} placeholder={t('assistant.argumentsPlaceholder')} spellcheck="false" autocapitalize="off" /> | |
| 322 | + <input bind:value={form.arguments} placeholder={t('assistant.argumentsPlaceholder')} aria-invalid={has('agentFile')} spellcheck="false" autocapitalize="off" /> | |
| 323 | + {#if has('agentFile')}<small class="problem" role="alert">{t('assistant.missing.agentFile')}</small>{/if} | |
| 290 | 324 | </label> |
| 291 | 325 | <label for="workspace">{t('assistant.workspace')}</label> |
| 292 | 326 | <div class="row centered"> |
| @@ -340,5 +374,7 @@ | ||
| 340 | 374 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } |
| 341 | 375 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } |
| 342 | 376 | .actions { display: flex; justify-content: flex-end; gap: 8px; } |
| 377 | + .hidden { display: none; } | |
| 378 | + .note { margin-top: -4px; } | |
| 343 | 379 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } |
| 344 | 380 | </style> |
| @@ -7,7 +7,7 @@ | |||
| 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 9 | import { FilesDropped } from '../../../bindings/events' | 9 | import { FilesDropped } from '../../../bindings/events' |
| 10 | - import { argumentsFor, emptyForm, knownPrograms, nameFromTitle, problemsOf, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | 10 | + import { argumentsFor, emptyForm, nameFromTitle, sandboxMismatch, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' |
| 11 | import { subscribe } from '../events' | 11 | import { subscribe } from '../events' |
| 12 | import AgentAvatar from './AgentAvatar.svelte' | 12 | import AgentAvatar from './AgentAvatar.svelte' |
| 13 | import { agentAdded, appState } from '../state.svelte' | 13 | import { agentAdded, appState } from '../state.svelte' |
| @@ -23,6 +23,8 @@ | |||
| 23 | // Why the last sbx environment file could not be read, and which one was. | 23 | // Why the last sbx environment file could not be read, and which one was. |
| 24 | let envProblem = $state('') | 24 | let envProblem = $state('') |
| 25 | let envFile = $state('') | 25 | let envFile = $state('') |
| 26 | + // The sbx agent of that file ("agent:"), to catch Codex given Claude's sandbox. | ||
| 27 | + let envAgent = $state('') | ||
| 26 | // The agent's configuration file dropped or chosen, and why one was refused. | 28 | // The agent's configuration file dropped or chosen, and why one was refused. |
| 27 | let configFile = $state('') | 29 | let configFile = $state('') |
| 28 | let configProblem = $state('') | 30 | let configProblem = $state('') |
| @@ -93,13 +95,29 @@ | |||
| 93 | try { | 95 | try { |
| 94 | const env = await ConfigService.ReadSandboxEnv(path) | 96 | const env = await ConfigService.ReadSandboxEnv(path) |
| 95 | form = withSandboxEnv(form, env) | 97 | form = withSandboxEnv(form, env) |
| 98 | + // mm or docker-agent chosen from the file start with their configuration | ||
| 99 | + // file: the one already given, or else the agent.yaml of the sandbox's | ||
| 100 | + // workspace (issue #87). | ||
| 101 | + const file = configFile || env.agentFile || '' | ||
| 102 | + const args = file ? argumentsFor(form.program, file) : undefined | ||
| 103 | + if (args !== undefined) { | ||
| 104 | + form.arguments = args | ||
| 105 | + configFile = file | ||
| 106 | + configProblem = '' | ||
| 107 | + } | ||
| 96 | envFile = path | 108 | envFile = path |
| 109 | + envAgent = env.agent ?? '' | ||
| 97 | } catch (error) { | 110 | } catch (error) { |
| 98 | envProblem = error instanceof Error ? error.message : String(error) | 111 | envProblem = error instanceof Error ? error.message : String(error) |
| 99 | } | 112 | } |
| 100 | } | 113 | } |
| 101 | 114 | ||
| 102 | 115 | ||
| 116 | + // Claude, Codex or Gemini in an sbx sandbox (issues #81, #82, #84): its | ||
| 117 | + // sbxenv.yaml, dropped above, gives the sandbox; it needs no configuration file. | ||
| 118 | + const sbxAgent = $derived(sbxAgentOf(form)) | ||
| 119 | + const mismatch = $derived(sandboxMismatch(form, envAgent)) | ||
| 120 | + | ||
| 103 | function useAgentConfig(path: string) { | 121 | function useAgentConfig(path: string) { |
| 104 | if (!/\.ya?ml$/i.test(path)) { | 122 | if (!/\.ya?ml$/i.test(path)) { |
| 105 | configProblem = t('assistant.agentConfig.notYaml') | 123 | configProblem = t('assistant.agentConfig.notYaml') |
| @@ -120,7 +138,15 @@ | |||
| 120 | } | 138 | } |
| 121 | 139 | ||
| 122 | // Choosing another program after a file was given starts it with that file. | 140 | // Choosing another program after a file was given starts it with that file. |
| 141 | + // Claude, Codex or Gemini in a sandbox start with their own arguments | ||
| 142 | + // (Gemini CLI: --acp), unless some were typed. | ||
| 123 | function onProgram() { | 143 | function onProgram() { |
| 144 | + const agent = sbxAgentOf(form) | ||
| 145 | + if (agent) { | ||
| 146 | + const known = Object.values(sbxArguments) | ||
| 147 | + if (!form.arguments.trim() || known.includes(form.arguments.trim())) form.arguments = sbxArguments[agent] | ||
| 148 | + return | ||
| 149 | + } | ||
| 124 | if (!configFile) return | 150 | if (!configFile) return |
| 125 | const args = argumentsFor(form.program, configFile) | 151 | const args = argumentsFor(form.program, configFile) |
| 126 | if (args !== undefined) form.arguments = args | 152 | if (args !== undefined) form.arguments = args |
| @@ -140,7 +166,7 @@ | |||
| 140 | tried = true | 166 | tried = true |
| 141 | refused = [] | 167 | refused = [] |
| 142 | failure = '' | 168 | failure = '' |
| 143 | - if (missing.length > 0) return | 169 | + if (missing.length > 0 || mismatch) return |
| 144 | adding = true | 170 | adding = true |
| 145 | try { | 171 | try { |
| 146 | const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? [] | 172 | const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? [] |
| @@ -258,14 +284,21 @@ | |||
| 258 | {t('assistant.program')} | 284 | {t('assistant.program')} |
| 259 | <input bind:value={form.program} oninput={onProgram} list="known-programs" placeholder={t('assistant.programPlaceholder')} aria-invalid={has('program')} aria-describedby="program-hint" spellcheck="false" autocapitalize="off" /> | 285 | <input bind:value={form.program} oninput={onProgram} list="known-programs" placeholder={t('assistant.programPlaceholder')} aria-invalid={has('program')} aria-describedby="program-hint" spellcheck="false" autocapitalize="off" /> |
| 260 | <datalist id="known-programs"> | 286 | <datalist id="known-programs"> |
| 261 | - {#each knownPrograms as program (program)}<option value={program}></option>{/each} | 287 | + {#each programsFor(form.environment) as program (program)}<option value={program}></option>{/each} |
| 262 | </datalist> | 288 | </datalist> |
| 263 | - <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : t('assistant.programHint')}</small> | 289 | + <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : form.environment === 'sbx' ? t('assistant.programHintSbx') : t('assistant.programHint')}</small> |
| 264 | </label> | 290 | </label> |
| 291 | + {#if sbxAgent} | ||
| 292 | + <small class="note">{t(`assistant.${sbxAgent}Note`)}</small> | ||
| 293 | + {/if} | ||
| 294 | + {#if mismatch && sbxAgent} | ||
| 295 | + <small class="problem" role="alert">{t('assistant.sandboxMismatch', { file: envFile, agent: mismatch, wanted: sbxAgent })}</small> | ||
| 296 | + {/if} | ||
| 265 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the | 297 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the |
| 266 | same path, and so must the container (as with docker exec today), so | 298 | same path, and so must the container (as with docker exec today), so |
| 267 | the file's path on this computer is also its path there. --> | 299 | the file's path on this computer is also its path there. --> |
| 268 | - <div id={configTarget} class="dropzone" data-file-drop-target> | 300 | + <!-- Claude, Codex and Gemini have no configuration file to give. --> |
| 301 | + <div id={configTarget} class="dropzone" class:hidden={sbxAgent !== undefined} data-file-drop-target> | ||
| 269 | <div class="row centered"> | 302 | <div class="row centered"> |
| 270 | <p class="grow"> | 303 | <p class="grow"> |
| 271 | <strong>{t('assistant.agentConfig.title')}</strong> | 304 | <strong>{t('assistant.agentConfig.title')}</strong> |
| @@ -286,7 +319,8 @@ | |||
| 286 | </div> | 319 | </div> |
| 287 | <label> | 320 | <label> |
| 288 | {t('assistant.arguments')} | 321 | {t('assistant.arguments')} |
| 289 | - <input bind:value={form.arguments} placeholder={t('assistant.argumentsPlaceholder')} spellcheck="false" autocapitalize="off" /> | 322 | + <input bind:value={form.arguments} placeholder={t('assistant.argumentsPlaceholder')} aria-invalid={has('agentFile')} spellcheck="false" autocapitalize="off" /> |
| 323 | + {#if has('agentFile')}<small class="problem" role="alert">{t('assistant.missing.agentFile')}</small>{/if} | ||
| 290 | </label> | 324 | </label> |
| 291 | <label for="workspace">{t('assistant.workspace')}</label> | 325 | <label for="workspace">{t('assistant.workspace')}</label> |
| 292 | <div class="row centered"> | 326 | <div class="row centered"> |
| @@ -340,5 +374,7 @@ | |||
| 340 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } | 374 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } |
| 341 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } | 375 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } |
| 342 | .actions { display: flex; justify-content: flex-end; gap: 8px; } | 376 | .actions { display: flex; justify-content: flex-end; gap: 8px; } |
| 377 | + .hidden { display: none; } | ||
| 378 | + .note { margin-top: -4px; } | ||
| 343 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | 379 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } |
| 344 | </style> | 380 | </style> |
modified
frontend/src/lib/agent/AgentView.svelte +62 -11 | @@ -1,17 +1,26 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | +<script lang="ts" module> | |
| 3 | + // The tab shown last for each agent: coming back to an agent shows its | |
| 4 | + // terminals again if they were in view (issue #72). | |
| 5 | + const lastTab: Record<string, 'files' | 'terminal' | 'log'> = {} | |
| 6 | +</script> | |
| 7 | + | |
| 2 | 8 | <script lang="ts"> |
| 3 | 9 | // An agent's workspace in the centre (wireframe 5, issue #27): its state |
| 4 | 10 | // and where it runs, then its files, a terminal and its log. |
| 5 | 11 | import { onMount } from 'svelte' |
| 6 | 12 | import { AgentService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 7 | 13 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' |
| 8 | - import { act, appState, openDirect } from '../state.svelte' | |
| 14 | + import { act, appState, loadCommands, openDirect } from '../state.svelte' | |
| 9 | 15 | import ActionError from '../chat/ActionError.svelte' |
| 10 | 16 | import AgentAvatar from './AgentAvatar.svelte' |
| 11 | 17 | import AgentLog from './AgentLog.svelte' |
| 12 | 18 | import FilesTab from './FilesTab.svelte' |
| 13 | 19 | import TerminalView from './TerminalView.svelte' |
| 14 | 20 | import ErrorText from '../chat/ErrorText.svelte' |
| 21 | + import { activeTerminal, closeTerminal, newTerminal, runningTerminals, terminalsOf } from '../terminalSessions.svelte' | |
| 22 | + import { maxTerminalsPerAgent } from '../terminals' | |
| 23 | + import { canUnload, unloadReady } from '../unload' | |
| 15 | 24 | |
| 16 | 25 | let { agent: name }: { agent: string } = $props() |
| 17 | 26 | |
| @@ -20,11 +29,14 @@ | ||
| 20 | 29 | const stateKey = $derived(`agent.state.${agent?.state ?? ''}`) |
| 21 | 30 | |
| 22 | 31 | type Tab = 'files' | 'terminal' | 'log' |
| 23 | - let tab: Tab = $state('files') | |
| 24 | - // The terminal is kept once opened, hidden on the other tabs, so that its | |
| 25 | - // shell survives a look at the files. | |
| 26 | - let terminalOpened = $state(false) | |
| 32 | + // svelte-ignore state_referenced_locally | |
| 33 | + let tab: Tab = $state(lastTab[name] ?? 'files') | |
| 34 | + // The terminals of the agent (issues #72 and #73) live outside this view: | |
| 35 | + // they keep running when it goes away. | |
| 36 | + const terminals = $derived(terminalsOf(name)) | |
| 37 | + const current = $derived(terminals.find((session) => session.key === activeTerminal[name]) ?? terminals[0]) | |
| 27 | 38 | let location = $state('') |
| 39 | + let revealable = $state(false) | |
| 28 | 40 | let problem = $state('') |
| 29 | 41 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. |
| 30 | 42 | let confirmingRemove = $state(false) |
| @@ -44,12 +56,16 @@ | ||
| 44 | 56 | |
| 45 | 57 | function show(next: Tab) { |
| 46 | 58 | tab = next |
| 47 | - if (next === 'terminal') terminalOpened = true | |
| 59 | + lastTab[name] = next | |
| 60 | + // The first look at the Terminal tab opens a shell. | |
| 61 | + if (next === 'terminal' && terminals.length === 0) newTerminal(name) | |
| 48 | 62 | } |
| 49 | 63 | |
| 50 | 64 | onMount(async () => { |
| 65 | + void loadCommands(name) | |
| 51 | 66 | const info = await WorkspaceService.Info(name) |
| 52 | 67 | location = info?.location ?? '' |
| 68 | + revealable = info?.revealable ?? false | |
| 53 | 69 | problem = info?.problem ?? '' |
| 54 | 70 | }) |
| 55 | 71 | </script> |
| @@ -70,6 +86,9 @@ | ||
| 70 | 86 | {#if agent.state === 'stopped' || agent.state === 'error'} |
| 71 | 87 | <button onclick={() => act(() => AgentService.Start(name))}>{t('workspace.start')}</button> |
| 72 | 88 | {:else} |
| 89 | + {#if canUnload(appState.commands[name])} | |
| 90 | + <button disabled={!unloadReady(agent.state)} onclick={() => act(() => AgentService.Unload(name))} title={t('unload.oneHelp', { agent: agent.title })}>{t('unload.one')}</button> | |
| 91 | + {/if} | |
| 73 | 92 | <button onclick={() => act(() => AgentService.Restart(name))}>{t('workspace.restart')}</button> |
| 74 | 93 | <button class="stop" onclick={() => act(() => AgentService.Stop(name))}>{t('workspace.stop')}</button> |
| 75 | 94 | {/if} |
| @@ -91,7 +110,9 @@ | ||
| 91 | 110 | |
| 92 | 111 | <div class="tabs" role="tablist"> |
| 93 | 112 | {#each ['files', 'terminal', 'log'] as const as each (each)} |
| 94 | - <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}>{t(`workspace.tab.${each}`)}</button> | |
| 113 | + <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}> | |
| 114 | + {t(`workspace.tab.${each}`)}{#if each === 'terminal' && runningTerminals(name) > 0}<span class="count" title={t('terminal.running', { count: runningTerminals(name) })}>{runningTerminals(name)}</span>{/if} | |
| 115 | + </button> | |
| 95 | 116 | {/each} |
| 96 | 117 | </div> |
| 97 | 118 | |
| @@ -102,11 +123,28 @@ | ||
| 102 | 123 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> |
| 103 | 124 | {:else} |
| 104 | 125 | <div class="pane" class:hidden={tab !== 'files'}> |
| 105 | - <FilesTab agent={name} inContainer={!location.startsWith('local')} /> | |
| 126 | + <FilesTab agent={name} inContainer={!location.startsWith('local')} {revealable} /> | |
| 106 | 127 | </div> |
| 107 | - {#if terminalOpened} | |
| 108 | - <div class="pane" class:hidden={tab !== 'terminal'}> | |
| 109 | - <TerminalView agent={name} visible={tab === 'terminal'} /> | |
| 128 | + {#if tab === 'terminal'} | |
| 129 | + <div class="pane terminals"> | |
| 130 | + <div class="terminal-tabs" role="tablist" aria-label={t('terminal.list')}> | |
| 131 | + {#each terminals as session (session.key)} | |
| 132 | + <span class="terminal-tab" class:active={session.key === current?.key} class:ended={session.ended}> | |
| 133 | + <button role="tab" aria-selected={session.key === current?.key} onclick={() => (activeTerminal[name] = session.key)}> | |
| 134 | + {t('terminal.name', { number: session.number })} | |
| 135 | + </button> | |
| 136 | + <button class="close" onclick={() => closeTerminal(session.key)} aria-label={t('terminal.close', { name: t('terminal.name', { number: session.number }) })} title={t('terminal.close', { name: t('terminal.name', { number: session.number }) })}>×</button> | |
| 137 | + </span> | |
| 138 | + {/each} | |
| 139 | + <button class="add" onclick={() => newTerminal(name)} disabled={terminals.length >= maxTerminalsPerAgent} title={terminals.length >= maxTerminalsPerAgent ? t('terminal.limit', { count: maxTerminalsPerAgent }) : t('terminal.new')} aria-label={t('terminal.new')}>+</button> | |
| 140 | + </div> | |
| 141 | + {#if current} | |
| 142 | + {#key current.key} | |
| 143 | + <div class="terminal-pane"><TerminalView session={current} visible={tab === 'terminal'} /></div> | |
| 144 | + {/key} | |
| 145 | + {:else} | |
| 146 | + <p class="no-terminal">{t('terminal.none')}</p> | |
| 147 | + {/if} | |
| 110 | 148 | </div> |
| 111 | 149 | {/if} |
| 112 | 150 | {/if} |
| @@ -137,5 +175,18 @@ | ||
| 137 | 175 | .body { flex: 1; min-height: 0; padding: 12px 18px 14px; display: flex; flex-direction: column; } |
| 138 | 176 | .pane { flex: 1; min-height: 0; } |
| 139 | 177 | .hidden { display: none; } |
| 178 | + .count { margin-left: 6px; padding: 0 6px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; } | |
| 179 | + .terminals { display: flex; flex-direction: column; gap: 6px; } | |
| 180 | + .terminal-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } | |
| 181 | + .terminal-tab { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; overflow: hidden; } | |
| 182 | + .terminal-tab button { border: none; border-radius: 0; background: none; padding: 3px 8px; font-size: 12px; } | |
| 183 | + .terminal-tab .close { padding: 3px 6px; color: var(--muted); } | |
| 184 | + .terminal-tab .close:hover { color: var(--danger); } | |
| 185 | + .terminal-tab.active { border-color: var(--accent); } | |
| 186 | + .terminal-tab.active button:first-child { color: var(--accent); font-weight: 600; } | |
| 187 | + .terminal-tab.ended button:first-child { text-decoration: line-through; color: var(--muted); } | |
| 188 | + .add { border: 1px dashed var(--border); background: none; padding: 2px 8px; font-size: 12px; } | |
| 189 | + .terminal-pane { flex: 1; min-height: 0; } | |
| 190 | + .no-terminal { color: var(--muted); font-size: 13px; } | |
| 140 | 191 | .error { color: var(--danger); font-size: 13px; margin: 6px 18px; } |
| 141 | 192 | </style> |
| @@ -1,17 +1,26 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | +<script lang="ts" module> | ||
| 3 | + // The tab shown last for each agent: coming back to an agent shows its | ||
| 4 | + // terminals again if they were in view (issue #72). | ||
| 5 | + const lastTab: Record<string, 'files' | 'terminal' | 'log'> = {} | ||
| 6 | +</script> | ||
| 7 | + | ||
| 2 | <script lang="ts"> | 8 | <script lang="ts"> |
| 3 | // An agent's workspace in the centre (wireframe 5, issue #27): its state | 9 | // An agent's workspace in the centre (wireframe 5, issue #27): its state |
| 4 | // and where it runs, then its files, a terminal and its log. | 10 | // and where it runs, then its files, a terminal and its log. |
| 5 | import { onMount } from 'svelte' | 11 | import { onMount } from 'svelte' |
| 6 | import { AgentService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 12 | import { AgentService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 7 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' | 13 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' |
| 8 | - import { act, appState, openDirect } from '../state.svelte' | 14 | + import { act, appState, loadCommands, openDirect } from '../state.svelte' |
| 9 | import ActionError from '../chat/ActionError.svelte' | 15 | import ActionError from '../chat/ActionError.svelte' |
| 10 | import AgentAvatar from './AgentAvatar.svelte' | 16 | import AgentAvatar from './AgentAvatar.svelte' |
| 11 | import AgentLog from './AgentLog.svelte' | 17 | import AgentLog from './AgentLog.svelte' |
| 12 | import FilesTab from './FilesTab.svelte' | 18 | import FilesTab from './FilesTab.svelte' |
| 13 | import TerminalView from './TerminalView.svelte' | 19 | import TerminalView from './TerminalView.svelte' |
| 14 | import ErrorText from '../chat/ErrorText.svelte' | 20 | import ErrorText from '../chat/ErrorText.svelte' |
| 21 | + import { activeTerminal, closeTerminal, newTerminal, runningTerminals, terminalsOf } from '../terminalSessions.svelte' | ||
| 22 | + import { maxTerminalsPerAgent } from '../terminals' | ||
| 23 | + import { canUnload, unloadReady } from '../unload' | ||
| 15 | 24 | ||
| 16 | let { agent: name }: { agent: string } = $props() | 25 | let { agent: name }: { agent: string } = $props() |
| 17 | 26 | ||
| @@ -20,11 +29,14 @@ | |||
| 20 | const stateKey = $derived(`agent.state.${agent?.state ?? ''}`) | 29 | const stateKey = $derived(`agent.state.${agent?.state ?? ''}`) |
| 21 | 30 | ||
| 22 | type Tab = 'files' | 'terminal' | 'log' | 31 | type Tab = 'files' | 'terminal' | 'log' |
| 23 | - let tab: Tab = $state('files') | 32 | + // svelte-ignore state_referenced_locally |
| 24 | - // The terminal is kept once opened, hidden on the other tabs, so that its | 33 | + let tab: Tab = $state(lastTab[name] ?? 'files') |
| 25 | - // shell survives a look at the files. | 34 | + // The terminals of the agent (issues #72 and #73) live outside this view: |
| 26 | - let terminalOpened = $state(false) | 35 | + // they keep running when it goes away. |
| 36 | + const terminals = $derived(terminalsOf(name)) | ||
| 37 | + const current = $derived(terminals.find((session) => session.key === activeTerminal[name]) ?? terminals[0]) | ||
| 27 | let location = $state('') | 38 | let location = $state('') |
| 39 | + let revealable = $state(false) | ||
| 28 | let problem = $state('') | 40 | let problem = $state('') |
| 29 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. | 41 | // The sandbox commands of runtime.lifecycle (issue #47); removing asks first. |
| 30 | let confirmingRemove = $state(false) | 42 | let confirmingRemove = $state(false) |
| @@ -44,12 +56,16 @@ | |||
| 44 | 56 | ||
| 45 | function show(next: Tab) { | 57 | function show(next: Tab) { |
| 46 | tab = next | 58 | tab = next |
| 47 | - if (next === 'terminal') terminalOpened = true | 59 | + lastTab[name] = next |
| 60 | + // The first look at the Terminal tab opens a shell. | ||
| 61 | + if (next === 'terminal' && terminals.length === 0) newTerminal(name) | ||
| 48 | } | 62 | } |
| 49 | 63 | ||
| 50 | onMount(async () => { | 64 | onMount(async () => { |
| 65 | + void loadCommands(name) | ||
| 51 | const info = await WorkspaceService.Info(name) | 66 | const info = await WorkspaceService.Info(name) |
| 52 | location = info?.location ?? '' | 67 | location = info?.location ?? '' |
| 68 | + revealable = info?.revealable ?? false | ||
| 53 | problem = info?.problem ?? '' | 69 | problem = info?.problem ?? '' |
| 54 | }) | 70 | }) |
| 55 | </script> | 71 | </script> |
| @@ -70,6 +86,9 @@ | |||
| 70 | {#if agent.state === 'stopped' || agent.state === 'error'} | 86 | {#if agent.state === 'stopped' || agent.state === 'error'} |
| 71 | <button onclick={() => act(() => AgentService.Start(name))}>{t('workspace.start')}</button> | 87 | <button onclick={() => act(() => AgentService.Start(name))}>{t('workspace.start')}</button> |
| 72 | {:else} | 88 | {:else} |
| 89 | + {#if canUnload(appState.commands[name])} | ||
| 90 | + <button disabled={!unloadReady(agent.state)} onclick={() => act(() => AgentService.Unload(name))} title={t('unload.oneHelp', { agent: agent.title })}>{t('unload.one')}</button> | ||
| 91 | + {/if} | ||
| 73 | <button onclick={() => act(() => AgentService.Restart(name))}>{t('workspace.restart')}</button> | 92 | <button onclick={() => act(() => AgentService.Restart(name))}>{t('workspace.restart')}</button> |
| 74 | <button class="stop" onclick={() => act(() => AgentService.Stop(name))}>{t('workspace.stop')}</button> | 93 | <button class="stop" onclick={() => act(() => AgentService.Stop(name))}>{t('workspace.stop')}</button> |
| 75 | {/if} | 94 | {/if} |
| @@ -91,7 +110,9 @@ | |||
| 91 | 110 | ||
| 92 | <div class="tabs" role="tablist"> | 111 | <div class="tabs" role="tablist"> |
| 93 | {#each ['files', 'terminal', 'log'] as const as each (each)} | 112 | {#each ['files', 'terminal', 'log'] as const as each (each)} |
| 94 | - <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}>{t(`workspace.tab.${each}`)}</button> | 113 | + <button role="tab" aria-selected={tab === each} class:active={tab === each} onclick={() => show(each)}> |
| 114 | + {t(`workspace.tab.${each}`)}{#if each === 'terminal' && runningTerminals(name) > 0}<span class="count" title={t('terminal.running', { count: runningTerminals(name) })}>{runningTerminals(name)}</span>{/if} | ||
| 115 | + </button> | ||
| 95 | {/each} | 116 | {/each} |
| 96 | </div> | 117 | </div> |
| 97 | 118 | ||
| @@ -102,11 +123,28 @@ | |||
| 102 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> | 123 | <div class="error">{t('workspace.unavailable', { agent: agent.title })} <ErrorText raw={problem} /></div> |
| 103 | {:else} | 124 | {:else} |
| 104 | <div class="pane" class:hidden={tab !== 'files'}> | 125 | <div class="pane" class:hidden={tab !== 'files'}> |
| 105 | - <FilesTab agent={name} inContainer={!location.startsWith('local')} /> | 126 | + <FilesTab agent={name} inContainer={!location.startsWith('local')} {revealable} /> |
| 106 | </div> | 127 | </div> |
| 107 | - {#if terminalOpened} | 128 | + {#if tab === 'terminal'} |
| 108 | - <div class="pane" class:hidden={tab !== 'terminal'}> | 129 | + <div class="pane terminals"> |
| 109 | - <TerminalView agent={name} visible={tab === 'terminal'} /> | 130 | + <div class="terminal-tabs" role="tablist" aria-label={t('terminal.list')}> |
| 131 | + {#each terminals as session (session.key)} | ||
| 132 | + <span class="terminal-tab" class:active={session.key === current?.key} class:ended={session.ended}> | ||
| 133 | + <button role="tab" aria-selected={session.key === current?.key} onclick={() => (activeTerminal[name] = session.key)}> | ||
| 134 | + {t('terminal.name', { number: session.number })} | ||
| 135 | + </button> | ||
| 136 | + <button class="close" onclick={() => closeTerminal(session.key)} aria-label={t('terminal.close', { name: t('terminal.name', { number: session.number }) })} title={t('terminal.close', { name: t('terminal.name', { number: session.number }) })}>×</button> | ||
| 137 | + </span> | ||
| 138 | + {/each} | ||
| 139 | + <button class="add" onclick={() => newTerminal(name)} disabled={terminals.length >= maxTerminalsPerAgent} title={terminals.length >= maxTerminalsPerAgent ? t('terminal.limit', { count: maxTerminalsPerAgent }) : t('terminal.new')} aria-label={t('terminal.new')}>+</button> | ||
| 140 | + </div> | ||
| 141 | + {#if current} | ||
| 142 | + {#key current.key} | ||
| 143 | + <div class="terminal-pane"><TerminalView session={current} visible={tab === 'terminal'} /></div> | ||
| 144 | + {/key} | ||
| 145 | + {:else} | ||
| 146 | + <p class="no-terminal">{t('terminal.none')}</p> | ||
| 147 | + {/if} | ||
| 110 | </div> | 148 | </div> |
| 111 | {/if} | 149 | {/if} |
| 112 | {/if} | 150 | {/if} |
| @@ -137,5 +175,18 @@ | |||
| 137 | .body { flex: 1; min-height: 0; padding: 12px 18px 14px; display: flex; flex-direction: column; } | 175 | .body { flex: 1; min-height: 0; padding: 12px 18px 14px; display: flex; flex-direction: column; } |
| 138 | .pane { flex: 1; min-height: 0; } | 176 | .pane { flex: 1; min-height: 0; } |
| 139 | .hidden { display: none; } | 177 | .hidden { display: none; } |
| 178 | + .count { margin-left: 6px; padding: 0 6px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; } | ||
| 179 | + .terminals { display: flex; flex-direction: column; gap: 6px; } | ||
| 180 | + .terminal-tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } | ||
| 181 | + .terminal-tab { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; overflow: hidden; } | ||
| 182 | + .terminal-tab button { border: none; border-radius: 0; background: none; padding: 3px 8px; font-size: 12px; } | ||
| 183 | + .terminal-tab .close { padding: 3px 6px; color: var(--muted); } | ||
| 184 | + .terminal-tab .close:hover { color: var(--danger); } | ||
| 185 | + .terminal-tab.active { border-color: var(--accent); } | ||
| 186 | + .terminal-tab.active button:first-child { color: var(--accent); font-weight: 600; } | ||
| 187 | + .terminal-tab.ended button:first-child { text-decoration: line-through; color: var(--muted); } | ||
| 188 | + .add { border: 1px dashed var(--border); background: none; padding: 2px 8px; font-size: 12px; } | ||
| 189 | + .terminal-pane { flex: 1; min-height: 0; } | ||
| 190 | + .no-terminal { color: var(--muted); font-size: 13px; } | ||
| 140 | .error { color: var(--danger); font-size: 13px; margin: 6px 18px; } | 191 | .error { color: var(--danger); font-size: 13px; margin: 6px 18px; } |
| 141 | </style> | 192 | </style> |
modified
frontend/src/lib/agent/FileEditor.svelte +20 -11 | @@ -1,16 +1,16 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the |
| 4 | - // Settings panel, with the language of the file and ⌘S to save. | |
| 4 | + // Settings panel, with ⌘S to save, coloured according to the language of | |
| 5 | + // the file (issue #71), loaded once the text is shown. | |
| 5 | 6 | import { onMount } from 'svelte' |
| 6 | 7 | import { EditorView, basicSetup } from 'codemirror' |
| 7 | 8 | import { keymap } from '@codemirror/view' |
| 8 | - import { EditorState } from '@codemirror/state' | |
| 9 | - import { yaml } from '@codemirror/lang-yaml' | |
| 10 | - import { markdown } from '@codemirror/lang-markdown' | |
| 11 | - import { json } from '@codemirror/lang-json' | |
| 9 | + import { Compartment, EditorState } from '@codemirror/state' | |
| 12 | 10 | import { oneDark } from '@codemirror/theme-one-dark' |
| 13 | - import type { languageFor } from '../files' | |
| 11 | + import type { EditorLanguage } from '../files' | |
| 12 | + import { languageSupport, maxHighlightedSize } from '../editorLanguages' | |
| 13 | + import { isDark } from '../theme' | |
| 14 | 14 | |
| 15 | 15 | let { |
| 16 | 16 | content, |
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | readOnly = false, |
| 21 | 21 | }: { |
| 22 | 22 | content: string |
| 23 | - language: ReturnType<typeof languageFor> | |
| 23 | + language: EditorLanguage | |
| 24 | 24 | /** A protected file (issue #54): shown, never changed. */ |
| 25 | 25 | readOnly?: boolean |
| 26 | 26 | onChange: (text: string) => void |
| @@ -29,8 +29,8 @@ | ||
| 29 | 29 | |
| 30 | 30 | let host: HTMLElement |
| 31 | 31 | let view: EditorView | undefined |
| 32 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | |
| 33 | - const languages = { yaml: [yaml()], markdown: [markdown()], json: [json()], text: [] } | |
| 32 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 33 | + const highlighting = new Compartment() | |
| 34 | 34 | |
| 35 | 35 | onMount(() => { |
| 36 | 36 | view = new EditorView({ |
| @@ -38,7 +38,7 @@ | ||
| 38 | 38 | parent: host, |
| 39 | 39 | extensions: [ |
| 40 | 40 | basicSetup, |
| 41 | - ...languages[language], | |
| 41 | + highlighting.of([]), | |
| 42 | 42 | EditorView.lineWrapping, |
| 43 | 43 | EditorState.readOnly.of(readOnly), |
| 44 | 44 | EditorView.editable.of(!readOnly), |
| @@ -49,7 +49,16 @@ | ||
| 49 | 49 | ...(dark ? [oneDark] : []), |
| 50 | 50 | ], |
| 51 | 51 | }) |
| 52 | - return () => view?.destroy() | |
| 52 | + // A large file stays plain text; an unknown language too. | |
| 53 | + if (content.length <= maxHighlightedSize) { | |
| 54 | + languageSupport(language) | |
| 55 | + .then((support) => view?.dispatch({ effects: highlighting.reconfigure(support) })) | |
| 56 | + .catch(() => {}) // plain text is fine | |
| 57 | + } | |
| 58 | + return () => { | |
| 59 | + view?.destroy() | |
| 60 | + view = undefined | |
| 61 | + } | |
| 53 | 62 | }) |
| 54 | 63 | |
| 55 | 64 | /** Replaces the whole text, e.g. with the agent's version of the file. */ |
| @@ -1,16 +1,16 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the | 3 | // The editor of a workspace file (issue #30): the same CodeMirror as the |
| 4 | - // Settings panel, with the language of the file and ⌘S to save. | 4 | + // Settings panel, with ⌘S to save, coloured according to the language of |
| 5 | + // the file (issue #71), loaded once the text is shown. | ||
| 5 | import { onMount } from 'svelte' | 6 | import { onMount } from 'svelte' |
| 6 | import { EditorView, basicSetup } from 'codemirror' | 7 | import { EditorView, basicSetup } from 'codemirror' |
| 7 | import { keymap } from '@codemirror/view' | 8 | import { keymap } from '@codemirror/view' |
| 8 | - import { EditorState } from '@codemirror/state' | 9 | + import { Compartment, EditorState } from '@codemirror/state' |
| 9 | - import { yaml } from '@codemirror/lang-yaml' | ||
| 10 | - import { markdown } from '@codemirror/lang-markdown' | ||
| 11 | - import { json } from '@codemirror/lang-json' | ||
| 12 | import { oneDark } from '@codemirror/theme-one-dark' | 10 | import { oneDark } from '@codemirror/theme-one-dark' |
| 13 | - import type { languageFor } from '../files' | 11 | + import type { EditorLanguage } from '../files' |
| 12 | + import { languageSupport, maxHighlightedSize } from '../editorLanguages' | ||
| 13 | + import { isDark } from '../theme' | ||
| 14 | 14 | ||
| 15 | let { | 15 | let { |
| 16 | content, | 16 | content, |
| @@ -20,7 +20,7 @@ | |||
| 20 | readOnly = false, | 20 | readOnly = false, |
| 21 | }: { | 21 | }: { |
| 22 | content: string | 22 | content: string |
| 23 | - language: ReturnType<typeof languageFor> | 23 | + language: EditorLanguage |
| 24 | /** A protected file (issue #54): shown, never changed. */ | 24 | /** A protected file (issue #54): shown, never changed. */ |
| 25 | readOnly?: boolean | 25 | readOnly?: boolean |
| 26 | onChange: (text: string) => void | 26 | onChange: (text: string) => void |
| @@ -29,8 +29,8 @@ | |||
| 29 | 29 | ||
| 30 | let host: HTMLElement | 30 | let host: HTMLElement |
| 31 | let view: EditorView | undefined | 31 | let view: EditorView | undefined |
| 32 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | 32 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) |
| 33 | - const languages = { yaml: [yaml()], markdown: [markdown()], json: [json()], text: [] } | 33 | + const highlighting = new Compartment() |
| 34 | 34 | ||
| 35 | onMount(() => { | 35 | onMount(() => { |
| 36 | view = new EditorView({ | 36 | view = new EditorView({ |
| @@ -38,7 +38,7 @@ | |||
| 38 | parent: host, | 38 | parent: host, |
| 39 | extensions: [ | 39 | extensions: [ |
| 40 | basicSetup, | 40 | basicSetup, |
| 41 | - ...languages[language], | 41 | + highlighting.of([]), |
| 42 | EditorView.lineWrapping, | 42 | EditorView.lineWrapping, |
| 43 | EditorState.readOnly.of(readOnly), | 43 | EditorState.readOnly.of(readOnly), |
| 44 | EditorView.editable.of(!readOnly), | 44 | EditorView.editable.of(!readOnly), |
| @@ -49,7 +49,16 @@ | |||
| 49 | ...(dark ? [oneDark] : []), | 49 | ...(dark ? [oneDark] : []), |
| 50 | ], | 50 | ], |
| 51 | }) | 51 | }) |
| 52 | - return () => view?.destroy() | 52 | + // A large file stays plain text; an unknown language too. |
| 53 | + if (content.length <= maxHighlightedSize) { | ||
| 54 | + languageSupport(language) | ||
| 55 | + .then((support) => view?.dispatch({ effects: highlighting.reconfigure(support) })) | ||
| 56 | + .catch(() => {}) // plain text is fine | ||
| 57 | + } | ||
| 58 | + return () => { | ||
| 59 | + view?.destroy() | ||
| 60 | + view = undefined | ||
| 61 | + } | ||
| 53 | }) | 62 | }) |
| 54 | 63 | ||
| 55 | /** Replaces the whole text, e.g. with the agent's version of the file. */ | 64 | /** Replaces the whole text, e.g. with the agent's version of the file. */ |
modified
frontend/src/lib/agent/FilesTab.svelte +338 -36 | @@ -2,7 +2,9 @@ | ||
| 2 | 2 | <script lang="ts"> |
| 3 | 3 | // The files of an agent (issues #29 and #30): a tree loaded folder by |
| 4 | 4 | // folder and kept up to date while the agent works, and an editor that |
| 5 | - // notices when the agent changes the file being edited. | |
| 5 | + // notices when the agent changes the file being edited. Entries can be | |
| 6 | + // selected together, renamed, moved (drag and drop, or Move to…) and | |
| 7 | + // deleted, from the buttons, the keyboard or a context menu (issue #70). | |
| 6 | 8 | import { onMount } from 'svelte' |
| 7 | 9 | import { WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | 10 | import type { Entry, File } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| @@ -12,22 +14,42 @@ | ||
| 12 | 14 | import FileEditor from './FileEditor.svelte' |
| 13 | 15 | import FilePreview from './FilePreview.svelte' |
| 14 | 16 | import { previewKind } from '../preview' |
| 17 | + import { canDrop, isUnder, movedPath, nameOf, parentOf, select } from '../fileSelection' | |
| 15 | 18 | |
| 16 | - let { agent, inContainer }: { agent: string; inContainer: boolean } = $props() | |
| 19 | + let { | |
| 20 | + agent, | |
| 21 | + inContainer, | |
| 22 | + revealable = false, | |
| 23 | + }: { | |
| 24 | + agent: string | |
| 25 | + inContainer: boolean | |
| 26 | + /** The folder is on this computer: its files can be shown in the Finder (issue #74). */ | |
| 27 | + revealable?: boolean | |
| 28 | + } = $props() | |
| 17 | 29 | |
| 18 | 30 | // The entries of each folder loaded so far, by folder path ("" is the root). |
| 19 | 31 | let listings: Record<string, Entry[]> = $state({}) |
| 20 | 32 | let open: Record<string, boolean> = $state({ '': true }) |
| 21 | 33 | let showHidden = $state(false) |
| 34 | + // The entry clicked last (anchor of a ⇧ range), and the selected entries. | |
| 22 | 35 | let selected = $state('') |
| 36 | + let selection = $state<string[]>([]) | |
| 23 | 37 | let file = $state<File | null>(null) |
| 24 | 38 | let draft = $state('') |
| 25 | 39 | let conflict = $state(false) |
| 26 | 40 | let message = $state('') |
| 27 | 41 | let error = $state('') |
| 28 | - let creating = $state(false) | |
| 42 | + let creating = $state<'' | 'file' | 'folder'>('') | |
| 29 | 43 | let newName = $state('') |
| 30 | - let confirming = $state('') | |
| 44 | + // The entries waiting for the confirmation of their deletion. | |
| 45 | + let confirming = $state<string[]>([]) | |
| 46 | + let renaming = $state('') | |
| 47 | + let renameValue = $state('') | |
| 48 | + let moving = $state<string[]>([]) | |
| 49 | + let moveTarget = $state('') | |
| 50 | + let menu = $state<{ x: number; y: number; path: string } | null>(null) | |
| 51 | + let dragging: string[] = [] | |
| 52 | + let dropTarget = $state<string | null>(null) | |
| 31 | 53 | let editor: FileEditor | undefined = $state() |
| 32 | 54 | // Issue #46: a document with a preview opens on it; an image has nothing else. |
| 33 | 55 | let mode = $state<'preview' | 'edit'>('edit') |
| @@ -39,9 +61,13 @@ | ||
| 39 | 61 | if (!selected) return '' |
| 40 | 62 | const entry = Object.values(listings).flat().find((candidate) => candidate.path === selected) |
| 41 | 63 | if (entry?.dir) return entry.path |
| 42 | - return selected.includes('/') ? selected.slice(0, selected.lastIndexOf('/')) : '' | |
| 64 | + return parentOf(selected) | |
| 43 | 65 | }) |
| 44 | 66 | |
| 67 | + function entryAt(path: string): Entry | undefined { | |
| 68 | + return Object.values(listings).flat().find((candidate) => candidate.path === path) | |
| 69 | + } | |
| 70 | + | |
| 45 | 71 | async function attempt(action: () => Promise<void>) { |
| 46 | 72 | error = '' |
| 47 | 73 | try { |
| @@ -87,8 +113,22 @@ | ||
| 87 | 113 | } |
| 88 | 114 | } |
| 89 | 115 | |
| 116 | + // A click on a row: ⌘/Ctrl adds it to the selection or takes it out, ⇧ | |
| 117 | + // selects up to it; a plain click selects it alone and opens it. | |
| 118 | + function click(event: MouseEvent, entry: Entry) { | |
| 119 | + menu = null | |
| 120 | + const toggleKey = event.metaKey || event.ctrlKey | |
| 121 | + if (toggleKey || event.shiftKey) { | |
| 122 | + selection = select(rows.map((row) => row.entry.path), selection, selected, entry.path, { toggle: toggleKey, range: event.shiftKey }) | |
| 123 | + if (!event.shiftKey) selected = entry.path | |
| 124 | + return | |
| 125 | + } | |
| 126 | + void toggle(entry) | |
| 127 | + } | |
| 128 | + | |
| 90 | 129 | async function toggle(entry: Entry) { |
| 91 | 130 | selected = entry.path |
| 131 | + selection = [entry.path] | |
| 92 | 132 | if (!entry.dir) return openFile(entry.path) |
| 93 | 133 | open[entry.path] = !open[entry.path] |
| 94 | 134 | if (open[entry.path] && !listings[entry.path]) await attempt(() => load(entry.path)) |
| @@ -138,29 +178,199 @@ | ||
| 138 | 178 | async function create() { |
| 139 | 179 | if (!validFileName(newName)) return |
| 140 | 180 | const folder = targetFolder |
| 181 | + const name = newName.trim() | |
| 141 | 182 | await attempt(async () => { |
| 142 | - const created = await WorkspaceService.Create(agent, folder, newName.trim()) | |
| 143 | - creating = false | |
| 144 | - newName = '' | |
| 145 | - open[folder] = true | |
| 146 | - await load(folder) | |
| 147 | - if (created) { | |
| 148 | - selected = created.path | |
| 149 | - await openFile(created.path) | |
| 183 | + if (creating === 'folder') { | |
| 184 | + const created = await WorkspaceService.CreateFolder(agent, folder, name) | |
| 185 | + open[folder] = true | |
| 186 | + open[created] = true | |
| 187 | + await load(folder) | |
| 188 | + selected = created | |
| 189 | + selection = [created] | |
| 190 | + } else { | |
| 191 | + const created = await WorkspaceService.Create(agent, folder, name) | |
| 192 | + open[folder] = true | |
| 193 | + await load(folder) | |
| 194 | + if (created) { | |
| 195 | + selected = created.path | |
| 196 | + selection = [created.path] | |
| 197 | + await openFile(created.path) | |
| 198 | + } | |
| 150 | 199 | } |
| 200 | + creating = '' | |
| 201 | + newName = '' | |
| 151 | 202 | }) |
| 152 | 203 | } |
| 153 | 204 | |
| 154 | - async function remove(path: string) { | |
| 155 | - confirming = '' | |
| 205 | + // Asks to confirm the deletion of paths: the selection when the entry is | |
| 206 | + // part of it, the entry alone otherwise. | |
| 207 | + function askRemove(path: string) { | |
| 208 | + menu = null | |
| 209 | + confirming = selection.includes(path) ? [...selection] : [path] | |
| 210 | + } | |
| 211 | + | |
| 212 | + async function remove(paths: string[]) { | |
| 213 | + confirming = [] | |
| 156 | 214 | await attempt(async () => { |
| 157 | - await WorkspaceService.Remove(agent, path) | |
| 158 | - if (file && (file.path === path || file.path.startsWith(path + '/'))) file = null | |
| 215 | + if (paths.length === 1) await WorkspaceService.Remove(agent, paths[0]) | |
| 216 | + else await WorkspaceService.RemoveAll(agent, paths) | |
| 217 | + if (file && isUnder(file.path, paths)) file = null | |
| 218 | + selection = [] | |
| 159 | 219 | selected = '' |
| 160 | 220 | await refresh() |
| 161 | 221 | }) |
| 162 | 222 | } |
| 163 | 223 | |
| 224 | + // The tree remembers open folders by path: those under from now are under to. | |
| 225 | + function follow(from: string, to: string) { | |
| 226 | + for (const state of [open, listings] as Record<string, unknown>[]) { | |
| 227 | + for (const key of Object.keys(state)) { | |
| 228 | + if (isUnder(key, [from])) { | |
| 229 | + state[movedPath(key, from, to)] = state[key] | |
| 230 | + delete state[key] | |
| 231 | + } | |
| 232 | + } | |
| 233 | + } | |
| 234 | + // The open file keeps what is being typed: only its path changes. | |
| 235 | + if (file && isUnder(file.path, [from])) file = { ...file, path: movedPath(file.path, from, to) } | |
| 236 | + selection = selection.map((path) => movedPath(path, from, to)) | |
| 237 | + if (selected) selected = movedPath(selected, from, to) | |
| 238 | + } | |
| 239 | + | |
| 240 | + function startRename(path: string) { | |
| 241 | + menu = null | |
| 242 | + renaming = path | |
| 243 | + renameValue = nameOf(path) | |
| 244 | + } | |
| 245 | + | |
| 246 | + async function rename() { | |
| 247 | + const from = renaming | |
| 248 | + const name = renameValue.trim() | |
| 249 | + renaming = '' | |
| 250 | + if (!from || name === nameOf(from) || !validFileName(name)) return | |
| 251 | + const parent = parentOf(from) | |
| 252 | + await attempt(async () => { | |
| 253 | + const to = await WorkspaceService.Rename(agent, from, parent ? `${parent}/${name}` : name) | |
| 254 | + follow(from, to) | |
| 255 | + await refresh() | |
| 256 | + }) | |
| 257 | + } | |
| 258 | + | |
| 259 | + // Moves paths into folder ("" is the root), after a drop or Move to…. | |
| 260 | + async function moveInto(paths: string[], folder: string) { | |
| 261 | + moving = [] | |
| 262 | + if (!canDrop(paths, folder)) return | |
| 263 | + await attempt(async () => { | |
| 264 | + try { | |
| 265 | + const moved = (await WorkspaceService.Move(agent, paths, folder)) ?? [] | |
| 266 | + paths.forEach((from, index) => moved[index] && follow(from, moved[index])) | |
| 267 | + } finally { | |
| 268 | + open[folder] = true | |
| 269 | + if (!listings[folder]) await load(folder).catch(() => {}) | |
| 270 | + await refresh() | |
| 271 | + } | |
| 272 | + }) | |
| 273 | + } | |
| 274 | + | |
| 275 | + // Copies the entry, or the selection it is part of, next to itself | |
| 276 | + // (plan.md → plan-copy.md); the copies become the selection. | |
| 277 | + async function duplicate(path: string) { | |
| 278 | + menu = null | |
| 279 | + const paths = selection.includes(path) ? [...selection] : [path] | |
| 280 | + await attempt(async () => { | |
| 281 | + try { | |
| 282 | + const copies = (await WorkspaceService.Duplicate(agent, paths)) ?? [] | |
| 283 | + if (copies.length) { | |
| 284 | + selection = copies | |
| 285 | + selected = copies[copies.length - 1] | |
| 286 | + } | |
| 287 | + } finally { | |
| 288 | + await refresh() | |
| 289 | + } | |
| 290 | + }) | |
| 291 | + } | |
| 292 | + | |
| 293 | + function askMove(path: string) { | |
| 294 | + menu = null | |
| 295 | + moving = selection.includes(path) ? [...selection] : [path] | |
| 296 | + moveTarget = parentOf(path) | |
| 297 | + } | |
| 298 | + | |
| 299 | + // Drag and drop: the dragged entry, with the rest of the selection when | |
| 300 | + // it is part of it, goes into the folder dropped on (or the folder of the | |
| 301 | + // file dropped on, or the root below the rows). | |
| 302 | + function dragStart(event: DragEvent, entry: Entry) { | |
| 303 | + dragging = selection.includes(entry.path) ? [...selection] : [entry.path] | |
| 304 | + event.dataTransfer?.setData('text/plain', dragging.join('\n')) | |
| 305 | + if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move' | |
| 306 | + } | |
| 307 | + | |
| 308 | + function dragOver(event: DragEvent, folder: string) { | |
| 309 | + if (!dragging.length || !canDrop(dragging, folder)) return | |
| 310 | + event.preventDefault() | |
| 311 | + event.stopPropagation() | |
| 312 | + dropTarget = folder | |
| 313 | + } | |
| 314 | + | |
| 315 | + function drop(event: DragEvent, folder: string) { | |
| 316 | + event.preventDefault() | |
| 317 | + event.stopPropagation() | |
| 318 | + const paths = dragging | |
| 319 | + dragging = [] | |
| 320 | + dropTarget = null | |
| 321 | + void moveInto(paths, folder) | |
| 322 | + } | |
| 323 | + | |
| 324 | + function dragEnd() { | |
| 325 | + dragging = [] | |
| 326 | + dropTarget = null | |
| 327 | + } | |
| 328 | + | |
| 329 | + function openMenu(event: MouseEvent, entry: Entry) { | |
| 330 | + event.preventDefault() | |
| 331 | + if (!selection.includes(entry.path)) { | |
| 332 | + selection = [entry.path] | |
| 333 | + selected = entry.path | |
| 334 | + } | |
| 335 | + menu = { x: event.clientX, y: event.clientY, path: entry.path } | |
| 336 | + } | |
| 337 | + | |
| 338 | + // Shortcuts of the tree: F2 renames, ⌘D duplicates, Delete (⌘⌫ on a Mac) deletes, ⌘A | |
| 339 | + // selects every row shown, Escape closes the menu or empties the selection. | |
| 340 | + function treeKey(event: KeyboardEvent) { | |
| 341 | + if ((event.target as HTMLElement).tagName === 'INPUT') return | |
| 342 | + const mod = event.metaKey || event.ctrlKey | |
| 343 | + if (event.key === 'F2' && selection.length === 1 && !entryAt(selection[0])?.protected) { | |
| 344 | + event.preventDefault() | |
| 345 | + startRename(selection[0]) | |
| 346 | + } else if ((event.key === 'Delete' || (event.key === 'Backspace' && mod)) && selection.length) { | |
| 347 | + event.preventDefault() | |
| 348 | + askRemove(selection[0]) | |
| 349 | + } else if (mod && event.key.toLowerCase() === 'd' && selection.length) { | |
| 350 | + event.preventDefault() | |
| 351 | + void duplicate(selection[0]) | |
| 352 | + } else if (mod && event.key.toLowerCase() === 'a') { | |
| 353 | + event.preventDefault() | |
| 354 | + selection = rows.map((row) => row.entry.path) | |
| 355 | + } else if (event.key === 'Escape') { | |
| 356 | + if (menu) menu = null | |
| 357 | + else selection = [] | |
| 358 | + } | |
| 359 | + } | |
| 360 | + | |
| 361 | + function closeMenu(event: MouseEvent) { | |
| 362 | + if (menu && !(event.target as HTMLElement).closest('.menu')) menu = null | |
| 363 | + } | |
| 364 | + | |
| 365 | + function blocked(paths: string[]): boolean { | |
| 366 | + return paths.some((path) => entryAt(path)?.protected) | |
| 367 | + } | |
| 368 | + | |
| 369 | + // Shows a file or a folder in the Finder, the Explorer or the file manager. | |
| 370 | + function reveal(path: string) { | |
| 371 | + void attempt(() => WorkspaceService.Reveal(agent, path)) | |
| 372 | + } | |
| 373 | + | |
| 164 | 374 | function focus(element: HTMLInputElement) { |
| 165 | 375 | element.focus() |
| 166 | 376 | } |
| @@ -199,6 +409,7 @@ | ||
| 199 | 409 | if (!listings[dir]) await load(dir) |
| 200 | 410 | } |
| 201 | 411 | selected = wanted |
| 412 | + selection = [wanted] | |
| 202 | 413 | await openFile(wanted) |
| 203 | 414 | }) |
| 204 | 415 | }) |
| @@ -215,49 +426,125 @@ | ||
| 215 | 426 | }) |
| 216 | 427 | </script> |
| 217 | 428 | |
| 429 | +<svelte:window onclick={closeMenu} /> | |
| 430 | + | |
| 218 | 431 | <div class="files"> |
| 219 | - <aside class="tree"> | |
| 220 | - <ul> | |
| 432 | + <!-- svelte-ignore a11y_no_noninteractive_element_interactions --> | |
| 433 | + <aside class="tree" class:drop={dropTarget === ''} onkeydown={treeKey} ondragover={(event) => dragOver(event, '')} ondrop={(event) => drop(event, '')} ondragleave={() => (dropTarget = null)} aria-label={t('workspace.tree')}> | |
| 434 | + {#if confirming.length > 1} | |
| 435 | + <div class="confirm" role="alert"> | |
| 436 | + <span>{inContainer ? t('workspace.deleteManyForGood', { count: confirming.length }) : t('workspace.deleteManyConfirm', { count: confirming.length })}</span> | |
| 437 | + <button class="danger" onclick={() => remove(confirming)}>{t('workspace.delete')}</button> | |
| 438 | + <button onclick={() => (confirming = [])}>{t('workspace.cancel')}</button> | |
| 439 | + </div> | |
| 440 | + {/if} | |
| 441 | + {#if moving.length} | |
| 442 | + <form class="create" onsubmit={(event) => { event.preventDefault(); void moveInto(moving, moveTarget.trim().replace(/^\/+|\/+$/g, '')) }}> | |
| 443 | + <label for="move-target">{moving.length === 1 ? t('workspace.moveOne', { name: nameOf(moving[0]) }) : t('workspace.moveMany', { count: moving.length })}</label> | |
| 444 | + <input id="move-target" use:focus bind:value={moveTarget} placeholder={t('workspace.moveTarget')} onkeydown={(event) => event.key === 'Escape' && (moving = [])} /> | |
| 445 | + <button class="primary" disabled={!canDrop(moving, moveTarget.trim().replace(/^\/+|\/+$/g, ''))}>{t('workspace.move')}</button> | |
| 446 | + <button type="button" onclick={() => (moving = [])}>{t('workspace.cancel')}</button> | |
| 447 | + </form> | |
| 448 | + {/if} | |
| 449 | + <ul aria-multiselectable="true" role="tree"> | |
| 221 | 450 | {#each rows as { entry, depth } (entry.path)} |
| 222 | - <li class:selected={selected === entry.path} style:padding-left="{8 + depth * 14}px"> | |
| 223 | - <button class="row" onclick={() => toggle(entry)} title={entry.path}> | |
| 224 | - <span aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | |
| 225 | - {entry.name} | |
| 226 | - </button> | |
| 451 | + <li | |
| 452 | + role="treeitem" | |
| 453 | + aria-selected={selection.includes(entry.path)} | |
| 454 | + class:selected={selection.includes(entry.path)} | |
| 455 | + class:drop={dropTarget === entry.path} | |
| 456 | + style:padding-left="{8 + depth * 14}px" | |
| 457 | + draggable={renaming !== entry.path} | |
| 458 | + ondragstart={(event) => dragStart(event, entry)} | |
| 459 | + ondragend={dragEnd} | |
| 460 | + ondragover={(event) => dragOver(event, entry.dir ? entry.path : parentOf(entry.path))} | |
| 461 | + ondrop={(event) => drop(event, entry.dir ? entry.path : parentOf(entry.path))} | |
| 462 | + oncontextmenu={(event) => openMenu(event, entry)} | |
| 463 | + > | |
| 464 | + {#if renaming === entry.path} | |
| 465 | + <form class="rename" onsubmit={(event) => { event.preventDefault(); void rename() }}> | |
| 466 | + <span class="icon" aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | |
| 467 | + <input use:focus bind:value={renameValue} aria-label={t('workspace.renameEntry', { name: entry.name })} onblur={() => void rename()} onkeydown={(event) => { if (event.key === 'Escape') { event.stopPropagation(); renaming = '' } }} /> | |
| 468 | + </form> | |
| 469 | + {:else} | |
| 470 | + <button class="row" onclick={(event) => click(event, entry)} ondblclick={(event) => !entry.protected && !event.metaKey && !event.ctrlKey && !event.shiftKey && startRename(entry.path)} title={entry.path}> | |
| 471 | + <span class="icon" aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | |
| 472 | + <span class="name">{entry.name}</span> | |
| 473 | + </button> | |
| 474 | + {/if} | |
| 475 | + {#if revealable} | |
| 476 | + <button class="action" onclick={() => reveal(entry.path)} aria-label={t('workspace.revealEntry', { name: entry.name })} title={t('linked.reveal')}>📂</button> | |
| 477 | + {/if} | |
| 227 | 478 | {#if entry.protected} |
| 228 | 479 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> |
| 229 | 480 | {:else} |
| 230 | - <button class="remove" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | |
| 481 | + <button class="action" onclick={() => startRename(entry.path)} aria-label={t('workspace.renameEntry', { name: entry.name })} title={t('workspace.renameEntry', { name: entry.name })}>✏️</button> | |
| 482 | + <button class="action" onclick={() => askRemove(entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | |
| 231 | 483 | {/if} |
| 232 | 484 | </li> |
| 233 | - {#if confirming === entry.path} | |
| 485 | + {#if confirming.length === 1 && confirming[0] === entry.path} | |
| 234 | 486 | <li class="confirm"> |
| 235 | 487 | <span role="alert">{inContainer ? t('workspace.deleteForGood', { name: entry.name }) : t('workspace.deleteConfirm', { name: entry.name })}</span> |
| 236 | - <button class="danger" onclick={() => remove(entry.path)}>{t('workspace.delete')}</button> | |
| 237 | - <button onclick={() => (confirming = '')}>{t('workspace.cancel')}</button> | |
| 488 | + <button class="danger" onclick={() => remove(confirming)}>{t('workspace.delete')}</button> | |
| 489 | + <button onclick={() => (confirming = [])}>{t('workspace.cancel')}</button> | |
| 238 | 490 | </li> |
| 239 | 491 | {/if} |
| 240 | 492 | {:else} |
| 241 | 493 | <li class="empty">{t('workspace.empty')}</li> |
| 242 | 494 | {/each} |
| 243 | 495 | </ul> |
| 496 | + {#if selection.length > 1} | |
| 497 | + <p class="count">{t('workspace.selected', { count: selection.length })}</p> | |
| 498 | + {/if} | |
| 244 | 499 | {#if creating} |
| 245 | 500 | <form class="create" onsubmit={(event) => { event.preventDefault(); void create() }}> |
| 246 | - <label for="new-file">{t('workspace.newFileIn', { folder: targetFolder || '/' })}</label> | |
| 247 | - <input id="new-file" use:focus bind:value={newName} placeholder={t('workspace.fileName')} onkeydown={(event) => event.key === 'Escape' && (creating = false)} /> | |
| 501 | + <label for="new-file">{creating === 'folder' ? t('workspace.newFolderIn', { folder: targetFolder || '/' }) : t('workspace.newFileIn', { folder: targetFolder || '/' })}</label> | |
| 502 | + <input id="new-file" use:focus bind:value={newName} placeholder={creating === 'folder' ? t('workspace.folderName') : t('workspace.fileName')} onkeydown={(event) => event.key === 'Escape' && (creating = '')} /> | |
| 248 | 503 | <button class="primary" disabled={!validFileName(newName)}>{t('workspace.create')}</button> |
| 249 | 504 | </form> |
| 250 | 505 | {:else} |
| 251 | - <button class="link" onclick={() => (creating = true)}>{t('workspace.newFile')}</button> | |
| 506 | + <div class="links"> | |
| 507 | + <button class="link" onclick={() => (creating = 'file')}>{t('workspace.newFile')}</button> | |
| 508 | + <button class="link" onclick={() => (creating = 'folder')}>{t('workspace.newFolder')}</button> | |
| 509 | + </div> | |
| 252 | 510 | {/if} |
| 253 | 511 | <label class="hidden"><input type="checkbox" bind:checked={showHidden} /> {t('workspace.showHidden')}</label> |
| 254 | 512 | </aside> |
| 255 | 513 | |
| 514 | + {#if menu} | |
| 515 | + {@const many = selection.length > 1 && selection.includes(menu.path)} | |
| 516 | + {@const targets = many ? selection : [menu.path]} | |
| 517 | + {@const entry = entryAt(menu.path)} | |
| 518 | + <div class="menu" role="menu" tabindex="-1" style:left="{menu.x}px" style:top="{menu.y}px" onkeydown={(event) => event.key === 'Escape' && (menu = null)}> | |
| 519 | + {#if !many && entry && !entry.dir} | |
| 520 | + <button role="menuitem" onclick={() => { const path = menu!.path; menu = null; selected = path; void openFile(path) }}>{t('workspace.menu.open')}</button> | |
| 521 | + {/if} | |
| 522 | + {#if !many && entry && !entry.protected} | |
| 523 | + <button role="menuitem" onclick={() => startRename(menu!.path)}>{t('workspace.menu.rename')}</button> | |
| 524 | + {/if} | |
| 525 | + {#if !blocked(targets)} | |
| 526 | + <button role="menuitem" onclick={() => askMove(menu!.path)}>{many ? t('workspace.menu.moveMany', { count: targets.length }) : t('workspace.menu.move')}</button> | |
| 527 | + {/if} | |
| 528 | + <button role="menuitem" onclick={() => duplicate(menu!.path)}>{many ? t('workspace.menu.duplicateMany', { count: targets.length }) : t('workspace.menu.duplicate')}</button> | |
| 529 | + {#if !many && revealable} | |
| 530 | + <button role="menuitem" onclick={() => { const path = menu!.path; menu = null; reveal(path) }}>📂 {t('linked.reveal')}</button> | |
| 531 | + {/if} | |
| 532 | + <button role="menuitem" onclick={() => { selected = menu!.path; menu = null; creating = 'file' }}>{t('workspace.newFile')}</button> | |
| 533 | + <button role="menuitem" onclick={() => { selected = menu!.path; menu = null; creating = 'folder' }}>{t('workspace.newFolder')}</button> | |
| 534 | + {#if !blocked(targets)} | |
| 535 | + <button role="menuitem" class="danger-text" onclick={() => askRemove(menu!.path)}>{many ? t('workspace.menu.deleteMany', { count: targets.length }) : t('workspace.delete')}</button> | |
| 536 | + {/if} | |
| 537 | + </div> | |
| 538 | + {/if} | |
| 539 | + | |
| 256 | 540 | <section class="editor"> |
| 257 | 541 | {#if error}<p class="error" role="alert">{t('workspace.cannotOpen', { error })}</p>{/if} |
| 258 | 542 | {#if file} |
| 259 | 543 | <header> |
| 260 | 544 | <span class="path">{file.path}</span> |
| 545 | + {#if revealable} | |
| 546 | + <button class="reveal" onclick={() => file && reveal(file.path)}>📂 {t('linked.reveal')}</button> | |
| 547 | + {/if} | |
| 261 | 548 | {#if kind && kind !== 'image'} |
| 262 | 549 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> |
| 263 | 550 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> |
| @@ -288,14 +575,14 @@ | ||
| 288 | 575 | {#if file.readOnly} |
| 289 | 576 | <span class="readonly-hint">{t('workspace.protected')}</span> |
| 290 | 577 | {:else} |
| 291 | - <button class="danger-outline" onclick={() => file && (confirming = file.path)}>{t('workspace.delete')}</button> | |
| 578 | + <button class="danger-outline" onclick={() => file && (confirming = [file.path])}>{t('workspace.delete')}</button> | |
| 292 | 579 | {/if} |
| 293 | 580 | </footer> |
| 294 | 581 | {:else if file.readOnly} |
| 295 | 582 | <footer><span class="readonly-hint">{t('workspace.protected')}</span></footer> |
| 296 | 583 | {:else} |
| 297 | 584 | <footer> |
| 298 | - <button class="danger-outline" onclick={() => file && (confirming = file.path)}>{t('workspace.delete')}</button> | |
| 585 | + <button class="danger-outline" onclick={() => file && (confirming = [file.path])}>{t('workspace.delete')}</button> | |
| 299 | 586 | <span class="spacer"></span> |
| 300 | 587 | <button disabled={!dirty} onclick={() => { if (file) { draft = file.content; editor?.setContent(file.content) } }}>{t('workspace.revert')}</button> |
| 301 | 588 | <button class="primary" disabled={!dirty} onclick={() => save()}>{t('workspace.save')}</button> |
| @@ -313,17 +600,32 @@ | ||
| 313 | 600 | ul { list-style: none; margin: 0; padding: 0; } |
| 314 | 601 | li { display: flex; align-items: center; border-radius: 4px; } |
| 315 | 602 | li:hover, li.selected { background: var(--panel-2); } |
| 316 | - .row { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | |
| 317 | - .remove { border: none; background: none; padding: 0 6px; font-size: 11px; opacity: 0; } | |
| 603 | + li.selected { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 2px 0 0 var(--accent); } | |
| 604 | + li.drop, .tree.drop { outline: 1px dashed var(--accent); outline-offset: -1px; } | |
| 605 | + .rename { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; padding: 1px 4px; font-family: var(--mono); font-size: 12.5px; } | |
| 606 | + .rename input { flex: 1; min-width: 0; font: inherit; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 3px; background: var(--bg); color: var(--text); } | |
| 607 | + .count { margin: 4px 10px 0; color: var(--muted); font-size: 12px; } | |
| 608 | + .links { display: flex; gap: 12px; } | |
| 609 | + .menu { position: fixed; z-index: 50; min-width: 180px; display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); } | |
| 610 | + .menu button { border: none; background: none; text-align: left; padding: 4px 10px; border-radius: 4px; font-size: 12.5px; } | |
| 611 | + .menu button:hover, .menu button:focus-visible { background: var(--panel-2); } | |
| 612 | + .danger-text { color: var(--danger); } | |
| 613 | + .row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; line-height: 18px; white-space: nowrap; } | |
| 614 | + /* The emoji is taller than the monospace text: a fixed box, centred, so that every name starts at the same place and sits on the same line as its icon. */ | |
| 615 | + .icon { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; } | |
| 616 | + .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; } | |
| 617 | + .action { border: none; background: none; padding: 0 4px; font-size: 11px; opacity: 0; } | |
| 618 | + .reveal { border: none; background: none; padding: 0; font-size: 12px; color: var(--accent); } | |
| 318 | 619 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } |
| 319 | 620 | .readonly { color: var(--muted); font-size: 12px; } |
| 320 | 621 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } |
| 321 | 622 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } |
| 322 | 623 | .modes button.active { background: var(--accent); color: #fff; } |
| 323 | 624 | .readonly-hint { color: var(--muted); font-size: 12px; } |
| 324 | - li:hover .remove { opacity: 1; } | |
| 625 | + li:hover .action, li:has(:focus-visible) .action { opacity: 1; } | |
| 325 | 626 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } |
| 326 | 627 | .confirm span { flex-basis: 100%; } |
| 628 | + div.confirm { display: flex; border-radius: 4px; } | |
| 327 | 629 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } |
| 328 | 630 | .pick { margin: auto; } |
| 329 | 631 | .link { align-self: flex-start; margin: 8px 8px 0; border: none; background: none; color: var(--accent); font-size: 12px; padding: 0; } |
| @@ -2,7 +2,9 @@ | |||
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | // The files of an agent (issues #29 and #30): a tree loaded folder by | 3 | // The files of an agent (issues #29 and #30): a tree loaded folder by |
| 4 | // folder and kept up to date while the agent works, and an editor that | 4 | // folder and kept up to date while the agent works, and an editor that |
| 5 | - // notices when the agent changes the file being edited. | 5 | + // notices when the agent changes the file being edited. Entries can be |
| 6 | + // selected together, renamed, moved (drag and drop, or Move to…) and | ||
| 7 | + // deleted, from the buttons, the keyboard or a context menu (issue #70). | ||
| 6 | import { onMount } from 'svelte' | 8 | import { onMount } from 'svelte' |
| 7 | import { WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 9 | import { WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | import type { Entry, File } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' | 10 | import type { Entry, File } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| @@ -12,22 +14,42 @@ | |||
| 12 | import FileEditor from './FileEditor.svelte' | 14 | import FileEditor from './FileEditor.svelte' |
| 13 | import FilePreview from './FilePreview.svelte' | 15 | import FilePreview from './FilePreview.svelte' |
| 14 | import { previewKind } from '../preview' | 16 | import { previewKind } from '../preview' |
| 17 | + import { canDrop, isUnder, movedPath, nameOf, parentOf, select } from '../fileSelection' | ||
| 15 | 18 | ||
| 16 | - let { agent, inContainer }: { agent: string; inContainer: boolean } = $props() | 19 | + let { |
| 20 | + agent, | ||
| 21 | + inContainer, | ||
| 22 | + revealable = false, | ||
| 23 | + }: { | ||
| 24 | + agent: string | ||
| 25 | + inContainer: boolean | ||
| 26 | + /** The folder is on this computer: its files can be shown in the Finder (issue #74). */ | ||
| 27 | + revealable?: boolean | ||
| 28 | + } = $props() | ||
| 17 | 29 | ||
| 18 | // The entries of each folder loaded so far, by folder path ("" is the root). | 30 | // The entries of each folder loaded so far, by folder path ("" is the root). |
| 19 | let listings: Record<string, Entry[]> = $state({}) | 31 | let listings: Record<string, Entry[]> = $state({}) |
| 20 | let open: Record<string, boolean> = $state({ '': true }) | 32 | let open: Record<string, boolean> = $state({ '': true }) |
| 21 | let showHidden = $state(false) | 33 | let showHidden = $state(false) |
| 34 | + // The entry clicked last (anchor of a ⇧ range), and the selected entries. | ||
| 22 | let selected = $state('') | 35 | let selected = $state('') |
| 36 | + let selection = $state<string[]>([]) | ||
| 23 | let file = $state<File | null>(null) | 37 | let file = $state<File | null>(null) |
| 24 | let draft = $state('') | 38 | let draft = $state('') |
| 25 | let conflict = $state(false) | 39 | let conflict = $state(false) |
| 26 | let message = $state('') | 40 | let message = $state('') |
| 27 | let error = $state('') | 41 | let error = $state('') |
| 28 | - let creating = $state(false) | 42 | + let creating = $state<'' | 'file' | 'folder'>('') |
| 29 | let newName = $state('') | 43 | let newName = $state('') |
| 30 | - let confirming = $state('') | 44 | + // The entries waiting for the confirmation of their deletion. |
| 45 | + let confirming = $state<string[]>([]) | ||
| 46 | + let renaming = $state('') | ||
| 47 | + let renameValue = $state('') | ||
| 48 | + let moving = $state<string[]>([]) | ||
| 49 | + let moveTarget = $state('') | ||
| 50 | + let menu = $state<{ x: number; y: number; path: string } | null>(null) | ||
| 51 | + let dragging: string[] = [] | ||
| 52 | + let dropTarget = $state<string | null>(null) | ||
| 31 | let editor: FileEditor | undefined = $state() | 53 | let editor: FileEditor | undefined = $state() |
| 32 | // Issue #46: a document with a preview opens on it; an image has nothing else. | 54 | // Issue #46: a document with a preview opens on it; an image has nothing else. |
| 33 | let mode = $state<'preview' | 'edit'>('edit') | 55 | let mode = $state<'preview' | 'edit'>('edit') |
| @@ -39,9 +61,13 @@ | |||
| 39 | if (!selected) return '' | 61 | if (!selected) return '' |
| 40 | const entry = Object.values(listings).flat().find((candidate) => candidate.path === selected) | 62 | const entry = Object.values(listings).flat().find((candidate) => candidate.path === selected) |
| 41 | if (entry?.dir) return entry.path | 63 | if (entry?.dir) return entry.path |
| 42 | - return selected.includes('/') ? selected.slice(0, selected.lastIndexOf('/')) : '' | 64 | + return parentOf(selected) |
| 43 | }) | 65 | }) |
| 44 | 66 | ||
| 67 | + function entryAt(path: string): Entry | undefined { | ||
| 68 | + return Object.values(listings).flat().find((candidate) => candidate.path === path) | ||
| 69 | + } | ||
| 70 | + | ||
| 45 | async function attempt(action: () => Promise<void>) { | 71 | async function attempt(action: () => Promise<void>) { |
| 46 | error = '' | 72 | error = '' |
| 47 | try { | 73 | try { |
| @@ -87,8 +113,22 @@ | |||
| 87 | } | 113 | } |
| 88 | } | 114 | } |
| 89 | 115 | ||
| 116 | + // A click on a row: ⌘/Ctrl adds it to the selection or takes it out, ⇧ | ||
| 117 | + // selects up to it; a plain click selects it alone and opens it. | ||
| 118 | + function click(event: MouseEvent, entry: Entry) { | ||
| 119 | + menu = null | ||
| 120 | + const toggleKey = event.metaKey || event.ctrlKey | ||
| 121 | + if (toggleKey || event.shiftKey) { | ||
| 122 | + selection = select(rows.map((row) => row.entry.path), selection, selected, entry.path, { toggle: toggleKey, range: event.shiftKey }) | ||
| 123 | + if (!event.shiftKey) selected = entry.path | ||
| 124 | + return | ||
| 125 | + } | ||
| 126 | + void toggle(entry) | ||
| 127 | + } | ||
| 128 | + | ||
| 90 | async function toggle(entry: Entry) { | 129 | async function toggle(entry: Entry) { |
| 91 | selected = entry.path | 130 | selected = entry.path |
| 131 | + selection = [entry.path] | ||
| 92 | if (!entry.dir) return openFile(entry.path) | 132 | if (!entry.dir) return openFile(entry.path) |
| 93 | open[entry.path] = !open[entry.path] | 133 | open[entry.path] = !open[entry.path] |
| 94 | if (open[entry.path] && !listings[entry.path]) await attempt(() => load(entry.path)) | 134 | if (open[entry.path] && !listings[entry.path]) await attempt(() => load(entry.path)) |
| @@ -138,29 +178,199 @@ | |||
| 138 | async function create() { | 178 | async function create() { |
| 139 | if (!validFileName(newName)) return | 179 | if (!validFileName(newName)) return |
| 140 | const folder = targetFolder | 180 | const folder = targetFolder |
| 181 | + const name = newName.trim() | ||
| 141 | await attempt(async () => { | 182 | await attempt(async () => { |
| 142 | - const created = await WorkspaceService.Create(agent, folder, newName.trim()) | 183 | + if (creating === 'folder') { |
| 143 | - creating = false | 184 | + const created = await WorkspaceService.CreateFolder(agent, folder, name) |
| 144 | - newName = '' | 185 | + open[folder] = true |
| 145 | - open[folder] = true | 186 | + open[created] = true |
| 146 | - await load(folder) | 187 | + await load(folder) |
| 147 | - if (created) { | 188 | + selected = created |
| 148 | - selected = created.path | 189 | + selection = [created] |
| 149 | - await openFile(created.path) | 190 | + } else { |
| 191 | + const created = await WorkspaceService.Create(agent, folder, name) | ||
| 192 | + open[folder] = true | ||
| 193 | + await load(folder) | ||
| 194 | + if (created) { | ||
| 195 | + selected = created.path | ||
| 196 | + selection = [created.path] | ||
| 197 | + await openFile(created.path) | ||
| 198 | + } | ||
| 150 | } | 199 | } |
| 200 | + creating = '' | ||
| 201 | + newName = '' | ||
| 151 | }) | 202 | }) |
| 152 | } | 203 | } |
| 153 | 204 | ||
| 154 | - async function remove(path: string) { | 205 | + // Asks to confirm the deletion of paths: the selection when the entry is |
| 155 | - confirming = '' | 206 | + // part of it, the entry alone otherwise. |
| 207 | + function askRemove(path: string) { | ||
| 208 | + menu = null | ||
| 209 | + confirming = selection.includes(path) ? [...selection] : [path] | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | + async function remove(paths: string[]) { | ||
| 213 | + confirming = [] | ||
| 156 | await attempt(async () => { | 214 | await attempt(async () => { |
| 157 | - await WorkspaceService.Remove(agent, path) | 215 | + if (paths.length === 1) await WorkspaceService.Remove(agent, paths[0]) |
| 158 | - if (file && (file.path === path || file.path.startsWith(path + '/'))) file = null | 216 | + else await WorkspaceService.RemoveAll(agent, paths) |
| 217 | + if (file && isUnder(file.path, paths)) file = null | ||
| 218 | + selection = [] | ||
| 159 | selected = '' | 219 | selected = '' |
| 160 | await refresh() | 220 | await refresh() |
| 161 | }) | 221 | }) |
| 162 | } | 222 | } |
| 163 | 223 | ||
| 224 | + // The tree remembers open folders by path: those under from now are under to. | ||
| 225 | + function follow(from: string, to: string) { | ||
| 226 | + for (const state of [open, listings] as Record<string, unknown>[]) { | ||
| 227 | + for (const key of Object.keys(state)) { | ||
| 228 | + if (isUnder(key, [from])) { | ||
| 229 | + state[movedPath(key, from, to)] = state[key] | ||
| 230 | + delete state[key] | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + } | ||
| 234 | + // The open file keeps what is being typed: only its path changes. | ||
| 235 | + if (file && isUnder(file.path, [from])) file = { ...file, path: movedPath(file.path, from, to) } | ||
| 236 | + selection = selection.map((path) => movedPath(path, from, to)) | ||
| 237 | + if (selected) selected = movedPath(selected, from, to) | ||
| 238 | + } | ||
| 239 | + | ||
| 240 | + function startRename(path: string) { | ||
| 241 | + menu = null | ||
| 242 | + renaming = path | ||
| 243 | + renameValue = nameOf(path) | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + async function rename() { | ||
| 247 | + const from = renaming | ||
| 248 | + const name = renameValue.trim() | ||
| 249 | + renaming = '' | ||
| 250 | + if (!from || name === nameOf(from) || !validFileName(name)) return | ||
| 251 | + const parent = parentOf(from) | ||
| 252 | + await attempt(async () => { | ||
| 253 | + const to = await WorkspaceService.Rename(agent, from, parent ? `${parent}/${name}` : name) | ||
| 254 | + follow(from, to) | ||
| 255 | + await refresh() | ||
| 256 | + }) | ||
| 257 | + } | ||
| 258 | + | ||
| 259 | + // Moves paths into folder ("" is the root), after a drop or Move to…. | ||
| 260 | + async function moveInto(paths: string[], folder: string) { | ||
| 261 | + moving = [] | ||
| 262 | + if (!canDrop(paths, folder)) return | ||
| 263 | + await attempt(async () => { | ||
| 264 | + try { | ||
| 265 | + const moved = (await WorkspaceService.Move(agent, paths, folder)) ?? [] | ||
| 266 | + paths.forEach((from, index) => moved[index] && follow(from, moved[index])) | ||
| 267 | + } finally { | ||
| 268 | + open[folder] = true | ||
| 269 | + if (!listings[folder]) await load(folder).catch(() => {}) | ||
| 270 | + await refresh() | ||
| 271 | + } | ||
| 272 | + }) | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + // Copies the entry, or the selection it is part of, next to itself | ||
| 276 | + // (plan.md → plan-copy.md); the copies become the selection. | ||
| 277 | + async function duplicate(path: string) { | ||
| 278 | + menu = null | ||
| 279 | + const paths = selection.includes(path) ? [...selection] : [path] | ||
| 280 | + await attempt(async () => { | ||
| 281 | + try { | ||
| 282 | + const copies = (await WorkspaceService.Duplicate(agent, paths)) ?? [] | ||
| 283 | + if (copies.length) { | ||
| 284 | + selection = copies | ||
| 285 | + selected = copies[copies.length - 1] | ||
| 286 | + } | ||
| 287 | + } finally { | ||
| 288 | + await refresh() | ||
| 289 | + } | ||
| 290 | + }) | ||
| 291 | + } | ||
| 292 | + | ||
| 293 | + function askMove(path: string) { | ||
| 294 | + menu = null | ||
| 295 | + moving = selection.includes(path) ? [...selection] : [path] | ||
| 296 | + moveTarget = parentOf(path) | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + // Drag and drop: the dragged entry, with the rest of the selection when | ||
| 300 | + // it is part of it, goes into the folder dropped on (or the folder of the | ||
| 301 | + // file dropped on, or the root below the rows). | ||
| 302 | + function dragStart(event: DragEvent, entry: Entry) { | ||
| 303 | + dragging = selection.includes(entry.path) ? [...selection] : [entry.path] | ||
| 304 | + event.dataTransfer?.setData('text/plain', dragging.join('\n')) | ||
| 305 | + if (event.dataTransfer) event.dataTransfer.effectAllowed = 'move' | ||
| 306 | + } | ||
| 307 | + | ||
| 308 | + function dragOver(event: DragEvent, folder: string) { | ||
| 309 | + if (!dragging.length || !canDrop(dragging, folder)) return | ||
| 310 | + event.preventDefault() | ||
| 311 | + event.stopPropagation() | ||
| 312 | + dropTarget = folder | ||
| 313 | + } | ||
| 314 | + | ||
| 315 | + function drop(event: DragEvent, folder: string) { | ||
| 316 | + event.preventDefault() | ||
| 317 | + event.stopPropagation() | ||
| 318 | + const paths = dragging | ||
| 319 | + dragging = [] | ||
| 320 | + dropTarget = null | ||
| 321 | + void moveInto(paths, folder) | ||
| 322 | + } | ||
| 323 | + | ||
| 324 | + function dragEnd() { | ||
| 325 | + dragging = [] | ||
| 326 | + dropTarget = null | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + function openMenu(event: MouseEvent, entry: Entry) { | ||
| 330 | + event.preventDefault() | ||
| 331 | + if (!selection.includes(entry.path)) { | ||
| 332 | + selection = [entry.path] | ||
| 333 | + selected = entry.path | ||
| 334 | + } | ||
| 335 | + menu = { x: event.clientX, y: event.clientY, path: entry.path } | ||
| 336 | + } | ||
| 337 | + | ||
| 338 | + // Shortcuts of the tree: F2 renames, ⌘D duplicates, Delete (⌘⌫ on a Mac) deletes, ⌘A | ||
| 339 | + // selects every row shown, Escape closes the menu or empties the selection. | ||
| 340 | + function treeKey(event: KeyboardEvent) { | ||
| 341 | + if ((event.target as HTMLElement).tagName === 'INPUT') return | ||
| 342 | + const mod = event.metaKey || event.ctrlKey | ||
| 343 | + if (event.key === 'F2' && selection.length === 1 && !entryAt(selection[0])?.protected) { | ||
| 344 | + event.preventDefault() | ||
| 345 | + startRename(selection[0]) | ||
| 346 | + } else if ((event.key === 'Delete' || (event.key === 'Backspace' && mod)) && selection.length) { | ||
| 347 | + event.preventDefault() | ||
| 348 | + askRemove(selection[0]) | ||
| 349 | + } else if (mod && event.key.toLowerCase() === 'd' && selection.length) { | ||
| 350 | + event.preventDefault() | ||
| 351 | + void duplicate(selection[0]) | ||
| 352 | + } else if (mod && event.key.toLowerCase() === 'a') { | ||
| 353 | + event.preventDefault() | ||
| 354 | + selection = rows.map((row) => row.entry.path) | ||
| 355 | + } else if (event.key === 'Escape') { | ||
| 356 | + if (menu) menu = null | ||
| 357 | + else selection = [] | ||
| 358 | + } | ||
| 359 | + } | ||
| 360 | + | ||
| 361 | + function closeMenu(event: MouseEvent) { | ||
| 362 | + if (menu && !(event.target as HTMLElement).closest('.menu')) menu = null | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + function blocked(paths: string[]): boolean { | ||
| 366 | + return paths.some((path) => entryAt(path)?.protected) | ||
| 367 | + } | ||
| 368 | + | ||
| 369 | + // Shows a file or a folder in the Finder, the Explorer or the file manager. | ||
| 370 | + function reveal(path: string) { | ||
| 371 | + void attempt(() => WorkspaceService.Reveal(agent, path)) | ||
| 372 | + } | ||
| 373 | + | ||
| 164 | function focus(element: HTMLInputElement) { | 374 | function focus(element: HTMLInputElement) { |
| 165 | element.focus() | 375 | element.focus() |
| 166 | } | 376 | } |
| @@ -199,6 +409,7 @@ | |||
| 199 | if (!listings[dir]) await load(dir) | 409 | if (!listings[dir]) await load(dir) |
| 200 | } | 410 | } |
| 201 | selected = wanted | 411 | selected = wanted |
| 412 | + selection = [wanted] | ||
| 202 | await openFile(wanted) | 413 | await openFile(wanted) |
| 203 | }) | 414 | }) |
| 204 | }) | 415 | }) |
| @@ -215,49 +426,125 @@ | |||
| 215 | }) | 426 | }) |
| 216 | </script> | 427 | </script> |
| 217 | 428 | ||
| 429 | +<svelte:window onclick={closeMenu} /> | ||
| 430 | + | ||
| 218 | <div class="files"> | 431 | <div class="files"> |
| 219 | - <aside class="tree"> | 432 | + <!-- svelte-ignore a11y_no_noninteractive_element_interactions --> |
| 220 | - <ul> | 433 | + <aside class="tree" class:drop={dropTarget === ''} onkeydown={treeKey} ondragover={(event) => dragOver(event, '')} ondrop={(event) => drop(event, '')} ondragleave={() => (dropTarget = null)} aria-label={t('workspace.tree')}> |
| 434 | + {#if confirming.length > 1} | ||
| 435 | + <div class="confirm" role="alert"> | ||
| 436 | + <span>{inContainer ? t('workspace.deleteManyForGood', { count: confirming.length }) : t('workspace.deleteManyConfirm', { count: confirming.length })}</span> | ||
| 437 | + <button class="danger" onclick={() => remove(confirming)}>{t('workspace.delete')}</button> | ||
| 438 | + <button onclick={() => (confirming = [])}>{t('workspace.cancel')}</button> | ||
| 439 | + </div> | ||
| 440 | + {/if} | ||
| 441 | + {#if moving.length} | ||
| 442 | + <form class="create" onsubmit={(event) => { event.preventDefault(); void moveInto(moving, moveTarget.trim().replace(/^\/+|\/+$/g, '')) }}> | ||
| 443 | + <label for="move-target">{moving.length === 1 ? t('workspace.moveOne', { name: nameOf(moving[0]) }) : t('workspace.moveMany', { count: moving.length })}</label> | ||
| 444 | + <input id="move-target" use:focus bind:value={moveTarget} placeholder={t('workspace.moveTarget')} onkeydown={(event) => event.key === 'Escape' && (moving = [])} /> | ||
| 445 | + <button class="primary" disabled={!canDrop(moving, moveTarget.trim().replace(/^\/+|\/+$/g, ''))}>{t('workspace.move')}</button> | ||
| 446 | + <button type="button" onclick={() => (moving = [])}>{t('workspace.cancel')}</button> | ||
| 447 | + </form> | ||
| 448 | + {/if} | ||
| 449 | + <ul aria-multiselectable="true" role="tree"> | ||
| 221 | {#each rows as { entry, depth } (entry.path)} | 450 | {#each rows as { entry, depth } (entry.path)} |
| 222 | - <li class:selected={selected === entry.path} style:padding-left="{8 + depth * 14}px"> | 451 | + <li |
| 223 | - <button class="row" onclick={() => toggle(entry)} title={entry.path}> | 452 | + role="treeitem" |
| 224 | - <span aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | 453 | + aria-selected={selection.includes(entry.path)} |
| 225 | - {entry.name} | 454 | + class:selected={selection.includes(entry.path)} |
| 226 | - </button> | 455 | + class:drop={dropTarget === entry.path} |
| 456 | + style:padding-left="{8 + depth * 14}px" | ||
| 457 | + draggable={renaming !== entry.path} | ||
| 458 | + ondragstart={(event) => dragStart(event, entry)} | ||
| 459 | + ondragend={dragEnd} | ||
| 460 | + ondragover={(event) => dragOver(event, entry.dir ? entry.path : parentOf(entry.path))} | ||
| 461 | + ondrop={(event) => drop(event, entry.dir ? entry.path : parentOf(entry.path))} | ||
| 462 | + oncontextmenu={(event) => openMenu(event, entry)} | ||
| 463 | + > | ||
| 464 | + {#if renaming === entry.path} | ||
| 465 | + <form class="rename" onsubmit={(event) => { event.preventDefault(); void rename() }}> | ||
| 466 | + <span class="icon" aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | ||
| 467 | + <input use:focus bind:value={renameValue} aria-label={t('workspace.renameEntry', { name: entry.name })} onblur={() => void rename()} onkeydown={(event) => { if (event.key === 'Escape') { event.stopPropagation(); renaming = '' } }} /> | ||
| 468 | + </form> | ||
| 469 | + {:else} | ||
| 470 | + <button class="row" onclick={(event) => click(event, entry)} ondblclick={(event) => !entry.protected && !event.metaKey && !event.ctrlKey && !event.shiftKey && startRename(entry.path)} title={entry.path}> | ||
| 471 | + <span class="icon" aria-hidden="true">{iconFor(entry.name, entry.dir, open[entry.path])}</span> | ||
| 472 | + <span class="name">{entry.name}</span> | ||
| 473 | + </button> | ||
| 474 | + {/if} | ||
| 475 | + {#if revealable} | ||
| 476 | + <button class="action" onclick={() => reveal(entry.path)} aria-label={t('workspace.revealEntry', { name: entry.name })} title={t('linked.reveal')}>📂</button> | ||
| 477 | + {/if} | ||
| 227 | {#if entry.protected} | 478 | {#if entry.protected} |
| 228 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> | 479 | <span class="lock" title={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')} aria-label={entry.dir ? t('workspace.protectedFolder') : t('workspace.protected')}>🔒</span> |
| 229 | {:else} | 480 | {:else} |
| 230 | - <button class="remove" onclick={() => (confirming = entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | 481 | + <button class="action" onclick={() => startRename(entry.path)} aria-label={t('workspace.renameEntry', { name: entry.name })} title={t('workspace.renameEntry', { name: entry.name })}>✏️</button> |
| 482 | + <button class="action" onclick={() => askRemove(entry.path)} aria-label={t('workspace.deleteFile', { name: entry.name })} title={t('workspace.deleteFile', { name: entry.name })}>🗑</button> | ||
| 231 | {/if} | 483 | {/if} |
| 232 | </li> | 484 | </li> |
| 233 | - {#if confirming === entry.path} | 485 | + {#if confirming.length === 1 && confirming[0] === entry.path} |
| 234 | <li class="confirm"> | 486 | <li class="confirm"> |
| 235 | <span role="alert">{inContainer ? t('workspace.deleteForGood', { name: entry.name }) : t('workspace.deleteConfirm', { name: entry.name })}</span> | 487 | <span role="alert">{inContainer ? t('workspace.deleteForGood', { name: entry.name }) : t('workspace.deleteConfirm', { name: entry.name })}</span> |
| 236 | - <button class="danger" onclick={() => remove(entry.path)}>{t('workspace.delete')}</button> | 488 | + <button class="danger" onclick={() => remove(confirming)}>{t('workspace.delete')}</button> |
| 237 | - <button onclick={() => (confirming = '')}>{t('workspace.cancel')}</button> | 489 | + <button onclick={() => (confirming = [])}>{t('workspace.cancel')}</button> |
| 238 | </li> | 490 | </li> |
| 239 | {/if} | 491 | {/if} |
| 240 | {:else} | 492 | {:else} |
| 241 | <li class="empty">{t('workspace.empty')}</li> | 493 | <li class="empty">{t('workspace.empty')}</li> |
| 242 | {/each} | 494 | {/each} |
| 243 | </ul> | 495 | </ul> |
| 496 | + {#if selection.length > 1} | ||
| 497 | + <p class="count">{t('workspace.selected', { count: selection.length })}</p> | ||
| 498 | + {/if} | ||
| 244 | {#if creating} | 499 | {#if creating} |
| 245 | <form class="create" onsubmit={(event) => { event.preventDefault(); void create() }}> | 500 | <form class="create" onsubmit={(event) => { event.preventDefault(); void create() }}> |
| 246 | - <label for="new-file">{t('workspace.newFileIn', { folder: targetFolder || '/' })}</label> | 501 | + <label for="new-file">{creating === 'folder' ? t('workspace.newFolderIn', { folder: targetFolder || '/' }) : t('workspace.newFileIn', { folder: targetFolder || '/' })}</label> |
| 247 | - <input id="new-file" use:focus bind:value={newName} placeholder={t('workspace.fileName')} onkeydown={(event) => event.key === 'Escape' && (creating = false)} /> | 502 | + <input id="new-file" use:focus bind:value={newName} placeholder={creating === 'folder' ? t('workspace.folderName') : t('workspace.fileName')} onkeydown={(event) => event.key === 'Escape' && (creating = '')} /> |
| 248 | <button class="primary" disabled={!validFileName(newName)}>{t('workspace.create')}</button> | 503 | <button class="primary" disabled={!validFileName(newName)}>{t('workspace.create')}</button> |
| 249 | </form> | 504 | </form> |
| 250 | {:else} | 505 | {:else} |
| 251 | - <button class="link" onclick={() => (creating = true)}>{t('workspace.newFile')}</button> | 506 | + <div class="links"> |
| 507 | + <button class="link" onclick={() => (creating = 'file')}>{t('workspace.newFile')}</button> | ||
| 508 | + <button class="link" onclick={() => (creating = 'folder')}>{t('workspace.newFolder')}</button> | ||
| 509 | + </div> | ||
| 252 | {/if} | 510 | {/if} |
| 253 | <label class="hidden"><input type="checkbox" bind:checked={showHidden} /> {t('workspace.showHidden')}</label> | 511 | <label class="hidden"><input type="checkbox" bind:checked={showHidden} /> {t('workspace.showHidden')}</label> |
| 254 | </aside> | 512 | </aside> |
| 255 | 513 | ||
| 514 | + {#if menu} | ||
| 515 | + {@const many = selection.length > 1 && selection.includes(menu.path)} | ||
| 516 | + {@const targets = many ? selection : [menu.path]} | ||
| 517 | + {@const entry = entryAt(menu.path)} | ||
| 518 | + <div class="menu" role="menu" tabindex="-1" style:left="{menu.x}px" style:top="{menu.y}px" onkeydown={(event) => event.key === 'Escape' && (menu = null)}> | ||
| 519 | + {#if !many && entry && !entry.dir} | ||
| 520 | + <button role="menuitem" onclick={() => { const path = menu!.path; menu = null; selected = path; void openFile(path) }}>{t('workspace.menu.open')}</button> | ||
| 521 | + {/if} | ||
| 522 | + {#if !many && entry && !entry.protected} | ||
| 523 | + <button role="menuitem" onclick={() => startRename(menu!.path)}>{t('workspace.menu.rename')}</button> | ||
| 524 | + {/if} | ||
| 525 | + {#if !blocked(targets)} | ||
| 526 | + <button role="menuitem" onclick={() => askMove(menu!.path)}>{many ? t('workspace.menu.moveMany', { count: targets.length }) : t('workspace.menu.move')}</button> | ||
| 527 | + {/if} | ||
| 528 | + <button role="menuitem" onclick={() => duplicate(menu!.path)}>{many ? t('workspace.menu.duplicateMany', { count: targets.length }) : t('workspace.menu.duplicate')}</button> | ||
| 529 | + {#if !many && revealable} | ||
| 530 | + <button role="menuitem" onclick={() => { const path = menu!.path; menu = null; reveal(path) }}>📂 {t('linked.reveal')}</button> | ||
| 531 | + {/if} | ||
| 532 | + <button role="menuitem" onclick={() => { selected = menu!.path; menu = null; creating = 'file' }}>{t('workspace.newFile')}</button> | ||
| 533 | + <button role="menuitem" onclick={() => { selected = menu!.path; menu = null; creating = 'folder' }}>{t('workspace.newFolder')}</button> | ||
| 534 | + {#if !blocked(targets)} | ||
| 535 | + <button role="menuitem" class="danger-text" onclick={() => askRemove(menu!.path)}>{many ? t('workspace.menu.deleteMany', { count: targets.length }) : t('workspace.delete')}</button> | ||
| 536 | + {/if} | ||
| 537 | + </div> | ||
| 538 | + {/if} | ||
| 539 | + | ||
| 256 | <section class="editor"> | 540 | <section class="editor"> |
| 257 | {#if error}<p class="error" role="alert">{t('workspace.cannotOpen', { error })}</p>{/if} | 541 | {#if error}<p class="error" role="alert">{t('workspace.cannotOpen', { error })}</p>{/if} |
| 258 | {#if file} | 542 | {#if file} |
| 259 | <header> | 543 | <header> |
| 260 | <span class="path">{file.path}</span> | 544 | <span class="path">{file.path}</span> |
| 545 | + {#if revealable} | ||
| 546 | + <button class="reveal" onclick={() => file && reveal(file.path)}>📂 {t('linked.reveal')}</button> | ||
| 547 | + {/if} | ||
| 261 | {#if kind && kind !== 'image'} | 548 | {#if kind && kind !== 'image'} |
| 262 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> | 549 | <span class="modes" role="tablist" aria-label={t('preview.modes')}> |
| 263 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> | 550 | <button role="tab" aria-selected={mode === 'preview'} class:active={mode === 'preview'} onclick={() => (mode = 'preview')}>{t('preview.preview')}</button> |
| @@ -288,14 +575,14 @@ | |||
| 288 | {#if file.readOnly} | 575 | {#if file.readOnly} |
| 289 | <span class="readonly-hint">{t('workspace.protected')}</span> | 576 | <span class="readonly-hint">{t('workspace.protected')}</span> |
| 290 | {:else} | 577 | {:else} |
| 291 | - <button class="danger-outline" onclick={() => file && (confirming = file.path)}>{t('workspace.delete')}</button> | 578 | + <button class="danger-outline" onclick={() => file && (confirming = [file.path])}>{t('workspace.delete')}</button> |
| 292 | {/if} | 579 | {/if} |
| 293 | </footer> | 580 | </footer> |
| 294 | {:else if file.readOnly} | 581 | {:else if file.readOnly} |
| 295 | <footer><span class="readonly-hint">{t('workspace.protected')}</span></footer> | 582 | <footer><span class="readonly-hint">{t('workspace.protected')}</span></footer> |
| 296 | {:else} | 583 | {:else} |
| 297 | <footer> | 584 | <footer> |
| 298 | - <button class="danger-outline" onclick={() => file && (confirming = file.path)}>{t('workspace.delete')}</button> | 585 | + <button class="danger-outline" onclick={() => file && (confirming = [file.path])}>{t('workspace.delete')}</button> |
| 299 | <span class="spacer"></span> | 586 | <span class="spacer"></span> |
| 300 | <button disabled={!dirty} onclick={() => { if (file) { draft = file.content; editor?.setContent(file.content) } }}>{t('workspace.revert')}</button> | 587 | <button disabled={!dirty} onclick={() => { if (file) { draft = file.content; editor?.setContent(file.content) } }}>{t('workspace.revert')}</button> |
| 301 | <button class="primary" disabled={!dirty} onclick={() => save()}>{t('workspace.save')}</button> | 588 | <button class="primary" disabled={!dirty} onclick={() => save()}>{t('workspace.save')}</button> |
| @@ -313,17 +600,32 @@ | |||
| 313 | ul { list-style: none; margin: 0; padding: 0; } | 600 | ul { list-style: none; margin: 0; padding: 0; } |
| 314 | li { display: flex; align-items: center; border-radius: 4px; } | 601 | li { display: flex; align-items: center; border-radius: 4px; } |
| 315 | li:hover, li.selected { background: var(--panel-2); } | 602 | li:hover, li.selected { background: var(--panel-2); } |
| 316 | - .row { flex: 1; min-width: 0; display: flex; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | 603 | + li.selected { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 2px 0 0 var(--accent); } |
| 317 | - .remove { border: none; background: none; padding: 0 6px; font-size: 11px; opacity: 0; } | 604 | + li.drop, .tree.drop { outline: 1px dashed var(--accent); outline-offset: -1px; } |
| 605 | + .rename { flex: 1; min-width: 0; display: flex; gap: 6px; align-items: center; padding: 1px 4px; font-family: var(--mono); font-size: 12.5px; } | ||
| 606 | + .rename input { flex: 1; min-width: 0; font: inherit; padding: 1px 4px; border: 1px solid var(--accent); border-radius: 3px; background: var(--bg); color: var(--text); } | ||
| 607 | + .count { margin: 4px 10px 0; color: var(--muted); font-size: 12px; } | ||
| 608 | + .links { display: flex; gap: 12px; } | ||
| 609 | + .menu { position: fixed; z-index: 50; min-width: 180px; display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); } | ||
| 610 | + .menu button { border: none; background: none; text-align: left; padding: 4px 10px; border-radius: 4px; font-size: 12.5px; } | ||
| 611 | + .menu button:hover, .menu button:focus-visible { background: var(--panel-2); } | ||
| 612 | + .danger-text { color: var(--danger); } | ||
| 613 | + .row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; text-align: left; border: none; background: none; padding: 3px 4px; font-family: var(--mono); font-size: 12.5px; line-height: 18px; white-space: nowrap; } | ||
| 614 | + /* The emoji is taller than the monospace text: a fixed box, centred, so that every name starts at the same place and sits on the same line as its icon. */ | ||
| 615 | + .icon { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; line-height: 1; } | ||
| 616 | + .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; } | ||
| 617 | + .action { border: none; background: none; padding: 0 4px; font-size: 11px; opacity: 0; } | ||
| 618 | + .reveal { border: none; background: none; padding: 0; font-size: 12px; color: var(--accent); } | ||
| 318 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } | 619 | .lock { padding: 0 6px; font-size: 11px; opacity: 0.7; } |
| 319 | .readonly { color: var(--muted); font-size: 12px; } | 620 | .readonly { color: var(--muted); font-size: 12px; } |
| 320 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } | 621 | .modes { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; } |
| 321 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } | 622 | .modes button { border: none; border-radius: 0; padding: 2px 10px; font-size: 12px; background: none; } |
| 322 | .modes button.active { background: var(--accent); color: #fff; } | 623 | .modes button.active { background: var(--accent); color: #fff; } |
| 323 | .readonly-hint { color: var(--muted); font-size: 12px; } | 624 | .readonly-hint { color: var(--muted); font-size: 12px; } |
| 324 | - li:hover .remove { opacity: 1; } | 625 | + li:hover .action, li:has(:focus-visible) .action { opacity: 1; } |
| 325 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } | 626 | .confirm { flex-wrap: wrap; gap: 6px; margin: 2px 8px 6px; padding: 6px 8px; border: 1px solid var(--danger); font-size: 12px; } |
| 326 | .confirm span { flex-basis: 100%; } | 627 | .confirm span { flex-basis: 100%; } |
| 628 | + div.confirm { display: flex; border-radius: 4px; } | ||
| 327 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } | 629 | .empty, .pick { color: var(--muted); font-size: 12px; padding: 4px 10px; } |
| 328 | .pick { margin: auto; } | 630 | .pick { margin: auto; } |
| 329 | .link { align-self: flex-start; margin: 8px 8px 0; border: none; background: none; color: var(--accent); font-size: 12px; padding: 0; } | 631 | .link { align-self: flex-start; margin: 8px 8px 0; border: none; background: none; color: var(--accent); font-size: 12px; padding: 0; } |
modified
frontend/src/lib/agent/TerminalView.svelte +18 -65 | @@ -1,95 +1,48 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | - // A shell in the agent's folder (issue #31): xterm.js here, a | |
| 4 | - // pseudo-terminal on the Go side (local, or docker exec). The shell ends | |
| 5 | - // when this view goes away. | |
| 3 | + // Shows one terminal of an agent (issues #31, #72): xterm.js here, a | |
| 4 | + // pseudo-terminal on the Go side (local, docker exec or sbx exec). The | |
| 5 | + // terminal lives in terminalSessions: when this view goes away, its shell | |
| 6 | + // and its screen go on, and come back as they are. | |
| 6 | 7 | import { onMount } from 'svelte' |
| 7 | - import { Terminal } from '@xterm/xterm' | |
| 8 | - import { FitAddon } from '@xterm/addon-fit' | |
| 9 | 8 | import '@xterm/xterm/css/xterm.css' |
| 10 | - import { TerminalService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 11 | 9 | import { t } from '../i18n/index.svelte' |
| 12 | - import { listenTerminal } from '../terminals' | |
| 10 | + import { attachTerminal, fitTerminal, focusTerminal, restartTerminal, type TerminalSession } from '../terminalSessions.svelte' | |
| 13 | 11 | import ErrorText from '../chat/ErrorText.svelte' |
| 14 | 12 | |
| 15 | - let { agent, visible }: { agent: string; visible: boolean } = $props() | |
| 13 | + let { session, visible }: { session: TerminalSession; visible: boolean } = $props() | |
| 16 | 14 | |
| 17 | 15 | let host: HTMLElement |
| 18 | - let terminal: Terminal | undefined | |
| 19 | - let fit: FitAddon | undefined | |
| 20 | - let id = '' | |
| 21 | - let stopListening = () => {} | |
| 22 | - let ended = $state(false) | |
| 23 | - let error = $state('') | |
| 24 | - | |
| 25 | - async function openShell() { | |
| 26 | - if (!terminal || !fit) return | |
| 27 | - ended = false | |
| 28 | - error = '' | |
| 29 | - terminal.reset() | |
| 30 | - fit.fit() | |
| 31 | - try { | |
| 32 | - id = (await TerminalService.Open(agent, terminal.cols, terminal.rows)) ?? '' | |
| 33 | - } catch (problem) { | |
| 34 | - error = problem instanceof Error ? problem.message : String(problem) | |
| 35 | - return | |
| 36 | - } | |
| 37 | - stopListening = listenTerminal( | |
| 38 | - id, | |
| 39 | - (data) => terminal?.write(data), | |
| 40 | - () => { | |
| 41 | - ended = true | |
| 42 | - id = '' | |
| 43 | - }, | |
| 44 | - ) | |
| 45 | - terminal.focus() | |
| 46 | - } | |
| 47 | - | |
| 48 | - // Follows the size of the panel; the shell is told the new size. | |
| 49 | - function resize() { | |
| 50 | - if (!terminal || !fit || !visible || host.clientWidth === 0) return | |
| 51 | - fit.fit() | |
| 52 | - if (id) void TerminalService.Resize(id, terminal.cols, terminal.rows) | |
| 53 | - } | |
| 54 | 16 | |
| 55 | 17 | onMount(() => { |
| 56 | - terminal = new Terminal({ | |
| 57 | - fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--mono') || 'monospace', | |
| 58 | - fontSize: 13, | |
| 59 | - cursorBlink: true, | |
| 60 | - theme: { background: '#16181d', foreground: '#e6e6e6' }, | |
| 61 | - }) | |
| 62 | - fit = new FitAddon() | |
| 63 | - terminal.loadAddon(fit) | |
| 64 | - terminal.open(host) | |
| 65 | - terminal.onData((data) => { | |
| 66 | - if (id) void TerminalService.Write(id, data) | |
| 18 | + const key = session.key | |
| 19 | + const detach = attachTerminal(key, host) | |
| 20 | + // Follows the size of the panel; the shell is told the new size. | |
| 21 | + const observer = new ResizeObserver(() => { | |
| 22 | + if (visible) fitTerminal(key) | |
| 67 | 23 | }) |
| 68 | - const observer = new ResizeObserver(() => resize()) | |
| 69 | 24 | observer.observe(host) |
| 70 | - void openShell() | |
| 71 | 25 | return () => { |
| 72 | 26 | observer.disconnect() |
| 73 | - stopListening() | |
| 74 | - if (id) void TerminalService.Close(id) | |
| 75 | - terminal?.dispose() | |
| 27 | + detach() | |
| 76 | 28 | } |
| 77 | 29 | }) |
| 78 | 30 | |
| 79 | 31 | $effect(() => { |
| 32 | + const key = session.key | |
| 80 | 33 | if (visible) queueMicrotask(() => { |
| 81 | - resize() | |
| 82 | - terminal?.focus() | |
| 34 | + fitTerminal(key) | |
| 35 | + focusTerminal(key) | |
| 83 | 36 | }) |
| 84 | 37 | }) |
| 85 | 38 | </script> |
| 86 | 39 | |
| 87 | 40 | <div class="terminal"> |
| 88 | 41 | <div class="screen" bind:this={host}></div> |
| 89 | - {#if ended || error} | |
| 42 | + {#if session.ended} | |
| 90 | 43 | <div class="ended"> |
| 91 | - <span>{#if error}{t('terminal.error')} <ErrorText raw={error} />{:else}{t('terminal.ended')}{/if}</span> | |
| 92 | - <button onclick={openShell}>{t('terminal.restart')}</button> | |
| 44 | + <span>{#if session.error}{t('terminal.error')} <ErrorText raw={session.error} />{:else}{t('terminal.ended')}{/if}</span> | |
| 45 | + <button onclick={() => restartTerminal(session.key)}>{t('terminal.restart')}</button> | |
| 93 | 46 | </div> |
| 94 | 47 | {/if} |
| 95 | 48 | </div> |
| @@ -1,95 +1,48 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | - // A shell in the agent's folder (issue #31): xterm.js here, a | 3 | + // Shows one terminal of an agent (issues #31, #72): xterm.js here, a |
| 4 | - // pseudo-terminal on the Go side (local, or docker exec). The shell ends | 4 | + // pseudo-terminal on the Go side (local, docker exec or sbx exec). The |
| 5 | - // when this view goes away. | 5 | + // terminal lives in terminalSessions: when this view goes away, its shell |
| 6 | + // and its screen go on, and come back as they are. | ||
| 6 | import { onMount } from 'svelte' | 7 | import { onMount } from 'svelte' |
| 7 | - import { Terminal } from '@xterm/xterm' | ||
| 8 | - import { FitAddon } from '@xterm/addon-fit' | ||
| 9 | import '@xterm/xterm/css/xterm.css' | 8 | import '@xterm/xterm/css/xterm.css' |
| 10 | - import { TerminalService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 11 | import { t } from '../i18n/index.svelte' | 9 | import { t } from '../i18n/index.svelte' |
| 12 | - import { listenTerminal } from '../terminals' | 10 | + import { attachTerminal, fitTerminal, focusTerminal, restartTerminal, type TerminalSession } from '../terminalSessions.svelte' |
| 13 | import ErrorText from '../chat/ErrorText.svelte' | 11 | import ErrorText from '../chat/ErrorText.svelte' |
| 14 | 12 | ||
| 15 | - let { agent, visible }: { agent: string; visible: boolean } = $props() | 13 | + let { session, visible }: { session: TerminalSession; visible: boolean } = $props() |
| 16 | 14 | ||
| 17 | let host: HTMLElement | 15 | let host: HTMLElement |
| 18 | - let terminal: Terminal | undefined | ||
| 19 | - let fit: FitAddon | undefined | ||
| 20 | - let id = '' | ||
| 21 | - let stopListening = () => {} | ||
| 22 | - let ended = $state(false) | ||
| 23 | - let error = $state('') | ||
| 24 | - | ||
| 25 | - async function openShell() { | ||
| 26 | - if (!terminal || !fit) return | ||
| 27 | - ended = false | ||
| 28 | - error = '' | ||
| 29 | - terminal.reset() | ||
| 30 | - fit.fit() | ||
| 31 | - try { | ||
| 32 | - id = (await TerminalService.Open(agent, terminal.cols, terminal.rows)) ?? '' | ||
| 33 | - } catch (problem) { | ||
| 34 | - error = problem instanceof Error ? problem.message : String(problem) | ||
| 35 | - return | ||
| 36 | - } | ||
| 37 | - stopListening = listenTerminal( | ||
| 38 | - id, | ||
| 39 | - (data) => terminal?.write(data), | ||
| 40 | - () => { | ||
| 41 | - ended = true | ||
| 42 | - id = '' | ||
| 43 | - }, | ||
| 44 | - ) | ||
| 45 | - terminal.focus() | ||
| 46 | - } | ||
| 47 | - | ||
| 48 | - // Follows the size of the panel; the shell is told the new size. | ||
| 49 | - function resize() { | ||
| 50 | - if (!terminal || !fit || !visible || host.clientWidth === 0) return | ||
| 51 | - fit.fit() | ||
| 52 | - if (id) void TerminalService.Resize(id, terminal.cols, terminal.rows) | ||
| 53 | - } | ||
| 54 | 16 | ||
| 55 | onMount(() => { | 17 | onMount(() => { |
| 56 | - terminal = new Terminal({ | 18 | + const key = session.key |
| 57 | - fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--mono') || 'monospace', | 19 | + const detach = attachTerminal(key, host) |
| 58 | - fontSize: 13, | 20 | + // Follows the size of the panel; the shell is told the new size. |
| 59 | - cursorBlink: true, | 21 | + const observer = new ResizeObserver(() => { |
| 60 | - theme: { background: '#16181d', foreground: '#e6e6e6' }, | 22 | + if (visible) fitTerminal(key) |
| 61 | - }) | ||
| 62 | - fit = new FitAddon() | ||
| 63 | - terminal.loadAddon(fit) | ||
| 64 | - terminal.open(host) | ||
| 65 | - terminal.onData((data) => { | ||
| 66 | - if (id) void TerminalService.Write(id, data) | ||
| 67 | }) | 23 | }) |
| 68 | - const observer = new ResizeObserver(() => resize()) | ||
| 69 | observer.observe(host) | 24 | observer.observe(host) |
| 70 | - void openShell() | ||
| 71 | return () => { | 25 | return () => { |
| 72 | observer.disconnect() | 26 | observer.disconnect() |
| 73 | - stopListening() | 27 | + detach() |
| 74 | - if (id) void TerminalService.Close(id) | ||
| 75 | - terminal?.dispose() | ||
| 76 | } | 28 | } |
| 77 | }) | 29 | }) |
| 78 | 30 | ||
| 79 | $effect(() => { | 31 | $effect(() => { |
| 32 | + const key = session.key | ||
| 80 | if (visible) queueMicrotask(() => { | 33 | if (visible) queueMicrotask(() => { |
| 81 | - resize() | 34 | + fitTerminal(key) |
| 82 | - terminal?.focus() | 35 | + focusTerminal(key) |
| 83 | }) | 36 | }) |
| 84 | }) | 37 | }) |
| 85 | </script> | 38 | </script> |
| 86 | 39 | ||
| 87 | <div class="terminal"> | 40 | <div class="terminal"> |
| 88 | <div class="screen" bind:this={host}></div> | 41 | <div class="screen" bind:this={host}></div> |
| 89 | - {#if ended || error} | 42 | + {#if session.ended} |
| 90 | <div class="ended"> | 43 | <div class="ended"> |
| 91 | - <span>{#if error}{t('terminal.error')} <ErrorText raw={error} />{:else}{t('terminal.ended')}{/if}</span> | 44 | + <span>{#if session.error}{t('terminal.error')} <ErrorText raw={session.error} />{:else}{t('terminal.ended')}{/if}</span> |
| 92 | - <button onclick={openShell}>{t('terminal.restart')}</button> | 45 | + <button onclick={() => restartTerminal(session.key)}>{t('terminal.restart')}</button> |
| 93 | </div> | 46 | </div> |
| 94 | {/if} | 47 | {/if} |
| 95 | </div> | 48 | </div> |
modified
frontend/src/lib/agentform.test.ts +110 -1 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { argumentsFor, emptyForm, folderOf, nameFromTitle, problemsOf, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' | |
| 4 | +import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sandboxMismatch, sbxAgentOf, sbxArguments, withSbxProgram, programOfSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' | |
| 5 | 5 | |
| 6 | 6 | describe('nameFromTitle', () => { |
| 7 | 7 | it('folds accents, lowercases and joins words', () => { |
| @@ -98,3 +98,112 @@ describe('withComposeService', () => { | ||
| 98 | 98 | }) |
| 99 | 99 | }) |
| 100 | 100 | }) |
| 101 | + | |
| 102 | +describe('Claude in an sbx sandbox (issue #81)', () => { | |
| 103 | + it('offers claude-agent-acp in a sandbox only', () => { | |
| 104 | + expect(programsFor('sbx')).toContain('claude-agent-acp') | |
| 105 | + expect(programsFor('local')).not.toContain('claude-agent-acp') | |
| 106 | + expect(programsFor('container')).not.toContain('claude-agent-acp') | |
| 107 | + }) | |
| 108 | + | |
| 109 | + it('recognises the form', () => { | |
| 110 | + expect(isClaudeSandbox({ ...emptyForm(), environment: 'sbx', program: ' claude-agent-acp ' })).toBe(true) | |
| 111 | + expect(isClaudeSandbox({ ...emptyForm(), environment: 'local', program: 'claude-agent-acp' })).toBe(false) | |
| 112 | + }) | |
| 113 | +}) | |
| 114 | + | |
| 115 | +describe('Codex and Gemini in an sbx sandbox (issues #82, #84)', () => { | |
| 116 | + it('offers their programs in a sandbox only', () => { | |
| 117 | + expect(programsFor('sbx')).toEqual(expect.arrayContaining(['codex-acp', 'gemini'])) | |
| 118 | + expect(programsFor('local')).not.toContain('gemini') | |
| 119 | + expect(sbxArguments.gemini).toBe('--acp') | |
| 120 | + expect(sbxArguments.codex).toBe('') | |
| 121 | + }) | |
| 122 | + | |
| 123 | + it('recognises which agent the form describes', () => { | |
| 124 | + const sbx = { ...emptyForm(), environment: 'sbx' as const } | |
| 125 | + expect(sbxAgentOf({ ...sbx, program: '/home/agent/.local/bin/codex-acp' })).toBe('codex') | |
| 126 | + expect(sbxAgentOf({ ...sbx, program: 'codex-acp' })).toBe('codex') | |
| 127 | + expect(sbxAgentOf({ ...sbx, program: ' gemini ' })).toBe('gemini') | |
| 128 | + expect(sbxAgentOf({ ...sbx, program: 'claude-agent-acp' })).toBe('claude') | |
| 129 | + expect(sbxAgentOf({ ...sbx, program: 'mm' })).toBeUndefined() | |
| 130 | + expect(sbxAgentOf({ ...emptyForm(), environment: 'local', program: 'gemini' })).toBeUndefined() | |
| 131 | + }) | |
| 132 | +}) | |
| 133 | + | |
| 134 | +describe('sandboxMismatch', () => { | |
| 135 | + const codex = { ...emptyForm(), environment: 'sbx' as const, program: 'codex-acp' } | |
| 136 | + it("names the file's agent when it is not the program's", () => { | |
| 137 | + expect(sandboxMismatch(codex, 'claude')).toBe('claude') | |
| 138 | + }) | |
| 139 | + it('is empty when they match, or when one of them is unknown', () => { | |
| 140 | + expect(sandboxMismatch(codex, 'codex')).toBe('') | |
| 141 | + expect(sandboxMismatch(codex, '')).toBe('') | |
| 142 | + expect(sandboxMismatch(codex, undefined)).toBe('') | |
| 143 | + expect(sandboxMismatch({ ...codex, program: 'mm' }, 'claude')).toBe('') | |
| 144 | + }) | |
| 145 | +}) | |
| 146 | + | |
| 147 | +describe('the program follows the sandbox file (agent:)', () => { | |
| 148 | + const env = { name: 'gemini-acp', agent: 'gemini', workspace: '', sandboxFolder: '/a', createCommand: 'c', stopCommand: 's', removeCommand: 'r' } | |
| 149 | + it('chooses Claude, Codex or Gemini with their arguments', () => { | |
| 150 | + expect(withSandboxEnv(emptyForm(), env)).toMatchObject({ program: 'gemini', arguments: '--acp' }) | |
| 151 | + expect(withSandboxEnv(emptyForm(), { ...env, agent: 'codex' })).toMatchObject({ program: 'codex-acp', arguments: '' }) | |
| 152 | + expect(withSandboxEnv(emptyForm(), { ...env, agent: 'claude' })).toMatchObject({ program: 'claude-agent-acp', arguments: '' }) | |
| 153 | + }) | |
| 154 | + it('replaces a program of the list, with its arguments', () => { | |
| 155 | + const form = { ...emptyForm(), program: 'mm', arguments: '--acp --config a.yaml' } | |
| 156 | + expect(withSbxProgram(form, 'claude')).toMatchObject({ program: 'claude-agent-acp', arguments: '' }) | |
| 157 | + expect(withSbxProgram({ ...form, program: 'gemini', arguments: '--acp' }, 'codex')).toMatchObject({ program: 'codex-acp', arguments: '' }) | |
| 158 | + }) | |
| 159 | + it('keeps a program typed by hand, the same program with its arguments, and unknown agents', () => { | |
| 160 | + const typed = { ...emptyForm(), program: 'my-wrapper', arguments: '-v' } | |
| 161 | + expect(withSbxProgram(typed, 'codex')).toBe(typed) | |
| 162 | + const old = { ...emptyForm(), program: 'gemini', arguments: '--experimental-acp' } | |
| 163 | + expect(withSbxProgram(old, 'gemini')).toBe(old) | |
| 164 | + expect(withSbxProgram(emptyForm(), 'shell')).toEqual(emptyForm()) | |
| 165 | + expect(withSbxProgram(emptyForm(), undefined)).toEqual(emptyForm()) | |
| 166 | + }) | |
| 167 | +}) | |
| 168 | + | |
| 169 | +describe('mini-me in a sandbox', () => { | |
| 170 | + it('chooses mm for a mini-me kit', () => { | |
| 171 | + expect(programOfSandbox('mini-me-kit')).toEqual({ program: 'mm', arguments: '--acp' }) | |
| 172 | + expect(programOfSandbox('minime')).toEqual({ program: 'mm', arguments: '--acp' }) | |
| 173 | + expect(programOfSandbox('mini-meteo')).toBeUndefined() | |
| 174 | + expect(withSandboxEnv(emptyForm(), { name: 'milo-sbx', agent: 'mini-me-kit', workspace: '', sandboxFolder: '/a', createCommand: '', stopCommand: '', removeCommand: '' })).toMatchObject({ program: 'mm', arguments: '--acp' }) | |
| 175 | + }) | |
| 176 | + it('keeps mm with its configuration file', () => { | |
| 177 | + const form = { ...emptyForm(), program: 'mm', arguments: '--acp --config /a/agent.yaml' } | |
| 178 | + expect(withSbxProgram(form, 'mini-me-kit')).toBe(form) | |
| 179 | + }) | |
| 180 | + it('is not a coding agent of a third-party kit: its configuration file is still asked', () => { | |
| 181 | + expect(sbxAgentOf({ ...emptyForm(), environment: 'sbx', program: 'mm' })).toBeUndefined() | |
| 182 | + }) | |
| 183 | +}) | |
| 184 | + | |
| 185 | +describe('Docker Agent in a sandbox (issue #87)', () => { | |
| 186 | + it('chooses docker-agent for the sbx agent docker-agent, or cagent', () => { | |
| 187 | + expect(programOfSandbox('docker-agent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) | |
| 188 | + expect(programOfSandbox('cagent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) | |
| 189 | + }) | |
| 190 | + it('replaces "docker agent" of the list, and keeps docker-agent with its file', () => { | |
| 191 | + expect(withSbxProgram({ ...emptyForm(), program: 'docker agent', arguments: 'serve acp a.yaml' }, 'docker-agent')).toMatchObject({ program: 'docker-agent', arguments: 'serve acp' }) | |
| 192 | + const form = { ...emptyForm(), program: 'docker-agent', arguments: 'serve acp /a/agent.yaml' } | |
| 193 | + expect(withSbxProgram(form, 'docker-agent')).toBe(form) | |
| 194 | + }) | |
| 195 | + it('then takes its configuration file', () => { | |
| 196 | + expect(argumentsFor('docker-agent', '/a/agent.yaml')).toBe('serve acp /a/agent.yaml') | |
| 197 | + }) | |
| 198 | +}) | |
| 199 | + | |
| 200 | +describe('Docker Agent without its agent file', () => { | |
| 201 | + const form = { ...emptyForm(), name: 'da', workspace: '/a', environment: 'sbx' as const, box: 'da-sbx', program: 'docker-agent', arguments: 'serve acp' } | |
| 202 | + it('is refused', () => { | |
| 203 | + expect(problemsOf(form)).toEqual(['agentFile']) | |
| 204 | + expect(problemsOf({ ...form, program: 'docker agent', arguments: ' serve acp ' })).toEqual(['agentFile']) | |
| 205 | + }) | |
| 206 | + it('is accepted with the file', () => { | |
| 207 | + expect(problemsOf({ ...form, arguments: 'serve acp /a/agent.yaml' })).toEqual([]) | |
| 208 | + }) | |
| 209 | +}) | |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { argumentsFor, emptyForm, folderOf, nameFromTitle, problemsOf, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' | 4 | +import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sandboxMismatch, sbxAgentOf, sbxArguments, withSbxProgram, programOfSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' |
| 5 | 5 | ||
| 6 | describe('nameFromTitle', () => { | 6 | describe('nameFromTitle', () => { |
| 7 | it('folds accents, lowercases and joins words', () => { | 7 | it('folds accents, lowercases and joins words', () => { |
| @@ -98,3 +98,112 @@ describe('withComposeService', () => { | |||
| 98 | }) | 98 | }) |
| 99 | }) | 99 | }) |
| 100 | }) | 100 | }) |
| 101 | + | ||
| 102 | +describe('Claude in an sbx sandbox (issue #81)', () => { | ||
| 103 | + it('offers claude-agent-acp in a sandbox only', () => { | ||
| 104 | + expect(programsFor('sbx')).toContain('claude-agent-acp') | ||
| 105 | + expect(programsFor('local')).not.toContain('claude-agent-acp') | ||
| 106 | + expect(programsFor('container')).not.toContain('claude-agent-acp') | ||
| 107 | + }) | ||
| 108 | + | ||
| 109 | + it('recognises the form', () => { | ||
| 110 | + expect(isClaudeSandbox({ ...emptyForm(), environment: 'sbx', program: ' claude-agent-acp ' })).toBe(true) | ||
| 111 | + expect(isClaudeSandbox({ ...emptyForm(), environment: 'local', program: 'claude-agent-acp' })).toBe(false) | ||
| 112 | + }) | ||
| 113 | +}) | ||
| 114 | + | ||
| 115 | +describe('Codex and Gemini in an sbx sandbox (issues #82, #84)', () => { | ||
| 116 | + it('offers their programs in a sandbox only', () => { | ||
| 117 | + expect(programsFor('sbx')).toEqual(expect.arrayContaining(['codex-acp', 'gemini'])) | ||
| 118 | + expect(programsFor('local')).not.toContain('gemini') | ||
| 119 | + expect(sbxArguments.gemini).toBe('--acp') | ||
| 120 | + expect(sbxArguments.codex).toBe('') | ||
| 121 | + }) | ||
| 122 | + | ||
| 123 | + it('recognises which agent the form describes', () => { | ||
| 124 | + const sbx = { ...emptyForm(), environment: 'sbx' as const } | ||
| 125 | + expect(sbxAgentOf({ ...sbx, program: '/home/agent/.local/bin/codex-acp' })).toBe('codex') | ||
| 126 | + expect(sbxAgentOf({ ...sbx, program: 'codex-acp' })).toBe('codex') | ||
| 127 | + expect(sbxAgentOf({ ...sbx, program: ' gemini ' })).toBe('gemini') | ||
| 128 | + expect(sbxAgentOf({ ...sbx, program: 'claude-agent-acp' })).toBe('claude') | ||
| 129 | + expect(sbxAgentOf({ ...sbx, program: 'mm' })).toBeUndefined() | ||
| 130 | + expect(sbxAgentOf({ ...emptyForm(), environment: 'local', program: 'gemini' })).toBeUndefined() | ||
| 131 | + }) | ||
| 132 | +}) | ||
| 133 | + | ||
| 134 | +describe('sandboxMismatch', () => { | ||
| 135 | + const codex = { ...emptyForm(), environment: 'sbx' as const, program: 'codex-acp' } | ||
| 136 | + it("names the file's agent when it is not the program's", () => { | ||
| 137 | + expect(sandboxMismatch(codex, 'claude')).toBe('claude') | ||
| 138 | + }) | ||
| 139 | + it('is empty when they match, or when one of them is unknown', () => { | ||
| 140 | + expect(sandboxMismatch(codex, 'codex')).toBe('') | ||
| 141 | + expect(sandboxMismatch(codex, '')).toBe('') | ||
| 142 | + expect(sandboxMismatch(codex, undefined)).toBe('') | ||
| 143 | + expect(sandboxMismatch({ ...codex, program: 'mm' }, 'claude')).toBe('') | ||
| 144 | + }) | ||
| 145 | +}) | ||
| 146 | + | ||
| 147 | +describe('the program follows the sandbox file (agent:)', () => { | ||
| 148 | + const env = { name: 'gemini-acp', agent: 'gemini', workspace: '', sandboxFolder: '/a', createCommand: 'c', stopCommand: 's', removeCommand: 'r' } | ||
| 149 | + it('chooses Claude, Codex or Gemini with their arguments', () => { | ||
| 150 | + expect(withSandboxEnv(emptyForm(), env)).toMatchObject({ program: 'gemini', arguments: '--acp' }) | ||
| 151 | + expect(withSandboxEnv(emptyForm(), { ...env, agent: 'codex' })).toMatchObject({ program: 'codex-acp', arguments: '' }) | ||
| 152 | + expect(withSandboxEnv(emptyForm(), { ...env, agent: 'claude' })).toMatchObject({ program: 'claude-agent-acp', arguments: '' }) | ||
| 153 | + }) | ||
| 154 | + it('replaces a program of the list, with its arguments', () => { | ||
| 155 | + const form = { ...emptyForm(), program: 'mm', arguments: '--acp --config a.yaml' } | ||
| 156 | + expect(withSbxProgram(form, 'claude')).toMatchObject({ program: 'claude-agent-acp', arguments: '' }) | ||
| 157 | + expect(withSbxProgram({ ...form, program: 'gemini', arguments: '--acp' }, 'codex')).toMatchObject({ program: 'codex-acp', arguments: '' }) | ||
| 158 | + }) | ||
| 159 | + it('keeps a program typed by hand, the same program with its arguments, and unknown agents', () => { | ||
| 160 | + const typed = { ...emptyForm(), program: 'my-wrapper', arguments: '-v' } | ||
| 161 | + expect(withSbxProgram(typed, 'codex')).toBe(typed) | ||
| 162 | + const old = { ...emptyForm(), program: 'gemini', arguments: '--experimental-acp' } | ||
| 163 | + expect(withSbxProgram(old, 'gemini')).toBe(old) | ||
| 164 | + expect(withSbxProgram(emptyForm(), 'shell')).toEqual(emptyForm()) | ||
| 165 | + expect(withSbxProgram(emptyForm(), undefined)).toEqual(emptyForm()) | ||
| 166 | + }) | ||
| 167 | +}) | ||
| 168 | + | ||
| 169 | +describe('mini-me in a sandbox', () => { | ||
| 170 | + it('chooses mm for a mini-me kit', () => { | ||
| 171 | + expect(programOfSandbox('mini-me-kit')).toEqual({ program: 'mm', arguments: '--acp' }) | ||
| 172 | + expect(programOfSandbox('minime')).toEqual({ program: 'mm', arguments: '--acp' }) | ||
| 173 | + expect(programOfSandbox('mini-meteo')).toBeUndefined() | ||
| 174 | + expect(withSandboxEnv(emptyForm(), { name: 'milo-sbx', agent: 'mini-me-kit', workspace: '', sandboxFolder: '/a', createCommand: '', stopCommand: '', removeCommand: '' })).toMatchObject({ program: 'mm', arguments: '--acp' }) | ||
| 175 | + }) | ||
| 176 | + it('keeps mm with its configuration file', () => { | ||
| 177 | + const form = { ...emptyForm(), program: 'mm', arguments: '--acp --config /a/agent.yaml' } | ||
| 178 | + expect(withSbxProgram(form, 'mini-me-kit')).toBe(form) | ||
| 179 | + }) | ||
| 180 | + it('is not a coding agent of a third-party kit: its configuration file is still asked', () => { | ||
| 181 | + expect(sbxAgentOf({ ...emptyForm(), environment: 'sbx', program: 'mm' })).toBeUndefined() | ||
| 182 | + }) | ||
| 183 | +}) | ||
| 184 | + | ||
| 185 | +describe('Docker Agent in a sandbox (issue #87)', () => { | ||
| 186 | + it('chooses docker-agent for the sbx agent docker-agent, or cagent', () => { | ||
| 187 | + expect(programOfSandbox('docker-agent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) | ||
| 188 | + expect(programOfSandbox('cagent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) | ||
| 189 | + }) | ||
| 190 | + it('replaces "docker agent" of the list, and keeps docker-agent with its file', () => { | ||
| 191 | + expect(withSbxProgram({ ...emptyForm(), program: 'docker agent', arguments: 'serve acp a.yaml' }, 'docker-agent')).toMatchObject({ program: 'docker-agent', arguments: 'serve acp' }) | ||
| 192 | + const form = { ...emptyForm(), program: 'docker-agent', arguments: 'serve acp /a/agent.yaml' } | ||
| 193 | + expect(withSbxProgram(form, 'docker-agent')).toBe(form) | ||
| 194 | + }) | ||
| 195 | + it('then takes its configuration file', () => { | ||
| 196 | + expect(argumentsFor('docker-agent', '/a/agent.yaml')).toBe('serve acp /a/agent.yaml') | ||
| 197 | + }) | ||
| 198 | +}) | ||
| 199 | + | ||
| 200 | +describe('Docker Agent without its agent file', () => { | ||
| 201 | + const form = { ...emptyForm(), name: 'da', workspace: '/a', environment: 'sbx' as const, box: 'da-sbx', program: 'docker-agent', arguments: 'serve acp' } | ||
| 202 | + it('is refused', () => { | ||
| 203 | + expect(problemsOf(form)).toEqual(['agentFile']) | ||
| 204 | + expect(problemsOf({ ...form, program: 'docker agent', arguments: ' serve acp ' })).toEqual(['agentFile']) | ||
| 205 | + }) | ||
| 206 | + it('is accepted with the file', () => { | ||
| 207 | + expect(problemsOf({ ...form, arguments: 'serve acp /a/agent.yaml' })).toEqual([]) | ||
| 208 | + }) | ||
| 209 | +}) | ||
modified
frontend/src/lib/agentform.ts +127 -4 | @@ -34,6 +34,10 @@ export function emptyForm(): AgentFormValues { | ||
| 34 | 34 | /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */ |
| 35 | 35 | export interface SandboxEnvValues { |
| 36 | 36 | name: string |
| 37 | + /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */ | |
| 38 | + agent?: string | |
| 39 | + /** The agent's configuration file found in its workspace (agent.yaml), for mm and docker-agent. */ | |
| 40 | + agentFile?: string | |
| 37 | 41 | workspace: string |
| 38 | 42 | sandboxFolder: string |
| 39 | 43 | createCommand: string |
| @@ -44,8 +48,9 @@ export interface SandboxEnvValues { | ||
| 44 | 48 | /** |
| 45 | 49 | * Fills the form from an sbx environment file dropped on the assistant: the |
| 46 | 50 | * sandbox's name and its commands replace what was typed (the user dropped |
| 47 | - * the file for that), the agent's folder only when it is still empty. Every | |
| 48 | - * field stays editable. | |
| 51 | + * the file for that), the agent's folder only when it is still empty. A | |
| 52 | + * sandbox for Claude, Codex or Gemini ("agent:") also chooses their program | |
| 53 | + * (withSbxProgram). Every field stays editable. | |
| 49 | 54 | * |
| 50 | 55 | * @example |
| 51 | 56 | * withSandboxEnv(emptyForm(), { name: 'milo-sbx', createCommand: 'sbx env create --force', … }) |
| @@ -53,7 +58,7 @@ export interface SandboxEnvValues { | ||
| 53 | 58 | */ |
| 54 | 59 | export function withSandboxEnv(form: AgentFormValues, env: SandboxEnvValues): AgentFormValues { |
| 55 | 60 | return { |
| 56 | - ...form, | |
| 61 | + ...withSbxProgram(form, env.agent), | |
| 57 | 62 | environment: 'sbx', |
| 58 | 63 | box: env.name || form.box, |
| 59 | 64 | workspace: form.workspace.trim() ? form.workspace : env.workspace, |
| @@ -85,13 +90,14 @@ export function nameFromTitle(title: string): string { | ||
| 85 | 90 | } |
| 86 | 91 | |
| 87 | 92 | /** The fields the user still has to fill in, by name. */ |
| 88 | -export type Missing = 'name' | 'nameFormat' | 'program' | 'workspace' | 'box' | |
| 93 | +export type Missing = 'name' | 'nameFormat' | 'program' | 'workspace' | 'box' | 'agentFile' | |
| 89 | 94 | |
| 90 | 95 | /** |
| 91 | 96 | * What is missing or wrong before the form can be sent. |
| 92 | 97 | * |
| 93 | 98 | * @example |
| 94 | 99 | * problemsOf({ ...emptyForm(), title: 'Alice' }) // ['name', 'program', 'workspace'] |
| 100 | + * problemsOf({ ...form, program: 'docker-agent', arguments: 'serve acp' }) // [… 'agentFile'] | |
| 95 | 101 | */ |
| 96 | 102 | export function problemsOf(form: AgentFormValues): Missing[] { |
| 97 | 103 | const problems: Missing[] = [] |
| @@ -101,6 +107,9 @@ export function problemsOf(form: AgentFormValues): Missing[] { | ||
| 101 | 107 | if (!form.program.trim()) problems.push('program') |
| 102 | 108 | if (!form.workspace.trim()) problems.push('workspace') |
| 103 | 109 | if (form.environment !== 'local' && !form.box.trim()) problems.push('box') |
| 110 | + // Docker Agent serves one agent file over ACP: "serve acp" alone stops at once. | |
| 111 | + const command = `${form.program} ${form.arguments}`.trim().split(/\s+/).join(' ') | |
| 112 | + if (/^docker[- ]agent serve acp$/.test(command)) problems.push('agentFile') | |
| 104 | 113 | return problems |
| 105 | 114 | } |
| 106 | 115 | |
| @@ -110,6 +119,120 @@ export function problemsOf(form: AgentFormValues): Missing[] { | ||
| 110 | 119 | */ |
| 111 | 120 | export const knownPrograms = ['mm', 'docker-agent', 'docker agent'] as const |
| 112 | 121 | |
| 122 | +/** The coding agents a third-party sbx kit runs over ACP (issues #81, #82, #84). */ | |
| 123 | +export type SbxAgent = 'claude' | 'codex' | 'gemini' | |
| 124 | + | |
| 125 | +/** | |
| 126 | + * The program of each of them inside its sandbox, as the "Program" field | |
| 127 | + * offers it in an sbx sandbox only: Claude Code's and Codex's ACP adapters | |
| 128 | + * (the docker.io/sbx/claude-acp and docker.io/sbx/codex-acp kits, both in | |
| 129 | + * the PATH), and Gemini CLI, which speaks | |
| 130 | + * ACP itself with the argument --acp (docker.io/sbx/gemini-kit). | |
| 131 | + */ | |
| 132 | +export const sbxPrograms: Record<SbxAgent, string> = { | |
| 133 | + claude: 'claude-agent-acp', | |
| 134 | + codex: 'codex-acp', | |
| 135 | + gemini: 'gemini', | |
| 136 | +} | |
| 137 | + | |
| 138 | +/** Where the older docker.io/sbx/codex-acp-kit (v2) installed codex-acp. */ | |
| 139 | +const legacyCodexProgram = '/home/agent/.local/bin/codex-acp' | |
| 140 | + | |
| 141 | +/** The arguments each of them starts with: only Gemini CLI takes one, --acp. */ | |
| 142 | +export const sbxArguments: Record<SbxAgent, string> = { claude: '', codex: '', gemini: '--acp' } | |
| 143 | + | |
| 144 | +/** Claude Code's ACP adapter, offered in an sbx sandbox only (issue #81). */ | |
| 145 | +export const claudeProgram = sbxPrograms.claude | |
| 146 | + | |
| 147 | +/** | |
| 148 | + * The programs the "Program" field offers where the agent runs: in an sbx | |
| 149 | + * sandbox, also the coding agents of sbxPrograms. | |
| 150 | + * | |
| 151 | + * @example | |
| 152 | + * programsFor('sbx') // ['mm', 'docker-agent', 'docker agent', 'claude-agent-acp', 'codex-acp', 'gemini'] | |
| 153 | + */ | |
| 154 | +export function programsFor(environment: Environment): string[] { | |
| 155 | + return environment === 'sbx' ? [...knownPrograms, ...Object.values(sbxPrograms)] : [...knownPrograms] | |
| 156 | +} | |
| 157 | + | |
| 158 | +/** | |
| 159 | + * The program and arguments of the agent a sandbox file names ("agent:"): | |
| 160 | + * Claude, Codex or Gemini (sbxPrograms), mini-me (mm, from a kit such as | |
| 161 | + * docker.io/k33g/mini-me-kit, whose sbx agent is named after the kit), or | |
| 162 | + * Docker Agent (docker-agent, an sbx agent of its own, also called cagent). | |
| 163 | + * mm and docker-agent also need their configuration file: dropping it | |
| 164 | + * adds it to the arguments (argumentsFor). | |
| 165 | + * | |
| 166 | + * @example | |
| 167 | + * programOfSandbox('gemini') // { program: 'gemini', arguments: '--acp' } | |
| 168 | + * programOfSandbox('mini-me-kit') // { program: 'mm', arguments: '--acp' } | |
| 169 | + * programOfSandbox('docker-agent') // { program: 'docker-agent', arguments: 'serve acp' } | |
| 170 | + */ | |
| 171 | +export function programOfSandbox(agent: string | undefined): { program: string; arguments: string } | undefined { | |
| 172 | + const known = (agent ?? '').trim() | |
| 173 | + if (Object.hasOwn(sbxPrograms, known)) return { program: sbxPrograms[known as SbxAgent], arguments: sbxArguments[known as SbxAgent] } | |
| 174 | + if (/^mini-?me\b/.test(known)) return { program: 'mm', arguments: '--acp' } | |
| 175 | + if (known === 'docker-agent' || known === 'cagent') return { program: 'docker-agent', arguments: 'serve acp' } | |
| 176 | + return undefined | |
| 177 | +} | |
| 178 | + | |
| 179 | +/** | |
| 180 | + * Chooses the program of the agent a sandbox file names (programOfSandbox), | |
| 181 | + * with its arguments, when the field is empty or holds one of the programs | |
| 182 | + * the list offers: a program typed by hand is kept. The arguments typed for | |
| 183 | + * the same program are kept too (gemini --experimental-acp). | |
| 184 | + * | |
| 185 | + * @example | |
| 186 | + * withSbxProgram(emptyForm(), 'gemini') // { …, program: 'gemini', arguments: '--acp' } | |
| 187 | + * withSbxProgram({ ...form, program: 'my-wrapper' }, 'codex') // unchanged | |
| 188 | + */ | |
| 189 | +export function withSbxProgram(form: AgentFormValues, agent: string | undefined): AgentFormValues { | |
| 190 | + const wanted = programOfSandbox(agent) | |
| 191 | + if (!wanted) return form | |
| 192 | + const program = form.program.trim() | |
| 193 | + if (program === wanted.program) return form | |
| 194 | + const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram] as string[] | |
| 195 | + if (program && !offered.includes(program)) return form | |
| 196 | + return { ...form, program: wanted.program, arguments: wanted.arguments } | |
| 197 | +} | |
| 198 | + | |
| 199 | +/** | |
| 200 | + * Which coding agent of sbxPrograms the form describes, in an sbx sandbox: | |
| 201 | + * its sbxenv.yaml gives the rest, it takes no configuration file. Codex is | |
| 202 | + * also recognised with the folder the older docker.io/sbx/codex-acp-kit | |
| 203 | + * installed it in. | |
| 204 | + * | |
| 205 | + * @example | |
| 206 | + * sbxAgentOf({ ...form, environment: 'sbx', program: 'codex-acp' }) // 'codex' | |
| 207 | + */ | |
| 208 | +export function sbxAgentOf(form: AgentFormValues): SbxAgent | undefined { | |
| 209 | + if (form.environment !== 'sbx') return undefined | |
| 210 | + const program = form.program.trim() | |
| 211 | + if (program === sbxPrograms.claude) return 'claude' | |
| 212 | + if (program === sbxPrograms.codex || program === legacyCodexProgram) return 'codex' | |
| 213 | + if (program === sbxPrograms.gemini) return 'gemini' | |
| 214 | + return undefined | |
| 215 | +} | |
| 216 | + | |
| 217 | +/** | |
| 218 | + * The sbx agent of the sandbox file read, when it is not the one the program | |
| 219 | + * needs: Codex started in Claude's sandbox does not find its adapter. '' | |
| 220 | + * when they match, or when the program or the file names no known agent. | |
| 221 | + * | |
| 222 | + * @example | |
| 223 | + * sandboxMismatch({ ...form, environment: 'sbx', program: 'codex-acp' }, 'claude') // 'claude' | |
| 224 | + */ | |
| 225 | +export function sandboxMismatch(form: AgentFormValues, envAgent: string | undefined): string { | |
| 226 | + const wanted = sbxAgentOf(form) | |
| 227 | + const agent = (envAgent ?? '').trim() | |
| 228 | + return wanted && agent && agent !== wanted ? agent : '' | |
| 229 | +} | |
| 230 | + | |
| 231 | +/** Whether the form describes Claude in an sbx sandbox. */ | |
| 232 | +export function isClaudeSandbox(form: AgentFormValues): boolean { | |
| 233 | + return sbxAgentOf(form) === 'claude' | |
| 234 | +} | |
| 235 | + | |
| 113 | 236 | /** |
| 114 | 237 | * Quotes an argument for a field typed like a terminal line, as the backend |
| 115 | 238 | * splits it: double quotes when it holds a space or a quote, single quotes |
| @@ -34,6 +34,10 @@ export function emptyForm(): AgentFormValues { | |||
| 34 | /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */ | 34 | /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */ |
| 35 | export interface SandboxEnvValues { | 35 | export interface SandboxEnvValues { |
| 36 | name: string | 36 | name: string |
| 37 | + /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */ | ||
| 38 | + agent?: string | ||
| 39 | + /** The agent's configuration file found in its workspace (agent.yaml), for mm and docker-agent. */ | ||
| 40 | + agentFile?: string | ||
| 37 | workspace: string | 41 | workspace: string |
| 38 | sandboxFolder: string | 42 | sandboxFolder: string |
| 39 | createCommand: string | 43 | createCommand: string |
| @@ -44,8 +48,9 @@ export interface SandboxEnvValues { | |||
| 44 | /** | 48 | /** |
| 45 | * Fills the form from an sbx environment file dropped on the assistant: the | 49 | * Fills the form from an sbx environment file dropped on the assistant: the |
| 46 | * sandbox's name and its commands replace what was typed (the user dropped | 50 | * sandbox's name and its commands replace what was typed (the user dropped |
| 47 | - * the file for that), the agent's folder only when it is still empty. Every | 51 | + * the file for that), the agent's folder only when it is still empty. A |
| 48 | - * field stays editable. | 52 | + * sandbox for Claude, Codex or Gemini ("agent:") also chooses their program |
| 53 | + * (withSbxProgram). Every field stays editable. | ||
| 49 | * | 54 | * |
| 50 | * @example | 55 | * @example |
| 51 | * withSandboxEnv(emptyForm(), { name: 'milo-sbx', createCommand: 'sbx env create --force', … }) | 56 | * withSandboxEnv(emptyForm(), { name: 'milo-sbx', createCommand: 'sbx env create --force', … }) |
| @@ -53,7 +58,7 @@ export interface SandboxEnvValues { | |||
| 53 | */ | 58 | */ |
| 54 | export function withSandboxEnv(form: AgentFormValues, env: SandboxEnvValues): AgentFormValues { | 59 | export function withSandboxEnv(form: AgentFormValues, env: SandboxEnvValues): AgentFormValues { |
| 55 | return { | 60 | return { |
| 56 | - ...form, | 61 | + ...withSbxProgram(form, env.agent), |
| 57 | environment: 'sbx', | 62 | environment: 'sbx', |
| 58 | box: env.name || form.box, | 63 | box: env.name || form.box, |
| 59 | workspace: form.workspace.trim() ? form.workspace : env.workspace, | 64 | workspace: form.workspace.trim() ? form.workspace : env.workspace, |
| @@ -85,13 +90,14 @@ export function nameFromTitle(title: string): string { | |||
| 85 | } | 90 | } |
| 86 | 91 | ||
| 87 | /** The fields the user still has to fill in, by name. */ | 92 | /** The fields the user still has to fill in, by name. */ |
| 88 | -export type Missing = 'name' | 'nameFormat' | 'program' | 'workspace' | 'box' | 93 | +export type Missing = 'name' | 'nameFormat' | 'program' | 'workspace' | 'box' | 'agentFile' |
| 89 | 94 | ||
| 90 | /** | 95 | /** |
| 91 | * What is missing or wrong before the form can be sent. | 96 | * What is missing or wrong before the form can be sent. |
| 92 | * | 97 | * |
| 93 | * @example | 98 | * @example |
| 94 | * problemsOf({ ...emptyForm(), title: 'Alice' }) // ['name', 'program', 'workspace'] | 99 | * problemsOf({ ...emptyForm(), title: 'Alice' }) // ['name', 'program', 'workspace'] |
| 100 | + * problemsOf({ ...form, program: 'docker-agent', arguments: 'serve acp' }) // [… 'agentFile'] | ||
| 95 | */ | 101 | */ |
| 96 | export function problemsOf(form: AgentFormValues): Missing[] { | 102 | export function problemsOf(form: AgentFormValues): Missing[] { |
| 97 | const problems: Missing[] = [] | 103 | const problems: Missing[] = [] |
| @@ -101,6 +107,9 @@ export function problemsOf(form: AgentFormValues): Missing[] { | |||
| 101 | if (!form.program.trim()) problems.push('program') | 107 | if (!form.program.trim()) problems.push('program') |
| 102 | if (!form.workspace.trim()) problems.push('workspace') | 108 | if (!form.workspace.trim()) problems.push('workspace') |
| 103 | if (form.environment !== 'local' && !form.box.trim()) problems.push('box') | 109 | if (form.environment !== 'local' && !form.box.trim()) problems.push('box') |
| 110 | + // Docker Agent serves one agent file over ACP: "serve acp" alone stops at once. | ||
| 111 | + const command = `${form.program} ${form.arguments}`.trim().split(/\s+/).join(' ') | ||
| 112 | + if (/^docker[- ]agent serve acp$/.test(command)) problems.push('agentFile') | ||
| 104 | return problems | 113 | return problems |
| 105 | } | 114 | } |
| 106 | 115 | ||
| @@ -110,6 +119,120 @@ export function problemsOf(form: AgentFormValues): Missing[] { | |||
| 110 | */ | 119 | */ |
| 111 | export const knownPrograms = ['mm', 'docker-agent', 'docker agent'] as const | 120 | export const knownPrograms = ['mm', 'docker-agent', 'docker agent'] as const |
| 112 | 121 | ||
| 122 | +/** The coding agents a third-party sbx kit runs over ACP (issues #81, #82, #84). */ | ||
| 123 | +export type SbxAgent = 'claude' | 'codex' | 'gemini' | ||
| 124 | + | ||
| 125 | +/** | ||
| 126 | + * The program of each of them inside its sandbox, as the "Program" field | ||
| 127 | + * offers it in an sbx sandbox only: Claude Code's and Codex's ACP adapters | ||
| 128 | + * (the docker.io/sbx/claude-acp and docker.io/sbx/codex-acp kits, both in | ||
| 129 | + * the PATH), and Gemini CLI, which speaks | ||
| 130 | + * ACP itself with the argument --acp (docker.io/sbx/gemini-kit). | ||
| 131 | + */ | ||
| 132 | +export const sbxPrograms: Record<SbxAgent, string> = { | ||
| 133 | + claude: 'claude-agent-acp', | ||
| 134 | + codex: 'codex-acp', | ||
| 135 | + gemini: 'gemini', | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +/** Where the older docker.io/sbx/codex-acp-kit (v2) installed codex-acp. */ | ||
| 139 | +const legacyCodexProgram = '/home/agent/.local/bin/codex-acp' | ||
| 140 | + | ||
| 141 | +/** The arguments each of them starts with: only Gemini CLI takes one, --acp. */ | ||
| 142 | +export const sbxArguments: Record<SbxAgent, string> = { claude: '', codex: '', gemini: '--acp' } | ||
| 143 | + | ||
| 144 | +/** Claude Code's ACP adapter, offered in an sbx sandbox only (issue #81). */ | ||
| 145 | +export const claudeProgram = sbxPrograms.claude | ||
| 146 | + | ||
| 147 | +/** | ||
| 148 | + * The programs the "Program" field offers where the agent runs: in an sbx | ||
| 149 | + * sandbox, also the coding agents of sbxPrograms. | ||
| 150 | + * | ||
| 151 | + * @example | ||
| 152 | + * programsFor('sbx') // ['mm', 'docker-agent', 'docker agent', 'claude-agent-acp', 'codex-acp', 'gemini'] | ||
| 153 | + */ | ||
| 154 | +export function programsFor(environment: Environment): string[] { | ||
| 155 | + return environment === 'sbx' ? [...knownPrograms, ...Object.values(sbxPrograms)] : [...knownPrograms] | ||
| 156 | +} | ||
| 157 | + | ||
| 158 | +/** | ||
| 159 | + * The program and arguments of the agent a sandbox file names ("agent:"): | ||
| 160 | + * Claude, Codex or Gemini (sbxPrograms), mini-me (mm, from a kit such as | ||
| 161 | + * docker.io/k33g/mini-me-kit, whose sbx agent is named after the kit), or | ||
| 162 | + * Docker Agent (docker-agent, an sbx agent of its own, also called cagent). | ||
| 163 | + * mm and docker-agent also need their configuration file: dropping it | ||
| 164 | + * adds it to the arguments (argumentsFor). | ||
| 165 | + * | ||
| 166 | + * @example | ||
| 167 | + * programOfSandbox('gemini') // { program: 'gemini', arguments: '--acp' } | ||
| 168 | + * programOfSandbox('mini-me-kit') // { program: 'mm', arguments: '--acp' } | ||
| 169 | + * programOfSandbox('docker-agent') // { program: 'docker-agent', arguments: 'serve acp' } | ||
| 170 | + */ | ||
| 171 | +export function programOfSandbox(agent: string | undefined): { program: string; arguments: string } | undefined { | ||
| 172 | + const known = (agent ?? '').trim() | ||
| 173 | + if (Object.hasOwn(sbxPrograms, known)) return { program: sbxPrograms[known as SbxAgent], arguments: sbxArguments[known as SbxAgent] } | ||
| 174 | + if (/^mini-?me\b/.test(known)) return { program: 'mm', arguments: '--acp' } | ||
| 175 | + if (known === 'docker-agent' || known === 'cagent') return { program: 'docker-agent', arguments: 'serve acp' } | ||
| 176 | + return undefined | ||
| 177 | +} | ||
| 178 | + | ||
| 179 | +/** | ||
| 180 | + * Chooses the program of the agent a sandbox file names (programOfSandbox), | ||
| 181 | + * with its arguments, when the field is empty or holds one of the programs | ||
| 182 | + * the list offers: a program typed by hand is kept. The arguments typed for | ||
| 183 | + * the same program are kept too (gemini --experimental-acp). | ||
| 184 | + * | ||
| 185 | + * @example | ||
| 186 | + * withSbxProgram(emptyForm(), 'gemini') // { …, program: 'gemini', arguments: '--acp' } | ||
| 187 | + * withSbxProgram({ ...form, program: 'my-wrapper' }, 'codex') // unchanged | ||
| 188 | + */ | ||
| 189 | +export function withSbxProgram(form: AgentFormValues, agent: string | undefined): AgentFormValues { | ||
| 190 | + const wanted = programOfSandbox(agent) | ||
| 191 | + if (!wanted) return form | ||
| 192 | + const program = form.program.trim() | ||
| 193 | + if (program === wanted.program) return form | ||
| 194 | + const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram] as string[] | ||
| 195 | + if (program && !offered.includes(program)) return form | ||
| 196 | + return { ...form, program: wanted.program, arguments: wanted.arguments } | ||
| 197 | +} | ||
| 198 | + | ||
| 199 | +/** | ||
| 200 | + * Which coding agent of sbxPrograms the form describes, in an sbx sandbox: | ||
| 201 | + * its sbxenv.yaml gives the rest, it takes no configuration file. Codex is | ||
| 202 | + * also recognised with the folder the older docker.io/sbx/codex-acp-kit | ||
| 203 | + * installed it in. | ||
| 204 | + * | ||
| 205 | + * @example | ||
| 206 | + * sbxAgentOf({ ...form, environment: 'sbx', program: 'codex-acp' }) // 'codex' | ||
| 207 | + */ | ||
| 208 | +export function sbxAgentOf(form: AgentFormValues): SbxAgent | undefined { | ||
| 209 | + if (form.environment !== 'sbx') return undefined | ||
| 210 | + const program = form.program.trim() | ||
| 211 | + if (program === sbxPrograms.claude) return 'claude' | ||
| 212 | + if (program === sbxPrograms.codex || program === legacyCodexProgram) return 'codex' | ||
| 213 | + if (program === sbxPrograms.gemini) return 'gemini' | ||
| 214 | + return undefined | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +/** | ||
| 218 | + * The sbx agent of the sandbox file read, when it is not the one the program | ||
| 219 | + * needs: Codex started in Claude's sandbox does not find its adapter. '' | ||
| 220 | + * when they match, or when the program or the file names no known agent. | ||
| 221 | + * | ||
| 222 | + * @example | ||
| 223 | + * sandboxMismatch({ ...form, environment: 'sbx', program: 'codex-acp' }, 'claude') // 'claude' | ||
| 224 | + */ | ||
| 225 | +export function sandboxMismatch(form: AgentFormValues, envAgent: string | undefined): string { | ||
| 226 | + const wanted = sbxAgentOf(form) | ||
| 227 | + const agent = (envAgent ?? '').trim() | ||
| 228 | + return wanted && agent && agent !== wanted ? agent : '' | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | +/** Whether the form describes Claude in an sbx sandbox. */ | ||
| 232 | +export function isClaudeSandbox(form: AgentFormValues): boolean { | ||
| 233 | + return sbxAgentOf(form) === 'claude' | ||
| 234 | +} | ||
| 235 | + | ||
| 113 | /** | 236 | /** |
| 114 | * Quotes an argument for a field typed like a terminal line, as the backend | 237 | * Quotes an argument for a field typed like a terminal line, as the backend |
| 115 | * splits it: double quotes when it holds a space or a quote, single quotes | 238 | * splits it: double quotes when it holds a space or a quote, single quotes |
added
frontend/src/lib/editorLanguages.test.ts +27 -0 | new file mode 100644 | ||
| @@ -0,0 +1,27 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +import { describe, expect, it } from 'vitest' | |
| 4 | +import { EditorState } from '@codemirror/state' | |
| 5 | +import { languageSupport } from './editorLanguages' | |
| 6 | +import type { EditorLanguage } from './files' | |
| 7 | + | |
| 8 | +const languages: EditorLanguage[] = [ | |
| 9 | + 'yaml', 'markdown', 'json', 'javascript', 'typescript', 'jsx', 'tsx', 'python', 'go', 'rust', 'css', | |
| 10 | + 'html', 'xml', 'java', 'cpp', 'php', 'sql', 'shell', 'toml', 'dockerfile', 'ruby', 'swift', 'kotlin', | |
| 11 | + 'csharp', 'lua', 'properties', 'diff', 'powershell', | |
| 12 | +] | |
| 13 | + | |
| 14 | +describe('languageSupport (issue #71)', () => { | |
| 15 | + it('loads every language the editor colours', async () => { | |
| 16 | + for (const language of languages) { | |
| 17 | + const support = await languageSupport(language) | |
| 18 | + // A real language gives the editor a language facet. | |
| 19 | + const state = EditorState.create({ doc: 'x', extensions: [support] }) | |
| 20 | + expect(state.facet(EditorState.languageData).length, language).toBeGreaterThan(0) | |
| 21 | + } | |
| 22 | + }) | |
| 23 | + | |
| 24 | + it('gives nothing for plain text', async () => { | |
| 25 | + expect(await languageSupport('text')).toEqual([]) | |
| 26 | + }) | |
| 27 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +import { describe, expect, it } from 'vitest' | ||
| 4 | +import { EditorState } from '@codemirror/state' | ||
| 5 | +import { languageSupport } from './editorLanguages' | ||
| 6 | +import type { EditorLanguage } from './files' | ||
| 7 | + | ||
| 8 | +const languages: EditorLanguage[] = [ | ||
| 9 | + 'yaml', 'markdown', 'json', 'javascript', 'typescript', 'jsx', 'tsx', 'python', 'go', 'rust', 'css', | ||
| 10 | + 'html', 'xml', 'java', 'cpp', 'php', 'sql', 'shell', 'toml', 'dockerfile', 'ruby', 'swift', 'kotlin', | ||
| 11 | + 'csharp', 'lua', 'properties', 'diff', 'powershell', | ||
| 12 | +] | ||
| 13 | + | ||
| 14 | +describe('languageSupport (issue #71)', () => { | ||
| 15 | + it('loads every language the editor colours', async () => { | ||
| 16 | + for (const language of languages) { | ||
| 17 | + const support = await languageSupport(language) | ||
| 18 | + // A real language gives the editor a language facet. | ||
| 19 | + const state = EditorState.create({ doc: 'x', extensions: [support] }) | ||
| 20 | + expect(state.facet(EditorState.languageData).length, language).toBeGreaterThan(0) | ||
| 21 | + } | ||
| 22 | + }) | ||
| 23 | + | ||
| 24 | + it('gives nothing for plain text', async () => { | ||
| 25 | + expect(await languageSupport('text')).toEqual([]) | ||
| 26 | + }) | ||
| 27 | +}) | ||
added
frontend/src/lib/editorLanguages.ts +62 -0 | new file mode 100644 | ||
| @@ -0,0 +1,62 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// The CodeMirror support of each editor language (issue #71), loaded the | |
| 4 | +// first time a file of that language is opened: the start of the | |
| 5 | +// application never pays for languages nobody opens. | |
| 6 | + | |
| 7 | +import type { Extension } from '@codemirror/state' | |
| 8 | +import type { StreamParser } from '@codemirror/language' | |
| 9 | +import type { EditorLanguage } from './files' | |
| 10 | + | |
| 11 | +// A language of @codemirror/legacy-modes, wrapped for CodeMirror 6. | |
| 12 | +async function legacy(parser: Promise<StreamParser<unknown>>): Promise<Extension> { | |
| 13 | + const [{ StreamLanguage }, mode] = await Promise.all([import('@codemirror/language'), parser]) | |
| 14 | + return StreamLanguage.define(mode) | |
| 15 | +} | |
| 16 | + | |
| 17 | +const loaders: Record<Exclude<EditorLanguage, 'text'>, () => Promise<Extension>> = { | |
| 18 | + yaml: async () => (await import('@codemirror/lang-yaml')).yaml(), | |
| 19 | + markdown: async () => (await import('@codemirror/lang-markdown')).markdown(), | |
| 20 | + json: async () => (await import('@codemirror/lang-json')).json(), | |
| 21 | + javascript: async () => (await import('@codemirror/lang-javascript')).javascript(), | |
| 22 | + typescript: async () => (await import('@codemirror/lang-javascript')).javascript({ typescript: true }), | |
| 23 | + jsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true }), | |
| 24 | + tsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true, typescript: true }), | |
| 25 | + python: async () => (await import('@codemirror/lang-python')).python(), | |
| 26 | + go: async () => (await import('@codemirror/lang-go')).go(), | |
| 27 | + rust: async () => (await import('@codemirror/lang-rust')).rust(), | |
| 28 | + css: async () => (await import('@codemirror/lang-css')).css(), | |
| 29 | + html: async () => (await import('@codemirror/lang-html')).html(), | |
| 30 | + xml: async () => (await import('@codemirror/lang-xml')).xml(), | |
| 31 | + java: async () => (await import('@codemirror/lang-java')).java(), | |
| 32 | + cpp: async () => (await import('@codemirror/lang-cpp')).cpp(), | |
| 33 | + php: async () => (await import('@codemirror/lang-php')).php(), | |
| 34 | + sql: async () => (await import('@codemirror/lang-sql')).sql(), | |
| 35 | + shell: () => legacy(import('@codemirror/legacy-modes/mode/shell').then((m) => m.shell)), | |
| 36 | + toml: () => legacy(import('@codemirror/legacy-modes/mode/toml').then((m) => m.toml)), | |
| 37 | + dockerfile: () => legacy(import('@codemirror/legacy-modes/mode/dockerfile').then((m) => m.dockerFile)), | |
| 38 | + ruby: () => legacy(import('@codemirror/legacy-modes/mode/ruby').then((m) => m.ruby)), | |
| 39 | + swift: () => legacy(import('@codemirror/legacy-modes/mode/swift').then((m) => m.swift)), | |
| 40 | + kotlin: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.kotlin)), | |
| 41 | + csharp: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.csharp)), | |
| 42 | + lua: () => legacy(import('@codemirror/legacy-modes/mode/lua').then((m) => m.lua)), | |
| 43 | + properties: () => legacy(import('@codemirror/legacy-modes/mode/properties').then((m) => m.properties)), | |
| 44 | + diff: () => legacy(import('@codemirror/legacy-modes/mode/diff').then((m) => m.diff)), | |
| 45 | + powershell: () => legacy(import('@codemirror/legacy-modes/mode/powershell').then((m) => m.powerShell)), | |
| 46 | +} | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * Above this size, a file is shown as plain text: colouring it would slow | |
| 50 | + * the editor down. | |
| 51 | + */ | |
| 52 | +export const maxHighlightedSize = 512 * 1024 | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * The editor extension of a language, [] for plain text. | |
| 56 | + * | |
| 57 | + * @example | |
| 58 | + * compartment.reconfigure(await languageSupport('go')) | |
| 59 | + */ | |
| 60 | +export async function languageSupport(language: EditorLanguage): Promise<Extension> { | |
| 61 | + return language === 'text' ? [] : loaders[language]() | |
| 62 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// The CodeMirror support of each editor language (issue #71), loaded the | ||
| 4 | +// first time a file of that language is opened: the start of the | ||
| 5 | +// application never pays for languages nobody opens. | ||
| 6 | + | ||
| 7 | +import type { Extension } from '@codemirror/state' | ||
| 8 | +import type { StreamParser } from '@codemirror/language' | ||
| 9 | +import type { EditorLanguage } from './files' | ||
| 10 | + | ||
| 11 | +// A language of @codemirror/legacy-modes, wrapped for CodeMirror 6. | ||
| 12 | +async function legacy(parser: Promise<StreamParser<unknown>>): Promise<Extension> { | ||
| 13 | + const [{ StreamLanguage }, mode] = await Promise.all([import('@codemirror/language'), parser]) | ||
| 14 | + return StreamLanguage.define(mode) | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +const loaders: Record<Exclude<EditorLanguage, 'text'>, () => Promise<Extension>> = { | ||
| 18 | + yaml: async () => (await import('@codemirror/lang-yaml')).yaml(), | ||
| 19 | + markdown: async () => (await import('@codemirror/lang-markdown')).markdown(), | ||
| 20 | + json: async () => (await import('@codemirror/lang-json')).json(), | ||
| 21 | + javascript: async () => (await import('@codemirror/lang-javascript')).javascript(), | ||
| 22 | + typescript: async () => (await import('@codemirror/lang-javascript')).javascript({ typescript: true }), | ||
| 23 | + jsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true }), | ||
| 24 | + tsx: async () => (await import('@codemirror/lang-javascript')).javascript({ jsx: true, typescript: true }), | ||
| 25 | + python: async () => (await import('@codemirror/lang-python')).python(), | ||
| 26 | + go: async () => (await import('@codemirror/lang-go')).go(), | ||
| 27 | + rust: async () => (await import('@codemirror/lang-rust')).rust(), | ||
| 28 | + css: async () => (await import('@codemirror/lang-css')).css(), | ||
| 29 | + html: async () => (await import('@codemirror/lang-html')).html(), | ||
| 30 | + xml: async () => (await import('@codemirror/lang-xml')).xml(), | ||
| 31 | + java: async () => (await import('@codemirror/lang-java')).java(), | ||
| 32 | + cpp: async () => (await import('@codemirror/lang-cpp')).cpp(), | ||
| 33 | + php: async () => (await import('@codemirror/lang-php')).php(), | ||
| 34 | + sql: async () => (await import('@codemirror/lang-sql')).sql(), | ||
| 35 | + shell: () => legacy(import('@codemirror/legacy-modes/mode/shell').then((m) => m.shell)), | ||
| 36 | + toml: () => legacy(import('@codemirror/legacy-modes/mode/toml').then((m) => m.toml)), | ||
| 37 | + dockerfile: () => legacy(import('@codemirror/legacy-modes/mode/dockerfile').then((m) => m.dockerFile)), | ||
| 38 | + ruby: () => legacy(import('@codemirror/legacy-modes/mode/ruby').then((m) => m.ruby)), | ||
| 39 | + swift: () => legacy(import('@codemirror/legacy-modes/mode/swift').then((m) => m.swift)), | ||
| 40 | + kotlin: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.kotlin)), | ||
| 41 | + csharp: () => legacy(import('@codemirror/legacy-modes/mode/clike').then((m) => m.csharp)), | ||
| 42 | + lua: () => legacy(import('@codemirror/legacy-modes/mode/lua').then((m) => m.lua)), | ||
| 43 | + properties: () => legacy(import('@codemirror/legacy-modes/mode/properties').then((m) => m.properties)), | ||
| 44 | + diff: () => legacy(import('@codemirror/legacy-modes/mode/diff').then((m) => m.diff)), | ||
| 45 | + powershell: () => legacy(import('@codemirror/legacy-modes/mode/powershell').then((m) => m.powerShell)), | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +/** | ||
| 49 | + * Above this size, a file is shown as plain text: colouring it would slow | ||
| 50 | + * the editor down. | ||
| 51 | + */ | ||
| 52 | +export const maxHighlightedSize = 512 * 1024 | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * The editor extension of a language, [] for plain text. | ||
| 56 | + * | ||
| 57 | + * @example | ||
| 58 | + * compartment.reconfigure(await languageSupport('go')) | ||
| 59 | + */ | ||
| 60 | +export async function languageSupport(language: EditorLanguage): Promise<Extension> { | ||
| 61 | + return language === 'text' ? [] : loaders[language]() | ||
| 62 | +} | ||
modified
frontend/src/lib/errors.test.ts +1 -0 | @@ -15,6 +15,7 @@ describe('explain', () => { | ||
| 15 | 15 | expect(explain('Error response from daemon: container 4f2 is not running')).toEqual({ key: 'error.containerStopped', vars: { box: '4f2' } }) |
| 16 | 16 | expect(explain('the agent stopped: exit status 1\nCannot connect to the Docker daemon at unix:///var/run/docker.sock')).toEqual({ key: 'error.dockerNotRunning', vars: {} }) |
| 17 | 17 | expect(explain('sandbox "milo-sbx" not found')).toEqual({ key: 'error.sandboxMissing', vars: { box: 'milo-sbx' } }) |
| 18 | + expect(explain('docker-agent: self-update failed\nError: accepts 1 arg(s), received 0')).toEqual({ key: 'error.agentFileMissing', vars: {} }) | |
| 18 | 19 | }) |
| 19 | 20 | |
| 20 | 21 | it('recognises the limit of running agents', () => { |
| @@ -15,6 +15,7 @@ describe('explain', () => { | |||
| 15 | expect(explain('Error response from daemon: container 4f2 is not running')).toEqual({ key: 'error.containerStopped', vars: { box: '4f2' } }) | 15 | expect(explain('Error response from daemon: container 4f2 is not running')).toEqual({ key: 'error.containerStopped', vars: { box: '4f2' } }) |
| 16 | expect(explain('the agent stopped: exit status 1\nCannot connect to the Docker daemon at unix:///var/run/docker.sock')).toEqual({ key: 'error.dockerNotRunning', vars: {} }) | 16 | expect(explain('the agent stopped: exit status 1\nCannot connect to the Docker daemon at unix:///var/run/docker.sock')).toEqual({ key: 'error.dockerNotRunning', vars: {} }) |
| 17 | expect(explain('sandbox "milo-sbx" not found')).toEqual({ key: 'error.sandboxMissing', vars: { box: 'milo-sbx' } }) | 17 | expect(explain('sandbox "milo-sbx" not found')).toEqual({ key: 'error.sandboxMissing', vars: { box: 'milo-sbx' } }) |
| 18 | + expect(explain('docker-agent: self-update failed\nError: accepts 1 arg(s), received 0')).toEqual({ key: 'error.agentFileMissing', vars: {} }) | ||
| 18 | }) | 19 | }) |
| 19 | 20 | ||
| 20 | it('recognises the limit of running agents', () => { | 21 | it('recognises the limit of running agents', () => { |
modified
frontend/src/lib/errors.ts +5 -0 | @@ -23,6 +23,8 @@ interface Rule { | ||
| 23 | 23 | const rules: Rule[] = [ |
| 24 | 24 | { pattern: /Cannot connect to the Docker daemon|docker daemon is not running|error during connect/i, key: 'error.dockerNotRunning' }, |
| 25 | 25 | { pattern: /No such container:\s*(\S+)/i, key: 'error.containerMissing', groups: ['box'] }, |
| 26 | + // docker-agent serve acp without its agent file (cobra's message). | |
| 27 | + { pattern: /accepts 1 arg\(s\), received 0/, key: 'error.agentFileMissing' }, | |
| 26 | 28 | { pattern: /container (\S+) is not running|Container (\S+) is not running/i, key: 'error.containerStopped', groups: ['box'] }, |
| 27 | 29 | { pattern: /sandbox[ "']+([\w.-]+)["']? (?:not found|does not exist)/i, key: 'error.sandboxMissing', groups: ['box'] }, |
| 28 | 30 | { pattern: /exec: "([^"]+)": executable file not found/, key: 'error.programNotFound', groups: ['program'] }, |
| @@ -36,6 +38,9 @@ const rules: Rule[] = [ | ||
| 36 | 38 | { pattern: /unknown agent:?\s*(\S*)/, key: 'error.unknownAgent', groups: ['agent'] }, |
| 37 | 39 | { pattern: /the history was written by a newer Sidekicks/, key: 'error.newerHistory' }, |
| 38 | 40 | { pattern: /an agent is answering in this channel/, key: 'error.channelBusy' }, |
| 41 | + { pattern: /the agent is answering: wait for the end of its answer to unload/, key: 'error.agentAnswering' }, | |
| 42 | + { pattern: /the agent is not running: it has no model to unload/, key: 'error.notRunning' }, | |
| 43 | + { pattern: /cannot unload its model: it offers no \/unload command/, key: 'error.cannotUnload' }, | |
| 39 | 44 | ] |
| 40 | 45 | |
| 41 | 46 | /** |
| @@ -23,6 +23,8 @@ interface Rule { | |||
| 23 | const rules: Rule[] = [ | 23 | const rules: Rule[] = [ |
| 24 | { pattern: /Cannot connect to the Docker daemon|docker daemon is not running|error during connect/i, key: 'error.dockerNotRunning' }, | 24 | { pattern: /Cannot connect to the Docker daemon|docker daemon is not running|error during connect/i, key: 'error.dockerNotRunning' }, |
| 25 | { pattern: /No such container:\s*(\S+)/i, key: 'error.containerMissing', groups: ['box'] }, | 25 | { pattern: /No such container:\s*(\S+)/i, key: 'error.containerMissing', groups: ['box'] }, |
| 26 | + // docker-agent serve acp without its agent file (cobra's message). | ||
| 27 | + { pattern: /accepts 1 arg\(s\), received 0/, key: 'error.agentFileMissing' }, | ||
| 26 | { pattern: /container (\S+) is not running|Container (\S+) is not running/i, key: 'error.containerStopped', groups: ['box'] }, | 28 | { pattern: /container (\S+) is not running|Container (\S+) is not running/i, key: 'error.containerStopped', groups: ['box'] }, |
| 27 | { pattern: /sandbox[ "']+([\w.-]+)["']? (?:not found|does not exist)/i, key: 'error.sandboxMissing', groups: ['box'] }, | 29 | { pattern: /sandbox[ "']+([\w.-]+)["']? (?:not found|does not exist)/i, key: 'error.sandboxMissing', groups: ['box'] }, |
| 28 | { pattern: /exec: "([^"]+)": executable file not found/, key: 'error.programNotFound', groups: ['program'] }, | 30 | { pattern: /exec: "([^"]+)": executable file not found/, key: 'error.programNotFound', groups: ['program'] }, |
| @@ -36,6 +38,9 @@ const rules: Rule[] = [ | |||
| 36 | { pattern: /unknown agent:?\s*(\S*)/, key: 'error.unknownAgent', groups: ['agent'] }, | 38 | { pattern: /unknown agent:?\s*(\S*)/, key: 'error.unknownAgent', groups: ['agent'] }, |
| 37 | { pattern: /the history was written by a newer Sidekicks/, key: 'error.newerHistory' }, | 39 | { pattern: /the history was written by a newer Sidekicks/, key: 'error.newerHistory' }, |
| 38 | { pattern: /an agent is answering in this channel/, key: 'error.channelBusy' }, | 40 | { pattern: /an agent is answering in this channel/, key: 'error.channelBusy' }, |
| 41 | + { pattern: /the agent is answering: wait for the end of its answer to unload/, key: 'error.agentAnswering' }, | ||
| 42 | + { pattern: /the agent is not running: it has no model to unload/, key: 'error.notRunning' }, | ||
| 43 | + { pattern: /cannot unload its model: it offers no \/unload command/, key: 'error.cannotUnload' }, | ||
| 39 | ] | 44 | ] |
| 40 | 45 | ||
| 41 | /** | 46 | /** |
added
frontend/src/lib/fileSelection.test.ts +55 -0 | new file mode 100644 | ||
| @@ -0,0 +1,55 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +import { describe, expect, it } from 'vitest' | |
| 4 | +import { canDrop, isUnder, movedPath, nameOf, parentOf, select } from './fileSelection' | |
| 5 | + | |
| 6 | +const rows = ['notes', 'notes/a.md', 'notes/b.md', 'AGENTS.md'] | |
| 7 | + | |
| 8 | +describe('select (issue #70)', () => { | |
| 9 | + it('selects one entry with a plain click', () => { | |
| 10 | + expect(select(rows, ['notes', 'AGENTS.md'], 'notes', 'notes/a.md', {})).toEqual(['notes/a.md']) | |
| 11 | + }) | |
| 12 | + | |
| 13 | + it('adds or takes an entry with ⌘ or Ctrl', () => { | |
| 14 | + expect(select(rows, ['notes'], 'notes', 'AGENTS.md', { toggle: true })).toEqual(['notes', 'AGENTS.md']) | |
| 15 | + expect(select(rows, ['notes', 'AGENTS.md'], 'notes', 'notes', { toggle: true })).toEqual(['AGENTS.md']) | |
| 16 | + }) | |
| 17 | + | |
| 18 | + it('selects a range with ⇧, in either direction', () => { | |
| 19 | + expect(select(rows, ['notes/a.md'], 'notes/a.md', 'AGENTS.md', { range: true })).toEqual(['notes/a.md', 'notes/b.md', 'AGENTS.md']) | |
| 20 | + expect(select(rows, ['AGENTS.md'], 'AGENTS.md', 'notes/a.md', { range: true })).toEqual(['notes/a.md', 'notes/b.md', 'AGENTS.md']) | |
| 21 | + }) | |
| 22 | + | |
| 23 | + it('falls back to one entry when the anchor is not shown', () => { | |
| 24 | + expect(select(rows, [], 'gone.md', 'notes', { range: true })).toEqual(['notes']) | |
| 25 | + }) | |
| 26 | +}) | |
| 27 | + | |
| 28 | +describe('paths', () => { | |
| 29 | + it('splits a path', () => { | |
| 30 | + expect(parentOf('a/b/c.md')).toBe('a/b') | |
| 31 | + expect(parentOf('c.md')).toBe('') | |
| 32 | + expect(nameOf('a/b/c.md')).toBe('c.md') | |
| 33 | + }) | |
| 34 | + | |
| 35 | + it('follows a renamed or moved entry', () => { | |
| 36 | + expect(movedPath('notes', 'notes', 'journal')).toBe('journal') | |
| 37 | + expect(movedPath('notes/plan.md', 'notes', 'archive/notes')).toBe('archive/notes/plan.md') | |
| 38 | + expect(movedPath('notes-2/plan.md', 'notes', 'journal')).toBe('notes-2/plan.md') | |
| 39 | + }) | |
| 40 | + | |
| 41 | + it('tells where entries can be dropped', () => { | |
| 42 | + expect(canDrop(['AGENTS.md'], 'notes')).toBe(true) | |
| 43 | + expect(canDrop(['notes'], 'notes')).toBe(false) | |
| 44 | + expect(canDrop(['notes'], 'notes/old')).toBe(false) | |
| 45 | + expect(canDrop(['notes/a.md'], 'notes')).toBe(false) | |
| 46 | + expect(canDrop(['notes/a.md'], '')).toBe(true) | |
| 47 | + expect(canDrop([], 'notes')).toBe(false) | |
| 48 | + }) | |
| 49 | + | |
| 50 | + it('tells what goes away with removed entries', () => { | |
| 51 | + expect(isUnder('notes/a.md', ['notes'])).toBe(true) | |
| 52 | + expect(isUnder('notes', ['notes'])).toBe(true) | |
| 53 | + expect(isUnder('notes-2', ['notes'])).toBe(false) | |
| 54 | + }) | |
| 55 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +import { describe, expect, it } from 'vitest' | ||
| 4 | +import { canDrop, isUnder, movedPath, nameOf, parentOf, select } from './fileSelection' | ||
| 5 | + | ||
| 6 | +const rows = ['notes', 'notes/a.md', 'notes/b.md', 'AGENTS.md'] | ||
| 7 | + | ||
| 8 | +describe('select (issue #70)', () => { | ||
| 9 | + it('selects one entry with a plain click', () => { | ||
| 10 | + expect(select(rows, ['notes', 'AGENTS.md'], 'notes', 'notes/a.md', {})).toEqual(['notes/a.md']) | ||
| 11 | + }) | ||
| 12 | + | ||
| 13 | + it('adds or takes an entry with ⌘ or Ctrl', () => { | ||
| 14 | + expect(select(rows, ['notes'], 'notes', 'AGENTS.md', { toggle: true })).toEqual(['notes', 'AGENTS.md']) | ||
| 15 | + expect(select(rows, ['notes', 'AGENTS.md'], 'notes', 'notes', { toggle: true })).toEqual(['AGENTS.md']) | ||
| 16 | + }) | ||
| 17 | + | ||
| 18 | + it('selects a range with ⇧, in either direction', () => { | ||
| 19 | + expect(select(rows, ['notes/a.md'], 'notes/a.md', 'AGENTS.md', { range: true })).toEqual(['notes/a.md', 'notes/b.md', 'AGENTS.md']) | ||
| 20 | + expect(select(rows, ['AGENTS.md'], 'AGENTS.md', 'notes/a.md', { range: true })).toEqual(['notes/a.md', 'notes/b.md', 'AGENTS.md']) | ||
| 21 | + }) | ||
| 22 | + | ||
| 23 | + it('falls back to one entry when the anchor is not shown', () => { | ||
| 24 | + expect(select(rows, [], 'gone.md', 'notes', { range: true })).toEqual(['notes']) | ||
| 25 | + }) | ||
| 26 | +}) | ||
| 27 | + | ||
| 28 | +describe('paths', () => { | ||
| 29 | + it('splits a path', () => { | ||
| 30 | + expect(parentOf('a/b/c.md')).toBe('a/b') | ||
| 31 | + expect(parentOf('c.md')).toBe('') | ||
| 32 | + expect(nameOf('a/b/c.md')).toBe('c.md') | ||
| 33 | + }) | ||
| 34 | + | ||
| 35 | + it('follows a renamed or moved entry', () => { | ||
| 36 | + expect(movedPath('notes', 'notes', 'journal')).toBe('journal') | ||
| 37 | + expect(movedPath('notes/plan.md', 'notes', 'archive/notes')).toBe('archive/notes/plan.md') | ||
| 38 | + expect(movedPath('notes-2/plan.md', 'notes', 'journal')).toBe('notes-2/plan.md') | ||
| 39 | + }) | ||
| 40 | + | ||
| 41 | + it('tells where entries can be dropped', () => { | ||
| 42 | + expect(canDrop(['AGENTS.md'], 'notes')).toBe(true) | ||
| 43 | + expect(canDrop(['notes'], 'notes')).toBe(false) | ||
| 44 | + expect(canDrop(['notes'], 'notes/old')).toBe(false) | ||
| 45 | + expect(canDrop(['notes/a.md'], 'notes')).toBe(false) | ||
| 46 | + expect(canDrop(['notes/a.md'], '')).toBe(true) | ||
| 47 | + expect(canDrop([], 'notes')).toBe(false) | ||
| 48 | + }) | ||
| 49 | + | ||
| 50 | + it('tells what goes away with removed entries', () => { | ||
| 51 | + expect(isUnder('notes/a.md', ['notes'])).toBe(true) | ||
| 52 | + expect(isUnder('notes', ['notes'])).toBe(true) | ||
| 53 | + expect(isUnder('notes-2', ['notes'])).toBe(false) | ||
| 54 | + }) | ||
| 55 | +}) | ||
added
frontend/src/lib/fileSelection.ts +74 -0 | new file mode 100644 | ||
| @@ -0,0 +1,74 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// The selection of several entries in the workspace tree, and where the | |
| 4 | +// paths go when entries are renamed or moved (issue #70). Pure functions: | |
| 5 | +// the Files tab calls them. | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * The selection after a click on path: alone, added to or taken from the | |
| 9 | + * selection (⌘ or Ctrl), or every row from the anchor to it (⇧). | |
| 10 | + * | |
| 11 | + * @example | |
| 12 | + * select(['a', 'b', 'c'], ['a'], 'a', 'c', { range: true }) // ['a', 'b', 'c'] | |
| 13 | + */ | |
| 14 | +export function select( | |
| 15 | + rows: string[], | |
| 16 | + current: string[], | |
| 17 | + anchor: string, | |
| 18 | + path: string, | |
| 19 | + modifiers: { toggle?: boolean; range?: boolean }, | |
| 20 | +): string[] { | |
| 21 | + if (modifiers.range && anchor && rows.includes(anchor) && rows.includes(path)) { | |
| 22 | + const [from, to] = [rows.indexOf(anchor), rows.indexOf(path)].sort((a, b) => a - b) | |
| 23 | + return rows.slice(from, to + 1) | |
| 24 | + } | |
| 25 | + if (modifiers.toggle) { | |
| 26 | + return current.includes(path) ? current.filter((candidate) => candidate !== path) : [...current, path] | |
| 27 | + } | |
| 28 | + return [path] | |
| 29 | +} | |
| 30 | + | |
| 31 | +/** The folder of a path, "" for the root: "a/b/c.md" → "a/b". */ | |
| 32 | +export function parentOf(path: string): string { | |
| 33 | + return path.includes('/') ? path.slice(0, path.lastIndexOf('/')) : '' | |
| 34 | +} | |
| 35 | + | |
| 36 | +/** The last part of a path: "a/b/c.md" → "c.md". */ | |
| 37 | +export function nameOf(path: string): string { | |
| 38 | + return path.slice(path.lastIndexOf('/') + 1) | |
| 39 | +} | |
| 40 | + | |
| 41 | +/** | |
| 42 | + * Where path is once from was renamed or moved to to: itself, or inside | |
| 43 | + * it; unchanged otherwise. | |
| 44 | + * | |
| 45 | + * @example | |
| 46 | + * movedPath('notes/plan.md', 'notes', 'archive/notes') // 'archive/notes/plan.md' | |
| 47 | + */ | |
| 48 | +export function movedPath(path: string, from: string, to: string): string { | |
| 49 | + if (path === from) return to | |
| 50 | + if (path.startsWith(from + '/')) return to + path.slice(from.length) | |
| 51 | + return path | |
| 52 | +} | |
| 53 | + | |
| 54 | +/** | |
| 55 | + * Whether entries can be dropped into folder: none of them is the folder, | |
| 56 | + * holds it, or is already directly in it. | |
| 57 | + * | |
| 58 | + * @example | |
| 59 | + * canDrop(['notes'], 'notes/old') // false: a folder never goes inside itself | |
| 60 | + */ | |
| 61 | +export function canDrop(paths: string[], folder: string): boolean { | |
| 62 | + if (paths.length === 0) return false | |
| 63 | + return paths.every( | |
| 64 | + (path) => path !== folder && !folder.startsWith(path + '/') && parentOf(path) !== folder, | |
| 65 | + ) | |
| 66 | +} | |
| 67 | + | |
| 68 | +/** | |
| 69 | + * Whether the entry at path disappears when paths are removed: it is one of | |
| 70 | + * them, or inside one. | |
| 71 | + */ | |
| 72 | +export function isUnder(path: string, paths: string[]): boolean { | |
| 73 | + return paths.some((removed) => path === removed || path.startsWith(removed + '/')) | |
| 74 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,74 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// The selection of several entries in the workspace tree, and where the | ||
| 4 | +// paths go when entries are renamed or moved (issue #70). Pure functions: | ||
| 5 | +// the Files tab calls them. | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * The selection after a click on path: alone, added to or taken from the | ||
| 9 | + * selection (⌘ or Ctrl), or every row from the anchor to it (⇧). | ||
| 10 | + * | ||
| 11 | + * @example | ||
| 12 | + * select(['a', 'b', 'c'], ['a'], 'a', 'c', { range: true }) // ['a', 'b', 'c'] | ||
| 13 | + */ | ||
| 14 | +export function select( | ||
| 15 | + rows: string[], | ||
| 16 | + current: string[], | ||
| 17 | + anchor: string, | ||
| 18 | + path: string, | ||
| 19 | + modifiers: { toggle?: boolean; range?: boolean }, | ||
| 20 | +): string[] { | ||
| 21 | + if (modifiers.range && anchor && rows.includes(anchor) && rows.includes(path)) { | ||
| 22 | + const [from, to] = [rows.indexOf(anchor), rows.indexOf(path)].sort((a, b) => a - b) | ||
| 23 | + return rows.slice(from, to + 1) | ||
| 24 | + } | ||
| 25 | + if (modifiers.toggle) { | ||
| 26 | + return current.includes(path) ? current.filter((candidate) => candidate !== path) : [...current, path] | ||
| 27 | + } | ||
| 28 | + return [path] | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +/** The folder of a path, "" for the root: "a/b/c.md" → "a/b". */ | ||
| 32 | +export function parentOf(path: string): string { | ||
| 33 | + return path.includes('/') ? path.slice(0, path.lastIndexOf('/')) : '' | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | +/** The last part of a path: "a/b/c.md" → "c.md". */ | ||
| 37 | +export function nameOf(path: string): string { | ||
| 38 | + return path.slice(path.lastIndexOf('/') + 1) | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +/** | ||
| 42 | + * Where path is once from was renamed or moved to to: itself, or inside | ||
| 43 | + * it; unchanged otherwise. | ||
| 44 | + * | ||
| 45 | + * @example | ||
| 46 | + * movedPath('notes/plan.md', 'notes', 'archive/notes') // 'archive/notes/plan.md' | ||
| 47 | + */ | ||
| 48 | +export function movedPath(path: string, from: string, to: string): string { | ||
| 49 | + if (path === from) return to | ||
| 50 | + if (path.startsWith(from + '/')) return to + path.slice(from.length) | ||
| 51 | + return path | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +/** | ||
| 55 | + * Whether entries can be dropped into folder: none of them is the folder, | ||
| 56 | + * holds it, or is already directly in it. | ||
| 57 | + * | ||
| 58 | + * @example | ||
| 59 | + * canDrop(['notes'], 'notes/old') // false: a folder never goes inside itself | ||
| 60 | + */ | ||
| 61 | +export function canDrop(paths: string[], folder: string): boolean { | ||
| 62 | + if (paths.length === 0) return false | ||
| 63 | + return paths.every( | ||
| 64 | + (path) => path !== folder && !folder.startsWith(path + '/') && parentOf(path) !== folder, | ||
| 65 | + ) | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +/** | ||
| 69 | + * Whether the entry at path disappears when paths are removed: it is one of | ||
| 70 | + * them, or inside one. | ||
| 71 | + */ | ||
| 72 | +export function isUnder(path: string, paths: string[]): boolean { | ||
| 73 | + return paths.some((removed) => path === removed || path.startsWith(removed + '/')) | ||
| 74 | +} | ||
modified
frontend/src/lib/files.test.ts +19 -1 | @@ -21,7 +21,25 @@ describe('workspace files', () => { | ||
| 21 | 21 | expect(languageFor('agent.YML')).toBe('yaml') |
| 22 | 22 | expect(languageFor('SKILL.md')).toBe('markdown') |
| 23 | 23 | expect(languageFor('data.json')).toBe('json') |
| 24 | - expect(languageFor('.env')).toBe('text') | |
| 24 | + expect(languageFor('notes.txt')).toBe('text') | |
| 25 | + expect(languageFor('LICENSE')).toBe('text') | |
| 26 | + }) | |
| 27 | + | |
| 28 | + it('recognises source code by extension or by name (issue #71)', () => { | |
| 29 | + expect(languageFor('internal/app/app.go')).toBe('go') | |
| 30 | + expect(languageFor('src/main.ts')).toBe('typescript') | |
| 31 | + expect(languageFor('App.tsx')).toBe('tsx') | |
| 32 | + expect(languageFor('tool.py')).toBe('python') | |
| 33 | + expect(languageFor('lib.rs')).toBe('rust') | |
| 34 | + expect(languageFor('run.sh')).toBe('shell') | |
| 35 | + expect(languageFor('Cargo.toml')).toBe('toml') | |
| 36 | + expect(languageFor('View.svelte')).toBe('html') | |
| 37 | + expect(languageFor('Dockerfile')).toBe('dockerfile') | |
| 38 | + expect(languageFor('build/Dockerfile.dev')).toBe('dockerfile') | |
| 39 | + expect(languageFor('Makefile')).toBe('shell') | |
| 40 | + expect(languageFor('.env')).toBe('properties') | |
| 41 | + expect(languageFor('.env.local')).toBe('properties') | |
| 42 | + expect(languageFor('go.mod')).toBe('go') | |
| 25 | 43 | }) |
| 26 | 44 | |
| 27 | 45 | it('checks new file names', () => { |
| @@ -21,7 +21,25 @@ describe('workspace files', () => { | |||
| 21 | expect(languageFor('agent.YML')).toBe('yaml') | 21 | expect(languageFor('agent.YML')).toBe('yaml') |
| 22 | expect(languageFor('SKILL.md')).toBe('markdown') | 22 | expect(languageFor('SKILL.md')).toBe('markdown') |
| 23 | expect(languageFor('data.json')).toBe('json') | 23 | expect(languageFor('data.json')).toBe('json') |
| 24 | - expect(languageFor('.env')).toBe('text') | 24 | + expect(languageFor('notes.txt')).toBe('text') |
| 25 | + expect(languageFor('LICENSE')).toBe('text') | ||
| 26 | + }) | ||
| 27 | + | ||
| 28 | + it('recognises source code by extension or by name (issue #71)', () => { | ||
| 29 | + expect(languageFor('internal/app/app.go')).toBe('go') | ||
| 30 | + expect(languageFor('src/main.ts')).toBe('typescript') | ||
| 31 | + expect(languageFor('App.tsx')).toBe('tsx') | ||
| 32 | + expect(languageFor('tool.py')).toBe('python') | ||
| 33 | + expect(languageFor('lib.rs')).toBe('rust') | ||
| 34 | + expect(languageFor('run.sh')).toBe('shell') | ||
| 35 | + expect(languageFor('Cargo.toml')).toBe('toml') | ||
| 36 | + expect(languageFor('View.svelte')).toBe('html') | ||
| 37 | + expect(languageFor('Dockerfile')).toBe('dockerfile') | ||
| 38 | + expect(languageFor('build/Dockerfile.dev')).toBe('dockerfile') | ||
| 39 | + expect(languageFor('Makefile')).toBe('shell') | ||
| 40 | + expect(languageFor('.env')).toBe('properties') | ||
| 41 | + expect(languageFor('.env.local')).toBe('properties') | ||
| 42 | + expect(languageFor('go.mod')).toBe('go') | ||
| 25 | }) | 43 | }) |
| 26 | 44 | ||
| 27 | it('checks new file names', () => { | 45 | it('checks new file names', () => { |
modified
frontend/src/lib/files.ts +45 -8 | @@ -20,7 +20,8 @@ export function isHidden(name: string): boolean { | ||
| 20 | 20 | const icons: Record<string, string> = { |
| 21 | 21 | md: '📝', txt: '📝', |
| 22 | 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', |
| 23 | - go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', | |
| 23 | + go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', tsx: '📜', jsx: '📜', java: '📜', | |
| 24 | + c: '📜', cpp: '📜', h: '📜', rb: '📜', php: '📜', swift: '📜', kt: '📜', cs: '📜', lua: '📜', sql: '📜', | |
| 24 | 25 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', |
| 25 | 26 | } |
| 26 | 27 | |
| @@ -30,13 +31,49 @@ export function iconFor(name: string, dir: boolean, open = false): string { | ||
| 30 | 31 | return icons[extensionOf(name)] ?? '📄' |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | -/** The editor language of a file, from its extension. */ | |
| 34 | -export function languageFor(name: string): 'yaml' | 'markdown' | 'json' | 'text' { | |
| 35 | - const extension = extensionOf(name) | |
| 36 | - if (extension === 'yaml' || extension === 'yml') return 'yaml' | |
| 37 | - if (extension === 'md' || extension === 'markdown') return 'markdown' | |
| 38 | - if (extension === 'json') return 'json' | |
| 39 | - return 'text' | |
| 34 | +/** The languages the editor colours (issue #71); "text" is plain text. */ | |
| 35 | +export type EditorLanguage = | |
| 36 | + | 'yaml' | 'markdown' | 'json' | 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'python' | 'go' | |
| 37 | + | 'rust' | 'css' | 'html' | 'xml' | 'java' | 'cpp' | 'php' | 'sql' | 'shell' | 'toml' | |
| 38 | + | 'dockerfile' | 'ruby' | 'swift' | 'kotlin' | 'csharp' | 'lua' | 'properties' | 'diff' | |
| 39 | + | 'powershell' | 'text' | |
| 40 | + | |
| 41 | +const languagesByExtension: Record<string, EditorLanguage> = { | |
| 42 | + yaml: 'yaml', yml: 'yaml', md: 'markdown', markdown: 'markdown', json: 'json', jsonc: 'json', | |
| 43 | + js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', mts: 'typescript', cts: 'typescript', | |
| 44 | + jsx: 'jsx', tsx: 'tsx', py: 'python', pyw: 'python', go: 'go', rs: 'rust', | |
| 45 | + css: 'css', scss: 'css', less: 'css', html: 'html', htm: 'html', svelte: 'html', vue: 'html', | |
| 46 | + xml: 'xml', svg: 'xml', plist: 'xml', drawio: 'xml', | |
| 47 | + java: 'java', c: 'cpp', h: 'cpp', cc: 'cpp', cpp: 'cpp', cxx: 'cpp', hpp: 'cpp', hh: 'cpp', | |
| 48 | + php: 'php', sql: 'sql', sh: 'shell', bash: 'shell', zsh: 'shell', ksh: 'shell', fish: 'shell', | |
| 49 | + toml: 'toml', rb: 'ruby', swift: 'swift', kt: 'kotlin', kts: 'kotlin', cs: 'csharp', lua: 'lua', | |
| 50 | + properties: 'properties', ini: 'properties', cfg: 'properties', conf: 'properties', env: 'properties', | |
| 51 | + diff: 'diff', patch: 'diff', ps1: 'powershell', psm1: 'powershell', | |
| 52 | +} | |
| 53 | + | |
| 54 | +// Files known by their name, with no telling extension. | |
| 55 | +const languagesByName: Record<string, EditorLanguage> = { | |
| 56 | + dockerfile: 'dockerfile', containerfile: 'dockerfile', makefile: 'shell', gnumakefile: 'shell', | |
| 57 | + '.bashrc': 'shell', '.zshrc': 'shell', '.profile': 'shell', '.bash_profile': 'shell', | |
| 58 | + '.env': 'properties', '.gitignore': 'properties', '.dockerignore': 'properties', '.editorconfig': 'properties', | |
| 59 | + gemfile: 'ruby', rakefile: 'ruby', 'go.mod': 'go', 'cargo.lock': 'toml', | |
| 60 | +} | |
| 61 | + | |
| 62 | +/** | |
| 63 | + * The editor language of a file, from its name or its extension; "text" | |
| 64 | + * when it is unknown. | |
| 65 | + * | |
| 66 | + * @example | |
| 67 | + * languageFor('main.go') // 'go' | |
| 68 | + * languageFor('Dockerfile') // 'dockerfile' | |
| 69 | + * languageFor('notes.txt') // 'text' | |
| 70 | + */ | |
| 71 | +export function languageFor(path: string): EditorLanguage { | |
| 72 | + const name = (path.split('/').pop() ?? '').toLowerCase() | |
| 73 | + if (languagesByName[name]) return languagesByName[name] | |
| 74 | + if (name.startsWith('dockerfile.') || name.endsWith('.dockerfile')) return 'dockerfile' | |
| 75 | + if (name.startsWith('.env.')) return 'properties' | |
| 76 | + return languagesByExtension[extensionOf(name)] ?? 'text' | |
| 40 | 77 | } |
| 41 | 78 | |
| 42 | 79 | function extensionOf(name: string): string { |
| @@ -20,7 +20,8 @@ export function isHidden(name: string): boolean { | |||
| 20 | const icons: Record<string, string> = { | 20 | const icons: Record<string, string> = { |
| 21 | md: '📝', txt: '📝', | 21 | md: '📝', txt: '📝', |
| 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', | 22 | yaml: '⚙️', yml: '⚙️', toml: '⚙️', json: '⚙️', |
| 23 | - go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', | 23 | + go: '📜', py: '📜', js: '📜', ts: '📜', sh: '📜', rs: '📜', tsx: '📜', jsx: '📜', java: '📜', |
| 24 | + c: '📜', cpp: '📜', h: '📜', rb: '📜', php: '📜', swift: '📜', kt: '📜', cs: '📜', lua: '📜', sql: '📜', | ||
| 24 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', | 25 | png: '🖼️', jpg: '🖼️', jpeg: '🖼️', gif: '🖼️', svg: '🖼️', |
| 25 | } | 26 | } |
| 26 | 27 | ||
| @@ -30,13 +31,49 @@ export function iconFor(name: string, dir: boolean, open = false): string { | |||
| 30 | return icons[extensionOf(name)] ?? '📄' | 31 | return icons[extensionOf(name)] ?? '📄' |
| 31 | } | 32 | } |
| 32 | 33 | ||
| 33 | -/** The editor language of a file, from its extension. */ | 34 | +/** The languages the editor colours (issue #71); "text" is plain text. */ |
| 34 | -export function languageFor(name: string): 'yaml' | 'markdown' | 'json' | 'text' { | 35 | +export type EditorLanguage = |
| 35 | - const extension = extensionOf(name) | 36 | + | 'yaml' | 'markdown' | 'json' | 'javascript' | 'typescript' | 'jsx' | 'tsx' | 'python' | 'go' |
| 36 | - if (extension === 'yaml' || extension === 'yml') return 'yaml' | 37 | + | 'rust' | 'css' | 'html' | 'xml' | 'java' | 'cpp' | 'php' | 'sql' | 'shell' | 'toml' |
| 37 | - if (extension === 'md' || extension === 'markdown') return 'markdown' | 38 | + | 'dockerfile' | 'ruby' | 'swift' | 'kotlin' | 'csharp' | 'lua' | 'properties' | 'diff' |
| 38 | - if (extension === 'json') return 'json' | 39 | + | 'powershell' | 'text' |
| 39 | - return 'text' | 40 | + |
| 41 | +const languagesByExtension: Record<string, EditorLanguage> = { | ||
| 42 | + yaml: 'yaml', yml: 'yaml', md: 'markdown', markdown: 'markdown', json: 'json', jsonc: 'json', | ||
| 43 | + js: 'javascript', mjs: 'javascript', cjs: 'javascript', ts: 'typescript', mts: 'typescript', cts: 'typescript', | ||
| 44 | + jsx: 'jsx', tsx: 'tsx', py: 'python', pyw: 'python', go: 'go', rs: 'rust', | ||
| 45 | + css: 'css', scss: 'css', less: 'css', html: 'html', htm: 'html', svelte: 'html', vue: 'html', | ||
| 46 | + xml: 'xml', svg: 'xml', plist: 'xml', drawio: 'xml', | ||
| 47 | + java: 'java', c: 'cpp', h: 'cpp', cc: 'cpp', cpp: 'cpp', cxx: 'cpp', hpp: 'cpp', hh: 'cpp', | ||
| 48 | + php: 'php', sql: 'sql', sh: 'shell', bash: 'shell', zsh: 'shell', ksh: 'shell', fish: 'shell', | ||
| 49 | + toml: 'toml', rb: 'ruby', swift: 'swift', kt: 'kotlin', kts: 'kotlin', cs: 'csharp', lua: 'lua', | ||
| 50 | + properties: 'properties', ini: 'properties', cfg: 'properties', conf: 'properties', env: 'properties', | ||
| 51 | + diff: 'diff', patch: 'diff', ps1: 'powershell', psm1: 'powershell', | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +// Files known by their name, with no telling extension. | ||
| 55 | +const languagesByName: Record<string, EditorLanguage> = { | ||
| 56 | + dockerfile: 'dockerfile', containerfile: 'dockerfile', makefile: 'shell', gnumakefile: 'shell', | ||
| 57 | + '.bashrc': 'shell', '.zshrc': 'shell', '.profile': 'shell', '.bash_profile': 'shell', | ||
| 58 | + '.env': 'properties', '.gitignore': 'properties', '.dockerignore': 'properties', '.editorconfig': 'properties', | ||
| 59 | + gemfile: 'ruby', rakefile: 'ruby', 'go.mod': 'go', 'cargo.lock': 'toml', | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +/** | ||
| 63 | + * The editor language of a file, from its name or its extension; "text" | ||
| 64 | + * when it is unknown. | ||
| 65 | + * | ||
| 66 | + * @example | ||
| 67 | + * languageFor('main.go') // 'go' | ||
| 68 | + * languageFor('Dockerfile') // 'dockerfile' | ||
| 69 | + * languageFor('notes.txt') // 'text' | ||
| 70 | + */ | ||
| 71 | +export function languageFor(path: string): EditorLanguage { | ||
| 72 | + const name = (path.split('/').pop() ?? '').toLowerCase() | ||
| 73 | + if (languagesByName[name]) return languagesByName[name] | ||
| 74 | + if (name.startsWith('dockerfile.') || name.endsWith('.dockerfile')) return 'dockerfile' | ||
| 75 | + if (name.startsWith('.env.')) return 'properties' | ||
| 76 | + return languagesByExtension[extensionOf(name)] ?? 'text' | ||
| 40 | } | 77 | } |
| 41 | 78 | ||
| 42 | function extensionOf(name: string): string { | 79 | function extensionOf(name: string): string { |
modified
frontend/src/lib/i18n/messages.ts +92 -0 | @@ -43,6 +43,14 @@ export const en = { | ||
| 43 | 43 | // log |
| 44 | 44 | 'logs.of': 'Log of', |
| 45 | 45 | 'logs.empty': 'Nothing yet: the log fills up when the agent starts.', |
| 46 | + 'unload.one': '⏏ Unload the model', | |
| 47 | + 'unload.oneHelp': "Frees the memory {agent}'s model takes, without stopping it: the model is loaded again with its next message.", | |
| 48 | + 'unload.agent': "Unload {agent}'s model", | |
| 49 | + 'unload.all': '⏏ Unload all', | |
| 50 | + 'unload.allHelp': 'Frees the memory of the models of every running agent that can do it.', | |
| 51 | + 'unload.done': 'Model unloaded: {agents}.', | |
| 52 | + 'unload.skipped': 'Left alone (answering or cannot unload): {agents}.', | |
| 53 | + 'unload.none': 'No running agent to unload.', | |
| 46 | 54 | 'memory.pressure': 'Memory pressure:', |
| 47 | 55 | 'memory.level.normal': 'normal', |
| 48 | 56 | 'memory.level.warning': 'high', |
| @@ -114,6 +122,7 @@ export const en = { | ||
| 114 | 122 | 'system.no-recipient': 'Nobody was addressed: mention an agent with @ (for example @{example}).', |
| 115 | 123 | 'system.agent-unavailable': '{agent} could not answer.', |
| 116 | 124 | 'system.attachment-unavailable': 'A file was not sent to {agent}.', |
| 125 | + 'system.handoff-limit': '{agent} mentioned another agent, but this message was already handed from agent to agent as often as allowed (limits.maxAgentHandoffs): the chain stops here. Mention the agent yourself to go on.', | |
| 117 | 126 | |
| 118 | 127 | // tool calls |
| 119 | 128 | 'tool.status.pending': 'waiting', |
| @@ -153,6 +162,7 @@ export const en = { | ||
| 153 | 162 | 'error.containerMissing': 'The container "{box}" does not exist. Create and start it (docker run …), or correct its name in the agent\'s settings.', |
| 154 | 163 | 'error.containerStopped': 'The container "{box}" is stopped. Start it with: docker start {box}', |
| 155 | 164 | 'error.sandboxMissing': 'The sbx sandbox "{box}" does not exist. Create it, or correct its name in the agent\'s settings.', |
| 165 | + 'error.agentFileMissing': 'The agent was started without its file: Docker Agent needs the path of its agent file after serve acp. Add it to the agent\'s arguments in Settings.', | |
| 156 | 166 | 'error.limitReached': 'Already {limit} agents are working, the most allowed at once. Wait for one to finish, or stop one in the Agents panel.', |
| 157 | 167 | 'error.modelServer': 'The agent cannot reach its model server. Check that it is running (llmman, Ollama…), then try again.', |
| 158 | 168 | 'error.protocol': 'This agent speaks a version of ACP that Sidekicks does not know. Update the agent or Sidekicks.', |
| @@ -161,6 +171,9 @@ export const en = { | ||
| 161 | 171 | 'error.unknownAgent': 'The agent "{agent}" is no longer in the configuration.', |
| 162 | 172 | 'error.newerHistory': 'The history was written by a newer Sidekicks. Update Sidekicks to read it.', |
| 163 | 173 | 'error.channelBusy': 'An agent is answering here: stop it (■) or wait for the end of its answer, then clear the history.', |
| 174 | + 'error.agentAnswering': 'The agent is answering: wait for the end of its answer, then unload its model.', | |
| 175 | + 'error.notRunning': 'The agent is not running: its model is not loaded by it.', | |
| 176 | + 'error.cannotUnload': 'This agent cannot unload its model: it offers no /unload command.', | |
| 164 | 177 | 'code.copy': 'Copy', |
| 165 | 178 | 'code.copied': 'Copied ✓', |
| 166 | 179 | 'message.copy': 'Copy the answer', |
| @@ -221,6 +234,7 @@ export const en = { | ||
| 221 | 234 | 'linked.label': 'The file {file}', |
| 222 | 235 | 'linked.close': 'Close (Esc)', |
| 223 | 236 | 'linked.reveal': 'Show where it is', |
| 237 | + 'workspace.revealEntry': 'Show where {name} is', | |
| 224 | 238 | 'linked.openInFiles': "Open in the agent's files", |
| 225 | 239 | 'linked.reload': 'Read the file again', |
| 226 | 240 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', |
| @@ -244,6 +258,25 @@ export const en = { | ||
| 244 | 258 | 'workspace.noChannel': 'in no channel', |
| 245 | 259 | 'workspace.showHidden': 'Show hidden files', |
| 246 | 260 | 'workspace.newFile': '+ New file', |
| 261 | + 'workspace.newFolder': '+ New folder', | |
| 262 | + 'workspace.newFolderIn': 'New folder in {folder}', | |
| 263 | + 'workspace.folderName': 'Folder name', | |
| 264 | + 'workspace.tree': 'Files of the agent', | |
| 265 | + 'workspace.renameEntry': 'Rename {name}', | |
| 266 | + 'workspace.selected': '{count} selected — ⌘/Ctrl-click or ⇧-click to change the selection', | |
| 267 | + 'workspace.deleteManyConfirm': 'Delete these {count} items? They go to the trash.', | |
| 268 | + 'workspace.deleteManyForGood': 'Delete these {count} items for good? There is no trash in a container or a sandbox.', | |
| 269 | + 'workspace.moveOne': 'Move {name} to the folder', | |
| 270 | + 'workspace.moveMany': 'Move these {count} items to the folder', | |
| 271 | + 'workspace.moveTarget': 'Folder (empty: the top)', | |
| 272 | + 'workspace.move': 'Move', | |
| 273 | + 'workspace.menu.open': 'Open', | |
| 274 | + 'workspace.menu.rename': 'Rename… (F2)', | |
| 275 | + 'workspace.menu.move': 'Move to…', | |
| 276 | + 'workspace.menu.moveMany': 'Move {count} items to…', | |
| 277 | + 'workspace.menu.deleteMany': 'Delete {count} items', | |
| 278 | + 'workspace.menu.duplicate': 'Duplicate (⌘D)', | |
| 279 | + 'workspace.menu.duplicateMany': 'Duplicate {count} items (⌘D)', | |
| 247 | 280 | 'workspace.newFileIn': 'New file in {folder}', |
| 248 | 281 | 'workspace.fileName': 'File name', |
| 249 | 282 | 'workspace.create': 'Create', |
| @@ -266,6 +299,13 @@ export const en = { | ||
| 266 | 299 | 'terminal.ended': 'The shell has ended.', |
| 267 | 300 | 'terminal.restart': 'Open a new shell', |
| 268 | 301 | 'terminal.error': 'Cannot open a terminal.', |
| 302 | + 'terminal.list': 'Terminals of the agent', | |
| 303 | + 'terminal.name': 'Terminal {number}', | |
| 304 | + 'terminal.new': 'Open another terminal', | |
| 305 | + 'terminal.close': 'Close {name}: ends its shell and what it runs', | |
| 306 | + 'terminal.limit': 'At most {count} terminals per agent', | |
| 307 | + 'terminal.none': 'No terminal open. Click + to open one.', | |
| 308 | + 'terminal.running': '{count} terminal(s) running, even while you look elsewhere', | |
| 269 | 309 | |
| 270 | 310 | // welcome and the "add an agent" assistant |
| 271 | 311 | 'welcome.title': 'Welcome to Sidekicks', |
| @@ -319,6 +359,11 @@ export const en = { | ||
| 319 | 359 | 'assistant.program': 'Program', |
| 320 | 360 | 'assistant.programPlaceholder': 'mm', |
| 321 | 361 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', |
| 362 | + 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp, codex-acp, gemini (arguments --acp): Claude, Codex or Gemini, with the sbxenv.yaml of its sandbox dropped above.', | |
| 363 | + 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".', | |
| 364 | + 'assistant.sandboxMismatch': '{file} describes a sandbox for the sbx agent "{agent}", not "{wanted}": this program would not be found there. Choose the sbxenv.yaml of the right sandbox above.', | |
| 365 | + 'assistant.codexNote': 'Codex runs from the docker.io/sbx/codex-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Sign in to ChatGPT or store your OpenAI API key in sbx before starting it: see the guide "Add a Codex agent in an sbx sandbox".', | |
| 366 | + 'assistant.geminiNote': 'Gemini runs from the docker.io/sbx/gemini-kit kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Gemini API key in sbx before starting it: see the guide "Add a Gemini agent in an sbx sandbox".', | |
| 322 | 367 | 'assistant.arguments': 'Arguments', |
| 323 | 368 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 324 | 369 | 'assistant.workspace': 'Agent\'s folder', |
| @@ -332,6 +377,7 @@ export const en = { | ||
| 332 | 377 | 'assistant.missing.program': 'Say which program starts the agent.', |
| 333 | 378 | 'assistant.missing.workspace': 'Choose the agent\'s folder.', |
| 334 | 379 | 'assistant.missing.box': 'Give the name of the container or sandbox.', |
| 380 | + 'assistant.missing.agentFile': 'Docker Agent needs its agent file after serve acp: drop it on the agent\'s configuration file area above, or type its path.', | |
| 335 | 381 | 'assistant.refused': 'The agent was not added:', |
| 336 | 382 | 'assistant.agentConfig.title': 'The agent\'s configuration file (optional)', |
| 337 | 383 | 'assistant.agentConfig.intro': 'Give the YAML file that configures the agent: its folder becomes the agent\'s folder, and the arguments of mm, docker-agent or docker agent are filled in.', |
| @@ -398,6 +444,14 @@ export const fr: Record<MessageKey, string> = { | ||
| 398 | 444 | |
| 399 | 445 | 'logs.of': 'Journal de', |
| 400 | 446 | 'logs.empty': "Rien pour l'instant : le journal se remplit quand l'agent démarre.", |
| 447 | + 'unload.one': '⏏ Décharger le modèle', | |
| 448 | + 'unload.oneHelp': "Libère la mémoire prise par le modèle de {agent}, sans l'arrêter : le modèle est rechargé à son prochain message.", | |
| 449 | + 'unload.agent': 'Décharger le modèle de {agent}', | |
| 450 | + 'unload.all': '⏏ Tout décharger', | |
| 451 | + 'unload.allHelp': 'Libère la mémoire des modèles de tous les agents qui tournent et savent le faire.', | |
| 452 | + 'unload.done': 'Modèle déchargé : {agents}.', | |
| 453 | + 'unload.skipped': 'Laissés de côté (en train de répondre ou sans /unload) : {agents}.', | |
| 454 | + 'unload.none': 'Aucun agent en marche à décharger.', | |
| 401 | 455 | 'memory.pressure': 'Pression mémoire :', |
| 402 | 456 | 'memory.level.normal': 'normale', |
| 403 | 457 | 'memory.level.warning': 'élevée', |
| @@ -465,6 +519,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 465 | 519 | 'system.no-recipient': "Personne n'est désigné : mentionnez un agent avec @ (par exemple @{example}).", |
| 466 | 520 | 'system.agent-unavailable': "{agent} n'a pas pu répondre.", |
| 467 | 521 | 'system.attachment-unavailable': "Un fichier n'a pas été envoyé à {agent}.", |
| 522 | + 'system.handoff-limit': "{agent} a mentionné un autre agent, mais ce message est déjà passé d'agent en agent autant de fois que permis (limits.maxAgentHandoffs) : la chaîne s'arrête ici. Mentionnez vous-même l'agent pour continuer.", | |
| 468 | 523 | |
| 469 | 524 | 'tool.status.pending': 'en attente', |
| 470 | 525 | 'tool.status.in_progress': 'en cours', |
| @@ -501,6 +556,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 501 | 556 | 'error.containerMissing': "Le conteneur « {box} » n'existe pas. Créez-le et démarrez-le (docker run …), ou corrigez son nom dans les réglages de l'agent.", |
| 502 | 557 | 'error.containerStopped': 'Le conteneur « {box} » est arrêté. Démarrez-le avec : docker start {box}', |
| 503 | 558 | 'error.sandboxMissing': "La sandbox sbx « {box} » n'existe pas. Créez-la, ou corrigez son nom dans les réglages de l'agent.", |
| 559 | + 'error.agentFileMissing': "L'agent a été démarré sans son fichier : Docker Agent a besoin du chemin de son fichier d'agent après serve acp. Ajoutez-le aux arguments de l'agent dans Settings.", | |
| 504 | 560 | 'error.limitReached': "Déjà {limit} agents travaillent, le maximum autorisé en même temps. Attendez qu'un agent ait fini, ou arrêtez-en un dans le panneau Agents.", |
| 505 | 561 | 'error.modelServer': "L'agent n'arrive pas à joindre son serveur de modèles. Vérifiez qu'il tourne (llmman, Ollama…), puis réessayez.", |
| 506 | 562 | 'error.protocol': "Cet agent parle une version d'ACP que Sidekicks ne connaît pas. Mettez à jour l'agent ou Sidekicks.", |
| @@ -509,6 +565,9 @@ export const fr: Record<MessageKey, string> = { | ||
| 509 | 565 | 'error.unknownAgent': "L'agent « {agent} » n'est plus dans la configuration.", |
| 510 | 566 | 'error.newerHistory': "L'historique a été écrit par un Sidekicks plus récent. Mettez Sidekicks à jour pour le lire.", |
| 511 | 567 | 'error.channelBusy': "Un agent répond ici : arrêtez-le (■) ou attendez la fin de sa réponse, puis videz l'historique.", |
| 568 | + 'error.agentAnswering': "L'agent est en train de répondre : attendez la fin de sa réponse, puis déchargez son modèle.", | |
| 569 | + 'error.notRunning': "L'agent ne tourne pas : il n'a pas de modèle chargé.", | |
| 570 | + 'error.cannotUnload': 'Cet agent ne sait pas décharger son modèle : il ne propose pas de commande /unload.', | |
| 512 | 571 | 'code.copy': 'Copier', |
| 513 | 572 | 'code.copied': 'Copié ✓', |
| 514 | 573 | 'message.copy': 'Copier la réponse', |
| @@ -568,6 +627,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 568 | 627 | 'linked.label': 'Le fichier {file}', |
| 569 | 628 | 'linked.close': 'Fermer (Échap)', |
| 570 | 629 | 'linked.reveal': "Afficher l'emplacement", |
| 630 | + 'workspace.revealEntry': "Afficher l'emplacement de {name}", | |
| 571 | 631 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", |
| 572 | 632 | 'linked.reload': 'Relire le fichier', |
| 573 | 633 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', |
| @@ -591,6 +651,25 @@ export const fr: Record<MessageKey, string> = { | ||
| 591 | 651 | 'workspace.noChannel': 'dans aucun channel', |
| 592 | 652 | 'workspace.showHidden': 'Afficher les fichiers cachés', |
| 593 | 653 | 'workspace.newFile': '+ Nouveau fichier', |
| 654 | + 'workspace.newFolder': '+ Nouveau dossier', | |
| 655 | + 'workspace.newFolderIn': 'Nouveau dossier dans {folder}', | |
| 656 | + 'workspace.folderName': 'Nom du dossier', | |
| 657 | + 'workspace.tree': "Fichiers de l'agent", | |
| 658 | + 'workspace.renameEntry': 'Renommer {name}', | |
| 659 | + 'workspace.selected': '{count} sélectionnés — ⌘/Ctrl-clic ou ⇧-clic pour changer la sélection', | |
| 660 | + 'workspace.deleteManyConfirm': 'Supprimer ces {count} éléments ? Ils partent à la corbeille.', | |
| 661 | + 'workspace.deleteManyForGood': "Supprimer définitivement ces {count} éléments ? Il n'y a pas de corbeille dans un conteneur ou une sandbox.", | |
| 662 | + 'workspace.moveOne': 'Déplacer {name} dans le dossier', | |
| 663 | + 'workspace.moveMany': 'Déplacer ces {count} éléments dans le dossier', | |
| 664 | + 'workspace.moveTarget': 'Dossier (vide : la racine)', | |
| 665 | + 'workspace.move': 'Déplacer', | |
| 666 | + 'workspace.menu.open': 'Ouvrir', | |
| 667 | + 'workspace.menu.rename': 'Renommer… (F2)', | |
| 668 | + 'workspace.menu.move': 'Déplacer vers…', | |
| 669 | + 'workspace.menu.moveMany': 'Déplacer {count} éléments vers…', | |
| 670 | + 'workspace.menu.deleteMany': 'Supprimer {count} éléments', | |
| 671 | + 'workspace.menu.duplicate': 'Dupliquer (⌘D)', | |
| 672 | + 'workspace.menu.duplicateMany': 'Dupliquer {count} éléments (⌘D)', | |
| 594 | 673 | 'workspace.newFileIn': 'Nouveau fichier dans {folder}', |
| 595 | 674 | 'workspace.fileName': 'Nom du fichier', |
| 596 | 675 | 'workspace.create': 'Créer', |
| @@ -613,6 +692,13 @@ export const fr: Record<MessageKey, string> = { | ||
| 613 | 692 | 'terminal.ended': 'Le shell est terminé.', |
| 614 | 693 | 'terminal.restart': 'Ouvrir un nouveau shell', |
| 615 | 694 | 'terminal.error': "Impossible d'ouvrir un terminal.", |
| 695 | + 'terminal.list': "Terminaux de l'agent", | |
| 696 | + 'terminal.name': 'Terminal {number}', | |
| 697 | + 'terminal.new': 'Ouvrir un autre terminal', | |
| 698 | + 'terminal.close': 'Fermer {name} : arrête son shell et ce qui y tourne', | |
| 699 | + 'terminal.limit': 'Au plus {count} terminaux par agent', | |
| 700 | + 'terminal.none': 'Aucun terminal ouvert. Cliquez sur + pour en ouvrir un.', | |
| 701 | + 'terminal.running': '{count} terminal(aux) en cours, même quand vous regardez ailleurs', | |
| 616 | 702 | |
| 617 | 703 | 'welcome.title': 'Bienvenue dans Sidekicks', |
| 618 | 704 | 'welcome.tagline': "Discutez avec des agents d'IA dans des channels, comme avec des collègues.", |
| @@ -665,6 +751,11 @@ export const fr: Record<MessageKey, string> = { | ||
| 665 | 751 | 'assistant.program': 'Programme', |
| 666 | 752 | 'assistant.programPlaceholder': 'mm', |
| 667 | 753 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", |
| 754 | + 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp, codex-acp, gemini (arguments --acp) : Claude, Codex ou Gemini, avec le sbxenv.yaml de sa sandbox déposé plus haut.", | |
| 755 | + 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", | |
| 756 | + 'assistant.sandboxMismatch': "{file} décrit une sandbox pour l'agent sbx « {agent} », pas « {wanted} » : ce programme n'y serait pas trouvé. Choisissez plus haut le sbxenv.yaml de la bonne sandbox.", | |
| 757 | + 'assistant.codexNote': "Codex tourne grâce au kit docker.io/sbx/codex-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Connectez-vous à ChatGPT ou enregistrez votre clé d'API OpenAI dans sbx avant de le démarrer : voir le guide « Ajouter un agent Codex dans une sandbox sbx ».", | |
| 758 | + 'assistant.geminiNote': "Gemini tourne grâce au kit docker.io/sbx/gemini-kit nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Gemini dans sbx avant de le démarrer : voir le guide « Ajouter un agent Gemini dans une sandbox sbx ».", | |
| 668 | 759 | 'assistant.arguments': 'Arguments', |
| 669 | 760 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 670 | 761 | 'assistant.workspace': "Dossier de l'agent", |
| @@ -678,6 +769,7 @@ export const fr: Record<MessageKey, string> = { | ||
| 678 | 769 | 'assistant.missing.program': "Indiquez le programme qui démarre l'agent.", |
| 679 | 770 | 'assistant.missing.workspace': "Choisissez le dossier de l'agent.", |
| 680 | 771 | 'assistant.missing.box': 'Donnez le nom du conteneur ou de la sandbox.', |
| 772 | + 'assistant.missing.agentFile': "Docker Agent a besoin de son fichier d'agent après serve acp : déposez-le plus haut sur la zone du fichier de configuration de l'agent, ou tapez son chemin.", | |
| 681 | 773 | 'assistant.refused': "L'agent n'a pas été ajouté :", |
| 682 | 774 | 'assistant.agentConfig.title': "Le fichier de configuration de l'agent (facultatif)", |
| 683 | 775 | 'assistant.agentConfig.intro': "Indiquez le fichier YAML qui configure l'agent : son dossier devient celui de l'agent, et les arguments de mm, docker-agent ou docker agent sont remplis.", |
| @@ -43,6 +43,14 @@ export const en = { | |||
| 43 | // log | 43 | // log |
| 44 | 'logs.of': 'Log of', | 44 | 'logs.of': 'Log of', |
| 45 | 'logs.empty': 'Nothing yet: the log fills up when the agent starts.', | 45 | 'logs.empty': 'Nothing yet: the log fills up when the agent starts.', |
| 46 | + 'unload.one': '⏏ Unload the model', | ||
| 47 | + 'unload.oneHelp': "Frees the memory {agent}'s model takes, without stopping it: the model is loaded again with its next message.", | ||
| 48 | + 'unload.agent': "Unload {agent}'s model", | ||
| 49 | + 'unload.all': '⏏ Unload all', | ||
| 50 | + 'unload.allHelp': 'Frees the memory of the models of every running agent that can do it.', | ||
| 51 | + 'unload.done': 'Model unloaded: {agents}.', | ||
| 52 | + 'unload.skipped': 'Left alone (answering or cannot unload): {agents}.', | ||
| 53 | + 'unload.none': 'No running agent to unload.', | ||
| 46 | 'memory.pressure': 'Memory pressure:', | 54 | 'memory.pressure': 'Memory pressure:', |
| 47 | 'memory.level.normal': 'normal', | 55 | 'memory.level.normal': 'normal', |
| 48 | 'memory.level.warning': 'high', | 56 | 'memory.level.warning': 'high', |
| @@ -114,6 +122,7 @@ export const en = { | |||
| 114 | 'system.no-recipient': 'Nobody was addressed: mention an agent with @ (for example @{example}).', | 122 | 'system.no-recipient': 'Nobody was addressed: mention an agent with @ (for example @{example}).', |
| 115 | 'system.agent-unavailable': '{agent} could not answer.', | 123 | 'system.agent-unavailable': '{agent} could not answer.', |
| 116 | 'system.attachment-unavailable': 'A file was not sent to {agent}.', | 124 | 'system.attachment-unavailable': 'A file was not sent to {agent}.', |
| 125 | + 'system.handoff-limit': '{agent} mentioned another agent, but this message was already handed from agent to agent as often as allowed (limits.maxAgentHandoffs): the chain stops here. Mention the agent yourself to go on.', | ||
| 117 | 126 | ||
| 118 | // tool calls | 127 | // tool calls |
| 119 | 'tool.status.pending': 'waiting', | 128 | 'tool.status.pending': 'waiting', |
| @@ -153,6 +162,7 @@ export const en = { | |||
| 153 | 'error.containerMissing': 'The container "{box}" does not exist. Create and start it (docker run …), or correct its name in the agent\'s settings.', | 162 | 'error.containerMissing': 'The container "{box}" does not exist. Create and start it (docker run …), or correct its name in the agent\'s settings.', |
| 154 | 'error.containerStopped': 'The container "{box}" is stopped. Start it with: docker start {box}', | 163 | 'error.containerStopped': 'The container "{box}" is stopped. Start it with: docker start {box}', |
| 155 | 'error.sandboxMissing': 'The sbx sandbox "{box}" does not exist. Create it, or correct its name in the agent\'s settings.', | 164 | 'error.sandboxMissing': 'The sbx sandbox "{box}" does not exist. Create it, or correct its name in the agent\'s settings.', |
| 165 | + 'error.agentFileMissing': 'The agent was started without its file: Docker Agent needs the path of its agent file after serve acp. Add it to the agent\'s arguments in Settings.', | ||
| 156 | 'error.limitReached': 'Already {limit} agents are working, the most allowed at once. Wait for one to finish, or stop one in the Agents panel.', | 166 | 'error.limitReached': 'Already {limit} agents are working, the most allowed at once. Wait for one to finish, or stop one in the Agents panel.', |
| 157 | 'error.modelServer': 'The agent cannot reach its model server. Check that it is running (llmman, Ollama…), then try again.', | 167 | 'error.modelServer': 'The agent cannot reach its model server. Check that it is running (llmman, Ollama…), then try again.', |
| 158 | 'error.protocol': 'This agent speaks a version of ACP that Sidekicks does not know. Update the agent or Sidekicks.', | 168 | 'error.protocol': 'This agent speaks a version of ACP that Sidekicks does not know. Update the agent or Sidekicks.', |
| @@ -161,6 +171,9 @@ export const en = { | |||
| 161 | 'error.unknownAgent': 'The agent "{agent}" is no longer in the configuration.', | 171 | 'error.unknownAgent': 'The agent "{agent}" is no longer in the configuration.', |
| 162 | 'error.newerHistory': 'The history was written by a newer Sidekicks. Update Sidekicks to read it.', | 172 | 'error.newerHistory': 'The history was written by a newer Sidekicks. Update Sidekicks to read it.', |
| 163 | 'error.channelBusy': 'An agent is answering here: stop it (■) or wait for the end of its answer, then clear the history.', | 173 | 'error.channelBusy': 'An agent is answering here: stop it (■) or wait for the end of its answer, then clear the history.', |
| 174 | + 'error.agentAnswering': 'The agent is answering: wait for the end of its answer, then unload its model.', | ||
| 175 | + 'error.notRunning': 'The agent is not running: its model is not loaded by it.', | ||
| 176 | + 'error.cannotUnload': 'This agent cannot unload its model: it offers no /unload command.', | ||
| 164 | 'code.copy': 'Copy', | 177 | 'code.copy': 'Copy', |
| 165 | 'code.copied': 'Copied ✓', | 178 | 'code.copied': 'Copied ✓', |
| 166 | 'message.copy': 'Copy the answer', | 179 | 'message.copy': 'Copy the answer', |
| @@ -221,6 +234,7 @@ export const en = { | |||
| 221 | 'linked.label': 'The file {file}', | 234 | 'linked.label': 'The file {file}', |
| 222 | 'linked.close': 'Close (Esc)', | 235 | 'linked.close': 'Close (Esc)', |
| 223 | 'linked.reveal': 'Show where it is', | 236 | 'linked.reveal': 'Show where it is', |
| 237 | + 'workspace.revealEntry': 'Show where {name} is', | ||
| 224 | 'linked.openInFiles': "Open in the agent's files", | 238 | 'linked.openInFiles': "Open in the agent's files", |
| 225 | 'linked.reload': 'Read the file again', | 239 | 'linked.reload': 'Read the file again', |
| 226 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', | 240 | 'linked.resize': 'Drag to resize the panel (or ← → once selected)', |
| @@ -244,6 +258,25 @@ export const en = { | |||
| 244 | 'workspace.noChannel': 'in no channel', | 258 | 'workspace.noChannel': 'in no channel', |
| 245 | 'workspace.showHidden': 'Show hidden files', | 259 | 'workspace.showHidden': 'Show hidden files', |
| 246 | 'workspace.newFile': '+ New file', | 260 | 'workspace.newFile': '+ New file', |
| 261 | + 'workspace.newFolder': '+ New folder', | ||
| 262 | + 'workspace.newFolderIn': 'New folder in {folder}', | ||
| 263 | + 'workspace.folderName': 'Folder name', | ||
| 264 | + 'workspace.tree': 'Files of the agent', | ||
| 265 | + 'workspace.renameEntry': 'Rename {name}', | ||
| 266 | + 'workspace.selected': '{count} selected — ⌘/Ctrl-click or ⇧-click to change the selection', | ||
| 267 | + 'workspace.deleteManyConfirm': 'Delete these {count} items? They go to the trash.', | ||
| 268 | + 'workspace.deleteManyForGood': 'Delete these {count} items for good? There is no trash in a container or a sandbox.', | ||
| 269 | + 'workspace.moveOne': 'Move {name} to the folder', | ||
| 270 | + 'workspace.moveMany': 'Move these {count} items to the folder', | ||
| 271 | + 'workspace.moveTarget': 'Folder (empty: the top)', | ||
| 272 | + 'workspace.move': 'Move', | ||
| 273 | + 'workspace.menu.open': 'Open', | ||
| 274 | + 'workspace.menu.rename': 'Rename… (F2)', | ||
| 275 | + 'workspace.menu.move': 'Move to…', | ||
| 276 | + 'workspace.menu.moveMany': 'Move {count} items to…', | ||
| 277 | + 'workspace.menu.deleteMany': 'Delete {count} items', | ||
| 278 | + 'workspace.menu.duplicate': 'Duplicate (⌘D)', | ||
| 279 | + 'workspace.menu.duplicateMany': 'Duplicate {count} items (⌘D)', | ||
| 247 | 'workspace.newFileIn': 'New file in {folder}', | 280 | 'workspace.newFileIn': 'New file in {folder}', |
| 248 | 'workspace.fileName': 'File name', | 281 | 'workspace.fileName': 'File name', |
| 249 | 'workspace.create': 'Create', | 282 | 'workspace.create': 'Create', |
| @@ -266,6 +299,13 @@ export const en = { | |||
| 266 | 'terminal.ended': 'The shell has ended.', | 299 | 'terminal.ended': 'The shell has ended.', |
| 267 | 'terminal.restart': 'Open a new shell', | 300 | 'terminal.restart': 'Open a new shell', |
| 268 | 'terminal.error': 'Cannot open a terminal.', | 301 | 'terminal.error': 'Cannot open a terminal.', |
| 302 | + 'terminal.list': 'Terminals of the agent', | ||
| 303 | + 'terminal.name': 'Terminal {number}', | ||
| 304 | + 'terminal.new': 'Open another terminal', | ||
| 305 | + 'terminal.close': 'Close {name}: ends its shell and what it runs', | ||
| 306 | + 'terminal.limit': 'At most {count} terminals per agent', | ||
| 307 | + 'terminal.none': 'No terminal open. Click + to open one.', | ||
| 308 | + 'terminal.running': '{count} terminal(s) running, even while you look elsewhere', | ||
| 269 | 309 | ||
| 270 | // welcome and the "add an agent" assistant | 310 | // welcome and the "add an agent" assistant |
| 271 | 'welcome.title': 'Welcome to Sidekicks', | 311 | 'welcome.title': 'Welcome to Sidekicks', |
| @@ -319,6 +359,11 @@ export const en = { | |||
| 319 | 'assistant.program': 'Program', | 359 | 'assistant.program': 'Program', |
| 320 | 'assistant.programPlaceholder': 'mm', | 360 | 'assistant.programPlaceholder': 'mm', |
| 321 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', | 361 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', |
| 362 | + 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp, codex-acp, gemini (arguments --acp): Claude, Codex or Gemini, with the sbxenv.yaml of its sandbox dropped above.', | ||
| 363 | + 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".', | ||
| 364 | + 'assistant.sandboxMismatch': '{file} describes a sandbox for the sbx agent "{agent}", not "{wanted}": this program would not be found there. Choose the sbxenv.yaml of the right sandbox above.', | ||
| 365 | + 'assistant.codexNote': 'Codex runs from the docker.io/sbx/codex-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Sign in to ChatGPT or store your OpenAI API key in sbx before starting it: see the guide "Add a Codex agent in an sbx sandbox".', | ||
| 366 | + 'assistant.geminiNote': 'Gemini runs from the docker.io/sbx/gemini-kit kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Gemini API key in sbx before starting it: see the guide "Add a Gemini agent in an sbx sandbox".', | ||
| 322 | 'assistant.arguments': 'Arguments', | 367 | 'assistant.arguments': 'Arguments', |
| 323 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', | 368 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 324 | 'assistant.workspace': 'Agent\'s folder', | 369 | 'assistant.workspace': 'Agent\'s folder', |
| @@ -332,6 +377,7 @@ export const en = { | |||
| 332 | 'assistant.missing.program': 'Say which program starts the agent.', | 377 | 'assistant.missing.program': 'Say which program starts the agent.', |
| 333 | 'assistant.missing.workspace': 'Choose the agent\'s folder.', | 378 | 'assistant.missing.workspace': 'Choose the agent\'s folder.', |
| 334 | 'assistant.missing.box': 'Give the name of the container or sandbox.', | 379 | 'assistant.missing.box': 'Give the name of the container or sandbox.', |
| 380 | + 'assistant.missing.agentFile': 'Docker Agent needs its agent file after serve acp: drop it on the agent\'s configuration file area above, or type its path.', | ||
| 335 | 'assistant.refused': 'The agent was not added:', | 381 | 'assistant.refused': 'The agent was not added:', |
| 336 | 'assistant.agentConfig.title': 'The agent\'s configuration file (optional)', | 382 | 'assistant.agentConfig.title': 'The agent\'s configuration file (optional)', |
| 337 | 'assistant.agentConfig.intro': 'Give the YAML file that configures the agent: its folder becomes the agent\'s folder, and the arguments of mm, docker-agent or docker agent are filled in.', | 383 | 'assistant.agentConfig.intro': 'Give the YAML file that configures the agent: its folder becomes the agent\'s folder, and the arguments of mm, docker-agent or docker agent are filled in.', |
| @@ -398,6 +444,14 @@ export const fr: Record<MessageKey, string> = { | |||
| 398 | 444 | ||
| 399 | 'logs.of': 'Journal de', | 445 | 'logs.of': 'Journal de', |
| 400 | 'logs.empty': "Rien pour l'instant : le journal se remplit quand l'agent démarre.", | 446 | 'logs.empty': "Rien pour l'instant : le journal se remplit quand l'agent démarre.", |
| 447 | + 'unload.one': '⏏ Décharger le modèle', | ||
| 448 | + 'unload.oneHelp': "Libère la mémoire prise par le modèle de {agent}, sans l'arrêter : le modèle est rechargé à son prochain message.", | ||
| 449 | + 'unload.agent': 'Décharger le modèle de {agent}', | ||
| 450 | + 'unload.all': '⏏ Tout décharger', | ||
| 451 | + 'unload.allHelp': 'Libère la mémoire des modèles de tous les agents qui tournent et savent le faire.', | ||
| 452 | + 'unload.done': 'Modèle déchargé : {agents}.', | ||
| 453 | + 'unload.skipped': 'Laissés de côté (en train de répondre ou sans /unload) : {agents}.', | ||
| 454 | + 'unload.none': 'Aucun agent en marche à décharger.', | ||
| 401 | 'memory.pressure': 'Pression mémoire :', | 455 | 'memory.pressure': 'Pression mémoire :', |
| 402 | 'memory.level.normal': 'normale', | 456 | 'memory.level.normal': 'normale', |
| 403 | 'memory.level.warning': 'élevée', | 457 | 'memory.level.warning': 'élevée', |
| @@ -465,6 +519,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 465 | 'system.no-recipient': "Personne n'est désigné : mentionnez un agent avec @ (par exemple @{example}).", | 519 | 'system.no-recipient': "Personne n'est désigné : mentionnez un agent avec @ (par exemple @{example}).", |
| 466 | 'system.agent-unavailable': "{agent} n'a pas pu répondre.", | 520 | 'system.agent-unavailable': "{agent} n'a pas pu répondre.", |
| 467 | 'system.attachment-unavailable': "Un fichier n'a pas été envoyé à {agent}.", | 521 | 'system.attachment-unavailable': "Un fichier n'a pas été envoyé à {agent}.", |
| 522 | + 'system.handoff-limit': "{agent} a mentionné un autre agent, mais ce message est déjà passé d'agent en agent autant de fois que permis (limits.maxAgentHandoffs) : la chaîne s'arrête ici. Mentionnez vous-même l'agent pour continuer.", | ||
| 468 | 523 | ||
| 469 | 'tool.status.pending': 'en attente', | 524 | 'tool.status.pending': 'en attente', |
| 470 | 'tool.status.in_progress': 'en cours', | 525 | 'tool.status.in_progress': 'en cours', |
| @@ -501,6 +556,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 501 | 'error.containerMissing': "Le conteneur « {box} » n'existe pas. Créez-le et démarrez-le (docker run …), ou corrigez son nom dans les réglages de l'agent.", | 556 | 'error.containerMissing': "Le conteneur « {box} » n'existe pas. Créez-le et démarrez-le (docker run …), ou corrigez son nom dans les réglages de l'agent.", |
| 502 | 'error.containerStopped': 'Le conteneur « {box} » est arrêté. Démarrez-le avec : docker start {box}', | 557 | 'error.containerStopped': 'Le conteneur « {box} » est arrêté. Démarrez-le avec : docker start {box}', |
| 503 | 'error.sandboxMissing': "La sandbox sbx « {box} » n'existe pas. Créez-la, ou corrigez son nom dans les réglages de l'agent.", | 558 | 'error.sandboxMissing': "La sandbox sbx « {box} » n'existe pas. Créez-la, ou corrigez son nom dans les réglages de l'agent.", |
| 559 | + 'error.agentFileMissing': "L'agent a été démarré sans son fichier : Docker Agent a besoin du chemin de son fichier d'agent après serve acp. Ajoutez-le aux arguments de l'agent dans Settings.", | ||
| 504 | 'error.limitReached': "Déjà {limit} agents travaillent, le maximum autorisé en même temps. Attendez qu'un agent ait fini, ou arrêtez-en un dans le panneau Agents.", | 560 | 'error.limitReached': "Déjà {limit} agents travaillent, le maximum autorisé en même temps. Attendez qu'un agent ait fini, ou arrêtez-en un dans le panneau Agents.", |
| 505 | 'error.modelServer': "L'agent n'arrive pas à joindre son serveur de modèles. Vérifiez qu'il tourne (llmman, Ollama…), puis réessayez.", | 561 | 'error.modelServer': "L'agent n'arrive pas à joindre son serveur de modèles. Vérifiez qu'il tourne (llmman, Ollama…), puis réessayez.", |
| 506 | 'error.protocol': "Cet agent parle une version d'ACP que Sidekicks ne connaît pas. Mettez à jour l'agent ou Sidekicks.", | 562 | 'error.protocol': "Cet agent parle une version d'ACP que Sidekicks ne connaît pas. Mettez à jour l'agent ou Sidekicks.", |
| @@ -509,6 +565,9 @@ export const fr: Record<MessageKey, string> = { | |||
| 509 | 'error.unknownAgent': "L'agent « {agent} » n'est plus dans la configuration.", | 565 | 'error.unknownAgent': "L'agent « {agent} » n'est plus dans la configuration.", |
| 510 | 'error.newerHistory': "L'historique a été écrit par un Sidekicks plus récent. Mettez Sidekicks à jour pour le lire.", | 566 | 'error.newerHistory': "L'historique a été écrit par un Sidekicks plus récent. Mettez Sidekicks à jour pour le lire.", |
| 511 | 'error.channelBusy': "Un agent répond ici : arrêtez-le (■) ou attendez la fin de sa réponse, puis videz l'historique.", | 567 | 'error.channelBusy': "Un agent répond ici : arrêtez-le (■) ou attendez la fin de sa réponse, puis videz l'historique.", |
| 568 | + 'error.agentAnswering': "L'agent est en train de répondre : attendez la fin de sa réponse, puis déchargez son modèle.", | ||
| 569 | + 'error.notRunning': "L'agent ne tourne pas : il n'a pas de modèle chargé.", | ||
| 570 | + 'error.cannotUnload': 'Cet agent ne sait pas décharger son modèle : il ne propose pas de commande /unload.', | ||
| 512 | 'code.copy': 'Copier', | 571 | 'code.copy': 'Copier', |
| 513 | 'code.copied': 'Copié ✓', | 572 | 'code.copied': 'Copié ✓', |
| 514 | 'message.copy': 'Copier la réponse', | 573 | 'message.copy': 'Copier la réponse', |
| @@ -568,6 +627,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 568 | 'linked.label': 'Le fichier {file}', | 627 | 'linked.label': 'Le fichier {file}', |
| 569 | 'linked.close': 'Fermer (Échap)', | 628 | 'linked.close': 'Fermer (Échap)', |
| 570 | 'linked.reveal': "Afficher l'emplacement", | 629 | 'linked.reveal': "Afficher l'emplacement", |
| 630 | + 'workspace.revealEntry': "Afficher l'emplacement de {name}", | ||
| 571 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", | 631 | 'linked.openInFiles': "Ouvrir dans les fichiers de l'agent", |
| 572 | 'linked.reload': 'Relire le fichier', | 632 | 'linked.reload': 'Relire le fichier', |
| 573 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', | 633 | 'linked.resize': 'Faites glisser pour redimensionner le panneau (ou ← → une fois sélectionné)', |
| @@ -591,6 +651,25 @@ export const fr: Record<MessageKey, string> = { | |||
| 591 | 'workspace.noChannel': 'dans aucun channel', | 651 | 'workspace.noChannel': 'dans aucun channel', |
| 592 | 'workspace.showHidden': 'Afficher les fichiers cachés', | 652 | 'workspace.showHidden': 'Afficher les fichiers cachés', |
| 593 | 'workspace.newFile': '+ Nouveau fichier', | 653 | 'workspace.newFile': '+ Nouveau fichier', |
| 654 | + 'workspace.newFolder': '+ Nouveau dossier', | ||
| 655 | + 'workspace.newFolderIn': 'Nouveau dossier dans {folder}', | ||
| 656 | + 'workspace.folderName': 'Nom du dossier', | ||
| 657 | + 'workspace.tree': "Fichiers de l'agent", | ||
| 658 | + 'workspace.renameEntry': 'Renommer {name}', | ||
| 659 | + 'workspace.selected': '{count} sélectionnés — ⌘/Ctrl-clic ou ⇧-clic pour changer la sélection', | ||
| 660 | + 'workspace.deleteManyConfirm': 'Supprimer ces {count} éléments ? Ils partent à la corbeille.', | ||
| 661 | + 'workspace.deleteManyForGood': "Supprimer définitivement ces {count} éléments ? Il n'y a pas de corbeille dans un conteneur ou une sandbox.", | ||
| 662 | + 'workspace.moveOne': 'Déplacer {name} dans le dossier', | ||
| 663 | + 'workspace.moveMany': 'Déplacer ces {count} éléments dans le dossier', | ||
| 664 | + 'workspace.moveTarget': 'Dossier (vide : la racine)', | ||
| 665 | + 'workspace.move': 'Déplacer', | ||
| 666 | + 'workspace.menu.open': 'Ouvrir', | ||
| 667 | + 'workspace.menu.rename': 'Renommer… (F2)', | ||
| 668 | + 'workspace.menu.move': 'Déplacer vers…', | ||
| 669 | + 'workspace.menu.moveMany': 'Déplacer {count} éléments vers…', | ||
| 670 | + 'workspace.menu.deleteMany': 'Supprimer {count} éléments', | ||
| 671 | + 'workspace.menu.duplicate': 'Dupliquer (⌘D)', | ||
| 672 | + 'workspace.menu.duplicateMany': 'Dupliquer {count} éléments (⌘D)', | ||
| 594 | 'workspace.newFileIn': 'Nouveau fichier dans {folder}', | 673 | 'workspace.newFileIn': 'Nouveau fichier dans {folder}', |
| 595 | 'workspace.fileName': 'Nom du fichier', | 674 | 'workspace.fileName': 'Nom du fichier', |
| 596 | 'workspace.create': 'Créer', | 675 | 'workspace.create': 'Créer', |
| @@ -613,6 +692,13 @@ export const fr: Record<MessageKey, string> = { | |||
| 613 | 'terminal.ended': 'Le shell est terminé.', | 692 | 'terminal.ended': 'Le shell est terminé.', |
| 614 | 'terminal.restart': 'Ouvrir un nouveau shell', | 693 | 'terminal.restart': 'Ouvrir un nouveau shell', |
| 615 | 'terminal.error': "Impossible d'ouvrir un terminal.", | 694 | 'terminal.error': "Impossible d'ouvrir un terminal.", |
| 695 | + 'terminal.list': "Terminaux de l'agent", | ||
| 696 | + 'terminal.name': 'Terminal {number}', | ||
| 697 | + 'terminal.new': 'Ouvrir un autre terminal', | ||
| 698 | + 'terminal.close': 'Fermer {name} : arrête son shell et ce qui y tourne', | ||
| 699 | + 'terminal.limit': 'Au plus {count} terminaux par agent', | ||
| 700 | + 'terminal.none': 'Aucun terminal ouvert. Cliquez sur + pour en ouvrir un.', | ||
| 701 | + 'terminal.running': '{count} terminal(aux) en cours, même quand vous regardez ailleurs', | ||
| 616 | 702 | ||
| 617 | 'welcome.title': 'Bienvenue dans Sidekicks', | 703 | 'welcome.title': 'Bienvenue dans Sidekicks', |
| 618 | 'welcome.tagline': "Discutez avec des agents d'IA dans des channels, comme avec des collègues.", | 704 | 'welcome.tagline': "Discutez avec des agents d'IA dans des channels, comme avec des collègues.", |
| @@ -665,6 +751,11 @@ export const fr: Record<MessageKey, string> = { | |||
| 665 | 'assistant.program': 'Programme', | 751 | 'assistant.program': 'Programme', |
| 666 | 'assistant.programPlaceholder': 'mm', | 752 | 'assistant.programPlaceholder': 'mm', |
| 667 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", | 753 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", |
| 754 | + 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp, codex-acp, gemini (arguments --acp) : Claude, Codex ou Gemini, avec le sbxenv.yaml de sa sandbox déposé plus haut.", | ||
| 755 | + 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", | ||
| 756 | + 'assistant.sandboxMismatch': "{file} décrit une sandbox pour l'agent sbx « {agent} », pas « {wanted} » : ce programme n'y serait pas trouvé. Choisissez plus haut le sbxenv.yaml de la bonne sandbox.", | ||
| 757 | + 'assistant.codexNote': "Codex tourne grâce au kit docker.io/sbx/codex-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Connectez-vous à ChatGPT ou enregistrez votre clé d'API OpenAI dans sbx avant de le démarrer : voir le guide « Ajouter un agent Codex dans une sandbox sbx ».", | ||
| 758 | + 'assistant.geminiNote': "Gemini tourne grâce au kit docker.io/sbx/gemini-kit nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Gemini dans sbx avant de le démarrer : voir le guide « Ajouter un agent Gemini dans une sandbox sbx ».", | ||
| 668 | 'assistant.arguments': 'Arguments', | 759 | 'assistant.arguments': 'Arguments', |
| 669 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', | 760 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 670 | 'assistant.workspace': "Dossier de l'agent", | 761 | 'assistant.workspace': "Dossier de l'agent", |
| @@ -678,6 +769,7 @@ export const fr: Record<MessageKey, string> = { | |||
| 678 | 'assistant.missing.program': "Indiquez le programme qui démarre l'agent.", | 769 | 'assistant.missing.program': "Indiquez le programme qui démarre l'agent.", |
| 679 | 'assistant.missing.workspace': "Choisissez le dossier de l'agent.", | 770 | 'assistant.missing.workspace': "Choisissez le dossier de l'agent.", |
| 680 | 'assistant.missing.box': 'Donnez le nom du conteneur ou de la sandbox.', | 771 | 'assistant.missing.box': 'Donnez le nom du conteneur ou de la sandbox.', |
| 772 | + 'assistant.missing.agentFile': "Docker Agent a besoin de son fichier d'agent après serve acp : déposez-le plus haut sur la zone du fichier de configuration de l'agent, ou tapez son chemin.", | ||
| 681 | 'assistant.refused': "L'agent n'a pas été ajouté :", | 773 | 'assistant.refused': "L'agent n'a pas été ajouté :", |
| 682 | 'assistant.agentConfig.title': "Le fichier de configuration de l'agent (facultatif)", | 774 | 'assistant.agentConfig.title': "Le fichier de configuration de l'agent (facultatif)", |
| 683 | 'assistant.agentConfig.intro': "Indiquez le fichier YAML qui configure l'agent : son dossier devient celui de l'agent, et les arguments de mm, docker-agent ou docker agent sont remplis.", | 775 | 'assistant.agentConfig.intro': "Indiquez le fichier YAML qui configure l'agent : son dossier devient celui de l'agent, et les arguments de mm, docker-agent ou docker agent sont remplis.", |
modified
frontend/src/lib/panels/AgentsPanel.svelte +16 -2 | @@ -1,12 +1,14 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | + import { runningTerminals } from '../terminalSessions.svelte' | |
| 3 | 4 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' |
| 4 | 5 | import ActionError from '../chat/ActionError.svelte' |
| 5 | 6 | import ErrorText from '../chat/ErrorText.svelte' |
| 6 | 7 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 7 | 8 | import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | - import { act, appState, channelOf, openAssistant, openDirect, openWorkspace } from '../state.svelte' | |
| 9 | + import { act, appState, channelOf, loadCommands, openAssistant, openDirect, openWorkspace } from '../state.svelte' | |
| 9 | 10 | import { directOf } from '../conversation' |
| 11 | + import { canUnload, unloadReady } from '../unload' | |
| 10 | 12 | |
| 11 | 13 | // The agent of the direct conversation shown, to highlight it. |
| 12 | 14 | const directAgent = $derived(channelOf(appState.selectedChannel)?.direct ?? '') |
| @@ -17,6 +19,11 @@ | ||
| 17 | 19 | const direct = directOf(appState.channels, agent) |
| 18 | 20 | return direct ? appState.unread[direct.id] ?? 0 : 0 |
| 19 | 21 | } |
| 22 | + | |
| 23 | + // Issue #51: the agents that announced /unload get a ⏏ button. | |
| 24 | + $effect(() => { | |
| 25 | + for (const agent of appState.agents) void loadCommands(agent.name) | |
| 26 | + }) | |
| 20 | 27 | </script> |
| 21 | 28 | |
| 22 | 29 | {#if appState.agents.length === 0} |
| @@ -30,12 +37,18 @@ | ||
| 30 | 37 | {#if unreadOf(agent.name)} |
| 31 | 38 | <span class="badge" title={t('channels.unread', { count: unreadOf(agent.name) })}>{unreadOf(agent.name)}</span> |
| 32 | 39 | {/if} |
| 40 | + {#if runningTerminals(agent.name)} | |
| 41 | + <span class="terminals" title={t('terminal.running', { count: runningTerminals(agent.name) })} aria-label={t('terminal.running', { count: runningTerminals(agent.name) })}>⌨ {runningTerminals(agent.name)}</span> | |
| 42 | + {/if} | |
| 33 | 43 | <span class="state">{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{agent.outdated ? t('agent.outdated') : ''}</span> |
| 34 | 44 | <span class="actions"> |
| 35 | 45 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> |
| 36 | 46 | {#if agent.state === 'stopped' || agent.state === 'error'} |
| 37 | 47 | <button onclick={() => act(() => AgentService.Start(agent.name))} aria-label={t('agent.start', { agent: agent.title })}>▶</button> |
| 38 | 48 | {:else} |
| 49 | + {#if canUnload(appState.commands[agent.name])} | |
| 50 | + <button disabled={!unloadReady(agent.state)} onclick={() => act(() => AgentService.Unload(agent.name))} aria-label={t('unload.agent', { agent: agent.title })} title={t('unload.oneHelp', { agent: agent.title })}>⏏</button> | |
| 51 | + {/if} | |
| 39 | 52 | <button onclick={() => act(() => AgentService.Restart(agent.name))} aria-label={t('agent.restart', { agent: agent.title })}>↻</button> |
| 40 | 53 | <button onclick={() => act(() => AgentService.Stop(agent.name))} aria-label={t('agent.stop', { agent: agent.title })}>■</button> |
| 41 | 54 | {/if} |
| @@ -67,7 +80,8 @@ | ||
| 67 | 80 | .state { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12px; } |
| 68 | 81 | .actions { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 4px; opacity: 0; } |
| 69 | 82 | li:hover .actions, li:focus-within .actions { opacity: 1; } |
| 70 | - li:hover .badge, li:focus-within .badge { visibility: hidden; } | |
| 83 | + .terminals { grid-column: 3; grid-row: 2; justify-self: end; font-size: 11px; color: var(--muted); } | |
| 84 | + li:hover .badge, li:focus-within .badge, li:hover .terminals, li:focus-within .terminals { visibility: hidden; } | |
| 71 | 85 | .actions button { padding: 1px 7px; font-size: 11px; } |
| 72 | 86 | .failure { grid-column: 2 / span 2; grid-row: 3; margin: 2px 0 0; color: var(--danger); font-size: 12px; white-space: pre-wrap; } |
| 73 | 87 | .empty { color: var(--muted); padding: 0 8px; } |
| @@ -1,12 +1,14 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | + import { runningTerminals } from '../terminalSessions.svelte' | ||
| 3 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' | 4 | import { hasMessage, t, type MessageKey } from '../i18n/index.svelte' |
| 4 | import ActionError from '../chat/ActionError.svelte' | 5 | import ActionError from '../chat/ActionError.svelte' |
| 5 | import ErrorText from '../chat/ErrorText.svelte' | 6 | import ErrorText from '../chat/ErrorText.svelte' |
| 6 | import AgentAvatar from '../agent/AgentAvatar.svelte' | 7 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 7 | import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 8 | import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | - import { act, appState, channelOf, openAssistant, openDirect, openWorkspace } from '../state.svelte' | 9 | + import { act, appState, channelOf, loadCommands, openAssistant, openDirect, openWorkspace } from '../state.svelte' |
| 9 | import { directOf } from '../conversation' | 10 | import { directOf } from '../conversation' |
| 11 | + import { canUnload, unloadReady } from '../unload' | ||
| 10 | 12 | ||
| 11 | // The agent of the direct conversation shown, to highlight it. | 13 | // The agent of the direct conversation shown, to highlight it. |
| 12 | const directAgent = $derived(channelOf(appState.selectedChannel)?.direct ?? '') | 14 | const directAgent = $derived(channelOf(appState.selectedChannel)?.direct ?? '') |
| @@ -17,6 +19,11 @@ | |||
| 17 | const direct = directOf(appState.channels, agent) | 19 | const direct = directOf(appState.channels, agent) |
| 18 | return direct ? appState.unread[direct.id] ?? 0 : 0 | 20 | return direct ? appState.unread[direct.id] ?? 0 : 0 |
| 19 | } | 21 | } |
| 22 | + | ||
| 23 | + // Issue #51: the agents that announced /unload get a ⏏ button. | ||
| 24 | + $effect(() => { | ||
| 25 | + for (const agent of appState.agents) void loadCommands(agent.name) | ||
| 26 | + }) | ||
| 20 | </script> | 27 | </script> |
| 21 | 28 | ||
| 22 | {#if appState.agents.length === 0} | 29 | {#if appState.agents.length === 0} |
| @@ -30,12 +37,18 @@ | |||
| 30 | {#if unreadOf(agent.name)} | 37 | {#if unreadOf(agent.name)} |
| 31 | <span class="badge" title={t('channels.unread', { count: unreadOf(agent.name) })}>{unreadOf(agent.name)}</span> | 38 | <span class="badge" title={t('channels.unread', { count: unreadOf(agent.name) })}>{unreadOf(agent.name)}</span> |
| 32 | {/if} | 39 | {/if} |
| 40 | + {#if runningTerminals(agent.name)} | ||
| 41 | + <span class="terminals" title={t('terminal.running', { count: runningTerminals(agent.name) })} aria-label={t('terminal.running', { count: runningTerminals(agent.name) })}>⌨ {runningTerminals(agent.name)}</span> | ||
| 42 | + {/if} | ||
| 33 | <span class="state">{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{agent.outdated ? t('agent.outdated') : ''}</span> | 43 | <span class="state">{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{agent.outdated ? t('agent.outdated') : ''}</span> |
| 34 | <span class="actions"> | 44 | <span class="actions"> |
| 35 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> | 45 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> |
| 36 | {#if agent.state === 'stopped' || agent.state === 'error'} | 46 | {#if agent.state === 'stopped' || agent.state === 'error'} |
| 37 | <button onclick={() => act(() => AgentService.Start(agent.name))} aria-label={t('agent.start', { agent: agent.title })}>▶</button> | 47 | <button onclick={() => act(() => AgentService.Start(agent.name))} aria-label={t('agent.start', { agent: agent.title })}>▶</button> |
| 38 | {:else} | 48 | {:else} |
| 49 | + {#if canUnload(appState.commands[agent.name])} | ||
| 50 | + <button disabled={!unloadReady(agent.state)} onclick={() => act(() => AgentService.Unload(agent.name))} aria-label={t('unload.agent', { agent: agent.title })} title={t('unload.oneHelp', { agent: agent.title })}>⏏</button> | ||
| 51 | + {/if} | ||
| 39 | <button onclick={() => act(() => AgentService.Restart(agent.name))} aria-label={t('agent.restart', { agent: agent.title })}>↻</button> | 52 | <button onclick={() => act(() => AgentService.Restart(agent.name))} aria-label={t('agent.restart', { agent: agent.title })}>↻</button> |
| 40 | <button onclick={() => act(() => AgentService.Stop(agent.name))} aria-label={t('agent.stop', { agent: agent.title })}>■</button> | 53 | <button onclick={() => act(() => AgentService.Stop(agent.name))} aria-label={t('agent.stop', { agent: agent.title })}>■</button> |
| 41 | {/if} | 54 | {/if} |
| @@ -67,7 +80,8 @@ | |||
| 67 | .state { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12px; } | 80 | .state { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 12px; } |
| 68 | .actions { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 4px; opacity: 0; } | 81 | .actions { grid-column: 3; grid-row: 1 / span 2; display: flex; gap: 4px; opacity: 0; } |
| 69 | li:hover .actions, li:focus-within .actions { opacity: 1; } | 82 | li:hover .actions, li:focus-within .actions { opacity: 1; } |
| 70 | - li:hover .badge, li:focus-within .badge { visibility: hidden; } | 83 | + .terminals { grid-column: 3; grid-row: 2; justify-self: end; font-size: 11px; color: var(--muted); } |
| 84 | + li:hover .badge, li:focus-within .badge, li:hover .terminals, li:focus-within .terminals { visibility: hidden; } | ||
| 71 | .actions button { padding: 1px 7px; font-size: 11px; } | 85 | .actions button { padding: 1px 7px; font-size: 11px; } |
| 72 | .failure { grid-column: 2 / span 2; grid-row: 3; margin: 2px 0 0; color: var(--danger); font-size: 12px; white-space: pre-wrap; } | 86 | .failure { grid-column: 2 / span 2; grid-row: 3; margin: 2px 0 0; color: var(--danger); font-size: 12px; white-space: pre-wrap; } |
| 73 | .empty { color: var(--muted); padding: 0 8px; } | 87 | .empty { color: var(--muted); padding: 0 8px; } |
modified
frontend/src/lib/panels/LogsPanel.svelte +64 -4 | @@ -1,12 +1,57 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | 3 | import { t } from '../i18n/index.svelte' |
| 4 | - import { appState } from '../state.svelte' | |
| 4 | + import { appState, loadCommands } from '../state.svelte' | |
| 5 | + import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 5 | 6 | import AgentLog from '../agent/AgentLog.svelte' |
| 7 | + import ErrorText from '../chat/ErrorText.svelte' | |
| 6 | 8 | import MemoryPressure from './MemoryPressure.svelte' |
| 9 | + import { canUnload, unloadReady, unloadSummary, type UnloadLine } from '../unload' | |
| 7 | 10 | |
| 8 | 11 | let selected = $state('') |
| 9 | 12 | const agentName = $derived(selected || appState.agents[0]?.name || '') |
| 13 | + const agent = $derived(appState.agents.find((candidate) => candidate.name === agentName)) | |
| 14 | + | |
| 15 | + // Issue #51: next to the memory pressure, unload the model of the agent | |
| 16 | + // shown, or of every running agent that can. | |
| 17 | + let unloading = $state(false) | |
| 18 | + let notice = $state<UnloadLine[]>([]) | |
| 19 | + let problem = $state('') | |
| 20 | + const anyRunning = $derived(appState.agents.some((candidate) => unloadReady(candidate.state) || candidate.state === 'busy')) | |
| 21 | + | |
| 22 | + $effect(() => { | |
| 23 | + for (const each of appState.agents) void loadCommands(each.name) | |
| 24 | + }) | |
| 25 | + | |
| 26 | + async function unload(action: () => Promise<void>) { | |
| 27 | + unloading = true | |
| 28 | + notice = [] | |
| 29 | + problem = '' | |
| 30 | + try { | |
| 31 | + await action() | |
| 32 | + } catch (error) { | |
| 33 | + problem = error instanceof Error ? error.message : String(error) | |
| 34 | + } finally { | |
| 35 | + unloading = false | |
| 36 | + } | |
| 37 | + } | |
| 38 | + | |
| 39 | + function titleOf(name: string): string { | |
| 40 | + return appState.agents.find((candidate) => candidate.name === name)?.title ?? name | |
| 41 | + } | |
| 42 | + | |
| 43 | + const unloadOne = () => | |
| 44 | + unload(async () => { | |
| 45 | + const name = agentName | |
| 46 | + await AgentService.Unload(name) | |
| 47 | + notice = [{ key: 'unload.done', vars: { agents: titleOf(name) } }] | |
| 48 | + }) | |
| 49 | + | |
| 50 | + const unloadAll = () => | |
| 51 | + unload(async () => { | |
| 52 | + const result = await AgentService.UnloadAll() | |
| 53 | + notice = unloadSummary(result ?? { unloaded: [], skipped: [] }, titleOf) | |
| 54 | + }) | |
| 10 | 55 | </script> |
| 11 | 56 | |
| 12 | 57 | <div class="logs"> |
| @@ -14,19 +59,34 @@ | ||
| 14 | 59 | <label> |
| 15 | 60 | {t('logs.of')} |
| 16 | 61 | <select value={agentName} onchange={(event) => (selected = event.currentTarget.value)}> |
| 17 | - {#each appState.agents as agent (agent.name)} | |
| 18 | - <option value={agent.name}>{agent.title}</option> | |
| 62 | + {#each appState.agents as each (each.name)} | |
| 63 | + <option value={each.name}>{each.title}</option> | |
| 19 | 64 | {/each} |
| 20 | 65 | </select> |
| 21 | 66 | </label> |
| 67 | + {#if agent && canUnload(appState.commands[agent.name])} | |
| 68 | + <button disabled={unloading || !unloadReady(agent.state)} onclick={unloadOne} title={t('unload.oneHelp', { agent: agent.title })}>{t('unload.one')}</button> | |
| 69 | + {/if} | |
| 70 | + <button disabled={unloading || !anyRunning} onclick={unloadAll} title={t('unload.allHelp')}>{t('unload.all')}</button> | |
| 22 | 71 | <MemoryPressure /> |
| 23 | 72 | </div> |
| 73 | + {#if notice.length || problem} | |
| 74 | + <p class="notice" class:failed={problem !== ''} role="status"> | |
| 75 | + {#if problem}<ErrorText raw={problem} />{:else}{notice.map((line) => t(line.key, line.vars)).join(' ')}{/if} | |
| 76 | + <button onclick={() => ((notice = []), (problem = ''))} aria-label={t('error.dismiss')} title={t('error.dismiss')}>×</button> | |
| 77 | + </p> | |
| 78 | + {/if} | |
| 24 | 79 | <AgentLog agent={agentName} /> |
| 25 | 80 | </div> |
| 26 | 81 | |
| 27 | 82 | <style> |
| 28 | 83 | .logs { height: 100%; display: flex; flex-direction: column; } |
| 29 | - .bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 0 8px 6px; } | |
| 84 | + .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 0 8px 6px; } | |
| 85 | + .bar :global(.memory) { margin-left: auto; } | |
| 30 | 86 | label { color: var(--muted); font-size: 12px; } |
| 31 | 87 | select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; } |
| 88 | + .bar > button { font-size: 12px; padding: 1px 8px; } | |
| 89 | + .notice { display: flex; gap: 6px; align-items: flex-start; margin: 0 8px 6px; color: var(--muted); font-size: 12px; } | |
| 90 | + .notice.failed { color: var(--danger); } | |
| 91 | + .notice button { margin-left: auto; border: none; background: none; color: inherit; padding: 0 4px; font-size: 14px; line-height: 1; } | |
| 32 | 92 | </style> |
| @@ -1,12 +1,57 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | import { t } from '../i18n/index.svelte' | 3 | import { t } from '../i18n/index.svelte' |
| 4 | - import { appState } from '../state.svelte' | 4 | + import { appState, loadCommands } from '../state.svelte' |
| 5 | + import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 5 | import AgentLog from '../agent/AgentLog.svelte' | 6 | import AgentLog from '../agent/AgentLog.svelte' |
| 7 | + import ErrorText from '../chat/ErrorText.svelte' | ||
| 6 | import MemoryPressure from './MemoryPressure.svelte' | 8 | import MemoryPressure from './MemoryPressure.svelte' |
| 9 | + import { canUnload, unloadReady, unloadSummary, type UnloadLine } from '../unload' | ||
| 7 | 10 | ||
| 8 | let selected = $state('') | 11 | let selected = $state('') |
| 9 | const agentName = $derived(selected || appState.agents[0]?.name || '') | 12 | const agentName = $derived(selected || appState.agents[0]?.name || '') |
| 13 | + const agent = $derived(appState.agents.find((candidate) => candidate.name === agentName)) | ||
| 14 | + | ||
| 15 | + // Issue #51: next to the memory pressure, unload the model of the agent | ||
| 16 | + // shown, or of every running agent that can. | ||
| 17 | + let unloading = $state(false) | ||
| 18 | + let notice = $state<UnloadLine[]>([]) | ||
| 19 | + let problem = $state('') | ||
| 20 | + const anyRunning = $derived(appState.agents.some((candidate) => unloadReady(candidate.state) || candidate.state === 'busy')) | ||
| 21 | + | ||
| 22 | + $effect(() => { | ||
| 23 | + for (const each of appState.agents) void loadCommands(each.name) | ||
| 24 | + }) | ||
| 25 | + | ||
| 26 | + async function unload(action: () => Promise<void>) { | ||
| 27 | + unloading = true | ||
| 28 | + notice = [] | ||
| 29 | + problem = '' | ||
| 30 | + try { | ||
| 31 | + await action() | ||
| 32 | + } catch (error) { | ||
| 33 | + problem = error instanceof Error ? error.message : String(error) | ||
| 34 | + } finally { | ||
| 35 | + unloading = false | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + function titleOf(name: string): string { | ||
| 40 | + return appState.agents.find((candidate) => candidate.name === name)?.title ?? name | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + const unloadOne = () => | ||
| 44 | + unload(async () => { | ||
| 45 | + const name = agentName | ||
| 46 | + await AgentService.Unload(name) | ||
| 47 | + notice = [{ key: 'unload.done', vars: { agents: titleOf(name) } }] | ||
| 48 | + }) | ||
| 49 | + | ||
| 50 | + const unloadAll = () => | ||
| 51 | + unload(async () => { | ||
| 52 | + const result = await AgentService.UnloadAll() | ||
| 53 | + notice = unloadSummary(result ?? { unloaded: [], skipped: [] }, titleOf) | ||
| 54 | + }) | ||
| 10 | </script> | 55 | </script> |
| 11 | 56 | ||
| 12 | <div class="logs"> | 57 | <div class="logs"> |
| @@ -14,19 +59,34 @@ | |||
| 14 | <label> | 59 | <label> |
| 15 | {t('logs.of')} | 60 | {t('logs.of')} |
| 16 | <select value={agentName} onchange={(event) => (selected = event.currentTarget.value)}> | 61 | <select value={agentName} onchange={(event) => (selected = event.currentTarget.value)}> |
| 17 | - {#each appState.agents as agent (agent.name)} | 62 | + {#each appState.agents as each (each.name)} |
| 18 | - <option value={agent.name}>{agent.title}</option> | 63 | + <option value={each.name}>{each.title}</option> |
| 19 | {/each} | 64 | {/each} |
| 20 | </select> | 65 | </select> |
| 21 | </label> | 66 | </label> |
| 67 | + {#if agent && canUnload(appState.commands[agent.name])} | ||
| 68 | + <button disabled={unloading || !unloadReady(agent.state)} onclick={unloadOne} title={t('unload.oneHelp', { agent: agent.title })}>{t('unload.one')}</button> | ||
| 69 | + {/if} | ||
| 70 | + <button disabled={unloading || !anyRunning} onclick={unloadAll} title={t('unload.allHelp')}>{t('unload.all')}</button> | ||
| 22 | <MemoryPressure /> | 71 | <MemoryPressure /> |
| 23 | </div> | 72 | </div> |
| 73 | + {#if notice.length || problem} | ||
| 74 | + <p class="notice" class:failed={problem !== ''} role="status"> | ||
| 75 | + {#if problem}<ErrorText raw={problem} />{:else}{notice.map((line) => t(line.key, line.vars)).join(' ')}{/if} | ||
| 76 | + <button onclick={() => ((notice = []), (problem = ''))} aria-label={t('error.dismiss')} title={t('error.dismiss')}>×</button> | ||
| 77 | + </p> | ||
| 78 | + {/if} | ||
| 24 | <AgentLog agent={agentName} /> | 79 | <AgentLog agent={agentName} /> |
| 25 | </div> | 80 | </div> |
| 26 | 81 | ||
| 27 | <style> | 82 | <style> |
| 28 | .logs { height: 100%; display: flex; flex-direction: column; } | 83 | .logs { height: 100%; display: flex; flex-direction: column; } |
| 29 | - .bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; padding: 0 8px 6px; } | 84 | + .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 0 8px 6px; } |
| 85 | + .bar :global(.memory) { margin-left: auto; } | ||
| 30 | label { color: var(--muted); font-size: 12px; } | 86 | label { color: var(--muted); font-size: 12px; } |
| 31 | select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; } | 87 | select { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; } |
| 88 | + .bar > button { font-size: 12px; padding: 1px 8px; } | ||
| 89 | + .notice { display: flex; gap: 6px; align-items: flex-start; margin: 0 8px 6px; color: var(--muted); font-size: 12px; } | ||
| 90 | + .notice.failed { color: var(--danger); } | ||
| 91 | + .notice button { margin-left: auto; border: none; background: none; color: inherit; padding: 0 4px; font-size: 14px; line-height: 1; } | ||
| 32 | </style> | 92 | </style> |
modified
frontend/src/lib/panels/SettingsPanel.svelte +2 -1 | @@ -1,5 +1,6 @@ | ||
| 1 | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | 2 | <script lang="ts"> |
| 3 | + import { isDark } from '../theme' | |
| 3 | 4 | import ActionError from '../chat/ActionError.svelte' |
| 4 | 5 | import { hasMessage, t } from '../i18n/index.svelte' |
| 5 | 6 | import { onMount } from 'svelte' |
| @@ -24,7 +25,7 @@ | ||
| 24 | 25 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) |
| 25 | 26 | let editor: ConfigEditor | undefined = $state() |
| 26 | 27 | const dirty = $derived(edited !== saved) |
| 27 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | |
| 28 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 28 | 29 | |
| 29 | 30 | async function load() { |
| 30 | 31 | const content = await ConfigService.Content() |
| @@ -1,5 +1,6 @@ | |||
| 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | 1 | <!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> |
| 2 | <script lang="ts"> | 2 | <script lang="ts"> |
| 3 | + import { isDark } from '../theme' | ||
| 3 | import ActionError from '../chat/ActionError.svelte' | 4 | import ActionError from '../chat/ActionError.svelte' |
| 4 | import { hasMessage, t } from '../i18n/index.svelte' | 5 | import { hasMessage, t } from '../i18n/index.svelte' |
| 5 | import { onMount } from 'svelte' | 6 | import { onMount } from 'svelte' |
| @@ -24,7 +25,7 @@ | |||
| 24 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) | 25 | let schema = $state<ReturnType<typeof createSchemaIndex> | null>(null) |
| 25 | let editor: ConfigEditor | undefined = $state() | 26 | let editor: ConfigEditor | undefined = $state() |
| 26 | const dirty = $derived(edited !== saved) | 27 | const dirty = $derived(edited !== saved) |
| 27 | - const dark = window.matchMedia('(prefers-color-scheme: dark)').matches | 28 | + const dark = isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) |
| 28 | 29 | ||
| 29 | async function load() { | 30 | async function load() { |
| 30 | const content = await ConfigService.Content() | 31 | const content = await ConfigService.Content() |
modified
frontend/src/lib/state.svelte.ts +2 -1 | @@ -274,7 +274,8 @@ export async function prepareCommands(id: string) { | ||
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | -async function loadCommands(agent: string) { | |
| 277 | +/** Loads the slash commands an agent announced, once. */ | |
| 278 | +export async function loadCommands(agent: string) { | |
| 278 | 279 | if (appState.commands[agent]) return |
| 279 | 280 | appState.commands[agent] = (await ChannelService.Commands(agent)) ?? [] |
| 280 | 281 | } |
| @@ -274,7 +274,8 @@ export async function prepareCommands(id: string) { | |||
| 274 | } | 274 | } |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | -async function loadCommands(agent: string) { | 277 | +/** Loads the slash commands an agent announced, once. */ |
| 278 | +export async function loadCommands(agent: string) { | ||
| 278 | if (appState.commands[agent]) return | 279 | if (appState.commands[agent]) return |
| 279 | appState.commands[agent] = (await ChannelService.Commands(agent)) ?? [] | 280 | appState.commands[agent] = (await ChannelService.Commands(agent)) ?? [] |
| 280 | } | 281 | } |
added
frontend/src/lib/terminalSessions.svelte.ts +194 -0 | new file mode 100644 | ||
| @@ -0,0 +1,194 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// The terminals of the agents, kept outside the views (issues #72 and #73): | |
| 4 | +// an agent may have several, and each one goes on running — its shell, its | |
| 5 | +// screen, the output arriving meanwhile — when the user goes to a | |
| 6 | +// conversation, a channel or another agent. A terminal ends only when the | |
| 7 | +// user closes it, its shell exits, or the application closes its terminals | |
| 8 | +// (another configuration file opened, the application quits). | |
| 9 | +// | |
| 10 | +// The screen of a terminal is an xterm.js instance drawn in its own element; | |
| 11 | +// a TerminalView shows it by moving that element into the page, and lets it | |
| 12 | +// go when it disappears. What the shell prints while nobody looks is written | |
| 13 | +// into the instance all the same. | |
| 14 | + | |
| 15 | +import { Terminal } from '@xterm/xterm' | |
| 16 | +import { FitAddon } from '@xterm/addon-fit' | |
| 17 | +import { TerminalService } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 18 | +import { listenTerminal, maxTerminalsPerAgent, nextTerminalNumber } from './terminals' | |
| 19 | + | |
| 20 | +/** What the views show of a terminal. */ | |
| 21 | +export type TerminalSession = { | |
| 22 | + key: string | |
| 23 | + agent: string | |
| 24 | + number: number | |
| 25 | + /** The shell has exited (or could not start: error). */ | |
| 26 | + ended: boolean | |
| 27 | + error: string | |
| 28 | +} | |
| 29 | + | |
| 30 | +// The parts of a terminal that are not displayed state: xterm objects must | |
| 31 | +// never become Svelte proxies. | |
| 32 | +type Screen = { | |
| 33 | + xterm: Terminal | |
| 34 | + fit: FitAddon | |
| 35 | + element: HTMLDivElement | |
| 36 | + opened: boolean | |
| 37 | + id: string | |
| 38 | + stop: () => void | |
| 39 | +} | |
| 40 | + | |
| 41 | +/** The terminals of each agent, in the order they were opened. */ | |
| 42 | +export const terminalSessions: Record<string, TerminalSession[]> = $state({}) | |
| 43 | +/** The terminal shown for each agent. */ | |
| 44 | +export const activeTerminal: Record<string, string> = $state({}) | |
| 45 | + | |
| 46 | +const screens = new Map<string, Screen>() | |
| 47 | +let sequence = 0 | |
| 48 | + | |
| 49 | +/** The terminals of an agent. */ | |
| 50 | +export function terminalsOf(agent: string): TerminalSession[] { | |
| 51 | + return terminalSessions[agent] ?? [] | |
| 52 | +} | |
| 53 | + | |
| 54 | +/** How many terminals of an agent still run a shell. */ | |
| 55 | +export function runningTerminals(agent: string): number { | |
| 56 | + return terminalsOf(agent).filter((session) => !session.ended).length | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * Adds a terminal to the agent and shows it; its shell starts once the view | |
| 61 | + * has measured it. Returns its key, or "" when the agent has as many | |
| 62 | + * terminals as allowed. | |
| 63 | + */ | |
| 64 | +export function newTerminal(agent: string): string { | |
| 65 | + const sessions = terminalsOf(agent) | |
| 66 | + if (sessions.length >= maxTerminalsPerAgent) return '' | |
| 67 | + const key = `term-${++sequence}` | |
| 68 | + const xterm = new Terminal({ | |
| 69 | + fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--mono') || 'monospace', | |
| 70 | + fontSize: 13, | |
| 71 | + cursorBlink: true, | |
| 72 | + theme: { background: '#16181d', foreground: '#e6e6e6' }, | |
| 73 | + }) | |
| 74 | + const fit = new FitAddon() | |
| 75 | + xterm.loadAddon(fit) | |
| 76 | + const element = document.createElement('div') | |
| 77 | + element.className = 'terminal-screen' | |
| 78 | + element.style.height = '100%' | |
| 79 | + const screen: Screen = { xterm, fit, element, opened: false, id: '', stop: () => {} } | |
| 80 | + xterm.onData((data) => { | |
| 81 | + if (screen.id) void TerminalService.Write(screen.id, data) | |
| 82 | + }) | |
| 83 | + screens.set(key, screen) | |
| 84 | + terminalSessions[agent] = [ | |
| 85 | + ...sessions, | |
| 86 | + { key, agent, number: nextTerminalNumber(sessions.map((session) => session.number)), ended: false, error: '' }, | |
| 87 | + ] | |
| 88 | + activeTerminal[agent] = key | |
| 89 | + return key | |
| 90 | +} | |
| 91 | + | |
| 92 | +function sessionOf(key: string): TerminalSession | undefined { | |
| 93 | + for (const sessions of Object.values(terminalSessions)) { | |
| 94 | + const found = sessions.find((session) => session.key === key) | |
| 95 | + if (found) return found | |
| 96 | + } | |
| 97 | + return undefined | |
| 98 | +} | |
| 99 | + | |
| 100 | +// Starts the shell of a terminal, of the size of its screen. | |
| 101 | +async function start(key: string) { | |
| 102 | + const screen = screens.get(key) | |
| 103 | + const session = sessionOf(key) | |
| 104 | + if (!screen || !session) return | |
| 105 | + session.ended = false | |
| 106 | + session.error = '' | |
| 107 | + try { | |
| 108 | + screen.id = (await TerminalService.Open(session.agent, screen.xterm.cols, screen.xterm.rows)) ?? '' | |
| 109 | + } catch (problem) { | |
| 110 | + session.ended = true | |
| 111 | + session.error = problem instanceof Error ? problem.message : String(problem) | |
| 112 | + return | |
| 113 | + } | |
| 114 | + if (!screens.has(key)) { | |
| 115 | + // Closed while the shell was starting. | |
| 116 | + void TerminalService.Close(screen.id) | |
| 117 | + return | |
| 118 | + } | |
| 119 | + screen.stop = listenTerminal( | |
| 120 | + screen.id, | |
| 121 | + (data) => screen.xterm.write(data), | |
| 122 | + () => { | |
| 123 | + screen.id = '' | |
| 124 | + const ended = sessionOf(key) | |
| 125 | + if (ended) ended.ended = true | |
| 126 | + }, | |
| 127 | + ) | |
| 128 | +} | |
| 129 | + | |
| 130 | +/** | |
| 131 | + * Shows a terminal in host: its screen moves there, takes the size of host, | |
| 132 | + * and its shell starts the first time. Returns the function that lets it go | |
| 133 | + * (the shell keeps running). | |
| 134 | + */ | |
| 135 | +export function attachTerminal(key: string, host: HTMLElement): () => void { | |
| 136 | + const screen = screens.get(key) | |
| 137 | + if (!screen) return () => {} | |
| 138 | + host.appendChild(screen.element) | |
| 139 | + if (!screen.opened) { | |
| 140 | + screen.xterm.open(screen.element) | |
| 141 | + screen.opened = true | |
| 142 | + screen.fit.fit() | |
| 143 | + void start(key) | |
| 144 | + } else { | |
| 145 | + fitTerminal(key) | |
| 146 | + screen.xterm.refresh(0, screen.xterm.rows - 1) | |
| 147 | + } | |
| 148 | + return () => { | |
| 149 | + if (screen.element.parentElement === host) host.removeChild(screen.element) | |
| 150 | + } | |
| 151 | +} | |
| 152 | + | |
| 153 | +/** Gives a shown terminal the size of its place; the shell is told. */ | |
| 154 | +export function fitTerminal(key: string) { | |
| 155 | + const screen = screens.get(key) | |
| 156 | + if (!screen?.opened || !screen.element.isConnected || screen.element.clientWidth === 0) return | |
| 157 | + screen.fit.fit() | |
| 158 | + if (screen.id) void TerminalService.Resize(screen.id, screen.xterm.cols, screen.xterm.rows) | |
| 159 | +} | |
| 160 | + | |
| 161 | +/** Puts the keyboard in a terminal. */ | |
| 162 | +export function focusTerminal(key: string) { | |
| 163 | + screens.get(key)?.xterm.focus() | |
| 164 | +} | |
| 165 | + | |
| 166 | +/** Starts a new shell in a terminal whose shell has ended. */ | |
| 167 | +export function restartTerminal(key: string) { | |
| 168 | + const screen = screens.get(key) | |
| 169 | + if (!screen) return | |
| 170 | + screen.stop() | |
| 171 | + screen.xterm.reset() | |
| 172 | + void start(key) | |
| 173 | +} | |
| 174 | + | |
| 175 | +/** Ends a terminal: its shell and everything it started, then its screen. */ | |
| 176 | +export function closeTerminal(key: string) { | |
| 177 | + const session = sessionOf(key) | |
| 178 | + const screen = screens.get(key) | |
| 179 | + screens.delete(key) | |
| 180 | + if (screen) { | |
| 181 | + screen.stop() | |
| 182 | + if (screen.id) void TerminalService.Close(screen.id) | |
| 183 | + screen.element.remove() | |
| 184 | + screen.xterm.dispose() | |
| 185 | + } | |
| 186 | + if (!session) return | |
| 187 | + const sessions = terminalsOf(session.agent) | |
| 188 | + const index = sessions.findIndex((candidate) => candidate.key === key) | |
| 189 | + const rest = sessions.filter((candidate) => candidate.key !== key) | |
| 190 | + terminalSessions[session.agent] = rest | |
| 191 | + if (activeTerminal[session.agent] === key) { | |
| 192 | + activeTerminal[session.agent] = rest[Math.min(index, rest.length - 1)]?.key ?? '' | |
| 193 | + } | |
| 194 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,194 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// The terminals of the agents, kept outside the views (issues #72 and #73): | ||
| 4 | +// an agent may have several, and each one goes on running — its shell, its | ||
| 5 | +// screen, the output arriving meanwhile — when the user goes to a | ||
| 6 | +// conversation, a channel or another agent. A terminal ends only when the | ||
| 7 | +// user closes it, its shell exits, or the application closes its terminals | ||
| 8 | +// (another configuration file opened, the application quits). | ||
| 9 | +// | ||
| 10 | +// The screen of a terminal is an xterm.js instance drawn in its own element; | ||
| 11 | +// a TerminalView shows it by moving that element into the page, and lets it | ||
| 12 | +// go when it disappears. What the shell prints while nobody looks is written | ||
| 13 | +// into the instance all the same. | ||
| 14 | + | ||
| 15 | +import { Terminal } from '@xterm/xterm' | ||
| 16 | +import { FitAddon } from '@xterm/addon-fit' | ||
| 17 | +import { TerminalService } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 18 | +import { listenTerminal, maxTerminalsPerAgent, nextTerminalNumber } from './terminals' | ||
| 19 | + | ||
| 20 | +/** What the views show of a terminal. */ | ||
| 21 | +export type TerminalSession = { | ||
| 22 | + key: string | ||
| 23 | + agent: string | ||
| 24 | + number: number | ||
| 25 | + /** The shell has exited (or could not start: error). */ | ||
| 26 | + ended: boolean | ||
| 27 | + error: string | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +// The parts of a terminal that are not displayed state: xterm objects must | ||
| 31 | +// never become Svelte proxies. | ||
| 32 | +type Screen = { | ||
| 33 | + xterm: Terminal | ||
| 34 | + fit: FitAddon | ||
| 35 | + element: HTMLDivElement | ||
| 36 | + opened: boolean | ||
| 37 | + id: string | ||
| 38 | + stop: () => void | ||
| 39 | +} | ||
| 40 | + | ||
| 41 | +/** The terminals of each agent, in the order they were opened. */ | ||
| 42 | +export const terminalSessions: Record<string, TerminalSession[]> = $state({}) | ||
| 43 | +/** The terminal shown for each agent. */ | ||
| 44 | +export const activeTerminal: Record<string, string> = $state({}) | ||
| 45 | + | ||
| 46 | +const screens = new Map<string, Screen>() | ||
| 47 | +let sequence = 0 | ||
| 48 | + | ||
| 49 | +/** The terminals of an agent. */ | ||
| 50 | +export function terminalsOf(agent: string): TerminalSession[] { | ||
| 51 | + return terminalSessions[agent] ?? [] | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +/** How many terminals of an agent still run a shell. */ | ||
| 55 | +export function runningTerminals(agent: string): number { | ||
| 56 | + return terminalsOf(agent).filter((session) => !session.ended).length | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +/** | ||
| 60 | + * Adds a terminal to the agent and shows it; its shell starts once the view | ||
| 61 | + * has measured it. Returns its key, or "" when the agent has as many | ||
| 62 | + * terminals as allowed. | ||
| 63 | + */ | ||
| 64 | +export function newTerminal(agent: string): string { | ||
| 65 | + const sessions = terminalsOf(agent) | ||
| 66 | + if (sessions.length >= maxTerminalsPerAgent) return '' | ||
| 67 | + const key = `term-${++sequence}` | ||
| 68 | + const xterm = new Terminal({ | ||
| 69 | + fontFamily: getComputedStyle(document.documentElement).getPropertyValue('--mono') || 'monospace', | ||
| 70 | + fontSize: 13, | ||
| 71 | + cursorBlink: true, | ||
| 72 | + theme: { background: '#16181d', foreground: '#e6e6e6' }, | ||
| 73 | + }) | ||
| 74 | + const fit = new FitAddon() | ||
| 75 | + xterm.loadAddon(fit) | ||
| 76 | + const element = document.createElement('div') | ||
| 77 | + element.className = 'terminal-screen' | ||
| 78 | + element.style.height = '100%' | ||
| 79 | + const screen: Screen = { xterm, fit, element, opened: false, id: '', stop: () => {} } | ||
| 80 | + xterm.onData((data) => { | ||
| 81 | + if (screen.id) void TerminalService.Write(screen.id, data) | ||
| 82 | + }) | ||
| 83 | + screens.set(key, screen) | ||
| 84 | + terminalSessions[agent] = [ | ||
| 85 | + ...sessions, | ||
| 86 | + { key, agent, number: nextTerminalNumber(sessions.map((session) => session.number)), ended: false, error: '' }, | ||
| 87 | + ] | ||
| 88 | + activeTerminal[agent] = key | ||
| 89 | + return key | ||
| 90 | +} | ||
| 91 | + | ||
| 92 | +function sessionOf(key: string): TerminalSession | undefined { | ||
| 93 | + for (const sessions of Object.values(terminalSessions)) { | ||
| 94 | + const found = sessions.find((session) => session.key === key) | ||
| 95 | + if (found) return found | ||
| 96 | + } | ||
| 97 | + return undefined | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +// Starts the shell of a terminal, of the size of its screen. | ||
| 101 | +async function start(key: string) { | ||
| 102 | + const screen = screens.get(key) | ||
| 103 | + const session = sessionOf(key) | ||
| 104 | + if (!screen || !session) return | ||
| 105 | + session.ended = false | ||
| 106 | + session.error = '' | ||
| 107 | + try { | ||
| 108 | + screen.id = (await TerminalService.Open(session.agent, screen.xterm.cols, screen.xterm.rows)) ?? '' | ||
| 109 | + } catch (problem) { | ||
| 110 | + session.ended = true | ||
| 111 | + session.error = problem instanceof Error ? problem.message : String(problem) | ||
| 112 | + return | ||
| 113 | + } | ||
| 114 | + if (!screens.has(key)) { | ||
| 115 | + // Closed while the shell was starting. | ||
| 116 | + void TerminalService.Close(screen.id) | ||
| 117 | + return | ||
| 118 | + } | ||
| 119 | + screen.stop = listenTerminal( | ||
| 120 | + screen.id, | ||
| 121 | + (data) => screen.xterm.write(data), | ||
| 122 | + () => { | ||
| 123 | + screen.id = '' | ||
| 124 | + const ended = sessionOf(key) | ||
| 125 | + if (ended) ended.ended = true | ||
| 126 | + }, | ||
| 127 | + ) | ||
| 128 | +} | ||
| 129 | + | ||
| 130 | +/** | ||
| 131 | + * Shows a terminal in host: its screen moves there, takes the size of host, | ||
| 132 | + * and its shell starts the first time. Returns the function that lets it go | ||
| 133 | + * (the shell keeps running). | ||
| 134 | + */ | ||
| 135 | +export function attachTerminal(key: string, host: HTMLElement): () => void { | ||
| 136 | + const screen = screens.get(key) | ||
| 137 | + if (!screen) return () => {} | ||
| 138 | + host.appendChild(screen.element) | ||
| 139 | + if (!screen.opened) { | ||
| 140 | + screen.xterm.open(screen.element) | ||
| 141 | + screen.opened = true | ||
| 142 | + screen.fit.fit() | ||
| 143 | + void start(key) | ||
| 144 | + } else { | ||
| 145 | + fitTerminal(key) | ||
| 146 | + screen.xterm.refresh(0, screen.xterm.rows - 1) | ||
| 147 | + } | ||
| 148 | + return () => { | ||
| 149 | + if (screen.element.parentElement === host) host.removeChild(screen.element) | ||
| 150 | + } | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +/** Gives a shown terminal the size of its place; the shell is told. */ | ||
| 154 | +export function fitTerminal(key: string) { | ||
| 155 | + const screen = screens.get(key) | ||
| 156 | + if (!screen?.opened || !screen.element.isConnected || screen.element.clientWidth === 0) return | ||
| 157 | + screen.fit.fit() | ||
| 158 | + if (screen.id) void TerminalService.Resize(screen.id, screen.xterm.cols, screen.xterm.rows) | ||
| 159 | +} | ||
| 160 | + | ||
| 161 | +/** Puts the keyboard in a terminal. */ | ||
| 162 | +export function focusTerminal(key: string) { | ||
| 163 | + screens.get(key)?.xterm.focus() | ||
| 164 | +} | ||
| 165 | + | ||
| 166 | +/** Starts a new shell in a terminal whose shell has ended. */ | ||
| 167 | +export function restartTerminal(key: string) { | ||
| 168 | + const screen = screens.get(key) | ||
| 169 | + if (!screen) return | ||
| 170 | + screen.stop() | ||
| 171 | + screen.xterm.reset() | ||
| 172 | + void start(key) | ||
| 173 | +} | ||
| 174 | + | ||
| 175 | +/** Ends a terminal: its shell and everything it started, then its screen. */ | ||
| 176 | +export function closeTerminal(key: string) { | ||
| 177 | + const session = sessionOf(key) | ||
| 178 | + const screen = screens.get(key) | ||
| 179 | + screens.delete(key) | ||
| 180 | + if (screen) { | ||
| 181 | + screen.stop() | ||
| 182 | + if (screen.id) void TerminalService.Close(screen.id) | ||
| 183 | + screen.element.remove() | ||
| 184 | + screen.xterm.dispose() | ||
| 185 | + } | ||
| 186 | + if (!session) return | ||
| 187 | + const sessions = terminalsOf(session.agent) | ||
| 188 | + const index = sessions.findIndex((candidate) => candidate.key === key) | ||
| 189 | + const rest = sessions.filter((candidate) => candidate.key !== key) | ||
| 190 | + terminalSessions[session.agent] = rest | ||
| 191 | + if (activeTerminal[session.agent] === key) { | ||
| 192 | + activeTerminal[session.agent] = rest[Math.min(index, rest.length - 1)]?.key ?? '' | ||
| 193 | + } | ||
| 194 | +} | ||
modified
frontend/src/lib/terminals.test.ts +9 -1 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { listenTerminal, terminalExit, terminalOutput } from './terminals' | |
| 4 | +import { listenTerminal, nextTerminalNumber, terminalExit, terminalOutput } from './terminals' | |
| 5 | 5 | |
| 6 | 6 | describe('terminal routing', () => { |
| 7 | 7 | it('keeps the output that arrives before the view listens', () => { |
| @@ -19,3 +19,11 @@ describe('terminal routing', () => { | ||
| 19 | 19 | expect(received).toHaveLength(2) |
| 20 | 20 | }) |
| 21 | 21 | }) |
| 22 | + | |
| 23 | +describe('terminal numbers (issue #73)', () => { | |
| 24 | + it('gives the smallest number not taken', () => { | |
| 25 | + expect(nextTerminalNumber([])).toBe(1) | |
| 26 | + expect(nextTerminalNumber([1, 2])).toBe(3) | |
| 27 | + expect(nextTerminalNumber([1, 3])).toBe(2) | |
| 28 | + }) | |
| 29 | +}) | |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { listenTerminal, terminalExit, terminalOutput } from './terminals' | 4 | +import { listenTerminal, nextTerminalNumber, terminalExit, terminalOutput } from './terminals' |
| 5 | 5 | ||
| 6 | describe('terminal routing', () => { | 6 | describe('terminal routing', () => { |
| 7 | it('keeps the output that arrives before the view listens', () => { | 7 | it('keeps the output that arrives before the view listens', () => { |
| @@ -19,3 +19,11 @@ describe('terminal routing', () => { | |||
| 19 | expect(received).toHaveLength(2) | 19 | expect(received).toHaveLength(2) |
| 20 | }) | 20 | }) |
| 21 | }) | 21 | }) |
| 22 | + | ||
| 23 | +describe('terminal numbers (issue #73)', () => { | ||
| 24 | + it('gives the smallest number not taken', () => { | ||
| 25 | + expect(nextTerminalNumber([])).toBe(1) | ||
| 26 | + expect(nextTerminalNumber([1, 2])).toBe(3) | ||
| 27 | + expect(nextTerminalNumber([1, 3])).toBe(2) | ||
| 28 | + }) | ||
| 29 | +}) | ||
modified
frontend/src/lib/terminals.ts +16 -0 | @@ -35,3 +35,19 @@ export function terminalExit(id: string) { | ||
| 35 | 35 | listeners.get(id)?.exit() |
| 36 | 36 | early.delete(id) |
| 37 | 37 | } |
| 38 | + | |
| 39 | +/** The most terminals an agent may have open at once (issue #73). */ | |
| 40 | +export const maxTerminalsPerAgent = 8 | |
| 41 | + | |
| 42 | +/** | |
| 43 | + * The number of a new terminal: the smallest one not taken, so that closing | |
| 44 | + * "Terminal 2" then opening one gives "Terminal 2" again. | |
| 45 | + * | |
| 46 | + * @example | |
| 47 | + * nextTerminalNumber([1, 3]) // 2 | |
| 48 | + */ | |
| 49 | +export function nextTerminalNumber(taken: number[]): number { | |
| 50 | + let number = 1 | |
| 51 | + while (taken.includes(number)) number++ | |
| 52 | + return number | |
| 53 | +} | |
| @@ -35,3 +35,19 @@ export function terminalExit(id: string) { | |||
| 35 | listeners.get(id)?.exit() | 35 | listeners.get(id)?.exit() |
| 36 | early.delete(id) | 36 | early.delete(id) |
| 37 | } | 37 | } |
| 38 | + | ||
| 39 | +/** The most terminals an agent may have open at once (issue #73). */ | ||
| 40 | +export const maxTerminalsPerAgent = 8 | ||
| 41 | + | ||
| 42 | +/** | ||
| 43 | + * The number of a new terminal: the smallest one not taken, so that closing | ||
| 44 | + * "Terminal 2" then opening one gives "Terminal 2" again. | ||
| 45 | + * | ||
| 46 | + * @example | ||
| 47 | + * nextTerminalNumber([1, 3]) // 2 | ||
| 48 | + */ | ||
| 49 | +export function nextTerminalNumber(taken: number[]): number { | ||
| 50 | + let number = 1 | ||
| 51 | + while (taken.includes(number)) number++ | ||
| 52 | + return number | ||
| 53 | +} | ||
modified
frontend/src/lib/theme.test.ts +13 -1 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { applyTheme, isMac, markPlatform } from './theme' | |
| 4 | +import { applyTheme, isDark, isMac, markPlatform } from './theme' | |
| 5 | 5 | |
| 6 | 6 | function element() { |
| 7 | 7 | const classes = new Set<string>() |
| @@ -56,3 +56,15 @@ describe('isMac', () => { | ||
| 56 | 56 | expect(isMac(false, webkitGtk)).toBe(false) |
| 57 | 57 | }) |
| 58 | 58 | }) |
| 59 | + | |
| 60 | +describe('isDark', () => { | |
| 61 | + it('follows ui.theme, then the system', () => { | |
| 62 | + const root = element() | |
| 63 | + expect(isDark(root, true)).toBe(true) | |
| 64 | + expect(isDark(root, false)).toBe(false) | |
| 65 | + applyTheme(root, 'light') | |
| 66 | + expect(isDark(root, true)).toBe(false) | |
| 67 | + applyTheme(root, 'dark') | |
| 68 | + expect(isDark(root, false)).toBe(true) | |
| 69 | + }) | |
| 70 | +}) | |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { applyTheme, isMac, markPlatform } from './theme' | 4 | +import { applyTheme, isDark, isMac, markPlatform } from './theme' |
| 5 | 5 | ||
| 6 | function element() { | 6 | function element() { |
| 7 | const classes = new Set<string>() | 7 | const classes = new Set<string>() |
| @@ -56,3 +56,15 @@ describe('isMac', () => { | |||
| 56 | expect(isMac(false, webkitGtk)).toBe(false) | 56 | expect(isMac(false, webkitGtk)).toBe(false) |
| 57 | }) | 57 | }) |
| 58 | }) | 58 | }) |
| 59 | + | ||
| 60 | +describe('isDark', () => { | ||
| 61 | + it('follows ui.theme, then the system', () => { | ||
| 62 | + const root = element() | ||
| 63 | + expect(isDark(root, true)).toBe(true) | ||
| 64 | + expect(isDark(root, false)).toBe(false) | ||
| 65 | + applyTheme(root, 'light') | ||
| 66 | + expect(isDark(root, true)).toBe(false) | ||
| 67 | + applyTheme(root, 'dark') | ||
| 68 | + expect(isDark(root, false)).toBe(true) | ||
| 69 | + }) | ||
| 70 | +}) | ||
modified
frontend/src/lib/theme.ts +13 -0 | @@ -20,6 +20,19 @@ export function applyTheme(root: HTMLElement, theme: string) { | ||
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | +/** | |
| 24 | + * Whether the interface is dark: ui.theme forces it, otherwise the | |
| 25 | + * operating system decides. | |
| 26 | + * | |
| 27 | + * @example | |
| 28 | + * isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | |
| 29 | + */ | |
| 30 | +export function isDark(root: HTMLElement, systemIsDark: boolean): boolean { | |
| 31 | + if (root.dataset.theme === 'dark') return true | |
| 32 | + if (root.dataset.theme === 'light') return false | |
| 33 | + return systemIsDark | |
| 34 | +} | |
| 35 | + | |
| 23 | 36 | /** |
| 24 | 37 | * Tells whether the interface runs on macOS. The Wails runtime fills its |
| 25 | 38 | * environment asynchronously, so System.IsMac() can still be false when the |
| @@ -20,6 +20,19 @@ export function applyTheme(root: HTMLElement, theme: string) { | |||
| 20 | } | 20 | } |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | +/** | ||
| 24 | + * Whether the interface is dark: ui.theme forces it, otherwise the | ||
| 25 | + * operating system decides. | ||
| 26 | + * | ||
| 27 | + * @example | ||
| 28 | + * isDark(document.documentElement, window.matchMedia('(prefers-color-scheme: dark)').matches) | ||
| 29 | + */ | ||
| 30 | +export function isDark(root: HTMLElement, systemIsDark: boolean): boolean { | ||
| 31 | + if (root.dataset.theme === 'dark') return true | ||
| 32 | + if (root.dataset.theme === 'light') return false | ||
| 33 | + return systemIsDark | ||
| 34 | +} | ||
| 35 | + | ||
| 23 | /** | 36 | /** |
| 24 | * Tells whether the interface runs on macOS. The Wails runtime fills its | 37 | * Tells whether the interface runs on macOS. The Wails runtime fills its |
| 25 | * environment asynchronously, so System.IsMac() can still be false when the | 38 | * environment asynchronously, so System.IsMac() can still be false when the |
added
frontend/src/lib/unload.test.ts +32 -0 | new file mode 100644 | ||
| @@ -0,0 +1,32 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +import { describe, expect, it } from 'vitest' | |
| 4 | +import { canUnload, unloadReady, unloadSummary } from './unload' | |
| 5 | + | |
| 6 | +describe('canUnload', () => { | |
| 7 | + it('needs the unload command', () => { | |
| 8 | + expect(canUnload([{ name: 'compact' }, { name: 'unload' }])).toBe(true) | |
| 9 | + expect(canUnload([{ name: 'compact' }])).toBe(false) | |
| 10 | + expect(canUnload(undefined)).toBe(false) | |
| 11 | + }) | |
| 12 | +}) | |
| 13 | + | |
| 14 | +describe('unloadReady', () => { | |
| 15 | + it('only while the agent runs and does not answer', () => { | |
| 16 | + expect(unloadReady('ready')).toBe(true) | |
| 17 | + for (const state of ['busy', 'stopped', 'starting', 'error', undefined]) expect(unloadReady(state)).toBe(false) | |
| 18 | + }) | |
| 19 | +}) | |
| 20 | + | |
| 21 | +describe('unloadSummary', () => { | |
| 22 | + const title = (name: string) => name[0].toUpperCase() + name.slice(1) | |
| 23 | + it('names the unloaded agents and the ones left alone', () => { | |
| 24 | + expect(unloadSummary({ unloaded: ['alice', 'bob'], skipped: ['carol'] }, title)).toEqual([ | |
| 25 | + { key: 'unload.done', vars: { agents: 'Alice, Bob' } }, | |
| 26 | + { key: 'unload.skipped', vars: { agents: 'Carol' } }, | |
| 27 | + ]) | |
| 28 | + }) | |
| 29 | + it('says when there was nothing to unload', () => { | |
| 30 | + expect(unloadSummary({ unloaded: null, skipped: [] }, title)).toEqual([{ key: 'unload.none', vars: {} }]) | |
| 31 | + }) | |
| 32 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +import { describe, expect, it } from 'vitest' | ||
| 4 | +import { canUnload, unloadReady, unloadSummary } from './unload' | ||
| 5 | + | ||
| 6 | +describe('canUnload', () => { | ||
| 7 | + it('needs the unload command', () => { | ||
| 8 | + expect(canUnload([{ name: 'compact' }, { name: 'unload' }])).toBe(true) | ||
| 9 | + expect(canUnload([{ name: 'compact' }])).toBe(false) | ||
| 10 | + expect(canUnload(undefined)).toBe(false) | ||
| 11 | + }) | ||
| 12 | +}) | ||
| 13 | + | ||
| 14 | +describe('unloadReady', () => { | ||
| 15 | + it('only while the agent runs and does not answer', () => { | ||
| 16 | + expect(unloadReady('ready')).toBe(true) | ||
| 17 | + for (const state of ['busy', 'stopped', 'starting', 'error', undefined]) expect(unloadReady(state)).toBe(false) | ||
| 18 | + }) | ||
| 19 | +}) | ||
| 20 | + | ||
| 21 | +describe('unloadSummary', () => { | ||
| 22 | + const title = (name: string) => name[0].toUpperCase() + name.slice(1) | ||
| 23 | + it('names the unloaded agents and the ones left alone', () => { | ||
| 24 | + expect(unloadSummary({ unloaded: ['alice', 'bob'], skipped: ['carol'] }, title)).toEqual([ | ||
| 25 | + { key: 'unload.done', vars: { agents: 'Alice, Bob' } }, | ||
| 26 | + { key: 'unload.skipped', vars: { agents: 'Carol' } }, | ||
| 27 | + ]) | ||
| 28 | + }) | ||
| 29 | + it('says when there was nothing to unload', () => { | ||
| 30 | + expect(unloadSummary({ unloaded: null, skipped: [] }, title)).toEqual([{ key: 'unload.none', vars: {} }]) | ||
| 31 | + }) | ||
| 32 | +}) | ||
added
frontend/src/lib/unload.ts +44 -0 | new file mode 100644 | ||
| @@ -0,0 +1,44 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// Unloading an agent's model from memory (issue #51): an agent that announces | |
| 4 | +// the /unload command can do it; Sidekicks sends it the command in a session | |
| 5 | +// of its own, while it runs and does not answer. | |
| 6 | + | |
| 7 | +import type { MessageKey } from './i18n/index.svelte' | |
| 8 | + | |
| 9 | +/** The slash command that unloads an agent's model (announced by mm). */ | |
| 10 | +export const unloadCommand = 'unload' | |
| 11 | + | |
| 12 | +/** Whether an agent that announced these commands can unload its model. */ | |
| 13 | +export function canUnload(commands: readonly { name: string }[] | undefined): boolean { | |
| 14 | + return (commands ?? []).some((command) => command.name === unloadCommand) | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** Whether the button can be used now: the agent runs and does not answer. */ | |
| 18 | +export function unloadReady(state: string | undefined): boolean { | |
| 19 | + return state === 'ready' | |
| 20 | +} | |
| 21 | + | |
| 22 | +/** A sentence of the result of "Unload all", as message keys and variables. */ | |
| 23 | +export type UnloadLine = { key: MessageKey; vars: Record<string, string> } | |
| 24 | + | |
| 25 | +/** | |
| 26 | + * What "Unload all" says: the agents unloaded and the ones left alone, by | |
| 27 | + * title, or that there was none. | |
| 28 | + * | |
| 29 | + * @example | |
| 30 | + * unloadSummary({ unloaded: ['alice'], skipped: [] }, (name) => name.toUpperCase()) | |
| 31 | + * // [{ key: 'unload.done', vars: { agents: 'ALICE' } }] | |
| 32 | + */ | |
| 33 | +export function unloadSummary( | |
| 34 | + result: { unloaded: string[] | null; skipped: string[] | null }, | |
| 35 | + titleOf: (name: string) => string, | |
| 36 | +): UnloadLine[] { | |
| 37 | + const unloaded = result.unloaded ?? [] | |
| 38 | + const skipped = result.skipped ?? [] | |
| 39 | + const lines: UnloadLine[] = [] | |
| 40 | + if (unloaded.length) lines.push({ key: 'unload.done', vars: { agents: unloaded.map(titleOf).join(', ') } }) | |
| 41 | + if (skipped.length) lines.push({ key: 'unload.skipped', vars: { agents: skipped.map(titleOf).join(', ') } }) | |
| 42 | + if (!lines.length) lines.push({ key: 'unload.none', vars: {} }) | |
| 43 | + return lines | |
| 44 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// Unloading an agent's model from memory (issue #51): an agent that announces | ||
| 4 | +// the /unload command can do it; Sidekicks sends it the command in a session | ||
| 5 | +// of its own, while it runs and does not answer. | ||
| 6 | + | ||
| 7 | +import type { MessageKey } from './i18n/index.svelte' | ||
| 8 | + | ||
| 9 | +/** The slash command that unloads an agent's model (announced by mm). */ | ||
| 10 | +export const unloadCommand = 'unload' | ||
| 11 | + | ||
| 12 | +/** Whether an agent that announced these commands can unload its model. */ | ||
| 13 | +export function canUnload(commands: readonly { name: string }[] | undefined): boolean { | ||
| 14 | + return (commands ?? []).some((command) => command.name === unloadCommand) | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +/** Whether the button can be used now: the agent runs and does not answer. */ | ||
| 18 | +export function unloadReady(state: string | undefined): boolean { | ||
| 19 | + return state === 'ready' | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +/** A sentence of the result of "Unload all", as message keys and variables. */ | ||
| 23 | +export type UnloadLine = { key: MessageKey; vars: Record<string, string> } | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * What "Unload all" says: the agents unloaded and the ones left alone, by | ||
| 27 | + * title, or that there was none. | ||
| 28 | + * | ||
| 29 | + * @example | ||
| 30 | + * unloadSummary({ unloaded: ['alice'], skipped: [] }, (name) => name.toUpperCase()) | ||
| 31 | + * // [{ key: 'unload.done', vars: { agents: 'ALICE' } }] | ||
| 32 | + */ | ||
| 33 | +export function unloadSummary( | ||
| 34 | + result: { unloaded: string[] | null; skipped: string[] | null }, | ||
| 35 | + titleOf: (name: string) => string, | ||
| 36 | +): UnloadLine[] { | ||
| 37 | + const unloaded = result.unloaded ?? [] | ||
| 38 | + const skipped = result.skipped ?? [] | ||
| 39 | + const lines: UnloadLine[] = [] | ||
| 40 | + if (unloaded.length) lines.push({ key: 'unload.done', vars: { agents: unloaded.map(titleOf).join(', ') } }) | ||
| 41 | + if (skipped.length) lines.push({ key: 'unload.skipped', vars: { agents: skipped.map(titleOf).join(', ') } }) | ||
| 42 | + if (!lines.length) lines.push({ key: 'unload.none', vars: {} }) | ||
| 43 | + return lines | ||
| 44 | +} | ||
modified
internal/app/app.go +14 -2 | @@ -123,12 +123,13 @@ func (c *Core) openChannels() { | ||
| 123 | 123 | problem = err.Error() |
| 124 | 124 | db, _ = store.OpenInMemory() |
| 125 | 125 | } |
| 126 | - manager, err := channels.NewManager(c.manager, db, channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}}) | |
| 126 | + options := channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}, Handoffs: c.maxAgentHandoffs} | |
| 127 | + manager, err := channels.NewManager(c.manager, db, options) | |
| 127 | 128 | if err != nil { |
| 128 | 129 | problem = err.Error() |
| 129 | 130 | _ = db.Close() |
| 130 | 131 | db, _ = store.OpenInMemory() |
| 131 | - manager, _ = channels.NewManager(c.manager, db, channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}}) | |
| 132 | + manager, _ = channels.NewManager(c.manager, db, options) | |
| 132 | 133 | } |
| 133 | 134 | _ = manager.Declare(declared) |
| 134 | 135 | c.mu.Lock() |
| @@ -302,3 +303,14 @@ func messages(problems []config.Problem) []string { | ||
| 302 | 303 | } |
| 303 | 304 | return result |
| 304 | 305 | } |
| 306 | + | |
| 307 | +// maxAgentHandoffs is limits.maxAgentHandoffs of the current configuration, | |
| 308 | +// read by the channels for each message (issue #26). | |
| 309 | +func (c *Core) maxAgentHandoffs() int { | |
| 310 | + c.mu.Lock() | |
| 311 | + defer c.mu.Unlock() | |
| 312 | + if c.cfg == nil { | |
| 313 | + return config.DefaultMaxAgentHandoffs | |
| 314 | + } | |
| 315 | + return c.cfg.Limits.MaxAgentHandoffs | |
| 316 | +} | |
| @@ -123,12 +123,13 @@ func (c *Core) openChannels() { | |||
| 123 | problem = err.Error() | 123 | problem = err.Error() |
| 124 | db, _ = store.OpenInMemory() | 124 | db, _ = store.OpenInMemory() |
| 125 | } | 125 | } |
| 126 | - manager, err := channels.NewManager(c.manager, db, channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}}) | 126 | + options := channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}, Handoffs: c.maxAgentHandoffs} |
| 127 | + manager, err := channels.NewManager(c.manager, db, options) | ||
| 127 | if err != nil { | 128 | if err != nil { |
| 128 | problem = err.Error() | 129 | problem = err.Error() |
| 129 | _ = db.Close() | 130 | _ = db.Close() |
| 130 | db, _ = store.OpenInMemory() | 131 | db, _ = store.OpenInMemory() |
| 131 | - manager, _ = channels.NewManager(c.manager, db, channels.Options{Emitter: c.options.Emitter, Files: agentFiles{core: c}}) | 132 | + manager, _ = channels.NewManager(c.manager, db, options) |
| 132 | } | 133 | } |
| 133 | _ = manager.Declare(declared) | 134 | _ = manager.Declare(declared) |
| 134 | c.mu.Lock() | 135 | c.mu.Lock() |
| @@ -302,3 +303,14 @@ func messages(problems []config.Problem) []string { | |||
| 302 | } | 303 | } |
| 303 | return result | 304 | return result |
| 304 | } | 305 | } |
| 306 | + | ||
| 307 | +// maxAgentHandoffs is limits.maxAgentHandoffs of the current configuration, | ||
| 308 | +// read by the channels for each message (issue #26). | ||
| 309 | +func (c *Core) maxAgentHandoffs() int { | ||
| 310 | + c.mu.Lock() | ||
| 311 | + defer c.mu.Unlock() | ||
| 312 | + if c.cfg == nil { | ||
| 313 | + return config.DefaultMaxAgentHandoffs | ||
| 314 | + } | ||
| 315 | + return c.cfg.Limits.MaxAgentHandoffs | ||
| 316 | +} | ||
modified
internal/app/app_test.go +59 -1 | @@ -352,7 +352,7 @@ func workspaceCore(t *testing.T) (*app.Core, string, *events.Recorder) { | ||
| 352 | 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { |
| 353 | 353 | core, folder, _ := workspaceCore(t) |
| 354 | 354 | service := &app.WorkspaceService{Core: core} |
| 355 | - if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" { | |
| 355 | + if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" || !info.Revealable { | |
| 356 | 356 | t.Fatalf("info: %+v", info) |
| 357 | 357 | } |
| 358 | 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { |
| @@ -394,6 +394,64 @@ func TestTheWorkspaceServiceEditsAnAgentsFiles(t *testing.T) { | ||
| 394 | 394 | } |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | +func TestTheWorkspaceServiceRenamesMovesAndRemovesSeveralFiles(t *testing.T) { | |
| 398 | + core, folder, _ := workspaceCore(t) | |
| 399 | + service := &app.WorkspaceService{Core: core} | |
| 400 | + ctx := context.Background() | |
| 401 | + t.Setenv("HOME", t.TempDir()) | |
| 402 | + t.Setenv("XDG_DATA_HOME", t.TempDir()) | |
| 403 | + if renamed, err := service.Rename(ctx, "alice", "notes.md", "journal.md"); err != nil || renamed != "journal.md" { | |
| 404 | + t.Fatalf("rename: %q %v", renamed, err) | |
| 405 | + } | |
| 406 | + if created, err := service.CreateFolder(ctx, "alice", "", "archive"); err != nil || created != "archive" { | |
| 407 | + t.Fatalf("folder: %q %v", created, err) | |
| 408 | + } | |
| 409 | + if _, err := service.CreateFolder(ctx, "alice", "", "a/b"); err == nil { | |
| 410 | + t.Fatal("a folder name with / is refused") | |
| 411 | + } | |
| 412 | + write(t, filepath.Join(folder, "plan.md"), "plan") | |
| 413 | + moved, err := service.Move(ctx, "alice", []string{"journal.md", "plan.md"}, "archive") | |
| 414 | + if err != nil || strings.Join(moved, ",") != "archive/journal.md,archive/plan.md" { | |
| 415 | + t.Fatalf("move: %v %v", moved, err) | |
| 416 | + } | |
| 417 | + if moved, err := service.Move(ctx, "alice", []string{"archive/plan.md"}, "archive"); err != nil || moved[0] != "archive/plan.md" { | |
| 418 | + t.Fatalf("moving into its own folder changes nothing: %v %v", moved, err) | |
| 419 | + } | |
| 420 | + write(t, filepath.Join(folder, "draft.md"), "draft") | |
| 421 | + if err := service.RemoveAll(ctx, "alice", []string{"archive/journal.md", "archive", "draft.md"}); err != nil { | |
| 422 | + t.Fatal(err) | |
| 423 | + } | |
| 424 | + for _, gone := range []string{"archive", "draft.md"} { | |
| 425 | + if _, err := os.Stat(filepath.Join(folder, gone)); !os.IsNotExist(err) { | |
| 426 | + t.Fatalf("%s should be gone", gone) | |
| 427 | + } | |
| 428 | + } | |
| 429 | +} | |
| 430 | + | |
| 431 | +func TestTheWorkspaceServiceDuplicatesFilesAndFolders(t *testing.T) { | |
| 432 | + core, folder, _ := workspaceCore(t) | |
| 433 | + service := &app.WorkspaceService{Core: core} | |
| 434 | + ctx := context.Background() | |
| 435 | + if err := os.MkdirAll(filepath.Join(folder, "archive"), 0o755); err != nil { | |
| 436 | + t.Fatal(err) | |
| 437 | + } | |
| 438 | + write(t, filepath.Join(folder, "archive", "plan.md"), "plan") | |
| 439 | + copies, err := service.Duplicate(ctx, "alice", []string{"archive/plan.md", "archive"}) | |
| 440 | + if err != nil || strings.Join(copies, ",") != "archive-copy" { | |
| 441 | + t.Fatalf("a file inside a duplicated folder is not copied twice: %v %v", copies, err) | |
| 442 | + } | |
| 443 | + copies, err = service.Duplicate(ctx, "alice", []string{"archive/plan.md"}) | |
| 444 | + if err != nil || copies[0] != "archive/plan-copy.md" { | |
| 445 | + t.Fatalf("duplicate: %v %v", copies, err) | |
| 446 | + } | |
| 447 | + if copies, err = service.Duplicate(ctx, "alice", []string{"archive/plan.md"}); err != nil || copies[0] != "archive/plan-copy-2.md" { | |
| 448 | + t.Fatalf("the next copy takes a free name: %v %v", copies, err) | |
| 449 | + } | |
| 450 | + if content, _ := os.ReadFile(filepath.Join(folder, "archive-copy", "plan.md")); string(content) != "plan" { | |
| 451 | + t.Fatalf("the folder is copied with its content: %q", content) | |
| 452 | + } | |
| 453 | +} | |
| 454 | + | |
| 397 | 455 | func TestWatchAnnouncesChangesUntilUnwatch(t *testing.T) { |
| 398 | 456 | core, folder, recorder := workspaceCore(t) |
| 399 | 457 | service := &app.WorkspaceService{Core: core} |
| @@ -352,7 +352,7 @@ func workspaceCore(t *testing.T) (*app.Core, string, *events.Recorder) { | |||
| 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { | 352 | func TestInfoTellsWhereEachWorkspaceIs(t *testing.T) { |
| 353 | core, folder, _ := workspaceCore(t) | 353 | core, folder, _ := workspaceCore(t) |
| 354 | service := &app.WorkspaceService{Core: core} | 354 | service := &app.WorkspaceService{Core: core} |
| 355 | - if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" { | 355 | + if info := service.Info("alice"); info.Location != "local · "+folder || info.Problem != "" || !info.Revealable { |
| 356 | t.Fatalf("info: %+v", info) | 356 | t.Fatalf("info: %+v", info) |
| 357 | } | 357 | } |
| 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { | 358 | if info := service.Info("boxed"); info.Problem != "" || info.Location != "sandbox box · "+folder { |
| @@ -394,6 +394,64 @@ func TestTheWorkspaceServiceEditsAnAgentsFiles(t *testing.T) { | |||
| 394 | } | 394 | } |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | +func TestTheWorkspaceServiceRenamesMovesAndRemovesSeveralFiles(t *testing.T) { | ||
| 398 | + core, folder, _ := workspaceCore(t) | ||
| 399 | + service := &app.WorkspaceService{Core: core} | ||
| 400 | + ctx := context.Background() | ||
| 401 | + t.Setenv("HOME", t.TempDir()) | ||
| 402 | + t.Setenv("XDG_DATA_HOME", t.TempDir()) | ||
| 403 | + if renamed, err := service.Rename(ctx, "alice", "notes.md", "journal.md"); err != nil || renamed != "journal.md" { | ||
| 404 | + t.Fatalf("rename: %q %v", renamed, err) | ||
| 405 | + } | ||
| 406 | + if created, err := service.CreateFolder(ctx, "alice", "", "archive"); err != nil || created != "archive" { | ||
| 407 | + t.Fatalf("folder: %q %v", created, err) | ||
| 408 | + } | ||
| 409 | + if _, err := service.CreateFolder(ctx, "alice", "", "a/b"); err == nil { | ||
| 410 | + t.Fatal("a folder name with / is refused") | ||
| 411 | + } | ||
| 412 | + write(t, filepath.Join(folder, "plan.md"), "plan") | ||
| 413 | + moved, err := service.Move(ctx, "alice", []string{"journal.md", "plan.md"}, "archive") | ||
| 414 | + if err != nil || strings.Join(moved, ",") != "archive/journal.md,archive/plan.md" { | ||
| 415 | + t.Fatalf("move: %v %v", moved, err) | ||
| 416 | + } | ||
| 417 | + if moved, err := service.Move(ctx, "alice", []string{"archive/plan.md"}, "archive"); err != nil || moved[0] != "archive/plan.md" { | ||
| 418 | + t.Fatalf("moving into its own folder changes nothing: %v %v", moved, err) | ||
| 419 | + } | ||
| 420 | + write(t, filepath.Join(folder, "draft.md"), "draft") | ||
| 421 | + if err := service.RemoveAll(ctx, "alice", []string{"archive/journal.md", "archive", "draft.md"}); err != nil { | ||
| 422 | + t.Fatal(err) | ||
| 423 | + } | ||
| 424 | + for _, gone := range []string{"archive", "draft.md"} { | ||
| 425 | + if _, err := os.Stat(filepath.Join(folder, gone)); !os.IsNotExist(err) { | ||
| 426 | + t.Fatalf("%s should be gone", gone) | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | +} | ||
| 430 | + | ||
| 431 | +func TestTheWorkspaceServiceDuplicatesFilesAndFolders(t *testing.T) { | ||
| 432 | + core, folder, _ := workspaceCore(t) | ||
| 433 | + service := &app.WorkspaceService{Core: core} | ||
| 434 | + ctx := context.Background() | ||
| 435 | + if err := os.MkdirAll(filepath.Join(folder, "archive"), 0o755); err != nil { | ||
| 436 | + t.Fatal(err) | ||
| 437 | + } | ||
| 438 | + write(t, filepath.Join(folder, "archive", "plan.md"), "plan") | ||
| 439 | + copies, err := service.Duplicate(ctx, "alice", []string{"archive/plan.md", "archive"}) | ||
| 440 | + if err != nil || strings.Join(copies, ",") != "archive-copy" { | ||
| 441 | + t.Fatalf("a file inside a duplicated folder is not copied twice: %v %v", copies, err) | ||
| 442 | + } | ||
| 443 | + copies, err = service.Duplicate(ctx, "alice", []string{"archive/plan.md"}) | ||
| 444 | + if err != nil || copies[0] != "archive/plan-copy.md" { | ||
| 445 | + t.Fatalf("duplicate: %v %v", copies, err) | ||
| 446 | + } | ||
| 447 | + if copies, err = service.Duplicate(ctx, "alice", []string{"archive/plan.md"}); err != nil || copies[0] != "archive/plan-copy-2.md" { | ||
| 448 | + t.Fatalf("the next copy takes a free name: %v %v", copies, err) | ||
| 449 | + } | ||
| 450 | + if content, _ := os.ReadFile(filepath.Join(folder, "archive-copy", "plan.md")); string(content) != "plan" { | ||
| 451 | + t.Fatalf("the folder is copied with its content: %q", content) | ||
| 452 | + } | ||
| 453 | +} | ||
| 454 | + | ||
| 397 | func TestWatchAnnouncesChangesUntilUnwatch(t *testing.T) { | 455 | func TestWatchAnnouncesChangesUntilUnwatch(t *testing.T) { |
| 398 | core, folder, recorder := workspaceCore(t) | 456 | core, folder, recorder := workspaceCore(t) |
| 399 | service := &app.WorkspaceService{Core: core} | 457 | service := &app.WorkspaceService{Core: core} |
modified
internal/app/protect_test.go +30 -0 | @@ -81,3 +81,33 @@ func TestProtectedFilesAreMarkedReadOnlyAndKept(t *testing.T) { | ||
| 81 | 81 | t.Fatalf("the other files stay editable: %v", err) |
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | + | |
| 85 | +func TestProtectedFilesCannotBeRenamedMovedNorRemovedTogether(t *testing.T) { | |
| 86 | + service, folder := protectedSetup(t) | |
| 87 | + ctx := context.Background() | |
| 88 | + t.Setenv("HOME", t.TempDir()) | |
| 89 | + t.Setenv("XDG_DATA_HOME", t.TempDir()) | |
| 90 | + for _, from := range []string{"AGENTS.md", "skills"} { | |
| 91 | + if _, err := service.Rename(ctx, "bob", from, "elsewhere"); !errors.Is(err, workspace.ErrProtected) { | |
| 92 | + t.Fatalf("renaming %s is refused: %v", from, err) | |
| 93 | + } | |
| 94 | + } | |
| 95 | + if _, err := service.Rename(ctx, "bob", "notes.md", "skills/notes.md"); !errors.Is(err, workspace.ErrProtected) { | |
| 96 | + t.Fatalf("a protected new path is refused: %v", err) | |
| 97 | + } | |
| 98 | + if _, err := service.Move(ctx, "bob", []string{"agent.yaml"}, "archive"); !errors.Is(err, workspace.ErrProtected) { | |
| 99 | + t.Fatalf("moving a protected file is refused: %v", err) | |
| 100 | + } | |
| 101 | + if copies, err := service.Duplicate(ctx, "bob", []string{"AGENTS.md"}); err != nil || copies[0] != "AGENTS-copy.md" { | |
| 102 | + t.Fatalf("a protected file may be duplicated, its copy is not protected: %v %v", copies, err) | |
| 103 | + } | |
| 104 | + if _, err := service.Duplicate(ctx, "bob", []string{"skills/idioms/SKILL.md"}); !errors.Is(err, workspace.ErrProtected) { | |
| 105 | + t.Fatalf("a copy inside a protected folder is refused: %v", err) | |
| 106 | + } | |
| 107 | + if err := service.RemoveAll(ctx, "bob", []string{"notes.md", "AGENTS.md"}); !errors.Is(err, workspace.ErrProtected) { | |
| 108 | + t.Fatalf("removing a protected file with others is refused: %v", err) | |
| 109 | + } | |
| 110 | + if _, err := os.Stat(filepath.Join(folder, "notes.md")); err != nil { | |
| 111 | + t.Fatal("nothing is removed when one of the files is protected") | |
| 112 | + } | |
| 113 | +} | |
| @@ -81,3 +81,33 @@ func TestProtectedFilesAreMarkedReadOnlyAndKept(t *testing.T) { | |||
| 81 | t.Fatalf("the other files stay editable: %v", err) | 81 | t.Fatalf("the other files stay editable: %v", err) |
| 82 | } | 82 | } |
| 83 | } | 83 | } |
| 84 | + | ||
| 85 | +func TestProtectedFilesCannotBeRenamedMovedNorRemovedTogether(t *testing.T) { | ||
| 86 | + service, folder := protectedSetup(t) | ||
| 87 | + ctx := context.Background() | ||
| 88 | + t.Setenv("HOME", t.TempDir()) | ||
| 89 | + t.Setenv("XDG_DATA_HOME", t.TempDir()) | ||
| 90 | + for _, from := range []string{"AGENTS.md", "skills"} { | ||
| 91 | + if _, err := service.Rename(ctx, "bob", from, "elsewhere"); !errors.Is(err, workspace.ErrProtected) { | ||
| 92 | + t.Fatalf("renaming %s is refused: %v", from, err) | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + if _, err := service.Rename(ctx, "bob", "notes.md", "skills/notes.md"); !errors.Is(err, workspace.ErrProtected) { | ||
| 96 | + t.Fatalf("a protected new path is refused: %v", err) | ||
| 97 | + } | ||
| 98 | + if _, err := service.Move(ctx, "bob", []string{"agent.yaml"}, "archive"); !errors.Is(err, workspace.ErrProtected) { | ||
| 99 | + t.Fatalf("moving a protected file is refused: %v", err) | ||
| 100 | + } | ||
| 101 | + if copies, err := service.Duplicate(ctx, "bob", []string{"AGENTS.md"}); err != nil || copies[0] != "AGENTS-copy.md" { | ||
| 102 | + t.Fatalf("a protected file may be duplicated, its copy is not protected: %v %v", copies, err) | ||
| 103 | + } | ||
| 104 | + if _, err := service.Duplicate(ctx, "bob", []string{"skills/idioms/SKILL.md"}); !errors.Is(err, workspace.ErrProtected) { | ||
| 105 | + t.Fatalf("a copy inside a protected folder is refused: %v", err) | ||
| 106 | + } | ||
| 107 | + if err := service.RemoveAll(ctx, "bob", []string{"notes.md", "AGENTS.md"}); !errors.Is(err, workspace.ErrProtected) { | ||
| 108 | + t.Fatalf("removing a protected file with others is refused: %v", err) | ||
| 109 | + } | ||
| 110 | + if _, err := os.Stat(filepath.Join(folder, "notes.md")); err != nil { | ||
| 111 | + t.Fatal("nothing is removed when one of the files is protected") | ||
| 112 | + } | ||
| 113 | +} | ||
modified
internal/app/sandboxes.go +27 -2 | @@ -7,6 +7,7 @@ import ( | ||
| 7 | 7 | "errors" |
| 8 | 8 | "fmt" |
| 9 | 9 | "os" |
| 10 | + "path/filepath" | |
| 10 | 11 | |
| 11 | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 12 | 13 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" |
| @@ -46,7 +47,12 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle. | ||
| 46 | 47 | // assistant: the sandbox's name, the agent's folder, and its commands on one |
| 47 | 48 | // line each, ready for the form's fields. |
| 48 | 49 | type SandboxEnv struct { |
| 49 | - Name string `json:"name"` | |
| 50 | + Name string `json:"name"` | |
| 51 | + // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | |
| 52 | + Agent string `json:"agent"` | |
| 53 | + // AgentFile is the agent's configuration file found in the workspace | |
| 54 | + // (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | |
| 55 | + AgentFile string `json:"agentFile"` | |
| 50 | 56 | Workspace string `json:"workspace"` |
| 51 | 57 | SandboxFolder string `json:"sandboxFolder"` |
| 52 | 58 | CreateCommand string `json:"createCommand"` |
| @@ -65,11 +71,30 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) { | ||
| 65 | 71 | return SandboxEnv{}, err |
| 66 | 72 | } |
| 67 | 73 | return SandboxEnv{ |
| 68 | - Name: env.Name, Workspace: env.Workspace, SandboxFolder: env.Folder, | |
| 74 | + Name: env.Name, Agent: env.Agent, AgentFile: agentFileIn(env.Workspace), Workspace: env.Workspace, SandboxFolder: env.Folder, | |
| 69 | 75 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), |
| 70 | 76 | }, nil |
| 71 | 77 | } |
| 72 | 78 | |
| 79 | +// agentFileNames are the names an agent's configuration file is looked for | |
| 80 | +// under in a sandbox's workspace, in this order (the snippets use agent.yaml). | |
| 81 | +var agentFileNames = []string{"agent.yaml", "agent.yml"} | |
| 82 | + | |
| 83 | +// agentFileIn returns the agent's configuration file in workspace, "" when | |
| 84 | +// there is none or no workspace. | |
| 85 | +func agentFileIn(workspace string) string { | |
| 86 | + if workspace == "" { | |
| 87 | + return "" | |
| 88 | + } | |
| 89 | + for _, name := range agentFileNames { | |
| 90 | + path := filepath.Join(workspace, name) | |
| 91 | + if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() { | |
| 92 | + return path | |
| 93 | + } | |
| 94 | + } | |
| 95 | + return "" | |
| 96 | +} | |
| 97 | + | |
| 73 | 98 | // ComposeView is a Compose file for the "add an agent" assistant: the folder |
| 74 | 99 | // the commands run in, and each service with its container and commands, on |
| 75 | 100 | // one line each, ready for the form's fields (issue #48). |
| @@ -7,6 +7,7 @@ import ( | |||
| 7 | "errors" | 7 | "errors" |
| 8 | "fmt" | 8 | "fmt" |
| 9 | "os" | 9 | "os" |
| 10 | + "path/filepath" | ||
| 10 | 11 | ||
| 11 | "git.rickub.com/bots-garden/sidekicks/internal/agents" | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 12 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | 13 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" |
| @@ -46,7 +47,12 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle. | |||
| 46 | // assistant: the sandbox's name, the agent's folder, and its commands on one | 47 | // assistant: the sandbox's name, the agent's folder, and its commands on one |
| 47 | // line each, ready for the form's fields. | 48 | // line each, ready for the form's fields. |
| 48 | type SandboxEnv struct { | 49 | type SandboxEnv struct { |
| 49 | - Name string `json:"name"` | 50 | + Name string `json:"name"` |
| 51 | + // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | ||
| 52 | + Agent string `json:"agent"` | ||
| 53 | + // AgentFile is the agent's configuration file found in the workspace | ||
| 54 | + // (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | ||
| 55 | + AgentFile string `json:"agentFile"` | ||
| 50 | Workspace string `json:"workspace"` | 56 | Workspace string `json:"workspace"` |
| 51 | SandboxFolder string `json:"sandboxFolder"` | 57 | SandboxFolder string `json:"sandboxFolder"` |
| 52 | CreateCommand string `json:"createCommand"` | 58 | CreateCommand string `json:"createCommand"` |
| @@ -65,11 +71,30 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) { | |||
| 65 | return SandboxEnv{}, err | 71 | return SandboxEnv{}, err |
| 66 | } | 72 | } |
| 67 | return SandboxEnv{ | 73 | return SandboxEnv{ |
| 68 | - Name: env.Name, Workspace: env.Workspace, SandboxFolder: env.Folder, | 74 | + Name: env.Name, Agent: env.Agent, AgentFile: agentFileIn(env.Workspace), Workspace: env.Workspace, SandboxFolder: env.Folder, |
| 69 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), | 75 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), |
| 70 | }, nil | 76 | }, nil |
| 71 | } | 77 | } |
| 72 | 78 | ||
| 79 | +// agentFileNames are the names an agent's configuration file is looked for | ||
| 80 | +// under in a sandbox's workspace, in this order (the snippets use agent.yaml). | ||
| 81 | +var agentFileNames = []string{"agent.yaml", "agent.yml"} | ||
| 82 | + | ||
| 83 | +// agentFileIn returns the agent's configuration file in workspace, "" when | ||
| 84 | +// there is none or no workspace. | ||
| 85 | +func agentFileIn(workspace string) string { | ||
| 86 | + if workspace == "" { | ||
| 87 | + return "" | ||
| 88 | + } | ||
| 89 | + for _, name := range agentFileNames { | ||
| 90 | + path := filepath.Join(workspace, name) | ||
| 91 | + if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() { | ||
| 92 | + return path | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + return "" | ||
| 96 | +} | ||
| 97 | + | ||
| 73 | // ComposeView is a Compose file for the "add an agent" assistant: the folder | 98 | // ComposeView is a Compose file for the "add an agent" assistant: the folder |
| 74 | // the commands run in, and each service with its container and commands, on | 99 | // the commands run in, and each service with its container and commands, on |
| 75 | // one line each, ready for the form's fields (issue #48). | 100 | // one line each, ready for the form's fields (issue #48). |
modified
internal/app/sandboxes_test.go +9 -1 | @@ -114,12 +114,20 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) { | ||
| 114 | 114 | t.Fatal(err) |
| 115 | 115 | } |
| 116 | 116 | want := app.SandboxEnv{ |
| 117 | - Name: "milo-sbx", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir, | |
| 117 | + Name: "milo-sbx", Agent: "mini-me-kit", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir, | |
| 118 | 118 | CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`, |
| 119 | 119 | } |
| 120 | 120 | if env != want { |
| 121 | 121 | t.Fatalf("got %+v\nwant %+v", env, want) |
| 122 | 122 | } |
| 123 | + // The agent's configuration file in the workspace is given too (issue #87). | |
| 124 | + if err := os.MkdirAll(filepath.Join(dir, "workspace"), 0o755); err != nil { | |
| 125 | + t.Fatal(err) | |
| 126 | + } | |
| 127 | + write(t, filepath.Join(dir, "workspace", "agent.yaml"), "agents: {}\n") | |
| 128 | + if env, err := service.ReadSandboxEnv(path); err != nil || env.AgentFile != filepath.Join(dir, "workspace", "agent.yaml") { | |
| 129 | + t.Fatalf("agent file: %+v, %v", env, err) | |
| 130 | + } | |
| 123 | 131 | write(t, path, "version: 1\n") |
| 124 | 132 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { |
| 125 | 133 | t.Fatalf("another file is refused: %v", err) |
| @@ -114,12 +114,20 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) { | |||
| 114 | t.Fatal(err) | 114 | t.Fatal(err) |
| 115 | } | 115 | } |
| 116 | want := app.SandboxEnv{ | 116 | want := app.SandboxEnv{ |
| 117 | - Name: "milo-sbx", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir, | 117 | + Name: "milo-sbx", Agent: "mini-me-kit", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir, |
| 118 | CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`, | 118 | CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`, |
| 119 | } | 119 | } |
| 120 | if env != want { | 120 | if env != want { |
| 121 | t.Fatalf("got %+v\nwant %+v", env, want) | 121 | t.Fatalf("got %+v\nwant %+v", env, want) |
| 122 | } | 122 | } |
| 123 | + // The agent's configuration file in the workspace is given too (issue #87). | ||
| 124 | + if err := os.MkdirAll(filepath.Join(dir, "workspace"), 0o755); err != nil { | ||
| 125 | + t.Fatal(err) | ||
| 126 | + } | ||
| 127 | + write(t, filepath.Join(dir, "workspace", "agent.yaml"), "agents: {}\n") | ||
| 128 | + if env, err := service.ReadSandboxEnv(path); err != nil || env.AgentFile != filepath.Join(dir, "workspace", "agent.yaml") { | ||
| 129 | + t.Fatalf("agent file: %+v, %v", env, err) | ||
| 130 | + } | ||
| 123 | write(t, path, "version: 1\n") | 131 | write(t, path, "version: 1\n") |
| 124 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { | 132 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { |
| 125 | t.Fatalf("another file is refused: %v", err) | 133 | t.Fatalf("another file is refused: %v", err) |
added
internal/app/unload.go +81 -0 | new file mode 100644 | ||
| @@ -0,0 +1,81 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package app | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "fmt" | |
| 9 | + "strings" | |
| 10 | + | |
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | |
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | |
| 13 | +) | |
| 14 | + | |
| 15 | +// ErrNotRunning is returned for an agent that is not running: it has no model loaded. | |
| 16 | +var ErrNotRunning = errors.New("the agent is not running: it has no model to unload") | |
| 17 | + | |
| 18 | +// Unload has the agent unload its model from memory, without stopping it | |
| 19 | +// (issue #51), when it offers the /unload command. Nothing appears in the | |
| 20 | +// conversations: what the agent answers goes to its log. The model is loaded | |
| 21 | +// again with the next message. | |
| 22 | +func (s *AgentService) Unload(ctx context.Context, name string) error { | |
| 23 | + status, ok := s.Core.status(name) | |
| 24 | + if !ok { | |
| 25 | + return fmt.Errorf("%w: %s", agents.ErrUnknownAgent, name) | |
| 26 | + } | |
| 27 | + switch status.State { | |
| 28 | + case agents.StateReady: | |
| 29 | + case agents.StateBusy: | |
| 30 | + return channels.ErrAgentAnswering | |
| 31 | + default: | |
| 32 | + return ErrNotRunning | |
| 33 | + } | |
| 34 | + log := func(line string) { _ = s.Core.manager.Log(name, "unload: "+line) } | |
| 35 | + answer, err := s.Core.Channels().Unload(ctx, name) | |
| 36 | + if err != nil { | |
| 37 | + log(err.Error()) | |
| 38 | + return err | |
| 39 | + } | |
| 40 | + if answer == "" { | |
| 41 | + answer = "done" | |
| 42 | + } | |
| 43 | + for _, line := range strings.Split(answer, "\n") { | |
| 44 | + log(line) | |
| 45 | + } | |
| 46 | + return nil | |
| 47 | +} | |
| 48 | + | |
| 49 | +// UnloadResult says which agents unloaded their model, and which running | |
| 50 | +// agents were left alone: answering, unable to unload, or failing. | |
| 51 | +type UnloadResult struct { | |
| 52 | + Unloaded []string `json:"unloaded"` | |
| 53 | + Skipped []string `json:"skipped"` | |
| 54 | +} | |
| 55 | + | |
| 56 | +// UnloadAll has every running agent that offers /unload unload its model. | |
| 57 | +// Stopped agents are not counted; running agents that are answering or | |
| 58 | +// cannot unload are skipped. | |
| 59 | +func (s *AgentService) UnloadAll(ctx context.Context) UnloadResult { | |
| 60 | + result := UnloadResult{Unloaded: []string{}, Skipped: []string{}} | |
| 61 | + for _, status := range s.Core.manager.Statuses() { | |
| 62 | + if status.State != agents.StateReady && status.State != agents.StateBusy { | |
| 63 | + continue | |
| 64 | + } | |
| 65 | + if err := s.Unload(ctx, status.Name); err != nil { | |
| 66 | + result.Skipped = append(result.Skipped, status.Name) | |
| 67 | + continue | |
| 68 | + } | |
| 69 | + result.Unloaded = append(result.Unloaded, status.Name) | |
| 70 | + } | |
| 71 | + return result | |
| 72 | +} | |
| 73 | + | |
| 74 | +func (c *Core) status(name string) (agents.Status, bool) { | |
| 75 | + for _, status := range c.manager.Statuses() { | |
| 76 | + if status.Name == name { | |
| 77 | + return status, true | |
| 78 | + } | |
| 79 | + } | |
| 80 | + return agents.Status{}, false | |
| 81 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package app | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "fmt" | ||
| 9 | + "strings" | ||
| 10 | + | ||
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | ||
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +// ErrNotRunning is returned for an agent that is not running: it has no model loaded. | ||
| 16 | +var ErrNotRunning = errors.New("the agent is not running: it has no model to unload") | ||
| 17 | + | ||
| 18 | +// Unload has the agent unload its model from memory, without stopping it | ||
| 19 | +// (issue #51), when it offers the /unload command. Nothing appears in the | ||
| 20 | +// conversations: what the agent answers goes to its log. The model is loaded | ||
| 21 | +// again with the next message. | ||
| 22 | +func (s *AgentService) Unload(ctx context.Context, name string) error { | ||
| 23 | + status, ok := s.Core.status(name) | ||
| 24 | + if !ok { | ||
| 25 | + return fmt.Errorf("%w: %s", agents.ErrUnknownAgent, name) | ||
| 26 | + } | ||
| 27 | + switch status.State { | ||
| 28 | + case agents.StateReady: | ||
| 29 | + case agents.StateBusy: | ||
| 30 | + return channels.ErrAgentAnswering | ||
| 31 | + default: | ||
| 32 | + return ErrNotRunning | ||
| 33 | + } | ||
| 34 | + log := func(line string) { _ = s.Core.manager.Log(name, "unload: "+line) } | ||
| 35 | + answer, err := s.Core.Channels().Unload(ctx, name) | ||
| 36 | + if err != nil { | ||
| 37 | + log(err.Error()) | ||
| 38 | + return err | ||
| 39 | + } | ||
| 40 | + if answer == "" { | ||
| 41 | + answer = "done" | ||
| 42 | + } | ||
| 43 | + for _, line := range strings.Split(answer, "\n") { | ||
| 44 | + log(line) | ||
| 45 | + } | ||
| 46 | + return nil | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +// UnloadResult says which agents unloaded their model, and which running | ||
| 50 | +// agents were left alone: answering, unable to unload, or failing. | ||
| 51 | +type UnloadResult struct { | ||
| 52 | + Unloaded []string `json:"unloaded"` | ||
| 53 | + Skipped []string `json:"skipped"` | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +// UnloadAll has every running agent that offers /unload unload its model. | ||
| 57 | +// Stopped agents are not counted; running agents that are answering or | ||
| 58 | +// cannot unload are skipped. | ||
| 59 | +func (s *AgentService) UnloadAll(ctx context.Context) UnloadResult { | ||
| 60 | + result := UnloadResult{Unloaded: []string{}, Skipped: []string{}} | ||
| 61 | + for _, status := range s.Core.manager.Statuses() { | ||
| 62 | + if status.State != agents.StateReady && status.State != agents.StateBusy { | ||
| 63 | + continue | ||
| 64 | + } | ||
| 65 | + if err := s.Unload(ctx, status.Name); err != nil { | ||
| 66 | + result.Skipped = append(result.Skipped, status.Name) | ||
| 67 | + continue | ||
| 68 | + } | ||
| 69 | + result.Unloaded = append(result.Unloaded, status.Name) | ||
| 70 | + } | ||
| 71 | + return result | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +func (c *Core) status(name string) (agents.Status, bool) { | ||
| 75 | + for _, status := range c.manager.Statuses() { | ||
| 76 | + if status.Name == name { | ||
| 77 | + return status, true | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + return agents.Status{}, false | ||
| 81 | +} | ||
added
internal/app/unload_test.go +100 -0 | new file mode 100644 | ||
| @@ -0,0 +1,100 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package app_test | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "path/filepath" | |
| 9 | + "slices" | |
| 10 | + "testing" | |
| 11 | + | |
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | |
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | |
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | |
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | |
| 16 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | |
| 17 | +) | |
| 18 | + | |
| 19 | +// unloadingConn announces the unload command, like mm, and answers it. | |
| 20 | +type unloadingConn struct{ conn } | |
| 21 | + | |
| 22 | +func (c *unloadingConn) NewSession(_ context.Context, _ string, handler acp.SessionHandler) (string, error) { | |
| 23 | + c.handler = handler | |
| 24 | + handler.Update(acp.Update{Kind: acp.UpdateCommands, Commands: []acp.Command{{Name: "compact"}, {Name: "unload"}}}) | |
| 25 | + return "s-1", nil | |
| 26 | +} | |
| 27 | + | |
| 28 | +func (c *unloadingConn) Prompt(_ context.Context, _ string, text string, _ ...acp.Attachment) (acp.TurnResult, error) { | |
| 29 | + answer := "ok" | |
| 30 | + if text == "/unload" { | |
| 31 | + answer = "unloaded: gemma" | |
| 32 | + } | |
| 33 | + c.handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer}) | |
| 34 | + return acp.TurnResult{StopReason: "end_turn"}, nil | |
| 35 | +} | |
| 36 | + | |
| 37 | +// unloadCore has three agents: alice and bob can unload their model, carol | |
| 38 | +// cannot. | |
| 39 | +func unloadCore(t *testing.T) (*app.AgentService, *app.ChannelService) { | |
| 40 | + t.Helper() | |
| 41 | + path := filepath.Join(t.TempDir(), "config.yaml") | |
| 42 | + write(t, path, "version: 1\nagents:\n - name: alice\n command: sh\n - name: bob\n command: sh\n - name: carol\n command: sh\n") | |
| 43 | + start := func(_ context.Context, spec acp.Spec, _ func(string)) (agents.Conn, error) { | |
| 44 | + if spec.Name == "carol" { | |
| 45 | + return &conn{done: make(chan struct{})}, nil | |
| 46 | + } | |
| 47 | + return &unloadingConn{conn{done: make(chan struct{})}}, nil | |
| 48 | + } | |
| 49 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: start}) | |
| 50 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | |
| 51 | + return &app.AgentService{Core: core}, &app.ChannelService{Core: core} | |
| 52 | +} | |
| 53 | + | |
| 54 | +// announce opens the direct conversation of each agent, which has it | |
| 55 | +// announce its commands. | |
| 56 | +func announce(t *testing.T, chat *app.ChannelService, names ...string) { | |
| 57 | + t.Helper() | |
| 58 | + for _, name := range names { | |
| 59 | + direct, err := chat.Direct(name) | |
| 60 | + if err != nil { | |
| 61 | + t.Fatal(err) | |
| 62 | + } | |
| 63 | + if err := chat.Prepare(context.Background(), direct.ID); err != nil { | |
| 64 | + t.Fatal(err) | |
| 65 | + } | |
| 66 | + } | |
| 67 | +} | |
| 68 | + | |
| 69 | +func TestUnloadAsksARunningAgentAndLogsItsAnswer(t *testing.T) { | |
| 70 | + service, chat := unloadCore(t) | |
| 71 | + ctx := context.Background() | |
| 72 | + if err := service.Unload(ctx, "nobody"); !errors.Is(err, agents.ErrUnknownAgent) { | |
| 73 | + t.Fatalf("unknown agent: %v", err) | |
| 74 | + } | |
| 75 | + if err := service.Unload(ctx, "alice"); !errors.Is(err, app.ErrNotRunning) { | |
| 76 | + t.Fatalf("a stopped agent has nothing to unload: %v", err) | |
| 77 | + } | |
| 78 | + announce(t, chat, "alice", "carol") | |
| 79 | + if err := service.Unload(ctx, "alice"); err != nil { | |
| 80 | + t.Fatal(err) | |
| 81 | + } | |
| 82 | + if logs, _ := service.Logs("alice"); !slices.Contains(logs, "unload: unloaded: gemma") { | |
| 83 | + t.Fatalf("the answer goes to the log: %q", logs) | |
| 84 | + } | |
| 85 | + if err := service.Unload(ctx, "carol"); !errors.Is(err, channels.ErrCannotUnload) { | |
| 86 | + t.Fatalf("carol offers no /unload: %v", err) | |
| 87 | + } | |
| 88 | +} | |
| 89 | + | |
| 90 | +func TestUnloadAllUnloadsTheRunningAgentsThatCan(t *testing.T) { | |
| 91 | + service, chat := unloadCore(t) | |
| 92 | + announce(t, chat, "alice", "carol") // bob stays stopped | |
| 93 | + result := service.UnloadAll(context.Background()) | |
| 94 | + if !slices.Equal(result.Unloaded, []string{"alice"}) || !slices.Equal(result.Skipped, []string{"carol"}) { | |
| 95 | + t.Fatalf("got %+v", result) | |
| 96 | + } | |
| 97 | + if service.List()[1].State != agents.StateStopped { | |
| 98 | + t.Fatal("bob is not started to be unloaded") | |
| 99 | + } | |
| 100 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package app_test | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "path/filepath" | ||
| 9 | + "slices" | ||
| 10 | + "testing" | ||
| 11 | + | ||
| 12 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | ||
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/agents" | ||
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | ||
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | ||
| 16 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | ||
| 17 | +) | ||
| 18 | + | ||
| 19 | +// unloadingConn announces the unload command, like mm, and answers it. | ||
| 20 | +type unloadingConn struct{ conn } | ||
| 21 | + | ||
| 22 | +func (c *unloadingConn) NewSession(_ context.Context, _ string, handler acp.SessionHandler) (string, error) { | ||
| 23 | + c.handler = handler | ||
| 24 | + handler.Update(acp.Update{Kind: acp.UpdateCommands, Commands: []acp.Command{{Name: "compact"}, {Name: "unload"}}}) | ||
| 25 | + return "s-1", nil | ||
| 26 | +} | ||
| 27 | + | ||
| 28 | +func (c *unloadingConn) Prompt(_ context.Context, _ string, text string, _ ...acp.Attachment) (acp.TurnResult, error) { | ||
| 29 | + answer := "ok" | ||
| 30 | + if text == "/unload" { | ||
| 31 | + answer = "unloaded: gemma" | ||
| 32 | + } | ||
| 33 | + c.handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer}) | ||
| 34 | + return acp.TurnResult{StopReason: "end_turn"}, nil | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +// unloadCore has three agents: alice and bob can unload their model, carol | ||
| 38 | +// cannot. | ||
| 39 | +func unloadCore(t *testing.T) (*app.AgentService, *app.ChannelService) { | ||
| 40 | + t.Helper() | ||
| 41 | + path := filepath.Join(t.TempDir(), "config.yaml") | ||
| 42 | + write(t, path, "version: 1\nagents:\n - name: alice\n command: sh\n - name: bob\n command: sh\n - name: carol\n command: sh\n") | ||
| 43 | + start := func(_ context.Context, spec acp.Spec, _ func(string)) (agents.Conn, error) { | ||
| 44 | + if spec.Name == "carol" { | ||
| 45 | + return &conn{done: make(chan struct{})}, nil | ||
| 46 | + } | ||
| 47 | + return &unloadingConn{conn{done: make(chan struct{})}}, nil | ||
| 48 | + } | ||
| 49 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: start}) | ||
| 50 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | ||
| 51 | + return &app.AgentService{Core: core}, &app.ChannelService{Core: core} | ||
| 52 | +} | ||
| 53 | + | ||
| 54 | +// announce opens the direct conversation of each agent, which has it | ||
| 55 | +// announce its commands. | ||
| 56 | +func announce(t *testing.T, chat *app.ChannelService, names ...string) { | ||
| 57 | + t.Helper() | ||
| 58 | + for _, name := range names { | ||
| 59 | + direct, err := chat.Direct(name) | ||
| 60 | + if err != nil { | ||
| 61 | + t.Fatal(err) | ||
| 62 | + } | ||
| 63 | + if err := chat.Prepare(context.Background(), direct.ID); err != nil { | ||
| 64 | + t.Fatal(err) | ||
| 65 | + } | ||
| 66 | + } | ||
| 67 | +} | ||
| 68 | + | ||
| 69 | +func TestUnloadAsksARunningAgentAndLogsItsAnswer(t *testing.T) { | ||
| 70 | + service, chat := unloadCore(t) | ||
| 71 | + ctx := context.Background() | ||
| 72 | + if err := service.Unload(ctx, "nobody"); !errors.Is(err, agents.ErrUnknownAgent) { | ||
| 73 | + t.Fatalf("unknown agent: %v", err) | ||
| 74 | + } | ||
| 75 | + if err := service.Unload(ctx, "alice"); !errors.Is(err, app.ErrNotRunning) { | ||
| 76 | + t.Fatalf("a stopped agent has nothing to unload: %v", err) | ||
| 77 | + } | ||
| 78 | + announce(t, chat, "alice", "carol") | ||
| 79 | + if err := service.Unload(ctx, "alice"); err != nil { | ||
| 80 | + t.Fatal(err) | ||
| 81 | + } | ||
| 82 | + if logs, _ := service.Logs("alice"); !slices.Contains(logs, "unload: unloaded: gemma") { | ||
| 83 | + t.Fatalf("the answer goes to the log: %q", logs) | ||
| 84 | + } | ||
| 85 | + if err := service.Unload(ctx, "carol"); !errors.Is(err, channels.ErrCannotUnload) { | ||
| 86 | + t.Fatalf("carol offers no /unload: %v", err) | ||
| 87 | + } | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +func TestUnloadAllUnloadsTheRunningAgentsThatCan(t *testing.T) { | ||
| 91 | + service, chat := unloadCore(t) | ||
| 92 | + announce(t, chat, "alice", "carol") // bob stays stopped | ||
| 93 | + result := service.UnloadAll(context.Background()) | ||
| 94 | + if !slices.Equal(result.Unloaded, []string{"alice"}) || !slices.Equal(result.Skipped, []string{"carol"}) { | ||
| 95 | + t.Fatalf("got %+v", result) | ||
| 96 | + } | ||
| 97 | + if service.List()[1].State != agents.StateStopped { | ||
| 98 | + t.Fatal("bob is not started to be unloaded") | ||
| 99 | + } | ||
| 100 | +} | ||
modified
internal/app/workspaces.go +142 -1 | @@ -64,6 +64,9 @@ type WorkspaceService struct { | ||
| 64 | 64 | type WorkspaceInfo struct { |
| 65 | 65 | Location string `json:"location"` |
| 66 | 66 | Problem string `json:"problem"` |
| 67 | + // Revealable tells whether the folder is on this computer, so that its | |
| 68 | + // files can be shown in the Finder or the Explorer (issue #74). | |
| 69 | + Revealable bool `json:"revealable"` | |
| 67 | 70 | } |
| 68 | 71 | |
| 69 | 72 | // SaveResult is the outcome of a save: the new file, or a conflict when the |
| @@ -79,7 +82,9 @@ func (s *WorkspaceService) Info(agent string) WorkspaceInfo { | ||
| 79 | 82 | if err != nil { |
| 80 | 83 | return WorkspaceInfo{Problem: err.Error()} |
| 81 | 84 | } |
| 82 | - return WorkspaceInfo{Location: ws.Location()} | |
| 85 | + definition, _ := s.Core.manager.Definition(agent) | |
| 86 | + _, hostErr := hostFile(definition, "") | |
| 87 | + return WorkspaceInfo{Location: ws.Location(), Revealable: hostErr == nil} | |
| 83 | 88 | } |
| 84 | 89 | |
| 85 | 90 | // List returns the entries of a folder of the agent ("" for its root), |
| @@ -164,6 +169,142 @@ func (s *WorkspaceService) Remove(ctx context.Context, agent, file string) error | ||
| 164 | 169 | return ws.Remove(ctx, file) |
| 165 | 170 | } |
| 166 | 171 | |
| 172 | +// RemoveAll removes several files and folders at once (issue #70). Nothing | |
| 173 | +// is removed when one of them is protected, or holds a protected file. | |
| 174 | +func (s *WorkspaceService) RemoveAll(ctx context.Context, agent string, files []string) error { | |
| 175 | + ws, err := s.Core.workspaceOf(agent) | |
| 176 | + if err != nil { | |
| 177 | + return err | |
| 178 | + } | |
| 179 | + outermost, err := workspace.Outermost(files) | |
| 180 | + if err != nil { | |
| 181 | + return err | |
| 182 | + } | |
| 183 | + protection := s.Core.protectionOf(agent) | |
| 184 | + for _, file := range outermost { | |
| 185 | + if protection.Blocks(file) { | |
| 186 | + return fmt.Errorf("%s: %w", file, workspace.ErrProtected) | |
| 187 | + } | |
| 188 | + } | |
| 189 | + for _, file := range outermost { | |
| 190 | + if err := ws.Remove(ctx, file); err != nil && !errors.Is(err, workspace.ErrNotFound) { | |
| 191 | + return fmt.Errorf("%s: %w", file, err) | |
| 192 | + } | |
| 193 | + } | |
| 194 | + return nil | |
| 195 | +} | |
| 196 | + | |
| 197 | +// Rename renames a file or a folder, or moves it when to is in another | |
| 198 | +// folder (issue #70); it returns the new path. A protected file, a folder | |
| 199 | +// that holds one, or a protected new path is refused. | |
| 200 | +func (s *WorkspaceService) Rename(ctx context.Context, agent, from, to string) (string, error) { | |
| 201 | + ws, err := s.Core.workspaceOf(agent) | |
| 202 | + if err != nil { | |
| 203 | + return "", err | |
| 204 | + } | |
| 205 | + target, err := workspace.Clean(to) | |
| 206 | + if err != nil { | |
| 207 | + return "", err | |
| 208 | + } | |
| 209 | + protection := s.Core.protectionOf(agent) | |
| 210 | + if protection.Blocks(from) || protection.Protects(target) { | |
| 211 | + return "", workspace.ErrProtected | |
| 212 | + } | |
| 213 | + return target, ws.Rename(ctx, from, target) | |
| 214 | +} | |
| 215 | + | |
| 216 | +// Move moves files and folders into folder dir ("" for the root), keeping | |
| 217 | +// their names (issue #70), and returns their new paths. It stops at the | |
| 218 | +// first one that cannot move: those before it have moved. | |
| 219 | +func (s *WorkspaceService) Move(ctx context.Context, agent string, files []string, dir string) ([]string, error) { | |
| 220 | + outermost, err := workspace.Outermost(files) | |
| 221 | + if err != nil { | |
| 222 | + return nil, err | |
| 223 | + } | |
| 224 | + folder, err := workspace.Clean(dir) | |
| 225 | + if err != nil { | |
| 226 | + return nil, err | |
| 227 | + } | |
| 228 | + moved := []string{} | |
| 229 | + for _, file := range outermost { | |
| 230 | + if parent := path.Dir(file); parent == folder || (parent == "." && folder == "") { | |
| 231 | + moved = append(moved, file) // already there | |
| 232 | + continue | |
| 233 | + } | |
| 234 | + target, err := s.Rename(ctx, agent, file, path.Join(folder, path.Base(file))) | |
| 235 | + if err != nil { | |
| 236 | + return moved, fmt.Errorf("%s: %w", file, err) | |
| 237 | + } | |
| 238 | + moved = append(moved, target) | |
| 239 | + } | |
| 240 | + return moved, nil | |
| 241 | +} | |
| 242 | + | |
| 243 | +// Duplicate copies files and folders next to themselves, under a free name | |
| 244 | +// with "-copy" before the extension (plan.md → plan-copy.md, then | |
| 245 | +// plan-copy-2.md…), and returns the paths of the copies (issue #70). A | |
| 246 | +// protected file may be duplicated; a copy whose path would be protected is | |
| 247 | +// refused. It stops at the first that cannot be copied. | |
| 248 | +func (s *WorkspaceService) Duplicate(ctx context.Context, agent string, files []string) ([]string, error) { | |
| 249 | + ws, err := s.Core.workspaceOf(agent) | |
| 250 | + if err != nil { | |
| 251 | + return nil, err | |
| 252 | + } | |
| 253 | + outermost, err := workspace.Outermost(files) | |
| 254 | + if err != nil { | |
| 255 | + return nil, err | |
| 256 | + } | |
| 257 | + protection := s.Core.protectionOf(agent) | |
| 258 | + copies := []string{} | |
| 259 | + for _, file := range outermost { | |
| 260 | + if file == "" { | |
| 261 | + return copies, workspace.ErrOutside // never the whole folder | |
| 262 | + } | |
| 263 | + parent := path.Dir(file) | |
| 264 | + if parent == "." { | |
| 265 | + parent = "" | |
| 266 | + } | |
| 267 | + entries, err := ws.List(ctx, parent) | |
| 268 | + if err != nil { | |
| 269 | + return copies, fmt.Errorf("%s: %w", file, err) | |
| 270 | + } | |
| 271 | + taken := map[string]bool{} | |
| 272 | + for _, entry := range entries { | |
| 273 | + taken[entry.Name] = true | |
| 274 | + } | |
| 275 | + name := workspace.FreeName(workspace.CopyName(path.Base(file)), func(candidate string) bool { return taken[candidate] }) | |
| 276 | + target := path.Join(parent, name) | |
| 277 | + if protection.Protects(target) { | |
| 278 | + return copies, fmt.Errorf("%s: %w", target, workspace.ErrProtected) | |
| 279 | + } | |
| 280 | + if err := ws.Copy(ctx, file, target); err != nil { | |
| 281 | + return copies, fmt.Errorf("%s: %w", file, err) | |
| 282 | + } | |
| 283 | + copies = append(copies, target) | |
| 284 | + } | |
| 285 | + return copies, nil | |
| 286 | +} | |
| 287 | + | |
| 288 | +// CreateFolder creates an empty folder called name in folder dir and | |
| 289 | +// returns its path (issue #70). | |
| 290 | +func (s *WorkspaceService) CreateFolder(ctx context.Context, agent, dir, name string) (string, error) { | |
| 291 | + ws, err := s.Core.workspaceOf(agent) | |
| 292 | + if err != nil { | |
| 293 | + return "", err | |
| 294 | + } | |
| 295 | + if name == "" || path.Base(name) != name || name == "." || name == ".." { | |
| 296 | + return "", errors.New("a folder name cannot be empty nor contain /") | |
| 297 | + } | |
| 298 | + folder, err := workspace.Clean(path.Join(dir, name)) | |
| 299 | + if err != nil { | |
| 300 | + return "", err | |
| 301 | + } | |
| 302 | + if s.Core.protectionOf(agent).Protects(folder) { | |
| 303 | + return "", workspace.ErrProtected | |
| 304 | + } | |
| 305 | + return folder, ws.MakeDir(ctx, folder) | |
| 306 | +} | |
| 307 | + | |
| 167 | 308 | // Watch follows the changes of the agent's folder, announced by |
| 168 | 309 | // workspace:changed events, until Unwatch or another Watch. |
| 169 | 310 | func (s *WorkspaceService) Watch(agent string) error { |
| @@ -64,6 +64,9 @@ type WorkspaceService struct { | |||
| 64 | type WorkspaceInfo struct { | 64 | type WorkspaceInfo struct { |
| 65 | Location string `json:"location"` | 65 | Location string `json:"location"` |
| 66 | Problem string `json:"problem"` | 66 | Problem string `json:"problem"` |
| 67 | + // Revealable tells whether the folder is on this computer, so that its | ||
| 68 | + // files can be shown in the Finder or the Explorer (issue #74). | ||
| 69 | + Revealable bool `json:"revealable"` | ||
| 67 | } | 70 | } |
| 68 | 71 | ||
| 69 | // SaveResult is the outcome of a save: the new file, or a conflict when the | 72 | // SaveResult is the outcome of a save: the new file, or a conflict when the |
| @@ -79,7 +82,9 @@ func (s *WorkspaceService) Info(agent string) WorkspaceInfo { | |||
| 79 | if err != nil { | 82 | if err != nil { |
| 80 | return WorkspaceInfo{Problem: err.Error()} | 83 | return WorkspaceInfo{Problem: err.Error()} |
| 81 | } | 84 | } |
| 82 | - return WorkspaceInfo{Location: ws.Location()} | 85 | + definition, _ := s.Core.manager.Definition(agent) |
| 86 | + _, hostErr := hostFile(definition, "") | ||
| 87 | + return WorkspaceInfo{Location: ws.Location(), Revealable: hostErr == nil} | ||
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | // List returns the entries of a folder of the agent ("" for its root), | 90 | // List returns the entries of a folder of the agent ("" for its root), |
| @@ -164,6 +169,142 @@ func (s *WorkspaceService) Remove(ctx context.Context, agent, file string) error | |||
| 164 | return ws.Remove(ctx, file) | 169 | return ws.Remove(ctx, file) |
| 165 | } | 170 | } |
| 166 | 171 | ||
| 172 | +// RemoveAll removes several files and folders at once (issue #70). Nothing | ||
| 173 | +// is removed when one of them is protected, or holds a protected file. | ||
| 174 | +func (s *WorkspaceService) RemoveAll(ctx context.Context, agent string, files []string) error { | ||
| 175 | + ws, err := s.Core.workspaceOf(agent) | ||
| 176 | + if err != nil { | ||
| 177 | + return err | ||
| 178 | + } | ||
| 179 | + outermost, err := workspace.Outermost(files) | ||
| 180 | + if err != nil { | ||
| 181 | + return err | ||
| 182 | + } | ||
| 183 | + protection := s.Core.protectionOf(agent) | ||
| 184 | + for _, file := range outermost { | ||
| 185 | + if protection.Blocks(file) { | ||
| 186 | + return fmt.Errorf("%s: %w", file, workspace.ErrProtected) | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + for _, file := range outermost { | ||
| 190 | + if err := ws.Remove(ctx, file); err != nil && !errors.Is(err, workspace.ErrNotFound) { | ||
| 191 | + return fmt.Errorf("%s: %w", file, err) | ||
| 192 | + } | ||
| 193 | + } | ||
| 194 | + return nil | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +// Rename renames a file or a folder, or moves it when to is in another | ||
| 198 | +// folder (issue #70); it returns the new path. A protected file, a folder | ||
| 199 | +// that holds one, or a protected new path is refused. | ||
| 200 | +func (s *WorkspaceService) Rename(ctx context.Context, agent, from, to string) (string, error) { | ||
| 201 | + ws, err := s.Core.workspaceOf(agent) | ||
| 202 | + if err != nil { | ||
| 203 | + return "", err | ||
| 204 | + } | ||
| 205 | + target, err := workspace.Clean(to) | ||
| 206 | + if err != nil { | ||
| 207 | + return "", err | ||
| 208 | + } | ||
| 209 | + protection := s.Core.protectionOf(agent) | ||
| 210 | + if protection.Blocks(from) || protection.Protects(target) { | ||
| 211 | + return "", workspace.ErrProtected | ||
| 212 | + } | ||
| 213 | + return target, ws.Rename(ctx, from, target) | ||
| 214 | +} | ||
| 215 | + | ||
| 216 | +// Move moves files and folders into folder dir ("" for the root), keeping | ||
| 217 | +// their names (issue #70), and returns their new paths. It stops at the | ||
| 218 | +// first one that cannot move: those before it have moved. | ||
| 219 | +func (s *WorkspaceService) Move(ctx context.Context, agent string, files []string, dir string) ([]string, error) { | ||
| 220 | + outermost, err := workspace.Outermost(files) | ||
| 221 | + if err != nil { | ||
| 222 | + return nil, err | ||
| 223 | + } | ||
| 224 | + folder, err := workspace.Clean(dir) | ||
| 225 | + if err != nil { | ||
| 226 | + return nil, err | ||
| 227 | + } | ||
| 228 | + moved := []string{} | ||
| 229 | + for _, file := range outermost { | ||
| 230 | + if parent := path.Dir(file); parent == folder || (parent == "." && folder == "") { | ||
| 231 | + moved = append(moved, file) // already there | ||
| 232 | + continue | ||
| 233 | + } | ||
| 234 | + target, err := s.Rename(ctx, agent, file, path.Join(folder, path.Base(file))) | ||
| 235 | + if err != nil { | ||
| 236 | + return moved, fmt.Errorf("%s: %w", file, err) | ||
| 237 | + } | ||
| 238 | + moved = append(moved, target) | ||
| 239 | + } | ||
| 240 | + return moved, nil | ||
| 241 | +} | ||
| 242 | + | ||
| 243 | +// Duplicate copies files and folders next to themselves, under a free name | ||
| 244 | +// with "-copy" before the extension (plan.md → plan-copy.md, then | ||
| 245 | +// plan-copy-2.md…), and returns the paths of the copies (issue #70). A | ||
| 246 | +// protected file may be duplicated; a copy whose path would be protected is | ||
| 247 | +// refused. It stops at the first that cannot be copied. | ||
| 248 | +func (s *WorkspaceService) Duplicate(ctx context.Context, agent string, files []string) ([]string, error) { | ||
| 249 | + ws, err := s.Core.workspaceOf(agent) | ||
| 250 | + if err != nil { | ||
| 251 | + return nil, err | ||
| 252 | + } | ||
| 253 | + outermost, err := workspace.Outermost(files) | ||
| 254 | + if err != nil { | ||
| 255 | + return nil, err | ||
| 256 | + } | ||
| 257 | + protection := s.Core.protectionOf(agent) | ||
| 258 | + copies := []string{} | ||
| 259 | + for _, file := range outermost { | ||
| 260 | + if file == "" { | ||
| 261 | + return copies, workspace.ErrOutside // never the whole folder | ||
| 262 | + } | ||
| 263 | + parent := path.Dir(file) | ||
| 264 | + if parent == "." { | ||
| 265 | + parent = "" | ||
| 266 | + } | ||
| 267 | + entries, err := ws.List(ctx, parent) | ||
| 268 | + if err != nil { | ||
| 269 | + return copies, fmt.Errorf("%s: %w", file, err) | ||
| 270 | + } | ||
| 271 | + taken := map[string]bool{} | ||
| 272 | + for _, entry := range entries { | ||
| 273 | + taken[entry.Name] = true | ||
| 274 | + } | ||
| 275 | + name := workspace.FreeName(workspace.CopyName(path.Base(file)), func(candidate string) bool { return taken[candidate] }) | ||
| 276 | + target := path.Join(parent, name) | ||
| 277 | + if protection.Protects(target) { | ||
| 278 | + return copies, fmt.Errorf("%s: %w", target, workspace.ErrProtected) | ||
| 279 | + } | ||
| 280 | + if err := ws.Copy(ctx, file, target); err != nil { | ||
| 281 | + return copies, fmt.Errorf("%s: %w", file, err) | ||
| 282 | + } | ||
| 283 | + copies = append(copies, target) | ||
| 284 | + } | ||
| 285 | + return copies, nil | ||
| 286 | +} | ||
| 287 | + | ||
| 288 | +// CreateFolder creates an empty folder called name in folder dir and | ||
| 289 | +// returns its path (issue #70). | ||
| 290 | +func (s *WorkspaceService) CreateFolder(ctx context.Context, agent, dir, name string) (string, error) { | ||
| 291 | + ws, err := s.Core.workspaceOf(agent) | ||
| 292 | + if err != nil { | ||
| 293 | + return "", err | ||
| 294 | + } | ||
| 295 | + if name == "" || path.Base(name) != name || name == "." || name == ".." { | ||
| 296 | + return "", errors.New("a folder name cannot be empty nor contain /") | ||
| 297 | + } | ||
| 298 | + folder, err := workspace.Clean(path.Join(dir, name)) | ||
| 299 | + if err != nil { | ||
| 300 | + return "", err | ||
| 301 | + } | ||
| 302 | + if s.Core.protectionOf(agent).Protects(folder) { | ||
| 303 | + return "", workspace.ErrProtected | ||
| 304 | + } | ||
| 305 | + return folder, ws.MakeDir(ctx, folder) | ||
| 306 | +} | ||
| 307 | + | ||
| 167 | // Watch follows the changes of the agent's folder, announced by | 308 | // Watch follows the changes of the agent's folder, announced by |
| 168 | // workspace:changed events, until Unwatch or another Watch. | 309 | // workspace:changed events, until Unwatch or another Watch. |
| 169 | func (s *WorkspaceService) Watch(agent string) error { | 310 | func (s *WorkspaceService) Watch(agent string) error { |
modified
internal/channels/channels.go +16 -1 | @@ -66,8 +66,16 @@ const ( | ||
| 66 | 66 | // CodeAttachmentUnavailable: a file joined with $ could not be sent to |
| 67 | 67 | // the agent (Agent); Error names the file and says why. |
| 68 | 68 | CodeAttachmentUnavailable = "attachment-unavailable" |
| 69 | + // CodeHandoffLimit: an agent (Agent) addressed another one, but the | |
| 70 | + // message was already handed from agent to agent as many times as | |
| 71 | + // allowed (Options.Handoffs); the chain stops there. | |
| 72 | + CodeHandoffLimit = "handoff-limit" | |
| 69 | 73 | ) |
| 70 | 74 | |
| 75 | +// DefaultHandoffs is how many times the agents may hand one message on to | |
| 76 | +// each other with @name, unless Options.Handoffs says otherwise. | |
| 77 | +const DefaultHandoffs = 3 | |
| 78 | + | |
| 71 | 79 | // How many messages a channel loads when it is opened; older ones are paged |
| 72 | 80 | // with Older. |
| 73 | 81 | const pageSize = 100 |
| @@ -231,6 +239,11 @@ type Options struct { | ||
| 231 | 239 | // Files reads the files joined with $; nil sends none (their |
| 232 | 240 | // references stay in the text). |
| 233 | 241 | Files FileSource |
| 242 | + // Handoffs returns how many times, for one user message, an agent's | |
| 243 | + // answer may hand the floor to another member of the channel by | |
| 244 | + // mentioning it with @name (issue #26; limits.maxAgentHandoffs). It is | |
| 245 | + // read for each message; 0 turns hand-offs off. nil: DefaultHandoffs. | |
| 246 | + Handoffs func() int | |
| 234 | 247 | } |
| 235 | 248 | |
| 236 | 249 | // Manager holds the channels. It is safe for concurrent use. |
| @@ -240,6 +253,8 @@ type Manager struct { | ||
| 240 | 253 | emitter events.Emitter |
| 241 | 254 | now func() time.Time |
| 242 | 255 | files FileSource |
| 256 | + // handoffs: see Options.Handoffs. | |
| 257 | + handoffs func() int | |
| 243 | 258 | |
| 244 | 259 | mu sync.Mutex |
| 245 | 260 | channels map[string]*channel |
| @@ -301,7 +316,7 @@ func NewManager(source AgentSource, db *store.Store, options Options) (*Manager, | ||
| 301 | 316 | options.Now = time.Now |
| 302 | 317 | } |
| 303 | 318 | m := &Manager{ |
| 304 | - agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, | |
| 319 | + agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, handoffs: options.Handoffs, | |
| 305 | 320 | channels: map[string]*channel{}, permissions: map[string]*pendingPermission{}, |
| 306 | 321 | commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{}, |
| 307 | 322 | } |
| @@ -66,8 +66,16 @@ const ( | |||
| 66 | // CodeAttachmentUnavailable: a file joined with $ could not be sent to | 66 | // CodeAttachmentUnavailable: a file joined with $ could not be sent to |
| 67 | // the agent (Agent); Error names the file and says why. | 67 | // the agent (Agent); Error names the file and says why. |
| 68 | CodeAttachmentUnavailable = "attachment-unavailable" | 68 | CodeAttachmentUnavailable = "attachment-unavailable" |
| 69 | + // CodeHandoffLimit: an agent (Agent) addressed another one, but the | ||
| 70 | + // message was already handed from agent to agent as many times as | ||
| 71 | + // allowed (Options.Handoffs); the chain stops there. | ||
| 72 | + CodeHandoffLimit = "handoff-limit" | ||
| 69 | ) | 73 | ) |
| 70 | 74 | ||
| 75 | +// DefaultHandoffs is how many times the agents may hand one message on to | ||
| 76 | +// each other with @name, unless Options.Handoffs says otherwise. | ||
| 77 | +const DefaultHandoffs = 3 | ||
| 78 | + | ||
| 71 | // How many messages a channel loads when it is opened; older ones are paged | 79 | // How many messages a channel loads when it is opened; older ones are paged |
| 72 | // with Older. | 80 | // with Older. |
| 73 | const pageSize = 100 | 81 | const pageSize = 100 |
| @@ -231,6 +239,11 @@ type Options struct { | |||
| 231 | // Files reads the files joined with $; nil sends none (their | 239 | // Files reads the files joined with $; nil sends none (their |
| 232 | // references stay in the text). | 240 | // references stay in the text). |
| 233 | Files FileSource | 241 | Files FileSource |
| 242 | + // Handoffs returns how many times, for one user message, an agent's | ||
| 243 | + // answer may hand the floor to another member of the channel by | ||
| 244 | + // mentioning it with @name (issue #26; limits.maxAgentHandoffs). It is | ||
| 245 | + // read for each message; 0 turns hand-offs off. nil: DefaultHandoffs. | ||
| 246 | + Handoffs func() int | ||
| 234 | } | 247 | } |
| 235 | 248 | ||
| 236 | // Manager holds the channels. It is safe for concurrent use. | 249 | // Manager holds the channels. It is safe for concurrent use. |
| @@ -240,6 +253,8 @@ type Manager struct { | |||
| 240 | emitter events.Emitter | 253 | emitter events.Emitter |
| 241 | now func() time.Time | 254 | now func() time.Time |
| 242 | files FileSource | 255 | files FileSource |
| 256 | + // handoffs: see Options.Handoffs. | ||
| 257 | + handoffs func() int | ||
| 243 | 258 | ||
| 244 | mu sync.Mutex | 259 | mu sync.Mutex |
| 245 | channels map[string]*channel | 260 | channels map[string]*channel |
| @@ -301,7 +316,7 @@ func NewManager(source AgentSource, db *store.Store, options Options) (*Manager, | |||
| 301 | options.Now = time.Now | 316 | options.Now = time.Now |
| 302 | } | 317 | } |
| 303 | m := &Manager{ | 318 | m := &Manager{ |
| 304 | - agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, | 319 | + agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, handoffs: options.Handoffs, |
| 305 | channels: map[string]*channel{}, permissions: map[string]*pendingPermission{}, | 320 | channels: map[string]*channel{}, permissions: map[string]*pendingPermission{}, |
| 306 | commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{}, | 321 | commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{}, |
| 307 | } | 322 | } |
modified
internal/channels/fakes_test.go +8 -1 | @@ -37,6 +37,8 @@ type fakeConn struct { | ||
| 37 | 37 | attachments [][]acp.Attachment |
| 38 | 38 | cancelled chan struct{} |
| 39 | 39 | scripts map[string]script |
| 40 | + // reply, when set, gives the answer to a prompt that has no script. | |
| 41 | + reply func(prompt string) string | |
| 40 | 42 | } |
| 41 | 43 | |
| 42 | 44 | func newFakeConn(agent string, scripts map[string]script) *fakeConn { |
| @@ -82,9 +84,14 @@ func (c *fakeConn) Prompt(ctx context.Context, sessionID string, text string, at | ||
| 82 | 84 | c.attachments = append(c.attachments, attachments) |
| 83 | 85 | handler := c.handlers[sessionID] |
| 84 | 86 | play := c.scripts[text] |
| 87 | + reply := c.reply | |
| 85 | 88 | c.mu.Unlock() |
| 86 | 89 | if play == nil { |
| 87 | - handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: c.agent + " ok"}) | |
| 90 | + answer := c.agent + " ok" | |
| 91 | + if reply != nil { | |
| 92 | + answer = reply(text) | |
| 93 | + } | |
| 94 | + handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer}) | |
| 88 | 95 | return acp.TurnResult{StopReason: "end_turn"}, nil |
| 89 | 96 | } |
| 90 | 97 | return play(withCancel(ctx, c.cancelled), handler) |
| @@ -37,6 +37,8 @@ type fakeConn struct { | |||
| 37 | attachments [][]acp.Attachment | 37 | attachments [][]acp.Attachment |
| 38 | cancelled chan struct{} | 38 | cancelled chan struct{} |
| 39 | scripts map[string]script | 39 | scripts map[string]script |
| 40 | + // reply, when set, gives the answer to a prompt that has no script. | ||
| 41 | + reply func(prompt string) string | ||
| 40 | } | 42 | } |
| 41 | 43 | ||
| 42 | func newFakeConn(agent string, scripts map[string]script) *fakeConn { | 44 | func newFakeConn(agent string, scripts map[string]script) *fakeConn { |
| @@ -82,9 +84,14 @@ func (c *fakeConn) Prompt(ctx context.Context, sessionID string, text string, at | |||
| 82 | c.attachments = append(c.attachments, attachments) | 84 | c.attachments = append(c.attachments, attachments) |
| 83 | handler := c.handlers[sessionID] | 85 | handler := c.handlers[sessionID] |
| 84 | play := c.scripts[text] | 86 | play := c.scripts[text] |
| 87 | + reply := c.reply | ||
| 85 | c.mu.Unlock() | 88 | c.mu.Unlock() |
| 86 | if play == nil { | 89 | if play == nil { |
| 87 | - handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: c.agent + " ok"}) | 90 | + answer := c.agent + " ok" |
| 91 | + if reply != nil { | ||
| 92 | + answer = reply(text) | ||
| 93 | + } | ||
| 94 | + handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer}) | ||
| 88 | return acp.TurnResult{StopReason: "end_turn"}, nil | 95 | return acp.TurnResult{StopReason: "end_turn"}, nil |
| 89 | } | 96 | } |
| 90 | return play(withCancel(ctx, c.cancelled), handler) | 97 | return play(withCancel(ctx, c.cancelled), handler) |
added
internal/channels/handoff_test.go +133 -0 | new file mode 100644 | ||
| @@ -0,0 +1,133 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package channels_test | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "strings" | |
| 7 | + "testing" | |
| 8 | + | |
| 9 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | |
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/events" | |
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/store" | |
| 12 | +) | |
| 13 | + | |
| 14 | +// Issue #26: an agent hands the floor to another member with @name. | |
| 15 | + | |
| 16 | +func setupHandoffs(t *testing.T, limit int) *fixture { | |
| 17 | + t.Helper() | |
| 18 | + db, err := store.OpenInMemory() | |
| 19 | + if err != nil { | |
| 20 | + t.Fatal(err) | |
| 21 | + } | |
| 22 | + t.Cleanup(func() { _ = db.Close() }) | |
| 23 | + source := newFakeSource(nil) | |
| 24 | + recorder := &events.Recorder{} | |
| 25 | + manager, err := channels.NewManager(source, db, channels.Options{Emitter: recorder, Handoffs: func() int { return limit }}) | |
| 26 | + if err != nil { | |
| 27 | + t.Fatal(err) | |
| 28 | + } | |
| 29 | + t.Cleanup(manager.Close) | |
| 30 | + return &fixture{manager: manager, source: source, db: db, recorder: recorder} | |
| 31 | +} | |
| 32 | + | |
| 33 | +func TestAnAgentMentioningAMemberHandsItTheFloor(t *testing.T) { | |
| 34 | + f := setup(t, nil) | |
| 35 | + general := f.channel(t, "general", "alice", "bob") | |
| 36 | + f.source.conn("alice").reply = func(string) string { return "Good question, @bob knows the trains." } | |
| 37 | + f.send(t, general.ID, "@alice how do I get to Lyon?") | |
| 38 | + view := f.idle(t, general.ID, 4) | |
| 39 | + if got := describe(view.Messages[len(view.Messages)-3:]); got != "user:::@alice how do I get to Lyon? | agent:alice::Good question, @bob knows the trains. | agent:bob::bob ok" { | |
| 40 | + t.Fatalf("bob answers after alice: %s", got) | |
| 41 | + } | |
| 42 | + sent := f.source.conn("bob").sent() | |
| 43 | + if len(sent) != 1 { | |
| 44 | + t.Fatalf("bob prompts: %q", sent) | |
| 45 | + } | |
| 46 | + for _, want := range []string{"user: @alice how do I get to Lyon?", "alice: Good question, @bob knows the trains.", "alice mentioned you (@bob) in its last message in #general"} { | |
| 47 | + if !strings.Contains(sent[0], want) { | |
| 48 | + t.Fatalf("bob's prompt lacks %q:\n%s", want, sent[0]) | |
| 49 | + } | |
| 50 | + } | |
| 51 | +} | |
| 52 | + | |
| 53 | +func TestOnlyOtherMembersMentionedOutsideCodeGetTheFloor(t *testing.T) { | |
| 54 | + f := setup(t, nil) | |
| 55 | + general := f.channel(t, "general", "alice", "bob") | |
| 56 | + // garfield is an agent but not a member; @alice is alice herself; @bob is in code. | |
| 57 | + f.source.conn("alice").reply = func(string) string { return "Ask @garfield, or me (@alice). Run `notify @bob`." } | |
| 58 | + f.send(t, general.ID, "@alice hi") | |
| 59 | + f.idle(t, general.ID, 3) | |
| 60 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | |
| 61 | + t.Fatalf("nobody gets the floor: bob got %q", sent) | |
| 62 | + } | |
| 63 | + if sent := f.source.conn("garfield").sent(); len(sent) != 0 { | |
| 64 | + t.Fatalf("garfield is not invited by an agent: %q", sent) | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +func TestAnAgentAlreadyAddressedByTheUserIsNotAskedTwice(t *testing.T) { | |
| 69 | + f := setup(t, nil) | |
| 70 | + general := f.channel(t, "general", "alice", "bob") | |
| 71 | + f.source.conn("alice").reply = func(string) string { return "@bob, your turn." } | |
| 72 | + f.send(t, general.ID, "@alice @bob hi") | |
| 73 | + f.idle(t, general.ID, 3) | |
| 74 | + if sent := f.source.conn("bob").sent(); len(sent) != 1 { | |
| 75 | + t.Fatalf("bob answers once: %q", sent) | |
| 76 | + } | |
| 77 | +} | |
| 78 | + | |
| 79 | +func TestTheHandoffsOfAMessageAreBounded(t *testing.T) { | |
| 80 | + f := setupHandoffs(t, 2) | |
| 81 | + general := f.channel(t, "general", "alice", "bob") | |
| 82 | + f.source.conn("alice").reply = func(string) string { return "@bob?" } | |
| 83 | + f.source.conn("bob").reply = func(string) string { return "@alice!" } | |
| 84 | + f.send(t, general.ID, "@alice start") | |
| 85 | + view := f.idle(t, general.ID, 5) | |
| 86 | + got := describe(view.Messages[len(view.Messages)-5:]) | |
| 87 | + if got != "user:::@alice start | agent:alice::@bob? | agent:bob::@alice! | agent:alice::@bob? | system:alice:handoff-limit:" { | |
| 88 | + t.Fatalf("two hand-offs, then the chain stops and says so: %s", got) | |
| 89 | + } | |
| 90 | + // The next message starts a new count. | |
| 91 | + f.send(t, general.ID, "@alice again") | |
| 92 | + f.idle(t, general.ID, 10) | |
| 93 | +} | |
| 94 | + | |
| 95 | +func TestHandoffsCanBeTurnedOff(t *testing.T) { | |
| 96 | + f := setupHandoffs(t, 0) | |
| 97 | + general := f.channel(t, "general", "alice", "bob") | |
| 98 | + f.source.conn("alice").reply = func(string) string { return "@bob?" } | |
| 99 | + f.send(t, general.ID, "@alice start") | |
| 100 | + view := f.idle(t, general.ID, 3) | |
| 101 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | |
| 102 | + t.Fatalf("bob stays silent: %q", sent) | |
| 103 | + } | |
| 104 | + if last := view.Messages[len(view.Messages)-1]; last.Role != channels.RoleAgent { | |
| 105 | + t.Fatalf("no system message when hand-offs are off: %s", describe(view.Messages)) | |
| 106 | + } | |
| 107 | +} | |
| 108 | + | |
| 109 | +func TestACommandIsNotHandedOn(t *testing.T) { | |
| 110 | + f := setup(t, nil) | |
| 111 | + general := f.channel(t, "general", "alice", "bob") | |
| 112 | + f.source.conn("alice").reply = func(string) string { return "@bob" } | |
| 113 | + f.send(t, general.ID, "@alice /compact") | |
| 114 | + f.idle(t, general.ID, 3) | |
| 115 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | |
| 116 | + t.Fatalf("a command's answer hands nothing on: %q", sent) | |
| 117 | + } | |
| 118 | +} | |
| 119 | + | |
| 120 | +func TestEachAddressedAgentReceivesItsPart(t *testing.T) { | |
| 121 | + f := setup(t, nil) | |
| 122 | + general := f.channel(t, "general", "alice", "bob") | |
| 123 | + f.source.conn("alice").reply = func(string) string { return "Once upon a time." } | |
| 124 | + f.send(t, general.ID, "@alice make a story about seven of nine, then @bob make a summary of this story") | |
| 125 | + f.idle(t, general.ID, 5) | |
| 126 | + if sent := f.source.conn("alice").sent(); len(sent) != 1 || sent[0] != "make a story about seven of nine" { | |
| 127 | + t.Fatalf("alice prompts: %q", sent) | |
| 128 | + } | |
| 129 | + sent := f.source.conn("bob").sent() | |
| 130 | + if len(sent) != 1 || !strings.Contains(sent[0], "alice: Once upon a time.\n") || !strings.HasSuffix(sent[0], "The user now writes to you (answer directly, without your name in front):\nmake a summary of this story") { | |
| 131 | + t.Fatalf("bob prompts: %q", sent) | |
| 132 | + } | |
| 133 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,133 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package channels_test | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "strings" | ||
| 7 | + "testing" | ||
| 8 | + | ||
| 9 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | ||
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/events" | ||
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/store" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +// Issue #26: an agent hands the floor to another member with @name. | ||
| 15 | + | ||
| 16 | +func setupHandoffs(t *testing.T, limit int) *fixture { | ||
| 17 | + t.Helper() | ||
| 18 | + db, err := store.OpenInMemory() | ||
| 19 | + if err != nil { | ||
| 20 | + t.Fatal(err) | ||
| 21 | + } | ||
| 22 | + t.Cleanup(func() { _ = db.Close() }) | ||
| 23 | + source := newFakeSource(nil) | ||
| 24 | + recorder := &events.Recorder{} | ||
| 25 | + manager, err := channels.NewManager(source, db, channels.Options{Emitter: recorder, Handoffs: func() int { return limit }}) | ||
| 26 | + if err != nil { | ||
| 27 | + t.Fatal(err) | ||
| 28 | + } | ||
| 29 | + t.Cleanup(manager.Close) | ||
| 30 | + return &fixture{manager: manager, source: source, db: db, recorder: recorder} | ||
| 31 | +} | ||
| 32 | + | ||
| 33 | +func TestAnAgentMentioningAMemberHandsItTheFloor(t *testing.T) { | ||
| 34 | + f := setup(t, nil) | ||
| 35 | + general := f.channel(t, "general", "alice", "bob") | ||
| 36 | + f.source.conn("alice").reply = func(string) string { return "Good question, @bob knows the trains." } | ||
| 37 | + f.send(t, general.ID, "@alice how do I get to Lyon?") | ||
| 38 | + view := f.idle(t, general.ID, 4) | ||
| 39 | + if got := describe(view.Messages[len(view.Messages)-3:]); got != "user:::@alice how do I get to Lyon? | agent:alice::Good question, @bob knows the trains. | agent:bob::bob ok" { | ||
| 40 | + t.Fatalf("bob answers after alice: %s", got) | ||
| 41 | + } | ||
| 42 | + sent := f.source.conn("bob").sent() | ||
| 43 | + if len(sent) != 1 { | ||
| 44 | + t.Fatalf("bob prompts: %q", sent) | ||
| 45 | + } | ||
| 46 | + for _, want := range []string{"user: @alice how do I get to Lyon?", "alice: Good question, @bob knows the trains.", "alice mentioned you (@bob) in its last message in #general"} { | ||
| 47 | + if !strings.Contains(sent[0], want) { | ||
| 48 | + t.Fatalf("bob's prompt lacks %q:\n%s", want, sent[0]) | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +func TestOnlyOtherMembersMentionedOutsideCodeGetTheFloor(t *testing.T) { | ||
| 54 | + f := setup(t, nil) | ||
| 55 | + general := f.channel(t, "general", "alice", "bob") | ||
| 56 | + // garfield is an agent but not a member; @alice is alice herself; @bob is in code. | ||
| 57 | + f.source.conn("alice").reply = func(string) string { return "Ask @garfield, or me (@alice). Run `notify @bob`." } | ||
| 58 | + f.send(t, general.ID, "@alice hi") | ||
| 59 | + f.idle(t, general.ID, 3) | ||
| 60 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | ||
| 61 | + t.Fatalf("nobody gets the floor: bob got %q", sent) | ||
| 62 | + } | ||
| 63 | + if sent := f.source.conn("garfield").sent(); len(sent) != 0 { | ||
| 64 | + t.Fatalf("garfield is not invited by an agent: %q", sent) | ||
| 65 | + } | ||
| 66 | +} | ||
| 67 | + | ||
| 68 | +func TestAnAgentAlreadyAddressedByTheUserIsNotAskedTwice(t *testing.T) { | ||
| 69 | + f := setup(t, nil) | ||
| 70 | + general := f.channel(t, "general", "alice", "bob") | ||
| 71 | + f.source.conn("alice").reply = func(string) string { return "@bob, your turn." } | ||
| 72 | + f.send(t, general.ID, "@alice @bob hi") | ||
| 73 | + f.idle(t, general.ID, 3) | ||
| 74 | + if sent := f.source.conn("bob").sent(); len(sent) != 1 { | ||
| 75 | + t.Fatalf("bob answers once: %q", sent) | ||
| 76 | + } | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +func TestTheHandoffsOfAMessageAreBounded(t *testing.T) { | ||
| 80 | + f := setupHandoffs(t, 2) | ||
| 81 | + general := f.channel(t, "general", "alice", "bob") | ||
| 82 | + f.source.conn("alice").reply = func(string) string { return "@bob?" } | ||
| 83 | + f.source.conn("bob").reply = func(string) string { return "@alice!" } | ||
| 84 | + f.send(t, general.ID, "@alice start") | ||
| 85 | + view := f.idle(t, general.ID, 5) | ||
| 86 | + got := describe(view.Messages[len(view.Messages)-5:]) | ||
| 87 | + if got != "user:::@alice start | agent:alice::@bob? | agent:bob::@alice! | agent:alice::@bob? | system:alice:handoff-limit:" { | ||
| 88 | + t.Fatalf("two hand-offs, then the chain stops and says so: %s", got) | ||
| 89 | + } | ||
| 90 | + // The next message starts a new count. | ||
| 91 | + f.send(t, general.ID, "@alice again") | ||
| 92 | + f.idle(t, general.ID, 10) | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +func TestHandoffsCanBeTurnedOff(t *testing.T) { | ||
| 96 | + f := setupHandoffs(t, 0) | ||
| 97 | + general := f.channel(t, "general", "alice", "bob") | ||
| 98 | + f.source.conn("alice").reply = func(string) string { return "@bob?" } | ||
| 99 | + f.send(t, general.ID, "@alice start") | ||
| 100 | + view := f.idle(t, general.ID, 3) | ||
| 101 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | ||
| 102 | + t.Fatalf("bob stays silent: %q", sent) | ||
| 103 | + } | ||
| 104 | + if last := view.Messages[len(view.Messages)-1]; last.Role != channels.RoleAgent { | ||
| 105 | + t.Fatalf("no system message when hand-offs are off: %s", describe(view.Messages)) | ||
| 106 | + } | ||
| 107 | +} | ||
| 108 | + | ||
| 109 | +func TestACommandIsNotHandedOn(t *testing.T) { | ||
| 110 | + f := setup(t, nil) | ||
| 111 | + general := f.channel(t, "general", "alice", "bob") | ||
| 112 | + f.source.conn("alice").reply = func(string) string { return "@bob" } | ||
| 113 | + f.send(t, general.ID, "@alice /compact") | ||
| 114 | + f.idle(t, general.ID, 3) | ||
| 115 | + if sent := f.source.conn("bob").sent(); len(sent) != 0 { | ||
| 116 | + t.Fatalf("a command's answer hands nothing on: %q", sent) | ||
| 117 | + } | ||
| 118 | +} | ||
| 119 | + | ||
| 120 | +func TestEachAddressedAgentReceivesItsPart(t *testing.T) { | ||
| 121 | + f := setup(t, nil) | ||
| 122 | + general := f.channel(t, "general", "alice", "bob") | ||
| 123 | + f.source.conn("alice").reply = func(string) string { return "Once upon a time." } | ||
| 124 | + f.send(t, general.ID, "@alice make a story about seven of nine, then @bob make a summary of this story") | ||
| 125 | + f.idle(t, general.ID, 5) | ||
| 126 | + if sent := f.source.conn("alice").sent(); len(sent) != 1 || sent[0] != "make a story about seven of nine" { | ||
| 127 | + t.Fatalf("alice prompts: %q", sent) | ||
| 128 | + } | ||
| 129 | + sent := f.source.conn("bob").sent() | ||
| 130 | + if len(sent) != 1 || !strings.Contains(sent[0], "alice: Once upon a time.\n") || !strings.HasSuffix(sent[0], "The user now writes to you (answer directly, without your name in front):\nmake a summary of this story") { | ||
| 131 | + t.Fatalf("bob prompts: %q", sent) | ||
| 132 | + } | ||
| 133 | +} | ||
modified
internal/channels/route.go +65 -4 | @@ -5,6 +5,7 @@ package channels | ||
| 5 | 5 | import ( |
| 6 | 6 | "fmt" |
| 7 | 7 | "regexp" |
| 8 | + "slices" | |
| 8 | 9 | "strings" |
| 9 | 10 | ) |
| 10 | 11 | |
| @@ -21,6 +22,8 @@ var ( | ||
| 21 | 22 | codePattern = regexp.MustCompile("(?s)```.*?(```|$)|`[^`\n]*`") |
| 22 | 23 | trailingPunct = regexp.MustCompile(`[.,;:!?)\]]+$`) |
| 23 | 24 | pathLike = regexp.MustCompile(`[\p{L}_.]`) |
| 25 | + // the word that links two parts: "@alice write a story, then @bob …" | |
| 26 | + trailingLink = regexp.MustCompile(`(?i)[\s,;:]+(and then|and|then|after that|et ensuite|et après|et|puis|ensuite|après)$`) | |
| 24 | 27 | ) |
| 25 | 28 | |
| 26 | 29 | // MaxAttachments is how many files a message may join. |
| @@ -120,11 +123,22 @@ func Prompt(agent, channelName, text string, unseen []Line) string { | ||
| 120 | 123 | if len(unseen) == 0 { |
| 121 | 124 | return text |
| 122 | 125 | } |
| 126 | + var builder strings.Builder | |
| 127 | + writeUnseen(&builder, agent, channelName, unseen) | |
| 128 | + fmt.Fprintf(&builder, "The user now writes to you (answer directly, without your name in front):\n%s", text) | |
| 129 | + return builder.String() | |
| 130 | +} | |
| 131 | + | |
| 132 | +// writeUnseen writes the last unseen messages, between markers, as agent | |
| 133 | +// reads them; nothing when there is none. | |
| 134 | +func writeUnseen(builder *strings.Builder, agent, channelName string, unseen []Line) { | |
| 135 | + if len(unseen) == 0 { | |
| 136 | + return | |
| 137 | + } | |
| 123 | 138 | if len(unseen) > contextMessages { |
| 124 | 139 | unseen = unseen[len(unseen)-contextMessages:] |
| 125 | 140 | } |
| 126 | - var builder strings.Builder | |
| 127 | - fmt.Fprintf(&builder, "[Messages in %s you have not seen yet]\n", channelName) | |
| 141 | + fmt.Fprintf(builder, "[Messages in %s you have not seen yet]\n", channelName) | |
| 128 | 142 | for _, line := range unseen { |
| 129 | 143 | author := line.Author |
| 130 | 144 | if author == agent { |
| @@ -134,8 +148,55 @@ func Prompt(agent, channelName, text string, unseen []Line) string { | ||
| 134 | 148 | if runes := []rune(lineText); len(runes) > maxLineLength { |
| 135 | 149 | lineText = string(runes[:maxLineLength]) + "…" |
| 136 | 150 | } |
| 137 | - fmt.Fprintf(&builder, "%s: %s\n", author, lineText) | |
| 151 | + fmt.Fprintf(builder, "%s: %s\n", author, lineText) | |
| 138 | 152 | } |
| 139 | - fmt.Fprintf(&builder, "[End of the messages]\n\nThe user now writes to you (answer directly, without your name in front):\n%s", text) | |
| 153 | + builder.WriteString("[End of the messages]\n\n") | |
| 154 | +} | |
| 155 | + | |
| 156 | +// HandoffPrompt builds what agent receives when another agent, from, | |
| 157 | +// mentioned it with @agent in its answer (issue #26): the channel messages | |
| 158 | +// agent has not seen — the user's message and from's answer among them — | |
| 159 | +// then who addresses it. | |
| 160 | +// | |
| 161 | +// HandoffPrompt("bob", "alice", "#general", []Line{{Author: "user", Text: "@alice plan the trip"}, {Author: "alice", Text: "@bob, which train?"}}) | |
| 162 | +func HandoffPrompt(agent, from, channelName string, unseen []Line) string { | |
| 163 | + var builder strings.Builder | |
| 164 | + writeUnseen(&builder, agent, channelName, unseen) | |
| 165 | + fmt.Fprintf(&builder, "%s mentioned you (@%s) in its last message in %s: answer %s directly, without your name in front.", from, agent, channelName, from) | |
| 140 | 166 | return builder.String() |
| 141 | 167 | } |
| 168 | + | |
| 169 | +// PartFor returns what the user asks agent in a message that addresses several | |
| 170 | +// agents: the words after agent's first mention, up to the mention of | |
| 171 | +// another addressed agent, without the word that links them ("then", | |
| 172 | +// "puis"…). Small models do not know their own name: given the whole | |
| 173 | +// "@alice write a story, then @bob sum it up", Alice waits for a story and | |
| 174 | +// Bob does both, so each agent receives only its part (issue #26). "" when there are fewer than two words — the | |
| 175 | +// request is then for everyone ("@alice and @bob, tell a joke"). Code is | |
| 176 | +// not looked into. | |
| 177 | +// | |
| 178 | +// PartFor("@alice write a story, then @bob sum it up", "bob", []string{"alice", "bob"}) // "sum it up" | |
| 179 | +func PartFor(text, agent string, addressed []string) string { | |
| 180 | + masked := codePattern.ReplaceAllStringFunc(text, func(code string) string { return strings.Repeat(" ", len(code)) }) | |
| 181 | + start, end := -1, len(text) | |
| 182 | + for _, match := range mentionPattern.FindAllStringSubmatchIndex(masked, -1) { | |
| 183 | + name := masked[match[4]:match[5]] | |
| 184 | + if start < 0 && name == agent { | |
| 185 | + start = match[5] | |
| 186 | + continue | |
| 187 | + } | |
| 188 | + if start >= 0 && name != agent && slices.Contains(addressed, name) { | |
| 189 | + end = match[4] - 1 // the @ | |
| 190 | + break | |
| 191 | + } | |
| 192 | + } | |
| 193 | + if start < 0 { | |
| 194 | + return "" | |
| 195 | + } | |
| 196 | + part := strings.Trim(text[start:end], " \t\n,;:") | |
| 197 | + part = strings.Trim(trailingLink.ReplaceAllString(part, ""), " \t\n,;:") | |
| 198 | + if len(strings.Fields(part)) < 2 { | |
| 199 | + return "" | |
| 200 | + } | |
| 201 | + return part | |
| 202 | +} | |
| @@ -5,6 +5,7 @@ package channels | |||
| 5 | import ( | 5 | import ( |
| 6 | "fmt" | 6 | "fmt" |
| 7 | "regexp" | 7 | "regexp" |
| 8 | + "slices" | ||
| 8 | "strings" | 9 | "strings" |
| 9 | ) | 10 | ) |
| 10 | 11 | ||
| @@ -21,6 +22,8 @@ var ( | |||
| 21 | codePattern = regexp.MustCompile("(?s)```.*?(```|$)|`[^`\n]*`") | 22 | codePattern = regexp.MustCompile("(?s)```.*?(```|$)|`[^`\n]*`") |
| 22 | trailingPunct = regexp.MustCompile(`[.,;:!?)\]]+$`) | 23 | trailingPunct = regexp.MustCompile(`[.,;:!?)\]]+$`) |
| 23 | pathLike = regexp.MustCompile(`[\p{L}_.]`) | 24 | pathLike = regexp.MustCompile(`[\p{L}_.]`) |
| 25 | + // the word that links two parts: "@alice write a story, then @bob …" | ||
| 26 | + trailingLink = regexp.MustCompile(`(?i)[\s,;:]+(and then|and|then|after that|et ensuite|et après|et|puis|ensuite|après)$`) | ||
| 24 | ) | 27 | ) |
| 25 | 28 | ||
| 26 | // MaxAttachments is how many files a message may join. | 29 | // MaxAttachments is how many files a message may join. |
| @@ -120,11 +123,22 @@ func Prompt(agent, channelName, text string, unseen []Line) string { | |||
| 120 | if len(unseen) == 0 { | 123 | if len(unseen) == 0 { |
| 121 | return text | 124 | return text |
| 122 | } | 125 | } |
| 126 | + var builder strings.Builder | ||
| 127 | + writeUnseen(&builder, agent, channelName, unseen) | ||
| 128 | + fmt.Fprintf(&builder, "The user now writes to you (answer directly, without your name in front):\n%s", text) | ||
| 129 | + return builder.String() | ||
| 130 | +} | ||
| 131 | + | ||
| 132 | +// writeUnseen writes the last unseen messages, between markers, as agent | ||
| 133 | +// reads them; nothing when there is none. | ||
| 134 | +func writeUnseen(builder *strings.Builder, agent, channelName string, unseen []Line) { | ||
| 135 | + if len(unseen) == 0 { | ||
| 136 | + return | ||
| 137 | + } | ||
| 123 | if len(unseen) > contextMessages { | 138 | if len(unseen) > contextMessages { |
| 124 | unseen = unseen[len(unseen)-contextMessages:] | 139 | unseen = unseen[len(unseen)-contextMessages:] |
| 125 | } | 140 | } |
| 126 | - var builder strings.Builder | 141 | + fmt.Fprintf(builder, "[Messages in %s you have not seen yet]\n", channelName) |
| 127 | - fmt.Fprintf(&builder, "[Messages in %s you have not seen yet]\n", channelName) | ||
| 128 | for _, line := range unseen { | 142 | for _, line := range unseen { |
| 129 | author := line.Author | 143 | author := line.Author |
| 130 | if author == agent { | 144 | if author == agent { |
| @@ -134,8 +148,55 @@ func Prompt(agent, channelName, text string, unseen []Line) string { | |||
| 134 | if runes := []rune(lineText); len(runes) > maxLineLength { | 148 | if runes := []rune(lineText); len(runes) > maxLineLength { |
| 135 | lineText = string(runes[:maxLineLength]) + "…" | 149 | lineText = string(runes[:maxLineLength]) + "…" |
| 136 | } | 150 | } |
| 137 | - fmt.Fprintf(&builder, "%s: %s\n", author, lineText) | 151 | + fmt.Fprintf(builder, "%s: %s\n", author, lineText) |
| 138 | } | 152 | } |
| 139 | - fmt.Fprintf(&builder, "[End of the messages]\n\nThe user now writes to you (answer directly, without your name in front):\n%s", text) | 153 | + builder.WriteString("[End of the messages]\n\n") |
| 154 | +} | ||
| 155 | + | ||
| 156 | +// HandoffPrompt builds what agent receives when another agent, from, | ||
| 157 | +// mentioned it with @agent in its answer (issue #26): the channel messages | ||
| 158 | +// agent has not seen — the user's message and from's answer among them — | ||
| 159 | +// then who addresses it. | ||
| 160 | +// | ||
| 161 | +// HandoffPrompt("bob", "alice", "#general", []Line{{Author: "user", Text: "@alice plan the trip"}, {Author: "alice", Text: "@bob, which train?"}}) | ||
| 162 | +func HandoffPrompt(agent, from, channelName string, unseen []Line) string { | ||
| 163 | + var builder strings.Builder | ||
| 164 | + writeUnseen(&builder, agent, channelName, unseen) | ||
| 165 | + fmt.Fprintf(&builder, "%s mentioned you (@%s) in its last message in %s: answer %s directly, without your name in front.", from, agent, channelName, from) | ||
| 140 | return builder.String() | 166 | return builder.String() |
| 141 | } | 167 | } |
| 168 | + | ||
| 169 | +// PartFor returns what the user asks agent in a message that addresses several | ||
| 170 | +// agents: the words after agent's first mention, up to the mention of | ||
| 171 | +// another addressed agent, without the word that links them ("then", | ||
| 172 | +// "puis"…). Small models do not know their own name: given the whole | ||
| 173 | +// "@alice write a story, then @bob sum it up", Alice waits for a story and | ||
| 174 | +// Bob does both, so each agent receives only its part (issue #26). "" when there are fewer than two words — the | ||
| 175 | +// request is then for everyone ("@alice and @bob, tell a joke"). Code is | ||
| 176 | +// not looked into. | ||
| 177 | +// | ||
| 178 | +// PartFor("@alice write a story, then @bob sum it up", "bob", []string{"alice", "bob"}) // "sum it up" | ||
| 179 | +func PartFor(text, agent string, addressed []string) string { | ||
| 180 | + masked := codePattern.ReplaceAllStringFunc(text, func(code string) string { return strings.Repeat(" ", len(code)) }) | ||
| 181 | + start, end := -1, len(text) | ||
| 182 | + for _, match := range mentionPattern.FindAllStringSubmatchIndex(masked, -1) { | ||
| 183 | + name := masked[match[4]:match[5]] | ||
| 184 | + if start < 0 && name == agent { | ||
| 185 | + start = match[5] | ||
| 186 | + continue | ||
| 187 | + } | ||
| 188 | + if start >= 0 && name != agent && slices.Contains(addressed, name) { | ||
| 189 | + end = match[4] - 1 // the @ | ||
| 190 | + break | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + if start < 0 { | ||
| 194 | + return "" | ||
| 195 | + } | ||
| 196 | + part := strings.Trim(text[start:end], " \t\n,;:") | ||
| 197 | + part = strings.Trim(trailingLink.ReplaceAllString(part, ""), " \t\n,;:") | ||
| 198 | + if len(strings.Fields(part)) < 2 { | ||
| 199 | + return "" | ||
| 200 | + } | ||
| 201 | + return part | ||
| 202 | +} | ||
modified
internal/channels/route_test.go +31 -0 | @@ -111,3 +111,34 @@ func TestReferencesAreTheFilesJoinedWithADollar(t *testing.T) { | ||
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | + | |
| 115 | +func TestPartForIsWhatFollowsTheAgentsMention(t *testing.T) { | |
| 116 | + addressed := []string{"alice", "bob"} | |
| 117 | + text := "@alice make a story about seven of nine, then @bob make a summary of this story" | |
| 118 | + cases := map[string]string{"alice": "make a story about seven of nine", "bob": "make a summary of this story"} | |
| 119 | + for agent, want := range cases { | |
| 120 | + if got := channels.PartFor(text, agent, addressed); got != want { | |
| 121 | + t.Errorf("%s: got %q, want %q", agent, got, want) | |
| 122 | + } | |
| 123 | + } | |
| 124 | + shared := map[string]string{ | |
| 125 | + "@alice and @bob, tell me a joke": "alice", // one word: the request is for both | |
| 126 | + "@alice @bob compare": "bob", | |
| 127 | + "tell me @bob`@alice`": "alice", // a mention in code is text | |
| 128 | + } | |
| 129 | + for text, agent := range shared { | |
| 130 | + if got := channels.PartFor(text, agent, addressed); got != "" { | |
| 131 | + t.Errorf("%q for %s: got %q, want nothing", text, agent, got) | |
| 132 | + } | |
| 133 | + } | |
| 134 | + if got := channels.PartFor("@alice and @bob, tell me a joke", "bob", addressed); got != "tell me a joke" { | |
| 135 | + t.Errorf("got %q", got) | |
| 136 | + } | |
| 137 | + if got := channels.PartFor("@alice écris une histoire et ensuite @bob résume-la", "alice", addressed); got != "écris une histoire" { | |
| 138 | + t.Errorf("got %q", got) | |
| 139 | + } | |
| 140 | + // Only the agents that answer cut a part: @carol is just text here. | |
| 141 | + if got := channels.PartFor("@alice ask @carol about trains", "alice", addressed); got != "ask @carol about trains" { | |
| 142 | + t.Errorf("got %q", got) | |
| 143 | + } | |
| 144 | +} | |
| @@ -111,3 +111,34 @@ func TestReferencesAreTheFilesJoinedWithADollar(t *testing.T) { | |||
| 111 | } | 111 | } |
| 112 | } | 112 | } |
| 113 | } | 113 | } |
| 114 | + | ||
| 115 | +func TestPartForIsWhatFollowsTheAgentsMention(t *testing.T) { | ||
| 116 | + addressed := []string{"alice", "bob"} | ||
| 117 | + text := "@alice make a story about seven of nine, then @bob make a summary of this story" | ||
| 118 | + cases := map[string]string{"alice": "make a story about seven of nine", "bob": "make a summary of this story"} | ||
| 119 | + for agent, want := range cases { | ||
| 120 | + if got := channels.PartFor(text, agent, addressed); got != want { | ||
| 121 | + t.Errorf("%s: got %q, want %q", agent, got, want) | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + shared := map[string]string{ | ||
| 125 | + "@alice and @bob, tell me a joke": "alice", // one word: the request is for both | ||
| 126 | + "@alice @bob compare": "bob", | ||
| 127 | + "tell me @bob`@alice`": "alice", // a mention in code is text | ||
| 128 | + } | ||
| 129 | + for text, agent := range shared { | ||
| 130 | + if got := channels.PartFor(text, agent, addressed); got != "" { | ||
| 131 | + t.Errorf("%q for %s: got %q, want nothing", text, agent, got) | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + if got := channels.PartFor("@alice and @bob, tell me a joke", "bob", addressed); got != "tell me a joke" { | ||
| 135 | + t.Errorf("got %q", got) | ||
| 136 | + } | ||
| 137 | + if got := channels.PartFor("@alice écris une histoire et ensuite @bob résume-la", "alice", addressed); got != "écris une histoire" { | ||
| 138 | + t.Errorf("got %q", got) | ||
| 139 | + } | ||
| 140 | + // Only the agents that answer cut a part: @carol is just text here. | ||
| 141 | + if got := channels.PartFor("@alice ask @carol about trains", "alice", addressed); got != "ask @carol about trains" { | ||
| 142 | + t.Errorf("got %q", got) | ||
| 143 | + } | ||
| 144 | +} | ||
modified
internal/channels/turns.go +90 -23 | @@ -7,6 +7,7 @@ import ( | ||
| 7 | 7 | "encoding/json" |
| 8 | 8 | "errors" |
| 9 | 9 | "fmt" |
| 10 | + "slices" | |
| 10 | 11 | "strings" |
| 11 | 12 | |
| 12 | 13 | "git.rickub.com/bots-garden/sidekicks/internal/acp" |
| @@ -140,17 +141,13 @@ func (m *Manager) invite(ch *channel, names []string) { | ||
| 140 | 141 | } |
| 141 | 142 | |
| 142 | 143 | // run answers item, then the queued messages one by one; each message is |
| 143 | -// answered by its agents in order. | |
| 144 | +// answered by its agents in order, then by the agents they hand it to. | |
| 144 | 145 | func (m *Manager) run(ch *channel, item *pending) { |
| 145 | 146 | for item != nil { |
| 146 | 147 | m.mu.Lock() |
| 147 | 148 | ch.stopped = false |
| 148 | 149 | m.mu.Unlock() |
| 149 | - for _, agent := range item.route.Agents { | |
| 150 | - if !m.turn(ch, item, agent) { | |
| 151 | - break // stopped by the user: the other agents do not answer | |
| 152 | - } | |
| 153 | - } | |
| 150 | + m.answer(ch, item) | |
| 154 | 151 | m.mu.Lock() |
| 155 | 152 | item = nil |
| 156 | 153 | ch.answering = "" |
| @@ -166,37 +163,89 @@ func (m *Manager) run(ch *channel, item *pending) { | ||
| 166 | 163 | } |
| 167 | 164 | } |
| 168 | 165 | |
| 169 | -// turn has agent answer item and streams its answer. It returns false when | |
| 170 | -// the user stopped the channel. | |
| 171 | -func (m *Manager) turn(ch *channel, item *pending, agent string) bool { | |
| 166 | +// answer has the agents of item's route answer it, one after the other. In | |
| 167 | +// a channel, an agent whose answer mentions another member with @name hands | |
| 168 | +// it the floor (issue #26): that member answers next, told who addressed it. | |
| 169 | +// The hand-offs of one message are bounded (Options.Handoffs); the user stops | |
| 170 | +// the whole chain with Cancel. | |
| 171 | +func (m *Manager) answer(ch *channel, item *pending) { | |
| 172 | + queue := append([]string(nil), item.route.Agents...) | |
| 173 | + from := make([]string, len(queue)) // who handed the floor to queue[i]; "" for the user | |
| 174 | + handoffs, limit := 0, m.handoffLimit() | |
| 175 | + for i := 0; i < len(queue); i++ { | |
| 176 | + text, ok := m.turn(ch, item, queue[i], from[i]) | |
| 177 | + if !ok { | |
| 178 | + return // stopped by the user: the other agents do not answer | |
| 179 | + } | |
| 180 | + if item.route.Command != "" || ch.info.Direct != "" { | |
| 181 | + continue | |
| 182 | + } | |
| 183 | + for _, next := range m.addressed(ch, queue[i], text, queue[i+1:]) { | |
| 184 | + if handoffs >= limit { | |
| 185 | + if limit > 0 { | |
| 186 | + m.mu.Lock() | |
| 187 | + m.systemMessage(ch, CodeHandoffLimit, queue[i], "") | |
| 188 | + m.mu.Unlock() | |
| 189 | + } | |
| 190 | + break | |
| 191 | + } | |
| 192 | + handoffs++ | |
| 193 | + queue, from = append(queue, next), append(from, queue[i]) | |
| 194 | + } | |
| 195 | + } | |
| 196 | +} | |
| 197 | + | |
| 198 | +// addressed lists the members of ch that agent's answer mentions with @name, | |
| 199 | +// apart from agent itself and the ones that answer anyway (waiting). Code | |
| 200 | +// is not looked into. | |
| 201 | +func (m *Manager) addressed(ch *channel, agent, text string, waiting []string) []string { | |
| 202 | + m.mu.Lock() | |
| 203 | + defer m.mu.Unlock() | |
| 204 | + member := func(name string) bool { | |
| 205 | + return name != agent && ch.member(name) != nil && !slices.Contains(waiting, name) | |
| 206 | + } | |
| 207 | + return Mentions(codePattern.ReplaceAllString(text, " "), member) | |
| 208 | +} | |
| 209 | + | |
| 210 | +func (m *Manager) handoffLimit() int { | |
| 211 | + if m.handoffs == nil { | |
| 212 | + return DefaultHandoffs | |
| 213 | + } | |
| 214 | + return m.handoffs() | |
| 215 | +} | |
| 216 | + | |
| 217 | +// turn has agent answer item and streams its answer; from is the agent that | |
| 218 | +// handed it the floor, "" when the user asked. It returns the text of the | |
| 219 | +// answer, and false when the user stopped the channel. | |
| 220 | +func (m *Manager) turn(ch *channel, item *pending, agent, from string) (string, bool) { | |
| 172 | 221 | ctx, cancel := context.WithCancel(context.Background()) |
| 173 | 222 | defer cancel() |
| 174 | 223 | m.mu.Lock() |
| 175 | 224 | if ch.stopped { |
| 176 | 225 | m.mu.Unlock() |
| 177 | - return false | |
| 226 | + return "", false | |
| 178 | 227 | } |
| 179 | 228 | ch.cancel, ch.answering = cancel, agent |
| 180 | 229 | m.emitTurn(ch) |
| 181 | 230 | m.mu.Unlock() |
| 182 | 231 | |
| 183 | 232 | if !m.waitTurn(ctx, agent) { |
| 184 | - return false | |
| 233 | + return "", false | |
| 185 | 234 | } |
| 186 | 235 | defer m.endTurn(agent) |
| 187 | 236 | conn, release, err := m.agents.Acquire(ctx, agent) |
| 188 | 237 | if err != nil { |
| 189 | - return m.unavailable(ctx, ch, agent, err) | |
| 238 | + return "", m.unavailable(ctx, ch, agent, err) | |
| 190 | 239 | } |
| 191 | 240 | defer release() |
| 192 | 241 | sessionID, fresh, err := m.session(ctx, ch, agent, conn) |
| 193 | 242 | if err != nil { |
| 194 | - return m.unavailable(ctx, ch, agent, err) | |
| 243 | + return "", m.unavailable(ctx, ch, agent, err) | |
| 195 | 244 | } |
| 196 | 245 | attachments := m.readAttachments(ctx, ch, agent, item) |
| 197 | 246 | |
| 198 | 247 | m.mu.Lock() |
| 199 | - prompt := m.prompt(ch, agent, item, fresh) | |
| 248 | + prompt := m.prompt(ch, agent, item, from, fresh) | |
| 200 | 249 | answer := m.newMessage(ch, RoleAgent, agent) |
| 201 | 250 | ch.messages = append(ch.messages, answer) |
| 202 | 251 | ch.current, ch.rejected = answer, 0 |
| @@ -219,7 +268,7 @@ func (m *Manager) turn(ch *channel, item *pending, agent string) bool { | ||
| 219 | 268 | ch.current, ch.cancel = nil, nil |
| 220 | 269 | m.emitMessage(answer) |
| 221 | 270 | m.seen(ch, agent) |
| 222 | - return !ch.stopped && ctx.Err() == nil | |
| 271 | + return textOf(answer), !ch.stopped && ctx.Err() == nil | |
| 223 | 272 | } |
| 224 | 273 | |
| 225 | 274 | // maxEmbeddedText is the largest text file sent with its content; a larger |
| @@ -409,8 +458,11 @@ func (m *Manager) tryTurn(agent string) bool { | ||
| 409 | 458 | } |
| 410 | 459 | |
| 411 | 460 | // prompt is what agent receives for item: the command alone, or the text |
| 412 | -// with the channel messages it has not seen. The caller holds m.mu. | |
| 413 | -func (m *Manager) prompt(ch *channel, agent string, item *pending, fresh bool) string { | |
| 461 | +// with the channel messages it has not seen; when another agent (from) | |
| 462 | +// handed it the floor, those messages, the user's included, and who | |
| 463 | +// addresses it. A message for several agents gives each one its part | |
| 464 | +// (PartFor). The caller holds m.mu. | |
| 465 | +func (m *Manager) prompt(ch *channel, agent string, item *pending, from string, fresh bool) string { | |
| 414 | 466 | if item.route.Command != "" { |
| 415 | 467 | return item.route.Command |
| 416 | 468 | } |
| @@ -418,7 +470,16 @@ func (m *Manager) prompt(ch *channel, agent string, item *pending, fresh bool) s | ||
| 418 | 470 | if ch.info.Direct != "" { |
| 419 | 471 | place = "this conversation" |
| 420 | 472 | } |
| 421 | - return Prompt(agent, place, textOf(item.message), unseen(ch, agent, item.message, fresh)) | |
| 473 | + if from != "" { | |
| 474 | + return HandoffPrompt(agent, from, place, unseen(ch, agent, nil, fresh)) | |
| 475 | + } | |
| 476 | + text := textOf(item.message) | |
| 477 | + if addressed := item.route.Agents; len(addressed) > 1 && ch.info.Direct == "" { | |
| 478 | + if part := PartFor(text, agent, addressed); part != "" { | |
| 479 | + text = part | |
| 480 | + } | |
| 481 | + } | |
| 482 | + return Prompt(agent, place, text, unseen(ch, agent, item.message, fresh)) | |
| 422 | 483 | } |
| 423 | 484 | |
| 424 | 485 | // unseen lists the finished user and agent messages of ch that agent has not |
| @@ -564,11 +625,7 @@ func (h *handler) Update(update acp.Update) { | ||
| 564 | 625 | m.emitter.Emit(events.UsageChanged, UsagePayload{Channel: ch.info.ID, Agent: h.agent, Usage: *update.Usage}) |
| 565 | 626 | return |
| 566 | 627 | case acp.UpdateCommands: |
| 567 | - m.commands[h.agent] = update.Commands | |
| 568 | - if data, err := json.Marshal(update.Commands); err == nil { | |
| 569 | - _ = m.db.SetValue("commands/"+h.agent, data) | |
| 570 | - } | |
| 571 | - m.emitter.Emit(events.CommandsChanged, CommandsPayload{Agent: h.agent, Commands: update.Commands}) | |
| 628 | + m.storeCommands(h.agent, update.Commands) | |
| 572 | 629 | return |
| 573 | 630 | } |
| 574 | 631 | message := ch.current |
| @@ -608,6 +665,16 @@ func (h *handler) Update(update acp.Update) { | ||
| 608 | 665 | } |
| 609 | 666 | } |
| 610 | 667 | |
| 668 | +// storeCommands keeps the commands agent announced, for the next runs too, | |
| 669 | +// and tells the interface. The caller holds m.mu. | |
| 670 | +func (m *Manager) storeCommands(agent string, commands []acp.Command) { | |
| 671 | + m.commands[agent] = commands | |
| 672 | + if data, err := json.Marshal(commands); err == nil { | |
| 673 | + _ = m.db.SetValue("commands/"+agent, data) | |
| 674 | + } | |
| 675 | + m.emitter.Emit(events.CommandsChanged, CommandsPayload{Agent: agent, Commands: commands}) | |
| 676 | +} | |
| 677 | + | |
| 611 | 678 | // appendText adds a text or thought fragment to message. The caller holds m.mu. |
| 612 | 679 | func (m *Manager) appendText(message *Message, update acp.Update) { |
| 613 | 680 | kind := PartText |
| @@ -7,6 +7,7 @@ import ( | |||
| 7 | "encoding/json" | 7 | "encoding/json" |
| 8 | "errors" | 8 | "errors" |
| 9 | "fmt" | 9 | "fmt" |
| 10 | + "slices" | ||
| 10 | "strings" | 11 | "strings" |
| 11 | 12 | ||
| 12 | "git.rickub.com/bots-garden/sidekicks/internal/acp" | 13 | "git.rickub.com/bots-garden/sidekicks/internal/acp" |
| @@ -140,17 +141,13 @@ func (m *Manager) invite(ch *channel, names []string) { | |||
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | // run answers item, then the queued messages one by one; each message is | 143 | // run answers item, then the queued messages one by one; each message is |
| 143 | -// answered by its agents in order. | 144 | +// answered by its agents in order, then by the agents they hand it to. |
| 144 | func (m *Manager) run(ch *channel, item *pending) { | 145 | func (m *Manager) run(ch *channel, item *pending) { |
| 145 | for item != nil { | 146 | for item != nil { |
| 146 | m.mu.Lock() | 147 | m.mu.Lock() |
| 147 | ch.stopped = false | 148 | ch.stopped = false |
| 148 | m.mu.Unlock() | 149 | m.mu.Unlock() |
| 149 | - for _, agent := range item.route.Agents { | 150 | + m.answer(ch, item) |
| 150 | - if !m.turn(ch, item, agent) { | ||
| 151 | - break // stopped by the user: the other agents do not answer | ||
| 152 | - } | ||
| 153 | - } | ||
| 154 | m.mu.Lock() | 151 | m.mu.Lock() |
| 155 | item = nil | 152 | item = nil |
| 156 | ch.answering = "" | 153 | ch.answering = "" |
| @@ -166,37 +163,89 @@ func (m *Manager) run(ch *channel, item *pending) { | |||
| 166 | } | 163 | } |
| 167 | } | 164 | } |
| 168 | 165 | ||
| 169 | -// turn has agent answer item and streams its answer. It returns false when | 166 | +// answer has the agents of item's route answer it, one after the other. In |
| 170 | -// the user stopped the channel. | 167 | +// a channel, an agent whose answer mentions another member with @name hands |
| 171 | -func (m *Manager) turn(ch *channel, item *pending, agent string) bool { | 168 | +// it the floor (issue #26): that member answers next, told who addressed it. |
| 169 | +// The hand-offs of one message are bounded (Options.Handoffs); the user stops | ||
| 170 | +// the whole chain with Cancel. | ||
| 171 | +func (m *Manager) answer(ch *channel, item *pending) { | ||
| 172 | + queue := append([]string(nil), item.route.Agents...) | ||
| 173 | + from := make([]string, len(queue)) // who handed the floor to queue[i]; "" for the user | ||
| 174 | + handoffs, limit := 0, m.handoffLimit() | ||
| 175 | + for i := 0; i < len(queue); i++ { | ||
| 176 | + text, ok := m.turn(ch, item, queue[i], from[i]) | ||
| 177 | + if !ok { | ||
| 178 | + return // stopped by the user: the other agents do not answer | ||
| 179 | + } | ||
| 180 | + if item.route.Command != "" || ch.info.Direct != "" { | ||
| 181 | + continue | ||
| 182 | + } | ||
| 183 | + for _, next := range m.addressed(ch, queue[i], text, queue[i+1:]) { | ||
| 184 | + if handoffs >= limit { | ||
| 185 | + if limit > 0 { | ||
| 186 | + m.mu.Lock() | ||
| 187 | + m.systemMessage(ch, CodeHandoffLimit, queue[i], "") | ||
| 188 | + m.mu.Unlock() | ||
| 189 | + } | ||
| 190 | + break | ||
| 191 | + } | ||
| 192 | + handoffs++ | ||
| 193 | + queue, from = append(queue, next), append(from, queue[i]) | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +// addressed lists the members of ch that agent's answer mentions with @name, | ||
| 199 | +// apart from agent itself and the ones that answer anyway (waiting). Code | ||
| 200 | +// is not looked into. | ||
| 201 | +func (m *Manager) addressed(ch *channel, agent, text string, waiting []string) []string { | ||
| 202 | + m.mu.Lock() | ||
| 203 | + defer m.mu.Unlock() | ||
| 204 | + member := func(name string) bool { | ||
| 205 | + return name != agent && ch.member(name) != nil && !slices.Contains(waiting, name) | ||
| 206 | + } | ||
| 207 | + return Mentions(codePattern.ReplaceAllString(text, " "), member) | ||
| 208 | +} | ||
| 209 | + | ||
| 210 | +func (m *Manager) handoffLimit() int { | ||
| 211 | + if m.handoffs == nil { | ||
| 212 | + return DefaultHandoffs | ||
| 213 | + } | ||
| 214 | + return m.handoffs() | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +// turn has agent answer item and streams its answer; from is the agent that | ||
| 218 | +// handed it the floor, "" when the user asked. It returns the text of the | ||
| 219 | +// answer, and false when the user stopped the channel. | ||
| 220 | +func (m *Manager) turn(ch *channel, item *pending, agent, from string) (string, bool) { | ||
| 172 | ctx, cancel := context.WithCancel(context.Background()) | 221 | ctx, cancel := context.WithCancel(context.Background()) |
| 173 | defer cancel() | 222 | defer cancel() |
| 174 | m.mu.Lock() | 223 | m.mu.Lock() |
| 175 | if ch.stopped { | 224 | if ch.stopped { |
| 176 | m.mu.Unlock() | 225 | m.mu.Unlock() |
| 177 | - return false | 226 | + return "", false |
| 178 | } | 227 | } |
| 179 | ch.cancel, ch.answering = cancel, agent | 228 | ch.cancel, ch.answering = cancel, agent |
| 180 | m.emitTurn(ch) | 229 | m.emitTurn(ch) |
| 181 | m.mu.Unlock() | 230 | m.mu.Unlock() |
| 182 | 231 | ||
| 183 | if !m.waitTurn(ctx, agent) { | 232 | if !m.waitTurn(ctx, agent) { |
| 184 | - return false | 233 | + return "", false |
| 185 | } | 234 | } |
| 186 | defer m.endTurn(agent) | 235 | defer m.endTurn(agent) |
| 187 | conn, release, err := m.agents.Acquire(ctx, agent) | 236 | conn, release, err := m.agents.Acquire(ctx, agent) |
| 188 | if err != nil { | 237 | if err != nil { |
| 189 | - return m.unavailable(ctx, ch, agent, err) | 238 | + return "", m.unavailable(ctx, ch, agent, err) |
| 190 | } | 239 | } |
| 191 | defer release() | 240 | defer release() |
| 192 | sessionID, fresh, err := m.session(ctx, ch, agent, conn) | 241 | sessionID, fresh, err := m.session(ctx, ch, agent, conn) |
| 193 | if err != nil { | 242 | if err != nil { |
| 194 | - return m.unavailable(ctx, ch, agent, err) | 243 | + return "", m.unavailable(ctx, ch, agent, err) |
| 195 | } | 244 | } |
| 196 | attachments := m.readAttachments(ctx, ch, agent, item) | 245 | attachments := m.readAttachments(ctx, ch, agent, item) |
| 197 | 246 | ||
| 198 | m.mu.Lock() | 247 | m.mu.Lock() |
| 199 | - prompt := m.prompt(ch, agent, item, fresh) | 248 | + prompt := m.prompt(ch, agent, item, from, fresh) |
| 200 | answer := m.newMessage(ch, RoleAgent, agent) | 249 | answer := m.newMessage(ch, RoleAgent, agent) |
| 201 | ch.messages = append(ch.messages, answer) | 250 | ch.messages = append(ch.messages, answer) |
| 202 | ch.current, ch.rejected = answer, 0 | 251 | ch.current, ch.rejected = answer, 0 |
| @@ -219,7 +268,7 @@ func (m *Manager) turn(ch *channel, item *pending, agent string) bool { | |||
| 219 | ch.current, ch.cancel = nil, nil | 268 | ch.current, ch.cancel = nil, nil |
| 220 | m.emitMessage(answer) | 269 | m.emitMessage(answer) |
| 221 | m.seen(ch, agent) | 270 | m.seen(ch, agent) |
| 222 | - return !ch.stopped && ctx.Err() == nil | 271 | + return textOf(answer), !ch.stopped && ctx.Err() == nil |
| 223 | } | 272 | } |
| 224 | 273 | ||
| 225 | // maxEmbeddedText is the largest text file sent with its content; a larger | 274 | // maxEmbeddedText is the largest text file sent with its content; a larger |
| @@ -409,8 +458,11 @@ func (m *Manager) tryTurn(agent string) bool { | |||
| 409 | } | 458 | } |
| 410 | 459 | ||
| 411 | // prompt is what agent receives for item: the command alone, or the text | 460 | // prompt is what agent receives for item: the command alone, or the text |
| 412 | -// with the channel messages it has not seen. The caller holds m.mu. | 461 | +// with the channel messages it has not seen; when another agent (from) |
| 413 | -func (m *Manager) prompt(ch *channel, agent string, item *pending, fresh bool) string { | 462 | +// handed it the floor, those messages, the user's included, and who |
| 463 | +// addresses it. A message for several agents gives each one its part | ||
| 464 | +// (PartFor). The caller holds m.mu. | ||
| 465 | +func (m *Manager) prompt(ch *channel, agent string, item *pending, from string, fresh bool) string { | ||
| 414 | if item.route.Command != "" { | 466 | if item.route.Command != "" { |
| 415 | return item.route.Command | 467 | return item.route.Command |
| 416 | } | 468 | } |
| @@ -418,7 +470,16 @@ func (m *Manager) prompt(ch *channel, agent string, item *pending, fresh bool) s | |||
| 418 | if ch.info.Direct != "" { | 470 | if ch.info.Direct != "" { |
| 419 | place = "this conversation" | 471 | place = "this conversation" |
| 420 | } | 472 | } |
| 421 | - return Prompt(agent, place, textOf(item.message), unseen(ch, agent, item.message, fresh)) | 473 | + if from != "" { |
| 474 | + return HandoffPrompt(agent, from, place, unseen(ch, agent, nil, fresh)) | ||
| 475 | + } | ||
| 476 | + text := textOf(item.message) | ||
| 477 | + if addressed := item.route.Agents; len(addressed) > 1 && ch.info.Direct == "" { | ||
| 478 | + if part := PartFor(text, agent, addressed); part != "" { | ||
| 479 | + text = part | ||
| 480 | + } | ||
| 481 | + } | ||
| 482 | + return Prompt(agent, place, text, unseen(ch, agent, item.message, fresh)) | ||
| 422 | } | 483 | } |
| 423 | 484 | ||
| 424 | // unseen lists the finished user and agent messages of ch that agent has not | 485 | // unseen lists the finished user and agent messages of ch that agent has not |
| @@ -564,11 +625,7 @@ func (h *handler) Update(update acp.Update) { | |||
| 564 | m.emitter.Emit(events.UsageChanged, UsagePayload{Channel: ch.info.ID, Agent: h.agent, Usage: *update.Usage}) | 625 | m.emitter.Emit(events.UsageChanged, UsagePayload{Channel: ch.info.ID, Agent: h.agent, Usage: *update.Usage}) |
| 565 | return | 626 | return |
| 566 | case acp.UpdateCommands: | 627 | case acp.UpdateCommands: |
| 567 | - m.commands[h.agent] = update.Commands | 628 | + m.storeCommands(h.agent, update.Commands) |
| 568 | - if data, err := json.Marshal(update.Commands); err == nil { | ||
| 569 | - _ = m.db.SetValue("commands/"+h.agent, data) | ||
| 570 | - } | ||
| 571 | - m.emitter.Emit(events.CommandsChanged, CommandsPayload{Agent: h.agent, Commands: update.Commands}) | ||
| 572 | return | 629 | return |
| 573 | } | 630 | } |
| 574 | message := ch.current | 631 | message := ch.current |
| @@ -608,6 +665,16 @@ func (h *handler) Update(update acp.Update) { | |||
| 608 | } | 665 | } |
| 609 | } | 666 | } |
| 610 | 667 | ||
| 668 | +// storeCommands keeps the commands agent announced, for the next runs too, | ||
| 669 | +// and tells the interface. The caller holds m.mu. | ||
| 670 | +func (m *Manager) storeCommands(agent string, commands []acp.Command) { | ||
| 671 | + m.commands[agent] = commands | ||
| 672 | + if data, err := json.Marshal(commands); err == nil { | ||
| 673 | + _ = m.db.SetValue("commands/"+agent, data) | ||
| 674 | + } | ||
| 675 | + m.emitter.Emit(events.CommandsChanged, CommandsPayload{Agent: agent, Commands: commands}) | ||
| 676 | +} | ||
| 677 | + | ||
| 611 | // appendText adds a text or thought fragment to message. The caller holds m.mu. | 678 | // appendText adds a text or thought fragment to message. The caller holds m.mu. |
| 612 | func (m *Manager) appendText(message *Message, update acp.Update) { | 679 | func (m *Manager) appendText(message *Message, update acp.Update) { |
| 613 | kind := PartText | 680 | kind := PartText |
added
internal/channels/unload.go +99 -0 | new file mode 100644 | ||
| @@ -0,0 +1,99 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package channels | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "strings" | |
| 9 | + | |
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | |
| 11 | +) | |
| 12 | + | |
| 13 | +// UnloadCommand is the slash command an agent announces when it can unload | |
| 14 | +// its model from memory (issue #51). ACP has no standard method for it: an | |
| 15 | +// agent that announces a command with this name is taken at its word. | |
| 16 | +const UnloadCommand = "unload" | |
| 17 | + | |
| 18 | +var ( | |
| 19 | + // ErrCannotUnload is returned for an agent that never announced an unload command. | |
| 20 | + ErrCannotUnload = errors.New("this agent cannot unload its model: it offers no /unload command") | |
| 21 | + // ErrAgentAnswering is returned while the agent answers a channel: unloading would only | |
| 22 | + // make it load its model again. | |
| 23 | + ErrAgentAnswering = errors.New("the agent is answering: wait for the end of its answer to unload its model") | |
| 24 | +) | |
| 25 | + | |
| 26 | +// CanUnload tells whether agent announced the unload command. | |
| 27 | +func (m *Manager) CanUnload(agent string) bool { | |
| 28 | + m.mu.Lock() | |
| 29 | + defer m.mu.Unlock() | |
| 30 | + m.commandsKnown(agent) | |
| 31 | + for _, command := range m.commands[agent] { | |
| 32 | + if command.Name == UnloadCommand { | |
| 33 | + return true | |
| 34 | + } | |
| 35 | + } | |
| 36 | + return false | |
| 37 | +} | |
| 38 | + | |
| 39 | +// Unload has agent unload its model: it sends /unload in a session of its | |
| 40 | +// own, which no channel shows and which is forgotten afterwards. It returns | |
| 41 | +// what the agent answered. The agent is started if it is not running: the | |
| 42 | +// caller checks that it runs (there is nothing to unload otherwise). | |
| 43 | +// | |
| 44 | +// answer, err := manager.Unload(ctx, "alice") // "unloaded: gemma…" | |
| 45 | +func (m *Manager) Unload(ctx context.Context, agent string) (string, error) { | |
| 46 | + if !m.CanUnload(agent) { | |
| 47 | + return "", ErrCannotUnload | |
| 48 | + } | |
| 49 | + if !m.tryTurn(agent) { | |
| 50 | + return "", ErrAgentAnswering | |
| 51 | + } | |
| 52 | + defer m.endTurn(agent) | |
| 53 | + conn, release, err := m.agents.Acquire(ctx, agent) | |
| 54 | + if err != nil { | |
| 55 | + return "", err | |
| 56 | + } | |
| 57 | + defer release() | |
| 58 | + definition, _ := m.agents.Definition(agent) | |
| 59 | + handler := &unloadHandler{manager: m, agent: agent} | |
| 60 | + sessionID, err := conn.NewSession(ctx, definition.Workspace, handler) | |
| 61 | + if err != nil { | |
| 62 | + return "", err | |
| 63 | + } | |
| 64 | + if _, err := conn.Prompt(ctx, sessionID, "/"+UnloadCommand); err != nil { | |
| 65 | + return "", err | |
| 66 | + } | |
| 67 | + return strings.TrimSpace(handler.text()), nil | |
| 68 | +} | |
| 69 | + | |
| 70 | +// unloadHandler receives what the agent says in the session opened to | |
| 71 | +// unload it: its answer, kept for the log, and its commands, kept as usual. | |
| 72 | +type unloadHandler struct { | |
| 73 | + manager *Manager | |
| 74 | + agent string | |
| 75 | + answer strings.Builder | |
| 76 | +} | |
| 77 | + | |
| 78 | +func (h *unloadHandler) Update(update acp.Update) { | |
| 79 | + m := h.manager | |
| 80 | + m.mu.Lock() | |
| 81 | + defer m.mu.Unlock() | |
| 82 | + switch update.Kind { | |
| 83 | + case acp.UpdateCommands: | |
| 84 | + m.storeCommands(h.agent, update.Commands) | |
| 85 | + case acp.UpdateMessage: | |
| 86 | + h.answer.WriteString(update.Text) | |
| 87 | + } | |
| 88 | +} | |
| 89 | + | |
| 90 | +// RequestPermission refuses: unloading a model needs no tool. | |
| 91 | +func (h *unloadHandler) RequestPermission(context.Context, acp.PermissionRequest) acp.PermissionAnswer { | |
| 92 | + return acp.PermissionAnswer{} | |
| 93 | +} | |
| 94 | + | |
| 95 | +func (h *unloadHandler) text() string { | |
| 96 | + h.manager.mu.Lock() | |
| 97 | + defer h.manager.mu.Unlock() | |
| 98 | + return h.answer.String() | |
| 99 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package channels | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "strings" | ||
| 9 | + | ||
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | ||
| 11 | +) | ||
| 12 | + | ||
| 13 | +// UnloadCommand is the slash command an agent announces when it can unload | ||
| 14 | +// its model from memory (issue #51). ACP has no standard method for it: an | ||
| 15 | +// agent that announces a command with this name is taken at its word. | ||
| 16 | +const UnloadCommand = "unload" | ||
| 17 | + | ||
| 18 | +var ( | ||
| 19 | + // ErrCannotUnload is returned for an agent that never announced an unload command. | ||
| 20 | + ErrCannotUnload = errors.New("this agent cannot unload its model: it offers no /unload command") | ||
| 21 | + // ErrAgentAnswering is returned while the agent answers a channel: unloading would only | ||
| 22 | + // make it load its model again. | ||
| 23 | + ErrAgentAnswering = errors.New("the agent is answering: wait for the end of its answer to unload its model") | ||
| 24 | +) | ||
| 25 | + | ||
| 26 | +// CanUnload tells whether agent announced the unload command. | ||
| 27 | +func (m *Manager) CanUnload(agent string) bool { | ||
| 28 | + m.mu.Lock() | ||
| 29 | + defer m.mu.Unlock() | ||
| 30 | + m.commandsKnown(agent) | ||
| 31 | + for _, command := range m.commands[agent] { | ||
| 32 | + if command.Name == UnloadCommand { | ||
| 33 | + return true | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | + return false | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +// Unload has agent unload its model: it sends /unload in a session of its | ||
| 40 | +// own, which no channel shows and which is forgotten afterwards. It returns | ||
| 41 | +// what the agent answered. The agent is started if it is not running: the | ||
| 42 | +// caller checks that it runs (there is nothing to unload otherwise). | ||
| 43 | +// | ||
| 44 | +// answer, err := manager.Unload(ctx, "alice") // "unloaded: gemma…" | ||
| 45 | +func (m *Manager) Unload(ctx context.Context, agent string) (string, error) { | ||
| 46 | + if !m.CanUnload(agent) { | ||
| 47 | + return "", ErrCannotUnload | ||
| 48 | + } | ||
| 49 | + if !m.tryTurn(agent) { | ||
| 50 | + return "", ErrAgentAnswering | ||
| 51 | + } | ||
| 52 | + defer m.endTurn(agent) | ||
| 53 | + conn, release, err := m.agents.Acquire(ctx, agent) | ||
| 54 | + if err != nil { | ||
| 55 | + return "", err | ||
| 56 | + } | ||
| 57 | + defer release() | ||
| 58 | + definition, _ := m.agents.Definition(agent) | ||
| 59 | + handler := &unloadHandler{manager: m, agent: agent} | ||
| 60 | + sessionID, err := conn.NewSession(ctx, definition.Workspace, handler) | ||
| 61 | + if err != nil { | ||
| 62 | + return "", err | ||
| 63 | + } | ||
| 64 | + if _, err := conn.Prompt(ctx, sessionID, "/"+UnloadCommand); err != nil { | ||
| 65 | + return "", err | ||
| 66 | + } | ||
| 67 | + return strings.TrimSpace(handler.text()), nil | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +// unloadHandler receives what the agent says in the session opened to | ||
| 71 | +// unload it: its answer, kept for the log, and its commands, kept as usual. | ||
| 72 | +type unloadHandler struct { | ||
| 73 | + manager *Manager | ||
| 74 | + agent string | ||
| 75 | + answer strings.Builder | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +func (h *unloadHandler) Update(update acp.Update) { | ||
| 79 | + m := h.manager | ||
| 80 | + m.mu.Lock() | ||
| 81 | + defer m.mu.Unlock() | ||
| 82 | + switch update.Kind { | ||
| 83 | + case acp.UpdateCommands: | ||
| 84 | + m.storeCommands(h.agent, update.Commands) | ||
| 85 | + case acp.UpdateMessage: | ||
| 86 | + h.answer.WriteString(update.Text) | ||
| 87 | + } | ||
| 88 | +} | ||
| 89 | + | ||
| 90 | +// RequestPermission refuses: unloading a model needs no tool. | ||
| 91 | +func (h *unloadHandler) RequestPermission(context.Context, acp.PermissionRequest) acp.PermissionAnswer { | ||
| 92 | + return acp.PermissionAnswer{} | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +func (h *unloadHandler) text() string { | ||
| 96 | + h.manager.mu.Lock() | ||
| 97 | + defer h.manager.mu.Unlock() | ||
| 98 | + return h.answer.String() | ||
| 99 | +} | ||
added
internal/channels/unload_test.go +96 -0 | new file mode 100644 | ||
| @@ -0,0 +1,96 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package channels_test | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "testing" | |
| 9 | + | |
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | |
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | |
| 12 | +) | |
| 13 | + | |
| 14 | +// unloads is the fake agents' answer to /unload, like mm. | |
| 15 | +func unloads(_ context.Context, handler acp.SessionHandler) (acp.TurnResult, error) { | |
| 16 | + handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: "unloaded: gemma\n"}) | |
| 17 | + return acp.TurnResult{StopReason: "end_turn"}, nil | |
| 18 | +} | |
| 19 | + | |
| 20 | +func TestAnAgentWithoutTheUnloadCommandIsNotAskedToUnload(t *testing.T) { | |
| 21 | + f := setup(t, map[string]script{"/unload": unloads}) | |
| 22 | + f.source.conn("alice").commands = []acp.Command{{Name: "compact"}} | |
| 23 | + direct, _ := f.manager.Direct("alice") | |
| 24 | + if err := f.manager.Prepare(context.Background(), direct.ID); err != nil { | |
| 25 | + t.Fatal(err) | |
| 26 | + } | |
| 27 | + if f.manager.CanUnload("alice") || f.manager.CanUnload("bob") { | |
| 28 | + t.Fatal("neither alice nor bob announced unload") | |
| 29 | + } | |
| 30 | + if _, err := f.manager.Unload(context.Background(), "alice"); !errors.Is(err, channels.ErrCannotUnload) { | |
| 31 | + t.Fatalf("refused: %v", err) | |
| 32 | + } | |
| 33 | + if sent := f.source.conn("alice").sent(); len(sent) != 0 { | |
| 34 | + t.Fatalf("nothing sent: %q", sent) | |
| 35 | + } | |
| 36 | +} | |
| 37 | + | |
| 38 | +func TestUnloadSendsTheCommandInASessionOfItsOwn(t *testing.T) { | |
| 39 | + f := setup(t, map[string]script{"/unload": unloads}) | |
| 40 | + alice := f.source.conn("alice") | |
| 41 | + alice.commands = []acp.Command{{Name: "compact"}, {Name: "unload"}} | |
| 42 | + direct, _ := f.manager.Direct("alice") | |
| 43 | + f.send(t, direct.ID, "hello") | |
| 44 | + f.idle(t, direct.ID, 2) | |
| 45 | + if !f.manager.CanUnload("alice") { | |
| 46 | + t.Fatal("alice announced unload") | |
| 47 | + } | |
| 48 | + | |
| 49 | + answer, err := f.manager.Unload(context.Background(), "alice") | |
| 50 | + if err != nil { | |
| 51 | + t.Fatal(err) | |
| 52 | + } | |
| 53 | + if answer != "unloaded: gemma" { | |
| 54 | + t.Fatalf("answer: %q", answer) | |
| 55 | + } | |
| 56 | + if sent := alice.sent(); len(sent) != 2 || sent[1] != "/unload" { | |
| 57 | + t.Fatalf("prompts: %q", sent) | |
| 58 | + } | |
| 59 | + if alice.sessionCount() != 2 { | |
| 60 | + t.Fatalf("a session of its own: %d sessions", alice.sessionCount()) | |
| 61 | + } | |
| 62 | + view := f.idle(t, direct.ID, 2) | |
| 63 | + if len(view.Messages) != 2 { | |
| 64 | + t.Fatalf("no trace in the conversation: %s", describe(view.Messages)) | |
| 65 | + } | |
| 66 | + // The conversation goes on in its own session. | |
| 67 | + f.send(t, direct.ID, "again") | |
| 68 | + f.idle(t, direct.ID, 4) | |
| 69 | + if alice.sessionCount() != 2 { | |
| 70 | + t.Fatalf("the conversation keeps its session: %d sessions", alice.sessionCount()) | |
| 71 | + } | |
| 72 | +} | |
| 73 | + | |
| 74 | +func TestAnAnsweringAgentIsNotAskedToUnload(t *testing.T) { | |
| 75 | + release := make(chan struct{}) | |
| 76 | + f := setup(t, map[string]script{ | |
| 77 | + "/unload": unloads, | |
| 78 | + "slow": func(context.Context, acp.SessionHandler) (acp.TurnResult, error) { | |
| 79 | + <-release | |
| 80 | + return acp.TurnResult{StopReason: "end_turn"}, nil | |
| 81 | + }, | |
| 82 | + }) | |
| 83 | + alice := f.source.conn("alice") | |
| 84 | + alice.commands = []acp.Command{{Name: "unload"}} | |
| 85 | + direct, _ := f.manager.Direct("alice") | |
| 86 | + f.send(t, direct.ID, "slow") | |
| 87 | + waitFor(t, func() bool { return len(alice.sent()) == 1 }) | |
| 88 | + if _, err := f.manager.Unload(context.Background(), "alice"); !errors.Is(err, channels.ErrAgentAnswering) { | |
| 89 | + t.Fatalf("refused during an answer: %v", err) | |
| 90 | + } | |
| 91 | + close(release) | |
| 92 | + f.idle(t, direct.ID, 2) | |
| 93 | + if _, err := f.manager.Unload(context.Background(), "alice"); err != nil { | |
| 94 | + t.Fatalf("accepted once the answer ended: %v", err) | |
| 95 | + } | |
| 96 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package channels_test | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "testing" | ||
| 9 | + | ||
| 10 | + "git.rickub.com/bots-garden/sidekicks/internal/acp" | ||
| 11 | + "git.rickub.com/bots-garden/sidekicks/internal/channels" | ||
| 12 | +) | ||
| 13 | + | ||
| 14 | +// unloads is the fake agents' answer to /unload, like mm. | ||
| 15 | +func unloads(_ context.Context, handler acp.SessionHandler) (acp.TurnResult, error) { | ||
| 16 | + handler.Update(acp.Update{Kind: acp.UpdateMessage, Text: "unloaded: gemma\n"}) | ||
| 17 | + return acp.TurnResult{StopReason: "end_turn"}, nil | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +func TestAnAgentWithoutTheUnloadCommandIsNotAskedToUnload(t *testing.T) { | ||
| 21 | + f := setup(t, map[string]script{"/unload": unloads}) | ||
| 22 | + f.source.conn("alice").commands = []acp.Command{{Name: "compact"}} | ||
| 23 | + direct, _ := f.manager.Direct("alice") | ||
| 24 | + if err := f.manager.Prepare(context.Background(), direct.ID); err != nil { | ||
| 25 | + t.Fatal(err) | ||
| 26 | + } | ||
| 27 | + if f.manager.CanUnload("alice") || f.manager.CanUnload("bob") { | ||
| 28 | + t.Fatal("neither alice nor bob announced unload") | ||
| 29 | + } | ||
| 30 | + if _, err := f.manager.Unload(context.Background(), "alice"); !errors.Is(err, channels.ErrCannotUnload) { | ||
| 31 | + t.Fatalf("refused: %v", err) | ||
| 32 | + } | ||
| 33 | + if sent := f.source.conn("alice").sent(); len(sent) != 0 { | ||
| 34 | + t.Fatalf("nothing sent: %q", sent) | ||
| 35 | + } | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +func TestUnloadSendsTheCommandInASessionOfItsOwn(t *testing.T) { | ||
| 39 | + f := setup(t, map[string]script{"/unload": unloads}) | ||
| 40 | + alice := f.source.conn("alice") | ||
| 41 | + alice.commands = []acp.Command{{Name: "compact"}, {Name: "unload"}} | ||
| 42 | + direct, _ := f.manager.Direct("alice") | ||
| 43 | + f.send(t, direct.ID, "hello") | ||
| 44 | + f.idle(t, direct.ID, 2) | ||
| 45 | + if !f.manager.CanUnload("alice") { | ||
| 46 | + t.Fatal("alice announced unload") | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + answer, err := f.manager.Unload(context.Background(), "alice") | ||
| 50 | + if err != nil { | ||
| 51 | + t.Fatal(err) | ||
| 52 | + } | ||
| 53 | + if answer != "unloaded: gemma" { | ||
| 54 | + t.Fatalf("answer: %q", answer) | ||
| 55 | + } | ||
| 56 | + if sent := alice.sent(); len(sent) != 2 || sent[1] != "/unload" { | ||
| 57 | + t.Fatalf("prompts: %q", sent) | ||
| 58 | + } | ||
| 59 | + if alice.sessionCount() != 2 { | ||
| 60 | + t.Fatalf("a session of its own: %d sessions", alice.sessionCount()) | ||
| 61 | + } | ||
| 62 | + view := f.idle(t, direct.ID, 2) | ||
| 63 | + if len(view.Messages) != 2 { | ||
| 64 | + t.Fatalf("no trace in the conversation: %s", describe(view.Messages)) | ||
| 65 | + } | ||
| 66 | + // The conversation goes on in its own session. | ||
| 67 | + f.send(t, direct.ID, "again") | ||
| 68 | + f.idle(t, direct.ID, 4) | ||
| 69 | + if alice.sessionCount() != 2 { | ||
| 70 | + t.Fatalf("the conversation keeps its session: %d sessions", alice.sessionCount()) | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +func TestAnAnsweringAgentIsNotAskedToUnload(t *testing.T) { | ||
| 75 | + release := make(chan struct{}) | ||
| 76 | + f := setup(t, map[string]script{ | ||
| 77 | + "/unload": unloads, | ||
| 78 | + "slow": func(context.Context, acp.SessionHandler) (acp.TurnResult, error) { | ||
| 79 | + <-release | ||
| 80 | + return acp.TurnResult{StopReason: "end_turn"}, nil | ||
| 81 | + }, | ||
| 82 | + }) | ||
| 83 | + alice := f.source.conn("alice") | ||
| 84 | + alice.commands = []acp.Command{{Name: "unload"}} | ||
| 85 | + direct, _ := f.manager.Direct("alice") | ||
| 86 | + f.send(t, direct.ID, "slow") | ||
| 87 | + waitFor(t, func() bool { return len(alice.sent()) == 1 }) | ||
| 88 | + if _, err := f.manager.Unload(context.Background(), "alice"); !errors.Is(err, channels.ErrAgentAnswering) { | ||
| 89 | + t.Fatalf("refused during an answer: %v", err) | ||
| 90 | + } | ||
| 91 | + close(release) | ||
| 92 | + f.idle(t, direct.ID, 2) | ||
| 93 | + if _, err := f.manager.Unload(context.Background(), "alice"); err != nil { | ||
| 94 | + t.Fatalf("accepted once the answer ended: %v", err) | ||
| 95 | + } | ||
| 96 | +} | ||
modified
internal/config/config.go +10 -0 | @@ -34,6 +34,7 @@ const ( | ||
| 34 | 34 | DefaultLanguage = "en" |
| 35 | 35 | DefaultMaxRunningAgents = 2 |
| 36 | 36 | DefaultStopIdleAgentsAfter = 10 * time.Minute |
| 37 | + DefaultMaxAgentHandoffs = 3 | |
| 37 | 38 | RuntimeLocal = "local" |
| 38 | 39 | ) |
| 39 | 40 | |
| @@ -62,6 +63,10 @@ type Limits struct { | ||
| 62 | 63 | MaxRunningAgents int |
| 63 | 64 | // StopIdleAgentsAfter is 0 when idle agents are never stopped. |
| 64 | 65 | StopIdleAgentsAfter time.Duration |
| 66 | + // MaxAgentHandoffs is how many times, for one message in a channel, an | |
| 67 | + // agent may hand the floor to another one by mentioning it with @name | |
| 68 | + // (issue #26); 0 turns it off. | |
| 69 | + MaxAgentHandoffs int | |
| 65 | 70 | } |
| 66 | 71 | |
| 67 | 72 | // Agent describes one agent Sidekicks can start. |
| @@ -328,6 +333,7 @@ type rawConfig struct { | ||
| 328 | 333 | Limits struct { |
| 329 | 334 | MaxRunningAgents int `yaml:"maxRunningAgents"` |
| 330 | 335 | StopIdleAgentsAfter string `yaml:"stopIdleAgentsAfter"` |
| 336 | + MaxAgentHandoffs *int `yaml:"maxAgentHandoffs"` | |
| 331 | 337 | } `yaml:"limits"` |
| 332 | 338 | Agents []struct { |
| 333 | 339 | Name string `yaml:"name"` |
| @@ -367,8 +373,12 @@ func (raw *rawConfig) toConfig(baseDir string) *Config { | ||
| 367 | 373 | Limits: Limits{ |
| 368 | 374 | MaxRunningAgents: DefaultMaxRunningAgents, |
| 369 | 375 | StopIdleAgentsAfter: DefaultStopIdleAgentsAfter, |
| 376 | + MaxAgentHandoffs: DefaultMaxAgentHandoffs, | |
| 370 | 377 | }, |
| 371 | 378 | } |
| 379 | + if raw.Limits.MaxAgentHandoffs != nil { | |
| 380 | + cfg.Limits.MaxAgentHandoffs = *raw.Limits.MaxAgentHandoffs | |
| 381 | + } | |
| 372 | 382 | if raw.Limits.MaxRunningAgents > 0 { |
| 373 | 383 | cfg.Limits.MaxRunningAgents = raw.Limits.MaxRunningAgents |
| 374 | 384 | } |
| @@ -34,6 +34,7 @@ const ( | |||
| 34 | DefaultLanguage = "en" | 34 | DefaultLanguage = "en" |
| 35 | DefaultMaxRunningAgents = 2 | 35 | DefaultMaxRunningAgents = 2 |
| 36 | DefaultStopIdleAgentsAfter = 10 * time.Minute | 36 | DefaultStopIdleAgentsAfter = 10 * time.Minute |
| 37 | + DefaultMaxAgentHandoffs = 3 | ||
| 37 | RuntimeLocal = "local" | 38 | RuntimeLocal = "local" |
| 38 | ) | 39 | ) |
| 39 | 40 | ||
| @@ -62,6 +63,10 @@ type Limits struct { | |||
| 62 | MaxRunningAgents int | 63 | MaxRunningAgents int |
| 63 | // StopIdleAgentsAfter is 0 when idle agents are never stopped. | 64 | // StopIdleAgentsAfter is 0 when idle agents are never stopped. |
| 64 | StopIdleAgentsAfter time.Duration | 65 | StopIdleAgentsAfter time.Duration |
| 66 | + // MaxAgentHandoffs is how many times, for one message in a channel, an | ||
| 67 | + // agent may hand the floor to another one by mentioning it with @name | ||
| 68 | + // (issue #26); 0 turns it off. | ||
| 69 | + MaxAgentHandoffs int | ||
| 65 | } | 70 | } |
| 66 | 71 | ||
| 67 | // Agent describes one agent Sidekicks can start. | 72 | // Agent describes one agent Sidekicks can start. |
| @@ -328,6 +333,7 @@ type rawConfig struct { | |||
| 328 | Limits struct { | 333 | Limits struct { |
| 329 | MaxRunningAgents int `yaml:"maxRunningAgents"` | 334 | MaxRunningAgents int `yaml:"maxRunningAgents"` |
| 330 | StopIdleAgentsAfter string `yaml:"stopIdleAgentsAfter"` | 335 | StopIdleAgentsAfter string `yaml:"stopIdleAgentsAfter"` |
| 336 | + MaxAgentHandoffs *int `yaml:"maxAgentHandoffs"` | ||
| 331 | } `yaml:"limits"` | 337 | } `yaml:"limits"` |
| 332 | Agents []struct { | 338 | Agents []struct { |
| 333 | Name string `yaml:"name"` | 339 | Name string `yaml:"name"` |
| @@ -367,8 +373,12 @@ func (raw *rawConfig) toConfig(baseDir string) *Config { | |||
| 367 | Limits: Limits{ | 373 | Limits: Limits{ |
| 368 | MaxRunningAgents: DefaultMaxRunningAgents, | 374 | MaxRunningAgents: DefaultMaxRunningAgents, |
| 369 | StopIdleAgentsAfter: DefaultStopIdleAgentsAfter, | 375 | StopIdleAgentsAfter: DefaultStopIdleAgentsAfter, |
| 376 | + MaxAgentHandoffs: DefaultMaxAgentHandoffs, | ||
| 370 | }, | 377 | }, |
| 371 | } | 378 | } |
| 379 | + if raw.Limits.MaxAgentHandoffs != nil { | ||
| 380 | + cfg.Limits.MaxAgentHandoffs = *raw.Limits.MaxAgentHandoffs | ||
| 381 | + } | ||
| 372 | if raw.Limits.MaxRunningAgents > 0 { | 382 | if raw.Limits.MaxRunningAgents > 0 { |
| 373 | cfg.Limits.MaxRunningAgents = raw.Limits.MaxRunningAgents | 383 | cfg.Limits.MaxRunningAgents = raw.Limits.MaxRunningAgents |
| 374 | } | 384 | } |
modified
internal/config/config_test.go +4 -3 | @@ -51,7 +51,7 @@ func TestMinimalFileGetsTheDefaults(t *testing.T) { | ||
| 51 | 51 | if cfg.UI.Theme != "system" || cfg.UI.Language != "en" { |
| 52 | 52 | t.Errorf("ui defaults: %+v", cfg.UI) |
| 53 | 53 | } |
| 54 | - if cfg.Limits.MaxRunningAgents != 2 || cfg.Limits.StopIdleAgentsAfter != 10*time.Minute { | |
| 54 | + if cfg.Limits.MaxRunningAgents != 2 || cfg.Limits.StopIdleAgentsAfter != 10*time.Minute || cfg.Limits.MaxAgentHandoffs != 3 { | |
| 55 | 55 | t.Errorf("limits defaults: %+v", cfg.Limits) |
| 56 | 56 | } |
| 57 | 57 | alice := cfg.Agents[0] |
| @@ -92,11 +92,11 @@ agents: | ||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | func TestLimitsAndUIAreRead(t *testing.T) { |
| 95 | - cfg, err := parse(t, "version: 1\nui:\n theme: dark\n language: en\nlimits:\n maxRunningAgents: 3\n stopIdleAgentsAfter: 0\nagents: []\n") | |
| 95 | + cfg, err := parse(t, "version: 1\nui:\n theme: dark\n language: en\nlimits:\n maxRunningAgents: 3\n stopIdleAgentsAfter: 0\n maxAgentHandoffs: 0\nagents: []\n") | |
| 96 | 96 | if err != nil { |
| 97 | 97 | t.Fatal(err) |
| 98 | 98 | } |
| 99 | - if cfg.UI.Theme != "dark" || cfg.UI.Language != "en" || cfg.Limits.MaxRunningAgents != 3 || cfg.Limits.StopIdleAgentsAfter != 0 { | |
| 99 | + if cfg.UI.Theme != "dark" || cfg.UI.Language != "en" || cfg.Limits.MaxRunningAgents != 3 || cfg.Limits.StopIdleAgentsAfter != 0 || cfg.Limits.MaxAgentHandoffs != 0 { | |
| 100 | 100 | t.Fatalf("got %+v %+v", cfg.UI, cfg.Limits) |
| 101 | 101 | } |
| 102 | 102 | } |
| @@ -110,6 +110,7 @@ func TestProblemsAreLocatedAndExplained(t *testing.T) { | ||
| 110 | 110 | {"unknown key with suggestion", "version: 1\nagents:\n - name: alice\n comand: mm\n", 4, "agents[0].comand", `did you mean "command"`}, |
| 111 | 111 | {"missing key", "version: 1\nagents:\n - name: alice\n", 3, "agents[0]", `the key "command" is missing`}, |
| 112 | 112 | {"invalid name", "version: 1\nagents:\n - name: Alice Smith\n command: mm\n", 3, "agents[0].name", `"Alice Smith" is not a valid name`}, |
| 113 | + {"too many hand-offs", "version: 1\nlimits:\n maxAgentHandoffs: 11\nagents: []\n", 3, "limits.maxAgentHandoffs", ""}, | |
| 113 | 114 | {"bad duration", "version: 1\nlimits:\n stopIdleAgentsAfter: dix minutes\nagents: []\n", 3, "limits.stopIdleAgentsAfter", "is not a valid duration"}, |
| 114 | 115 | {"number other than 0 as duration", "version: 1\nlimits:\n stopIdleAgentsAfter: 5\nagents: []\n", 3, "limits.stopIdleAgentsAfter", `"5" is not a valid duration`}, |
| 115 | 116 | {"unknown theme", "version: 1\nui:\n theme: blue\nagents: []\n", 3, "ui.theme", "choose among: system, light, dark"}, |
| @@ -51,7 +51,7 @@ func TestMinimalFileGetsTheDefaults(t *testing.T) { | |||
| 51 | if cfg.UI.Theme != "system" || cfg.UI.Language != "en" { | 51 | if cfg.UI.Theme != "system" || cfg.UI.Language != "en" { |
| 52 | t.Errorf("ui defaults: %+v", cfg.UI) | 52 | t.Errorf("ui defaults: %+v", cfg.UI) |
| 53 | } | 53 | } |
| 54 | - if cfg.Limits.MaxRunningAgents != 2 || cfg.Limits.StopIdleAgentsAfter != 10*time.Minute { | 54 | + if cfg.Limits.MaxRunningAgents != 2 || cfg.Limits.StopIdleAgentsAfter != 10*time.Minute || cfg.Limits.MaxAgentHandoffs != 3 { |
| 55 | t.Errorf("limits defaults: %+v", cfg.Limits) | 55 | t.Errorf("limits defaults: %+v", cfg.Limits) |
| 56 | } | 56 | } |
| 57 | alice := cfg.Agents[0] | 57 | alice := cfg.Agents[0] |
| @@ -92,11 +92,11 @@ agents: | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | func TestLimitsAndUIAreRead(t *testing.T) { | 94 | func TestLimitsAndUIAreRead(t *testing.T) { |
| 95 | - cfg, err := parse(t, "version: 1\nui:\n theme: dark\n language: en\nlimits:\n maxRunningAgents: 3\n stopIdleAgentsAfter: 0\nagents: []\n") | 95 | + cfg, err := parse(t, "version: 1\nui:\n theme: dark\n language: en\nlimits:\n maxRunningAgents: 3\n stopIdleAgentsAfter: 0\n maxAgentHandoffs: 0\nagents: []\n") |
| 96 | if err != nil { | 96 | if err != nil { |
| 97 | t.Fatal(err) | 97 | t.Fatal(err) |
| 98 | } | 98 | } |
| 99 | - if cfg.UI.Theme != "dark" || cfg.UI.Language != "en" || cfg.Limits.MaxRunningAgents != 3 || cfg.Limits.StopIdleAgentsAfter != 0 { | 99 | + if cfg.UI.Theme != "dark" || cfg.UI.Language != "en" || cfg.Limits.MaxRunningAgents != 3 || cfg.Limits.StopIdleAgentsAfter != 0 || cfg.Limits.MaxAgentHandoffs != 0 { |
| 100 | t.Fatalf("got %+v %+v", cfg.UI, cfg.Limits) | 100 | t.Fatalf("got %+v %+v", cfg.UI, cfg.Limits) |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
| @@ -110,6 +110,7 @@ func TestProblemsAreLocatedAndExplained(t *testing.T) { | |||
| 110 | {"unknown key with suggestion", "version: 1\nagents:\n - name: alice\n comand: mm\n", 4, "agents[0].comand", `did you mean "command"`}, | 110 | {"unknown key with suggestion", "version: 1\nagents:\n - name: alice\n comand: mm\n", 4, "agents[0].comand", `did you mean "command"`}, |
| 111 | {"missing key", "version: 1\nagents:\n - name: alice\n", 3, "agents[0]", `the key "command" is missing`}, | 111 | {"missing key", "version: 1\nagents:\n - name: alice\n", 3, "agents[0]", `the key "command" is missing`}, |
| 112 | {"invalid name", "version: 1\nagents:\n - name: Alice Smith\n command: mm\n", 3, "agents[0].name", `"Alice Smith" is not a valid name`}, | 112 | {"invalid name", "version: 1\nagents:\n - name: Alice Smith\n command: mm\n", 3, "agents[0].name", `"Alice Smith" is not a valid name`}, |
| 113 | + {"too many hand-offs", "version: 1\nlimits:\n maxAgentHandoffs: 11\nagents: []\n", 3, "limits.maxAgentHandoffs", ""}, | ||
| 113 | {"bad duration", "version: 1\nlimits:\n stopIdleAgentsAfter: dix minutes\nagents: []\n", 3, "limits.stopIdleAgentsAfter", "is not a valid duration"}, | 114 | {"bad duration", "version: 1\nlimits:\n stopIdleAgentsAfter: dix minutes\nagents: []\n", 3, "limits.stopIdleAgentsAfter", "is not a valid duration"}, |
| 114 | {"number other than 0 as duration", "version: 1\nlimits:\n stopIdleAgentsAfter: 5\nagents: []\n", 3, "limits.stopIdleAgentsAfter", `"5" is not a valid duration`}, | 115 | {"number other than 0 as duration", "version: 1\nlimits:\n stopIdleAgentsAfter: 5\nagents: []\n", 3, "limits.stopIdleAgentsAfter", `"5" is not a valid duration`}, |
| 115 | {"unknown theme", "version: 1\nui:\n theme: blue\nagents: []\n", 3, "ui.theme", "choose among: system, light, dark"}, | 116 | {"unknown theme", "version: 1\nui:\n theme: blue\nagents: []\n", 3, "ui.theme", "choose among: system, light, dark"}, |
modified
internal/config/problems.go +1 -1 | @@ -291,7 +291,7 @@ func allowedKeys(path []string) []string { | ||
| 291 | 291 | case parent[0] == "ui": |
| 292 | 292 | return []string{"theme", "language"} |
| 293 | 293 | case parent[0] == "limits": |
| 294 | - return []string{"maxRunningAgents", "stopIdleAgentsAfter"} | |
| 294 | + return []string{"maxRunningAgents", "stopIdleAgentsAfter", "maxAgentHandoffs"} | |
| 295 | 295 | case parent[0] == "agents" && len(parent) == 2: |
| 296 | 296 | return []string{"name", "title", "icon", "description", "command", "args", "afterStop", "env", "workspace", "runtime", "protect"} |
| 297 | 297 | case parent[0] == "agents" && len(parent) == 3 && parent[2] == "runtime": |
| @@ -291,7 +291,7 @@ func allowedKeys(path []string) []string { | |||
| 291 | case parent[0] == "ui": | 291 | case parent[0] == "ui": |
| 292 | return []string{"theme", "language"} | 292 | return []string{"theme", "language"} |
| 293 | case parent[0] == "limits": | 293 | case parent[0] == "limits": |
| 294 | - return []string{"maxRunningAgents", "stopIdleAgentsAfter"} | 294 | + return []string{"maxRunningAgents", "stopIdleAgentsAfter", "maxAgentHandoffs"} |
| 295 | case parent[0] == "agents" && len(parent) == 2: | 295 | case parent[0] == "agents" && len(parent) == 2: |
| 296 | return []string{"name", "title", "icon", "description", "command", "args", "afterStop", "env", "workspace", "runtime", "protect"} | 296 | return []string{"name", "title", "icon", "description", "command", "args", "afterStop", "env", "workspace", "runtime", "protect"} |
| 297 | case parent[0] == "agents" && len(parent) == 3 && parent[2] == "runtime": | 297 | case parent[0] == "agents" && len(parent) == 3 && parent[2] == "runtime": |
modified
internal/lifecycle/sbxenv.go +3 -1 | @@ -23,6 +23,8 @@ var ErrNotSbxEnv = errors.New("not an sbx environment file (sbxenv.yaml)") | ||
| 23 | 23 | type SbxEnv struct { |
| 24 | 24 | // Name is the sandbox's name ("name:"); "" when the file does not set it. |
| 25 | 25 | Name string |
| 26 | + // Agent is the sbx agent of the sandbox ("agent:"), such as claude or codex. | |
| 27 | + Agent string | |
| 26 | 28 | // Folder is the folder of the file: the commands run there. |
| 27 | 29 | Folder string |
| 28 | 30 | // Workspace is the absolute host folder the sandbox mounts ("workspace:"); |
| @@ -64,7 +66,7 @@ func ReadSbxEnv(path string) (SbxEnv, error) { | ||
| 64 | 66 | if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 { |
| 65 | 67 | return SbxEnv{}, ErrNotSbxEnv |
| 66 | 68 | } |
| 67 | - env := SbxEnv{Name: file.Name, Folder: filepath.Dir(absolute)} | |
| 69 | + env := SbxEnv{Name: file.Name, Agent: file.Agent, Folder: filepath.Dir(absolute)} | |
| 68 | 70 | // A path built from ${{ … }} values is only known to sbx: it is left out. |
| 69 | 71 | if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") { |
| 70 | 72 | if !filepath.IsAbs(workspace) { |
| @@ -23,6 +23,8 @@ var ErrNotSbxEnv = errors.New("not an sbx environment file (sbxenv.yaml)") | |||
| 23 | type SbxEnv struct { | 23 | type SbxEnv struct { |
| 24 | // Name is the sandbox's name ("name:"); "" when the file does not set it. | 24 | // Name is the sandbox's name ("name:"); "" when the file does not set it. |
| 25 | Name string | 25 | Name string |
| 26 | + // Agent is the sbx agent of the sandbox ("agent:"), such as claude or codex. | ||
| 27 | + Agent string | ||
| 26 | // Folder is the folder of the file: the commands run there. | 28 | // Folder is the folder of the file: the commands run there. |
| 27 | Folder string | 29 | Folder string |
| 28 | // Workspace is the absolute host folder the sandbox mounts ("workspace:"); | 30 | // Workspace is the absolute host folder the sandbox mounts ("workspace:"); |
| @@ -64,7 +66,7 @@ func ReadSbxEnv(path string) (SbxEnv, error) { | |||
| 64 | if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 { | 66 | if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 { |
| 65 | return SbxEnv{}, ErrNotSbxEnv | 67 | return SbxEnv{}, ErrNotSbxEnv |
| 66 | } | 68 | } |
| 67 | - env := SbxEnv{Name: file.Name, Folder: filepath.Dir(absolute)} | 69 | + env := SbxEnv{Name: file.Name, Agent: file.Agent, Folder: filepath.Dir(absolute)} |
| 68 | // A path built from ${{ … }} values is only known to sbx: it is left out. | 70 | // A path built from ${{ … }} values is only known to sbx: it is left out. |
| 69 | if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") { | 71 | if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") { |
| 70 | if !filepath.IsAbs(workspace) { | 72 | if !filepath.IsAbs(workspace) { |
modified
internal/lifecycle/sbxenv_test.go +24 -0 | @@ -75,3 +75,27 @@ func TestReadSbxEnvRefusesOtherFiles(t *testing.T) { | ||
| 75 | 75 | t.Fatal("a missing file is an error") |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | + | |
| 79 | +// The examples of agents/snippets (issues #81, #82, #84) are read as the | |
| 80 | +// assistant reads a dropped sbxenv.yaml. | |
| 81 | +func TestTheSnippetsSandboxesAreRead(t *testing.T) { | |
| 82 | + paths, err := filepath.Glob("../../agents/snippets/*/sbxenv.yaml") | |
| 83 | + if err != nil || len(paths) == 0 { | |
| 84 | + t.Fatalf("no snippet: %v", err) | |
| 85 | + } | |
| 86 | + for _, path := range paths { | |
| 87 | + env, err := lifecycle.ReadSbxEnv(path) | |
| 88 | + folder := filepath.Base(filepath.Dir(path)) | |
| 89 | + if err != nil || env.Name != folder || filepath.Base(env.Workspace) != "workspace" { | |
| 90 | + t.Errorf("%s: %+v, %v", path, env, err) | |
| 91 | + } | |
| 92 | + } | |
| 93 | +} | |
| 94 | + | |
| 95 | +func TestReadSbxEnvGivesTheAgent(t *testing.T) { | |
| 96 | + path := write(t, t.TempDir(), "sbxenv.yaml", "name: codex-acp\nagent: codex\n") | |
| 97 | + env, err := lifecycle.ReadSbxEnv(path) | |
| 98 | + if err != nil || env.Agent != "codex" { | |
| 99 | + t.Fatalf("got %+v, %v", env, err) | |
| 100 | + } | |
| 101 | +} | |
| @@ -75,3 +75,27 @@ func TestReadSbxEnvRefusesOtherFiles(t *testing.T) { | |||
| 75 | t.Fatal("a missing file is an error") | 75 | t.Fatal("a missing file is an error") |
| 76 | } | 76 | } |
| 77 | } | 77 | } |
| 78 | + | ||
| 79 | +// The examples of agents/snippets (issues #81, #82, #84) are read as the | ||
| 80 | +// assistant reads a dropped sbxenv.yaml. | ||
| 81 | +func TestTheSnippetsSandboxesAreRead(t *testing.T) { | ||
| 82 | + paths, err := filepath.Glob("../../agents/snippets/*/sbxenv.yaml") | ||
| 83 | + if err != nil || len(paths) == 0 { | ||
| 84 | + t.Fatalf("no snippet: %v", err) | ||
| 85 | + } | ||
| 86 | + for _, path := range paths { | ||
| 87 | + env, err := lifecycle.ReadSbxEnv(path) | ||
| 88 | + folder := filepath.Base(filepath.Dir(path)) | ||
| 89 | + if err != nil || env.Name != folder || filepath.Base(env.Workspace) != "workspace" { | ||
| 90 | + t.Errorf("%s: %+v, %v", path, env, err) | ||
| 91 | + } | ||
| 92 | + } | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +func TestReadSbxEnvGivesTheAgent(t *testing.T) { | ||
| 96 | + path := write(t, t.TempDir(), "sbxenv.yaml", "name: codex-acp\nagent: codex\n") | ||
| 97 | + env, err := lifecycle.ReadSbxEnv(path) | ||
| 98 | + if err != nil || env.Agent != "codex" { | ||
| 99 | + t.Fatalf("got %+v, %v", env, err) | ||
| 100 | + } | ||
| 101 | +} | ||
modified
internal/workspace/container.go +53 -0 | @@ -241,6 +241,59 @@ func (c *Remote) Remove(ctx context.Context, p string) error { | ||
| 241 | 241 | return err |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | +// Rename implements Workspace. | |
| 245 | +func (c *Remote) Rename(ctx context.Context, from, to string) error { | |
| 246 | + source, fromRel, err := c.resolve(from) | |
| 247 | + if err != nil { | |
| 248 | + return err | |
| 249 | + } | |
| 250 | + target, toRel, err := c.resolve(to) | |
| 251 | + if err != nil { | |
| 252 | + return err | |
| 253 | + } | |
| 254 | + if err := checkRename(fromRel, toRel); err != nil { | |
| 255 | + return err | |
| 256 | + } | |
| 257 | + const script = `test -e "$1" || test -L "$1" || exit 3 | |
| 258 | +if test -e "$2" || test -L "$2"; then exit 5; fi | |
| 259 | +mkdir -p "$(dirname "$2")" && mv -- "$1" "$2"` | |
| 260 | + _, err = c.run(ctx, script, source, nil, target) | |
| 261 | + return err | |
| 262 | +} | |
| 263 | + | |
| 264 | +// Copy implements Workspace. | |
| 265 | +func (c *Remote) Copy(ctx context.Context, from, to string) error { | |
| 266 | + source, fromRel, err := c.resolve(from) | |
| 267 | + if err != nil { | |
| 268 | + return err | |
| 269 | + } | |
| 270 | + target, toRel, err := c.resolve(to) | |
| 271 | + if err != nil { | |
| 272 | + return err | |
| 273 | + } | |
| 274 | + if err := checkRename(fromRel, toRel); err != nil { | |
| 275 | + return err | |
| 276 | + } | |
| 277 | + const script = `test -e "$1" || test -L "$1" || exit 3 | |
| 278 | +if test -e "$2" || test -L "$2"; then exit 5; fi | |
| 279 | +mkdir -p "$(dirname "$2")" && cp -RPp -- "$1" "$2"` | |
| 280 | + _, err = c.run(ctx, script, source, nil, target) | |
| 281 | + return err | |
| 282 | +} | |
| 283 | + | |
| 284 | +// MakeDir implements Workspace. | |
| 285 | +func (c *Remote) MakeDir(ctx context.Context, p string) error { | |
| 286 | + abs, rel, err := c.resolve(p) | |
| 287 | + if err != nil { | |
| 288 | + return err | |
| 289 | + } | |
| 290 | + if rel == "" { | |
| 291 | + return ErrExists | |
| 292 | + } | |
| 293 | + _, err = c.run(ctx, `if test -e "$1" || test -L "$1"; then exit 5; fi; mkdir -p "$1"`, abs, nil) | |
| 294 | + return err | |
| 295 | +} | |
| 296 | + | |
| 244 | 297 | // Changes implements Workspace by comparing, every two seconds, the dates |
| 245 | 298 | // and sizes of the files: a container or a sandbox offers no notifications |
| 246 | 299 | // to the outside. |
| @@ -241,6 +241,59 @@ func (c *Remote) Remove(ctx context.Context, p string) error { | |||
| 241 | return err | 241 | return err |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | +// Rename implements Workspace. | ||
| 245 | +func (c *Remote) Rename(ctx context.Context, from, to string) error { | ||
| 246 | + source, fromRel, err := c.resolve(from) | ||
| 247 | + if err != nil { | ||
| 248 | + return err | ||
| 249 | + } | ||
| 250 | + target, toRel, err := c.resolve(to) | ||
| 251 | + if err != nil { | ||
| 252 | + return err | ||
| 253 | + } | ||
| 254 | + if err := checkRename(fromRel, toRel); err != nil { | ||
| 255 | + return err | ||
| 256 | + } | ||
| 257 | + const script = `test -e "$1" || test -L "$1" || exit 3 | ||
| 258 | +if test -e "$2" || test -L "$2"; then exit 5; fi | ||
| 259 | +mkdir -p "$(dirname "$2")" && mv -- "$1" "$2"` | ||
| 260 | + _, err = c.run(ctx, script, source, nil, target) | ||
| 261 | + return err | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +// Copy implements Workspace. | ||
| 265 | +func (c *Remote) Copy(ctx context.Context, from, to string) error { | ||
| 266 | + source, fromRel, err := c.resolve(from) | ||
| 267 | + if err != nil { | ||
| 268 | + return err | ||
| 269 | + } | ||
| 270 | + target, toRel, err := c.resolve(to) | ||
| 271 | + if err != nil { | ||
| 272 | + return err | ||
| 273 | + } | ||
| 274 | + if err := checkRename(fromRel, toRel); err != nil { | ||
| 275 | + return err | ||
| 276 | + } | ||
| 277 | + const script = `test -e "$1" || test -L "$1" || exit 3 | ||
| 278 | +if test -e "$2" || test -L "$2"; then exit 5; fi | ||
| 279 | +mkdir -p "$(dirname "$2")" && cp -RPp -- "$1" "$2"` | ||
| 280 | + _, err = c.run(ctx, script, source, nil, target) | ||
| 281 | + return err | ||
| 282 | +} | ||
| 283 | + | ||
| 284 | +// MakeDir implements Workspace. | ||
| 285 | +func (c *Remote) MakeDir(ctx context.Context, p string) error { | ||
| 286 | + abs, rel, err := c.resolve(p) | ||
| 287 | + if err != nil { | ||
| 288 | + return err | ||
| 289 | + } | ||
| 290 | + if rel == "" { | ||
| 291 | + return ErrExists | ||
| 292 | + } | ||
| 293 | + _, err = c.run(ctx, `if test -e "$1" || test -L "$1"; then exit 5; fi; mkdir -p "$1"`, abs, nil) | ||
| 294 | + return err | ||
| 295 | +} | ||
| 296 | + | ||
| 244 | // Changes implements Workspace by comparing, every two seconds, the dates | 297 | // Changes implements Workspace by comparing, every two seconds, the dates |
| 245 | // and sizes of the files: a container or a sandbox offers no notifications | 298 | // and sizes of the files: a container or a sandbox offers no notifications |
| 246 | // to the outside. | 299 | // to the outside. |
modified
internal/workspace/contract_test.go +108 -0 | @@ -128,6 +128,9 @@ func contract(t *testing.T, open opener) { | ||
| 128 | 128 | {"reads any file as bytes", checkReadsAnyFileAsBytes}, |
| 129 | 129 | {"imports a file under a free name", checkImportsAFileUnderAFreeName}, |
| 130 | 130 | {"removes a file and a folder", checkRemovesAFileAndAFolder}, |
| 131 | + {"renames and moves files and folders", checkRenamesAndMovesFilesAndFolders}, | |
| 132 | + {"creates a folder", checkCreatesAFolder}, | |
| 133 | + {"copies files and folders", checkCopiesFilesAndFolders}, | |
| 131 | 134 | {"signals changes", checkSignalsChanges}, |
| 132 | 135 | {"opens a shell in the folder", checkOpensAShellInTheFolder}, |
| 133 | 136 | {"a shell exits even when nobody reads it", checkAShellExitsEvenWhenNobodyReadsIt}, |
| @@ -282,6 +285,90 @@ func checkRemovesAFileAndAFolder(t *testing.T, open opener) { | ||
| 282 | 285 | } |
| 283 | 286 | } |
| 284 | 287 | |
| 288 | +func checkRenamesAndMovesFilesAndFolders(t *testing.T, open opener) { | |
| 289 | + ctx := context.Background() | |
| 290 | + ws := startWorkspace(t, open) | |
| 291 | + if err := ws.Rename(ctx, "AGENTS.md", "notes/STYLE.md"); err != nil { | |
| 292 | + t.Fatal(err) | |
| 293 | + } | |
| 294 | + if file, err := ws.Read(ctx, "notes/STYLE.md"); err != nil || file.Content != "# Style\n" { | |
| 295 | + t.Fatalf("moved file: %+v %v", file, err) | |
| 296 | + } | |
| 297 | + if _, err := ws.Read(ctx, "AGENTS.md"); !errors.Is(err, workspace.ErrNotFound) { | |
| 298 | + t.Fatalf("the old name is gone, got %v", err) | |
| 299 | + } | |
| 300 | + // A folder moves with its content, into a folder created on the way. | |
| 301 | + if err := ws.Rename(ctx, "skills", "archive/2026/skills"); err != nil { | |
| 302 | + t.Fatal(err) | |
| 303 | + } | |
| 304 | + if file, err := ws.Read(ctx, "archive/2026/skills/idioms/SKILL.md"); err != nil || file.Content != "idioms" { | |
| 305 | + t.Fatalf("moved folder: %+v %v", file, err) | |
| 306 | + } | |
| 307 | + if err := ws.Rename(ctx, "notes/STYLE.md", "archive"); !errors.Is(err, workspace.ErrExists) { | |
| 308 | + t.Fatalf("never over an existing entry, got %v", err) | |
| 309 | + } | |
| 310 | + if err := ws.Rename(ctx, "missing.md", "found.md"); !errors.Is(err, workspace.ErrNotFound) { | |
| 311 | + t.Fatalf("want ErrNotFound, got %v", err) | |
| 312 | + } | |
| 313 | + if err := ws.Rename(ctx, "archive", "archive/inside"); err == nil { | |
| 314 | + t.Fatal("a folder cannot go inside itself") | |
| 315 | + } | |
| 316 | + if err := ws.Rename(ctx, "notes", "../notes"); !errors.Is(err, workspace.ErrOutside) { | |
| 317 | + t.Fatalf("want ErrOutside, got %v", err) | |
| 318 | + } | |
| 319 | + if err := ws.Rename(ctx, "", "elsewhere"); !errors.Is(err, workspace.ErrOutside) { | |
| 320 | + t.Fatalf("never the whole folder, got %v", err) | |
| 321 | + } | |
| 322 | +} | |
| 323 | + | |
| 324 | +func checkCopiesFilesAndFolders(t *testing.T, open opener) { | |
| 325 | + ctx := context.Background() | |
| 326 | + ws := startWorkspace(t, open) | |
| 327 | + if err := ws.Copy(ctx, "AGENTS.md", "AGENTS-copy.md"); err != nil { | |
| 328 | + t.Fatal(err) | |
| 329 | + } | |
| 330 | + for _, name := range []string{"AGENTS.md", "AGENTS-copy.md"} { | |
| 331 | + if file, err := ws.Read(ctx, name); err != nil || file.Content != "# Style\n" { | |
| 332 | + t.Fatalf("%s: %+v %v", name, file, err) | |
| 333 | + } | |
| 334 | + } | |
| 335 | + if err := ws.Copy(ctx, "skills", "archive/skills"); err != nil { | |
| 336 | + t.Fatal(err) | |
| 337 | + } | |
| 338 | + for _, name := range []string{"skills/idioms/SKILL.md", "archive/skills/idioms/SKILL.md"} { | |
| 339 | + if file, err := ws.Read(ctx, name); err != nil || file.Content != "idioms" { | |
| 340 | + t.Fatalf("%s: %+v %v", name, file, err) | |
| 341 | + } | |
| 342 | + } | |
| 343 | + if err := ws.Copy(ctx, "AGENTS.md", "notes"); !errors.Is(err, workspace.ErrExists) { | |
| 344 | + t.Fatalf("never over an existing entry, got %v", err) | |
| 345 | + } | |
| 346 | + if err := ws.Copy(ctx, "missing.md", "found.md"); !errors.Is(err, workspace.ErrNotFound) { | |
| 347 | + t.Fatalf("want ErrNotFound, got %v", err) | |
| 348 | + } | |
| 349 | + if err := ws.Copy(ctx, "skills", "skills/inside"); err == nil { | |
| 350 | + t.Fatal("a folder cannot be copied inside itself") | |
| 351 | + } | |
| 352 | +} | |
| 353 | + | |
| 354 | +func checkCreatesAFolder(t *testing.T, open opener) { | |
| 355 | + ctx := context.Background() | |
| 356 | + ws := startWorkspace(t, open) | |
| 357 | + if err := ws.MakeDir(ctx, "drafts/2026"); err != nil { | |
| 358 | + t.Fatal(err) | |
| 359 | + } | |
| 360 | + entries, err := ws.List(ctx, "drafts") | |
| 361 | + if err != nil || len(entries) != 1 || !entries[0].Dir || entries[0].Path != "drafts/2026" { | |
| 362 | + t.Fatalf("got %+v %v", entries, err) | |
| 363 | + } | |
| 364 | + if err := ws.MakeDir(ctx, "notes"); !errors.Is(err, workspace.ErrExists) { | |
| 365 | + t.Fatalf("want ErrExists, got %v", err) | |
| 366 | + } | |
| 367 | + if err := ws.MakeDir(ctx, "AGENTS.md"); !errors.Is(err, workspace.ErrExists) { | |
| 368 | + t.Fatalf("want ErrExists for a file, got %v", err) | |
| 369 | + } | |
| 370 | +} | |
| 371 | + | |
| 285 | 372 | func checkSignalsChanges(t *testing.T, open opener) { |
| 286 | 373 | ctx := context.Background() |
| 287 | 374 | ws := startWorkspace(t, open) |
| @@ -449,6 +536,27 @@ func TestCleanKeepsPathsInsideTheFolder(t *testing.T) { | ||
| 449 | 536 | } |
| 450 | 537 | } |
| 451 | 538 | |
| 539 | +func TestOutermostKeepsWhatIsNotInsideAnotherPath(t *testing.T) { | |
| 540 | + got, err := workspace.Outermost([]string{"notes/a.md", "notes", "b.md", "./b.md", "notes-2/c.md"}) | |
| 541 | + if err != nil || strings.Join(got, ",") != "notes,b.md,notes-2/c.md" { | |
| 542 | + t.Fatalf("got %v %v", got, err) | |
| 543 | + } | |
| 544 | + if got, _ := workspace.Outermost([]string{"a", "", "b"}); len(got) != 1 || got[0] != "" { | |
| 545 | + t.Fatalf("the root holds everything: %v", got) | |
| 546 | + } | |
| 547 | + if _, err := workspace.Outermost([]string{"a", "../b"}); !errors.Is(err, workspace.ErrOutside) { | |
| 548 | + t.Fatalf("want ErrOutside, got %v", err) | |
| 549 | + } | |
| 550 | +} | |
| 551 | + | |
| 552 | +func TestCopyNameAddsCopyBeforeTheExtension(t *testing.T) { | |
| 553 | + for name, want := range map[string]string{"plan.md": "plan-copy.md", ".env": ".env-copy", "notes": "notes-copy", "a.tar.gz": "a.tar-copy.gz"} { | |
| 554 | + if got := workspace.CopyName(name); got != want { | |
| 555 | + t.Errorf("CopyName(%q) = %q, want %q", name, got, want) | |
| 556 | + } | |
| 557 | + } | |
| 558 | +} | |
| 559 | + | |
| 452 | 560 | func ExampleClean() { |
| 453 | 561 | cleaned, _ := workspace.Clean("skills/../AGENTS.md") |
| 454 | 562 | _, err := workspace.Clean("../secrets") |
| @@ -128,6 +128,9 @@ func contract(t *testing.T, open opener) { | |||
| 128 | {"reads any file as bytes", checkReadsAnyFileAsBytes}, | 128 | {"reads any file as bytes", checkReadsAnyFileAsBytes}, |
| 129 | {"imports a file under a free name", checkImportsAFileUnderAFreeName}, | 129 | {"imports a file under a free name", checkImportsAFileUnderAFreeName}, |
| 130 | {"removes a file and a folder", checkRemovesAFileAndAFolder}, | 130 | {"removes a file and a folder", checkRemovesAFileAndAFolder}, |
| 131 | + {"renames and moves files and folders", checkRenamesAndMovesFilesAndFolders}, | ||
| 132 | + {"creates a folder", checkCreatesAFolder}, | ||
| 133 | + {"copies files and folders", checkCopiesFilesAndFolders}, | ||
| 131 | {"signals changes", checkSignalsChanges}, | 134 | {"signals changes", checkSignalsChanges}, |
| 132 | {"opens a shell in the folder", checkOpensAShellInTheFolder}, | 135 | {"opens a shell in the folder", checkOpensAShellInTheFolder}, |
| 133 | {"a shell exits even when nobody reads it", checkAShellExitsEvenWhenNobodyReadsIt}, | 136 | {"a shell exits even when nobody reads it", checkAShellExitsEvenWhenNobodyReadsIt}, |
| @@ -282,6 +285,90 @@ func checkRemovesAFileAndAFolder(t *testing.T, open opener) { | |||
| 282 | } | 285 | } |
| 283 | } | 286 | } |
| 284 | 287 | ||
| 288 | +func checkRenamesAndMovesFilesAndFolders(t *testing.T, open opener) { | ||
| 289 | + ctx := context.Background() | ||
| 290 | + ws := startWorkspace(t, open) | ||
| 291 | + if err := ws.Rename(ctx, "AGENTS.md", "notes/STYLE.md"); err != nil { | ||
| 292 | + t.Fatal(err) | ||
| 293 | + } | ||
| 294 | + if file, err := ws.Read(ctx, "notes/STYLE.md"); err != nil || file.Content != "# Style\n" { | ||
| 295 | + t.Fatalf("moved file: %+v %v", file, err) | ||
| 296 | + } | ||
| 297 | + if _, err := ws.Read(ctx, "AGENTS.md"); !errors.Is(err, workspace.ErrNotFound) { | ||
| 298 | + t.Fatalf("the old name is gone, got %v", err) | ||
| 299 | + } | ||
| 300 | + // A folder moves with its content, into a folder created on the way. | ||
| 301 | + if err := ws.Rename(ctx, "skills", "archive/2026/skills"); err != nil { | ||
| 302 | + t.Fatal(err) | ||
| 303 | + } | ||
| 304 | + if file, err := ws.Read(ctx, "archive/2026/skills/idioms/SKILL.md"); err != nil || file.Content != "idioms" { | ||
| 305 | + t.Fatalf("moved folder: %+v %v", file, err) | ||
| 306 | + } | ||
| 307 | + if err := ws.Rename(ctx, "notes/STYLE.md", "archive"); !errors.Is(err, workspace.ErrExists) { | ||
| 308 | + t.Fatalf("never over an existing entry, got %v", err) | ||
| 309 | + } | ||
| 310 | + if err := ws.Rename(ctx, "missing.md", "found.md"); !errors.Is(err, workspace.ErrNotFound) { | ||
| 311 | + t.Fatalf("want ErrNotFound, got %v", err) | ||
| 312 | + } | ||
| 313 | + if err := ws.Rename(ctx, "archive", "archive/inside"); err == nil { | ||
| 314 | + t.Fatal("a folder cannot go inside itself") | ||
| 315 | + } | ||
| 316 | + if err := ws.Rename(ctx, "notes", "../notes"); !errors.Is(err, workspace.ErrOutside) { | ||
| 317 | + t.Fatalf("want ErrOutside, got %v", err) | ||
| 318 | + } | ||
| 319 | + if err := ws.Rename(ctx, "", "elsewhere"); !errors.Is(err, workspace.ErrOutside) { | ||
| 320 | + t.Fatalf("never the whole folder, got %v", err) | ||
| 321 | + } | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +func checkCopiesFilesAndFolders(t *testing.T, open opener) { | ||
| 325 | + ctx := context.Background() | ||
| 326 | + ws := startWorkspace(t, open) | ||
| 327 | + if err := ws.Copy(ctx, "AGENTS.md", "AGENTS-copy.md"); err != nil { | ||
| 328 | + t.Fatal(err) | ||
| 329 | + } | ||
| 330 | + for _, name := range []string{"AGENTS.md", "AGENTS-copy.md"} { | ||
| 331 | + if file, err := ws.Read(ctx, name); err != nil || file.Content != "# Style\n" { | ||
| 332 | + t.Fatalf("%s: %+v %v", name, file, err) | ||
| 333 | + } | ||
| 334 | + } | ||
| 335 | + if err := ws.Copy(ctx, "skills", "archive/skills"); err != nil { | ||
| 336 | + t.Fatal(err) | ||
| 337 | + } | ||
| 338 | + for _, name := range []string{"skills/idioms/SKILL.md", "archive/skills/idioms/SKILL.md"} { | ||
| 339 | + if file, err := ws.Read(ctx, name); err != nil || file.Content != "idioms" { | ||
| 340 | + t.Fatalf("%s: %+v %v", name, file, err) | ||
| 341 | + } | ||
| 342 | + } | ||
| 343 | + if err := ws.Copy(ctx, "AGENTS.md", "notes"); !errors.Is(err, workspace.ErrExists) { | ||
| 344 | + t.Fatalf("never over an existing entry, got %v", err) | ||
| 345 | + } | ||
| 346 | + if err := ws.Copy(ctx, "missing.md", "found.md"); !errors.Is(err, workspace.ErrNotFound) { | ||
| 347 | + t.Fatalf("want ErrNotFound, got %v", err) | ||
| 348 | + } | ||
| 349 | + if err := ws.Copy(ctx, "skills", "skills/inside"); err == nil { | ||
| 350 | + t.Fatal("a folder cannot be copied inside itself") | ||
| 351 | + } | ||
| 352 | +} | ||
| 353 | + | ||
| 354 | +func checkCreatesAFolder(t *testing.T, open opener) { | ||
| 355 | + ctx := context.Background() | ||
| 356 | + ws := startWorkspace(t, open) | ||
| 357 | + if err := ws.MakeDir(ctx, "drafts/2026"); err != nil { | ||
| 358 | + t.Fatal(err) | ||
| 359 | + } | ||
| 360 | + entries, err := ws.List(ctx, "drafts") | ||
| 361 | + if err != nil || len(entries) != 1 || !entries[0].Dir || entries[0].Path != "drafts/2026" { | ||
| 362 | + t.Fatalf("got %+v %v", entries, err) | ||
| 363 | + } | ||
| 364 | + if err := ws.MakeDir(ctx, "notes"); !errors.Is(err, workspace.ErrExists) { | ||
| 365 | + t.Fatalf("want ErrExists, got %v", err) | ||
| 366 | + } | ||
| 367 | + if err := ws.MakeDir(ctx, "AGENTS.md"); !errors.Is(err, workspace.ErrExists) { | ||
| 368 | + t.Fatalf("want ErrExists for a file, got %v", err) | ||
| 369 | + } | ||
| 370 | +} | ||
| 371 | + | ||
| 285 | func checkSignalsChanges(t *testing.T, open opener) { | 372 | func checkSignalsChanges(t *testing.T, open opener) { |
| 286 | ctx := context.Background() | 373 | ctx := context.Background() |
| 287 | ws := startWorkspace(t, open) | 374 | ws := startWorkspace(t, open) |
| @@ -449,6 +536,27 @@ func TestCleanKeepsPathsInsideTheFolder(t *testing.T) { | |||
| 449 | } | 536 | } |
| 450 | } | 537 | } |
| 451 | 538 | ||
| 539 | +func TestOutermostKeepsWhatIsNotInsideAnotherPath(t *testing.T) { | ||
| 540 | + got, err := workspace.Outermost([]string{"notes/a.md", "notes", "b.md", "./b.md", "notes-2/c.md"}) | ||
| 541 | + if err != nil || strings.Join(got, ",") != "notes,b.md,notes-2/c.md" { | ||
| 542 | + t.Fatalf("got %v %v", got, err) | ||
| 543 | + } | ||
| 544 | + if got, _ := workspace.Outermost([]string{"a", "", "b"}); len(got) != 1 || got[0] != "" { | ||
| 545 | + t.Fatalf("the root holds everything: %v", got) | ||
| 546 | + } | ||
| 547 | + if _, err := workspace.Outermost([]string{"a", "../b"}); !errors.Is(err, workspace.ErrOutside) { | ||
| 548 | + t.Fatalf("want ErrOutside, got %v", err) | ||
| 549 | + } | ||
| 550 | +} | ||
| 551 | + | ||
| 552 | +func TestCopyNameAddsCopyBeforeTheExtension(t *testing.T) { | ||
| 553 | + for name, want := range map[string]string{"plan.md": "plan-copy.md", ".env": ".env-copy", "notes": "notes-copy", "a.tar.gz": "a.tar-copy.gz"} { | ||
| 554 | + if got := workspace.CopyName(name); got != want { | ||
| 555 | + t.Errorf("CopyName(%q) = %q, want %q", name, got, want) | ||
| 556 | + } | ||
| 557 | + } | ||
| 558 | +} | ||
| 559 | + | ||
| 452 | func ExampleClean() { | 560 | func ExampleClean() { |
| 453 | cleaned, _ := workspace.Clean("skills/../AGENTS.md") | 561 | cleaned, _ := workspace.Clean("skills/../AGENTS.md") |
| 454 | _, err := workspace.Clean("../secrets") | 562 | _, err := workspace.Clean("../secrets") |
modified
internal/workspace/local.go +113 -0 | @@ -5,6 +5,7 @@ package workspace | ||
| 5 | 5 | import ( |
| 6 | 6 | "context" |
| 7 | 7 | "errors" |
| 8 | + "io" | |
| 8 | 9 | "io/fs" |
| 9 | 10 | "os" |
| 10 | 11 | "os/exec" |
| @@ -224,6 +225,118 @@ func (l *Local) Remove(_ context.Context, p string) error { | ||
| 224 | 225 | return moveToTrash(abs) |
| 225 | 226 | } |
| 226 | 227 | |
| 228 | +// Rename implements Workspace. | |
| 229 | +func (l *Local) Rename(_ context.Context, from, to string) error { | |
| 230 | + source, fromRel, err := l.resolve(from) | |
| 231 | + if err != nil { | |
| 232 | + return err | |
| 233 | + } | |
| 234 | + target, toRel, err := l.resolve(to) | |
| 235 | + if err != nil { | |
| 236 | + return err | |
| 237 | + } | |
| 238 | + if err := checkRename(fromRel, toRel); err != nil { | |
| 239 | + return err | |
| 240 | + } | |
| 241 | + info, err := os.Lstat(source) | |
| 242 | + if err != nil { | |
| 243 | + return notFound(err) | |
| 244 | + } | |
| 245 | + // SameFile: only the case of the name changes (notes.md → Notes.md) on | |
| 246 | + // a case-insensitive disk, where the target "exists", being the source. | |
| 247 | + if existing, err := os.Lstat(target); err == nil && !os.SameFile(info, existing) { | |
| 248 | + return ErrExists | |
| 249 | + } | |
| 250 | + if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil { | |
| 251 | + return err | |
| 252 | + } | |
| 253 | + return os.Rename(source, target) | |
| 254 | +} | |
| 255 | + | |
| 256 | +// Copy implements Workspace: files keep their permissions, symbolic links | |
| 257 | +// are copied as links. | |
| 258 | +func (l *Local) Copy(_ context.Context, from, to string) error { | |
| 259 | + source, fromRel, err := l.resolve(from) | |
| 260 | + if err != nil { | |
| 261 | + return err | |
| 262 | + } | |
| 263 | + target, toRel, err := l.resolve(to) | |
| 264 | + if err != nil { | |
| 265 | + return err | |
| 266 | + } | |
| 267 | + if err := checkRename(fromRel, toRel); err != nil { | |
| 268 | + return err | |
| 269 | + } | |
| 270 | + if _, err := os.Lstat(source); err != nil { | |
| 271 | + return notFound(err) | |
| 272 | + } | |
| 273 | + if _, err := os.Lstat(target); err == nil { | |
| 274 | + return ErrExists | |
| 275 | + } | |
| 276 | + return filepath.WalkDir(source, func(p string, entry fs.DirEntry, err error) error { | |
| 277 | + if err != nil { | |
| 278 | + return err | |
| 279 | + } | |
| 280 | + rel, err := filepath.Rel(source, p) | |
| 281 | + if err != nil { | |
| 282 | + return err | |
| 283 | + } | |
| 284 | + destination := filepath.Join(target, rel) | |
| 285 | + info, err := entry.Info() | |
| 286 | + if err != nil { | |
| 287 | + return err | |
| 288 | + } | |
| 289 | + switch { | |
| 290 | + case entry.Type()&fs.ModeSymlink != 0: | |
| 291 | + link, err := os.Readlink(p) | |
| 292 | + if err != nil { | |
| 293 | + return err | |
| 294 | + } | |
| 295 | + return os.Symlink(link, destination) | |
| 296 | + case entry.IsDir(): | |
| 297 | + return os.MkdirAll(destination, info.Mode().Perm()|0o700) | |
| 298 | + default: | |
| 299 | + return copyFile(p, destination, info.Mode().Perm()) | |
| 300 | + } | |
| 301 | + }) | |
| 302 | +} | |
| 303 | + | |
| 304 | +// copyFile copies the file at source to destination, which must not exist. | |
| 305 | +func copyFile(source, destination string, mode fs.FileMode) error { | |
| 306 | + if err := os.MkdirAll(filepath.Dir(destination), 0o755); err != nil { | |
| 307 | + return err | |
| 308 | + } | |
| 309 | + in, err := os.Open(source) | |
| 310 | + if err != nil { | |
| 311 | + return err | |
| 312 | + } | |
| 313 | + defer func() { _ = in.Close() }() | |
| 314 | + out, err := os.OpenFile(destination, os.O_WRONLY|os.O_CREATE|os.O_EXCL, mode) | |
| 315 | + if err != nil { | |
| 316 | + return err | |
| 317 | + } | |
| 318 | + if _, err := io.Copy(out, in); err != nil { | |
| 319 | + _ = out.Close() | |
| 320 | + return err | |
| 321 | + } | |
| 322 | + return out.Close() | |
| 323 | +} | |
| 324 | + | |
| 325 | +// MakeDir implements Workspace. | |
| 326 | +func (l *Local) MakeDir(_ context.Context, p string) error { | |
| 327 | + abs, rel, err := l.resolve(p) | |
| 328 | + if err != nil { | |
| 329 | + return err | |
| 330 | + } | |
| 331 | + if rel == "" { | |
| 332 | + return ErrExists | |
| 333 | + } | |
| 334 | + if _, err := os.Lstat(abs); err == nil { | |
| 335 | + return ErrExists | |
| 336 | + } | |
| 337 | + return os.MkdirAll(abs, 0o755) | |
| 338 | +} | |
| 339 | + | |
| 227 | 340 | // Changes implements Workspace with file system notifications. Folders |
| 228 | 341 | // that hold many files nobody edits by hand are not watched. |
| 229 | 342 | func (l *Local) Changes(ctx context.Context) (<-chan struct{}, error) { |
| @@ -5,6 +5,7 @@ package workspace | |||
| 5 | import ( | 5 | import ( |
| 6 | "context" | 6 | "context" |
| 7 | "errors" | 7 | "errors" |
| 8 | + "io" | ||
| 8 | "io/fs" | 9 | "io/fs" |
| 9 | "os" | 10 | "os" |
| 10 | "os/exec" | 11 | "os/exec" |
| @@ -224,6 +225,118 @@ func (l *Local) Remove(_ context.Context, p string) error { | |||
| 224 | return moveToTrash(abs) | 225 | return moveToTrash(abs) |
| 225 | } | 226 | } |
| 226 | 227 | ||
| 228 | +// Rename implements Workspace. | ||
| 229 | +func (l *Local) Rename(_ context.Context, from, to string) error { | ||
| 230 | + source, fromRel, err := l.resolve(from) | ||
| 231 | + if err != nil { | ||
| 232 | + return err | ||
| 233 | + } | ||
| 234 | + target, toRel, err := l.resolve(to) | ||
| 235 | + if err != nil { | ||
| 236 | + return err | ||
| 237 | + } | ||
| 238 | + if err := checkRename(fromRel, toRel); err != nil { | ||
| 239 | + return err | ||
| 240 | + } | ||
| 241 | + info, err := os.Lstat(source) | ||
| 242 | + if err != nil { | ||
| 243 | + return notFound(err) | ||
| 244 | + } | ||
| 245 | + // SameFile: only the case of the name changes (notes.md → Notes.md) on | ||
| 246 | + // a case-insensitive disk, where the target "exists", being the source. | ||
| 247 | + if existing, err := os.Lstat(target); err == nil && !os.SameFile(info, existing) { | ||
| 248 | + return ErrExists | ||
| 249 | + } | ||
| 250 | + if err := os.MkdirAll(filepath.Dir(target), 0o755); err != nil { | ||
| 251 | + return err | ||
| 252 | + } | ||
| 253 | + return os.Rename(source, target) | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | +// Copy implements Workspace: files keep their permissions, symbolic links | ||
| 257 | +// are copied as links. | ||
| 258 | +func (l *Local) Copy(_ context.Context, from, to string) error { | ||
| 259 | + source, fromRel, err := l.resolve(from) | ||
| 260 | + if err != nil { | ||
| 261 | + return err | ||
| 262 | + } | ||
| 263 | + target, toRel, err := l.resolve(to) | ||
| 264 | + if err != nil { | ||
| 265 | + return err | ||
| 266 | + } | ||
| 267 | + if err := checkRename(fromRel, toRel); err != nil { | ||
| 268 | + return err | ||
| 269 | + } | ||
| 270 | + if _, err := os.Lstat(source); err != nil { | ||
| 271 | + return notFound(err) | ||
| 272 | + } | ||
| 273 | + if _, err := os.Lstat(target); err == nil { | ||
| 274 | + return ErrExists | ||
| 275 | + } | ||
| 276 | + return filepath.WalkDir(source, func(p string, entry fs.DirEntry, err error) error { | ||
| 277 | + if err != nil { | ||
| 278 | + return err | ||
| 279 | + } | ||
| 280 | + rel, err := filepath.Rel(source, p) | ||
| 281 | + if err != nil { | ||
| 282 | + return err | ||
| 283 | + } | ||
| 284 | + destination := filepath.Join(target, rel) | ||
| 285 | + info, err := entry.Info() | ||
| 286 | + if err != nil { | ||
| 287 | + return err | ||
| 288 | + } | ||
| 289 | + switch { | ||
| 290 | + case entry.Type()&fs.ModeSymlink != 0: | ||
| 291 | + link, err := os.Readlink(p) | ||
| 292 | + if err != nil { | ||
| 293 | + return err | ||
| 294 | + } | ||
| 295 | + return os.Symlink(link, destination) | ||
| 296 | + case entry.IsDir(): | ||
| 297 | + return os.MkdirAll(destination, info.Mode().Perm()|0o700) | ||
| 298 | + default: | ||
| 299 | + return copyFile(p, destination, info.Mode().Perm()) | ||
| 300 | + } | ||
| 301 | + }) | ||
| 302 | +} | ||
| 303 | + | ||
| 304 | +// copyFile copies the file at source to destination, which must not exist. | ||
| 305 | +func copyFile(source, destination string, mode fs.FileMode) error { | ||
| 306 | + if err := os.MkdirAll(filepath.Dir(destination), 0o755); err != nil { | ||
| 307 | + return err | ||
| 308 | + } | ||
| 309 | + in, err := os.Open(source) | ||
| 310 | + if err != nil { | ||
| 311 | + return err | ||
| 312 | + } | ||
| 313 | + defer func() { _ = in.Close() }() | ||
| 314 | + out, err := os.OpenFile(destination, os.O_WRONLY|os.O_CREATE|os.O_EXCL, mode) | ||
| 315 | + if err != nil { | ||
| 316 | + return err | ||
| 317 | + } | ||
| 318 | + if _, err := io.Copy(out, in); err != nil { | ||
| 319 | + _ = out.Close() | ||
| 320 | + return err | ||
| 321 | + } | ||
| 322 | + return out.Close() | ||
| 323 | +} | ||
| 324 | + | ||
| 325 | +// MakeDir implements Workspace. | ||
| 326 | +func (l *Local) MakeDir(_ context.Context, p string) error { | ||
| 327 | + abs, rel, err := l.resolve(p) | ||
| 328 | + if err != nil { | ||
| 329 | + return err | ||
| 330 | + } | ||
| 331 | + if rel == "" { | ||
| 332 | + return ErrExists | ||
| 333 | + } | ||
| 334 | + if _, err := os.Lstat(abs); err == nil { | ||
| 335 | + return ErrExists | ||
| 336 | + } | ||
| 337 | + return os.MkdirAll(abs, 0o755) | ||
| 338 | +} | ||
| 339 | + | ||
| 227 | // Changes implements Workspace with file system notifications. Folders | 340 | // Changes implements Workspace with file system notifications. Folders |
| 228 | // that hold many files nobody edits by hand are not watched. | 341 | // that hold many files nobody edits by hand are not watched. |
| 229 | func (l *Local) Changes(ctx context.Context) (<-chan struct{}, error) { | 342 | func (l *Local) Changes(ctx context.Context) (<-chan struct{}, error) { |
modified
internal/workspace/workspace.go +78 -0 | @@ -106,6 +106,17 @@ type Workspace interface { | ||
| 106 | 106 | // Remove removes a file or a folder with its content. A local workspace |
| 107 | 107 | // puts it in the system trash. |
| 108 | 108 | Remove(ctx context.Context, path string) error |
| 109 | + // Rename renames or moves a file or a folder to path to (its folders are | |
| 110 | + // created if needed); ErrExists when something already has that path | |
| 111 | + // (issue #70). | |
| 112 | + Rename(ctx context.Context, from, to string) error | |
| 113 | + // Copy copies a file, or a folder with its content, to path to (its | |
| 114 | + // folders are created if needed); ErrExists when something already has | |
| 115 | + // that path (issue #70). | |
| 116 | + Copy(ctx context.Context, from, to string) error | |
| 117 | + // MakeDir creates a folder, and its parents if needed; ErrExists when | |
| 118 | + // something already has that path (issue #70). | |
| 119 | + MakeDir(ctx context.Context, path string) error | |
| 109 | 120 | // Changes signals, at most every half second, that something changed in |
| 110 | 121 | // the folder, until ctx ends. |
| 111 | 122 | Changes(ctx context.Context) (<-chan struct{}, error) |
| @@ -161,6 +172,73 @@ func freeName(name string, taken func(string) bool) string { | ||
| 161 | 172 | return candidate |
| 162 | 173 | } |
| 163 | 174 | |
| 175 | +// checkRename checks the paths of a renaming, already cleaned: neither is | |
| 176 | +// the root, and a folder never goes inside itself. | |
| 177 | +// | |
| 178 | +// checkRename("notes", "notes/old") // error | |
| 179 | +func checkRename(from, to string) error { | |
| 180 | + if from == "" || to == "" { | |
| 181 | + return ErrOutside | |
| 182 | + } | |
| 183 | + if to == from || strings.HasPrefix(to, from+"/") { | |
| 184 | + return fmt.Errorf("%s cannot be moved into itself", from) | |
| 185 | + } | |
| 186 | + return nil | |
| 187 | +} | |
| 188 | + | |
| 189 | +// Outermost cleans paths and keeps those that are not inside another one | |
| 190 | +// of the list, in their order, without duplicates: removing or moving a | |
| 191 | +// folder takes what it holds along (issue #70). | |
| 192 | +// | |
| 193 | +// Outermost([]string{"notes/a.md", "notes", "b.md"}) // ["notes", "b.md"], nil | |
| 194 | +func Outermost(paths []string) ([]string, error) { | |
| 195 | + cleaned := make([]string, 0, len(paths)) | |
| 196 | + for _, p := range paths { | |
| 197 | + clean, err := Clean(p) | |
| 198 | + if err != nil { | |
| 199 | + return nil, err | |
| 200 | + } | |
| 201 | + cleaned = append(cleaned, clean) | |
| 202 | + } | |
| 203 | + result := []string{} | |
| 204 | + for index, candidate := range cleaned { | |
| 205 | + kept := true | |
| 206 | + for other, container := range cleaned { | |
| 207 | + inside := container != candidate && (container == "" || strings.HasPrefix(candidate, container+"/")) | |
| 208 | + duplicate := container == candidate && other < index | |
| 209 | + if inside || duplicate { | |
| 210 | + kept = false | |
| 211 | + break | |
| 212 | + } | |
| 213 | + } | |
| 214 | + if kept { | |
| 215 | + result = append(result, candidate) | |
| 216 | + } | |
| 217 | + } | |
| 218 | + return result, nil | |
| 219 | +} | |
| 220 | + | |
| 221 | +// CopyName is the name of the copy of name: "-copy" before its extension. | |
| 222 | +// | |
| 223 | +// CopyName("plan.md") // "plan-copy.md" | |
| 224 | +// CopyName(".env") // ".env-copy" | |
| 225 | +func CopyName(name string) string { | |
| 226 | + extension := path.Ext(name) | |
| 227 | + base := strings.TrimSuffix(name, extension) | |
| 228 | + if base == "" { | |
| 229 | + base, extension = name, "" | |
| 230 | + } | |
| 231 | + return base + "-copy" + extension | |
| 232 | +} | |
| 233 | + | |
| 234 | +// FreeName returns name, or name with -2, -3… before its extension, the | |
| 235 | +// first one taken does not take. | |
| 236 | +// | |
| 237 | +// FreeName("plan-copy.md", taken) // "plan-copy.md", then "plan-copy-2.md"… | |
| 238 | +func FreeName(name string, taken func(string) bool) string { | |
| 239 | + return freeName(name, taken) | |
| 240 | +} | |
| 241 | + | |
| 164 | 242 | // checkImport checks the name and the size of an imported file. |
| 165 | 243 | func checkImport(name string, data []byte) error { |
| 166 | 244 | if name == "" || name == "." || name == ".." || strings.ContainsAny(name, "/\\") { |
| @@ -106,6 +106,17 @@ type Workspace interface { | |||
| 106 | // Remove removes a file or a folder with its content. A local workspace | 106 | // Remove removes a file or a folder with its content. A local workspace |
| 107 | // puts it in the system trash. | 107 | // puts it in the system trash. |
| 108 | Remove(ctx context.Context, path string) error | 108 | Remove(ctx context.Context, path string) error |
| 109 | + // Rename renames or moves a file or a folder to path to (its folders are | ||
| 110 | + // created if needed); ErrExists when something already has that path | ||
| 111 | + // (issue #70). | ||
| 112 | + Rename(ctx context.Context, from, to string) error | ||
| 113 | + // Copy copies a file, or a folder with its content, to path to (its | ||
| 114 | + // folders are created if needed); ErrExists when something already has | ||
| 115 | + // that path (issue #70). | ||
| 116 | + Copy(ctx context.Context, from, to string) error | ||
| 117 | + // MakeDir creates a folder, and its parents if needed; ErrExists when | ||
| 118 | + // something already has that path (issue #70). | ||
| 119 | + MakeDir(ctx context.Context, path string) error | ||
| 109 | // Changes signals, at most every half second, that something changed in | 120 | // Changes signals, at most every half second, that something changed in |
| 110 | // the folder, until ctx ends. | 121 | // the folder, until ctx ends. |
| 111 | Changes(ctx context.Context) (<-chan struct{}, error) | 122 | Changes(ctx context.Context) (<-chan struct{}, error) |
| @@ -161,6 +172,73 @@ func freeName(name string, taken func(string) bool) string { | |||
| 161 | return candidate | 172 | return candidate |
| 162 | } | 173 | } |
| 163 | 174 | ||
| 175 | +// checkRename checks the paths of a renaming, already cleaned: neither is | ||
| 176 | +// the root, and a folder never goes inside itself. | ||
| 177 | +// | ||
| 178 | +// checkRename("notes", "notes/old") // error | ||
| 179 | +func checkRename(from, to string) error { | ||
| 180 | + if from == "" || to == "" { | ||
| 181 | + return ErrOutside | ||
| 182 | + } | ||
| 183 | + if to == from || strings.HasPrefix(to, from+"/") { | ||
| 184 | + return fmt.Errorf("%s cannot be moved into itself", from) | ||
| 185 | + } | ||
| 186 | + return nil | ||
| 187 | +} | ||
| 188 | + | ||
| 189 | +// Outermost cleans paths and keeps those that are not inside another one | ||
| 190 | +// of the list, in their order, without duplicates: removing or moving a | ||
| 191 | +// folder takes what it holds along (issue #70). | ||
| 192 | +// | ||
| 193 | +// Outermost([]string{"notes/a.md", "notes", "b.md"}) // ["notes", "b.md"], nil | ||
| 194 | +func Outermost(paths []string) ([]string, error) { | ||
| 195 | + cleaned := make([]string, 0, len(paths)) | ||
| 196 | + for _, p := range paths { | ||
| 197 | + clean, err := Clean(p) | ||
| 198 | + if err != nil { | ||
| 199 | + return nil, err | ||
| 200 | + } | ||
| 201 | + cleaned = append(cleaned, clean) | ||
| 202 | + } | ||
| 203 | + result := []string{} | ||
| 204 | + for index, candidate := range cleaned { | ||
| 205 | + kept := true | ||
| 206 | + for other, container := range cleaned { | ||
| 207 | + inside := container != candidate && (container == "" || strings.HasPrefix(candidate, container+"/")) | ||
| 208 | + duplicate := container == candidate && other < index | ||
| 209 | + if inside || duplicate { | ||
| 210 | + kept = false | ||
| 211 | + break | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + if kept { | ||
| 215 | + result = append(result, candidate) | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + return result, nil | ||
| 219 | +} | ||
| 220 | + | ||
| 221 | +// CopyName is the name of the copy of name: "-copy" before its extension. | ||
| 222 | +// | ||
| 223 | +// CopyName("plan.md") // "plan-copy.md" | ||
| 224 | +// CopyName(".env") // ".env-copy" | ||
| 225 | +func CopyName(name string) string { | ||
| 226 | + extension := path.Ext(name) | ||
| 227 | + base := strings.TrimSuffix(name, extension) | ||
| 228 | + if base == "" { | ||
| 229 | + base, extension = name, "" | ||
| 230 | + } | ||
| 231 | + return base + "-copy" + extension | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +// FreeName returns name, or name with -2, -3… before its extension, the | ||
| 235 | +// first one taken does not take. | ||
| 236 | +// | ||
| 237 | +// FreeName("plan-copy.md", taken) // "plan-copy.md", then "plan-copy-2.md"… | ||
| 238 | +func FreeName(name string, taken func(string) bool) string { | ||
| 239 | + return freeName(name, taken) | ||
| 240 | +} | ||
| 241 | + | ||
| 164 | // checkImport checks the name and the size of an imported file. | 242 | // checkImport checks the name and the size of an imported file. |
| 165 | func checkImport(name string, data []byte) error { | 243 | func checkImport(name string, data []byte) error { |
| 166 | if name == "" || name == "." || name == ".." || strings.ContainsAny(name, "/\\") { | 244 | if name == "" || name == "." || name == ".." || strings.ContainsAny(name, "/\\") { |
modified
schema/config.schema.json +7 -0 | @@ -84,6 +84,13 @@ | ||
| 84 | 84 | "default": "10m", |
| 85 | 85 | "minimum": 0, |
| 86 | 86 | "maximum": 0 |
| 87 | + }, | |
| 88 | + "maxAgentHandoffs": { | |
| 89 | + "description": "In a channel, how many times one message may be handed from agent to agent: an agent whose answer mentions another member with @name hands it the floor. 0 turns it off.", | |
| 90 | + "type": "integer", | |
| 91 | + "minimum": 0, | |
| 92 | + "maximum": 10, | |
| 93 | + "default": 3 | |
| 87 | 94 | } |
| 88 | 95 | } |
| 89 | 96 | }, |
| @@ -84,6 +84,13 @@ | |||
| 84 | "default": "10m", | 84 | "default": "10m", |
| 85 | "minimum": 0, | 85 | "minimum": 0, |
| 86 | "maximum": 0 | 86 | "maximum": 0 |
| 87 | + }, | ||
| 88 | + "maxAgentHandoffs": { | ||
| 89 | + "description": "In a channel, how many times one message may be handed from agent to agent: an agent whose answer mentions another member with @name hands it the floor. 0 turns it off.", | ||
| 90 | + "type": "integer", | ||
| 91 | + "minimum": 0, | ||
| 92 | + "maximum": 10, | ||
| 93 | + "default": 3 | ||
| 87 | } | 94 | } |
| 88 | } | 95 | } |
| 89 | }, | 96 | }, |