Merge feature/96-sbx-creator into main
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
added
.memory/handoffs/2026-11-14-sbx-creator.md +15 -0 | new file mode 100644 | ||
| @@ -0,0 +1,15 @@ | ||
| 1 | +# Handoff — 2026-11-14 — #96 "Create a sbx agent" assistant | |
| 2 | + | |
| 3 | +## State | |
| 4 | + | |
| 5 | +Branch `feature/96-sbx-creator` (from main after the merge of feature/94-mini-me-creator; nothing pushed). #96 implemented and tested with a fake sbx; only task 6 (real sbx on the Mac, three kinds) is open. | |
| 6 | + | |
| 7 | +## Next steps | |
| 8 | + | |
| 9 | +1. On the Mac with sbx: create Claude, Gemini and Codex agents with the assistant, save a key through it, start each one. Check for Gemini/Antigravity: `agent: antigravity` accepted by `sbx env create`, `agy acp` answers, permissions asked in the conversation, the `google` bindings (kit v3) are fine. | |
| 10 | +2. If `sbx secret ls` prints something else than `SCOPE SERVICE SECRET` rows (HasSecret parses fields 0 and 1), adapt `sbxcreate.HasSecret`. | |
| 11 | + | |
| 12 | +## Watch out for | |
| 13 | + | |
| 14 | +- The secret must never be written in a file or a log (not in the agent log, not in `sbx` command lines shown by the lifecycle runner). | |
| 15 | +- `sbx ls -q` lists sandboxes (lifecycle.go already uses it) for the name check. | |
| new file mode 100644 | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | +# Handoff — 2026-11-14 — #96 "Create a sbx agent" assistant | ||
| 2 | + | ||
| 3 | +## State | ||
| 4 | + | ||
| 5 | +Branch `feature/96-sbx-creator` (from main after the merge of feature/94-mini-me-creator; nothing pushed). #96 implemented and tested with a fake sbx; only task 6 (real sbx on the Mac, three kinds) is open. | ||
| 6 | + | ||
| 7 | +## Next steps | ||
| 8 | + | ||
| 9 | +1. On the Mac with sbx: create Claude, Gemini and Codex agents with the assistant, save a key through it, start each one. Check for Gemini/Antigravity: `agent: antigravity` accepted by `sbx env create`, `agy acp` answers, permissions asked in the conversation, the `google` bindings (kit v3) are fine. | ||
| 10 | +2. If `sbx secret ls` prints something else than `SCOPE SERVICE SECRET` rows (HasSecret parses fields 0 and 1), adapt `sbxcreate.HasSecret`. | ||
| 11 | + | ||
| 12 | +## Watch out for | ||
| 13 | + | ||
| 14 | +- The secret must never be written in a file or a log (not in the agent log, not in `sbx` command lines shown by the lifecycle runner). | ||
| 15 | +- `sbx ls -q` lists sandboxes (lifecycle.go already uses it) for the name check. | ||
modified
.memory/history.md +8 -0 | @@ -257,3 +257,11 @@ | ||
| 257 | 257 | - **2026-11-14 — #94 closed** (owner: "close the task, do the docs, close the task and the ticket"): tasks 7 (sbx agent start not tried — closed on the owner's word) and 8 closed. Docs: create-a-mini-me-agent EN/FR gained "I have no name!" (update mini-me, `mm dockerinit`, `docker compose up -d --build`); release notes v1.5.0 EN/FR drafted with #94 and #95 (comment on #93, its task 2 left open). README status still says 1.4.0 (#93's job). |
| 258 | 258 | - **2026-11-14 — ticket #96** (owner: "a new wizard 'create a sbx agent': Claude, Gemini or Codex for now, more later; folder in Documents by default, changeable; examples in ./tmp and config entries pasted"): #96 written (epic Docker SBX, no milestone yet): catalogue of types, `<agentsFolder>/<name>/sbxenv.yaml` + `workspace/`, config entries as the owner's, reuse of agentform.ts sbx knowledge. Open points in the ticket: sandbox name (name vs name-acp, uniqueness via `sbx ls`), API keys / OAuth (`sbx secret set …`), English comments, Gemini kit deprecation. Not committed. |
| 259 | 259 | - **2026-11-14 — #96 decisions** (owner): sandbox name = agent name; keys: explain, check the sbx secret exists, else ask and set it; English comments; Gemini moves to the `antigravity` kit once its ACP is understood (task 8); #96 in v1.5.0 (listed in #93). Branch feature/94-mini-me-creator merged into main (not pushed); new branch feature/96-sbx-creator. |
| 260 | + | |
| 261 | +## 2026-11-14 — #96 sandbox creation assistant (branch feature/96-sbx-creator) | |
| 262 | + | |
| 263 | +- Asked: "start #96". Task 8 first: Antigravity — kit `docker.io/sbx/antigravity:latest` (v3), `agent: antigravity`, ACP via `agy acp` (Docker suggests `--dangerously-skip-permissions`; Sidekicks does not pass it so permissions show in the conversation — to confirm on the Mac), key `sbx secret set google` (OAuth is interactive only: the assistant asks for a key). sbx secrets: stdin for `sbx secret set <service>`; `sbx secret ls --service` prints SCOPE SERVICE SECRET (masked). | |
| 264 | +- Done: `internal/sbxcreate` (catalogue, Render/Write, Sbx: Sandboxes/HasSecret/SetSecret with the key scrubbed from errors), `internal/app/sbxcreator.go` `SbxCreatorService` (Kinds, Check with free-name suggestion kind, kind-2…, SetKey, Create → AddAgent with sbx exec -i + lifecycle from the written sbxenv; problem `sandboxExists` added), UI `CreateSbxAgent.svelte` (kind → key → details), entry points (welcome, Agents panel, palette), agentform.ts knows `agent: antigravity`. `appState.creator` became a string. | |
| 265 | +- Tests: Go (sbxcreate with a fake sh sbx, app service), vitest, lint (two tests simplified for gocyclo); Xvfb with a fake sbx on PATH: key via stdin (not in calls nor app log), `claude` refused as an existing sandbox, `claude-2` added with exactly the owner's entry shape. No sbx in this sandbox: real test on the Mac (task 6) open. | |
| 266 | +- Docs EN/FR: how-to create-an-agent-in-a-sandbox / creer-un-agent-dans-une-sandbox, agents-and-events (`SbxCreatorService`), configuration (`agentsFolder` for both assistants), shortcuts, READMEs, add-an-agent see-also, release notes v1.5.0. | |
| 267 | +- **2026-11-14 — #96 closed** (owner tested the three kinds on the Mac: all work). **Vibe research** (owner: "could we add Mistral Vibe? kit docker/sbx-kits-contrib/vibe — check ACP"): `vibe-acp` is Vibe's ACP server, installed with `mistral-vibe` (in the kit's image via uv tool install, path not verified); kit `docker.io/sbx/vibe-kit:latest` (spec schemaVersion 2), `agent: vibe` likely; key service `mistral` (api.mistral.ai); the kit's entrypoint (`vibe --trust --agent auto-approve`) is not used by `sbx exec -i … vibe-acp` — trust/profile to check. Findings in #86's comment; proposal: a catalogue entry of #96. Waiting for the owner. | |
| @@ -257,3 +257,11 @@ | |||
| 257 | - **2026-11-14 — #94 closed** (owner: "close the task, do the docs, close the task and the ticket"): tasks 7 (sbx agent start not tried — closed on the owner's word) and 8 closed. Docs: create-a-mini-me-agent EN/FR gained "I have no name!" (update mini-me, `mm dockerinit`, `docker compose up -d --build`); release notes v1.5.0 EN/FR drafted with #94 and #95 (comment on #93, its task 2 left open). README status still says 1.4.0 (#93's job). | 257 | - **2026-11-14 — #94 closed** (owner: "close the task, do the docs, close the task and the ticket"): tasks 7 (sbx agent start not tried — closed on the owner's word) and 8 closed. Docs: create-a-mini-me-agent EN/FR gained "I have no name!" (update mini-me, `mm dockerinit`, `docker compose up -d --build`); release notes v1.5.0 EN/FR drafted with #94 and #95 (comment on #93, its task 2 left open). README status still says 1.4.0 (#93's job). |
| 258 | - **2026-11-14 — ticket #96** (owner: "a new wizard 'create a sbx agent': Claude, Gemini or Codex for now, more later; folder in Documents by default, changeable; examples in ./tmp and config entries pasted"): #96 written (epic Docker SBX, no milestone yet): catalogue of types, `<agentsFolder>/<name>/sbxenv.yaml` + `workspace/`, config entries as the owner's, reuse of agentform.ts sbx knowledge. Open points in the ticket: sandbox name (name vs name-acp, uniqueness via `sbx ls`), API keys / OAuth (`sbx secret set …`), English comments, Gemini kit deprecation. Not committed. | 258 | - **2026-11-14 — ticket #96** (owner: "a new wizard 'create a sbx agent': Claude, Gemini or Codex for now, more later; folder in Documents by default, changeable; examples in ./tmp and config entries pasted"): #96 written (epic Docker SBX, no milestone yet): catalogue of types, `<agentsFolder>/<name>/sbxenv.yaml` + `workspace/`, config entries as the owner's, reuse of agentform.ts sbx knowledge. Open points in the ticket: sandbox name (name vs name-acp, uniqueness via `sbx ls`), API keys / OAuth (`sbx secret set …`), English comments, Gemini kit deprecation. Not committed. |
| 259 | - **2026-11-14 — #96 decisions** (owner): sandbox name = agent name; keys: explain, check the sbx secret exists, else ask and set it; English comments; Gemini moves to the `antigravity` kit once its ACP is understood (task 8); #96 in v1.5.0 (listed in #93). Branch feature/94-mini-me-creator merged into main (not pushed); new branch feature/96-sbx-creator. | 259 | - **2026-11-14 — #96 decisions** (owner): sandbox name = agent name; keys: explain, check the sbx secret exists, else ask and set it; English comments; Gemini moves to the `antigravity` kit once its ACP is understood (task 8); #96 in v1.5.0 (listed in #93). Branch feature/94-mini-me-creator merged into main (not pushed); new branch feature/96-sbx-creator. |
| 260 | + | ||
| 261 | +## 2026-11-14 — #96 sandbox creation assistant (branch feature/96-sbx-creator) | ||
| 262 | + | ||
| 263 | +- Asked: "start #96". Task 8 first: Antigravity — kit `docker.io/sbx/antigravity:latest` (v3), `agent: antigravity`, ACP via `agy acp` (Docker suggests `--dangerously-skip-permissions`; Sidekicks does not pass it so permissions show in the conversation — to confirm on the Mac), key `sbx secret set google` (OAuth is interactive only: the assistant asks for a key). sbx secrets: stdin for `sbx secret set <service>`; `sbx secret ls --service` prints SCOPE SERVICE SECRET (masked). | ||
| 264 | +- Done: `internal/sbxcreate` (catalogue, Render/Write, Sbx: Sandboxes/HasSecret/SetSecret with the key scrubbed from errors), `internal/app/sbxcreator.go` `SbxCreatorService` (Kinds, Check with free-name suggestion kind, kind-2…, SetKey, Create → AddAgent with sbx exec -i + lifecycle from the written sbxenv; problem `sandboxExists` added), UI `CreateSbxAgent.svelte` (kind → key → details), entry points (welcome, Agents panel, palette), agentform.ts knows `agent: antigravity`. `appState.creator` became a string. | ||
| 265 | +- Tests: Go (sbxcreate with a fake sh sbx, app service), vitest, lint (two tests simplified for gocyclo); Xvfb with a fake sbx on PATH: key via stdin (not in calls nor app log), `claude` refused as an existing sandbox, `claude-2` added with exactly the owner's entry shape. No sbx in this sandbox: real test on the Mac (task 6) open. | ||
| 266 | +- Docs EN/FR: how-to create-an-agent-in-a-sandbox / creer-un-agent-dans-une-sandbox, agents-and-events (`SbxCreatorService`), configuration (`agentsFolder` for both assistants), shortcuts, READMEs, add-an-agent see-also, release notes v1.5.0. | ||
| 267 | +- **2026-11-14 — #96 closed** (owner tested the three kinds on the Mac: all work). **Vibe research** (owner: "could we add Mistral Vibe? kit docker/sbx-kits-contrib/vibe — check ACP"): `vibe-acp` is Vibe's ACP server, installed with `mistral-vibe` (in the kit's image via uv tool install, path not verified); kit `docker.io/sbx/vibe-kit:latest` (spec schemaVersion 2), `agent: vibe` likely; key service `mistral` (api.mistral.ai); the kit's entrypoint (`vibe --trust --agent auto-approve`) is not used by `sbx exec -i … vibe-acp` — trust/profile to check. Findings in #86's comment; proposal: a catalogue entry of #96. Waiting for the owner. | ||
modified
.memory/summary.md +1 -0 | @@ -26,6 +26,7 @@ What exists: | ||
| 26 | 26 | - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths. |
| 27 | 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). |
| 28 | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | +- Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Gemini through Antigravity `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. | |
| 29 | 30 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 30 | 31 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 31 | 32 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
| @@ -26,6 +26,7 @@ What exists: | |||
| 26 | - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths. | 26 | - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths. |
| 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). | 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). |
| 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | +- Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Gemini through Antigravity `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. | ||
| 29 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. | 30 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 30 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). | 31 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 31 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. | 32 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
modified
.tickets/issues/0086-simplifier-l-ajout-d-une-sbx-avec-mistral-vibe-acp.yaml +25 -2 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-10T05:33:49.000Z |
| 9 | -updatedAt: 2026-11-10T05:33:49.000Z | |
| 9 | +updatedAt: 2026-11-14T18:48:25.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::config |
| @@ -17,6 +17,7 @@ related: | ||
| 17 | 17 | - 81 |
| 18 | 18 | - 82 |
| 19 | 19 | - 84 |
| 20 | + - 96 | |
| 20 | 21 | body: | |
| 21 | 22 | Faire pour **Mistral Vibe** ce qui a été fait pour Claude (#81), Codex (#82) et Gemini (#84) : ajouter en quelques clics |
| 22 | 23 | un agent Vibe qui tourne dans une sandbox **sbx**, depuis l'assistant **Ajouter un agent** |
| @@ -42,4 +43,26 @@ body: | | ||
| 42 | 43 | - Un message clair si sbx, le kit ou la clé manque, avec quoi faire. |
| 43 | 44 | - Tests (formulaire, programme choisi d'après le `sbxenv.yaml`) ; textes EN + FR ; guides EN + FR. |
| 44 | 45 | tasks: [] |
| 45 | -comments: [] | |
| 46 | +comments: | |
| 47 | + - id: 1 | |
| 48 | + author: | |
| 49 | + name: k33g | |
| 50 | + email: ph.charriere@gmail.com | |
| 51 | + createdAt: 2026-11-14T18:48:25.000Z | |
| 52 | + body: | | |
| 53 | + Recherche du 2026-11-14 (kit https://github.com/docker/sbx-kits-contrib/tree/main/vibe, doc Mistral, Zed) : | |
| 54 | + - **ACP** : oui. Le paquet `mistral-vibe` installe deux commandes, `vibe` et `vibe-acp` ; `vibe-acp` est le | |
| 55 | + serveur ACP (doc Mistral « Use Vibe in other IDEs », registre ACP de Zed). Le kit installe `mistral-vibe` avec | |
| 56 | + `uv tool install` : `vibe-acp` devrait donc être dans la sandbox (à vérifier : chemin et PATH). | |
| 57 | + - **Kit** : `docker.io/sbx/vibe-kit:latest` (`spec.yaml` en `schemaVersion: "2"`), lancé par | |
| 58 | + `sbx run --kit docker.io/sbx/vibe-kit:latest vibe` : `agent: vibe` probable dans le `sbxenv.yaml`. Pas de | |
| 59 | + branche `v3` dans le dépôt (404) ; un kit v3 existe ailleurs (`olegselajev241/sbx-kit-vibe`, guide Docker). | |
| 60 | + - **Clé** : service sbx `mistral` (`printf '%s' "$MISTRAL_API_KEY" | sbx secret set mistral`), injectée pour | |
| 61 | + `api.mistral.ai` ; la sandbox ne voit qu'une valeur sentinelle. Clés sur https://console.mistral.ai. | |
| 62 | + - **Réseau** : `api.mistral.ai`, `chat.mistral.ai`, `console.mistral.ai` (et `experiments.mistral.services`). | |
| 63 | + - **Permissions** : le point d'entrée du kit lance `vibe --trust --agent auto-approve` ; `vibe-acp` lancé par | |
| 64 | + `sbx exec -i` n'utilise pas ce point d'entrée : profil et confiance du dossier à vérifier (cf. #85). | |
| 65 | + - `~/.vibe` est un volume persistant (config, sessions, `.env`). | |
| 66 | + | |
| 67 | + Proposition : Vibe devient une entrée du catalogue de #96 (`agent: vibe`, kit `docker.io/sbx/vibe-kit:latest`, | |
| 68 | + programme `vibe-acp`, service `mistral`), et l'assistant « Ajouter un agent » reconnaît `agent: vibe`. | |
| @@ -6,7 +6,7 @@ author: | |||
| 6 | name: k33g | 6 | name: k33g |
| 7 | email: ph.charriere@gmail.com | 7 | email: ph.charriere@gmail.com |
| 8 | createdAt: 2026-11-10T05:33:49.000Z | 8 | createdAt: 2026-11-10T05:33:49.000Z |
| 9 | -updatedAt: 2026-11-10T05:33:49.000Z | 9 | +updatedAt: 2026-11-14T18:48:25.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::config | 12 | - area::config |
| @@ -17,6 +17,7 @@ related: | |||
| 17 | - 81 | 17 | - 81 |
| 18 | - 82 | 18 | - 82 |
| 19 | - 84 | 19 | - 84 |
| 20 | + - 96 | ||
| 20 | body: | | 21 | body: | |
| 21 | Faire pour **Mistral Vibe** ce qui a été fait pour Claude (#81), Codex (#82) et Gemini (#84) : ajouter en quelques clics | 22 | 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 | un agent Vibe qui tourne dans une sandbox **sbx**, depuis l'assistant **Ajouter un agent** |
| @@ -42,4 +43,26 @@ body: | | |||
| 42 | - Un message clair si sbx, le kit ou la clé manque, avec quoi faire. | 43 | - 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 | - Tests (formulaire, programme choisi d'après le `sbxenv.yaml`) ; textes EN + FR ; guides EN + FR. |
| 44 | tasks: [] | 45 | tasks: [] |
| 45 | -comments: [] | 46 | +comments: |
| 47 | + - id: 1 | ||
| 48 | + author: | ||
| 49 | + name: k33g | ||
| 50 | + email: ph.charriere@gmail.com | ||
| 51 | + createdAt: 2026-11-14T18:48:25.000Z | ||
| 52 | + body: | | ||
| 53 | + Recherche du 2026-11-14 (kit https://github.com/docker/sbx-kits-contrib/tree/main/vibe, doc Mistral, Zed) : | ||
| 54 | + - **ACP** : oui. Le paquet `mistral-vibe` installe deux commandes, `vibe` et `vibe-acp` ; `vibe-acp` est le | ||
| 55 | + serveur ACP (doc Mistral « Use Vibe in other IDEs », registre ACP de Zed). Le kit installe `mistral-vibe` avec | ||
| 56 | + `uv tool install` : `vibe-acp` devrait donc être dans la sandbox (à vérifier : chemin et PATH). | ||
| 57 | + - **Kit** : `docker.io/sbx/vibe-kit:latest` (`spec.yaml` en `schemaVersion: "2"`), lancé par | ||
| 58 | + `sbx run --kit docker.io/sbx/vibe-kit:latest vibe` : `agent: vibe` probable dans le `sbxenv.yaml`. Pas de | ||
| 59 | + branche `v3` dans le dépôt (404) ; un kit v3 existe ailleurs (`olegselajev241/sbx-kit-vibe`, guide Docker). | ||
| 60 | + - **Clé** : service sbx `mistral` (`printf '%s' "$MISTRAL_API_KEY" | sbx secret set mistral`), injectée pour | ||
| 61 | + `api.mistral.ai` ; la sandbox ne voit qu'une valeur sentinelle. Clés sur https://console.mistral.ai. | ||
| 62 | + - **Réseau** : `api.mistral.ai`, `chat.mistral.ai`, `console.mistral.ai` (et `experiments.mistral.services`). | ||
| 63 | + - **Permissions** : le point d'entrée du kit lance `vibe --trust --agent auto-approve` ; `vibe-acp` lancé par | ||
| 64 | + `sbx exec -i` n'utilise pas ce point d'entrée : profil et confiance du dossier à vérifier (cf. #85). | ||
| 65 | + - `~/.vibe` est un volume persistant (config, sessions, `.env`). | ||
| 66 | + | ||
| 67 | + Proposition : Vibe devient une entrée du catalogue de #96 (`agent: vibe`, kit `docker.io/sbx/vibe-kit:latest`, | ||
| 68 | + programme `vibe-acp`, service `mistral`), et l'assistant « Ajouter un agent » reconnaît `agent: vibe`. | ||
modified
.tickets/issues/0096-assistant-create-a-sbx-agent-claude-gemini-codex.yaml +66 -16 | @@ -1,12 +1,12 @@ | ||
| 1 | 1 | # Managed by IssueSpec. Hand edits are welcome; keep the schema valid. |
| 2 | 2 | id: 96 |
| 3 | 3 | title: "Assistant « Create a sbx agent » : Claude, Gemini, Codex dans une Docker Sandbox" |
| 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-14T18:04:31.000Z |
| 9 | -updatedAt: 2026-11-14T18:13:47.000Z | |
| 9 | +updatedAt: 2026-11-14T18:48:25.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::ui |
| @@ -77,13 +77,13 @@ body: | | ||
| 77 | 77 | |
| 78 | 78 | ## Décisions (owner) |
| 79 | 79 | - **Nom de la sandbox = nom de l'agent** (= nom du dossier). Il doit être unique pour sbx (lettres, chiffres, |
| 80 | - tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (\`sbx ls\`), comme le dossier et le nom d'agent. | |
| 80 | + tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (`sbx ls`), comme le dossier et le nom d'agent. | |
| 81 | 81 | - **Clés et connexion** : l'assistant **explique** ce qu'il faut (clé de l'API ou connexion OAuth), **vérifie** si la |
| 82 | 82 | clé existe déjà dans sbx et, sinon, la **demande** à l'utilisateur et la **pose** lui-même |
| 83 | - (\`sbx secret set anthropic|google|openai\`), sans jamais l'écrire dans un fichier ni dans les journaux. | |
| 84 | - - **Commentaires du \`sbxenv.yaml\` en anglais** (ADR 0005) ; les exemples de \`tmp/\` sont en français. | |
| 85 | - - **Gemini : passer au kit \`antigravity\`** qui remplace \`docker.io/sbx/gemini-kit\` (déprécié par Docker), après avoir | |
| 86 | - vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, \`bindings\`). | |
| 83 | + (`sbx secret set anthropic|google|openai`), sans jamais l'écrire dans un fichier ni dans les journaux. | |
| 84 | + - **Commentaires du `sbxenv.yaml` en anglais** (ADR 0005) ; les exemples de `tmp/` sont en français. | |
| 85 | + - **Gemini : passer au kit `antigravity`** qui remplace `docker.io/sbx/gemini-kit` (déprécié par Docker), après avoir | |
| 86 | + vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, `bindings`). | |
| 87 | 87 | |
| 88 | 88 | ## Messages d'erreur (simples) |
| 89 | 89 | - `sbx` absent : dire quoi installer ; rien n'est créé. |
| @@ -99,66 +99,116 @@ body: | | ||
| 99 | 99 | tasks: |
| 100 | 100 | - id: 1 |
| 101 | 101 | title: "Catalogue des types sbx (Claude, Gemini, Codex) : agent, kit, programme, arguments, bindings, emoji et titre par défaut ; source commune avec l'assistant Ajouter un agent" |
| 102 | - state: open | |
| 102 | + state: closed | |
| 103 | 103 | priority: high |
| 104 | 104 | author: |
| 105 | 105 | name: k33g |
| 106 | 106 | email: ph.charriere@gmail.com |
| 107 | 107 | createdAt: 2026-11-14T18:04:31.000Z |
| 108 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 109 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 108 | 110 | - id: 2 |
| 109 | 111 | title: "Génération du dossier : sbxenv.yaml (name, workspace ./workspace, kit, bindings, pullPolicy) + workspace/" |
| 110 | - state: open | |
| 112 | + state: closed | |
| 111 | 113 | priority: high |
| 112 | 114 | author: |
| 113 | 115 | name: k33g |
| 114 | 116 | email: ph.charriere@gmail.com |
| 115 | 117 | createdAt: 2026-11-14T18:04:31.000Z |
| 118 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 119 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 116 | 120 | - id: 3 |
| 117 | 121 | title: "Service Go : vérifier sbx, noms (agent, dossier, sandbox), écrire, ajouter l'entrée de configuration" |
| 118 | - state: open | |
| 122 | + state: closed | |
| 119 | 123 | priority: high |
| 120 | 124 | author: |
| 121 | 125 | name: k33g |
| 122 | 126 | email: ph.charriere@gmail.com |
| 123 | 127 | createdAt: 2026-11-14T18:04:31.000Z |
| 128 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 129 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 124 | 130 | - id: 4 |
| 125 | 131 | title: "Page de l'assistant : choix du type, nom, emoji ; accès depuis l'accueil, la liste des agents, la palette" |
| 126 | - state: open | |
| 132 | + state: closed | |
| 127 | 133 | priority: high |
| 128 | 134 | author: |
| 129 | 135 | name: k33g |
| 130 | 136 | email: ph.charriere@gmail.com |
| 131 | 137 | createdAt: 2026-11-14T18:04:31.000Z |
| 138 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 139 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 132 | 140 | - id: 5 |
| 133 | 141 | title: "Clés et connexion : expliquer, vérifier si le secret sbx existe, sinon le demander et le poser (jamais écrit ni journalisé)" |
| 134 | - state: open | |
| 142 | + state: closed | |
| 135 | 143 | priority: medium |
| 136 | 144 | author: |
| 137 | 145 | name: k33g |
| 138 | 146 | email: ph.charriere@gmail.com |
| 139 | 147 | createdAt: 2026-11-14T18:04:31.000Z |
| 148 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 149 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 140 | 150 | - id: 6 |
| 141 | 151 | title: "Tests unitaires ; essai sur le Mac avec les trois types" |
| 142 | - state: open | |
| 152 | + state: closed | |
| 143 | 153 | priority: high |
| 144 | 154 | author: |
| 145 | 155 | name: k33g |
| 146 | 156 | email: ph.charriere@gmail.com |
| 147 | 157 | createdAt: 2026-11-14T18:04:31.000Z |
| 158 | + updatedAt: 2026-11-14T18:48:25.000Z | |
| 159 | + closedAt: 2026-11-14T18:48:25.000Z | |
| 148 | 160 | - id: 7 |
| 149 | 161 | title: "Documentation EN + FR (how-to, référence), notes de release" |
| 150 | - state: open | |
| 162 | + state: closed | |
| 151 | 163 | priority: medium |
| 152 | 164 | author: |
| 153 | 165 | name: k33g |
| 154 | 166 | email: ph.charriere@gmail.com |
| 155 | 167 | createdAt: 2026-11-14T18:04:31.000Z |
| 168 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 169 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 156 | 170 | - id: 8 |
| 157 | 171 | title: "Gemini : étudier le kit antigravity et son ACP (programme, arguments, clés, bindings) avant de l'adopter" |
| 158 | - state: open | |
| 172 | + state: closed | |
| 159 | 173 | priority: high |
| 160 | 174 | author: |
| 161 | 175 | name: k33g |
| 162 | 176 | email: ph.charriere@gmail.com |
| 163 | 177 | createdAt: 2026-11-14T18:13:47.000Z |
| 164 | -comments: [] | |
| 178 | + updatedAt: 2026-11-14T18:24:54.000Z | |
| 179 | + closedAt: 2026-11-14T18:24:54.000Z | |
| 180 | +comments: | |
| 181 | + - id: 1 | |
| 182 | + author: | |
| 183 | + name: k33g | |
| 184 | + email: ph.charriere@gmail.com | |
| 185 | + createdAt: 2026-11-14T18:24:54.000Z | |
| 186 | + body: | | |
| 187 | + **Tâche 8 — Antigravity** (sources : page Docker Hub de `sbx/antigravity`, doc ACP d'Antigravity CLI) : | |
| 188 | + - kit `docker.io/sbx/antigravity:latest` (kit v3, capacité `acp@1` optionnelle), `agent: antigravity` dans le | |
| 189 | + `sbxenv.yaml` (vu dans des dépôts qui l'utilisent ; pas de doc officielle trouvée pour cette valeur) ; | |
| 190 | + - ACP : `agy acp` (sous-commande, pas `--acp`) ; Docker conseille `sbx exec -i <sandbox> agy acp | |
| 191 | + --dangerously-skip-permissions`. Sidekicks lance `agy acp` **sans** ce flag : les permissions sont demandées | |
| 192 | + dans la conversation (à confirmer sur le Mac que `agy` les envoie bien en `session/request_permission`) ; | |
| 193 | + - clé : `sbx secret set google` (clé Gemini API, mode sans interface) ; sinon connexion Google OAuth interactive | |
| 194 | + (code collé dans un terminal), que l'assistant ne sait pas faire : il demande la clé. | |
| 195 | + - Clés en général : `printf '%s' "$KEY" | sbx secret set <service>` (entrée standard, la valeur n'est jamais | |
| 196 | + dans les arguments) ; `sbx secret ls --service <service>` liste sans montrer les valeurs (SCOPE SERVICE SECRET). | |
| 197 | + | |
| 198 | + **Implémenté** sur `feature/96-sbx-creator` : `internal/sbxcreate` (catalogue Claude / Gemini via Antigravity / | |
| 199 | + Codex, `sbxenv.yaml` en anglais, `workspace/`, appels sbx), `SbxCreatorService` (Kinds, Check, SetKey, Create ; | |
| 200 | + noms libres comme agent, dossier et sandbox), page « Créer un agent dans une sandbox » (choix du type, clé | |
| 201 | + expliquée / vérifiée / demandée / posée, nom + titre + emoji), accès accueil / agents / palette ; l'assistant | |
| 202 | + « Ajouter un agent » reconnaît `agent: antigravity` (`agy acp`). Doc EN + FR, notes de release v1.5.0. | |
| 203 | + | |
| 204 | + Vérifié : tests Go et vitest, lint ; sous Xvfb avec un faux `sbx` : clé posée par l'entrée standard (absente des | |
| 205 | + arguments et du journal), nom `claude` refusé (sandbox existante), `claude-2` créé avec exactement l'entrée de | |
| 206 | + configuration attendue. Pas de sbx dans le sandbox de dev : **tâche 6 (essai sur le Mac avec les trois types) | |
| 207 | + ouverte** — en particulier Gemini/Antigravity (`agy acp`, `bindings` google, kit v3). | |
| 208 | + - id: 2 | |
| 209 | + author: | |
| 210 | + name: k33g | |
| 211 | + email: ph.charriere@gmail.com | |
| 212 | + createdAt: 2026-11-14T18:48:25.000Z | |
| 213 | + body: | | |
| 214 | + Testé sur le Mac par l'owner avec les trois types : tout fonctionne. Ticket fermé. | |
| @@ -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: 96 | 2 | id: 96 |
| 3 | title: "Assistant « Create a sbx agent » : Claude, Gemini, Codex dans une Docker Sandbox" | 3 | title: "Assistant « Create a sbx agent » : Claude, Gemini, Codex dans une Docker Sandbox" |
| 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-14T18:04:31.000Z | 8 | createdAt: 2026-11-14T18:04:31.000Z |
| 9 | -updatedAt: 2026-11-14T18:13:47.000Z | 9 | +updatedAt: 2026-11-14T18:48:25.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::ui | 12 | - area::ui |
| @@ -77,13 +77,13 @@ body: | | |||
| 77 | 77 | ||
| 78 | ## Décisions (owner) | 78 | ## Décisions (owner) |
| 79 | - **Nom de la sandbox = nom de l'agent** (= nom du dossier). Il doit être unique pour sbx (lettres, chiffres, | 79 | - **Nom de la sandbox = nom de l'agent** (= nom du dossier). Il doit être unique pour sbx (lettres, chiffres, |
| 80 | - tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (\`sbx ls\`), comme le dossier et le nom d'agent. | 80 | + tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (`sbx ls`), comme le dossier et le nom d'agent. |
| 81 | - **Clés et connexion** : l'assistant **explique** ce qu'il faut (clé de l'API ou connexion OAuth), **vérifie** si la | 81 | - **Clés et connexion** : l'assistant **explique** ce qu'il faut (clé de l'API ou connexion OAuth), **vérifie** si la |
| 82 | clé existe déjà dans sbx et, sinon, la **demande** à l'utilisateur et la **pose** lui-même | 82 | clé existe déjà dans sbx et, sinon, la **demande** à l'utilisateur et la **pose** lui-même |
| 83 | - (\`sbx secret set anthropic|google|openai\`), sans jamais l'écrire dans un fichier ni dans les journaux. | 83 | + (`sbx secret set anthropic|google|openai`), sans jamais l'écrire dans un fichier ni dans les journaux. |
| 84 | - - **Commentaires du \`sbxenv.yaml\` en anglais** (ADR 0005) ; les exemples de \`tmp/\` sont en français. | 84 | + - **Commentaires du `sbxenv.yaml` en anglais** (ADR 0005) ; les exemples de `tmp/` sont en français. |
| 85 | - - **Gemini : passer au kit \`antigravity\`** qui remplace \`docker.io/sbx/gemini-kit\` (déprécié par Docker), après avoir | 85 | + - **Gemini : passer au kit `antigravity`** qui remplace `docker.io/sbx/gemini-kit` (déprécié par Docker), après avoir |
| 86 | - vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, \`bindings\`). | 86 | + vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, `bindings`). |
| 87 | 87 | ||
| 88 | ## Messages d'erreur (simples) | 88 | ## Messages d'erreur (simples) |
| 89 | - `sbx` absent : dire quoi installer ; rien n'est créé. | 89 | - `sbx` absent : dire quoi installer ; rien n'est créé. |
| @@ -99,66 +99,116 @@ body: | | |||
| 99 | tasks: | 99 | tasks: |
| 100 | - id: 1 | 100 | - id: 1 |
| 101 | title: "Catalogue des types sbx (Claude, Gemini, Codex) : agent, kit, programme, arguments, bindings, emoji et titre par défaut ; source commune avec l'assistant Ajouter un agent" | 101 | title: "Catalogue des types sbx (Claude, Gemini, Codex) : agent, kit, programme, arguments, bindings, emoji et titre par défaut ; source commune avec l'assistant Ajouter un agent" |
| 102 | - state: open | 102 | + state: closed |
| 103 | priority: high | 103 | priority: high |
| 104 | author: | 104 | author: |
| 105 | name: k33g | 105 | name: k33g |
| 106 | email: ph.charriere@gmail.com | 106 | email: ph.charriere@gmail.com |
| 107 | createdAt: 2026-11-14T18:04:31.000Z | 107 | createdAt: 2026-11-14T18:04:31.000Z |
| 108 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 109 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 108 | - id: 2 | 110 | - id: 2 |
| 109 | title: "Génération du dossier : sbxenv.yaml (name, workspace ./workspace, kit, bindings, pullPolicy) + workspace/" | 111 | title: "Génération du dossier : sbxenv.yaml (name, workspace ./workspace, kit, bindings, pullPolicy) + workspace/" |
| 110 | - state: open | 112 | + state: closed |
| 111 | priority: high | 113 | priority: high |
| 112 | author: | 114 | author: |
| 113 | name: k33g | 115 | name: k33g |
| 114 | email: ph.charriere@gmail.com | 116 | email: ph.charriere@gmail.com |
| 115 | createdAt: 2026-11-14T18:04:31.000Z | 117 | createdAt: 2026-11-14T18:04:31.000Z |
| 118 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 119 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 116 | - id: 3 | 120 | - id: 3 |
| 117 | title: "Service Go : vérifier sbx, noms (agent, dossier, sandbox), écrire, ajouter l'entrée de configuration" | 121 | title: "Service Go : vérifier sbx, noms (agent, dossier, sandbox), écrire, ajouter l'entrée de configuration" |
| 118 | - state: open | 122 | + state: closed |
| 119 | priority: high | 123 | priority: high |
| 120 | author: | 124 | author: |
| 121 | name: k33g | 125 | name: k33g |
| 122 | email: ph.charriere@gmail.com | 126 | email: ph.charriere@gmail.com |
| 123 | createdAt: 2026-11-14T18:04:31.000Z | 127 | createdAt: 2026-11-14T18:04:31.000Z |
| 128 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 129 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 124 | - id: 4 | 130 | - id: 4 |
| 125 | title: "Page de l'assistant : choix du type, nom, emoji ; accès depuis l'accueil, la liste des agents, la palette" | 131 | title: "Page de l'assistant : choix du type, nom, emoji ; accès depuis l'accueil, la liste des agents, la palette" |
| 126 | - state: open | 132 | + state: closed |
| 127 | priority: high | 133 | priority: high |
| 128 | author: | 134 | author: |
| 129 | name: k33g | 135 | name: k33g |
| 130 | email: ph.charriere@gmail.com | 136 | email: ph.charriere@gmail.com |
| 131 | createdAt: 2026-11-14T18:04:31.000Z | 137 | createdAt: 2026-11-14T18:04:31.000Z |
| 138 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 139 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 132 | - id: 5 | 140 | - id: 5 |
| 133 | title: "Clés et connexion : expliquer, vérifier si le secret sbx existe, sinon le demander et le poser (jamais écrit ni journalisé)" | 141 | title: "Clés et connexion : expliquer, vérifier si le secret sbx existe, sinon le demander et le poser (jamais écrit ni journalisé)" |
| 134 | - state: open | 142 | + state: closed |
| 135 | priority: medium | 143 | priority: medium |
| 136 | author: | 144 | author: |
| 137 | name: k33g | 145 | name: k33g |
| 138 | email: ph.charriere@gmail.com | 146 | email: ph.charriere@gmail.com |
| 139 | createdAt: 2026-11-14T18:04:31.000Z | 147 | createdAt: 2026-11-14T18:04:31.000Z |
| 148 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 149 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 140 | - id: 6 | 150 | - id: 6 |
| 141 | title: "Tests unitaires ; essai sur le Mac avec les trois types" | 151 | title: "Tests unitaires ; essai sur le Mac avec les trois types" |
| 142 | - state: open | 152 | + state: closed |
| 143 | priority: high | 153 | priority: high |
| 144 | author: | 154 | author: |
| 145 | name: k33g | 155 | name: k33g |
| 146 | email: ph.charriere@gmail.com | 156 | email: ph.charriere@gmail.com |
| 147 | createdAt: 2026-11-14T18:04:31.000Z | 157 | createdAt: 2026-11-14T18:04:31.000Z |
| 158 | + updatedAt: 2026-11-14T18:48:25.000Z | ||
| 159 | + closedAt: 2026-11-14T18:48:25.000Z | ||
| 148 | - id: 7 | 160 | - id: 7 |
| 149 | title: "Documentation EN + FR (how-to, référence), notes de release" | 161 | title: "Documentation EN + FR (how-to, référence), notes de release" |
| 150 | - state: open | 162 | + state: closed |
| 151 | priority: medium | 163 | priority: medium |
| 152 | author: | 164 | author: |
| 153 | name: k33g | 165 | name: k33g |
| 154 | email: ph.charriere@gmail.com | 166 | email: ph.charriere@gmail.com |
| 155 | createdAt: 2026-11-14T18:04:31.000Z | 167 | createdAt: 2026-11-14T18:04:31.000Z |
| 168 | + updatedAt: 2026-11-14T18:24:54.000Z | ||
| 169 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 156 | - id: 8 | 170 | - id: 8 |
| 157 | title: "Gemini : étudier le kit antigravity et son ACP (programme, arguments, clés, bindings) avant de l'adopter" | 171 | title: "Gemini : étudier le kit antigravity et son ACP (programme, arguments, clés, bindings) avant de l'adopter" |
| 158 | - state: open | 172 | + state: closed |
| 159 | priority: high | 173 | priority: high |
| 160 | author: | 174 | author: |
| 161 | name: k33g | 175 | name: k33g |
| 162 | email: ph.charriere@gmail.com | 176 | email: ph.charriere@gmail.com |
| 163 | createdAt: 2026-11-14T18:13:47.000Z | 177 | createdAt: 2026-11-14T18:13:47.000Z |
| 164 | -comments: [] | 178 | + updatedAt: 2026-11-14T18:24:54.000Z |
| 179 | + closedAt: 2026-11-14T18:24:54.000Z | ||
| 180 | +comments: | ||
| 181 | + - id: 1 | ||
| 182 | + author: | ||
| 183 | + name: k33g | ||
| 184 | + email: ph.charriere@gmail.com | ||
| 185 | + createdAt: 2026-11-14T18:24:54.000Z | ||
| 186 | + body: | | ||
| 187 | + **Tâche 8 — Antigravity** (sources : page Docker Hub de `sbx/antigravity`, doc ACP d'Antigravity CLI) : | ||
| 188 | + - kit `docker.io/sbx/antigravity:latest` (kit v3, capacité `acp@1` optionnelle), `agent: antigravity` dans le | ||
| 189 | + `sbxenv.yaml` (vu dans des dépôts qui l'utilisent ; pas de doc officielle trouvée pour cette valeur) ; | ||
| 190 | + - ACP : `agy acp` (sous-commande, pas `--acp`) ; Docker conseille `sbx exec -i <sandbox> agy acp | ||
| 191 | + --dangerously-skip-permissions`. Sidekicks lance `agy acp` **sans** ce flag : les permissions sont demandées | ||
| 192 | + dans la conversation (à confirmer sur le Mac que `agy` les envoie bien en `session/request_permission`) ; | ||
| 193 | + - clé : `sbx secret set google` (clé Gemini API, mode sans interface) ; sinon connexion Google OAuth interactive | ||
| 194 | + (code collé dans un terminal), que l'assistant ne sait pas faire : il demande la clé. | ||
| 195 | + - Clés en général : `printf '%s' "$KEY" | sbx secret set <service>` (entrée standard, la valeur n'est jamais | ||
| 196 | + dans les arguments) ; `sbx secret ls --service <service>` liste sans montrer les valeurs (SCOPE SERVICE SECRET). | ||
| 197 | + | ||
| 198 | + **Implémenté** sur `feature/96-sbx-creator` : `internal/sbxcreate` (catalogue Claude / Gemini via Antigravity / | ||
| 199 | + Codex, `sbxenv.yaml` en anglais, `workspace/`, appels sbx), `SbxCreatorService` (Kinds, Check, SetKey, Create ; | ||
| 200 | + noms libres comme agent, dossier et sandbox), page « Créer un agent dans une sandbox » (choix du type, clé | ||
| 201 | + expliquée / vérifiée / demandée / posée, nom + titre + emoji), accès accueil / agents / palette ; l'assistant | ||
| 202 | + « Ajouter un agent » reconnaît `agent: antigravity` (`agy acp`). Doc EN + FR, notes de release v1.5.0. | ||
| 203 | + | ||
| 204 | + Vérifié : tests Go et vitest, lint ; sous Xvfb avec un faux `sbx` : clé posée par l'entrée standard (absente des | ||
| 205 | + arguments et du journal), nom `claude` refusé (sandbox existante), `claude-2` créé avec exactement l'entrée de | ||
| 206 | + configuration attendue. Pas de sbx dans le sandbox de dev : **tâche 6 (essai sur le Mac avec les trois types) | ||
| 207 | + ouverte** — en particulier Gemini/Antigravity (`agy acp`, `bindings` google, kit v3). | ||
| 208 | + - id: 2 | ||
| 209 | + author: | ||
| 210 | + name: k33g | ||
| 211 | + email: ph.charriere@gmail.com | ||
| 212 | + createdAt: 2026-11-14T18:48:25.000Z | ||
| 213 | + body: | | ||
| 214 | + Testé sur le Mac par l'owner avec les trois types : tout fonctionne. Ticket fermé. | ||
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) · [Create a mini-me agent](how-to/create-a-mini-me-agent.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) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.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) · [Create a mini-me agent](how-to/create-a-mini-me-agent.md) · [Create a Claude, Gemini or Codex agent in a sandbox](how-to/create-an-agent-in-a-sandbox.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) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.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) · [Create a mini-me agent](how-to/create-a-mini-me-agent.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) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.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) · [Create a mini-me agent](how-to/create-a-mini-me-agent.md) · [Create a Claude, Gemini or Codex agent in a sandbox](how-to/create-an-agent-in-a-sandbox.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) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.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/how-to/add-an-agent.md +1 -0 | @@ -25,6 +25,7 @@ When the agent cannot be added (a name already used, for instance), the assistan | ||
| 25 | 25 | ## See also |
| 26 | 26 | |
| 27 | 27 | - To create a new mini-me agent by answering questions, with no file and no folder to choose: [How to create a mini-me agent](create-a-mini-me-agent.md) |
| 28 | +- To create a new Claude, Gemini or Codex agent in a sandbox the same way: [How to create a Claude, Gemini or Codex agent in a sandbox](create-an-agent-in-a-sandbox.md) | |
| 28 | 29 | - What the assistant writes: [The configuration file](../reference/configuration.md) |
| 29 | 30 | - [How to edit or switch the configuration](edit-or-switch-the-configuration.md) |
| 30 | 31 | - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md) |
| @@ -25,6 +25,7 @@ When the agent cannot be added (a name already used, for instance), the assistan | |||
| 25 | ## See also | 25 | ## See also |
| 26 | 26 | ||
| 27 | - To create a new mini-me agent by answering questions, with no file and no folder to choose: [How to create a mini-me agent](create-a-mini-me-agent.md) | 27 | - To create a new mini-me agent by answering questions, with no file and no folder to choose: [How to create a mini-me agent](create-a-mini-me-agent.md) |
| 28 | +- To create a new Claude, Gemini or Codex agent in a sandbox the same way: [How to create a Claude, Gemini or Codex agent in a sandbox](create-an-agent-in-a-sandbox.md) | ||
| 28 | - What the assistant writes: [The configuration file](../reference/configuration.md) | 29 | - What the assistant writes: [The configuration file](../reference/configuration.md) |
| 29 | - [How to edit or switch the configuration](edit-or-switch-the-configuration.md) | 30 | - [How to edit or switch the configuration](edit-or-switch-the-configuration.md) |
| 30 | - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md) | 31 | - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md) |
added
docs/en/how-to/create-an-agent-in-a-sandbox.md +30 -0 | new file mode 100644 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +# How to create a Claude, Gemini or Codex agent in a sandbox | |
| 2 | + | |
| 3 | +This guide shows how to create a new Claude, Gemini or Codex agent that runs in a Docker Sandbox, from the Sidekicks window, without writing a file or choosing a folder. It assumes [sbx](https://docs.docker.com/ai/sandboxes/) (Docker Sandboxes) is installed, and that you have an API key of the agent's company — or will get one during the steps. To add a sandbox that already exists, use [How to add an agent](add-an-agent.md) instead. | |
| 4 | + | |
| 5 | +## Steps | |
| 6 | + | |
| 7 | +1. Open the assistant: **✨ Create a Claude, Gemini or Codex agent** on the welcome screen, **✨ Create an agent in a sandbox** under the agents list, or **Create an agent in a sandbox** in the command palette (⌘K, Ctrl+K on Linux and Windows). | |
| 8 | +2. Choose the agent: **Claude** (Anthropic's Claude Code), **Gemini** (Google's, through Antigravity) or **Codex** (OpenAI's). | |
| 9 | +3. If sbx does not hold its key yet, paste it in **API key** and click **Save the key**. **Get a key…** opens the page where the company gives you one. Sidekicks hands the key to sbx, which keeps it and gives it to your sandboxes for their calls to that company only; it is never written in a file. A key already saved is shown as **✓ Your … key is stored in sbx**. | |
| 10 | +4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. Sidekicks suggests a name nobody uses yet. | |
| 11 | +5. Click **Add the agent**. Its conversation opens. Its sandbox is created the first time you write to it, so that first answer takes a while. | |
| 12 | + | |
| 13 | +The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/claude`): its `sbxenv.yaml` and its `workspace/` folder, where the agent works. | |
| 14 | + | |
| 15 | +## When something goes wrong | |
| 16 | + | |
| 17 | +- **"sbx (Docker Sandboxes) is not installed on this computer"**: install sbx, then click **Try again**. | |
| 18 | +- **"Another agent already has this name"**, **"A folder with this name already exists"** or **"A sandbox with this name already exists"**: change the **Name** and click **Add the agent** again. An existing folder or sandbox is never changed. | |
| 19 | +- **"No … key in sbx yet"** (after **Later**): the agent cannot answer. Run the assistant again to save the key, or type `sbx secret set anthropic` (`google` for Gemini, `openai` for Codex) in a terminal. | |
| 20 | + | |
| 21 | +## Variants | |
| 22 | + | |
| 23 | +- **Replace a key**: choose the same agent again and click **Replace the key**. Every sandbox uses the new key from its next start. | |
| 24 | +- **Another folder than Documents**: set [`agentsFolder`](../reference/configuration.md#top-level) in **Settings**; the next agents are created there. | |
| 25 | + | |
| 26 | +## See also | |
| 27 | + | |
| 28 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) — what an sbx agent is, and its sandbox's lifecycle. | |
| 29 | +- [How to create a mini-me agent](create-a-mini-me-agent.md) — the same idea for mini-me. | |
| 30 | +- How it works: [`SbxCreatorService`](../reference/agents-and-events.md#sbxcreatorservice) | |
| new file mode 100644 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | +# How to create a Claude, Gemini or Codex agent in a sandbox | ||
| 2 | + | ||
| 3 | +This guide shows how to create a new Claude, Gemini or Codex agent that runs in a Docker Sandbox, from the Sidekicks window, without writing a file or choosing a folder. It assumes [sbx](https://docs.docker.com/ai/sandboxes/) (Docker Sandboxes) is installed, and that you have an API key of the agent's company — or will get one during the steps. To add a sandbox that already exists, use [How to add an agent](add-an-agent.md) instead. | ||
| 4 | + | ||
| 5 | +## Steps | ||
| 6 | + | ||
| 7 | +1. Open the assistant: **✨ Create a Claude, Gemini or Codex agent** on the welcome screen, **✨ Create an agent in a sandbox** under the agents list, or **Create an agent in a sandbox** in the command palette (⌘K, Ctrl+K on Linux and Windows). | ||
| 8 | +2. Choose the agent: **Claude** (Anthropic's Claude Code), **Gemini** (Google's, through Antigravity) or **Codex** (OpenAI's). | ||
| 9 | +3. If sbx does not hold its key yet, paste it in **API key** and click **Save the key**. **Get a key…** opens the page where the company gives you one. Sidekicks hands the key to sbx, which keeps it and gives it to your sandboxes for their calls to that company only; it is never written in a file. A key already saved is shown as **✓ Your … key is stored in sbx**. | ||
| 10 | +4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. Sidekicks suggests a name nobody uses yet. | ||
| 11 | +5. Click **Add the agent**. Its conversation opens. Its sandbox is created the first time you write to it, so that first answer takes a while. | ||
| 12 | + | ||
| 13 | +The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/claude`): its `sbxenv.yaml` and its `workspace/` folder, where the agent works. | ||
| 14 | + | ||
| 15 | +## When something goes wrong | ||
| 16 | + | ||
| 17 | +- **"sbx (Docker Sandboxes) is not installed on this computer"**: install sbx, then click **Try again**. | ||
| 18 | +- **"Another agent already has this name"**, **"A folder with this name already exists"** or **"A sandbox with this name already exists"**: change the **Name** and click **Add the agent** again. An existing folder or sandbox is never changed. | ||
| 19 | +- **"No … key in sbx yet"** (after **Later**): the agent cannot answer. Run the assistant again to save the key, or type `sbx secret set anthropic` (`google` for Gemini, `openai` for Codex) in a terminal. | ||
| 20 | + | ||
| 21 | +## Variants | ||
| 22 | + | ||
| 23 | +- **Replace a key**: choose the same agent again and click **Replace the key**. Every sandbox uses the new key from its next start. | ||
| 24 | +- **Another folder than Documents**: set [`agentsFolder`](../reference/configuration.md#top-level) in **Settings**; the next agents are created there. | ||
| 25 | + | ||
| 26 | +## See also | ||
| 27 | + | ||
| 28 | +- [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md) — what an sbx agent is, and its sandbox's lifecycle. | ||
| 29 | +- [How to create a mini-me agent](create-a-mini-me-agent.md) — the same idea for mini-me. | ||
| 30 | +- How it works: [`SbxCreatorService`](../reference/agents-and-events.md#sbxcreatorservice) | ||
modified
docs/en/reference/agents-and-events.md +17 -0 | @@ -252,6 +252,23 @@ The assistant that creates a mini-me agent (issue #94, [How to create a mini-me | ||
| 252 | 252 | |
| 253 | 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. |
| 254 | 254 | |
| 255 | +## `SbxCreatorService` | |
| 256 | + | |
| 257 | +The assistant that creates an agent in a Docker Sandbox (issue #96, [How to create a Claude, Gemini or Codex agent in a sandbox](../how-to/create-an-agent-in-a-sandbox.md)). The kinds it offers are a catalogue (`internal/sbxcreate`): one entry per kind, with what its `sbxenv.yaml` holds and how Sidekicks starts it. | |
| 258 | + | |
| 259 | +| Kind | `agent:` | Kit | Program in the sandbox | sbx secret | | |
| 260 | +| --- | --- | --- | --- | --- | | |
| 261 | +| `claude` 📙 | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` | | |
| 262 | +| `gemini` 📘 | `antigravity` | `docker.io/sbx/antigravity:latest` | `agy acp` | `google` | | |
| 263 | +| `codex` 📗 | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` | | |
| 264 | + | |
| 265 | +| Method | Effect | | |
| 266 | +| --- | --- | | |
| 267 | +| `Kinds()` | The catalogue, in order: `{id, title, icon, agent, kit, program, service, keyUrl}`. | | |
| 268 | +| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder}`: whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | | |
| 269 | +| `SetKey(kind, key)` | `sbx secret set <service>` with the key on its standard input — never in its arguments, a file or a log; an error never repeats it. Global: every sandbox gets it. | | |
| 270 | +| `Create({kind, name, title, icon})` | Writes `<agentsFolder>/<name>/sbxenv.yaml` (`name: <name>`, the kind's `agent:` and kit, `workspace: ./workspace`, `bindings` of its service, `pullPolicy: always`, English comments) and `workspace/`, then adds the agent: `sbx exec -i <name> <program>`, workspace `<folder>/workspace`, `runtime.lifecycle` in `<folder>` (`sbx env create --force`, `sbx stop <name>`, `sbx env rm --force`) — the sandbox is created at the first start. Returns `{problem, problems[], name, folder}`: `problem` is `invalidName` (lowercase letters, digits and `-`: no `_`, which sbx refuses), `nameTaken`, `folderExists` or `sandboxExists` when nothing was written. | | |
| 271 | + | |
| 255 | 272 | ## Tools offered to the agents |
| 256 | 273 | |
| 257 | 274 | Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent). |
| @@ -252,6 +252,23 @@ The assistant that creates a mini-me agent (issue #94, [How to create a mini-me | |||
| 252 | 252 | ||
| 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. | 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. |
| 254 | 254 | ||
| 255 | +## `SbxCreatorService` | ||
| 256 | + | ||
| 257 | +The assistant that creates an agent in a Docker Sandbox (issue #96, [How to create a Claude, Gemini or Codex agent in a sandbox](../how-to/create-an-agent-in-a-sandbox.md)). The kinds it offers are a catalogue (`internal/sbxcreate`): one entry per kind, with what its `sbxenv.yaml` holds and how Sidekicks starts it. | ||
| 258 | + | ||
| 259 | +| Kind | `agent:` | Kit | Program in the sandbox | sbx secret | | ||
| 260 | +| --- | --- | --- | --- | --- | | ||
| 261 | +| `claude` 📙 | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` | | ||
| 262 | +| `gemini` 📘 | `antigravity` | `docker.io/sbx/antigravity:latest` | `agy acp` | `google` | | ||
| 263 | +| `codex` 📗 | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` | | ||
| 264 | + | ||
| 265 | +| Method | Effect | | ||
| 266 | +| --- | --- | | ||
| 267 | +| `Kinds()` | The catalogue, in order: `{id, title, icon, agent, kit, program, service, keyUrl}`. | | ||
| 268 | +| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder}`: whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | | ||
| 269 | +| `SetKey(kind, key)` | `sbx secret set <service>` with the key on its standard input — never in its arguments, a file or a log; an error never repeats it. Global: every sandbox gets it. | | ||
| 270 | +| `Create({kind, name, title, icon})` | Writes `<agentsFolder>/<name>/sbxenv.yaml` (`name: <name>`, the kind's `agent:` and kit, `workspace: ./workspace`, `bindings` of its service, `pullPolicy: always`, English comments) and `workspace/`, then adds the agent: `sbx exec -i <name> <program>`, workspace `<folder>/workspace`, `runtime.lifecycle` in `<folder>` (`sbx env create --force`, `sbx stop <name>`, `sbx env rm --force`) — the sandbox is created at the first start. Returns `{problem, problems[], name, folder}`: `problem` is `invalidName` (lowercase letters, digits and `-`: no `_`, which sbx refuses), `nameTaken`, `folderExists` or `sandboxExists` when nothing was written. | | ||
| 271 | + | ||
| 255 | ## Tools offered to the agents | 272 | ## Tools offered to the agents |
| 256 | 273 | ||
| 257 | Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent). | 274 | Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent). |
modified
docs/en/reference/configuration.md +1 -1 | @@ -39,7 +39,7 @@ The file is looked up in this order; the first one that applies wins: | ||
| 39 | 39 | | `ui` | object | no | | Interface preferences. | |
| 40 | 40 | | `limits` | object | no | | Resource limits. | |
| 41 | 41 | | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). | |
| 42 | -| `agentsFolder` | path | no | `~/Documents` | Where the assistant that creates mini-me agents makes one folder per agent ([How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)): absolute, `~/…`, or relative to this file. Created when missing. | | |
| 42 | +| `agentsFolder` | path | no | `~/Documents` | Where the assistants that create agents make one folder per agent ([mini-me](../how-to/create-a-mini-me-agent.md), [Claude, Gemini, Codex in a sandbox](../how-to/create-an-agent-in-a-sandbox.md)): absolute, `~/…`, or relative to this file. Created when missing. | | |
| 43 | 43 | | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. | |
| 44 | 44 | | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. | |
| 45 | 45 | |
| @@ -39,7 +39,7 @@ The file is looked up in this order; the first one that applies wins: | |||
| 39 | | `ui` | object | no | | Interface preferences. | | 39 | | `ui` | object | no | | Interface preferences. | |
| 40 | | `limits` | object | no | | Resource limits. | | 40 | | `limits` | object | no | | Resource limits. | |
| 41 | | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). | | 41 | | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). | |
| 42 | -| `agentsFolder` | path | no | `~/Documents` | Where the assistant that creates mini-me agents makes one folder per agent ([How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)): absolute, `~/…`, or relative to this file. Created when missing. | | 42 | +| `agentsFolder` | path | no | `~/Documents` | Where the assistants that create agents make one folder per agent ([mini-me](../how-to/create-a-mini-me-agent.md), [Claude, Gemini, Codex in a sandbox](../how-to/create-an-agent-in-a-sandbox.md)): absolute, `~/…`, or relative to this file. Created when missing. | |
| 43 | | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. | | 43 | | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. | |
| 44 | | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. | | 44 | | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. | |
| 45 | 45 | ||
modified
docs/en/reference/keyboard-shortcuts.md +1 -1 | @@ -25,7 +25,7 @@ On Linux and Windows, when the cursor is in an agent's terminal, the terminal ke | ||
| 25 | 25 | | Enter | Runs the selection | |
| 26 | 26 | | Escape, or a click outside | Closes the palette | |
| 27 | 27 | |
| 28 | -The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent** and **Open a configuration…**. | |
| 28 | +The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent**, **Create an agent in a sandbox (Claude, Gemini, Codex)** and **Open a configuration…**. | |
| 29 | 29 | |
| 30 | 30 | ## Message box |
| 31 | 31 | |
| @@ -25,7 +25,7 @@ On Linux and Windows, when the cursor is in an agent's terminal, the terminal ke | |||
| 25 | | Enter | Runs the selection | | 25 | | Enter | Runs the selection | |
| 26 | | Escape, or a click outside | Closes the palette | | 26 | | Escape, or a click outside | Closes the palette | |
| 27 | 27 | ||
| 28 | -The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent** and **Open a configuration…**. | 28 | +The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent**, **Create an agent in a sandbox (Claude, Gemini, Codex)** and **Open a configuration…**. |
| 29 | 29 | ||
| 30 | ## Message box | 30 | ## Message box |
| 31 | 31 | ||
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) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.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) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.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) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.md) · [Créer un agent Claude, Gemini ou Codex dans une sandbox](how-to/creer-un-agent-dans-une-sandbox.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) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.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) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.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) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.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) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.md) · [Créer un agent Claude, Gemini ou Codex dans une sandbox](how-to/creer-un-agent-dans-une-sandbox.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) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.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/how-to/ajouter-un-agent.md +1 -0 | @@ -25,6 +25,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | ||
| 25 | 25 | ## Voir aussi |
| 26 | 26 | |
| 27 | 27 | - Pour créer un nouvel agent mini-me en répondant à des questions, sans fichier ni dossier à choisir : [Créer un agent mini-me](creer-un-agent-mini-me.md) |
| 28 | +- Pour créer de la même façon un nouvel agent Claude, Gemini ou Codex dans une sandbox : [Créer un agent Claude, Gemini ou Codex dans une sandbox](creer-un-agent-dans-une-sandbox.md) | |
| 28 | 29 | - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md) |
| 29 | 30 | - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md) |
| 30 | 31 | - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md) |
| @@ -25,6 +25,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | |||
| 25 | ## Voir aussi | 25 | ## Voir aussi |
| 26 | 26 | ||
| 27 | - Pour créer un nouvel agent mini-me en répondant à des questions, sans fichier ni dossier à choisir : [Créer un agent mini-me](creer-un-agent-mini-me.md) | 27 | - Pour créer un nouvel agent mini-me en répondant à des questions, sans fichier ni dossier à choisir : [Créer un agent mini-me](creer-un-agent-mini-me.md) |
| 28 | +- Pour créer de la même façon un nouvel agent Claude, Gemini ou Codex dans une sandbox : [Créer un agent Claude, Gemini ou Codex dans une sandbox](creer-un-agent-dans-une-sandbox.md) | ||
| 28 | - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md) | 29 | - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md) |
| 29 | - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md) | 30 | - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md) |
| 30 | - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md) | 31 | - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md) |
added
docs/fr/how-to/creer-un-agent-dans-une-sandbox.md +30 -0 | new file mode 100644 | ||
| @@ -0,0 +1,30 @@ | ||
| 1 | +# Créer un agent Claude, Gemini ou Codex dans une sandbox | |
| 2 | + | |
| 3 | +Ce guide montre comment créer un nouvel agent Claude, Gemini ou Codex qui tourne dans une Docker Sandbox, depuis la fenêtre de Sidekicks, sans écrire de fichier ni choisir de dossier. Il suppose que [sbx](https://docs.docker.com/ai/sandboxes/) (Docker Sandboxes) est installé, et que vous avez une clé d'API de l'éditeur de l'agent — ou que vous en obtiendrez une pendant les étapes. Pour ajouter une sandbox qui existe déjà, suivez plutôt [Ajouter un agent](ajouter-un-agent.md). | |
| 4 | + | |
| 5 | +## Étapes | |
| 6 | + | |
| 7 | +1. Ouvrez l'assistant : **✨ Créer un agent Claude, Gemini ou Codex** sur l'écran d'accueil, **✨ Créer un agent dans une sandbox** sous la liste des agents, ou **Créer un agent dans une sandbox** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). | |
| 8 | +2. Choisissez l'agent : **Claude** (Claude Code, d'Anthropic), **Gemini** (de Google, via Antigravity) ou **Codex** (d'OpenAI). | |
| 9 | +3. Si sbx n'a pas encore sa clé, collez-la dans **Clé d'API** et cliquez sur **Enregistrer la clé**. **Obtenir une clé…** ouvre la page où l'éditeur vous en donne une. Sidekicks confie la clé à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à cet éditeur ; elle n'est jamais écrite dans un fichier. Une clé déjà enregistrée s'affiche **✓ Votre clé … est enregistrée dans sbx**. | |
| 10 | +4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Sidekicks propose un nom que personne n'utilise encore. | |
| 11 | +5. Cliquez sur **Ajouter l'agent**. Sa conversation s'ouvre. Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment. | |
| 12 | + | |
| 13 | +Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/claude`) : son `sbxenv.yaml` et son dossier `workspace/`, où l'agent travaille. | |
| 14 | + | |
| 15 | +## Quand quelque chose ne va pas | |
| 16 | + | |
| 17 | +- **« sbx (Docker Sandboxes) n'est pas installé sur cet ordinateur »** : installez sbx, puis cliquez sur **Réessayer**. | |
| 18 | +- **« Un autre agent porte déjà ce nom »**, **« Un dossier porte déjà ce nom »** ou **« Une sandbox porte déjà ce nom »** : changez le **Nom** et cliquez de nouveau sur **Ajouter l'agent**. Un dossier ou une sandbox existants ne sont jamais modifiés. | |
| 19 | +- **« Pas encore de clé … dans sbx »** (après **Plus tard**) : l'agent ne peut pas répondre. Relancez l'assistant pour enregistrer la clé, ou tapez `sbx secret set anthropic` (`google` pour Gemini, `openai` pour Codex) dans un terminal. | |
| 20 | + | |
| 21 | +## Variantes | |
| 22 | + | |
| 23 | +- **Remplacer une clé** : choisissez de nouveau le même agent et cliquez sur **Remplacer la clé**. Chaque sandbox utilise la nouvelle clé dès son prochain démarrage. | |
| 24 | +- **Un autre dossier que Documents** : réglez [`agentsFolder`](../reference/configuration.md#racine) dans **Settings** ; les agents suivants y sont créés. | |
| 25 | + | |
| 26 | +## Voir aussi | |
| 27 | + | |
| 28 | +- [Lancer un agent dans une sandbox](lancer-un-agent-dans-une-sandbox.md) — ce qu'est un agent sbx, et le cycle de vie de sa sandbox. | |
| 29 | +- [Créer un agent mini-me](creer-un-agent-mini-me.md) — la même idée pour mini-me. | |
| 30 | +- Comment ça marche : [`SbxCreatorService`](../reference/agents-et-evenements.md#sbxcreatorservice) | |
| new file mode 100644 | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | +# Créer un agent Claude, Gemini ou Codex dans une sandbox | ||
| 2 | + | ||
| 3 | +Ce guide montre comment créer un nouvel agent Claude, Gemini ou Codex qui tourne dans une Docker Sandbox, depuis la fenêtre de Sidekicks, sans écrire de fichier ni choisir de dossier. Il suppose que [sbx](https://docs.docker.com/ai/sandboxes/) (Docker Sandboxes) est installé, et que vous avez une clé d'API de l'éditeur de l'agent — ou que vous en obtiendrez une pendant les étapes. Pour ajouter une sandbox qui existe déjà, suivez plutôt [Ajouter un agent](ajouter-un-agent.md). | ||
| 4 | + | ||
| 5 | +## Étapes | ||
| 6 | + | ||
| 7 | +1. Ouvrez l'assistant : **✨ Créer un agent Claude, Gemini ou Codex** sur l'écran d'accueil, **✨ Créer un agent dans une sandbox** sous la liste des agents, ou **Créer un agent dans une sandbox** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). | ||
| 8 | +2. Choisissez l'agent : **Claude** (Claude Code, d'Anthropic), **Gemini** (de Google, via Antigravity) ou **Codex** (d'OpenAI). | ||
| 9 | +3. Si sbx n'a pas encore sa clé, collez-la dans **Clé d'API** et cliquez sur **Enregistrer la clé**. **Obtenir une clé…** ouvre la page où l'éditeur vous en donne une. Sidekicks confie la clé à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à cet éditeur ; elle n'est jamais écrite dans un fichier. Une clé déjà enregistrée s'affiche **✓ Votre clé … est enregistrée dans sbx**. | ||
| 10 | +4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Sidekicks propose un nom que personne n'utilise encore. | ||
| 11 | +5. Cliquez sur **Ajouter l'agent**. Sa conversation s'ouvre. Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment. | ||
| 12 | + | ||
| 13 | +Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/claude`) : son `sbxenv.yaml` et son dossier `workspace/`, où l'agent travaille. | ||
| 14 | + | ||
| 15 | +## Quand quelque chose ne va pas | ||
| 16 | + | ||
| 17 | +- **« sbx (Docker Sandboxes) n'est pas installé sur cet ordinateur »** : installez sbx, puis cliquez sur **Réessayer**. | ||
| 18 | +- **« Un autre agent porte déjà ce nom »**, **« Un dossier porte déjà ce nom »** ou **« Une sandbox porte déjà ce nom »** : changez le **Nom** et cliquez de nouveau sur **Ajouter l'agent**. Un dossier ou une sandbox existants ne sont jamais modifiés. | ||
| 19 | +- **« Pas encore de clé … dans sbx »** (après **Plus tard**) : l'agent ne peut pas répondre. Relancez l'assistant pour enregistrer la clé, ou tapez `sbx secret set anthropic` (`google` pour Gemini, `openai` pour Codex) dans un terminal. | ||
| 20 | + | ||
| 21 | +## Variantes | ||
| 22 | + | ||
| 23 | +- **Remplacer une clé** : choisissez de nouveau le même agent et cliquez sur **Remplacer la clé**. Chaque sandbox utilise la nouvelle clé dès son prochain démarrage. | ||
| 24 | +- **Un autre dossier que Documents** : réglez [`agentsFolder`](../reference/configuration.md#racine) dans **Settings** ; les agents suivants y sont créés. | ||
| 25 | + | ||
| 26 | +## Voir aussi | ||
| 27 | + | ||
| 28 | +- [Lancer un agent dans une sandbox](lancer-un-agent-dans-une-sandbox.md) — ce qu'est un agent sbx, et le cycle de vie de sa sandbox. | ||
| 29 | +- [Créer un agent mini-me](creer-un-agent-mini-me.md) — la même idée pour mini-me. | ||
| 30 | +- Comment ça marche : [`SbxCreatorService`](../reference/agents-et-evenements.md#sbxcreatorservice) | ||
modified
docs/fr/reference/agents-et-evenements.md +17 -0 | @@ -252,6 +252,23 @@ L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../ | ||
| 252 | 252 | |
| 253 | 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. |
| 254 | 254 | |
| 255 | +## `SbxCreatorService` | |
| 256 | + | |
| 257 | +L'assistant qui crée un agent dans une Docker Sandbox (issue #96, [Créer un agent Claude, Gemini ou Codex dans une sandbox](../how-to/creer-un-agent-dans-une-sandbox.md)). Les types qu'il propose forment un catalogue (`internal/sbxcreate`) : une entrée par type, avec ce que contient son `sbxenv.yaml` et la façon dont Sidekicks le démarre. | |
| 258 | + | |
| 259 | +| Type | `agent:` | Kit | Programme dans la sandbox | Secret sbx | | |
| 260 | +| --- | --- | --- | --- | --- | | |
| 261 | +| `claude` 📙 | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` | | |
| 262 | +| `gemini` 📘 | `antigravity` | `docker.io/sbx/antigravity:latest` | `agy acp` | `google` | | |
| 263 | +| `codex` 📗 | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` | | |
| 264 | + | |
| 265 | +| Méthode | Effet | | |
| 266 | +| --- | --- | | |
| 267 | +| `Kinds()` | Le catalogue, dans l'ordre : `{id, title, icon, agent, kit, program, service, keyUrl}`. | | |
| 268 | +| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder}` : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | | |
| 269 | +| `SetKey(kind, key)` | `sbx secret set <service>` avec la clé sur son entrée standard — jamais dans ses arguments, un fichier ou un journal ; une erreur ne la répète jamais. Globale : toutes les sandboxes l'ont. | | |
| 270 | +| `Create({kind, name, title, icon})` | Écrit `<agentsFolder>/<name>/sbxenv.yaml` (`name: <name>`, l'`agent:` et le kit du type, `workspace: ./workspace`, les `bindings` de son service, `pullPolicy: always`, commentaires en anglais) et `workspace/`, puis ajoute l'agent : `sbx exec -i <name> <programme>`, dossier `<dossier>/workspace`, `runtime.lifecycle` dans `<dossier>` (`sbx env create --force`, `sbx stop <name>`, `sbx env rm --force`) — la sandbox est créée au premier démarrage. Renvoie `{problem, problems[], name, folder}` : `problem` vaut `invalidName` (minuscules, chiffres et `-` : pas de `_`, que sbx refuse), `nameTaken`, `folderExists` ou `sandboxExists` quand rien n'a été écrit. | | |
| 271 | + | |
| 255 | 272 | ## Outils proposés aux agents |
| 256 | 273 | |
| 257 | 274 | Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent). |
| @@ -252,6 +252,23 @@ L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../ | |||
| 252 | 252 | ||
| 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. | 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. |
| 254 | 254 | ||
| 255 | +## `SbxCreatorService` | ||
| 256 | + | ||
| 257 | +L'assistant qui crée un agent dans une Docker Sandbox (issue #96, [Créer un agent Claude, Gemini ou Codex dans une sandbox](../how-to/creer-un-agent-dans-une-sandbox.md)). Les types qu'il propose forment un catalogue (`internal/sbxcreate`) : une entrée par type, avec ce que contient son `sbxenv.yaml` et la façon dont Sidekicks le démarre. | ||
| 258 | + | ||
| 259 | +| Type | `agent:` | Kit | Programme dans la sandbox | Secret sbx | | ||
| 260 | +| --- | --- | --- | --- | --- | | ||
| 261 | +| `claude` 📙 | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` | | ||
| 262 | +| `gemini` 📘 | `antigravity` | `docker.io/sbx/antigravity:latest` | `agy acp` | `google` | | ||
| 263 | +| `codex` 📗 | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` | | ||
| 264 | + | ||
| 265 | +| Méthode | Effet | | ||
| 266 | +| --- | --- | | ||
| 267 | +| `Kinds()` | Le catalogue, dans l'ordre : `{id, title, icon, agent, kit, program, service, keyUrl}`. | | ||
| 268 | +| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder}` : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | | ||
| 269 | +| `SetKey(kind, key)` | `sbx secret set <service>` avec la clé sur son entrée standard — jamais dans ses arguments, un fichier ou un journal ; une erreur ne la répète jamais. Globale : toutes les sandboxes l'ont. | | ||
| 270 | +| `Create({kind, name, title, icon})` | Écrit `<agentsFolder>/<name>/sbxenv.yaml` (`name: <name>`, l'`agent:` et le kit du type, `workspace: ./workspace`, les `bindings` de son service, `pullPolicy: always`, commentaires en anglais) et `workspace/`, puis ajoute l'agent : `sbx exec -i <name> <programme>`, dossier `<dossier>/workspace`, `runtime.lifecycle` dans `<dossier>` (`sbx env create --force`, `sbx stop <name>`, `sbx env rm --force`) — la sandbox est créée au premier démarrage. Renvoie `{problem, problems[], name, folder}` : `problem` vaut `invalidName` (minuscules, chiffres et `-` : pas de `_`, que sbx refuse), `nameTaken`, `folderExists` ou `sandboxExists` quand rien n'a été écrit. | | ||
| 271 | + | ||
| 255 | ## Outils proposés aux agents | 272 | ## Outils proposés aux agents |
| 256 | 273 | ||
| 257 | Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent). | 274 | Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent). |
modified
docs/fr/reference/configuration.md +1 -1 | @@ -39,7 +39,7 @@ Le fichier est cherché dans cet ordre ; la première source applicable l'emport | ||
| 39 | 39 | | `ui` | objet | non | | Préférences d'interface. | |
| 40 | 40 | | `limits` | objet | non | | Limites de ressources. | |
| 41 | 41 | | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). | |
| 42 | -| `agentsFolder` | chemin | non | `~/Documents` | Où l'assistant qui crée des agents mini-me fait un dossier par agent ([Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. | | |
| 42 | +| `agentsFolder` | chemin | non | `~/Documents` | Où les assistants qui créent des agents font un dossier par agent ([mini-me](../how-to/creer-un-agent-mini-me.md), [Claude, Gemini, Codex dans une sandbox](../how-to/creer-un-agent-dans-une-sandbox.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. | | |
| 43 | 43 | | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. | |
| 44 | 44 | | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. | |
| 45 | 45 | |
| @@ -39,7 +39,7 @@ Le fichier est cherché dans cet ordre ; la première source applicable l'emport | |||
| 39 | | `ui` | objet | non | | Préférences d'interface. | | 39 | | `ui` | objet | non | | Préférences d'interface. | |
| 40 | | `limits` | objet | non | | Limites de ressources. | | 40 | | `limits` | objet | non | | Limites de ressources. | |
| 41 | | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). | | 41 | | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). | |
| 42 | -| `agentsFolder` | chemin | non | `~/Documents` | Où l'assistant qui crée des agents mini-me fait un dossier par agent ([Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. | | 42 | +| `agentsFolder` | chemin | non | `~/Documents` | Où les assistants qui créent des agents font un dossier par agent ([mini-me](../how-to/creer-un-agent-mini-me.md), [Claude, Gemini, Codex dans une sandbox](../how-to/creer-un-agent-dans-une-sandbox.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. | |
| 43 | | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. | | 43 | | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. | |
| 44 | | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. | | 44 | | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. | |
| 45 | 45 | ||
modified
docs/fr/reference/raccourcis-clavier.md +1 -1 | @@ -25,7 +25,7 @@ Sous Linux et Windows, quand le curseur est dans le terminal d'un agent, le term | ||
| 25 | 25 | | Entrée | Lance la sélection | |
| 26 | 26 | | Échap, ou un clic à côté | Ferme la palette | |
| 27 | 27 | |
| 28 | -La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me** et **Ouvrir une configuration…**. | |
| 28 | +La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me**, **Créer un agent dans une sandbox (Claude, Gemini, Codex)** et **Ouvrir une configuration…**. | |
| 29 | 29 | |
| 30 | 30 | ## Zone de message |
| 31 | 31 | |
| @@ -25,7 +25,7 @@ Sous Linux et Windows, quand le curseur est dans le terminal d'un agent, le term | |||
| 25 | | Entrée | Lance la sélection | | 25 | | Entrée | Lance la sélection | |
| 26 | | Échap, ou un clic à côté | Ferme la palette | | 26 | | Échap, ou un clic à côté | Ferme la palette | |
| 27 | 27 | ||
| 28 | -La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me** et **Ouvrir une configuration…**. | 28 | +La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me**, **Créer un agent dans une sandbox (Claude, Gemini, Codex)** et **Ouvrir une configuration…**. |
| 29 | 29 | ||
| 30 | ## Zone de message | 30 | ## Zone de message |
| 31 | 31 | ||
modified
docs/release-notes/v1.5.0.fr.md +12 -2 | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | [English](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.md) |
| 4 | 4 | |
| 5 | -Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un assistant en crée un nouveau en répondant à des questions, sans fichier à écrire ni dossier à choisir, et les questions d'un agent ont un vrai formulaire dans la conversation. | |
| 5 | +Sidekicks 1.5.0 rend la création d'agents facile pour tout le monde : deux assistants créent un agent mini-me, ou un agent Claude, Gemini ou Codex dans une Docker Sandbox, sans fichier à écrire ni dossier à choisir ; et les questions d'un agent ont un vrai formulaire dans la conversation. | |
| 6 | 6 | |
| 7 | 7 | ## Nouveautés |
| 8 | 8 | |
| @@ -15,6 +15,15 @@ Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un ass | ||
| 15 | 15 | |
| 16 | 16 | → [Créer un agent mini-me](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-mini-me.md) |
| 17 | 17 | |
| 18 | +### Créer un agent Claude, Gemini ou Codex dans une sandbox (#96) | |
| 19 | + | |
| 20 | +- **✨ Créer un agent dans une sandbox** — sous la liste des agents, sur l'écran d'accueil et dans la palette de commandes : choisissez **Claude**, **Gemini** (via Google Antigravity) ou **Codex**, donnez-lui un nom et un emoji, et Sidekicks écrit son dossier dans votre dossier Documents (son `sbxenv.yaml` et son `workspace/`) puis l'ajoute. Sa sandbox est créée à son premier démarrage. | |
| 21 | +- Pas encore de clé d'API dans sbx ? L'assistant explique laquelle il faut, ouvre la page qui en donne une, et la confie à sbx (`sbx secret set`) : la clé n'est jamais écrite dans un fichier ni dans un journal. | |
| 22 | +- Le nom donné est aussi celui du dossier et de la sandbox ; Sidekicks en propose un qui est libre. | |
| 23 | +- L'assistant « Ajouter un agent » reconnaît aussi une sandbox de Gemini via Antigravity (`agent: antigravity` : `agy acp`). | |
| 24 | + | |
| 25 | +→ [Créer un agent Claude, Gemini ou Codex dans une sandbox](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-dans-une-sandbox.md) | |
| 26 | + | |
| 18 | 27 | ### Répondre aux questions d'un agent dans un formulaire (#95) |
| 19 | 28 | |
| 20 | 29 | - Quand un agent mini-me vous pose une question avec son outil `ask_user`, une carte apparaît dans la conversation, sous sa réponse : un champ où écrire, un choix, plusieurs choix ou oui/non — puis **Répondre**, **Refuser** ou **Arrêter**. |
| @@ -30,7 +39,8 @@ Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un ass | ||
| 30 | 39 | |
| 31 | 40 | - Glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement ; votre configuration et votre historique sont gardés. |
| 32 | 41 | - Vos fichiers de configuration fonctionnent tels quels. Une nouvelle clé facultative : `agentsFolder`, où l'assistant crée les dossiers des agents (`~/Documents` par défaut). |
| 33 | -- L'assistant de création a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`). | |
| 42 | +- L'assistant des sandboxes a besoin de sbx (Docker Sandboxes). Gemini passe maintenant par le kit `antigravity` de Docker, qui remplace son `gemini-kit` déprécié ; vos sandboxes Gemini existantes continuent de fonctionner. | |
| 43 | +- L'assistant de création d'agents mini-me a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`). | |
| 34 | 44 | |
| 35 | 45 | ## Fichiers |
| 36 | 46 | |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | [English](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.md) | 3 | [English](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.md) |
| 4 | 4 | ||
| 5 | -Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un assistant en crée un nouveau en répondant à des questions, sans fichier à écrire ni dossier à choisir, et les questions d'un agent ont un vrai formulaire dans la conversation. | 5 | +Sidekicks 1.5.0 rend la création d'agents facile pour tout le monde : deux assistants créent un agent mini-me, ou un agent Claude, Gemini ou Codex dans une Docker Sandbox, sans fichier à écrire ni dossier à choisir ; et les questions d'un agent ont un vrai formulaire dans la conversation. |
| 6 | 6 | ||
| 7 | ## Nouveautés | 7 | ## Nouveautés |
| 8 | 8 | ||
| @@ -15,6 +15,15 @@ Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un ass | |||
| 15 | 15 | ||
| 16 | → [Créer un agent mini-me](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-mini-me.md) | 16 | → [Créer un agent mini-me](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-mini-me.md) |
| 17 | 17 | ||
| 18 | +### Créer un agent Claude, Gemini ou Codex dans une sandbox (#96) | ||
| 19 | + | ||
| 20 | +- **✨ Créer un agent dans une sandbox** — sous la liste des agents, sur l'écran d'accueil et dans la palette de commandes : choisissez **Claude**, **Gemini** (via Google Antigravity) ou **Codex**, donnez-lui un nom et un emoji, et Sidekicks écrit son dossier dans votre dossier Documents (son `sbxenv.yaml` et son `workspace/`) puis l'ajoute. Sa sandbox est créée à son premier démarrage. | ||
| 21 | +- Pas encore de clé d'API dans sbx ? L'assistant explique laquelle il faut, ouvre la page qui en donne une, et la confie à sbx (`sbx secret set`) : la clé n'est jamais écrite dans un fichier ni dans un journal. | ||
| 22 | +- Le nom donné est aussi celui du dossier et de la sandbox ; Sidekicks en propose un qui est libre. | ||
| 23 | +- L'assistant « Ajouter un agent » reconnaît aussi une sandbox de Gemini via Antigravity (`agent: antigravity` : `agy acp`). | ||
| 24 | + | ||
| 25 | +→ [Créer un agent Claude, Gemini ou Codex dans une sandbox](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-dans-une-sandbox.md) | ||
| 26 | + | ||
| 18 | ### Répondre aux questions d'un agent dans un formulaire (#95) | 27 | ### Répondre aux questions d'un agent dans un formulaire (#95) |
| 19 | 28 | ||
| 20 | - Quand un agent mini-me vous pose une question avec son outil `ask_user`, une carte apparaît dans la conversation, sous sa réponse : un champ où écrire, un choix, plusieurs choix ou oui/non — puis **Répondre**, **Refuser** ou **Arrêter**. | 29 | - Quand un agent mini-me vous pose une question avec son outil `ask_user`, une carte apparaît dans la conversation, sous sa réponse : un champ où écrire, un choix, plusieurs choix ou oui/non — puis **Répondre**, **Refuser** ou **Arrêter**. |
| @@ -30,7 +39,8 @@ Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un ass | |||
| 30 | 39 | ||
| 31 | - Glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement ; votre configuration et votre historique sont gardés. | 40 | - Glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement ; votre configuration et votre historique sont gardés. |
| 32 | - Vos fichiers de configuration fonctionnent tels quels. Une nouvelle clé facultative : `agentsFolder`, où l'assistant crée les dossiers des agents (`~/Documents` par défaut). | 41 | - Vos fichiers de configuration fonctionnent tels quels. Une nouvelle clé facultative : `agentsFolder`, où l'assistant crée les dossiers des agents (`~/Documents` par défaut). |
| 33 | -- L'assistant de création a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`). | 42 | +- L'assistant des sandboxes a besoin de sbx (Docker Sandboxes). Gemini passe maintenant par le kit `antigravity` de Docker, qui remplace son `gemini-kit` déprécié ; vos sandboxes Gemini existantes continuent de fonctionner. |
| 43 | +- L'assistant de création d'agents mini-me a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`). | ||
| 34 | 44 | ||
| 35 | ## Fichiers | 45 | ## Fichiers |
| 36 | 46 | ||
modified
docs/release-notes/v1.5.0.md +12 -2 | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | [Français](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.fr.md) |
| 4 | 4 | |
| 5 | -Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a new one by answering questions, with no file to write and no folder to choose, and an agent's questions get a real form in the conversation. | |
| 5 | +Sidekicks 1.5.0 makes creating agents easy for everyone: two assistants create a mini-me agent, or a Claude, Gemini or Codex agent in a Docker Sandbox, with no file to write and no folder to choose; and an agent's questions get a real form in the conversation. | |
| 6 | 6 | |
| 7 | 7 | ## What's new |
| 8 | 8 | |
| @@ -15,6 +15,15 @@ Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a | ||
| 15 | 15 | |
| 16 | 16 | → [Create a mini-me agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-a-mini-me-agent.md) |
| 17 | 17 | |
| 18 | +### Create a Claude, Gemini or Codex agent in a sandbox (#96) | |
| 19 | + | |
| 20 | +- **✨ Create an agent in a sandbox** — under the agents list, on the welcome screen and in the command palette: choose **Claude**, **Gemini** (through Google Antigravity) or **Codex**, give it a name and an emoji, and Sidekicks writes its folder in your Documents folder (its `sbxenv.yaml` and its `workspace/`) and adds it. Its sandbox is created at its first start. | |
| 21 | +- No API key in sbx yet? The assistant explains which one is needed, opens the page that gives one, and stores it with sbx (`sbx secret set`): the key is never written in a file nor in a log. | |
| 22 | +- The name you give is also the folder's and the sandbox's; Sidekicks suggests one that is free. | |
| 23 | +- The "Add an agent" assistant also recognises a sandbox of Gemini through Antigravity (`agent: antigravity`: `agy acp`). | |
| 24 | + | |
| 25 | +→ [Create a Claude, Gemini or Codex agent in a sandbox](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-an-agent-in-a-sandbox.md) | |
| 26 | + | |
| 18 | 27 | ### Answer an agent's questions in a form (#95) |
| 19 | 28 | |
| 20 | 29 | - When a mini-me agent asks you something with its `ask_user` tool, a card appears in the conversation, under its answer: a field to type in, a choice, several choices or yes/no — then **Answer**, **Decline** or **Stop**. |
| @@ -30,7 +39,8 @@ Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a | ||
| 30 | 39 | |
| 31 | 40 | - Drag the new **sidekicks** into **Applications** and confirm the replacement; your configuration and your history are kept. |
| 32 | 41 | - Your configuration files keep working as they are. One new optional key: `agentsFolder`, where the assistant creates the agents' folders (`~/Documents` by default). |
| 33 | -- The creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`). | |
| 42 | +- The sandbox assistant needs sbx (Docker Sandboxes). Gemini now goes through Docker's `antigravity` kit, which replaces its deprecated `gemini-kit`; your existing Gemini sandboxes keep working. | |
| 43 | +- The mini-me creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`). | |
| 34 | 44 | |
| 35 | 45 | ## Files |
| 36 | 46 | |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | [Français](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.fr.md) | 3 | [Français](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.fr.md) |
| 4 | 4 | ||
| 5 | -Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a new one by answering questions, with no file to write and no folder to choose, and an agent's questions get a real form in the conversation. | 5 | +Sidekicks 1.5.0 makes creating agents easy for everyone: two assistants create a mini-me agent, or a Claude, Gemini or Codex agent in a Docker Sandbox, with no file to write and no folder to choose; and an agent's questions get a real form in the conversation. |
| 6 | 6 | ||
| 7 | ## What's new | 7 | ## What's new |
| 8 | 8 | ||
| @@ -15,6 +15,15 @@ Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a | |||
| 15 | 15 | ||
| 16 | → [Create a mini-me agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-a-mini-me-agent.md) | 16 | → [Create a mini-me agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-a-mini-me-agent.md) |
| 17 | 17 | ||
| 18 | +### Create a Claude, Gemini or Codex agent in a sandbox (#96) | ||
| 19 | + | ||
| 20 | +- **✨ Create an agent in a sandbox** — under the agents list, on the welcome screen and in the command palette: choose **Claude**, **Gemini** (through Google Antigravity) or **Codex**, give it a name and an emoji, and Sidekicks writes its folder in your Documents folder (its `sbxenv.yaml` and its `workspace/`) and adds it. Its sandbox is created at its first start. | ||
| 21 | +- No API key in sbx yet? The assistant explains which one is needed, opens the page that gives one, and stores it with sbx (`sbx secret set`): the key is never written in a file nor in a log. | ||
| 22 | +- The name you give is also the folder's and the sandbox's; Sidekicks suggests one that is free. | ||
| 23 | +- The "Add an agent" assistant also recognises a sandbox of Gemini through Antigravity (`agent: antigravity`: `agy acp`). | ||
| 24 | + | ||
| 25 | +→ [Create a Claude, Gemini or Codex agent in a sandbox](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-an-agent-in-a-sandbox.md) | ||
| 26 | + | ||
| 18 | ### Answer an agent's questions in a form (#95) | 27 | ### Answer an agent's questions in a form (#95) |
| 19 | 28 | ||
| 20 | - When a mini-me agent asks you something with its `ask_user` tool, a card appears in the conversation, under its answer: a field to type in, a choice, several choices or yes/no — then **Answer**, **Decline** or **Stop**. | 29 | - When a mini-me agent asks you something with its `ask_user` tool, a card appears in the conversation, under its answer: a field to type in, a choice, several choices or yes/no — then **Answer**, **Decline** or **Stop**. |
| @@ -30,7 +39,8 @@ Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a | |||
| 30 | 39 | ||
| 31 | - Drag the new **sidekicks** into **Applications** and confirm the replacement; your configuration and your history are kept. | 40 | - Drag the new **sidekicks** into **Applications** and confirm the replacement; your configuration and your history are kept. |
| 32 | - Your configuration files keep working as they are. One new optional key: `agentsFolder`, where the assistant creates the agents' folders (`~/Documents` by default). | 41 | - Your configuration files keep working as they are. One new optional key: `agentsFolder`, where the assistant creates the agents' folders (`~/Documents` by default). |
| 33 | -- The creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`). | 42 | +- The sandbox assistant needs sbx (Docker Sandboxes). Gemini now goes through Docker's `antigravity` kit, which replaces its deprecated `gemini-kit`; your existing Gemini sandboxes keep working. |
| 43 | +- The mini-me creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`). | ||
| 34 | 44 | ||
| 35 | ## Files | 45 | ## Files |
| 36 | 46 | ||
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/index.ts +4 -0 | @@ -5,6 +5,7 @@ import * as AgentService from "./agentservice.js"; | ||
| 5 | 5 | import * as ChannelService from "./channelservice.js"; |
| 6 | 6 | import * as ConfigService from "./configservice.js"; |
| 7 | 7 | import * as CreatorService from "./creatorservice.js"; |
| 8 | +import * as SbxCreatorService from "./sbxcreatorservice.js"; | |
| 8 | 9 | import * as SystemService from "./systemservice.js"; |
| 9 | 10 | import * as TerminalService from "./terminalservice.js"; |
| 10 | 11 | import * as WorkspaceService from "./workspaceservice.js"; |
| @@ -13,6 +14,7 @@ export { | ||
| 13 | 14 | ChannelService, |
| 14 | 15 | ConfigService, |
| 15 | 16 | CreatorService, |
| 17 | + SbxCreatorService, | |
| 16 | 18 | SystemService, |
| 17 | 19 | TerminalService, |
| 18 | 20 | WorkspaceService |
| @@ -32,6 +34,8 @@ export type { | ||
| 32 | 34 | ResetResult, |
| 33 | 35 | SandboxEnv, |
| 34 | 36 | SaveResult, |
| 37 | + SbxCheck, | |
| 38 | + SbxCreateForm, | |
| 35 | 39 | UnloadResult, |
| 36 | 40 | WorkspaceInfo |
| 37 | 41 | } from "./models.js"; |
| @@ -5,6 +5,7 @@ import * as AgentService from "./agentservice.js"; | |||
| 5 | import * as ChannelService from "./channelservice.js"; | 5 | import * as ChannelService from "./channelservice.js"; |
| 6 | import * as ConfigService from "./configservice.js"; | 6 | import * as ConfigService from "./configservice.js"; |
| 7 | import * as CreatorService from "./creatorservice.js"; | 7 | import * as CreatorService from "./creatorservice.js"; |
| 8 | +import * as SbxCreatorService from "./sbxcreatorservice.js"; | ||
| 8 | import * as SystemService from "./systemservice.js"; | 9 | import * as SystemService from "./systemservice.js"; |
| 9 | import * as TerminalService from "./terminalservice.js"; | 10 | import * as TerminalService from "./terminalservice.js"; |
| 10 | import * as WorkspaceService from "./workspaceservice.js"; | 11 | import * as WorkspaceService from "./workspaceservice.js"; |
| @@ -13,6 +14,7 @@ export { | |||
| 13 | ChannelService, | 14 | ChannelService, |
| 14 | ConfigService, | 15 | ConfigService, |
| 15 | CreatorService, | 16 | CreatorService, |
| 17 | + SbxCreatorService, | ||
| 16 | SystemService, | 18 | SystemService, |
| 17 | TerminalService, | 19 | TerminalService, |
| 18 | WorkspaceService | 20 | WorkspaceService |
| @@ -32,6 +34,8 @@ export type { | |||
| 32 | ResetResult, | 34 | ResetResult, |
| 33 | SandboxEnv, | 35 | SandboxEnv, |
| 34 | SaveResult, | 36 | SaveResult, |
| 37 | + SbxCheck, | ||
| 38 | + SbxCreateForm, | ||
| 35 | UnloadResult, | 39 | UnloadResult, |
| 36 | WorkspaceInfo | 40 | WorkspaceInfo |
| 37 | } from "./models.js"; | 41 | } from "./models.js"; |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +21 -0 | @@ -235,6 +235,27 @@ export interface SaveResult { | ||
| 235 | 235 | "conflict": boolean; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | +/** | |
| 239 | + * SbxCheck is what the assistant needs once a kind is chosen: whether its | |
| 240 | + * key is stored in sbx, a free name to suggest, and where the folder goes. | |
| 241 | + */ | |
| 242 | +export interface SbxCheck { | |
| 243 | + "hasKey": boolean; | |
| 244 | + "name": string; | |
| 245 | + "agentsFolder": string; | |
| 246 | +} | |
| 247 | + | |
| 248 | +/** | |
| 249 | + * SbxCreateForm is the agent to create: its kind, its name (its folder's and | |
| 250 | + * its sandbox's too), its title and its emoji. | |
| 251 | + */ | |
| 252 | +export interface SbxCreateForm { | |
| 253 | + "kind": string; | |
| 254 | + "name": string; | |
| 255 | + "title": string; | |
| 256 | + "icon": string; | |
| 257 | +} | |
| 258 | + | |
| 238 | 259 | /** |
| 239 | 260 | * UnloadResult says which agents unloaded their model, and which running |
| 240 | 261 | * agents were left alone: answering, unable to unload, or failing. |
| @@ -235,6 +235,27 @@ export interface SaveResult { | |||
| 235 | "conflict": boolean; | 235 | "conflict": boolean; |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | +/** | ||
| 239 | + * SbxCheck is what the assistant needs once a kind is chosen: whether its | ||
| 240 | + * key is stored in sbx, a free name to suggest, and where the folder goes. | ||
| 241 | + */ | ||
| 242 | +export interface SbxCheck { | ||
| 243 | + "hasKey": boolean; | ||
| 244 | + "name": string; | ||
| 245 | + "agentsFolder": string; | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +/** | ||
| 249 | + * SbxCreateForm is the agent to create: its kind, its name (its folder's and | ||
| 250 | + * its sandbox's too), its title and its emoji. | ||
| 251 | + */ | ||
| 252 | +export interface SbxCreateForm { | ||
| 253 | + "kind": string; | ||
| 254 | + "name": string; | ||
| 255 | + "title": string; | ||
| 256 | + "icon": string; | ||
| 257 | +} | ||
| 258 | + | ||
| 238 | /** | 259 | /** |
| 239 | * UnloadResult says which agents unloaded their model, and which running | 260 | * UnloadResult says which agents unloaded their model, and which running |
| 240 | * agents were left alone: answering, unable to unload, or failing. | 261 | * agents were left alone: answering, unable to unload, or failing. |
added
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/sbxcreatorservice.ts +62 -0 | new file mode 100644 | ||
| @@ -0,0 +1,62 @@ | ||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | |
| 2 | +// This file is automatically generated. DO NOT EDIT | |
| 3 | + | |
| 4 | +/** | |
| 5 | + * SbxCreatorService is the assistant that creates an agent in a Docker | |
| 6 | + * Sandbox — Claude, Gemini, Codex… — for people who do not write files | |
| 7 | + * (issue #96): it checks sbx and the kind's API key (asking for it and | |
| 8 | + * storing it with sbx when missing), writes the agent's folder in the | |
| 9 | + * agents' folder and adds the agent to the configuration. | |
| 10 | + * | |
| 11 | + * kinds := service.Kinds() | |
| 12 | + * check, err := service.Check(ctx, "claude") // check.HasKey, check.Name | |
| 13 | + * err = service.SetKey(ctx, "claude", "sk-ant-…") // when !check.HasKey | |
| 14 | + * result, err := service.Create(ctx, SbxCreateForm{Kind: "claude", Name: check.Name, Icon: "📙"}) | |
| 15 | + * @module | |
| 16 | + */ | |
| 17 | + | |
| 18 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
| 19 | +// @ts-ignore: Unused imports | |
| 20 | +import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime"; | |
| 21 | + | |
| 22 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
| 23 | +// @ts-ignore: Unused imports | |
| 24 | +import * as sbxcreate$0 from "../sbxcreate/models.js"; | |
| 25 | + | |
| 26 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | |
| 27 | +// @ts-ignore: Unused imports | |
| 28 | +import * as $models from "./models.js"; | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * Check checks that sbx is installed ("sbx is not installed" otherwise), | |
| 32 | + * whether the kind's key is stored, and suggests a free name: the kind's | |
| 33 | + * id, else id-2, id-3… — free as an agent, a folder and a sandbox. | |
| 34 | + */ | |
| 35 | +export function Check(kindID: string): $CancellablePromise<$models.SbxCheck> { | |
| 36 | + return $Call.ByID(1722205738, kindID); | |
| 37 | +} | |
| 38 | + | |
| 39 | +/** | |
| 40 | + * Create writes the agent's folder — <agentsFolder>/<name>, with its | |
| 41 | + * sbxenv.yaml and workspace/ — and adds the agent: `sbx exec -i <name> | |
| 42 | + * <program>`, its sandbox created at its first start. A name already used | |
| 43 | + * (agent, folder or sandbox) is a Problem: nothing is written. | |
| 44 | + */ | |
| 45 | +export function Create(form: $models.SbxCreateForm): $CancellablePromise<$models.CreatorResult> { | |
| 46 | + return $Call.ByID(237897102, form); | |
| 47 | +} | |
| 48 | + | |
| 49 | +/** | |
| 50 | + * Kinds is the kinds of agents the assistant creates, in order. | |
| 51 | + */ | |
| 52 | +export function Kinds(): $CancellablePromise<sbxcreate$0.Kind[] | null> { | |
| 53 | + return $Call.ByID(2047680797); | |
| 54 | +} | |
| 55 | + | |
| 56 | +/** | |
| 57 | + * SetKey stores the kind's key in sbx, for every sandbox. The key goes to | |
| 58 | + * sbx on its standard input; it is never written in a file nor in a log. | |
| 59 | + */ | |
| 60 | +export function SetKey(kindID: string, key: string): $CancellablePromise<void> { | |
| 61 | + return $Call.ByID(2475754193, kindID, key); | |
| 62 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
| 2 | +// This file is automatically generated. DO NOT EDIT | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * SbxCreatorService is the assistant that creates an agent in a Docker | ||
| 6 | + * Sandbox — Claude, Gemini, Codex… — for people who do not write files | ||
| 7 | + * (issue #96): it checks sbx and the kind's API key (asking for it and | ||
| 8 | + * storing it with sbx when missing), writes the agent's folder in the | ||
| 9 | + * agents' folder and adds the agent to the configuration. | ||
| 10 | + * | ||
| 11 | + * kinds := service.Kinds() | ||
| 12 | + * check, err := service.Check(ctx, "claude") // check.HasKey, check.Name | ||
| 13 | + * err = service.SetKey(ctx, "claude", "sk-ant-…") // when !check.HasKey | ||
| 14 | + * result, err := service.Create(ctx, SbxCreateForm{Kind: "claude", Name: check.Name, Icon: "📙"}) | ||
| 15 | + * @module | ||
| 16 | + */ | ||
| 17 | + | ||
| 18 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| 19 | +// @ts-ignore: Unused imports | ||
| 20 | +import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime"; | ||
| 21 | + | ||
| 22 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| 23 | +// @ts-ignore: Unused imports | ||
| 24 | +import * as sbxcreate$0 from "../sbxcreate/models.js"; | ||
| 25 | + | ||
| 26 | +// eslint-disable-next-line @typescript-eslint/ban-ts-comment | ||
| 27 | +// @ts-ignore: Unused imports | ||
| 28 | +import * as $models from "./models.js"; | ||
| 29 | + | ||
| 30 | +/** | ||
| 31 | + * Check checks that sbx is installed ("sbx is not installed" otherwise), | ||
| 32 | + * whether the kind's key is stored, and suggests a free name: the kind's | ||
| 33 | + * id, else id-2, id-3… — free as an agent, a folder and a sandbox. | ||
| 34 | + */ | ||
| 35 | +export function Check(kindID: string): $CancellablePromise<$models.SbxCheck> { | ||
| 36 | + return $Call.ByID(1722205738, kindID); | ||
| 37 | +} | ||
| 38 | + | ||
| 39 | +/** | ||
| 40 | + * Create writes the agent's folder — <agentsFolder>/<name>, with its | ||
| 41 | + * sbxenv.yaml and workspace/ — and adds the agent: `sbx exec -i <name> | ||
| 42 | + * <program>`, its sandbox created at its first start. A name already used | ||
| 43 | + * (agent, folder or sandbox) is a Problem: nothing is written. | ||
| 44 | + */ | ||
| 45 | +export function Create(form: $models.SbxCreateForm): $CancellablePromise<$models.CreatorResult> { | ||
| 46 | + return $Call.ByID(237897102, form); | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | +/** | ||
| 50 | + * Kinds is the kinds of agents the assistant creates, in order. | ||
| 51 | + */ | ||
| 52 | +export function Kinds(): $CancellablePromise<sbxcreate$0.Kind[] | null> { | ||
| 53 | + return $Call.ByID(2047680797); | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +/** | ||
| 57 | + * SetKey stores the kind's key in sbx, for every sandbox. The key goes to | ||
| 58 | + * sbx on its standard input; it is never written in a file nor in a log. | ||
| 59 | + */ | ||
| 60 | +export function SetKey(kindID: string, key: string): $CancellablePromise<void> { | ||
| 61 | + return $Call.ByID(2475754193, kindID, key); | ||
| 62 | +} | ||
added
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate/index.ts +6 -0 | new file mode 100644 | ||
| @@ -0,0 +1,6 @@ | ||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | |
| 2 | +// This file is automatically generated. DO NOT EDIT | |
| 3 | + | |
| 4 | +export type { | |
| 5 | + Kind | |
| 6 | +} from "./models.js"; | |
| new file mode 100644 | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
| 2 | +// This file is automatically generated. DO NOT EDIT | ||
| 3 | + | ||
| 4 | +export type { | ||
| 5 | + Kind | ||
| 6 | +} from "./models.js"; | ||
added
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate/models.ts +34 -0 | new file mode 100644 | ||
| @@ -0,0 +1,34 @@ | ||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | |
| 2 | +// This file is automatically generated. DO NOT EDIT | |
| 3 | + | |
| 4 | +/** | |
| 5 | + * Kind is a kind of agent the assistant creates: what goes in its | |
| 6 | + * sbxenv.yaml, how Sidekicks starts it, and the sbx secret it needs. | |
| 7 | + */ | |
| 8 | +export interface Kind { | |
| 9 | + "id": string; | |
| 10 | + "title": string; | |
| 11 | + "icon": string; | |
| 12 | + | |
| 13 | + /** | |
| 14 | + * Agent is the sbx agent of the sandbox ("agent:"), Kit its kit. | |
| 15 | + */ | |
| 16 | + "agent": string; | |
| 17 | + "kit": string; | |
| 18 | + | |
| 19 | + /** | |
| 20 | + * Program is the agent's ACP program in the sandbox, then its | |
| 21 | + * arguments, on one line ("agy acp"). | |
| 22 | + */ | |
| 23 | + "program": string; | |
| 24 | + | |
| 25 | + /** | |
| 26 | + * Service is the sbx secret service of its key (sbx secret set <service>). | |
| 27 | + */ | |
| 28 | + "service": string; | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * KeyURL is where the user gets a key. | |
| 32 | + */ | |
| 33 | + "keyUrl": string; | |
| 34 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | +// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL | ||
| 2 | +// This file is automatically generated. DO NOT EDIT | ||
| 3 | + | ||
| 4 | +/** | ||
| 5 | + * Kind is a kind of agent the assistant creates: what goes in its | ||
| 6 | + * sbxenv.yaml, how Sidekicks starts it, and the sbx secret it needs. | ||
| 7 | + */ | ||
| 8 | +export interface Kind { | ||
| 9 | + "id": string; | ||
| 10 | + "title": string; | ||
| 11 | + "icon": string; | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * Agent is the sbx agent of the sandbox ("agent:"), Kit its kit. | ||
| 15 | + */ | ||
| 16 | + "agent": string; | ||
| 17 | + "kit": string; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Program is the agent's ACP program in the sandbox, then its | ||
| 21 | + * arguments, on one line ("agy acp"). | ||
| 22 | + */ | ||
| 23 | + "program": string; | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Service is the sbx secret service of its key (sbx secret set <service>). | ||
| 27 | + */ | ||
| 28 | + "service": string; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * KeyURL is where the user gets a key. | ||
| 32 | + */ | ||
| 33 | + "keyUrl": string; | ||
| 34 | +} | ||
modified
frontend/src/lib/agent/CreateMiniMeAgent.svelte +1 -1 | @@ -143,7 +143,7 @@ | ||
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | function close() { |
| 146 | - appState.creator = false | |
| 146 | + appState.creator = '' | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // Leaving the assistant before the end removes what mm wrote. |
| @@ -143,7 +143,7 @@ | |||
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | function close() { | 145 | function close() { |
| 146 | - appState.creator = false | 146 | + appState.creator = '' |
| 147 | } | 147 | } |
| 148 | 148 | ||
| 149 | // Leaving the assistant before the end removes what mm wrote. | 149 | // Leaving the assistant before the end removes what mm wrote. |
added
frontend/src/lib/agent/CreateSbxAgent.svelte +244 -0 | new file mode 100644 | ||
| @@ -0,0 +1,244 @@ | ||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | |
| 2 | +<script lang="ts"> | |
| 3 | + // The assistant that creates an agent in a Docker Sandbox (issue #96): | |
| 4 | + // the user picks Claude, Gemini or Codex, gives its API key when sbx does | |
| 5 | + // not hold one yet (SbxCreatorService.SetKey hands it to sbx: it is never | |
| 6 | + // written), then its name, title and emoji. SbxCreatorService.Create | |
| 7 | + // writes <agentsFolder>/<name> (sbxenv.yaml, workspace/) and adds the | |
| 8 | + // agent; its conversation opens. | |
| 9 | + import { Browser } from '@wailsio/runtime' | |
| 10 | + import { t, type MessageKey } from '../i18n/index.svelte' | |
| 11 | + import { SbxCreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | |
| 12 | + import type { Kind } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate' | |
| 13 | + import { agentAdded, appState } from '../state.svelte' | |
| 14 | + import { agentFolder, iconChoices, problemKey, sbxMissing, validSbxName } from '../creator' | |
| 15 | + import AgentAvatar from './AgentAvatar.svelte' | |
| 16 | + import ErrorText from '../chat/ErrorText.svelte' | |
| 17 | + import Spinner from '../chat/Spinner.svelte' | |
| 18 | + | |
| 19 | + type Step = 'kind' | 'checking' | 'failed' | 'key' | 'details' | |
| 20 | + | |
| 21 | + let kinds = $state<Kind[]>([]) | |
| 22 | + let step = $state<Step>('kind') | |
| 23 | + let kind = $state<Kind | null>(null) | |
| 24 | + let failure = $state('') | |
| 25 | + let agentsFolder = $state('') | |
| 26 | + let hasKey = $state(false) | |
| 27 | + let key = $state('') | |
| 28 | + let keyError = $state('') | |
| 29 | + let busy = $state(false) | |
| 30 | + let name = $state('') | |
| 31 | + let title = $state('') | |
| 32 | + let icon = $state('') | |
| 33 | + let problem = $state('') | |
| 34 | + let refused = $state<string[]>([]) | |
| 35 | + let error = $state('') | |
| 36 | + | |
| 37 | + const icons = $derived(kind ? [kind.icon, ...iconChoices.filter((choice) => choice !== kind?.icon)] : iconChoices) | |
| 38 | + | |
| 39 | + SbxCreatorService.Kinds().then((list) => (kinds = list ?? [])) | |
| 40 | + | |
| 41 | + async function choose(chosen: Kind) { | |
| 42 | + kind = chosen | |
| 43 | + title = chosen.title | |
| 44 | + icon = chosen.icon | |
| 45 | + await check() | |
| 46 | + } | |
| 47 | + | |
| 48 | + // check asks Go whether sbx is there and holds the kind's key, and for a free name. | |
| 49 | + async function check() { | |
| 50 | + if (!kind) return | |
| 51 | + step = 'checking' | |
| 52 | + failure = '' | |
| 53 | + try { | |
| 54 | + const result = await SbxCreatorService.Check(kind.id) | |
| 55 | + hasKey = result.hasKey | |
| 56 | + agentsFolder = result.agentsFolder | |
| 57 | + name = name || result.name | |
| 58 | + step = hasKey ? 'details' : 'key' | |
| 59 | + } catch (caught) { | |
| 60 | + failure = caught instanceof Error ? caught.message : String(caught) | |
| 61 | + step = 'failed' | |
| 62 | + } | |
| 63 | + } | |
| 64 | + | |
| 65 | + async function saveKey(event: SubmitEvent) { | |
| 66 | + event.preventDefault() | |
| 67 | + if (!kind || !key.trim()) return | |
| 68 | + busy = true | |
| 69 | + keyError = '' | |
| 70 | + try { | |
| 71 | + await SbxCreatorService.SetKey(kind.id, key) | |
| 72 | + key = '' | |
| 73 | + await check() | |
| 74 | + } catch (caught) { | |
| 75 | + keyError = caught instanceof Error ? caught.message : String(caught) | |
| 76 | + } finally { | |
| 77 | + busy = false | |
| 78 | + } | |
| 79 | + } | |
| 80 | + | |
| 81 | + async function create(event: SubmitEvent) { | |
| 82 | + event.preventDefault() | |
| 83 | + if (!kind) return | |
| 84 | + problem = '' | |
| 85 | + refused = [] | |
| 86 | + error = '' | |
| 87 | + if (!validSbxName(name)) { | |
| 88 | + problem = 'invalidName' | |
| 89 | + return | |
| 90 | + } | |
| 91 | + busy = true | |
| 92 | + try { | |
| 93 | + const result = await SbxCreatorService.Create({ kind: kind.id, name, title: title.trim() || kind.title, icon: icon.trim() }) | |
| 94 | + if (result.problem) problem = result.problem | |
| 95 | + else if (result.problems && result.problems.length > 0) refused = result.problems | |
| 96 | + else agentAdded(name) | |
| 97 | + } catch (caught) { | |
| 98 | + error = caught instanceof Error ? caught.message : String(caught) | |
| 99 | + } finally { | |
| 100 | + busy = false | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + function another() { | |
| 105 | + kind = null | |
| 106 | + name = '' | |
| 107 | + problem = '' | |
| 108 | + step = 'kind' | |
| 109 | + } | |
| 110 | + | |
| 111 | + function close() { | |
| 112 | + appState.creator = '' | |
| 113 | + } | |
| 114 | +</script> | |
| 115 | + | |
| 116 | +<div class="creator"> | |
| 117 | + <h1>{t('sbxCreator.title')}</h1> | |
| 118 | + | |
| 119 | + {#if step === 'kind'} | |
| 120 | + <p class="intro">{t('sbxCreator.intro')}</p> | |
| 121 | + <div class="kinds" role="group" aria-label={t('sbxCreator.choose')}> | |
| 122 | + {#each kinds as choice (choice.id)} | |
| 123 | + <button type="button" class="kind" onclick={() => choose(choice)}> | |
| 124 | + <span class="icon" aria-hidden="true">{choice.icon}</span> | |
| 125 | + <span><strong>{choice.title}</strong><br /><small>{t(`sbxCreator.kind.${choice.id}` as MessageKey)}</small></span> | |
| 126 | + </button> | |
| 127 | + {/each} | |
| 128 | + </div> | |
| 129 | + <div class="actions"><button type="button" onclick={close}>{t('creator.cancel')}</button></div> | |
| 130 | + {:else if step === 'checking'} | |
| 131 | + <p class="status" role="status"><Spinner /> {t('sbxCreator.checking')}</p> | |
| 132 | + {:else if step === 'failed'} | |
| 133 | + <div class="problem" role="alert"> | |
| 134 | + {#if sbxMissing(failure)}{t('sbxCreator.sbxMissing')}{:else}<ErrorText raw={failure} />{/if} | |
| 135 | + </div> | |
| 136 | + <div class="actions"> | |
| 137 | + <button type="button" onclick={close}>{t('creator.cancel')}</button> | |
| 138 | + <button type="button" onclick={another}>{t('sbxCreator.otherKind')}</button> | |
| 139 | + <button type="button" class="primary" onclick={check}>{t('creator.retry')}</button> | |
| 140 | + </div> | |
| 141 | + {:else if step === 'key' && kind} | |
| 142 | + <form class="panel" onsubmit={saveKey}> | |
| 143 | + <h2>{kind.icon} {t('sbxCreator.key.title', { title: kind.title })}</h2> | |
| 144 | + <p>{t('sbxCreator.key.explain', { title: kind.title, service: kind.service })}</p> | |
| 145 | + <button type="button" class="link" onclick={() => kind && Browser.OpenURL(kind.keyUrl)}>{t('sbxCreator.key.get')}</button> | |
| 146 | + <label> | |
| 147 | + {t('sbxCreator.key.label')} | |
| 148 | + <!-- svelte-ignore a11y_autofocus --> | |
| 149 | + <input type="password" bind:value={key} autocomplete="off" spellcheck="false" autocapitalize="off" autofocus disabled={busy} /> | |
| 150 | + </label> | |
| 151 | + {#if keyError}<div class="problem" role="alert"><ErrorText raw={keyError} /></div>{/if} | |
| 152 | + <div class="actions"> | |
| 153 | + <button type="button" onclick={another} disabled={busy}>{t('sbxCreator.otherKind')}</button> | |
| 154 | + <span class="grow"></span> | |
| 155 | + <button type="button" onclick={() => (step = 'details')} disabled={busy}>{t('sbxCreator.key.later')}</button> | |
| 156 | + <button type="submit" class="primary" disabled={busy || !key.trim()}>{#if busy}<Spinner /> {t('sbxCreator.key.saving')}{:else}{t('sbxCreator.key.save')}{/if}</button> | |
| 157 | + </div> | |
| 158 | + </form> | |
| 159 | + {:else if step === 'details' && kind} | |
| 160 | + <form class="questions" onsubmit={create} novalidate> | |
| 161 | + {#if hasKey} | |
| 162 | + <p class="ok">{t('sbxCreator.key.stored', { title: kind.title })} <button type="button" class="link" onclick={() => (step = 'key')}>{t('sbxCreator.key.replace')}</button></p> | |
| 163 | + {:else} | |
| 164 | + <p class="warning" role="alert">{t('sbxCreator.key.missing', { title: kind.title, service: kind.service })}</p> | |
| 165 | + {/if} | |
| 166 | + <fieldset disabled={busy}> | |
| 167 | + <div class="row"> | |
| 168 | + <span class="preview"><AgentAvatar {icon} title={title || name} {name} size={34} /></span> | |
| 169 | + <label class="grow"> | |
| 170 | + {t('sbxCreator.agentTitle')} | |
| 171 | + <input bind:value={title} /> | |
| 172 | + </label> | |
| 173 | + </div> | |
| 174 | + <label> | |
| 175 | + {t('sbxCreator.name')} | |
| 176 | + <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> | |
| 177 | + </label> | |
| 178 | + <small id="sbx-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | |
| 179 | + {problem ? t(problemKey(problem)) : t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | |
| 180 | + </small> | |
| 181 | + <div class="group" aria-label={t('creator.icon')}> | |
| 182 | + <span class="label">{t('creator.icon')}</span> | |
| 183 | + <div class="icons"> | |
| 184 | + {#each icons as choice (choice)} | |
| 185 | + <button type="button" class="icon-choice" class:chosen={icon === choice} onclick={() => (icon = choice)} aria-label={choice} aria-pressed={icon === choice}>{choice}</button> | |
| 186 | + {/each} | |
| 187 | + <input class="custom" bind:value={icon} maxlength="8" aria-label={t('creator.icon')} /> | |
| 188 | + </div> | |
| 189 | + </div> | |
| 190 | + </fieldset> | |
| 191 | + <small>{t('sbxCreator.firstStart')}</small> | |
| 192 | + {#if refused.length > 0} | |
| 193 | + <div class="problem" role="alert"> | |
| 194 | + <strong>{t('creator.refused')}</strong> | |
| 195 | + <ul>{#each refused as reason, index (index)}<li>{reason}</li>{/each}</ul> | |
| 196 | + </div> | |
| 197 | + {/if} | |
| 198 | + {#if error}<div class="problem" role="alert"><ErrorText raw={error} /></div>{/if} | |
| 199 | + <div class="actions"> | |
| 200 | + <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button> | |
| 201 | + <button type="button" onclick={another} disabled={busy}>{t('sbxCreator.otherKind')}</button> | |
| 202 | + <span class="grow"></span> | |
| 203 | + <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {t('sbxCreator.creating')}{:else}{t('sbxCreator.create')}{/if}</button> | |
| 204 | + </div> | |
| 205 | + </form> | |
| 206 | + {/if} | |
| 207 | +</div> | |
| 208 | + | |
| 209 | +<style> | |
| 210 | + .creator { max-width: 620px; width: 100%; margin: 0 auto; padding: 24px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; } | |
| 211 | + h1 { font-size: 20px; margin: 0; } | |
| 212 | + h2 { font-size: 16px; margin: 0; } | |
| 213 | + .intro, .status { color: var(--muted); margin: 0; } | |
| 214 | + .status { display: flex; align-items: center; gap: 8px; } | |
| 215 | + .kinds { display: flex; flex-direction: column; gap: 8px; } | |
| 216 | + .kind { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); } | |
| 217 | + .kind:hover { border-color: var(--accent); } | |
| 218 | + .kind .icon { font-size: 28px; } | |
| 219 | + .kind small { color: var(--muted); } | |
| 220 | + .panel, .questions { display: flex; flex-direction: column; gap: 12px; } | |
| 221 | + .panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--panel); } | |
| 222 | + .panel p { margin: 0; } | |
| 223 | + fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); margin: 0; } | |
| 224 | + label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; } | |
| 225 | + .label { font-size: 13px; } | |
| 226 | + input { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); } | |
| 227 | + input[aria-invalid='true'] { border-color: var(--danger); } | |
| 228 | + small { color: var(--muted); font-size: 12px; } | |
| 229 | + .problem-text { color: var(--danger); } | |
| 230 | + .icons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } | |
| 231 | + .icon-choice { font-size: 20px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); } | |
| 232 | + .icon-choice.chosen { border-color: var(--accent); } | |
| 233 | + .custom { width: 64px; text-align: center; } | |
| 234 | + .row { display: flex; gap: 10px; align-items: flex-end; } | |
| 235 | + .preview { display: flex; align-items: center; justify-content: center; width: 38px; height: 34px; } | |
| 236 | + .grow { flex: 1; min-width: 0; } | |
| 237 | + .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } | |
| 238 | + .link { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; align-self: flex-start; } | |
| 239 | + .ok { margin: 0; color: var(--ok, var(--text)); } | |
| 240 | + .warning { margin: 0; border: 1px solid var(--warn); border-radius: var(--radius); color: var(--warn); padding: 8px 12px; font-size: 13px; } | |
| 241 | + .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; } | |
| 242 | + .problem ul { margin: 4px 0 0; padding-left: 18px; } | |
| 243 | + .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | |
| 244 | +</style> | |
| new file mode 100644 | |||
| @@ -0,0 +1,244 @@ | |||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | ||
| 2 | +<script lang="ts"> | ||
| 3 | + // The assistant that creates an agent in a Docker Sandbox (issue #96): | ||
| 4 | + // the user picks Claude, Gemini or Codex, gives its API key when sbx does | ||
| 5 | + // not hold one yet (SbxCreatorService.SetKey hands it to sbx: it is never | ||
| 6 | + // written), then its name, title and emoji. SbxCreatorService.Create | ||
| 7 | + // writes <agentsFolder>/<name> (sbxenv.yaml, workspace/) and adds the | ||
| 8 | + // agent; its conversation opens. | ||
| 9 | + import { Browser } from '@wailsio/runtime' | ||
| 10 | + import { t, type MessageKey } from '../i18n/index.svelte' | ||
| 11 | + import { SbxCreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | ||
| 12 | + import type { Kind } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate' | ||
| 13 | + import { agentAdded, appState } from '../state.svelte' | ||
| 14 | + import { agentFolder, iconChoices, problemKey, sbxMissing, validSbxName } from '../creator' | ||
| 15 | + import AgentAvatar from './AgentAvatar.svelte' | ||
| 16 | + import ErrorText from '../chat/ErrorText.svelte' | ||
| 17 | + import Spinner from '../chat/Spinner.svelte' | ||
| 18 | + | ||
| 19 | + type Step = 'kind' | 'checking' | 'failed' | 'key' | 'details' | ||
| 20 | + | ||
| 21 | + let kinds = $state<Kind[]>([]) | ||
| 22 | + let step = $state<Step>('kind') | ||
| 23 | + let kind = $state<Kind | null>(null) | ||
| 24 | + let failure = $state('') | ||
| 25 | + let agentsFolder = $state('') | ||
| 26 | + let hasKey = $state(false) | ||
| 27 | + let key = $state('') | ||
| 28 | + let keyError = $state('') | ||
| 29 | + let busy = $state(false) | ||
| 30 | + let name = $state('') | ||
| 31 | + let title = $state('') | ||
| 32 | + let icon = $state('') | ||
| 33 | + let problem = $state('') | ||
| 34 | + let refused = $state<string[]>([]) | ||
| 35 | + let error = $state('') | ||
| 36 | + | ||
| 37 | + const icons = $derived(kind ? [kind.icon, ...iconChoices.filter((choice) => choice !== kind?.icon)] : iconChoices) | ||
| 38 | + | ||
| 39 | + SbxCreatorService.Kinds().then((list) => (kinds = list ?? [])) | ||
| 40 | + | ||
| 41 | + async function choose(chosen: Kind) { | ||
| 42 | + kind = chosen | ||
| 43 | + title = chosen.title | ||
| 44 | + icon = chosen.icon | ||
| 45 | + await check() | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // check asks Go whether sbx is there and holds the kind's key, and for a free name. | ||
| 49 | + async function check() { | ||
| 50 | + if (!kind) return | ||
| 51 | + step = 'checking' | ||
| 52 | + failure = '' | ||
| 53 | + try { | ||
| 54 | + const result = await SbxCreatorService.Check(kind.id) | ||
| 55 | + hasKey = result.hasKey | ||
| 56 | + agentsFolder = result.agentsFolder | ||
| 57 | + name = name || result.name | ||
| 58 | + step = hasKey ? 'details' : 'key' | ||
| 59 | + } catch (caught) { | ||
| 60 | + failure = caught instanceof Error ? caught.message : String(caught) | ||
| 61 | + step = 'failed' | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + async function saveKey(event: SubmitEvent) { | ||
| 66 | + event.preventDefault() | ||
| 67 | + if (!kind || !key.trim()) return | ||
| 68 | + busy = true | ||
| 69 | + keyError = '' | ||
| 70 | + try { | ||
| 71 | + await SbxCreatorService.SetKey(kind.id, key) | ||
| 72 | + key = '' | ||
| 73 | + await check() | ||
| 74 | + } catch (caught) { | ||
| 75 | + keyError = caught instanceof Error ? caught.message : String(caught) | ||
| 76 | + } finally { | ||
| 77 | + busy = false | ||
| 78 | + } | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + async function create(event: SubmitEvent) { | ||
| 82 | + event.preventDefault() | ||
| 83 | + if (!kind) return | ||
| 84 | + problem = '' | ||
| 85 | + refused = [] | ||
| 86 | + error = '' | ||
| 87 | + if (!validSbxName(name)) { | ||
| 88 | + problem = 'invalidName' | ||
| 89 | + return | ||
| 90 | + } | ||
| 91 | + busy = true | ||
| 92 | + try { | ||
| 93 | + const result = await SbxCreatorService.Create({ kind: kind.id, name, title: title.trim() || kind.title, icon: icon.trim() }) | ||
| 94 | + if (result.problem) problem = result.problem | ||
| 95 | + else if (result.problems && result.problems.length > 0) refused = result.problems | ||
| 96 | + else agentAdded(name) | ||
| 97 | + } catch (caught) { | ||
| 98 | + error = caught instanceof Error ? caught.message : String(caught) | ||
| 99 | + } finally { | ||
| 100 | + busy = false | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + function another() { | ||
| 105 | + kind = null | ||
| 106 | + name = '' | ||
| 107 | + problem = '' | ||
| 108 | + step = 'kind' | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + function close() { | ||
| 112 | + appState.creator = '' | ||
| 113 | + } | ||
| 114 | +</script> | ||
| 115 | + | ||
| 116 | +<div class="creator"> | ||
| 117 | + <h1>{t('sbxCreator.title')}</h1> | ||
| 118 | + | ||
| 119 | + {#if step === 'kind'} | ||
| 120 | + <p class="intro">{t('sbxCreator.intro')}</p> | ||
| 121 | + <div class="kinds" role="group" aria-label={t('sbxCreator.choose')}> | ||
| 122 | + {#each kinds as choice (choice.id)} | ||
| 123 | + <button type="button" class="kind" onclick={() => choose(choice)}> | ||
| 124 | + <span class="icon" aria-hidden="true">{choice.icon}</span> | ||
| 125 | + <span><strong>{choice.title}</strong><br /><small>{t(`sbxCreator.kind.${choice.id}` as MessageKey)}</small></span> | ||
| 126 | + </button> | ||
| 127 | + {/each} | ||
| 128 | + </div> | ||
| 129 | + <div class="actions"><button type="button" onclick={close}>{t('creator.cancel')}</button></div> | ||
| 130 | + {:else if step === 'checking'} | ||
| 131 | + <p class="status" role="status"><Spinner /> {t('sbxCreator.checking')}</p> | ||
| 132 | + {:else if step === 'failed'} | ||
| 133 | + <div class="problem" role="alert"> | ||
| 134 | + {#if sbxMissing(failure)}{t('sbxCreator.sbxMissing')}{:else}<ErrorText raw={failure} />{/if} | ||
| 135 | + </div> | ||
| 136 | + <div class="actions"> | ||
| 137 | + <button type="button" onclick={close}>{t('creator.cancel')}</button> | ||
| 138 | + <button type="button" onclick={another}>{t('sbxCreator.otherKind')}</button> | ||
| 139 | + <button type="button" class="primary" onclick={check}>{t('creator.retry')}</button> | ||
| 140 | + </div> | ||
| 141 | + {:else if step === 'key' && kind} | ||
| 142 | + <form class="panel" onsubmit={saveKey}> | ||
| 143 | + <h2>{kind.icon} {t('sbxCreator.key.title', { title: kind.title })}</h2> | ||
| 144 | + <p>{t('sbxCreator.key.explain', { title: kind.title, service: kind.service })}</p> | ||
| 145 | + <button type="button" class="link" onclick={() => kind && Browser.OpenURL(kind.keyUrl)}>{t('sbxCreator.key.get')}</button> | ||
| 146 | + <label> | ||
| 147 | + {t('sbxCreator.key.label')} | ||
| 148 | + <!-- svelte-ignore a11y_autofocus --> | ||
| 149 | + <input type="password" bind:value={key} autocomplete="off" spellcheck="false" autocapitalize="off" autofocus disabled={busy} /> | ||
| 150 | + </label> | ||
| 151 | + {#if keyError}<div class="problem" role="alert"><ErrorText raw={keyError} /></div>{/if} | ||
| 152 | + <div class="actions"> | ||
| 153 | + <button type="button" onclick={another} disabled={busy}>{t('sbxCreator.otherKind')}</button> | ||
| 154 | + <span class="grow"></span> | ||
| 155 | + <button type="button" onclick={() => (step = 'details')} disabled={busy}>{t('sbxCreator.key.later')}</button> | ||
| 156 | + <button type="submit" class="primary" disabled={busy || !key.trim()}>{#if busy}<Spinner /> {t('sbxCreator.key.saving')}{:else}{t('sbxCreator.key.save')}{/if}</button> | ||
| 157 | + </div> | ||
| 158 | + </form> | ||
| 159 | + {:else if step === 'details' && kind} | ||
| 160 | + <form class="questions" onsubmit={create} novalidate> | ||
| 161 | + {#if hasKey} | ||
| 162 | + <p class="ok">{t('sbxCreator.key.stored', { title: kind.title })} <button type="button" class="link" onclick={() => (step = 'key')}>{t('sbxCreator.key.replace')}</button></p> | ||
| 163 | + {:else} | ||
| 164 | + <p class="warning" role="alert">{t('sbxCreator.key.missing', { title: kind.title, service: kind.service })}</p> | ||
| 165 | + {/if} | ||
| 166 | + <fieldset disabled={busy}> | ||
| 167 | + <div class="row"> | ||
| 168 | + <span class="preview"><AgentAvatar {icon} title={title || name} {name} size={34} /></span> | ||
| 169 | + <label class="grow"> | ||
| 170 | + {t('sbxCreator.agentTitle')} | ||
| 171 | + <input bind:value={title} /> | ||
| 172 | + </label> | ||
| 173 | + </div> | ||
| 174 | + <label> | ||
| 175 | + {t('sbxCreator.name')} | ||
| 176 | + <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> | ||
| 177 | + </label> | ||
| 178 | + <small id="sbx-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | ||
| 179 | + {problem ? t(problemKey(problem)) : t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | ||
| 180 | + </small> | ||
| 181 | + <div class="group" aria-label={t('creator.icon')}> | ||
| 182 | + <span class="label">{t('creator.icon')}</span> | ||
| 183 | + <div class="icons"> | ||
| 184 | + {#each icons as choice (choice)} | ||
| 185 | + <button type="button" class="icon-choice" class:chosen={icon === choice} onclick={() => (icon = choice)} aria-label={choice} aria-pressed={icon === choice}>{choice}</button> | ||
| 186 | + {/each} | ||
| 187 | + <input class="custom" bind:value={icon} maxlength="8" aria-label={t('creator.icon')} /> | ||
| 188 | + </div> | ||
| 189 | + </div> | ||
| 190 | + </fieldset> | ||
| 191 | + <small>{t('sbxCreator.firstStart')}</small> | ||
| 192 | + {#if refused.length > 0} | ||
| 193 | + <div class="problem" role="alert"> | ||
| 194 | + <strong>{t('creator.refused')}</strong> | ||
| 195 | + <ul>{#each refused as reason, index (index)}<li>{reason}</li>{/each}</ul> | ||
| 196 | + </div> | ||
| 197 | + {/if} | ||
| 198 | + {#if error}<div class="problem" role="alert"><ErrorText raw={error} /></div>{/if} | ||
| 199 | + <div class="actions"> | ||
| 200 | + <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button> | ||
| 201 | + <button type="button" onclick={another} disabled={busy}>{t('sbxCreator.otherKind')}</button> | ||
| 202 | + <span class="grow"></span> | ||
| 203 | + <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {t('sbxCreator.creating')}{:else}{t('sbxCreator.create')}{/if}</button> | ||
| 204 | + </div> | ||
| 205 | + </form> | ||
| 206 | + {/if} | ||
| 207 | +</div> | ||
| 208 | + | ||
| 209 | +<style> | ||
| 210 | + .creator { max-width: 620px; width: 100%; margin: 0 auto; padding: 24px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; } | ||
| 211 | + h1 { font-size: 20px; margin: 0; } | ||
| 212 | + h2 { font-size: 16px; margin: 0; } | ||
| 213 | + .intro, .status { color: var(--muted); margin: 0; } | ||
| 214 | + .status { display: flex; align-items: center; gap: 8px; } | ||
| 215 | + .kinds { display: flex; flex-direction: column; gap: 8px; } | ||
| 216 | + .kind { display: flex; align-items: center; gap: 14px; text-align: left; padding: 12px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); } | ||
| 217 | + .kind:hover { border-color: var(--accent); } | ||
| 218 | + .kind .icon { font-size: 28px; } | ||
| 219 | + .kind small { color: var(--muted); } | ||
| 220 | + .panel, .questions { display: flex; flex-direction: column; gap: 12px; } | ||
| 221 | + .panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--panel); } | ||
| 222 | + .panel p { margin: 0; } | ||
| 223 | + fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); margin: 0; } | ||
| 224 | + label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; } | ||
| 225 | + .label { font-size: 13px; } | ||
| 226 | + input { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); } | ||
| 227 | + input[aria-invalid='true'] { border-color: var(--danger); } | ||
| 228 | + small { color: var(--muted); font-size: 12px; } | ||
| 229 | + .problem-text { color: var(--danger); } | ||
| 230 | + .icons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; } | ||
| 231 | + .icon-choice { font-size: 20px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); } | ||
| 232 | + .icon-choice.chosen { border-color: var(--accent); } | ||
| 233 | + .custom { width: 64px; text-align: center; } | ||
| 234 | + .row { display: flex; gap: 10px; align-items: flex-end; } | ||
| 235 | + .preview { display: flex; align-items: center; justify-content: center; width: 38px; height: 34px; } | ||
| 236 | + .grow { flex: 1; min-width: 0; } | ||
| 237 | + .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; } | ||
| 238 | + .link { border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; align-self: flex-start; } | ||
| 239 | + .ok { margin: 0; color: var(--ok, var(--text)); } | ||
| 240 | + .warning { margin: 0; border: 1px solid var(--warn); border-radius: var(--radius); color: var(--warn); padding: 8px 12px; font-size: 13px; } | ||
| 241 | + .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; } | ||
| 242 | + .problem ul { margin: 4px 0 0; padding-left: 18px; } | ||
| 243 | + .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | ||
| 244 | +</style> | ||
modified
frontend/src/lib/agentform.test.ts +7 -0 | @@ -182,6 +182,13 @@ describe('mini-me in a sandbox', () => { | ||
| 182 | 182 | }) |
| 183 | 183 | }) |
| 184 | 184 | |
| 185 | +describe('Gemini through Antigravity in a sandbox (issue #96)', () => { | |
| 186 | + it('chooses agy acp for the sbx agent antigravity', () => { | |
| 187 | + expect(programOfSandbox('antigravity')).toEqual({ program: 'agy', arguments: 'acp' }) | |
| 188 | + expect(withSbxProgram(emptyForm(), 'antigravity')).toMatchObject({ program: 'agy', arguments: 'acp' }) | |
| 189 | + }) | |
| 190 | +}) | |
| 191 | + | |
| 185 | 192 | describe('Docker Agent in a sandbox (issue #87)', () => { |
| 186 | 193 | it('chooses docker-agent for the sbx agent docker-agent, or cagent', () => { |
| 187 | 194 | expect(programOfSandbox('docker-agent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) |
| @@ -182,6 +182,13 @@ describe('mini-me in a sandbox', () => { | |||
| 182 | }) | 182 | }) |
| 183 | }) | 183 | }) |
| 184 | 184 | ||
| 185 | +describe('Gemini through Antigravity in a sandbox (issue #96)', () => { | ||
| 186 | + it('chooses agy acp for the sbx agent antigravity', () => { | ||
| 187 | + expect(programOfSandbox('antigravity')).toEqual({ program: 'agy', arguments: 'acp' }) | ||
| 188 | + expect(withSbxProgram(emptyForm(), 'antigravity')).toMatchObject({ program: 'agy', arguments: 'acp' }) | ||
| 189 | + }) | ||
| 190 | +}) | ||
| 191 | + | ||
| 185 | describe('Docker Agent in a sandbox (issue #87)', () => { | 192 | describe('Docker Agent in a sandbox (issue #87)', () => { |
| 186 | it('chooses docker-agent for the sbx agent docker-agent, or cagent', () => { | 193 | it('chooses docker-agent for the sbx agent docker-agent, or cagent', () => { |
| 187 | expect(programOfSandbox('docker-agent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) | 194 | expect(programOfSandbox('docker-agent')).toEqual({ program: 'docker-agent', arguments: 'serve acp' }) |
modified
frontend/src/lib/agentform.ts +5 -2 | @@ -159,7 +159,8 @@ export function programsFor(environment: Environment): string[] { | ||
| 159 | 159 | * The program and arguments of the agent a sandbox file names ("agent:"): |
| 160 | 160 | * Claude, Codex or Gemini (sbxPrograms), mini-me (mm, from a kit such as |
| 161 | 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). | |
| 162 | + * Docker Agent (docker-agent, an sbx agent of its own, also called cagent), | |
| 163 | + * or Google Antigravity (agy acp, the kit that replaces Gemini's, issue #96). | |
| 163 | 164 | * mm and docker-agent also need their configuration file: dropping it |
| 164 | 165 | * adds it to the arguments (argumentsFor). |
| 165 | 166 | * |
| @@ -167,12 +168,14 @@ export function programsFor(environment: Environment): string[] { | ||
| 167 | 168 | * programOfSandbox('gemini') // { program: 'gemini', arguments: '--acp' } |
| 168 | 169 | * programOfSandbox('mini-me-kit') // { program: 'mm', arguments: '--acp' } |
| 169 | 170 | * programOfSandbox('docker-agent') // { program: 'docker-agent', arguments: 'serve acp' } |
| 171 | + * programOfSandbox('antigravity') // { program: 'agy', arguments: 'acp' } | |
| 170 | 172 | */ |
| 171 | 173 | export function programOfSandbox(agent: string | undefined): { program: string; arguments: string } | undefined { |
| 172 | 174 | const known = (agent ?? '').trim() |
| 173 | 175 | if (Object.hasOwn(sbxPrograms, known)) return { program: sbxPrograms[known as SbxAgent], arguments: sbxArguments[known as SbxAgent] } |
| 174 | 176 | if (/^mini-?me\b/.test(known)) return { program: 'mm', arguments: '--acp' } |
| 175 | 177 | if (known === 'docker-agent' || known === 'cagent') return { program: 'docker-agent', arguments: 'serve acp' } |
| 178 | + if (known === 'antigravity') return { program: 'agy', arguments: 'acp' } | |
| 176 | 179 | return undefined |
| 177 | 180 | } |
| 178 | 181 | |
| @@ -191,7 +194,7 @@ export function withSbxProgram(form: AgentFormValues, agent: string | undefined) | ||
| 191 | 194 | if (!wanted) return form |
| 192 | 195 | const program = form.program.trim() |
| 193 | 196 | if (program === wanted.program) return form |
| 194 | - const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram] as string[] | |
| 197 | + const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram, 'agy'] as string[] | |
| 195 | 198 | if (program && !offered.includes(program)) return form |
| 196 | 199 | return { ...form, program: wanted.program, arguments: wanted.arguments } |
| 197 | 200 | } |
| @@ -159,7 +159,8 @@ export function programsFor(environment: Environment): string[] { | |||
| 159 | * The program and arguments of the agent a sandbox file names ("agent:"): | 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 | 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 | 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). | 162 | + * Docker Agent (docker-agent, an sbx agent of its own, also called cagent), |
| 163 | + * or Google Antigravity (agy acp, the kit that replaces Gemini's, issue #96). | ||
| 163 | * mm and docker-agent also need their configuration file: dropping it | 164 | * mm and docker-agent also need their configuration file: dropping it |
| 164 | * adds it to the arguments (argumentsFor). | 165 | * adds it to the arguments (argumentsFor). |
| 165 | * | 166 | * |
| @@ -167,12 +168,14 @@ export function programsFor(environment: Environment): string[] { | |||
| 167 | * programOfSandbox('gemini') // { program: 'gemini', arguments: '--acp' } | 168 | * programOfSandbox('gemini') // { program: 'gemini', arguments: '--acp' } |
| 168 | * programOfSandbox('mini-me-kit') // { program: 'mm', arguments: '--acp' } | 169 | * programOfSandbox('mini-me-kit') // { program: 'mm', arguments: '--acp' } |
| 169 | * programOfSandbox('docker-agent') // { program: 'docker-agent', arguments: 'serve acp' } | 170 | * programOfSandbox('docker-agent') // { program: 'docker-agent', arguments: 'serve acp' } |
| 171 | + * programOfSandbox('antigravity') // { program: 'agy', arguments: 'acp' } | ||
| 170 | */ | 172 | */ |
| 171 | export function programOfSandbox(agent: string | undefined): { program: string; arguments: string } | undefined { | 173 | export function programOfSandbox(agent: string | undefined): { program: string; arguments: string } | undefined { |
| 172 | const known = (agent ?? '').trim() | 174 | const known = (agent ?? '').trim() |
| 173 | if (Object.hasOwn(sbxPrograms, known)) return { program: sbxPrograms[known as SbxAgent], arguments: sbxArguments[known as SbxAgent] } | 175 | 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' } | 176 | 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' } | 177 | if (known === 'docker-agent' || known === 'cagent') return { program: 'docker-agent', arguments: 'serve acp' } |
| 178 | + if (known === 'antigravity') return { program: 'agy', arguments: 'acp' } | ||
| 176 | return undefined | 179 | return undefined |
| 177 | } | 180 | } |
| 178 | 181 | ||
| @@ -191,7 +194,7 @@ export function withSbxProgram(form: AgentFormValues, agent: string | undefined) | |||
| 191 | if (!wanted) return form | 194 | if (!wanted) return form |
| 192 | const program = form.program.trim() | 195 | const program = form.program.trim() |
| 193 | if (program === wanted.program) return form | 196 | if (program === wanted.program) return form |
| 194 | - const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram] as string[] | 197 | + const offered = [...knownPrograms, ...Object.values(sbxPrograms), legacyCodexProgram, 'agy'] as string[] |
| 195 | if (program && !offered.includes(program)) return form | 198 | if (program && !offered.includes(program)) return form |
| 196 | return { ...form, program: wanted.program, arguments: wanted.arguments } | 199 | return { ...form, program: wanted.program, arguments: wanted.arguments } |
| 197 | } | 200 | } |
modified
frontend/src/lib/creator.test.ts +14 -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 { agentFolder, contentOf, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | |
| 4 | +import { agentFolder, contentOf, sbxMissing, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | |
| 5 | 5 | |
| 6 | 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { |
| 7 | 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } |
| @@ -83,11 +83,24 @@ describe('names and folders', () => { | ||
| 83 | 83 | }) |
| 84 | 84 | }) |
| 85 | 85 | |
| 86 | +describe('the sbx assistant (issue #96)', () => { | |
| 87 | + it('accepts sandbox names: no underscore', () => { | |
| 88 | + expect(validSbxName('claude-2')).toBe(true) | |
| 89 | + expect(validSbxName('my_agent')).toBe(false) | |
| 90 | + expect(validSbxName('Claude')).toBe(false) | |
| 91 | + }) | |
| 92 | + it('recognises a missing sbx', () => { | |
| 93 | + expect(sbxMissing('sbx is not installed')).toBe(true) | |
| 94 | + expect(sbxMissing('sbx ls: exit status 1')).toBe(false) | |
| 95 | + }) | |
| 96 | +}) | |
| 97 | + | |
| 86 | 98 | describe('problems', () => { |
| 87 | 99 | it('explains the problems of Finish', () => { |
| 88 | 100 | expect(problemKey('nameTaken')).toBe('creator.problem.nameTaken') |
| 89 | 101 | expect(problemKey('folderExists')).toBe('creator.problem.folderExists') |
| 90 | 102 | expect(problemKey('invalidName')).toBe('creator.problem.invalidName') |
| 103 | + expect(problemKey('sandboxExists')).toBe('creator.problem.sandboxExists') | |
| 91 | 104 | }) |
| 92 | 105 | it('recognises a missing or old mm', () => { |
| 93 | 106 | expect(startProblem('mini-me (mm) is not installed')).toEqual({ key: 'creator.mmMissing', found: '' }) |
| @@ -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 { agentFolder, contentOf, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | 4 | +import { agentFolder, contentOf, sbxMissing, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' |
| 5 | 5 | ||
| 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { | 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { |
| 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } | 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } |
| @@ -83,11 +83,24 @@ describe('names and folders', () => { | |||
| 83 | }) | 83 | }) |
| 84 | }) | 84 | }) |
| 85 | 85 | ||
| 86 | +describe('the sbx assistant (issue #96)', () => { | ||
| 87 | + it('accepts sandbox names: no underscore', () => { | ||
| 88 | + expect(validSbxName('claude-2')).toBe(true) | ||
| 89 | + expect(validSbxName('my_agent')).toBe(false) | ||
| 90 | + expect(validSbxName('Claude')).toBe(false) | ||
| 91 | + }) | ||
| 92 | + it('recognises a missing sbx', () => { | ||
| 93 | + expect(sbxMissing('sbx is not installed')).toBe(true) | ||
| 94 | + expect(sbxMissing('sbx ls: exit status 1')).toBe(false) | ||
| 95 | + }) | ||
| 96 | +}) | ||
| 97 | + | ||
| 86 | describe('problems', () => { | 98 | describe('problems', () => { |
| 87 | it('explains the problems of Finish', () => { | 99 | it('explains the problems of Finish', () => { |
| 88 | expect(problemKey('nameTaken')).toBe('creator.problem.nameTaken') | 100 | expect(problemKey('nameTaken')).toBe('creator.problem.nameTaken') |
| 89 | expect(problemKey('folderExists')).toBe('creator.problem.folderExists') | 101 | expect(problemKey('folderExists')).toBe('creator.problem.folderExists') |
| 90 | expect(problemKey('invalidName')).toBe('creator.problem.invalidName') | 102 | expect(problemKey('invalidName')).toBe('creator.problem.invalidName') |
| 103 | + expect(problemKey('sandboxExists')).toBe('creator.problem.sandboxExists') | ||
| 91 | }) | 104 | }) |
| 92 | it('recognises a missing or old mm', () => { | 105 | it('recognises a missing or old mm', () => { |
| 93 | expect(startProblem('mini-me (mm) is not installed')).toEqual({ key: 'creator.mmMissing', found: '' }) | 106 | expect(startProblem('mini-me (mm) is not installed')).toEqual({ key: 'creator.mmMissing', found: '' }) |
modified
frontend/src/lib/creator.ts +15 -0 | @@ -111,6 +111,14 @@ export function splitMessages(messages: string[] | null | undefined): { warnings | ||
| 111 | 111 | return { warnings, details } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | +/** | |
| 115 | + * A name for an agent in a Docker Sandbox (issue #96): also its folder's and | |
| 116 | + * its sandbox's, which takes letters, digits and hyphens only (no "_"). | |
| 117 | + */ | |
| 118 | +export function validSbxName(name: string): boolean { | |
| 119 | + return /^[a-z][a-z0-9-]{0,31}$/.test(name) | |
| 120 | +} | |
| 121 | + | |
| 114 | 122 | /** An agent name Sidekicks accepts, which is also its folder's name. */ |
| 115 | 123 | export function validName(name: string): boolean { |
| 116 | 124 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) |
| @@ -135,11 +143,18 @@ export function problemKey(problem: string): MessageKey { | ||
| 135 | 143 | return 'creator.problem.nameTaken' |
| 136 | 144 | case 'folderExists': |
| 137 | 145 | return 'creator.problem.folderExists' |
| 146 | + case 'sandboxExists': | |
| 147 | + return 'creator.problem.sandboxExists' | |
| 138 | 148 | default: |
| 139 | 149 | return 'creator.problem.invalidName' |
| 140 | 150 | } |
| 141 | 151 | } |
| 142 | 152 | |
| 153 | +/** Whether an error of the sbx assistant says that sbx is not installed. */ | |
| 154 | +export function sbxMissing(raw: string): boolean { | |
| 155 | + return /sbx is not installed/.test(raw) | |
| 156 | +} | |
| 157 | + | |
| 143 | 158 | /** |
| 144 | 159 | * What a Start error means for the user: mm missing, too old, or another |
| 145 | 160 | * problem (shown with ErrorText). |
| @@ -111,6 +111,14 @@ export function splitMessages(messages: string[] | null | undefined): { warnings | |||
| 111 | return { warnings, details } | 111 | return { warnings, details } |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | +/** | ||
| 115 | + * A name for an agent in a Docker Sandbox (issue #96): also its folder's and | ||
| 116 | + * its sandbox's, which takes letters, digits and hyphens only (no "_"). | ||
| 117 | + */ | ||
| 118 | +export function validSbxName(name: string): boolean { | ||
| 119 | + return /^[a-z][a-z0-9-]{0,31}$/.test(name) | ||
| 120 | +} | ||
| 121 | + | ||
| 114 | /** An agent name Sidekicks accepts, which is also its folder's name. */ | 122 | /** An agent name Sidekicks accepts, which is also its folder's name. */ |
| 115 | export function validName(name: string): boolean { | 123 | export function validName(name: string): boolean { |
| 116 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) | 124 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) |
| @@ -135,11 +143,18 @@ export function problemKey(problem: string): MessageKey { | |||
| 135 | return 'creator.problem.nameTaken' | 143 | return 'creator.problem.nameTaken' |
| 136 | case 'folderExists': | 144 | case 'folderExists': |
| 137 | return 'creator.problem.folderExists' | 145 | return 'creator.problem.folderExists' |
| 146 | + case 'sandboxExists': | ||
| 147 | + return 'creator.problem.sandboxExists' | ||
| 138 | default: | 148 | default: |
| 139 | return 'creator.problem.invalidName' | 149 | return 'creator.problem.invalidName' |
| 140 | } | 150 | } |
| 141 | } | 151 | } |
| 142 | 152 | ||
| 153 | +/** Whether an error of the sbx assistant says that sbx is not installed. */ | ||
| 154 | +export function sbxMissing(raw: string): boolean { | ||
| 155 | + return /sbx is not installed/.test(raw) | ||
| 156 | +} | ||
| 157 | + | ||
| 143 | /** | 158 | /** |
| 144 | * What a Start error means for the user: mm missing, too old, or another | 159 | * What a Start error means for the user: mm missing, too old, or another |
| 145 | * problem (shown with ErrorText). | 160 | * problem (shown with ErrorText). |
modified
frontend/src/lib/i18n/messages.ts +58 -0 | @@ -324,6 +324,35 @@ export const en = { | ||
| 324 | 324 | 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.', |
| 325 | 325 | 'agents.add': '+ Add an agent', |
| 326 | 326 | 'agents.create': '✨ Create a mini-me agent', |
| 327 | + 'agents.createSbx': '✨ Create an agent in a sandbox', | |
| 328 | + 'welcome.createSbxFirst': '✨ Create a Claude, Gemini or Codex agent', | |
| 329 | + 'action.createSbxAgent': 'Create an agent in a sandbox (Claude, Gemini, Codex)', | |
| 330 | + 'creator.problem.sandboxExists': 'A sandbox with this name already exists: choose another name.', | |
| 331 | + 'sbxCreator.title': 'Create an agent in a sandbox', | |
| 332 | + 'sbxCreator.intro': 'Choose the agent: it runs in a Docker Sandbox, isolated from your computer. Sidekicks prepares everything.', | |
| 333 | + 'sbxCreator.choose': 'Which agent?', | |
| 334 | + 'sbxCreator.kind.claude': "Anthropic's Claude Code", | |
| 335 | + 'sbxCreator.kind.gemini': 'Google Gemini, through Antigravity', | |
| 336 | + 'sbxCreator.kind.codex': "OpenAI's Codex", | |
| 337 | + 'sbxCreator.checking': 'Checking sbx and your key…', | |
| 338 | + 'sbxCreator.sbxMissing': 'sbx (Docker Sandboxes) is not installed on this computer. Install it, then try again.', | |
| 339 | + 'sbxCreator.otherKind': '← Another agent', | |
| 340 | + 'sbxCreator.key.title': 'Your {title} key', | |
| 341 | + 'sbxCreator.key.explain': '{title} needs an API key ({service}). Sidekicks gives it to sbx, which stores it and gives it to your sandboxes only for their calls to {title}: it is never written in a file.', | |
| 342 | + 'sbxCreator.key.get': 'Get a key…', | |
| 343 | + 'sbxCreator.key.label': 'API key', | |
| 344 | + 'sbxCreator.key.save': 'Save the key', | |
| 345 | + 'sbxCreator.key.saving': 'Saving…', | |
| 346 | + 'sbxCreator.key.later': 'Later', | |
| 347 | + 'sbxCreator.key.stored': '✓ Your {title} key is stored in sbx.', | |
| 348 | + 'sbxCreator.key.missing': 'No {title} key in sbx yet: the agent will not be able to answer until you save one (run this assistant again, or sbx secret set {service}).', | |
| 349 | + 'sbxCreator.key.replace': 'Replace the key', | |
| 350 | + 'sbxCreator.name': 'Name', | |
| 351 | + 'sbxCreator.nameHint': 'Used to call it with @{name}, and as the name of its folder and its sandbox: {folder}', | |
| 352 | + 'sbxCreator.agentTitle': 'Name shown', | |
| 353 | + 'sbxCreator.create': 'Add the agent', | |
| 354 | + 'sbxCreator.creating': 'Adding…', | |
| 355 | + 'sbxCreator.firstStart': 'Its sandbox is created the first time you write to it: that first answer takes a while.', | |
| 327 | 356 | 'welcome.createFirst': '✨ Create my first agent', |
| 328 | 357 | 'action.createAgent': 'Create a mini-me agent', |
| 329 | 358 | 'creator.title': 'Create a mini-me agent', |
| @@ -760,6 +789,35 @@ export const fr: Record<MessageKey, string> = { | ||
| 760 | 789 | 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.', |
| 761 | 790 | 'agents.add': '+ Ajouter un agent', |
| 762 | 791 | 'agents.create': '✨ Créer un agent mini-me', |
| 792 | + 'agents.createSbx': '✨ Créer un agent dans une sandbox', | |
| 793 | + 'welcome.createSbxFirst': '✨ Créer un agent Claude, Gemini ou Codex', | |
| 794 | + 'action.createSbxAgent': 'Créer un agent dans une sandbox (Claude, Gemini, Codex)', | |
| 795 | + 'creator.problem.sandboxExists': 'Une sandbox porte déjà ce nom : choisissez un autre nom.', | |
| 796 | + 'sbxCreator.title': 'Créer un agent dans une sandbox', | |
| 797 | + 'sbxCreator.intro': "Choisissez l'agent : il tourne dans une Docker Sandbox, isolé de votre ordinateur. Sidekicks prépare tout.", | |
| 798 | + 'sbxCreator.choose': 'Quel agent ?', | |
| 799 | + 'sbxCreator.kind.claude': "Claude Code, d'Anthropic", | |
| 800 | + 'sbxCreator.kind.gemini': 'Gemini de Google, via Antigravity', | |
| 801 | + 'sbxCreator.kind.codex': "Codex, d'OpenAI", | |
| 802 | + 'sbxCreator.checking': 'Vérification de sbx et de votre clé…', | |
| 803 | + 'sbxCreator.sbxMissing': "sbx (Docker Sandboxes) n'est pas installé sur cet ordinateur. Installez-le, puis réessayez.", | |
| 804 | + 'sbxCreator.otherKind': '← Un autre agent', | |
| 805 | + 'sbxCreator.key.title': 'Votre clé {title}', | |
| 806 | + 'sbxCreator.key.explain': "{title} a besoin d'une clé d'API ({service}). Sidekicks la donne à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à {title} : elle n'est jamais écrite dans un fichier.", | |
| 807 | + 'sbxCreator.key.get': 'Obtenir une clé…', | |
| 808 | + 'sbxCreator.key.label': "Clé d'API", | |
| 809 | + 'sbxCreator.key.save': 'Enregistrer la clé', | |
| 810 | + 'sbxCreator.key.saving': 'Enregistrement…', | |
| 811 | + 'sbxCreator.key.later': 'Plus tard', | |
| 812 | + 'sbxCreator.key.stored': '✓ Votre clé {title} est enregistrée dans sbx.', | |
| 813 | + 'sbxCreator.key.missing': "Pas encore de clé {title} dans sbx : l'agent ne pourra pas répondre tant que vous n'en aurez pas enregistré une (relancez cet assistant, ou sbx secret set {service}).", | |
| 814 | + 'sbxCreator.key.replace': 'Remplacer la clé', | |
| 815 | + 'sbxCreator.name': 'Nom', | |
| 816 | + 'sbxCreator.nameHint': "Pour l'appeler avec @{name}, et comme nom de son dossier et de sa sandbox : {folder}", | |
| 817 | + 'sbxCreator.agentTitle': 'Nom affiché', | |
| 818 | + 'sbxCreator.create': "Ajouter l'agent", | |
| 819 | + 'sbxCreator.creating': 'Ajout…', | |
| 820 | + 'sbxCreator.firstStart': "Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment.", | |
| 763 | 821 | 'welcome.createFirst': '✨ Créer mon premier agent', |
| 764 | 822 | 'action.createAgent': 'Créer un agent mini-me', |
| 765 | 823 | 'creator.title': 'Créer un agent mini-me', |
| @@ -324,6 +324,35 @@ export const en = { | |||
| 324 | 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.', | 324 | 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.', |
| 325 | 'agents.add': '+ Add an agent', | 325 | 'agents.add': '+ Add an agent', |
| 326 | 'agents.create': '✨ Create a mini-me agent', | 326 | 'agents.create': '✨ Create a mini-me agent', |
| 327 | + 'agents.createSbx': '✨ Create an agent in a sandbox', | ||
| 328 | + 'welcome.createSbxFirst': '✨ Create a Claude, Gemini or Codex agent', | ||
| 329 | + 'action.createSbxAgent': 'Create an agent in a sandbox (Claude, Gemini, Codex)', | ||
| 330 | + 'creator.problem.sandboxExists': 'A sandbox with this name already exists: choose another name.', | ||
| 331 | + 'sbxCreator.title': 'Create an agent in a sandbox', | ||
| 332 | + 'sbxCreator.intro': 'Choose the agent: it runs in a Docker Sandbox, isolated from your computer. Sidekicks prepares everything.', | ||
| 333 | + 'sbxCreator.choose': 'Which agent?', | ||
| 334 | + 'sbxCreator.kind.claude': "Anthropic's Claude Code", | ||
| 335 | + 'sbxCreator.kind.gemini': 'Google Gemini, through Antigravity', | ||
| 336 | + 'sbxCreator.kind.codex': "OpenAI's Codex", | ||
| 337 | + 'sbxCreator.checking': 'Checking sbx and your key…', | ||
| 338 | + 'sbxCreator.sbxMissing': 'sbx (Docker Sandboxes) is not installed on this computer. Install it, then try again.', | ||
| 339 | + 'sbxCreator.otherKind': '← Another agent', | ||
| 340 | + 'sbxCreator.key.title': 'Your {title} key', | ||
| 341 | + 'sbxCreator.key.explain': '{title} needs an API key ({service}). Sidekicks gives it to sbx, which stores it and gives it to your sandboxes only for their calls to {title}: it is never written in a file.', | ||
| 342 | + 'sbxCreator.key.get': 'Get a key…', | ||
| 343 | + 'sbxCreator.key.label': 'API key', | ||
| 344 | + 'sbxCreator.key.save': 'Save the key', | ||
| 345 | + 'sbxCreator.key.saving': 'Saving…', | ||
| 346 | + 'sbxCreator.key.later': 'Later', | ||
| 347 | + 'sbxCreator.key.stored': '✓ Your {title} key is stored in sbx.', | ||
| 348 | + 'sbxCreator.key.missing': 'No {title} key in sbx yet: the agent will not be able to answer until you save one (run this assistant again, or sbx secret set {service}).', | ||
| 349 | + 'sbxCreator.key.replace': 'Replace the key', | ||
| 350 | + 'sbxCreator.name': 'Name', | ||
| 351 | + 'sbxCreator.nameHint': 'Used to call it with @{name}, and as the name of its folder and its sandbox: {folder}', | ||
| 352 | + 'sbxCreator.agentTitle': 'Name shown', | ||
| 353 | + 'sbxCreator.create': 'Add the agent', | ||
| 354 | + 'sbxCreator.creating': 'Adding…', | ||
| 355 | + 'sbxCreator.firstStart': 'Its sandbox is created the first time you write to it: that first answer takes a while.', | ||
| 327 | 'welcome.createFirst': '✨ Create my first agent', | 356 | 'welcome.createFirst': '✨ Create my first agent', |
| 328 | 'action.createAgent': 'Create a mini-me agent', | 357 | 'action.createAgent': 'Create a mini-me agent', |
| 329 | 'creator.title': 'Create a mini-me agent', | 358 | 'creator.title': 'Create a mini-me agent', |
| @@ -760,6 +789,35 @@ export const fr: Record<MessageKey, string> = { | |||
| 760 | 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.', | 789 | 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.', |
| 761 | 'agents.add': '+ Ajouter un agent', | 790 | 'agents.add': '+ Ajouter un agent', |
| 762 | 'agents.create': '✨ Créer un agent mini-me', | 791 | 'agents.create': '✨ Créer un agent mini-me', |
| 792 | + 'agents.createSbx': '✨ Créer un agent dans une sandbox', | ||
| 793 | + 'welcome.createSbxFirst': '✨ Créer un agent Claude, Gemini ou Codex', | ||
| 794 | + 'action.createSbxAgent': 'Créer un agent dans une sandbox (Claude, Gemini, Codex)', | ||
| 795 | + 'creator.problem.sandboxExists': 'Une sandbox porte déjà ce nom : choisissez un autre nom.', | ||
| 796 | + 'sbxCreator.title': 'Créer un agent dans une sandbox', | ||
| 797 | + 'sbxCreator.intro': "Choisissez l'agent : il tourne dans une Docker Sandbox, isolé de votre ordinateur. Sidekicks prépare tout.", | ||
| 798 | + 'sbxCreator.choose': 'Quel agent ?', | ||
| 799 | + 'sbxCreator.kind.claude': "Claude Code, d'Anthropic", | ||
| 800 | + 'sbxCreator.kind.gemini': 'Gemini de Google, via Antigravity', | ||
| 801 | + 'sbxCreator.kind.codex': "Codex, d'OpenAI", | ||
| 802 | + 'sbxCreator.checking': 'Vérification de sbx et de votre clé…', | ||
| 803 | + 'sbxCreator.sbxMissing': "sbx (Docker Sandboxes) n'est pas installé sur cet ordinateur. Installez-le, puis réessayez.", | ||
| 804 | + 'sbxCreator.otherKind': '← Un autre agent', | ||
| 805 | + 'sbxCreator.key.title': 'Votre clé {title}', | ||
| 806 | + 'sbxCreator.key.explain': "{title} a besoin d'une clé d'API ({service}). Sidekicks la donne à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à {title} : elle n'est jamais écrite dans un fichier.", | ||
| 807 | + 'sbxCreator.key.get': 'Obtenir une clé…', | ||
| 808 | + 'sbxCreator.key.label': "Clé d'API", | ||
| 809 | + 'sbxCreator.key.save': 'Enregistrer la clé', | ||
| 810 | + 'sbxCreator.key.saving': 'Enregistrement…', | ||
| 811 | + 'sbxCreator.key.later': 'Plus tard', | ||
| 812 | + 'sbxCreator.key.stored': '✓ Votre clé {title} est enregistrée dans sbx.', | ||
| 813 | + 'sbxCreator.key.missing': "Pas encore de clé {title} dans sbx : l'agent ne pourra pas répondre tant que vous n'en aurez pas enregistré une (relancez cet assistant, ou sbx secret set {service}).", | ||
| 814 | + 'sbxCreator.key.replace': 'Remplacer la clé', | ||
| 815 | + 'sbxCreator.name': 'Nom', | ||
| 816 | + 'sbxCreator.nameHint': "Pour l'appeler avec @{name}, et comme nom de son dossier et de sa sandbox : {folder}", | ||
| 817 | + 'sbxCreator.agentTitle': 'Nom affiché', | ||
| 818 | + 'sbxCreator.create': "Ajouter l'agent", | ||
| 819 | + 'sbxCreator.creating': 'Ajout…', | ||
| 820 | + 'sbxCreator.firstStart': "Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment.", | ||
| 763 | 'welcome.createFirst': '✨ Créer mon premier agent', | 821 | 'welcome.createFirst': '✨ Créer mon premier agent', |
| 764 | 'action.createAgent': 'Créer un agent mini-me', | 822 | 'action.createAgent': 'Créer un agent mini-me', |
| 765 | 'creator.title': 'Créer un agent mini-me', | 823 | 'creator.title': 'Créer un agent mini-me', |
modified
frontend/src/lib/layout/CommandPalette.svelte +2 -1 | @@ -6,7 +6,7 @@ | ||
| 6 | 6 | import { t } from '../i18n/index.svelte' |
| 7 | 7 | import { textIcon } from '../avatar' |
| 8 | 8 | import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts' |
| 9 | - import { act, appState, openCreator, openDirect, openWorkspace, selectChannel } from '../state.svelte' | |
| 9 | + import { act, appState, openCreator, openDirect, openSbxCreator, openWorkspace, selectChannel } from '../state.svelte' | |
| 10 | 10 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 11 | 11 | |
| 12 | 12 | let { run }: { run: (action: Action) => void } = $props() |
| @@ -32,6 +32,7 @@ | ||
| 32 | 32 | })), |
| 33 | 33 | ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })), |
| 34 | 34 | { id: 'action:createAgent', label: t('action.createAgent'), hint: '', run: openCreator }, |
| 35 | + { id: 'action:createSbxAgent', label: t('action.createSbxAgent'), hint: '', run: openSbxCreator }, | |
| 35 | 36 | { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) }, |
| 36 | 37 | ] |
| 37 | 38 | }) |
| @@ -6,7 +6,7 @@ | |||
| 6 | import { t } from '../i18n/index.svelte' | 6 | import { t } from '../i18n/index.svelte' |
| 7 | import { textIcon } from '../avatar' | 7 | import { textIcon } from '../avatar' |
| 8 | import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts' | 8 | import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts' |
| 9 | - import { act, appState, openCreator, openDirect, openWorkspace, selectChannel } from '../state.svelte' | 9 | + import { act, appState, openCreator, openDirect, openSbxCreator, openWorkspace, selectChannel } from '../state.svelte' |
| 10 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 10 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 11 | 11 | ||
| 12 | let { run }: { run: (action: Action) => void } = $props() | 12 | let { run }: { run: (action: Action) => void } = $props() |
| @@ -32,6 +32,7 @@ | |||
| 32 | })), | 32 | })), |
| 33 | ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })), | 33 | ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })), |
| 34 | { id: 'action:createAgent', label: t('action.createAgent'), hint: '', run: openCreator }, | 34 | { id: 'action:createAgent', label: t('action.createAgent'), hint: '', run: openCreator }, |
| 35 | + { id: 'action:createSbxAgent', label: t('action.createSbxAgent'), hint: '', run: openSbxCreator }, | ||
| 35 | { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) }, | 36 | { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) }, |
| 36 | ] | 37 | ] |
| 37 | }) | 38 | }) |
modified
frontend/src/lib/panels/AgentsPanel.svelte +2 -1 | @@ -6,7 +6,7 @@ | ||
| 6 | 6 | import ErrorText from '../chat/ErrorText.svelte' |
| 7 | 7 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 8 | 8 | import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 9 | - import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openWorkspace } from '../state.svelte' | |
| 9 | + import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openSbxCreator, openWorkspace } from '../state.svelte' | |
| 10 | 10 | import { directOf } from '../conversation' |
| 11 | 11 | import { canUnload, unloadReady } from '../unload' |
| 12 | 12 | |
| @@ -61,6 +61,7 @@ | ||
| 61 | 61 | </ul> |
| 62 | 62 | {/if} |
| 63 | 63 | <button class="add" onclick={openCreator}>{t('agents.create')}</button> |
| 64 | +<button class="add" onclick={openSbxCreator}>{t('agents.createSbx')}</button> | |
| 64 | 65 | <button class="add" onclick={openAssistant}>{t('agents.add')}</button> |
| 65 | 66 | <ActionError /> |
| 66 | 67 | |
| @@ -6,7 +6,7 @@ | |||
| 6 | import ErrorText from '../chat/ErrorText.svelte' | 6 | import ErrorText from '../chat/ErrorText.svelte' |
| 7 | import AgentAvatar from '../agent/AgentAvatar.svelte' | 7 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 8 | 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' |
| 9 | - import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openWorkspace } from '../state.svelte' | 9 | + import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openSbxCreator, openWorkspace } from '../state.svelte' |
| 10 | import { directOf } from '../conversation' | 10 | import { directOf } from '../conversation' |
| 11 | import { canUnload, unloadReady } from '../unload' | 11 | import { canUnload, unloadReady } from '../unload' |
| 12 | 12 | ||
| @@ -61,6 +61,7 @@ | |||
| 61 | </ul> | 61 | </ul> |
| 62 | {/if} | 62 | {/if} |
| 63 | <button class="add" onclick={openCreator}>{t('agents.create')}</button> | 63 | <button class="add" onclick={openCreator}>{t('agents.create')}</button> |
| 64 | +<button class="add" onclick={openSbxCreator}>{t('agents.createSbx')}</button> | ||
| 64 | <button class="add" onclick={openAssistant}>{t('agents.add')}</button> | 65 | <button class="add" onclick={openAssistant}>{t('agents.add')}</button> |
| 65 | <ActionError /> | 66 | <ActionError /> |
| 66 | 67 | ||
modified
frontend/src/lib/panels/ConversationPanel.svelte +6 -2 | @@ -12,13 +12,14 @@ | ||
| 12 | 12 | import { Pane, PaneGroup, PaneResizer } from 'paneforge' |
| 13 | 13 | import AddAgentForm from '../agent/AddAgentForm.svelte' |
| 14 | 14 | import CreateMiniMeAgent from '../agent/CreateMiniMeAgent.svelte' |
| 15 | + import CreateSbxAgent from '../agent/CreateSbxAgent.svelte' | |
| 15 | 16 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 16 | 17 | import { textIcon } from '../avatar' |
| 17 | 18 | import ActionError from '../chat/ActionError.svelte' |
| 18 | 19 | import Logo from '../layout/Logo.svelte' |
| 19 | 20 | import { drafts, isNearBottom, type Trigger } from '../composer' |
| 20 | 21 | import { notStreaming, usagePercent } from '../conversation' |
| 21 | - import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, prepareCommands, removeMember, send } from '../state.svelte' | |
| 22 | + import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, openSbxCreator, prepareCommands, removeMember, send } from '../state.svelte' | |
| 22 | 23 | import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 23 | 24 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 24 | 25 | import { FilesDropped } from '../../../bindings/events' |
| @@ -206,8 +207,10 @@ | ||
| 206 | 207 | <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div> |
| 207 | 208 | {/if} |
| 208 | 209 | |
| 209 | - {#if appState.creator} | |
| 210 | + {#if appState.creator === 'mini-me'} | |
| 210 | 211 | <CreateMiniMeAgent /> |
| 212 | + {:else if appState.creator === 'sbx'} | |
| 213 | + <CreateSbxAgent /> | |
| 211 | 214 | {:else if appState.assistant} |
| 212 | 215 | <AddAgentForm /> |
| 213 | 216 | {:else if appState.workspaceAgent} |
| @@ -346,6 +349,7 @@ | ||
| 346 | 349 | </ol> |
| 347 | 350 | <div class="buttons"> |
| 348 | 351 | <button class="primary" onclick={openCreator}>{t('welcome.createFirst')}</button> |
| 352 | + <button onclick={openSbxCreator}>{t('welcome.createSbxFirst')}</button> | |
| 349 | 353 | <button onclick={openAssistant}>{t('welcome.addFirst')}</button> |
| 350 | 354 | <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button> |
| 351 | 355 | </div> |
| @@ -12,13 +12,14 @@ | |||
| 12 | import { Pane, PaneGroup, PaneResizer } from 'paneforge' | 12 | import { Pane, PaneGroup, PaneResizer } from 'paneforge' |
| 13 | import AddAgentForm from '../agent/AddAgentForm.svelte' | 13 | import AddAgentForm from '../agent/AddAgentForm.svelte' |
| 14 | import CreateMiniMeAgent from '../agent/CreateMiniMeAgent.svelte' | 14 | import CreateMiniMeAgent from '../agent/CreateMiniMeAgent.svelte' |
| 15 | + import CreateSbxAgent from '../agent/CreateSbxAgent.svelte' | ||
| 15 | import AgentAvatar from '../agent/AgentAvatar.svelte' | 16 | import AgentAvatar from '../agent/AgentAvatar.svelte' |
| 16 | import { textIcon } from '../avatar' | 17 | import { textIcon } from '../avatar' |
| 17 | import ActionError from '../chat/ActionError.svelte' | 18 | import ActionError from '../chat/ActionError.svelte' |
| 18 | import Logo from '../layout/Logo.svelte' | 19 | import Logo from '../layout/Logo.svelte' |
| 19 | import { drafts, isNearBottom, type Trigger } from '../composer' | 20 | import { drafts, isNearBottom, type Trigger } from '../composer' |
| 20 | import { notStreaming, usagePercent } from '../conversation' | 21 | import { notStreaming, usagePercent } from '../conversation' |
| 21 | - import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, prepareCommands, removeMember, send } from '../state.svelte' | 22 | + import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, openSbxCreator, prepareCommands, removeMember, send } from '../state.svelte' |
| 22 | import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 23 | import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 23 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | 24 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 24 | import { FilesDropped } from '../../../bindings/events' | 25 | import { FilesDropped } from '../../../bindings/events' |
| @@ -206,8 +207,10 @@ | |||
| 206 | <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div> | 207 | <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div> |
| 207 | {/if} | 208 | {/if} |
| 208 | 209 | ||
| 209 | - {#if appState.creator} | 210 | + {#if appState.creator === 'mini-me'} |
| 210 | <CreateMiniMeAgent /> | 211 | <CreateMiniMeAgent /> |
| 212 | + {:else if appState.creator === 'sbx'} | ||
| 213 | + <CreateSbxAgent /> | ||
| 211 | {:else if appState.assistant} | 214 | {:else if appState.assistant} |
| 212 | <AddAgentForm /> | 215 | <AddAgentForm /> |
| 213 | {:else if appState.workspaceAgent} | 216 | {:else if appState.workspaceAgent} |
| @@ -346,6 +349,7 @@ | |||
| 346 | </ol> | 349 | </ol> |
| 347 | <div class="buttons"> | 350 | <div class="buttons"> |
| 348 | <button class="primary" onclick={openCreator}>{t('welcome.createFirst')}</button> | 351 | <button class="primary" onclick={openCreator}>{t('welcome.createFirst')}</button> |
| 352 | + <button onclick={openSbxCreator}>{t('welcome.createSbxFirst')}</button> | ||
| 349 | <button onclick={openAssistant}>{t('welcome.addFirst')}</button> | 353 | <button onclick={openAssistant}>{t('welcome.addFirst')}</button> |
| 350 | <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button> | 354 | <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button> |
| 351 | </div> | 355 | </div> |
modified
frontend/src/lib/state.svelte.ts +16 -7 | @@ -97,8 +97,8 @@ export const appState = $state({ | ||
| 97 | 97 | actionError: '', |
| 98 | 98 | /** The "add an agent" assistant is shown in the centre. */ |
| 99 | 99 | assistant: false, |
| 100 | - /** The assistant that creates a mini-me agent (issue #94) is shown in the centre. */ | |
| 101 | - creator: false, | |
| 100 | + /** The creation assistant shown in the centre: mini-me (issue #94), sbx (issue #96), or none. */ | |
| 101 | + creator: '' as '' | 'mini-me' | 'sbx', | |
| 102 | 102 | /** An agent just added with the assistant: its conversation opens once it is loaded. */ |
| 103 | 103 | pendingAgent: '', |
| 104 | 104 | /** The command palette (⌘K) is open. */ |
| @@ -178,7 +178,7 @@ export async function selectChannel(id: string) { | ||
| 178 | 178 | conversationOf(id) // shown empty until loaded |
| 179 | 179 | appState.workspaceAgent = '' |
| 180 | 180 | appState.assistant = false |
| 181 | - appState.creator = false | |
| 181 | + appState.creator = '' | |
| 182 | 182 | appState.selectedChannel = id |
| 183 | 183 | appState.unread[id] = 0 |
| 184 | 184 | const channel = channelOf(id) |
| @@ -212,7 +212,7 @@ export function closeLinkedFile(channel: string) { | ||
| 212 | 212 | /** Shows the workspace of agent (files, terminal, log) in the centre. */ |
| 213 | 213 | export function openWorkspace(agent: string, file = '') { |
| 214 | 214 | appState.assistant = false |
| 215 | - appState.creator = false | |
| 215 | + appState.creator = '' | |
| 216 | 216 | appState.workspaceAgent = agent |
| 217 | 217 | appState.workspaceFile = file |
| 218 | 218 | } |
| @@ -220,15 +220,24 @@ export function openWorkspace(agent: string, file = '') { | ||
| 220 | 220 | /** Shows the "add an agent" assistant in the centre. */ |
| 221 | 221 | export function openAssistant() { |
| 222 | 222 | appState.workspaceAgent = '' |
| 223 | - appState.creator = false | |
| 223 | + appState.creator = '' | |
| 224 | 224 | appState.assistant = true |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | /** Shows the assistant that creates a mini-me agent (issue #94) in the centre. */ |
| 228 | 228 | export function openCreator() { |
| 229 | + openCreation('mini-me') | |
| 230 | +} | |
| 231 | + | |
| 232 | +/** Shows the assistant that creates an agent in a Docker Sandbox (issue #96) in the centre. */ | |
| 233 | +export function openSbxCreator() { | |
| 234 | + openCreation('sbx') | |
| 235 | +} | |
| 236 | + | |
| 237 | +function openCreation(kind: 'mini-me' | 'sbx') { | |
| 229 | 238 | appState.workspaceAgent = '' |
| 230 | 239 | appState.assistant = false |
| 231 | - appState.creator = true | |
| 240 | + appState.creator = kind | |
| 232 | 241 | } |
| 233 | 242 | |
| 234 | 243 | /** |
| @@ -252,7 +261,7 @@ export async function historyReset() { | ||
| 252 | 261 | |
| 253 | 262 | export function agentAdded(name: string) { |
| 254 | 263 | appState.assistant = false |
| 255 | - appState.creator = false | |
| 264 | + appState.creator = '' | |
| 256 | 265 | appState.pendingAgent = name |
| 257 | 266 | if (appState.agents.some((agent) => agent.name === name)) void refreshAgents() |
| 258 | 267 | } |
| @@ -97,8 +97,8 @@ export const appState = $state({ | |||
| 97 | actionError: '', | 97 | actionError: '', |
| 98 | /** The "add an agent" assistant is shown in the centre. */ | 98 | /** The "add an agent" assistant is shown in the centre. */ |
| 99 | assistant: false, | 99 | assistant: false, |
| 100 | - /** The assistant that creates a mini-me agent (issue #94) is shown in the centre. */ | 100 | + /** The creation assistant shown in the centre: mini-me (issue #94), sbx (issue #96), or none. */ |
| 101 | - creator: false, | 101 | + creator: '' as '' | 'mini-me' | 'sbx', |
| 102 | /** An agent just added with the assistant: its conversation opens once it is loaded. */ | 102 | /** An agent just added with the assistant: its conversation opens once it is loaded. */ |
| 103 | pendingAgent: '', | 103 | pendingAgent: '', |
| 104 | /** The command palette (⌘K) is open. */ | 104 | /** The command palette (⌘K) is open. */ |
| @@ -178,7 +178,7 @@ export async function selectChannel(id: string) { | |||
| 178 | conversationOf(id) // shown empty until loaded | 178 | conversationOf(id) // shown empty until loaded |
| 179 | appState.workspaceAgent = '' | 179 | appState.workspaceAgent = '' |
| 180 | appState.assistant = false | 180 | appState.assistant = false |
| 181 | - appState.creator = false | 181 | + appState.creator = '' |
| 182 | appState.selectedChannel = id | 182 | appState.selectedChannel = id |
| 183 | appState.unread[id] = 0 | 183 | appState.unread[id] = 0 |
| 184 | const channel = channelOf(id) | 184 | const channel = channelOf(id) |
| @@ -212,7 +212,7 @@ export function closeLinkedFile(channel: string) { | |||
| 212 | /** Shows the workspace of agent (files, terminal, log) in the centre. */ | 212 | /** Shows the workspace of agent (files, terminal, log) in the centre. */ |
| 213 | export function openWorkspace(agent: string, file = '') { | 213 | export function openWorkspace(agent: string, file = '') { |
| 214 | appState.assistant = false | 214 | appState.assistant = false |
| 215 | - appState.creator = false | 215 | + appState.creator = '' |
| 216 | appState.workspaceAgent = agent | 216 | appState.workspaceAgent = agent |
| 217 | appState.workspaceFile = file | 217 | appState.workspaceFile = file |
| 218 | } | 218 | } |
| @@ -220,15 +220,24 @@ export function openWorkspace(agent: string, file = '') { | |||
| 220 | /** Shows the "add an agent" assistant in the centre. */ | 220 | /** Shows the "add an agent" assistant in the centre. */ |
| 221 | export function openAssistant() { | 221 | export function openAssistant() { |
| 222 | appState.workspaceAgent = '' | 222 | appState.workspaceAgent = '' |
| 223 | - appState.creator = false | 223 | + appState.creator = '' |
| 224 | appState.assistant = true | 224 | appState.assistant = true |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | /** Shows the assistant that creates a mini-me agent (issue #94) in the centre. */ | 227 | /** Shows the assistant that creates a mini-me agent (issue #94) in the centre. */ |
| 228 | export function openCreator() { | 228 | export function openCreator() { |
| 229 | + openCreation('mini-me') | ||
| 230 | +} | ||
| 231 | + | ||
| 232 | +/** Shows the assistant that creates an agent in a Docker Sandbox (issue #96) in the centre. */ | ||
| 233 | +export function openSbxCreator() { | ||
| 234 | + openCreation('sbx') | ||
| 235 | +} | ||
| 236 | + | ||
| 237 | +function openCreation(kind: 'mini-me' | 'sbx') { | ||
| 229 | appState.workspaceAgent = '' | 238 | appState.workspaceAgent = '' |
| 230 | appState.assistant = false | 239 | appState.assistant = false |
| 231 | - appState.creator = true | 240 | + appState.creator = kind |
| 232 | } | 241 | } |
| 233 | 242 | ||
| 234 | /** | 243 | /** |
| @@ -252,7 +261,7 @@ export async function historyReset() { | |||
| 252 | 261 | ||
| 253 | export function agentAdded(name: string) { | 262 | export function agentAdded(name: string) { |
| 254 | appState.assistant = false | 263 | appState.assistant = false |
| 255 | - appState.creator = false | 264 | + appState.creator = '' |
| 256 | appState.pendingAgent = name | 265 | appState.pendingAgent = name |
| 257 | if (appState.agents.some((agent) => agent.name === name)) void refreshAgents() | 266 | if (appState.agents.some((agent) => agent.name === name)) void refreshAgents() |
| 258 | } | 267 | } |
added
internal/app/sbxcreator.go +177 -0 | new file mode 100644 | ||
| @@ -0,0 +1,177 @@ | ||
| 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 | + "os" | |
| 10 | + "path/filepath" | |
| 11 | + "slices" | |
| 12 | + | |
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | |
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | |
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/workspace" | |
| 16 | +) | |
| 17 | + | |
| 18 | +// SbxCreatorService is the assistant that creates an agent in a Docker | |
| 19 | +// Sandbox — Claude, Gemini, Codex… — for people who do not write files | |
| 20 | +// (issue #96): it checks sbx and the kind's API key (asking for it and | |
| 21 | +// storing it with sbx when missing), writes the agent's folder in the | |
| 22 | +// agents' folder and adds the agent to the configuration. | |
| 23 | +// | |
| 24 | +// kinds := service.Kinds() | |
| 25 | +// check, err := service.Check(ctx, "claude") // check.HasKey, check.Name | |
| 26 | +// err = service.SetKey(ctx, "claude", "sk-ant-…") // when !check.HasKey | |
| 27 | +// result, err := service.Create(ctx, SbxCreateForm{Kind: "claude", Name: check.Name, Icon: "📙"}) | |
| 28 | +type SbxCreatorService struct { | |
| 29 | + Core *Core | |
| 30 | +} | |
| 31 | + | |
| 32 | +// CreatorSandboxExists is the problem Create reports when a sandbox already | |
| 33 | +// has the agent's name. | |
| 34 | +const CreatorSandboxExists = "sandboxExists" | |
| 35 | + | |
| 36 | +// SbxCheck is what the assistant needs once a kind is chosen: whether its | |
| 37 | +// key is stored in sbx, a free name to suggest, and where the folder goes. | |
| 38 | +type SbxCheck struct { | |
| 39 | + HasKey bool `json:"hasKey"` | |
| 40 | + Name string `json:"name"` | |
| 41 | + AgentsFolder string `json:"agentsFolder"` | |
| 42 | +} | |
| 43 | + | |
| 44 | +// SbxCreateForm is the agent to create: its kind, its name (its folder's and | |
| 45 | +// its sandbox's too), its title and its emoji. | |
| 46 | +type SbxCreateForm struct { | |
| 47 | + Kind string `json:"kind"` | |
| 48 | + Name string `json:"name"` | |
| 49 | + Title string `json:"title"` | |
| 50 | + Icon string `json:"icon"` | |
| 51 | +} | |
| 52 | + | |
| 53 | +func (c *Core) sbx() sbxcreate.Sbx { | |
| 54 | + if c.options.Sbx != "" { | |
| 55 | + return sbxcreate.Sbx{Command: c.options.Sbx} | |
| 56 | + } | |
| 57 | + return sbxcreate.Sbx{Command: workspace.SbxTool()} | |
| 58 | +} | |
| 59 | + | |
| 60 | +// Kinds is the kinds of agents the assistant creates, in order. | |
| 61 | +func (s *SbxCreatorService) Kinds() []sbxcreate.Kind { | |
| 62 | + return slices.Clone(sbxcreate.Catalogue) | |
| 63 | +} | |
| 64 | + | |
| 65 | +func kindOf(id string) (sbxcreate.Kind, error) { | |
| 66 | + kind, ok := sbxcreate.Lookup(id) | |
| 67 | + if !ok { | |
| 68 | + return sbxcreate.Kind{}, fmt.Errorf("unknown kind of agent %q", id) | |
| 69 | + } | |
| 70 | + return kind, nil | |
| 71 | +} | |
| 72 | + | |
| 73 | +// Check checks that sbx is installed ("sbx is not installed" otherwise), | |
| 74 | +// whether the kind's key is stored, and suggests a free name: the kind's | |
| 75 | +// id, else id-2, id-3… — free as an agent, a folder and a sandbox. | |
| 76 | +func (s *SbxCreatorService) Check(ctx context.Context, kindID string) (SbxCheck, error) { | |
| 77 | + kind, err := kindOf(kindID) | |
| 78 | + if err != nil { | |
| 79 | + return SbxCheck{}, err | |
| 80 | + } | |
| 81 | + sbx := s.Core.sbx() | |
| 82 | + if err := sbx.Available(); err != nil { | |
| 83 | + return SbxCheck{}, err | |
| 84 | + } | |
| 85 | + hasKey, err := sbx.HasSecret(ctx, kind.Service, "") | |
| 86 | + if err != nil { | |
| 87 | + return SbxCheck{}, err | |
| 88 | + } | |
| 89 | + sandboxes, err := sbx.Sandboxes(ctx) | |
| 90 | + if err != nil { | |
| 91 | + return SbxCheck{}, err | |
| 92 | + } | |
| 93 | + folder := s.Core.agentsFolder() | |
| 94 | + check := SbxCheck{HasKey: hasKey, AgentsFolder: folder} | |
| 95 | + for index := 1; index < 100; index++ { | |
| 96 | + name := kind.ID | |
| 97 | + if index > 1 { | |
| 98 | + name = fmt.Sprintf("%s-%d", kind.ID, index) | |
| 99 | + } | |
| 100 | + if s.problem(name, folder, sandboxes) == "" { | |
| 101 | + check.Name = name | |
| 102 | + break | |
| 103 | + } | |
| 104 | + } | |
| 105 | + return check, nil | |
| 106 | +} | |
| 107 | + | |
| 108 | +// SetKey stores the kind's key in sbx, for every sandbox. The key goes to | |
| 109 | +// sbx on its standard input; it is never written in a file nor in a log. | |
| 110 | +func (s *SbxCreatorService) SetKey(ctx context.Context, kindID, key string) error { | |
| 111 | + kind, err := kindOf(kindID) | |
| 112 | + if err != nil { | |
| 113 | + return err | |
| 114 | + } | |
| 115 | + return s.Core.sbx().SetSecret(ctx, kind.Service, key) | |
| 116 | +} | |
| 117 | + | |
| 118 | +// problem is why name cannot be used, or "". | |
| 119 | +func (s *SbxCreatorService) problem(name, folder string, sandboxes []string) string { | |
| 120 | + switch { | |
| 121 | + case !sbxcreate.ValidName(name): | |
| 122 | + return CreatorInvalidName | |
| 123 | + case s.Core.hasAgent(name): | |
| 124 | + return CreatorNameTaken | |
| 125 | + case slices.Contains(sandboxes, name): | |
| 126 | + return CreatorSandboxExists | |
| 127 | + } | |
| 128 | + if _, err := os.Lstat(filepath.Join(folder, name)); err == nil { | |
| 129 | + return CreatorFolderExists | |
| 130 | + } | |
| 131 | + return "" | |
| 132 | +} | |
| 133 | + | |
| 134 | +// Create writes the agent's folder — <agentsFolder>/<name>, with its | |
| 135 | +// sbxenv.yaml and workspace/ — and adds the agent: `sbx exec -i <name> | |
| 136 | +// <program>`, its sandbox created at its first start. A name already used | |
| 137 | +// (agent, folder or sandbox) is a Problem: nothing is written. | |
| 138 | +func (s *SbxCreatorService) Create(ctx context.Context, form SbxCreateForm) (CreatorResult, error) { | |
| 139 | + kind, err := kindOf(form.Kind) | |
| 140 | + if err != nil { | |
| 141 | + return CreatorResult{}, err | |
| 142 | + } | |
| 143 | + sandboxes, err := s.Core.sbx().Sandboxes(ctx) | |
| 144 | + if err != nil { | |
| 145 | + return CreatorResult{}, err | |
| 146 | + } | |
| 147 | + folder := s.Core.agentsFolder() | |
| 148 | + if problem := s.problem(form.Name, folder, sandboxes); problem != "" { | |
| 149 | + return CreatorResult{Problem: problem}, nil | |
| 150 | + } | |
| 151 | + dir, err := sbxcreate.Write(folder, kind, form.Name) | |
| 152 | + if errors.Is(err, sbxcreate.ErrFolderExists) { | |
| 153 | + return CreatorResult{Problem: CreatorFolderExists}, nil | |
| 154 | + } | |
| 155 | + if err != nil { | |
| 156 | + return CreatorResult{}, err | |
| 157 | + } | |
| 158 | + env, err := lifecycle.ReadSbxEnv(filepath.Join(dir, sbxcreate.SbxEnvFile)) | |
| 159 | + if err != nil { | |
| 160 | + return CreatorResult{}, err | |
| 161 | + } | |
| 162 | + title := form.Title | |
| 163 | + if title == "" { | |
| 164 | + title = kind.Title | |
| 165 | + } | |
| 166 | + problems, err := (&ConfigService{Core: s.Core}).AddAgent(AgentForm{ | |
| 167 | + Name: form.Name, Title: title, Icon: form.Icon, Environment: EnvironmentSandbox, Box: env.Name, | |
| 168 | + Program: kind.Program, Workspace: env.Workspace, SandboxFolder: env.Folder, | |
| 169 | + CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), | |
| 170 | + }) | |
| 171 | + if err != nil || len(problems) > 0 { | |
| 172 | + // The configuration refused it: the folder goes, the name stays free. | |
| 173 | + _ = os.RemoveAll(dir) | |
| 174 | + return CreatorResult{Problems: problems}, err | |
| 175 | + } | |
| 176 | + return CreatorResult{Problems: []string{}, Name: form.Name, Folder: dir}, nil | |
| 177 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,177 @@ | |||
| 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 | + "os" | ||
| 10 | + "path/filepath" | ||
| 11 | + "slices" | ||
| 12 | + | ||
| 13 | + "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | ||
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | ||
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/workspace" | ||
| 16 | +) | ||
| 17 | + | ||
| 18 | +// SbxCreatorService is the assistant that creates an agent in a Docker | ||
| 19 | +// Sandbox — Claude, Gemini, Codex… — for people who do not write files | ||
| 20 | +// (issue #96): it checks sbx and the kind's API key (asking for it and | ||
| 21 | +// storing it with sbx when missing), writes the agent's folder in the | ||
| 22 | +// agents' folder and adds the agent to the configuration. | ||
| 23 | +// | ||
| 24 | +// kinds := service.Kinds() | ||
| 25 | +// check, err := service.Check(ctx, "claude") // check.HasKey, check.Name | ||
| 26 | +// err = service.SetKey(ctx, "claude", "sk-ant-…") // when !check.HasKey | ||
| 27 | +// result, err := service.Create(ctx, SbxCreateForm{Kind: "claude", Name: check.Name, Icon: "📙"}) | ||
| 28 | +type SbxCreatorService struct { | ||
| 29 | + Core *Core | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +// CreatorSandboxExists is the problem Create reports when a sandbox already | ||
| 33 | +// has the agent's name. | ||
| 34 | +const CreatorSandboxExists = "sandboxExists" | ||
| 35 | + | ||
| 36 | +// SbxCheck is what the assistant needs once a kind is chosen: whether its | ||
| 37 | +// key is stored in sbx, a free name to suggest, and where the folder goes. | ||
| 38 | +type SbxCheck struct { | ||
| 39 | + HasKey bool `json:"hasKey"` | ||
| 40 | + Name string `json:"name"` | ||
| 41 | + AgentsFolder string `json:"agentsFolder"` | ||
| 42 | +} | ||
| 43 | + | ||
| 44 | +// SbxCreateForm is the agent to create: its kind, its name (its folder's and | ||
| 45 | +// its sandbox's too), its title and its emoji. | ||
| 46 | +type SbxCreateForm struct { | ||
| 47 | + Kind string `json:"kind"` | ||
| 48 | + Name string `json:"name"` | ||
| 49 | + Title string `json:"title"` | ||
| 50 | + Icon string `json:"icon"` | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +func (c *Core) sbx() sbxcreate.Sbx { | ||
| 54 | + if c.options.Sbx != "" { | ||
| 55 | + return sbxcreate.Sbx{Command: c.options.Sbx} | ||
| 56 | + } | ||
| 57 | + return sbxcreate.Sbx{Command: workspace.SbxTool()} | ||
| 58 | +} | ||
| 59 | + | ||
| 60 | +// Kinds is the kinds of agents the assistant creates, in order. | ||
| 61 | +func (s *SbxCreatorService) Kinds() []sbxcreate.Kind { | ||
| 62 | + return slices.Clone(sbxcreate.Catalogue) | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +func kindOf(id string) (sbxcreate.Kind, error) { | ||
| 66 | + kind, ok := sbxcreate.Lookup(id) | ||
| 67 | + if !ok { | ||
| 68 | + return sbxcreate.Kind{}, fmt.Errorf("unknown kind of agent %q", id) | ||
| 69 | + } | ||
| 70 | + return kind, nil | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +// Check checks that sbx is installed ("sbx is not installed" otherwise), | ||
| 74 | +// whether the kind's key is stored, and suggests a free name: the kind's | ||
| 75 | +// id, else id-2, id-3… — free as an agent, a folder and a sandbox. | ||
| 76 | +func (s *SbxCreatorService) Check(ctx context.Context, kindID string) (SbxCheck, error) { | ||
| 77 | + kind, err := kindOf(kindID) | ||
| 78 | + if err != nil { | ||
| 79 | + return SbxCheck{}, err | ||
| 80 | + } | ||
| 81 | + sbx := s.Core.sbx() | ||
| 82 | + if err := sbx.Available(); err != nil { | ||
| 83 | + return SbxCheck{}, err | ||
| 84 | + } | ||
| 85 | + hasKey, err := sbx.HasSecret(ctx, kind.Service, "") | ||
| 86 | + if err != nil { | ||
| 87 | + return SbxCheck{}, err | ||
| 88 | + } | ||
| 89 | + sandboxes, err := sbx.Sandboxes(ctx) | ||
| 90 | + if err != nil { | ||
| 91 | + return SbxCheck{}, err | ||
| 92 | + } | ||
| 93 | + folder := s.Core.agentsFolder() | ||
| 94 | + check := SbxCheck{HasKey: hasKey, AgentsFolder: folder} | ||
| 95 | + for index := 1; index < 100; index++ { | ||
| 96 | + name := kind.ID | ||
| 97 | + if index > 1 { | ||
| 98 | + name = fmt.Sprintf("%s-%d", kind.ID, index) | ||
| 99 | + } | ||
| 100 | + if s.problem(name, folder, sandboxes) == "" { | ||
| 101 | + check.Name = name | ||
| 102 | + break | ||
| 103 | + } | ||
| 104 | + } | ||
| 105 | + return check, nil | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +// SetKey stores the kind's key in sbx, for every sandbox. The key goes to | ||
| 109 | +// sbx on its standard input; it is never written in a file nor in a log. | ||
| 110 | +func (s *SbxCreatorService) SetKey(ctx context.Context, kindID, key string) error { | ||
| 111 | + kind, err := kindOf(kindID) | ||
| 112 | + if err != nil { | ||
| 113 | + return err | ||
| 114 | + } | ||
| 115 | + return s.Core.sbx().SetSecret(ctx, kind.Service, key) | ||
| 116 | +} | ||
| 117 | + | ||
| 118 | +// problem is why name cannot be used, or "". | ||
| 119 | +func (s *SbxCreatorService) problem(name, folder string, sandboxes []string) string { | ||
| 120 | + switch { | ||
| 121 | + case !sbxcreate.ValidName(name): | ||
| 122 | + return CreatorInvalidName | ||
| 123 | + case s.Core.hasAgent(name): | ||
| 124 | + return CreatorNameTaken | ||
| 125 | + case slices.Contains(sandboxes, name): | ||
| 126 | + return CreatorSandboxExists | ||
| 127 | + } | ||
| 128 | + if _, err := os.Lstat(filepath.Join(folder, name)); err == nil { | ||
| 129 | + return CreatorFolderExists | ||
| 130 | + } | ||
| 131 | + return "" | ||
| 132 | +} | ||
| 133 | + | ||
| 134 | +// Create writes the agent's folder — <agentsFolder>/<name>, with its | ||
| 135 | +// sbxenv.yaml and workspace/ — and adds the agent: `sbx exec -i <name> | ||
| 136 | +// <program>`, its sandbox created at its first start. A name already used | ||
| 137 | +// (agent, folder or sandbox) is a Problem: nothing is written. | ||
| 138 | +func (s *SbxCreatorService) Create(ctx context.Context, form SbxCreateForm) (CreatorResult, error) { | ||
| 139 | + kind, err := kindOf(form.Kind) | ||
| 140 | + if err != nil { | ||
| 141 | + return CreatorResult{}, err | ||
| 142 | + } | ||
| 143 | + sandboxes, err := s.Core.sbx().Sandboxes(ctx) | ||
| 144 | + if err != nil { | ||
| 145 | + return CreatorResult{}, err | ||
| 146 | + } | ||
| 147 | + folder := s.Core.agentsFolder() | ||
| 148 | + if problem := s.problem(form.Name, folder, sandboxes); problem != "" { | ||
| 149 | + return CreatorResult{Problem: problem}, nil | ||
| 150 | + } | ||
| 151 | + dir, err := sbxcreate.Write(folder, kind, form.Name) | ||
| 152 | + if errors.Is(err, sbxcreate.ErrFolderExists) { | ||
| 153 | + return CreatorResult{Problem: CreatorFolderExists}, nil | ||
| 154 | + } | ||
| 155 | + if err != nil { | ||
| 156 | + return CreatorResult{}, err | ||
| 157 | + } | ||
| 158 | + env, err := lifecycle.ReadSbxEnv(filepath.Join(dir, sbxcreate.SbxEnvFile)) | ||
| 159 | + if err != nil { | ||
| 160 | + return CreatorResult{}, err | ||
| 161 | + } | ||
| 162 | + title := form.Title | ||
| 163 | + if title == "" { | ||
| 164 | + title = kind.Title | ||
| 165 | + } | ||
| 166 | + problems, err := (&ConfigService{Core: s.Core}).AddAgent(AgentForm{ | ||
| 167 | + Name: form.Name, Title: title, Icon: form.Icon, Environment: EnvironmentSandbox, Box: env.Name, | ||
| 168 | + Program: kind.Program, Workspace: env.Workspace, SandboxFolder: env.Folder, | ||
| 169 | + CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), | ||
| 170 | + }) | ||
| 171 | + if err != nil || len(problems) > 0 { | ||
| 172 | + // The configuration refused it: the folder goes, the name stays free. | ||
| 173 | + _ = os.RemoveAll(dir) | ||
| 174 | + return CreatorResult{Problems: problems}, err | ||
| 175 | + } | ||
| 176 | + return CreatorResult{Problems: []string{}, Name: form.Name, Folder: dir}, nil | ||
| 177 | +} | ||
added
internal/app/sbxcreator_test.go +142 -0 | new file mode 100644 | ||
| @@ -0,0 +1,142 @@ | ||
| 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 | + "fmt" | |
| 9 | + "os" | |
| 10 | + "path/filepath" | |
| 11 | + "strings" | |
| 12 | + "testing" | |
| 13 | + | |
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | |
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | |
| 16 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | |
| 17 | +) | |
| 18 | + | |
| 19 | +// sbxScript is an sbx stand-in: "ls -q" prints the file sandboxes, "secret | |
| 20 | +// ls" the file secrets, "secret set <service>" adds its standard input as | |
| 21 | +// that service's global secret (and keeps the input in the file key). | |
| 22 | +const sbxScript = `#!/bin/sh | |
| 23 | +here=$(dirname "$0") | |
| 24 | +echo "$*" >> "$here/calls" | |
| 25 | +case "$1 $2" in | |
| 26 | + "ls -q") cat "$here/sandboxes" 2>/dev/null || true ;; | |
| 27 | + "secret ls") echo "SCOPE SERVICE SECRET"; cat "$here/secrets" 2>/dev/null || true ;; | |
| 28 | + "secret set") value=$(cat); printf '%s' "$value" > "$here/key"; echo "(global) $3 ****" >> "$here/secrets" ;; | |
| 29 | + *) exit 1 ;; | |
| 30 | +esac | |
| 31 | +` | |
| 32 | + | |
| 33 | +func sbxFixture(t *testing.T, sandboxes string) (*app.SbxCreatorService, string, string, string) { | |
| 34 | + t.Helper() | |
| 35 | + dir := t.TempDir() | |
| 36 | + bin := filepath.Join(dir, "bin") | |
| 37 | + if err := os.MkdirAll(bin, 0o755); err != nil { | |
| 38 | + t.Fatal(err) | |
| 39 | + } | |
| 40 | + write(t, filepath.Join(bin, "sbx"), sbxScript) | |
| 41 | + if err := os.Chmod(filepath.Join(bin, "sbx"), 0o755); err != nil { | |
| 42 | + t.Fatal(err) | |
| 43 | + } | |
| 44 | + write(t, filepath.Join(bin, "sandboxes"), sandboxes) | |
| 45 | + folder := filepath.Join(dir, "Documents") | |
| 46 | + path := filepath.Join(dir, "config.yaml") | |
| 47 | + write(t, path, "version: 1\nagentsFolder: "+folder+"\nagents:\n - name: claude\n command: sh\n") | |
| 48 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(bin, "sbx")}) | |
| 49 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | |
| 50 | + return &app.SbxCreatorService{Core: core}, path, folder, bin | |
| 51 | +} | |
| 52 | + | |
| 53 | +func TestCheckSuggestsAFreeNameAndTellsWhetherTheKeyIsStored(t *testing.T) { | |
| 54 | + service, _, folder, bin := sbxFixture(t, "codex\n") | |
| 55 | + if err := os.MkdirAll(filepath.Join(folder, "gemini"), 0o755); err != nil { | |
| 56 | + t.Fatal(err) | |
| 57 | + } | |
| 58 | + write(t, filepath.Join(bin, "secrets"), "(global) openai sk-****\n") | |
| 59 | + // claude is an agent, gemini a folder, codex a sandbox. | |
| 60 | + for kind, want := range map[string]app.SbxCheck{ | |
| 61 | + "claude": {Name: "claude-2", AgentsFolder: folder}, | |
| 62 | + "gemini": {Name: "gemini-2", AgentsFolder: folder}, | |
| 63 | + "codex": {Name: "codex-2", HasKey: true, AgentsFolder: folder}, | |
| 64 | + } { | |
| 65 | + if got, err := service.Check(context.Background(), kind); err != nil || got != want { | |
| 66 | + t.Errorf("%s: %+v %v, want %+v", kind, got, err, want) | |
| 67 | + } | |
| 68 | + } | |
| 69 | + if _, err := service.Check(context.Background(), "nope"); err == nil { | |
| 70 | + t.Error("an unknown kind must be refused") | |
| 71 | + } | |
| 72 | +} | |
| 73 | + | |
| 74 | +func TestSetKeyStoresTheKeyWithSbx(t *testing.T) { | |
| 75 | + service, _, _, bin := sbxFixture(t, "") | |
| 76 | + if err := service.SetKey(context.Background(), "gemini", "AIza-secret"); err != nil { | |
| 77 | + t.Fatal(err) | |
| 78 | + } | |
| 79 | + key, _ := os.ReadFile(filepath.Join(bin, "key")) | |
| 80 | + calls, _ := os.ReadFile(filepath.Join(bin, "calls")) | |
| 81 | + if string(key) != "AIza-secret" || strings.Contains(string(calls), "AIza") || !strings.Contains(string(calls), "secret set google") { | |
| 82 | + t.Fatalf("key %q, calls %q", key, calls) | |
| 83 | + } | |
| 84 | + if check, _ := service.Check(context.Background(), "gemini"); !check.HasKey { | |
| 85 | + t.Fatal("the key should now be stored") | |
| 86 | + } | |
| 87 | +} | |
| 88 | + | |
| 89 | +func TestCreateWritesTheFolderAndAddsTheAgent(t *testing.T) { | |
| 90 | + service, path, folder, _ := sbxFixture(t, "") | |
| 91 | + result, err := service.Create(context.Background(), app.SbxCreateForm{Kind: "gemini", Name: "gemini", Icon: "📘"}) | |
| 92 | + if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "gemini" || result.Folder != filepath.Join(folder, "gemini") { | |
| 93 | + t.Fatalf("create: %+v %v", result, err) | |
| 94 | + } | |
| 95 | + cfg, err := config.Load(path) | |
| 96 | + if err != nil { | |
| 97 | + t.Fatal(err) | |
| 98 | + } | |
| 99 | + gemini, ok := cfg.Agent("gemini") | |
| 100 | + dir := filepath.Join(folder, "gemini") | |
| 101 | + // As the owner's entries: sbx exec -i <sandbox> <program>, the workspace, | |
| 102 | + // the lifecycle in the agent's folder. | |
| 103 | + lifecycle := gemini.Runtime.Lifecycle | |
| 104 | + got := fmt.Sprintf("%s %s %s %v %s %s %s %s %v %v %v", gemini.Title, gemini.Icon, filepath.Base(gemini.Command), gemini.Args, gemini.Workspace, | |
| 105 | + gemini.Runtime.Type, gemini.Runtime.Sandbox, lifecycle.Folder, lifecycle.Create[1:], lifecycle.Stop[1:], lifecycle.Remove[1:]) | |
| 106 | + want := fmt.Sprintf("Gemini 📘 sbx [exec -i gemini agy acp] %s sbx gemini %s [env create --force] [stop gemini] [env rm --force]", filepath.Join(dir, "workspace"), dir) | |
| 107 | + if !ok || got != want { | |
| 108 | + t.Fatalf("gemini:\n got %s\nwant %s", got, want) | |
| 109 | + } | |
| 110 | + if _, err := os.Stat(filepath.Join(dir, sbxcreate.SbxEnvFile)); err != nil { | |
| 111 | + t.Fatal(err) | |
| 112 | + } | |
| 113 | +} | |
| 114 | + | |
| 115 | +func TestANameAlreadyUsedByAnAgentAFolderOrASandboxIsAProblem(t *testing.T) { | |
| 116 | + service, _, folder, _ := sbxFixture(t, "busy\n") | |
| 117 | + if err := os.MkdirAll(filepath.Join(folder, "taken"), 0o755); err != nil { | |
| 118 | + t.Fatal(err) | |
| 119 | + } | |
| 120 | + for name, problem := range map[string]string{ | |
| 121 | + "claude": app.CreatorNameTaken, "busy": app.CreatorSandboxExists, "taken": app.CreatorFolderExists, "my_agent": app.CreatorInvalidName, | |
| 122 | + } { | |
| 123 | + result, err := service.Create(context.Background(), app.SbxCreateForm{Kind: "codex", Name: name}) | |
| 124 | + if err != nil || result.Problem != problem { | |
| 125 | + t.Errorf("%s: %+v %v", name, result, err) | |
| 126 | + } | |
| 127 | + } | |
| 128 | + if entries, _ := os.ReadDir(filepath.Join(folder, "taken")); len(entries) != 0 { | |
| 129 | + t.Fatal("an existing folder must not be touched") | |
| 130 | + } | |
| 131 | +} | |
| 132 | + | |
| 133 | +func TestWithoutSbxTheAssistantSaysSo(t *testing.T) { | |
| 134 | + dir := t.TempDir() | |
| 135 | + path := filepath.Join(dir, "config.yaml") | |
| 136 | + write(t, path, "version: 1\nagents: []\n") | |
| 137 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(dir, "no-sbx")}) | |
| 138 | + defer core.Shutdown(context.Background()) | |
| 139 | + if _, err := (&app.SbxCreatorService{Core: core}).Check(context.Background(), "claude"); !errors.Is(err, sbxcreate.ErrSbxMissing) { | |
| 140 | + t.Fatalf("Check: %v", err) | |
| 141 | + } | |
| 142 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,142 @@ | |||
| 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 | + "fmt" | ||
| 9 | + "os" | ||
| 10 | + "path/filepath" | ||
| 11 | + "strings" | ||
| 12 | + "testing" | ||
| 13 | + | ||
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/app" | ||
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/config" | ||
| 16 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | ||
| 17 | +) | ||
| 18 | + | ||
| 19 | +// sbxScript is an sbx stand-in: "ls -q" prints the file sandboxes, "secret | ||
| 20 | +// ls" the file secrets, "secret set <service>" adds its standard input as | ||
| 21 | +// that service's global secret (and keeps the input in the file key). | ||
| 22 | +const sbxScript = `#!/bin/sh | ||
| 23 | +here=$(dirname "$0") | ||
| 24 | +echo "$*" >> "$here/calls" | ||
| 25 | +case "$1 $2" in | ||
| 26 | + "ls -q") cat "$here/sandboxes" 2>/dev/null || true ;; | ||
| 27 | + "secret ls") echo "SCOPE SERVICE SECRET"; cat "$here/secrets" 2>/dev/null || true ;; | ||
| 28 | + "secret set") value=$(cat); printf '%s' "$value" > "$here/key"; echo "(global) $3 ****" >> "$here/secrets" ;; | ||
| 29 | + *) exit 1 ;; | ||
| 30 | +esac | ||
| 31 | +` | ||
| 32 | + | ||
| 33 | +func sbxFixture(t *testing.T, sandboxes string) (*app.SbxCreatorService, string, string, string) { | ||
| 34 | + t.Helper() | ||
| 35 | + dir := t.TempDir() | ||
| 36 | + bin := filepath.Join(dir, "bin") | ||
| 37 | + if err := os.MkdirAll(bin, 0o755); err != nil { | ||
| 38 | + t.Fatal(err) | ||
| 39 | + } | ||
| 40 | + write(t, filepath.Join(bin, "sbx"), sbxScript) | ||
| 41 | + if err := os.Chmod(filepath.Join(bin, "sbx"), 0o755); err != nil { | ||
| 42 | + t.Fatal(err) | ||
| 43 | + } | ||
| 44 | + write(t, filepath.Join(bin, "sandboxes"), sandboxes) | ||
| 45 | + folder := filepath.Join(dir, "Documents") | ||
| 46 | + path := filepath.Join(dir, "config.yaml") | ||
| 47 | + write(t, path, "version: 1\nagentsFolder: "+folder+"\nagents:\n - name: claude\n command: sh\n") | ||
| 48 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(bin, "sbx")}) | ||
| 49 | + t.Cleanup(func() { core.Shutdown(context.Background()) }) | ||
| 50 | + return &app.SbxCreatorService{Core: core}, path, folder, bin | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +func TestCheckSuggestsAFreeNameAndTellsWhetherTheKeyIsStored(t *testing.T) { | ||
| 54 | + service, _, folder, bin := sbxFixture(t, "codex\n") | ||
| 55 | + if err := os.MkdirAll(filepath.Join(folder, "gemini"), 0o755); err != nil { | ||
| 56 | + t.Fatal(err) | ||
| 57 | + } | ||
| 58 | + write(t, filepath.Join(bin, "secrets"), "(global) openai sk-****\n") | ||
| 59 | + // claude is an agent, gemini a folder, codex a sandbox. | ||
| 60 | + for kind, want := range map[string]app.SbxCheck{ | ||
| 61 | + "claude": {Name: "claude-2", AgentsFolder: folder}, | ||
| 62 | + "gemini": {Name: "gemini-2", AgentsFolder: folder}, | ||
| 63 | + "codex": {Name: "codex-2", HasKey: true, AgentsFolder: folder}, | ||
| 64 | + } { | ||
| 65 | + if got, err := service.Check(context.Background(), kind); err != nil || got != want { | ||
| 66 | + t.Errorf("%s: %+v %v, want %+v", kind, got, err, want) | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + if _, err := service.Check(context.Background(), "nope"); err == nil { | ||
| 70 | + t.Error("an unknown kind must be refused") | ||
| 71 | + } | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +func TestSetKeyStoresTheKeyWithSbx(t *testing.T) { | ||
| 75 | + service, _, _, bin := sbxFixture(t, "") | ||
| 76 | + if err := service.SetKey(context.Background(), "gemini", "AIza-secret"); err != nil { | ||
| 77 | + t.Fatal(err) | ||
| 78 | + } | ||
| 79 | + key, _ := os.ReadFile(filepath.Join(bin, "key")) | ||
| 80 | + calls, _ := os.ReadFile(filepath.Join(bin, "calls")) | ||
| 81 | + if string(key) != "AIza-secret" || strings.Contains(string(calls), "AIza") || !strings.Contains(string(calls), "secret set google") { | ||
| 82 | + t.Fatalf("key %q, calls %q", key, calls) | ||
| 83 | + } | ||
| 84 | + if check, _ := service.Check(context.Background(), "gemini"); !check.HasKey { | ||
| 85 | + t.Fatal("the key should now be stored") | ||
| 86 | + } | ||
| 87 | +} | ||
| 88 | + | ||
| 89 | +func TestCreateWritesTheFolderAndAddsTheAgent(t *testing.T) { | ||
| 90 | + service, path, folder, _ := sbxFixture(t, "") | ||
| 91 | + result, err := service.Create(context.Background(), app.SbxCreateForm{Kind: "gemini", Name: "gemini", Icon: "📘"}) | ||
| 92 | + if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "gemini" || result.Folder != filepath.Join(folder, "gemini") { | ||
| 93 | + t.Fatalf("create: %+v %v", result, err) | ||
| 94 | + } | ||
| 95 | + cfg, err := config.Load(path) | ||
| 96 | + if err != nil { | ||
| 97 | + t.Fatal(err) | ||
| 98 | + } | ||
| 99 | + gemini, ok := cfg.Agent("gemini") | ||
| 100 | + dir := filepath.Join(folder, "gemini") | ||
| 101 | + // As the owner's entries: sbx exec -i <sandbox> <program>, the workspace, | ||
| 102 | + // the lifecycle in the agent's folder. | ||
| 103 | + lifecycle := gemini.Runtime.Lifecycle | ||
| 104 | + got := fmt.Sprintf("%s %s %s %v %s %s %s %s %v %v %v", gemini.Title, gemini.Icon, filepath.Base(gemini.Command), gemini.Args, gemini.Workspace, | ||
| 105 | + gemini.Runtime.Type, gemini.Runtime.Sandbox, lifecycle.Folder, lifecycle.Create[1:], lifecycle.Stop[1:], lifecycle.Remove[1:]) | ||
| 106 | + want := fmt.Sprintf("Gemini 📘 sbx [exec -i gemini agy acp] %s sbx gemini %s [env create --force] [stop gemini] [env rm --force]", filepath.Join(dir, "workspace"), dir) | ||
| 107 | + if !ok || got != want { | ||
| 108 | + t.Fatalf("gemini:\n got %s\nwant %s", got, want) | ||
| 109 | + } | ||
| 110 | + if _, err := os.Stat(filepath.Join(dir, sbxcreate.SbxEnvFile)); err != nil { | ||
| 111 | + t.Fatal(err) | ||
| 112 | + } | ||
| 113 | +} | ||
| 114 | + | ||
| 115 | +func TestANameAlreadyUsedByAnAgentAFolderOrASandboxIsAProblem(t *testing.T) { | ||
| 116 | + service, _, folder, _ := sbxFixture(t, "busy\n") | ||
| 117 | + if err := os.MkdirAll(filepath.Join(folder, "taken"), 0o755); err != nil { | ||
| 118 | + t.Fatal(err) | ||
| 119 | + } | ||
| 120 | + for name, problem := range map[string]string{ | ||
| 121 | + "claude": app.CreatorNameTaken, "busy": app.CreatorSandboxExists, "taken": app.CreatorFolderExists, "my_agent": app.CreatorInvalidName, | ||
| 122 | + } { | ||
| 123 | + result, err := service.Create(context.Background(), app.SbxCreateForm{Kind: "codex", Name: name}) | ||
| 124 | + if err != nil || result.Problem != problem { | ||
| 125 | + t.Errorf("%s: %+v %v", name, result, err) | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + if entries, _ := os.ReadDir(filepath.Join(folder, "taken")); len(entries) != 0 { | ||
| 129 | + t.Fatal("an existing folder must not be touched") | ||
| 130 | + } | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +func TestWithoutSbxTheAssistantSaysSo(t *testing.T) { | ||
| 134 | + dir := t.TempDir() | ||
| 135 | + path := filepath.Join(dir, "config.yaml") | ||
| 136 | + write(t, path, "version: 1\nagents: []\n") | ||
| 137 | + core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, Sbx: filepath.Join(dir, "no-sbx")}) | ||
| 138 | + defer core.Shutdown(context.Background()) | ||
| 139 | + if _, err := (&app.SbxCreatorService{Core: core}).Check(context.Background(), "claude"); !errors.Is(err, sbxcreate.ErrSbxMissing) { | ||
| 140 | + t.Fatalf("Check: %v", err) | ||
| 141 | + } | ||
| 142 | +} | ||
added
internal/sbxcreate/sbxcreate.go +261 -0 | new file mode 100644 | ||
| @@ -0,0 +1,261 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// Package sbxcreate creates an agent that runs in a Docker Sandbox (sbx) | |
| 4 | +// without a file to write (issue #96): a folder named after the agent, its | |
| 5 | +// sbxenv.yaml and its workspace/ folder, for one of the kinds of Catalogue | |
| 6 | +// (Claude, Gemini, Codex…). It also talks to sbx for what the assistant | |
| 7 | +// needs: the sandboxes that exist, and the API key of a kind, checked and | |
| 8 | +// stored with `sbx secret` without ever being written or logged. | |
| 9 | +// | |
| 10 | +// dir, err := sbxcreate.Write("/Users/me/Documents", sbxcreate.Lookup("claude"), "claude") | |
| 11 | +// // dir == "/Users/me/Documents/claude", with sbxenv.yaml and workspace/ | |
| 12 | +package sbxcreate | |
| 13 | + | |
| 14 | +import ( | |
| 15 | + "bytes" | |
| 16 | + "context" | |
| 17 | + "errors" | |
| 18 | + "fmt" | |
| 19 | + "os" | |
| 20 | + "os/exec" | |
| 21 | + "path/filepath" | |
| 22 | + "regexp" | |
| 23 | + "strings" | |
| 24 | + "time" | |
| 25 | +) | |
| 26 | + | |
| 27 | +// Binding is the domains where sbx injects a credential of a service: the | |
| 28 | +// API key (apiKey) or a sign-in (oauth). | |
| 29 | +type Binding struct { | |
| 30 | + APIKey []string | |
| 31 | + OAuth []string | |
| 32 | +} | |
| 33 | + | |
| 34 | +// Kind is a kind of agent the assistant creates: what goes in its | |
| 35 | +// sbxenv.yaml, how Sidekicks starts it, and the sbx secret it needs. | |
| 36 | +type Kind struct { | |
| 37 | + ID string `json:"id"` | |
| 38 | + Title string `json:"title"` | |
| 39 | + Icon string `json:"icon"` | |
| 40 | + // Agent is the sbx agent of the sandbox ("agent:"), Kit its kit. | |
| 41 | + Agent string `json:"agent"` | |
| 42 | + Kit string `json:"kit"` | |
| 43 | + // Program is the agent's ACP program in the sandbox, then its | |
| 44 | + // arguments, on one line ("agy acp"). | |
| 45 | + Program string `json:"program"` | |
| 46 | + // Service is the sbx secret service of its key (sbx secret set <service>). | |
| 47 | + Service string `json:"service"` | |
| 48 | + // KeyURL is where the user gets a key. | |
| 49 | + KeyURL string `json:"keyUrl"` | |
| 50 | + Bindings Binding `json:"-"` | |
| 51 | +} | |
| 52 | + | |
| 53 | +// Catalogue is the kinds the assistant offers, in this order. A new kind is | |
| 54 | +// one more entry here. | |
| 55 | +var Catalogue = []Kind{ | |
| 56 | + { | |
| 57 | + ID: "claude", Title: "Claude", Icon: "📙", | |
| 58 | + Agent: "claude", Kit: "docker.io/sbx/claude-acp:latest", Program: "claude-agent-acp", | |
| 59 | + Service: "anthropic", KeyURL: "https://console.anthropic.com/settings/keys", | |
| 60 | + Bindings: Binding{APIKey: []string{"api.anthropic.com", "console.anthropic.com"}}, | |
| 61 | + }, | |
| 62 | + { | |
| 63 | + // Gemini through Google Antigravity (agy), whose kit replaces Docker's | |
| 64 | + // deprecated gemini-kit; `agy acp` serves ACP. | |
| 65 | + ID: "gemini", Title: "Gemini", Icon: "📘", | |
| 66 | + Agent: "antigravity", Kit: "docker.io/sbx/antigravity:latest", Program: "agy acp", | |
| 67 | + Service: "google", KeyURL: "https://aistudio.google.com/apikey", | |
| 68 | + Bindings: Binding{ | |
| 69 | + APIKey: []string{"generativelanguage.googleapis.com", "aiplatform.googleapis.com", "vertexai.googleapis.com"}, | |
| 70 | + OAuth: []string{"accounts.google.com", "oauth2.googleapis.com"}, | |
| 71 | + }, | |
| 72 | + }, | |
| 73 | + { | |
| 74 | + ID: "codex", Title: "Codex", Icon: "📗", | |
| 75 | + Agent: "codex", Kit: "docker.io/sbx/codex-acp:latest", Program: "codex-acp", | |
| 76 | + Service: "openai", KeyURL: "https://platform.openai.com/api-keys", | |
| 77 | + Bindings: Binding{APIKey: []string{"api.openai.com", "openai.com"}, OAuth: []string{"auth.openai.com", "chatgpt.com"}}, | |
| 78 | + }, | |
| 79 | +} | |
| 80 | + | |
| 81 | +// Lookup is the kind called id; ok is false when there is none. | |
| 82 | +func Lookup(id string) (Kind, bool) { | |
| 83 | + for _, kind := range Catalogue { | |
| 84 | + if kind.ID == id { | |
| 85 | + return kind, true | |
| 86 | + } | |
| 87 | + } | |
| 88 | + return Kind{}, false | |
| 89 | +} | |
| 90 | + | |
| 91 | +var ( | |
| 92 | + // ErrSbxMissing is returned when sbx is not installed. | |
| 93 | + ErrSbxMissing = errors.New("sbx is not installed") | |
| 94 | + // ErrFolderExists is returned when a folder already has the agent's name. | |
| 95 | + ErrFolderExists = errors.New("a folder with this name already exists") | |
| 96 | + // ErrInvalidName is returned for a name that cannot be an agent's, a | |
| 97 | + // folder's and a sandbox's. | |
| 98 | + ErrInvalidName = errors.New("invalid agent name") | |
| 99 | +) | |
| 100 | + | |
| 101 | +// SbxEnvFile and WorkspaceFolder are what Write makes in the agent's folder. | |
| 102 | +const ( | |
| 103 | + SbxEnvFile = "sbxenv.yaml" | |
| 104 | + WorkspaceFolder = "workspace" | |
| 105 | +) | |
| 106 | + | |
| 107 | +// namePattern: an agent name of the configuration that sbx also accepts as a | |
| 108 | +// sandbox name (letters, digits and hyphens: no "_"). | |
| 109 | +var namePattern = regexp.MustCompile(`^[a-z][a-z0-9-]{0,31}$`) | |
| 110 | + | |
| 111 | +// ValidName reports whether name can be the agent's, its folder's and its | |
| 112 | +// sandbox's. | |
| 113 | +func ValidName(name string) bool { return namePattern.MatchString(name) } | |
| 114 | + | |
| 115 | +// Write creates <folder>/<name> with the sbxenv.yaml of kind and an empty | |
| 116 | +// workspace/ folder, and returns that folder. A folder that already exists | |
| 117 | +// is never touched: ErrFolderExists. | |
| 118 | +func Write(folder string, kind Kind, name string) (string, error) { | |
| 119 | + if !ValidName(name) { | |
| 120 | + return "", ErrInvalidName | |
| 121 | + } | |
| 122 | + if err := os.MkdirAll(folder, 0o755); err != nil { | |
| 123 | + return "", err | |
| 124 | + } | |
| 125 | + dir := filepath.Join(folder, name) | |
| 126 | + if err := os.Mkdir(dir, 0o755); err != nil { | |
| 127 | + if errors.Is(err, os.ErrExist) { | |
| 128 | + return "", ErrFolderExists | |
| 129 | + } | |
| 130 | + return "", err | |
| 131 | + } | |
| 132 | + if err := os.Mkdir(filepath.Join(dir, WorkspaceFolder), 0o755); err != nil { | |
| 133 | + _ = os.RemoveAll(dir) | |
| 134 | + return "", err | |
| 135 | + } | |
| 136 | + if err := os.WriteFile(filepath.Join(dir, SbxEnvFile), []byte(Render(kind, name)), 0o644); err != nil { | |
| 137 | + _ = os.RemoveAll(dir) | |
| 138 | + return "", err | |
| 139 | + } | |
| 140 | + return dir, nil | |
| 141 | +} | |
| 142 | + | |
| 143 | +// Render is the sbxenv.yaml of an agent of kind called name: its sandbox has | |
| 144 | +// the agent's name and mounts ./workspace. The comments are in English, like | |
| 145 | +// Sidekicks' default configuration. | |
| 146 | +func Render(kind Kind, name string) string { | |
| 147 | + var b strings.Builder | |
| 148 | + fmt.Fprintf(&b, "# %s: %s in a Docker Sandbox. Written by Sidekicks.\n", name, kind.Title) | |
| 149 | + b.WriteString("#\n# sbx env create --force creates the sandbox (Sidekicks does it at the agent's first start)\n") | |
| 150 | + b.WriteString("# sbx env rm --force removes it\n") | |
| 151 | + b.WriteString("schemaVersion: \"1\"\n\n") | |
| 152 | + b.WriteString("# The sandbox's name: the agent's, letters, digits and hyphens only.\n") | |
| 153 | + fmt.Fprintf(&b, "name: %s\n", name) | |
| 154 | + fmt.Fprintf(&b, "agent: %s\n\n", kind.Agent) | |
| 155 | + b.WriteString("# The agent's working folder, relative to this file.\n") | |
| 156 | + b.WriteString("workspace: ./workspace\n\n") | |
| 157 | + fmt.Fprintf(&b, "kits:\n - %s\n\n", kind.Kit) | |
| 158 | + fmt.Fprintf(&b, "# Where sbx injects the key stored with `sbx secret set %s`: these domains only.\n", kind.Service) | |
| 159 | + fmt.Fprintf(&b, "bindings:\n %s:\n", kind.Service) | |
| 160 | + for _, auth := range []struct { | |
| 161 | + name string | |
| 162 | + domains []string | |
| 163 | + }{{"apiKey", kind.Bindings.APIKey}, {"oauth", kind.Bindings.OAuth}} { | |
| 164 | + if len(auth.domains) == 0 { | |
| 165 | + continue | |
| 166 | + } | |
| 167 | + fmt.Fprintf(&b, " %s:\n domains:\n", auth.name) | |
| 168 | + for _, domain := range auth.domains { | |
| 169 | + fmt.Fprintf(&b, " - %s\n", domain) | |
| 170 | + } | |
| 171 | + } | |
| 172 | + b.WriteString("\n# Pull the kit at each creation: \"latest\" moves.\n") | |
| 173 | + b.WriteString("sandboxOptions:\n pullPolicy: always\n") | |
| 174 | + return b.String() | |
| 175 | +} | |
| 176 | + | |
| 177 | +// Sbx runs the sbx commands the assistant needs. | |
| 178 | +type Sbx struct { | |
| 179 | + // Command is sbx's program. | |
| 180 | + Command string | |
| 181 | +} | |
| 182 | + | |
| 183 | +// program is sbx's path, or ErrSbxMissing. | |
| 184 | +func (s Sbx) program() (string, error) { | |
| 185 | + path, err := exec.LookPath(s.Command) | |
| 186 | + if err != nil { | |
| 187 | + return "", ErrSbxMissing | |
| 188 | + } | |
| 189 | + return path, nil | |
| 190 | +} | |
| 191 | + | |
| 192 | +// Available reports ErrSbxMissing when sbx cannot be found. | |
| 193 | +func (s Sbx) Available() error { | |
| 194 | + _, err := s.program() | |
| 195 | + return err | |
| 196 | +} | |
| 197 | + | |
| 198 | +func (s Sbx) run(ctx context.Context, stdin string, args ...string) (string, error) { | |
| 199 | + program, err := s.program() | |
| 200 | + if err != nil { | |
| 201 | + return "", err | |
| 202 | + } | |
| 203 | + ctx, cancel := context.WithTimeout(ctx, 30*time.Second) | |
| 204 | + defer cancel() | |
| 205 | + command := exec.CommandContext(ctx, program, args...) | |
| 206 | + command.Stdin = strings.NewReader(stdin) | |
| 207 | + var out, errOut bytes.Buffer | |
| 208 | + command.Stdout, command.Stderr = &out, &errOut | |
| 209 | + if err := command.Run(); err != nil { | |
| 210 | + message := strings.TrimSpace(errOut.String()) | |
| 211 | + if message == "" { | |
| 212 | + message = strings.TrimSpace(out.String()) | |
| 213 | + } | |
| 214 | + return "", fmt.Errorf("sbx %s: %w: %s", args[0], err, message) | |
| 215 | + } | |
| 216 | + return out.String(), nil | |
| 217 | +} | |
| 218 | + | |
| 219 | +// Sandboxes is the names of the sandboxes that exist (sbx ls -q). | |
| 220 | +func (s Sbx) Sandboxes(ctx context.Context) ([]string, error) { | |
| 221 | + out, err := s.run(ctx, "", "ls", "-q") | |
| 222 | + if err != nil { | |
| 223 | + return nil, err | |
| 224 | + } | |
| 225 | + return strings.Fields(out), nil | |
| 226 | +} | |
| 227 | + | |
| 228 | +// HasSecret reports whether a key of service is stored in sbx, for every | |
| 229 | +// sandbox (global) or for the one called sandbox. `sbx secret ls` shows | |
| 230 | +// SCOPE SERVICE SECRET, the secret masked. | |
| 231 | +func (s Sbx) HasSecret(ctx context.Context, service, sandbox string) (bool, error) { | |
| 232 | + out, err := s.run(ctx, "", "secret", "ls", "--service", service) | |
| 233 | + if err != nil { | |
| 234 | + return false, err | |
| 235 | + } | |
| 236 | + for _, line := range strings.Split(out, "\n") { | |
| 237 | + fields := strings.Fields(line) | |
| 238 | + if len(fields) < 2 || fields[1] != service { | |
| 239 | + continue | |
| 240 | + } | |
| 241 | + if fields[0] == "(global)" || fields[0] == sandbox { | |
| 242 | + return true, nil | |
| 243 | + } | |
| 244 | + } | |
| 245 | + return false, nil | |
| 246 | +} | |
| 247 | + | |
| 248 | +// SetSecret stores key for service, for every sandbox: it goes to | |
| 249 | +// `sbx secret set <service>` on its standard input, never in its arguments, | |
| 250 | +// and an error never repeats it. | |
| 251 | +func (s Sbx) SetSecret(ctx context.Context, service, key string) error { | |
| 252 | + key = strings.TrimSpace(key) | |
| 253 | + if key == "" { | |
| 254 | + return errors.New("the key is empty") | |
| 255 | + } | |
| 256 | + _, err := s.run(ctx, key, "secret", "set", service) | |
| 257 | + if err != nil { | |
| 258 | + return errors.New(strings.ReplaceAll(err.Error(), key, "***")) | |
| 259 | + } | |
| 260 | + return nil | |
| 261 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,261 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// Package sbxcreate creates an agent that runs in a Docker Sandbox (sbx) | ||
| 4 | +// without a file to write (issue #96): a folder named after the agent, its | ||
| 5 | +// sbxenv.yaml and its workspace/ folder, for one of the kinds of Catalogue | ||
| 6 | +// (Claude, Gemini, Codex…). It also talks to sbx for what the assistant | ||
| 7 | +// needs: the sandboxes that exist, and the API key of a kind, checked and | ||
| 8 | +// stored with `sbx secret` without ever being written or logged. | ||
| 9 | +// | ||
| 10 | +// dir, err := sbxcreate.Write("/Users/me/Documents", sbxcreate.Lookup("claude"), "claude") | ||
| 11 | +// // dir == "/Users/me/Documents/claude", with sbxenv.yaml and workspace/ | ||
| 12 | +package sbxcreate | ||
| 13 | + | ||
| 14 | +import ( | ||
| 15 | + "bytes" | ||
| 16 | + "context" | ||
| 17 | + "errors" | ||
| 18 | + "fmt" | ||
| 19 | + "os" | ||
| 20 | + "os/exec" | ||
| 21 | + "path/filepath" | ||
| 22 | + "regexp" | ||
| 23 | + "strings" | ||
| 24 | + "time" | ||
| 25 | +) | ||
| 26 | + | ||
| 27 | +// Binding is the domains where sbx injects a credential of a service: the | ||
| 28 | +// API key (apiKey) or a sign-in (oauth). | ||
| 29 | +type Binding struct { | ||
| 30 | + APIKey []string | ||
| 31 | + OAuth []string | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +// Kind is a kind of agent the assistant creates: what goes in its | ||
| 35 | +// sbxenv.yaml, how Sidekicks starts it, and the sbx secret it needs. | ||
| 36 | +type Kind struct { | ||
| 37 | + ID string `json:"id"` | ||
| 38 | + Title string `json:"title"` | ||
| 39 | + Icon string `json:"icon"` | ||
| 40 | + // Agent is the sbx agent of the sandbox ("agent:"), Kit its kit. | ||
| 41 | + Agent string `json:"agent"` | ||
| 42 | + Kit string `json:"kit"` | ||
| 43 | + // Program is the agent's ACP program in the sandbox, then its | ||
| 44 | + // arguments, on one line ("agy acp"). | ||
| 45 | + Program string `json:"program"` | ||
| 46 | + // Service is the sbx secret service of its key (sbx secret set <service>). | ||
| 47 | + Service string `json:"service"` | ||
| 48 | + // KeyURL is where the user gets a key. | ||
| 49 | + KeyURL string `json:"keyUrl"` | ||
| 50 | + Bindings Binding `json:"-"` | ||
| 51 | +} | ||
| 52 | + | ||
| 53 | +// Catalogue is the kinds the assistant offers, in this order. A new kind is | ||
| 54 | +// one more entry here. | ||
| 55 | +var Catalogue = []Kind{ | ||
| 56 | + { | ||
| 57 | + ID: "claude", Title: "Claude", Icon: "📙", | ||
| 58 | + Agent: "claude", Kit: "docker.io/sbx/claude-acp:latest", Program: "claude-agent-acp", | ||
| 59 | + Service: "anthropic", KeyURL: "https://console.anthropic.com/settings/keys", | ||
| 60 | + Bindings: Binding{APIKey: []string{"api.anthropic.com", "console.anthropic.com"}}, | ||
| 61 | + }, | ||
| 62 | + { | ||
| 63 | + // Gemini through Google Antigravity (agy), whose kit replaces Docker's | ||
| 64 | + // deprecated gemini-kit; `agy acp` serves ACP. | ||
| 65 | + ID: "gemini", Title: "Gemini", Icon: "📘", | ||
| 66 | + Agent: "antigravity", Kit: "docker.io/sbx/antigravity:latest", Program: "agy acp", | ||
| 67 | + Service: "google", KeyURL: "https://aistudio.google.com/apikey", | ||
| 68 | + Bindings: Binding{ | ||
| 69 | + APIKey: []string{"generativelanguage.googleapis.com", "aiplatform.googleapis.com", "vertexai.googleapis.com"}, | ||
| 70 | + OAuth: []string{"accounts.google.com", "oauth2.googleapis.com"}, | ||
| 71 | + }, | ||
| 72 | + }, | ||
| 73 | + { | ||
| 74 | + ID: "codex", Title: "Codex", Icon: "📗", | ||
| 75 | + Agent: "codex", Kit: "docker.io/sbx/codex-acp:latest", Program: "codex-acp", | ||
| 76 | + Service: "openai", KeyURL: "https://platform.openai.com/api-keys", | ||
| 77 | + Bindings: Binding{APIKey: []string{"api.openai.com", "openai.com"}, OAuth: []string{"auth.openai.com", "chatgpt.com"}}, | ||
| 78 | + }, | ||
| 79 | +} | ||
| 80 | + | ||
| 81 | +// Lookup is the kind called id; ok is false when there is none. | ||
| 82 | +func Lookup(id string) (Kind, bool) { | ||
| 83 | + for _, kind := range Catalogue { | ||
| 84 | + if kind.ID == id { | ||
| 85 | + return kind, true | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + return Kind{}, false | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +var ( | ||
| 92 | + // ErrSbxMissing is returned when sbx is not installed. | ||
| 93 | + ErrSbxMissing = errors.New("sbx is not installed") | ||
| 94 | + // ErrFolderExists is returned when a folder already has the agent's name. | ||
| 95 | + ErrFolderExists = errors.New("a folder with this name already exists") | ||
| 96 | + // ErrInvalidName is returned for a name that cannot be an agent's, a | ||
| 97 | + // folder's and a sandbox's. | ||
| 98 | + ErrInvalidName = errors.New("invalid agent name") | ||
| 99 | +) | ||
| 100 | + | ||
| 101 | +// SbxEnvFile and WorkspaceFolder are what Write makes in the agent's folder. | ||
| 102 | +const ( | ||
| 103 | + SbxEnvFile = "sbxenv.yaml" | ||
| 104 | + WorkspaceFolder = "workspace" | ||
| 105 | +) | ||
| 106 | + | ||
| 107 | +// namePattern: an agent name of the configuration that sbx also accepts as a | ||
| 108 | +// sandbox name (letters, digits and hyphens: no "_"). | ||
| 109 | +var namePattern = regexp.MustCompile(`^[a-z][a-z0-9-]{0,31}$`) | ||
| 110 | + | ||
| 111 | +// ValidName reports whether name can be the agent's, its folder's and its | ||
| 112 | +// sandbox's. | ||
| 113 | +func ValidName(name string) bool { return namePattern.MatchString(name) } | ||
| 114 | + | ||
| 115 | +// Write creates <folder>/<name> with the sbxenv.yaml of kind and an empty | ||
| 116 | +// workspace/ folder, and returns that folder. A folder that already exists | ||
| 117 | +// is never touched: ErrFolderExists. | ||
| 118 | +func Write(folder string, kind Kind, name string) (string, error) { | ||
| 119 | + if !ValidName(name) { | ||
| 120 | + return "", ErrInvalidName | ||
| 121 | + } | ||
| 122 | + if err := os.MkdirAll(folder, 0o755); err != nil { | ||
| 123 | + return "", err | ||
| 124 | + } | ||
| 125 | + dir := filepath.Join(folder, name) | ||
| 126 | + if err := os.Mkdir(dir, 0o755); err != nil { | ||
| 127 | + if errors.Is(err, os.ErrExist) { | ||
| 128 | + return "", ErrFolderExists | ||
| 129 | + } | ||
| 130 | + return "", err | ||
| 131 | + } | ||
| 132 | + if err := os.Mkdir(filepath.Join(dir, WorkspaceFolder), 0o755); err != nil { | ||
| 133 | + _ = os.RemoveAll(dir) | ||
| 134 | + return "", err | ||
| 135 | + } | ||
| 136 | + if err := os.WriteFile(filepath.Join(dir, SbxEnvFile), []byte(Render(kind, name)), 0o644); err != nil { | ||
| 137 | + _ = os.RemoveAll(dir) | ||
| 138 | + return "", err | ||
| 139 | + } | ||
| 140 | + return dir, nil | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +// Render is the sbxenv.yaml of an agent of kind called name: its sandbox has | ||
| 144 | +// the agent's name and mounts ./workspace. The comments are in English, like | ||
| 145 | +// Sidekicks' default configuration. | ||
| 146 | +func Render(kind Kind, name string) string { | ||
| 147 | + var b strings.Builder | ||
| 148 | + fmt.Fprintf(&b, "# %s: %s in a Docker Sandbox. Written by Sidekicks.\n", name, kind.Title) | ||
| 149 | + b.WriteString("#\n# sbx env create --force creates the sandbox (Sidekicks does it at the agent's first start)\n") | ||
| 150 | + b.WriteString("# sbx env rm --force removes it\n") | ||
| 151 | + b.WriteString("schemaVersion: \"1\"\n\n") | ||
| 152 | + b.WriteString("# The sandbox's name: the agent's, letters, digits and hyphens only.\n") | ||
| 153 | + fmt.Fprintf(&b, "name: %s\n", name) | ||
| 154 | + fmt.Fprintf(&b, "agent: %s\n\n", kind.Agent) | ||
| 155 | + b.WriteString("# The agent's working folder, relative to this file.\n") | ||
| 156 | + b.WriteString("workspace: ./workspace\n\n") | ||
| 157 | + fmt.Fprintf(&b, "kits:\n - %s\n\n", kind.Kit) | ||
| 158 | + fmt.Fprintf(&b, "# Where sbx injects the key stored with `sbx secret set %s`: these domains only.\n", kind.Service) | ||
| 159 | + fmt.Fprintf(&b, "bindings:\n %s:\n", kind.Service) | ||
| 160 | + for _, auth := range []struct { | ||
| 161 | + name string | ||
| 162 | + domains []string | ||
| 163 | + }{{"apiKey", kind.Bindings.APIKey}, {"oauth", kind.Bindings.OAuth}} { | ||
| 164 | + if len(auth.domains) == 0 { | ||
| 165 | + continue | ||
| 166 | + } | ||
| 167 | + fmt.Fprintf(&b, " %s:\n domains:\n", auth.name) | ||
| 168 | + for _, domain := range auth.domains { | ||
| 169 | + fmt.Fprintf(&b, " - %s\n", domain) | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + b.WriteString("\n# Pull the kit at each creation: \"latest\" moves.\n") | ||
| 173 | + b.WriteString("sandboxOptions:\n pullPolicy: always\n") | ||
| 174 | + return b.String() | ||
| 175 | +} | ||
| 176 | + | ||
| 177 | +// Sbx runs the sbx commands the assistant needs. | ||
| 178 | +type Sbx struct { | ||
| 179 | + // Command is sbx's program. | ||
| 180 | + Command string | ||
| 181 | +} | ||
| 182 | + | ||
| 183 | +// program is sbx's path, or ErrSbxMissing. | ||
| 184 | +func (s Sbx) program() (string, error) { | ||
| 185 | + path, err := exec.LookPath(s.Command) | ||
| 186 | + if err != nil { | ||
| 187 | + return "", ErrSbxMissing | ||
| 188 | + } | ||
| 189 | + return path, nil | ||
| 190 | +} | ||
| 191 | + | ||
| 192 | +// Available reports ErrSbxMissing when sbx cannot be found. | ||
| 193 | +func (s Sbx) Available() error { | ||
| 194 | + _, err := s.program() | ||
| 195 | + return err | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +func (s Sbx) run(ctx context.Context, stdin string, args ...string) (string, error) { | ||
| 199 | + program, err := s.program() | ||
| 200 | + if err != nil { | ||
| 201 | + return "", err | ||
| 202 | + } | ||
| 203 | + ctx, cancel := context.WithTimeout(ctx, 30*time.Second) | ||
| 204 | + defer cancel() | ||
| 205 | + command := exec.CommandContext(ctx, program, args...) | ||
| 206 | + command.Stdin = strings.NewReader(stdin) | ||
| 207 | + var out, errOut bytes.Buffer | ||
| 208 | + command.Stdout, command.Stderr = &out, &errOut | ||
| 209 | + if err := command.Run(); err != nil { | ||
| 210 | + message := strings.TrimSpace(errOut.String()) | ||
| 211 | + if message == "" { | ||
| 212 | + message = strings.TrimSpace(out.String()) | ||
| 213 | + } | ||
| 214 | + return "", fmt.Errorf("sbx %s: %w: %s", args[0], err, message) | ||
| 215 | + } | ||
| 216 | + return out.String(), nil | ||
| 217 | +} | ||
| 218 | + | ||
| 219 | +// Sandboxes is the names of the sandboxes that exist (sbx ls -q). | ||
| 220 | +func (s Sbx) Sandboxes(ctx context.Context) ([]string, error) { | ||
| 221 | + out, err := s.run(ctx, "", "ls", "-q") | ||
| 222 | + if err != nil { | ||
| 223 | + return nil, err | ||
| 224 | + } | ||
| 225 | + return strings.Fields(out), nil | ||
| 226 | +} | ||
| 227 | + | ||
| 228 | +// HasSecret reports whether a key of service is stored in sbx, for every | ||
| 229 | +// sandbox (global) or for the one called sandbox. `sbx secret ls` shows | ||
| 230 | +// SCOPE SERVICE SECRET, the secret masked. | ||
| 231 | +func (s Sbx) HasSecret(ctx context.Context, service, sandbox string) (bool, error) { | ||
| 232 | + out, err := s.run(ctx, "", "secret", "ls", "--service", service) | ||
| 233 | + if err != nil { | ||
| 234 | + return false, err | ||
| 235 | + } | ||
| 236 | + for _, line := range strings.Split(out, "\n") { | ||
| 237 | + fields := strings.Fields(line) | ||
| 238 | + if len(fields) < 2 || fields[1] != service { | ||
| 239 | + continue | ||
| 240 | + } | ||
| 241 | + if fields[0] == "(global)" || fields[0] == sandbox { | ||
| 242 | + return true, nil | ||
| 243 | + } | ||
| 244 | + } | ||
| 245 | + return false, nil | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +// SetSecret stores key for service, for every sandbox: it goes to | ||
| 249 | +// `sbx secret set <service>` on its standard input, never in its arguments, | ||
| 250 | +// and an error never repeats it. | ||
| 251 | +func (s Sbx) SetSecret(ctx context.Context, service, key string) error { | ||
| 252 | + key = strings.TrimSpace(key) | ||
| 253 | + if key == "" { | ||
| 254 | + return errors.New("the key is empty") | ||
| 255 | + } | ||
| 256 | + _, err := s.run(ctx, key, "secret", "set", service) | ||
| 257 | + if err != nil { | ||
| 258 | + return errors.New(strings.ReplaceAll(err.Error(), key, "***")) | ||
| 259 | + } | ||
| 260 | + return nil | ||
| 261 | +} | ||
added
internal/sbxcreate/sbxcreate_test.go +179 -0 | new file mode 100644 | ||
| @@ -0,0 +1,179 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +package sbxcreate_test | |
| 4 | + | |
| 5 | +import ( | |
| 6 | + "context" | |
| 7 | + "errors" | |
| 8 | + "os" | |
| 9 | + "path/filepath" | |
| 10 | + "slices" | |
| 11 | + "strings" | |
| 12 | + "testing" | |
| 13 | + | |
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | |
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | |
| 16 | + "go.yaml.in/yaml/v3" | |
| 17 | +) | |
| 18 | + | |
| 19 | +// fakeSbxScript is an sbx stand-in: "ls -q" prints the file sandboxes, "secret ls" | |
| 20 | +// the file secrets, "secret set" stores its standard input in the file key | |
| 21 | +// and its arguments in calls; "secret set refuse" fails, repeating its input. | |
| 22 | +const fakeSbxScript = `#!/bin/sh | |
| 23 | +here=$(dirname "$0") | |
| 24 | +echo "$*" >> "$here/calls" | |
| 25 | +case "$1 $2" in | |
| 26 | + "ls -q") cat "$here/sandboxes" 2>/dev/null || true ;; | |
| 27 | + "secret ls") echo "SCOPE SERVICE SECRET"; cat "$here/secrets" 2>/dev/null || true ;; | |
| 28 | + "secret set") | |
| 29 | + value=$(cat) | |
| 30 | + if [ "$3" = refuse ]; then echo "invalid key $value" >&2; exit 1; fi | |
| 31 | + printf '%s' "$value" > "$here/key" ;; | |
| 32 | + *) exit 1 ;; | |
| 33 | +esac | |
| 34 | +` | |
| 35 | + | |
| 36 | +func fakeSbx(t *testing.T) (sbxcreate.Sbx, string) { | |
| 37 | + t.Helper() | |
| 38 | + dir := t.TempDir() | |
| 39 | + if err := os.WriteFile(filepath.Join(dir, "sbx"), []byte(fakeSbxScript), 0o755); err != nil { | |
| 40 | + t.Fatal(err) | |
| 41 | + } | |
| 42 | + return sbxcreate.Sbx{Command: filepath.Join(dir, "sbx")}, dir | |
| 43 | +} | |
| 44 | + | |
| 45 | +func TestTheCatalogueOffersClaudeGeminiAndCodex(t *testing.T) { | |
| 46 | + var ids []string | |
| 47 | + for _, kind := range sbxcreate.Catalogue { | |
| 48 | + ids = append(ids, kind.ID) | |
| 49 | + if kind.Title == "" || kind.Icon == "" || kind.Agent == "" || kind.Kit == "" || kind.Program == "" || kind.Service == "" || !strings.HasPrefix(kind.KeyURL, "https://") || len(kind.Bindings.APIKey) == 0 { | |
| 50 | + t.Errorf("incomplete kind: %+v", kind) | |
| 51 | + } | |
| 52 | + } | |
| 53 | + if !slices.Equal(ids, []string{"claude", "gemini", "codex"}) { | |
| 54 | + t.Fatalf("kinds: %v", ids) | |
| 55 | + } | |
| 56 | + if gemini, _ := sbxcreate.Lookup("gemini"); gemini.Agent != "antigravity" || gemini.Program != "agy acp" { | |
| 57 | + t.Fatalf("Gemini goes through Antigravity: %+v", gemini) | |
| 58 | + } | |
| 59 | + if _, ok := sbxcreate.Lookup("nope"); ok { | |
| 60 | + t.Fatal("an unknown kind") | |
| 61 | + } | |
| 62 | +} | |
| 63 | + | |
| 64 | +func TestWriteMakesTheFolderItsSbxenvAndItsWorkspace(t *testing.T) { | |
| 65 | + for _, kind := range sbxcreate.Catalogue { | |
| 66 | + folder := filepath.Join(t.TempDir(), "Documents") | |
| 67 | + dir, err := sbxcreate.Write(folder, kind, "my-"+kind.ID) | |
| 68 | + if err != nil { | |
| 69 | + t.Fatal(err) | |
| 70 | + } | |
| 71 | + if dir != filepath.Join(folder, "my-"+kind.ID) { | |
| 72 | + t.Fatalf("dir %s", dir) | |
| 73 | + } | |
| 74 | + if info, err := os.Stat(filepath.Join(dir, "workspace")); err != nil || !info.IsDir() { | |
| 75 | + t.Fatalf("%s: no workspace/: %v", kind.ID, err) | |
| 76 | + } | |
| 77 | + checkReadBack(t, kind, dir) | |
| 78 | + var file struct { | |
| 79 | + Kits []string `yaml:"kits"` | |
| 80 | + Bindings map[string]map[string]map[string][]string `yaml:"bindings"` | |
| 81 | + Options map[string]string `yaml:"sandboxOptions"` | |
| 82 | + } | |
| 83 | + content, _ := os.ReadFile(filepath.Join(dir, "sbxenv.yaml")) | |
| 84 | + if err := yaml.Unmarshal(content, &file); err != nil { | |
| 85 | + t.Fatal(err) | |
| 86 | + } | |
| 87 | + if !slices.Equal(file.Kits, []string{kind.Kit}) || !slices.Equal(file.Bindings[kind.Service]["apiKey"]["domains"], kind.Bindings.APIKey) || file.Options["pullPolicy"] != "always" { | |
| 88 | + t.Fatalf("%s:\n%s", kind.ID, content) | |
| 89 | + } | |
| 90 | + if strings.ContainsAny(string(content), "éèàç") { | |
| 91 | + t.Fatalf("%s: the comments are in English:\n%s", kind.ID, content) | |
| 92 | + } | |
| 93 | + } | |
| 94 | +} | |
| 95 | + | |
| 96 | +// checkReadBack reads the sbxenv.yaml of dir as Sidekicks does to fill the | |
| 97 | +// agent's entry. | |
| 98 | +func checkReadBack(t *testing.T, kind sbxcreate.Kind, dir string) { | |
| 99 | + t.Helper() | |
| 100 | + env, err := lifecycle.ReadSbxEnv(filepath.Join(dir, "sbxenv.yaml")) | |
| 101 | + if err != nil { | |
| 102 | + t.Fatal(err) | |
| 103 | + } | |
| 104 | + name := filepath.Base(dir) | |
| 105 | + if env.Name != name || env.Agent != kind.Agent || env.Workspace != filepath.Join(dir, "workspace") || env.Folder != dir || | |
| 106 | + !slices.Equal(env.Create, []string{"sbx", "env", "create", "--force"}) || !slices.Equal(env.Stop, []string{"sbx", "stop", name}) { | |
| 107 | + t.Fatalf("%s: %+v", kind.ID, env) | |
| 108 | + } | |
| 109 | +} | |
| 110 | + | |
| 111 | +func TestAnExistingFolderIsNeverTouchedAndNamesAreChecked(t *testing.T) { | |
| 112 | + folder := t.TempDir() | |
| 113 | + claude, _ := sbxcreate.Lookup("claude") | |
| 114 | + if err := os.MkdirAll(filepath.Join(folder, "claude"), 0o755); err != nil { | |
| 115 | + t.Fatal(err) | |
| 116 | + } | |
| 117 | + if _, err := sbxcreate.Write(folder, claude, "claude"); !errors.Is(err, sbxcreate.ErrFolderExists) { | |
| 118 | + t.Fatalf("Write: %v", err) | |
| 119 | + } | |
| 120 | + if entries, _ := os.ReadDir(filepath.Join(folder, "claude")); len(entries) != 0 { | |
| 121 | + t.Fatal("the existing folder was changed") | |
| 122 | + } | |
| 123 | + for _, name := range []string{"Claude", "my_agent", "2claude", "", strings.Repeat("a", 33)} { | |
| 124 | + if sbxcreate.ValidName(name) { | |
| 125 | + t.Errorf("%q should be refused", name) | |
| 126 | + } | |
| 127 | + } | |
| 128 | + if !sbxcreate.ValidName("claude-2") { | |
| 129 | + t.Error("claude-2 is a name") | |
| 130 | + } | |
| 131 | +} | |
| 132 | + | |
| 133 | +func TestSecretsAreCheckedAndSetThroughStandardInput(t *testing.T) { | |
| 134 | + sbx, dir := fakeSbx(t) | |
| 135 | + ctx := context.Background() | |
| 136 | + if err := os.WriteFile(filepath.Join(dir, "secrets"), []byte("(global) openai sk-****\nbob anthropic sk-****\n"), 0o644); err != nil { | |
| 137 | + t.Fatal(err) | |
| 138 | + } | |
| 139 | + for _, c := range []struct { | |
| 140 | + service, sandbox string | |
| 141 | + want bool | |
| 142 | + }{{"openai", "claude", true}, {"anthropic", "claude", false}, {"anthropic", "bob", true}, {"google", "", false}} { | |
| 143 | + if got, err := sbx.HasSecret(ctx, c.service, c.sandbox); err != nil || got != c.want { | |
| 144 | + t.Errorf("%s for %s: %v %v", c.service, c.sandbox, got, err) | |
| 145 | + } | |
| 146 | + } | |
| 147 | + if err := sbx.SetSecret(ctx, "anthropic", " sk-ant-secret\n"); err != nil { | |
| 148 | + t.Fatal(err) | |
| 149 | + } | |
| 150 | + key, _ := os.ReadFile(filepath.Join(dir, "key")) | |
| 151 | + calls, _ := os.ReadFile(filepath.Join(dir, "calls")) | |
| 152 | + if string(key) != "sk-ant-secret" || strings.Contains(string(calls), "sk-ant") || !strings.Contains(string(calls), "secret set anthropic") { | |
| 153 | + t.Fatalf("key %q, calls %q", key, calls) | |
| 154 | + } | |
| 155 | + err := sbx.SetSecret(ctx, "refuse", "sk-leak") | |
| 156 | + if err == nil || strings.Contains(err.Error(), "sk-leak") || !strings.Contains(err.Error(), "invalid key ***") { | |
| 157 | + t.Fatalf("an error must not repeat the key: %v", err) | |
| 158 | + } | |
| 159 | + if err := sbx.SetSecret(ctx, "anthropic", " "); err == nil { | |
| 160 | + t.Fatal("an empty key must be refused") | |
| 161 | + } | |
| 162 | +} | |
| 163 | + | |
| 164 | +func TestSandboxesAndAMissingSbx(t *testing.T) { | |
| 165 | + sbx, dir := fakeSbx(t) | |
| 166 | + if err := os.WriteFile(filepath.Join(dir, "sandboxes"), []byte("milo-sbx\nclaude\n"), 0o644); err != nil { | |
| 167 | + t.Fatal(err) | |
| 168 | + } | |
| 169 | + if names, err := sbx.Sandboxes(context.Background()); err != nil || !slices.Equal(names, []string{"milo-sbx", "claude"}) { | |
| 170 | + t.Fatalf("sandboxes: %v %v", names, err) | |
| 171 | + } | |
| 172 | + missing := sbxcreate.Sbx{Command: filepath.Join(t.TempDir(), "sbx")} | |
| 173 | + if err := missing.Available(); !errors.Is(err, sbxcreate.ErrSbxMissing) { | |
| 174 | + t.Fatalf("Available: %v", err) | |
| 175 | + } | |
| 176 | + if _, err := missing.HasSecret(context.Background(), "openai", ""); !errors.Is(err, sbxcreate.ErrSbxMissing) { | |
| 177 | + t.Fatalf("HasSecret: %v", err) | |
| 178 | + } | |
| 179 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,179 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +package sbxcreate_test | ||
| 4 | + | ||
| 5 | +import ( | ||
| 6 | + "context" | ||
| 7 | + "errors" | ||
| 8 | + "os" | ||
| 9 | + "path/filepath" | ||
| 10 | + "slices" | ||
| 11 | + "strings" | ||
| 12 | + "testing" | ||
| 13 | + | ||
| 14 | + "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | ||
| 15 | + "git.rickub.com/bots-garden/sidekicks/internal/sbxcreate" | ||
| 16 | + "go.yaml.in/yaml/v3" | ||
| 17 | +) | ||
| 18 | + | ||
| 19 | +// fakeSbxScript is an sbx stand-in: "ls -q" prints the file sandboxes, "secret ls" | ||
| 20 | +// the file secrets, "secret set" stores its standard input in the file key | ||
| 21 | +// and its arguments in calls; "secret set refuse" fails, repeating its input. | ||
| 22 | +const fakeSbxScript = `#!/bin/sh | ||
| 23 | +here=$(dirname "$0") | ||
| 24 | +echo "$*" >> "$here/calls" | ||
| 25 | +case "$1 $2" in | ||
| 26 | + "ls -q") cat "$here/sandboxes" 2>/dev/null || true ;; | ||
| 27 | + "secret ls") echo "SCOPE SERVICE SECRET"; cat "$here/secrets" 2>/dev/null || true ;; | ||
| 28 | + "secret set") | ||
| 29 | + value=$(cat) | ||
| 30 | + if [ "$3" = refuse ]; then echo "invalid key $value" >&2; exit 1; fi | ||
| 31 | + printf '%s' "$value" > "$here/key" ;; | ||
| 32 | + *) exit 1 ;; | ||
| 33 | +esac | ||
| 34 | +` | ||
| 35 | + | ||
| 36 | +func fakeSbx(t *testing.T) (sbxcreate.Sbx, string) { | ||
| 37 | + t.Helper() | ||
| 38 | + dir := t.TempDir() | ||
| 39 | + if err := os.WriteFile(filepath.Join(dir, "sbx"), []byte(fakeSbxScript), 0o755); err != nil { | ||
| 40 | + t.Fatal(err) | ||
| 41 | + } | ||
| 42 | + return sbxcreate.Sbx{Command: filepath.Join(dir, "sbx")}, dir | ||
| 43 | +} | ||
| 44 | + | ||
| 45 | +func TestTheCatalogueOffersClaudeGeminiAndCodex(t *testing.T) { | ||
| 46 | + var ids []string | ||
| 47 | + for _, kind := range sbxcreate.Catalogue { | ||
| 48 | + ids = append(ids, kind.ID) | ||
| 49 | + if kind.Title == "" || kind.Icon == "" || kind.Agent == "" || kind.Kit == "" || kind.Program == "" || kind.Service == "" || !strings.HasPrefix(kind.KeyURL, "https://") || len(kind.Bindings.APIKey) == 0 { | ||
| 50 | + t.Errorf("incomplete kind: %+v", kind) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + if !slices.Equal(ids, []string{"claude", "gemini", "codex"}) { | ||
| 54 | + t.Fatalf("kinds: %v", ids) | ||
| 55 | + } | ||
| 56 | + if gemini, _ := sbxcreate.Lookup("gemini"); gemini.Agent != "antigravity" || gemini.Program != "agy acp" { | ||
| 57 | + t.Fatalf("Gemini goes through Antigravity: %+v", gemini) | ||
| 58 | + } | ||
| 59 | + if _, ok := sbxcreate.Lookup("nope"); ok { | ||
| 60 | + t.Fatal("an unknown kind") | ||
| 61 | + } | ||
| 62 | +} | ||
| 63 | + | ||
| 64 | +func TestWriteMakesTheFolderItsSbxenvAndItsWorkspace(t *testing.T) { | ||
| 65 | + for _, kind := range sbxcreate.Catalogue { | ||
| 66 | + folder := filepath.Join(t.TempDir(), "Documents") | ||
| 67 | + dir, err := sbxcreate.Write(folder, kind, "my-"+kind.ID) | ||
| 68 | + if err != nil { | ||
| 69 | + t.Fatal(err) | ||
| 70 | + } | ||
| 71 | + if dir != filepath.Join(folder, "my-"+kind.ID) { | ||
| 72 | + t.Fatalf("dir %s", dir) | ||
| 73 | + } | ||
| 74 | + if info, err := os.Stat(filepath.Join(dir, "workspace")); err != nil || !info.IsDir() { | ||
| 75 | + t.Fatalf("%s: no workspace/: %v", kind.ID, err) | ||
| 76 | + } | ||
| 77 | + checkReadBack(t, kind, dir) | ||
| 78 | + var file struct { | ||
| 79 | + Kits []string `yaml:"kits"` | ||
| 80 | + Bindings map[string]map[string]map[string][]string `yaml:"bindings"` | ||
| 81 | + Options map[string]string `yaml:"sandboxOptions"` | ||
| 82 | + } | ||
| 83 | + content, _ := os.ReadFile(filepath.Join(dir, "sbxenv.yaml")) | ||
| 84 | + if err := yaml.Unmarshal(content, &file); err != nil { | ||
| 85 | + t.Fatal(err) | ||
| 86 | + } | ||
| 87 | + if !slices.Equal(file.Kits, []string{kind.Kit}) || !slices.Equal(file.Bindings[kind.Service]["apiKey"]["domains"], kind.Bindings.APIKey) || file.Options["pullPolicy"] != "always" { | ||
| 88 | + t.Fatalf("%s:\n%s", kind.ID, content) | ||
| 89 | + } | ||
| 90 | + if strings.ContainsAny(string(content), "éèàç") { | ||
| 91 | + t.Fatalf("%s: the comments are in English:\n%s", kind.ID, content) | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +// checkReadBack reads the sbxenv.yaml of dir as Sidekicks does to fill the | ||
| 97 | +// agent's entry. | ||
| 98 | +func checkReadBack(t *testing.T, kind sbxcreate.Kind, dir string) { | ||
| 99 | + t.Helper() | ||
| 100 | + env, err := lifecycle.ReadSbxEnv(filepath.Join(dir, "sbxenv.yaml")) | ||
| 101 | + if err != nil { | ||
| 102 | + t.Fatal(err) | ||
| 103 | + } | ||
| 104 | + name := filepath.Base(dir) | ||
| 105 | + if env.Name != name || env.Agent != kind.Agent || env.Workspace != filepath.Join(dir, "workspace") || env.Folder != dir || | ||
| 106 | + !slices.Equal(env.Create, []string{"sbx", "env", "create", "--force"}) || !slices.Equal(env.Stop, []string{"sbx", "stop", name}) { | ||
| 107 | + t.Fatalf("%s: %+v", kind.ID, env) | ||
| 108 | + } | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +func TestAnExistingFolderIsNeverTouchedAndNamesAreChecked(t *testing.T) { | ||
| 112 | + folder := t.TempDir() | ||
| 113 | + claude, _ := sbxcreate.Lookup("claude") | ||
| 114 | + if err := os.MkdirAll(filepath.Join(folder, "claude"), 0o755); err != nil { | ||
| 115 | + t.Fatal(err) | ||
| 116 | + } | ||
| 117 | + if _, err := sbxcreate.Write(folder, claude, "claude"); !errors.Is(err, sbxcreate.ErrFolderExists) { | ||
| 118 | + t.Fatalf("Write: %v", err) | ||
| 119 | + } | ||
| 120 | + if entries, _ := os.ReadDir(filepath.Join(folder, "claude")); len(entries) != 0 { | ||
| 121 | + t.Fatal("the existing folder was changed") | ||
| 122 | + } | ||
| 123 | + for _, name := range []string{"Claude", "my_agent", "2claude", "", strings.Repeat("a", 33)} { | ||
| 124 | + if sbxcreate.ValidName(name) { | ||
| 125 | + t.Errorf("%q should be refused", name) | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + if !sbxcreate.ValidName("claude-2") { | ||
| 129 | + t.Error("claude-2 is a name") | ||
| 130 | + } | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +func TestSecretsAreCheckedAndSetThroughStandardInput(t *testing.T) { | ||
| 134 | + sbx, dir := fakeSbx(t) | ||
| 135 | + ctx := context.Background() | ||
| 136 | + if err := os.WriteFile(filepath.Join(dir, "secrets"), []byte("(global) openai sk-****\nbob anthropic sk-****\n"), 0o644); err != nil { | ||
| 137 | + t.Fatal(err) | ||
| 138 | + } | ||
| 139 | + for _, c := range []struct { | ||
| 140 | + service, sandbox string | ||
| 141 | + want bool | ||
| 142 | + }{{"openai", "claude", true}, {"anthropic", "claude", false}, {"anthropic", "bob", true}, {"google", "", false}} { | ||
| 143 | + if got, err := sbx.HasSecret(ctx, c.service, c.sandbox); err != nil || got != c.want { | ||
| 144 | + t.Errorf("%s for %s: %v %v", c.service, c.sandbox, got, err) | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + if err := sbx.SetSecret(ctx, "anthropic", " sk-ant-secret\n"); err != nil { | ||
| 148 | + t.Fatal(err) | ||
| 149 | + } | ||
| 150 | + key, _ := os.ReadFile(filepath.Join(dir, "key")) | ||
| 151 | + calls, _ := os.ReadFile(filepath.Join(dir, "calls")) | ||
| 152 | + if string(key) != "sk-ant-secret" || strings.Contains(string(calls), "sk-ant") || !strings.Contains(string(calls), "secret set anthropic") { | ||
| 153 | + t.Fatalf("key %q, calls %q", key, calls) | ||
| 154 | + } | ||
| 155 | + err := sbx.SetSecret(ctx, "refuse", "sk-leak") | ||
| 156 | + if err == nil || strings.Contains(err.Error(), "sk-leak") || !strings.Contains(err.Error(), "invalid key ***") { | ||
| 157 | + t.Fatalf("an error must not repeat the key: %v", err) | ||
| 158 | + } | ||
| 159 | + if err := sbx.SetSecret(ctx, "anthropic", " "); err == nil { | ||
| 160 | + t.Fatal("an empty key must be refused") | ||
| 161 | + } | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | +func TestSandboxesAndAMissingSbx(t *testing.T) { | ||
| 165 | + sbx, dir := fakeSbx(t) | ||
| 166 | + if err := os.WriteFile(filepath.Join(dir, "sandboxes"), []byte("milo-sbx\nclaude\n"), 0o644); err != nil { | ||
| 167 | + t.Fatal(err) | ||
| 168 | + } | ||
| 169 | + if names, err := sbx.Sandboxes(context.Background()); err != nil || !slices.Equal(names, []string{"milo-sbx", "claude"}) { | ||
| 170 | + t.Fatalf("sandboxes: %v %v", names, err) | ||
| 171 | + } | ||
| 172 | + missing := sbxcreate.Sbx{Command: filepath.Join(t.TempDir(), "sbx")} | ||
| 173 | + if err := missing.Available(); !errors.Is(err, sbxcreate.ErrSbxMissing) { | ||
| 174 | + t.Fatalf("Available: %v", err) | ||
| 175 | + } | ||
| 176 | + if _, err := missing.HasSecret(context.Background(), "openai", ""); !errors.Is(err, sbxcreate.ErrSbxMissing) { | ||
| 177 | + t.Fatalf("HasSecret: %v", err) | ||
| 178 | + } | ||
| 179 | +} | ||
modified
main.go +1 -0 | @@ -142,6 +142,7 @@ func main() { | ||
| 142 | 142 | application.NewService(&app.WorkspaceService{Core: core}), |
| 143 | 143 | application.NewService(&app.TerminalService{Core: core}), |
| 144 | 144 | application.NewService(&app.CreatorService{Core: core}), |
| 145 | + application.NewService(&app.SbxCreatorService{Core: core}), | |
| 145 | 146 | application.NewService(&app.SystemService{}), |
| 146 | 147 | }, |
| 147 | 148 | Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)}, |
| @@ -142,6 +142,7 @@ func main() { | |||
| 142 | application.NewService(&app.WorkspaceService{Core: core}), | 142 | application.NewService(&app.WorkspaceService{Core: core}), |
| 143 | application.NewService(&app.TerminalService{Core: core}), | 143 | application.NewService(&app.TerminalService{Core: core}), |
| 144 | application.NewService(&app.CreatorService{Core: core}), | 144 | application.NewService(&app.CreatorService{Core: core}), |
| 145 | + application.NewService(&app.SbxCreatorService{Core: core}), | ||
| 145 | application.NewService(&app.SystemService{}), | 146 | application.NewService(&app.SystemService{}), |
| 146 | }, | 147 | }, |
| 147 | Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)}, | 148 | Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)}, |