#87 Assistant : l'agent.yaml du workspace du sbxenv.yaml devient l'argument de docker-agent et de mm
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
f88eb98 parent: 653ef94 modified
.memory/history.md +1 -0 | @@ -230,3 +230,4 @@ | ||
| 230 | 230 | - **2026-11-10 — same for mini-me** (owner: "the same for mini me"): `programOfSandbox` — agent: mini-me* (e.g. mini-me-kit) → mm --acp; a configuration file given before the sbxenv.yaml re-applies --config. mm stays outside sbxAgentOf (its config file is still asked, no note). Docs EN/FR: run-an-agent-in-a-sandbox, add-an-agent. |
| 231 | 231 | - **2026-11-10 — snippets mini-me-acp + #87 docker-agent in sbx** (owner: "add an example in agents/snippets, then create a ticket for docker agent too and implement it"): snippet mini-me-acp (kit docker.io/k33g/mini-me-kit:0.1.1, workspace/agent.yaml from milo's). #87: `programOfSandbox` agent docker-agent|cagent → docker-agent serve acp (built-in sbx agent, no kit: the v3 kit does not load while the built-in exists); snippet docker-agent-acp (agent.yaml with anthropic/claude-sonnet-4-5, key via sbx secret). No milestone on #87. Not tried with sbx. |
| 232 | 232 | - **2026-11-10 — #87 on the Mac**: sandbox created (sbx resolves agent: docker-agent to the kit docker.io/sbx/docker-agent), but `serve acp` without the agent file → "accepts 1 arg(s), received 0". Assistant now refuses docker-agent serve acp without a file (Missing 'agentFile'); errors.ts explains the message. |
| 233 | +- **2026-11-10 — #87 agent file from workspace** (owner: "add this argument automatically from the workspace of sbxenv.yaml"): `SandboxEnv.agentFile` = agent.yaml|agent.yml in the env workspace; the assistant uses it (or the file already dropped) for mm/docker-agent arguments. | |
| @@ -230,3 +230,4 @@ | |||
| 230 | - **2026-11-10 — same for mini-me** (owner: "the same for mini me"): `programOfSandbox` — agent: mini-me* (e.g. mini-me-kit) → mm --acp; a configuration file given before the sbxenv.yaml re-applies --config. mm stays outside sbxAgentOf (its config file is still asked, no note). Docs EN/FR: run-an-agent-in-a-sandbox, add-an-agent. | 230 | - **2026-11-10 — same for mini-me** (owner: "the same for mini me"): `programOfSandbox` — agent: mini-me* (e.g. mini-me-kit) → mm --acp; a configuration file given before the sbxenv.yaml re-applies --config. mm stays outside sbxAgentOf (its config file is still asked, no note). Docs EN/FR: run-an-agent-in-a-sandbox, add-an-agent. |
| 231 | - **2026-11-10 — snippets mini-me-acp + #87 docker-agent in sbx** (owner: "add an example in agents/snippets, then create a ticket for docker agent too and implement it"): snippet mini-me-acp (kit docker.io/k33g/mini-me-kit:0.1.1, workspace/agent.yaml from milo's). #87: `programOfSandbox` agent docker-agent|cagent → docker-agent serve acp (built-in sbx agent, no kit: the v3 kit does not load while the built-in exists); snippet docker-agent-acp (agent.yaml with anthropic/claude-sonnet-4-5, key via sbx secret). No milestone on #87. Not tried with sbx. | 231 | - **2026-11-10 — snippets mini-me-acp + #87 docker-agent in sbx** (owner: "add an example in agents/snippets, then create a ticket for docker agent too and implement it"): snippet mini-me-acp (kit docker.io/k33g/mini-me-kit:0.1.1, workspace/agent.yaml from milo's). #87: `programOfSandbox` agent docker-agent|cagent → docker-agent serve acp (built-in sbx agent, no kit: the v3 kit does not load while the built-in exists); snippet docker-agent-acp (agent.yaml with anthropic/claude-sonnet-4-5, key via sbx secret). No milestone on #87. Not tried with sbx. |
| 232 | - **2026-11-10 — #87 on the Mac**: sandbox created (sbx resolves agent: docker-agent to the kit docker.io/sbx/docker-agent), but `serve acp` without the agent file → "accepts 1 arg(s), received 0". Assistant now refuses docker-agent serve acp without a file (Missing 'agentFile'); errors.ts explains the message. | 232 | - **2026-11-10 — #87 on the Mac**: sandbox created (sbx resolves agent: docker-agent to the kit docker.io/sbx/docker-agent), but `serve acp` without the agent file → "accepts 1 arg(s), received 0". Assistant now refuses docker-agent serve acp without a file (Missing 'agentFile'); errors.ts explains the message. |
| 233 | +- **2026-11-10 — #87 agent file from workspace** (owner: "add this argument automatically from the workspace of sbxenv.yaml"): `SandboxEnv.agentFile` = agent.yaml|agent.yml in the env workspace; the assistant uses it (or the file already dropped) for mm/docker-agent arguments. | ||
modified
.tickets/issues/0087-simplifier-l-ajout-d-une-sbx-avec-docker-agent.yaml +11 -1 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-10T05:40:48.000Z |
| 9 | -updatedAt: 2026-11-10T05:54:51.000Z | |
| 9 | +updatedAt: 2026-11-10T06:03:23.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::config |
| @@ -89,3 +89,13 @@ comments: | ||
| 89 | 89 | mais l'agent s'arrête avec « Error: accepts 1 arg(s), received 0 » : l'entrée avait `serve acp` sans le fichier d'agent. |
| 90 | 90 | L'assistant refuse maintenant `docker-agent serve acp` sans fichier (problème `agentFile` dans `problemsOf`), et le |
| 91 | 91 | message d'erreur est expliqué (`error.agentFileMissing`). Doc EN + FR : la variante dans « Lancer un agent dans une sandbox sbx ». |
| 92 | + - id: 3 | |
| 93 | + author: | |
| 94 | + name: k33g | |
| 95 | + email: ph.charriere@gmail.com | |
| 96 | + createdAt: 2026-11-10T06:03:23.000Z | |
| 97 | + body: | | |
| 98 | + À la demande : le fichier d'agent est ajouté automatiquement d'après le `workspace` du `sbxenv.yaml`. | |
| 99 | + `ReadSandboxEnv` renvoie `agentFile`, l'`agent.yaml` (ou `agent.yml`) trouvé dans le workspace ; l'assistant en fait les | |
| 100 | + arguments (`serve acp …/agent.yaml` pour docker-agent, `--acp --config …/agent.yaml` pour mm), sauf si un fichier a déjà été déposé. | |
| 101 | + Exemples et doc EN + FR mis à jour. | |
| @@ -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:40:48.000Z | 8 | createdAt: 2026-11-10T05:40:48.000Z |
| 9 | -updatedAt: 2026-11-10T05:54:51.000Z | 9 | +updatedAt: 2026-11-10T06:03:23.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::config | 12 | - area::config |
| @@ -89,3 +89,13 @@ comments: | |||
| 89 | mais l'agent s'arrête avec « Error: accepts 1 arg(s), received 0 » : l'entrée avait `serve acp` sans le fichier d'agent. | 89 | mais l'agent s'arrête avec « Error: accepts 1 arg(s), received 0 » : l'entrée avait `serve acp` sans le fichier d'agent. |
| 90 | L'assistant refuse maintenant `docker-agent serve acp` sans fichier (problème `agentFile` dans `problemsOf`), et le | 90 | L'assistant refuse maintenant `docker-agent serve acp` sans fichier (problème `agentFile` dans `problemsOf`), et le |
| 91 | message d'erreur est expliqué (`error.agentFileMissing`). Doc EN + FR : la variante dans « Lancer un agent dans une sandbox sbx ». | 91 | message d'erreur est expliqué (`error.agentFileMissing`). Doc EN + FR : la variante dans « Lancer un agent dans une sandbox sbx ». |
| 92 | + - id: 3 | ||
| 93 | + author: | ||
| 94 | + name: k33g | ||
| 95 | + email: ph.charriere@gmail.com | ||
| 96 | + createdAt: 2026-11-10T06:03:23.000Z | ||
| 97 | + body: | | ||
| 98 | + À la demande : le fichier d'agent est ajouté automatiquement d'après le `workspace` du `sbxenv.yaml`. | ||
| 99 | + `ReadSandboxEnv` renvoie `agentFile`, l'`agent.yaml` (ou `agent.yml`) trouvé dans le workspace ; l'assistant en fait les | ||
| 100 | + arguments (`serve acp …/agent.yaml` pour docker-agent, `--acp --config …/agent.yaml` pour mm), sauf si un fichier a déjà été déposé. | ||
| 101 | + Exemples et doc EN + FR mis à jour. | ||
modified
agents/snippets/docker-agent-acp/README.md +1 -1 | @@ -4,7 +4,7 @@ | ||
| 4 | 4 | |
| 5 | 5 | Before starting it, store the key of the model's provider in sbx, never in a file: `sbx secret set anthropic` for the model of `agent.yaml`. |
| 6 | 6 | |
| 7 | -With the assistant: choose **In an sbx sandbox**, drop `sbxenv.yaml` (the program `docker-agent` is chosen from `agent: docker-agent`, with `serve acp`), then drop `workspace/agent.yaml` on the agent's configuration file area (the arguments become `serve acp …/agent.yaml`). | |
| 7 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `docker-agent` is chosen from `agent: docker-agent`, and its arguments are `serve acp …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | |
| 8 | 8 | |
| 9 | 9 | ```yaml |
| 10 | 10 | - name: docker-agent |
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | Before starting it, store the key of the model's provider in sbx, never in a file: `sbx secret set anthropic` for the model of `agent.yaml`. | 5 | Before starting it, store the key of the model's provider in sbx, never in a file: `sbx secret set anthropic` for the model of `agent.yaml`. |
| 6 | 6 | ||
| 7 | -With the assistant: choose **In an sbx sandbox**, drop `sbxenv.yaml` (the program `docker-agent` is chosen from `agent: docker-agent`, with `serve acp`), then drop `workspace/agent.yaml` on the agent's configuration file area (the arguments become `serve acp …/agent.yaml`). | 7 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `docker-agent` is chosen from `agent: docker-agent`, and its arguments are `serve acp …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. |
| 8 | 8 | ||
| 9 | ```yaml | 9 | ```yaml |
| 10 | - name: docker-agent | 10 | - name: docker-agent |
modified
agents/snippets/docker-agent-acp/workspace/agent.yaml +27 -12 | @@ -1,17 +1,32 @@ | ||
| 1 | -# A Docker Agent coding agent, served over ACP by Sidekicks: | |
| 2 | -# docker-agent serve acp agent.yaml | |
| 3 | -# The model is reached through sbx: store its key with `sbx secret set anthropic` | |
| 4 | -# (or change the model, e.g. openai/gpt-5-mini with `sbx secret set openai`). | |
| 1 | +providers: | |
| 2 | + llmman: | |
| 3 | + api_type: openai_chatcompletions | |
| 4 | + #base_url: http://127.0.0.1:17434/v1 | |
| 5 | + base_url: http://host.docker.internal:17434/v1 | |
| 6 | + | |
| 5 | 7 | agents: |
| 8 | + | |
| 6 | 9 | root: |
| 7 | - model: anthropic/claude-sonnet-4-5 | |
| 8 | - description: A coding agent that reads and changes the project and runs commands. | |
| 10 | + model: mellum | |
| 11 | + description: A local code agent, powered by a small LLM. | |
| 9 | 12 | instruction: | |
| 10 | - You are a coding agent working in the user's project. | |
| 11 | - Read before you change: look at the files and run the commands that tell | |
| 12 | - you how the project works. Make the smallest change that does the job, | |
| 13 | - then run the tests or the build to check it. | |
| 13 | + Your name is Ralph. You are a developer expert. | |
| 14 | + You act as a mentor and coding partner. | |
| 15 | + | |
| 16 | + # Tool discipline | |
| 17 | + | |
| 18 | + Built-in tools: | |
| 19 | + - shell: use the `shell` tool to explore the project, read files, or run commands. | |
| 20 | + Chain commands as long as it is useful, then give a clear final answer. | |
| 21 | + | |
| 22 | + # Style | |
| 23 | + | |
| 24 | + Be concise. Prefer a small, correct, compilable example over prose. | |
| 25 | + | |
| 14 | 26 | toolsets: |
| 15 | - - type: filesystem | |
| 16 | 27 | - type: shell |
| 17 | - - type: todo | |
| 28 | + | |
| 29 | +models: | |
| 30 | + mellum: | |
| 31 | + provider: llmman | |
| 32 | + model: huggingface.co/jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M | |
| @@ -1,17 +1,32 @@ | |||
| 1 | -# A Docker Agent coding agent, served over ACP by Sidekicks: | 1 | +providers: |
| 2 | -# docker-agent serve acp agent.yaml | 2 | + llmman: |
| 3 | -# The model is reached through sbx: store its key with `sbx secret set anthropic` | 3 | + api_type: openai_chatcompletions |
| 4 | -# (or change the model, e.g. openai/gpt-5-mini with `sbx secret set openai`). | 4 | + #base_url: http://127.0.0.1:17434/v1 |
| 5 | + base_url: http://host.docker.internal:17434/v1 | ||
| 6 | + | ||
| 5 | agents: | 7 | agents: |
| 8 | + | ||
| 6 | root: | 9 | root: |
| 7 | - model: anthropic/claude-sonnet-4-5 | 10 | + model: mellum |
| 8 | - description: A coding agent that reads and changes the project and runs commands. | 11 | + description: A local code agent, powered by a small LLM. |
| 9 | instruction: | | 12 | instruction: | |
| 10 | - You are a coding agent working in the user's project. | 13 | + Your name is Ralph. You are a developer expert. |
| 11 | - Read before you change: look at the files and run the commands that tell | 14 | + You act as a mentor and coding partner. |
| 12 | - you how the project works. Make the smallest change that does the job, | 15 | + |
| 13 | - then run the tests or the build to check it. | 16 | + # Tool discipline |
| 17 | + | ||
| 18 | + Built-in tools: | ||
| 19 | + - shell: use the `shell` tool to explore the project, read files, or run commands. | ||
| 20 | + Chain commands as long as it is useful, then give a clear final answer. | ||
| 21 | + | ||
| 22 | + # Style | ||
| 23 | + | ||
| 24 | + Be concise. Prefer a small, correct, compilable example over prose. | ||
| 25 | + | ||
| 14 | toolsets: | 26 | toolsets: |
| 15 | - - type: filesystem | ||
| 16 | - type: shell | 27 | - type: shell |
| 17 | - - type: todo | 28 | + |
| 29 | +models: | ||
| 30 | + mellum: | ||
| 31 | + provider: llmman | ||
| 32 | + model: huggingface.co/jetbrains/mellum2-12b-a2.5b-instruct-gguf-q4_k_m:Q4_K_M | ||
modified
agents/snippets/mini-me-acp/README.md +1 -1 | @@ -2,7 +2,7 @@ | ||
| 2 | 2 | |
| 3 | 3 | The sandbox is built from the `docker.io/k33g/mini-me-kit` kit (`agent: mini-me-kit`): mm runs in it, with `workspace/agent.yaml` as its configuration. mm talks to llmman on this computer (`host.docker.internal`), so no key is needed. |
| 4 | 4 | |
| 5 | -With the assistant: choose **In an sbx sandbox**, drop `sbxenv.yaml` (the program `mm` is chosen from `agent: mini-me-kit`), then drop `workspace/agent.yaml` on the agent's configuration file area (the arguments become `--acp --config …/agent.yaml`). | |
| 5 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `mm` is chosen from `agent: mini-me-kit`, and its arguments are `--acp --config …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. | |
| 6 | 6 | |
| 7 | 7 | ```yaml |
| 8 | 8 | - name: mini-me |
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | The sandbox is built from the `docker.io/k33g/mini-me-kit` kit (`agent: mini-me-kit`): mm runs in it, with `workspace/agent.yaml` as its configuration. mm talks to llmman on this computer (`host.docker.internal`), so no key is needed. | 3 | The sandbox is built from the `docker.io/k33g/mini-me-kit` kit (`agent: mini-me-kit`): mm runs in it, with `workspace/agent.yaml` as its configuration. mm talks to llmman on this computer (`host.docker.internal`), so no key is needed. |
| 4 | 4 | ||
| 5 | -With the assistant: choose **In an sbx sandbox**, drop `sbxenv.yaml` (the program `mm` is chosen from `agent: mini-me-kit`), then drop `workspace/agent.yaml` on the agent's configuration file area (the arguments become `--acp --config …/agent.yaml`). | 5 | +With the assistant: choose **In an sbx sandbox** and drop `sbxenv.yaml`: the program `mm` is chosen from `agent: mini-me-kit`, and its arguments are `--acp --config …/workspace/agent.yaml`, the file found in the sandbox's `workspace`. |
| 6 | 6 | ||
| 7 | ```yaml | 7 | ```yaml |
| 8 | - name: mini-me | 8 | - name: mini-me |
modified
docs/en/how-to/run-an-agent-in-a-sandbox.md +1 -1 | @@ -41,7 +41,7 @@ This guide shows how to declare an agent that runs inside a Docker sandbox (`sbx | ||
| 41 | 41 | |
| 42 | 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: |
| 43 | 43 | |
| 44 | -1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp` for a mini-me kit (`agent: mini-me-kit`; then drop the agent's configuration file to add `--config`), `docker-agent` with `serve acp` for `agent: docker-agent` (then drop its agent file too), `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). | |
| 44 | +1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp --config <file>` for a mini-me kit (`agent: mini-me-kit`), `docker-agent` with `serve acp <file>` for `agent: docker-agent` — `<file>` is the `agent.yaml` (or `agent.yml`) of the sandbox's `workspace`, or the configuration file you drop —, `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). | |
| 45 | 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: |
| 46 | 46 | |
| 47 | 47 | ```yaml |
| @@ -41,7 +41,7 @@ This guide shows how to declare an agent that runs inside a Docker sandbox (`sbx | |||
| 41 | 41 | ||
| 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: | 42 | When the sandbox is removed (by you, by `sbx rm`, after a reset of sbx), the agent can no longer start. Give Sidekicks the commands that manage the sandbox and it creates it again before starting the agent: |
| 43 | 43 | ||
| 44 | -1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp` for a mini-me kit (`agent: mini-me-kit`; then drop the agent's configuration file to add `--config`), `docker-agent` with `serve acp` for `agent: docker-agent` (then drop its agent file too), `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). | 44 | +1. With the assistant: choose **In an sbx sandbox**, then drop the sandbox's `sbxenv.yaml` on the **Recreate the sandbox when it is gone** area (or click **Choose an sbxenv.yaml…**). The sandbox name, the folder and the `sbx env` commands are filled in; change them if needed. The program follows the file's `agent:` line: `mm` with `--acp --config <file>` for a mini-me kit (`agent: mini-me-kit`), `docker-agent` with `serve acp <file>` for `agent: docker-agent` — `<file>` is the `agent.yaml` (or `agent.yml`) of the sandbox's `workspace`, or the configuration file you drop —, `claude-agent-acp`, `codex-acp` or `gemini --acp` for `claude`, `codex` or `gemini`. A program typed by hand is kept. Ready-made examples: [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) and [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (a folder each, with its `sbxenv.yaml` and the agent's file in `workspace/`). |
| 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: | 45 | 2. Or in **Settings**, add `lifecycle` to the runtime: |
| 46 | 46 | ||
| 47 | ```yaml | 47 | ```yaml |
modified
docs/fr/how-to/lancer-un-agent-dans-une-sandbox.md +1 -1 | @@ -41,7 +41,7 @@ Ce guide montre comment déclarer un agent qui tourne dans une sandbox Docker (` | ||
| 41 | 41 | |
| 42 | 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. |
| 43 | 43 | |
| 44 | -1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp` pour un kit mini-me (`agent: mini-me-kit` ; déposez ensuite le fichier de configuration de l'agent pour ajouter `--config`), `docker-agent` avec `serve acp` pour `agent: docker-agent` (déposez ensuite son fichier d'agent aussi), `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). | |
| 44 | +1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp --config <fichier>` pour un kit mini-me (`agent: mini-me-kit`), `docker-agent` avec `serve acp <fichier>` pour `agent: docker-agent` — `<fichier>` est l'`agent.yaml` (ou `agent.yml`) du `workspace` de la sandbox, ou le fichier de configuration que vous déposez —, `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). | |
| 45 | 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : |
| 46 | 46 | |
| 47 | 47 | ```yaml |
| @@ -41,7 +41,7 @@ Ce guide montre comment déclarer un agent qui tourne dans une sandbox Docker (` | |||
| 41 | 41 | ||
| 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. | 42 | Quand la sandbox est supprimée (par vous, par `sbx rm`, après une remise à zéro de sbx), l'agent ne peut plus démarrer. Donnez à Sidekicks les commandes qui gèrent la sandbox : il la recrée avant de démarrer l'agent. |
| 43 | 43 | ||
| 44 | -1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp` pour un kit mini-me (`agent: mini-me-kit` ; déposez ensuite le fichier de configuration de l'agent pour ajouter `--config`), `docker-agent` avec `serve acp` pour `agent: docker-agent` (déposez ensuite son fichier d'agent aussi), `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). | 44 | +1. Avec l'assistant : choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` de la sandbox sur la zone **Recréer la sandbox si elle a disparu** (ou cliquez sur **Choisir un sbxenv.yaml…**). Le nom de la sandbox, le dossier et les commandes `sbx env` sont remplis ; modifiez-les au besoin. Le programme suit la ligne `agent:` du fichier : `mm` avec `--acp --config <fichier>` pour un kit mini-me (`agent: mini-me-kit`), `docker-agent` avec `serve acp <fichier>` pour `agent: docker-agent` — `<fichier>` est l'`agent.yaml` (ou `agent.yml`) du `workspace` de la sandbox, ou le fichier de configuration que vous déposez —, `claude-agent-acp`, `codex-acp` ou `gemini --acp` pour `claude`, `codex` ou `gemini`. Un programme tapé à la main est gardé. Exemples prêts à l'emploi : [`agents/snippets/mini-me-acp`](../../../agents/snippets/mini-me-acp/README.md) et [`agents/snippets/docker-agent-acp`](../../../agents/snippets/docker-agent-acp/README.md) (un dossier chacun, avec son `sbxenv.yaml` et le fichier de l'agent dans `workspace/`). |
| 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : | 45 | 2. Ou dans **Settings**, ajoutez `lifecycle` au runtime : |
| 46 | 46 | ||
| 47 | ```yaml | 47 | ```yaml |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +6 -0 | @@ -164,6 +164,12 @@ export interface SandboxEnv { | ||
| 164 | 164 | * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. |
| 165 | 165 | */ |
| 166 | 166 | "agent": string; |
| 167 | + | |
| 168 | + /** | |
| 169 | + * AgentFile is the agent's configuration file found in the workspace | |
| 170 | + * (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | |
| 171 | + */ | |
| 172 | + "agentFile": string; | |
| 167 | 173 | "workspace": string; |
| 168 | 174 | "sandboxFolder": string; |
| 169 | 175 | "createCommand": string; |
| @@ -164,6 +164,12 @@ export interface SandboxEnv { | |||
| 164 | * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | 164 | * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. |
| 165 | */ | 165 | */ |
| 166 | "agent": string; | 166 | "agent": string; |
| 167 | + | ||
| 168 | + /** | ||
| 169 | + * AgentFile is the agent's configuration file found in the workspace | ||
| 170 | + * (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | ||
| 171 | + */ | ||
| 172 | + "agentFile": string; | ||
| 167 | "workspace": string; | 173 | "workspace": string; |
| 168 | "sandboxFolder": string; | 174 | "sandboxFolder": string; |
| 169 | "createCommand": string; | 175 | "createCommand": string; |
modified
frontend/src/lib/agent/AddAgentForm.svelte +10 -3 | @@ -95,9 +95,16 @@ | ||
| 95 | 95 | try { |
| 96 | 96 | const env = await ConfigService.ReadSandboxEnv(path) |
| 97 | 97 | form = withSandboxEnv(form, env) |
| 98 | - // mm chosen from the file, with its configuration file already given. | |
| 99 | - const args = configFile ? argumentsFor(form.program, configFile) : undefined | |
| 100 | - if (args !== undefined) form.arguments = args | |
| 98 | + // mm or docker-agent chosen from the file start with their configuration | |
| 99 | + // file: the one already given, or else the agent.yaml of the sandbox's | |
| 100 | + // workspace (issue #87). | |
| 101 | + const file = configFile || env.agentFile || '' | |
| 102 | + const args = file ? argumentsFor(form.program, file) : undefined | |
| 103 | + if (args !== undefined) { | |
| 104 | + form.arguments = args | |
| 105 | + configFile = file | |
| 106 | + configProblem = '' | |
| 107 | + } | |
| 101 | 108 | envFile = path |
| 102 | 109 | envAgent = env.agent ?? '' |
| 103 | 110 | } catch (error) { |
| @@ -95,9 +95,16 @@ | |||
| 95 | try { | 95 | try { |
| 96 | const env = await ConfigService.ReadSandboxEnv(path) | 96 | const env = await ConfigService.ReadSandboxEnv(path) |
| 97 | form = withSandboxEnv(form, env) | 97 | form = withSandboxEnv(form, env) |
| 98 | - // mm chosen from the file, with its configuration file already given. | 98 | + // mm or docker-agent chosen from the file start with their configuration |
| 99 | - const args = configFile ? argumentsFor(form.program, configFile) : undefined | 99 | + // file: the one already given, or else the agent.yaml of the sandbox's |
| 100 | - if (args !== undefined) form.arguments = args | 100 | + // workspace (issue #87). |
| 101 | + const file = configFile || env.agentFile || '' | ||
| 102 | + const args = file ? argumentsFor(form.program, file) : undefined | ||
| 103 | + if (args !== undefined) { | ||
| 104 | + form.arguments = args | ||
| 105 | + configFile = file | ||
| 106 | + configProblem = '' | ||
| 107 | + } | ||
| 101 | envFile = path | 108 | envFile = path |
| 102 | envAgent = env.agent ?? '' | 109 | envAgent = env.agent ?? '' |
| 103 | } catch (error) { | 110 | } catch (error) { |
modified
frontend/src/lib/agentform.ts +2 -0 | @@ -36,6 +36,8 @@ export interface SandboxEnvValues { | ||
| 36 | 36 | name: string |
| 37 | 37 | /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */ |
| 38 | 38 | agent?: string |
| 39 | + /** The agent's configuration file found in its workspace (agent.yaml), for mm and docker-agent. */ | |
| 40 | + agentFile?: string | |
| 39 | 41 | workspace: string |
| 40 | 42 | sandboxFolder: string |
| 41 | 43 | createCommand: string |
| @@ -36,6 +36,8 @@ export interface SandboxEnvValues { | |||
| 36 | name: string | 36 | name: string |
| 37 | /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */ | 37 | /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */ |
| 38 | agent?: string | 38 | agent?: string |
| 39 | + /** The agent's configuration file found in its workspace (agent.yaml), for mm and docker-agent. */ | ||
| 40 | + agentFile?: string | ||
| 39 | workspace: string | 41 | workspace: string |
| 40 | sandboxFolder: string | 42 | sandboxFolder: string |
| 41 | createCommand: string | 43 | createCommand: string |
modified
internal/app/sandboxes.go +25 -2 | @@ -7,6 +7,7 @@ import ( | ||
| 7 | 7 | "errors" |
| 8 | 8 | "fmt" |
| 9 | 9 | "os" |
| 10 | + "path/filepath" | |
| 10 | 11 | |
| 11 | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 12 | 13 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" |
| @@ -48,7 +49,10 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle. | ||
| 48 | 49 | type SandboxEnv struct { |
| 49 | 50 | Name string `json:"name"` |
| 50 | 51 | // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. |
| 51 | - Agent string `json:"agent"` | |
| 52 | + Agent string `json:"agent"` | |
| 53 | + // AgentFile is the agent's configuration file found in the workspace | |
| 54 | + // (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | |
| 55 | + AgentFile string `json:"agentFile"` | |
| 52 | 56 | Workspace string `json:"workspace"` |
| 53 | 57 | SandboxFolder string `json:"sandboxFolder"` |
| 54 | 58 | CreateCommand string `json:"createCommand"` |
| @@ -67,11 +71,30 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) { | ||
| 67 | 71 | return SandboxEnv{}, err |
| 68 | 72 | } |
| 69 | 73 | return SandboxEnv{ |
| 70 | - Name: env.Name, Agent: env.Agent, Workspace: env.Workspace, SandboxFolder: env.Folder, | |
| 74 | + Name: env.Name, Agent: env.Agent, AgentFile: agentFileIn(env.Workspace), Workspace: env.Workspace, SandboxFolder: env.Folder, | |
| 71 | 75 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), |
| 72 | 76 | }, nil |
| 73 | 77 | } |
| 74 | 78 | |
| 79 | +// agentFileNames are the names an agent's configuration file is looked for | |
| 80 | +// under in a sandbox's workspace, in this order (the snippets use agent.yaml). | |
| 81 | +var agentFileNames = []string{"agent.yaml", "agent.yml"} | |
| 82 | + | |
| 83 | +// agentFileIn returns the agent's configuration file in workspace, "" when | |
| 84 | +// there is none or no workspace. | |
| 85 | +func agentFileIn(workspace string) string { | |
| 86 | + if workspace == "" { | |
| 87 | + return "" | |
| 88 | + } | |
| 89 | + for _, name := range agentFileNames { | |
| 90 | + path := filepath.Join(workspace, name) | |
| 91 | + if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() { | |
| 92 | + return path | |
| 93 | + } | |
| 94 | + } | |
| 95 | + return "" | |
| 96 | +} | |
| 97 | + | |
| 75 | 98 | // ComposeView is a Compose file for the "add an agent" assistant: the folder |
| 76 | 99 | // the commands run in, and each service with its container and commands, on |
| 77 | 100 | // one line each, ready for the form's fields (issue #48). |
| @@ -7,6 +7,7 @@ import ( | |||
| 7 | "errors" | 7 | "errors" |
| 8 | "fmt" | 8 | "fmt" |
| 9 | "os" | 9 | "os" |
| 10 | + "path/filepath" | ||
| 10 | 11 | ||
| 11 | "git.rickub.com/bots-garden/sidekicks/internal/agents" | 12 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 12 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | 13 | "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" |
| @@ -48,7 +49,10 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle. | |||
| 48 | type SandboxEnv struct { | 49 | type SandboxEnv struct { |
| 49 | Name string `json:"name"` | 50 | Name string `json:"name"` |
| 50 | // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. | 51 | // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude. |
| 51 | - Agent string `json:"agent"` | 52 | + Agent string `json:"agent"` |
| 53 | + // AgentFile is the agent's configuration file found in the workspace | ||
| 54 | + // (agent.yaml or agent.yml), for mm and docker-agent; "" when none. | ||
| 55 | + AgentFile string `json:"agentFile"` | ||
| 52 | Workspace string `json:"workspace"` | 56 | Workspace string `json:"workspace"` |
| 53 | SandboxFolder string `json:"sandboxFolder"` | 57 | SandboxFolder string `json:"sandboxFolder"` |
| 54 | CreateCommand string `json:"createCommand"` | 58 | CreateCommand string `json:"createCommand"` |
| @@ -67,11 +71,30 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) { | |||
| 67 | return SandboxEnv{}, err | 71 | return SandboxEnv{}, err |
| 68 | } | 72 | } |
| 69 | return SandboxEnv{ | 73 | return SandboxEnv{ |
| 70 | - Name: env.Name, Agent: env.Agent, Workspace: env.Workspace, SandboxFolder: env.Folder, | 74 | + Name: env.Name, Agent: env.Agent, AgentFile: agentFileIn(env.Workspace), Workspace: env.Workspace, SandboxFolder: env.Folder, |
| 71 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), | 75 | CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove), |
| 72 | }, nil | 76 | }, nil |
| 73 | } | 77 | } |
| 74 | 78 | ||
| 79 | +// agentFileNames are the names an agent's configuration file is looked for | ||
| 80 | +// under in a sandbox's workspace, in this order (the snippets use agent.yaml). | ||
| 81 | +var agentFileNames = []string{"agent.yaml", "agent.yml"} | ||
| 82 | + | ||
| 83 | +// agentFileIn returns the agent's configuration file in workspace, "" when | ||
| 84 | +// there is none or no workspace. | ||
| 85 | +func agentFileIn(workspace string) string { | ||
| 86 | + if workspace == "" { | ||
| 87 | + return "" | ||
| 88 | + } | ||
| 89 | + for _, name := range agentFileNames { | ||
| 90 | + path := filepath.Join(workspace, name) | ||
| 91 | + if info, err := os.Stat(path); err == nil && info.Mode().IsRegular() { | ||
| 92 | + return path | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + return "" | ||
| 96 | +} | ||
| 97 | + | ||
| 75 | // ComposeView is a Compose file for the "add an agent" assistant: the folder | 98 | // ComposeView is a Compose file for the "add an agent" assistant: the folder |
| 76 | // the commands run in, and each service with its container and commands, on | 99 | // the commands run in, and each service with its container and commands, on |
| 77 | // one line each, ready for the form's fields (issue #48). | 100 | // one line each, ready for the form's fields (issue #48). |
modified
internal/app/sandboxes_test.go +8 -0 | @@ -120,6 +120,14 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) { | ||
| 120 | 120 | if env != want { |
| 121 | 121 | t.Fatalf("got %+v\nwant %+v", env, want) |
| 122 | 122 | } |
| 123 | + // The agent's configuration file in the workspace is given too (issue #87). | |
| 124 | + if err := os.MkdirAll(filepath.Join(dir, "workspace"), 0o755); err != nil { | |
| 125 | + t.Fatal(err) | |
| 126 | + } | |
| 127 | + write(t, filepath.Join(dir, "workspace", "agent.yaml"), "agents: {}\n") | |
| 128 | + if env, err := service.ReadSandboxEnv(path); err != nil || env.AgentFile != filepath.Join(dir, "workspace", "agent.yaml") { | |
| 129 | + t.Fatalf("agent file: %+v, %v", env, err) | |
| 130 | + } | |
| 123 | 131 | write(t, path, "version: 1\n") |
| 124 | 132 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { |
| 125 | 133 | t.Fatalf("another file is refused: %v", err) |
| @@ -120,6 +120,14 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) { | |||
| 120 | if env != want { | 120 | if env != want { |
| 121 | t.Fatalf("got %+v\nwant %+v", env, want) | 121 | t.Fatalf("got %+v\nwant %+v", env, want) |
| 122 | } | 122 | } |
| 123 | + // The agent's configuration file in the workspace is given too (issue #87). | ||
| 124 | + if err := os.MkdirAll(filepath.Join(dir, "workspace"), 0o755); err != nil { | ||
| 125 | + t.Fatal(err) | ||
| 126 | + } | ||
| 127 | + write(t, filepath.Join(dir, "workspace", "agent.yaml"), "agents: {}\n") | ||
| 128 | + if env, err := service.ReadSandboxEnv(path); err != nil || env.AgentFile != filepath.Join(dir, "workspace", "agent.yaml") { | ||
| 129 | + t.Fatalf("agent file: %+v, %v", env, err) | ||
| 130 | + } | ||
| 123 | write(t, path, "version: 1\n") | 131 | write(t, path, "version: 1\n") |
| 124 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { | 132 | if _, err := service.ReadSandboxEnv(path); err == nil || !strings.Contains(err.Error(), "sbxenv.yaml") { |
| 125 | t.Fatalf("another file is refused: %v", err) | 133 | t.Fatalf("another file is refused: %v", err) |