#81 Assistant : claude-agent-acp dans la liste sbx, sans cadre de préparation (le sbxenv.yaml déposé suffit)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86632e1 parent: 3f937ea modified
.tickets/issues/0081-simplifier-l-ajout-d-une-sbx-avec-claude-acp.yaml +15 -1 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-09T06:11:54.000Z |
| 9 | -updatedAt: 2026-11-09T06:56:37.000Z | |
| 9 | +updatedAt: 2026-11-09T07:06:11.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::config |
| @@ -117,3 +117,17 @@ comments: | ||
| 117 | 117 | - Vérifié dans l'application (Xvfb) : l'entrée écrite est celle du README de l'exemple. |
| 118 | 118 | - Docs EN + FR : guide #83 (voie « assistant » en premier, section « Un kit fourni par un tiers »), « Ajouter un agent », référence. |
| 119 | 119 | - Non vérifié : démarrage réel de Claude (pas de sbx ici). |
| 120 | + - id: 2 | |
| 121 | + author: | |
| 122 | + name: k33g | |
| 123 | + email: ph.charriere@gmail.com | |
| 124 | + createdAt: 2026-11-09T07:06:11.000Z | |
| 125 | + body: | | |
| 126 | + Simplifié à la demande : le cadre « Claude dans une sandbox sbx » est retiré, le `sbxenv.yaml` déposé sur | |
| 127 | + l'assistant donne déjà la sandbox, le dossier et les commandes. | |
| 128 | + - Reste : `claude-agent-acp` dans la liste **Programme** en mode sbx, une note sous le programme (kit tiers, | |
| 129 | + clé Anthropic, lien vers le guide #83) et le bloc « fichier de configuration de l'agent » caché pour Claude. | |
| 130 | + - Retiré : `ConfigService.PrepareClaudeSandbox` et ses tests, la génération du `sbxenv.yaml`. | |
| 131 | + - Guide #83 (EN + FR) : la voie « assistant » part d'une copie de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) ; | |
| 132 | + « Ajouter un agent » et la référence mis à jour. | |
| 133 | + - Vérifié dans l'application : `sbxenv.yaml` de l'exemple choisi + `claude-agent-acp` → l'entrée du README de l'exemple. | |
| @@ -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-09T06:11:54.000Z | 8 | createdAt: 2026-11-09T06:11:54.000Z |
| 9 | -updatedAt: 2026-11-09T06:56:37.000Z | 9 | +updatedAt: 2026-11-09T07:06:11.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::config | 12 | - area::config |
| @@ -117,3 +117,17 @@ comments: | |||
| 117 | - Vérifié dans l'application (Xvfb) : l'entrée écrite est celle du README de l'exemple. | 117 | - Vérifié dans l'application (Xvfb) : l'entrée écrite est celle du README de l'exemple. |
| 118 | - Docs EN + FR : guide #83 (voie « assistant » en premier, section « Un kit fourni par un tiers »), « Ajouter un agent », référence. | 118 | - Docs EN + FR : guide #83 (voie « assistant » en premier, section « Un kit fourni par un tiers »), « Ajouter un agent », référence. |
| 119 | - Non vérifié : démarrage réel de Claude (pas de sbx ici). | 119 | - Non vérifié : démarrage réel de Claude (pas de sbx ici). |
| 120 | + - id: 2 | ||
| 121 | + author: | ||
| 122 | + name: k33g | ||
| 123 | + email: ph.charriere@gmail.com | ||
| 124 | + createdAt: 2026-11-09T07:06:11.000Z | ||
| 125 | + body: | | ||
| 126 | + Simplifié à la demande : le cadre « Claude dans une sandbox sbx » est retiré, le `sbxenv.yaml` déposé sur | ||
| 127 | + l'assistant donne déjà la sandbox, le dossier et les commandes. | ||
| 128 | + - Reste : `claude-agent-acp` dans la liste **Programme** en mode sbx, une note sous le programme (kit tiers, | ||
| 129 | + clé Anthropic, lien vers le guide #83) et le bloc « fichier de configuration de l'agent » caché pour Claude. | ||
| 130 | + - Retiré : `ConfigService.PrepareClaudeSandbox` et ses tests, la génération du `sbxenv.yaml`. | ||
| 131 | + - Guide #83 (EN + FR) : la voie « assistant » part d'une copie de [agents/snippets/claude-acp](agents/snippets/claude-acp/README.md) ; | ||
| 132 | + « Ajouter un agent » et la référence mis à jour. | ||
| 133 | + - Vérifié dans l'application : `sbxenv.yaml` de l'exemple choisi + `claude-agent-acp` → l'entrée du README de l'exemple. | ||
modified
docs/en/how-to/add-a-claude-agent-in-a-sandbox.md +8 -8 | @@ -6,7 +6,7 @@ A ready-made example is in the repository: [`agents/snippets/claude-acp`](../../ | ||
| 6 | 6 | |
| 7 | 7 | ## A kit provided by a third party |
| 8 | 8 | |
| 9 | -The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only writes the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside the sandbox. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. | |
| 9 | +The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. | |
| 10 | 10 | |
| 11 | 11 | ## What you need |
| 12 | 12 | |
| @@ -16,14 +16,14 @@ The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provid | ||
| 16 | 16 | | The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. | |
| 17 | 17 | | Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. | |
| 18 | 18 | |
| 19 | -## The simplest way: let the assistant prepare the sandbox | |
| 19 | +## The simplest way: with the assistant | |
| 20 | 20 | |
| 21 | -1. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). | |
| 22 | -2. **Where does it run?** Choose **In an sbx sandbox**. | |
| 23 | -3. **Program**: choose `claude-agent-acp` in the list (it is offered in an sbx sandbox only). A **Claude in an sbx sandbox** area appears. | |
| 24 | -4. Check the **Folder of the sandbox** (`~/agents/<name>` by default, or **Choose…**) and the **Name of the sandbox** (`<name>-sbx` by default), then click **Prepare the sandbox**. Sidekicks writes `sbxenv.yaml` (the one of step 2 below) and an empty `workspace/` in that folder — an `sbxenv.yaml` already there is kept as it is — and fills in the rest of the form: the sandbox, the agent's folder (`…/workspace`), the `sbx env` commands, no arguments. | |
| 25 | -5. Click **Add the agent**. (If you click it without preparing, Sidekicks prepares the sandbox first, with the folder shown.) | |
| 26 | -6. Give your Anthropic API key to sbx (step 3 below), then start Claude (step 5 below). | |
| 21 | +1. **Prepare the folder**: copy [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/claude-acp`, or write them as in steps 1 and 2 below. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. | |
| 22 | +2. **Give your Anthropic API key to sbx** (step 3 below). | |
| 23 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). | |
| 24 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. | |
| 25 | +5. **Program**: choose `claude-agent-acp` in the list (it is offered in an sbx sandbox only). Leave **Arguments** empty. | |
| 26 | +6. Click **Add the agent**, then start Claude (step 5 below). | |
| 27 | 27 | |
| 28 | 28 | ## By hand |
| 29 | 29 | |
| @@ -6,7 +6,7 @@ A ready-made example is in the repository: [`agents/snippets/claude-acp`](../../ | |||
| 6 | 6 | ||
| 7 | ## A kit provided by a third party | 7 | ## A kit provided by a third party |
| 8 | 8 | ||
| 9 | -The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only writes the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside the sandbox. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. | 9 | +The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provided by a third party, **not by Sidekicks**: what it contains (Claude Code, `claude-agent-acp`), its updates (the sandbox pulls `latest` each time it is created) and whether it stays available depend on that third party. Sidekicks only creates the sandbox from the `sbxenv.yaml` that names it and starts `claude-agent-acp` inside it. If the kit changes or disappears, the sandbox may no longer be created, or Claude may no longer start: the **Log** tab then shows what sbx said. |
| 10 | 10 | ||
| 11 | ## What you need | 11 | ## What you need |
| 12 | 12 | ||
| @@ -16,14 +16,14 @@ The sandbox is built from the `docker.io/sbx/claude-acp` kit. This kit is provid | |||
| 16 | | The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. | | 16 | | The `docker.io/sbx/claude-acp` kit | the sandbox's image, with Claude Code and `claude-agent-acp` installed. | |
| 17 | | Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. | | 17 | | Your Anthropic API key, stored in sbx | sbx adds it to Claude's requests to Anthropic: it is written neither in the sandbox nor in Sidekicks' configuration. | |
| 18 | 18 | ||
| 19 | -## The simplest way: let the assistant prepare the sandbox | 19 | +## The simplest way: with the assistant |
| 20 | 20 | ||
| 21 | -1. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). | 21 | +1. **Prepare the folder**: copy [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (its `sbxenv.yaml` and `workspace/`) to where the agent will live, e.g. `/Users/me/agents/claude-acp`, or write them as in steps 1 and 2 below. Change `name:` in the `sbxenv.yaml` if you want another sandbox name. |
| 22 | -2. **Where does it run?** Choose **In an sbx sandbox**. | 22 | +2. **Give your Anthropic API key to sbx** (step 3 below). |
| 23 | -3. **Program**: choose `claude-agent-acp` in the list (it is offered in an sbx sandbox only). A **Claude in an sbx sandbox** area appears. | 23 | +3. In the **Agents** panel, click **+ Add an agent**. Fill in **Name shown** (`Claude`) and, if you like, an icon (📙). |
| 24 | -4. Check the **Folder of the sandbox** (`~/agents/<name>` by default, or **Choose…**) and the **Name of the sandbox** (`<name>-sbx` by default), then click **Prepare the sandbox**. Sidekicks writes `sbxenv.yaml` (the one of step 2 below) and an empty `workspace/` in that folder — an `sbxenv.yaml` already there is kept as it is — and fills in the rest of the form: the sandbox, the agent's folder (`…/workspace`), the `sbx env` commands, no arguments. | 24 | +4. **Where does it run?** Choose **In an sbx sandbox**, then drop the `sbxenv.yaml` on **Recreate the sandbox when it is gone (optional)** (or click **Choose an sbxenv.yaml…**). The sandbox, the agent's folder (`…/workspace`) and the `sbx env` commands are filled in from it. |
| 25 | -5. Click **Add the agent**. (If you click it without preparing, Sidekicks prepares the sandbox first, with the folder shown.) | 25 | +5. **Program**: choose `claude-agent-acp` in the list (it is offered in an sbx sandbox only). Leave **Arguments** empty. |
| 26 | -6. Give your Anthropic API key to sbx (step 3 below), then start Claude (step 5 below). | 26 | +6. Click **Add the agent**, then start Claude (step 5 below). |
| 27 | 27 | ||
| 28 | ## By hand | 28 | ## By hand |
| 29 | 29 | ||
modified
docs/en/how-to/add-an-agent.md +1 -1 | @@ -18,7 +18,7 @@ When the agent cannot be added (a name already used, for instance), the assistan | ||
| 18 | 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. |
| 19 | 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). |
| 20 | 20 | - **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). |
| 21 | -- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, then the program `claude-agent-acp`, and click **Prepare the sandbox**: Sidekicks writes the sandbox's `sbxenv.yaml` and its `workspace/` folder, and fills in the rest. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | |
| 21 | +- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, drop the sandbox's `sbxenv.yaml` (the sandbox, the folder and the commands are filled in), then choose the program `claude-agent-acp`, with no arguments. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | |
| 22 | 22 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. |
| 23 | 23 | |
| 24 | 24 | ## See also |
| @@ -18,7 +18,7 @@ When the agent cannot be added (a name already used, for instance), the assistan | |||
| 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. | 18 | - **On this computer**: the program runs here, in the agent's folder. If Sidekicks was opened from the Finder and does not find the program, write its full path (`which mm` in a terminal gives it). Sidekicks reads your shell's `PATH` at startup, so this is rarely needed. |
| 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). | 19 | - **In a Docker container**: give the **Container name**. The container must exist (Sidekicks starts it if it is stopped), with the agent's folder mounted at the same path, and contain the program: see [How to run an agent in a Docker container](run-an-agent-in-docker.md). Sidekicks starts the agent with `docker exec -i <container> <program> <arguments>`. To have the container recreated when it is gone, drop its `compose.yaml` on **Recreate the container when it is gone** and pick the service, or type the commands: see [Restart or recreate the container](run-an-agent-in-docker.md#restart-or-recreate-the-container). |
| 20 | - **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). | 20 | - **In an sbx sandbox**: give the **Sandbox name**. The sandbox must exist, with the agent's folder at the same path: see [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md). Sidekicks starts the agent with `sbx exec -i <sandbox> <program> <arguments>`. To have the sandbox recreated when it is gone, drop its `sbxenv.yaml` on **Recreate the sandbox when it is gone**, or type the commands: see [Recreate the sandbox when it is gone](run-an-agent-in-a-sandbox.md#recreate-the-sandbox-when-it-is-gone). |
| 21 | -- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, then the program `claude-agent-acp`, and click **Prepare the sandbox**: Sidekicks writes the sandbox's `sbxenv.yaml` and its `workspace/` folder, and fills in the rest. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). | 21 | +- **Claude in an sbx sandbox**: choose **In an sbx sandbox**, drop the sandbox's `sbxenv.yaml` (the sandbox, the folder and the commands are filled in), then choose the program `claude-agent-acp`, with no arguments. It relies on the `docker.io/sbx/claude-acp` kit, provided by a third party, not by Sidekicks. See [How to add a Claude agent in an sbx sandbox](add-a-claude-agent-in-a-sandbox.md). |
| 22 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. | 22 | - **Options the assistant does not ask for** (`env`, `afterStop`, a different `workspacePath`): add the agent with the assistant, then complete its entry in **Settings**. |
| 23 | 23 | ||
| 24 | ## See also | 24 | ## See also |
modified
docs/en/reference/agents-and-events.md +0 -1 | @@ -225,7 +225,6 @@ A file opened for editing has `path, content, version`; `version` identifies the | ||
| 225 | 225 | | `Choose()` | Shows the native file dialog and opens the chosen file; returns `""` when cancelled. | |
| 226 | 226 | | `Recent()` | The configuration files opened from the application, most recent first (8 at most). | |
| 227 | 227 | | `ReadSandboxEnv(path)` | Reads an sbx environment file for the assistant: `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commands on one line). A file that is not one is an error. | |
| 228 | -| `PrepareClaudeSandbox(folder, sandbox)` | Prepares Claude in an sbx sandbox (issue #81): in `folder` (created; `~` is the home folder; a relative folder is refused) writes `sbxenv.yaml` for the sandbox `sandbox` — the content of `agents/snippets/claude-acp`, kit `docker.io/sbx/claude-acp` (third party) — unless one is there, and creates `workspace/`. Returns what `ReadSandboxEnv` returns for it, plus `file` and `written` (false: an existing file was kept). | | |
| 229 | 228 | | `ChooseSandboxEnv()` | Shows the native file dialog, from the home folder, for an sbx environment file; returns its path, or `""` when cancelled. | |
| 230 | 229 | | `ChooseAgentConfig()` | The same, for an agent's configuration file (YAML). | |
| 231 | 230 | | `ReadCompose(path)` | Reads a Docker Compose file for the assistant: `folder`, and each service's `name, container, createCommand, stopCommand, removeCommand`. A file without services is an error. | |
| @@ -225,7 +225,6 @@ A file opened for editing has `path, content, version`; `version` identifies the | |||
| 225 | | `Choose()` | Shows the native file dialog and opens the chosen file; returns `""` when cancelled. | | 225 | | `Choose()` | Shows the native file dialog and opens the chosen file; returns `""` when cancelled. | |
| 226 | | `Recent()` | The configuration files opened from the application, most recent first (8 at most). | | 226 | | `Recent()` | The configuration files opened from the application, most recent first (8 at most). | |
| 227 | | `ReadSandboxEnv(path)` | Reads an sbx environment file for the assistant: `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commands on one line). A file that is not one is an error. | | 227 | | `ReadSandboxEnv(path)` | Reads an sbx environment file for the assistant: `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commands on one line). A file that is not one is an error. | |
| 228 | -| `PrepareClaudeSandbox(folder, sandbox)` | Prepares Claude in an sbx sandbox (issue #81): in `folder` (created; `~` is the home folder; a relative folder is refused) writes `sbxenv.yaml` for the sandbox `sandbox` — the content of `agents/snippets/claude-acp`, kit `docker.io/sbx/claude-acp` (third party) — unless one is there, and creates `workspace/`. Returns what `ReadSandboxEnv` returns for it, plus `file` and `written` (false: an existing file was kept). | | ||
| 229 | | `ChooseSandboxEnv()` | Shows the native file dialog, from the home folder, for an sbx environment file; returns its path, or `""` when cancelled. | | 228 | | `ChooseSandboxEnv()` | Shows the native file dialog, from the home folder, for an sbx environment file; returns its path, or `""` when cancelled. | |
| 230 | | `ChooseAgentConfig()` | The same, for an agent's configuration file (YAML). | | 229 | | `ChooseAgentConfig()` | The same, for an agent's configuration file (YAML). | |
| 231 | | `ReadCompose(path)` | Reads a Docker Compose file for the assistant: `folder`, and each service's `name, container, createCommand, stopCommand, removeCommand`. A file without services is an error. | | 230 | | `ReadCompose(path)` | Reads a Docker Compose file for the assistant: `folder`, and each service's `name, container, createCommand, stopCommand, removeCommand`. A file without services is an error. | |
modified
docs/fr/how-to/ajouter-un-agent-claude-dans-une-sandbox.md +8 -8 | @@ -6,7 +6,7 @@ Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/claude-acp` | ||
| 6 | 6 | |
| 7 | 7 | ## Un kit fourni par un tiers |
| 8 | 8 | |
| 9 | -La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente d'écrire le `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dans la sandbox. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | |
| 9 | +La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | |
| 10 | 10 | |
| 11 | 11 | ## Ce qu'il faut |
| 12 | 12 | |
| @@ -16,14 +16,14 @@ La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit es | ||
| 16 | 16 | | Le kit `docker.io/sbx/claude-acp` | l'image de la sandbox, avec Claude Code et `claude-agent-acp` installés. | |
| 17 | 17 | | Votre clé d'API Anthropic, enregistrée dans sbx | sbx l'ajoute aux requêtes de Claude vers Anthropic : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | |
| 18 | 18 | |
| 19 | -## Le plus simple : laisser l'assistant préparer la sandbox | |
| 19 | +## Le plus simple : avec l'assistant | |
| 20 | 20 | |
| 21 | -1. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). | |
| 22 | -2. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**. | |
| 23 | -3. **Programme** : choisissez `claude-agent-acp` dans la liste (il n'est proposé que dans une sandbox sbx). Une zone **Claude dans une sandbox sbx** apparaît. | |
| 24 | -4. Vérifiez le **Dossier de la sandbox** (`~/agents/<nom>` par défaut, ou **Choisir…**) et le **Nom de la sandbox** (`<nom>-sbx` par défaut), puis cliquez sur **Préparer la sandbox**. Sidekicks écrit `sbxenv.yaml` (celui de l'étape 2 ci-dessous) et un `workspace/` vide dans ce dossier — un `sbxenv.yaml` déjà présent est gardé tel quel — et remplit le reste du formulaire : la sandbox, le dossier de l'agent (`…/workspace`), les commandes `sbx env`, aucun argument. | |
| 25 | -5. Cliquez sur **Ajouter l'agent**. (Si vous cliquez sans avoir préparé, Sidekicks prépare d'abord la sandbox, avec le dossier affiché.) | |
| 26 | -6. Donnez votre clé d'API Anthropic à sbx (étape 3 ci-dessous), puis démarrez Claude (étape 5 ci-dessous). | |
| 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/claude-acp`, ou écrivez-les comme aux étapes 1 et 2 ci-dessous. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. | |
| 22 | +2. **Donnez votre clé d'API Anthropic à sbx** (étape 3 ci-dessous). | |
| 23 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). | |
| 24 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. | |
| 25 | +5. **Programme** : choisissez `claude-agent-acp` dans la liste (il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. | |
| 26 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Claude (étape 5 ci-dessous). | |
| 27 | 27 | |
| 28 | 28 | ## À la main |
| 29 | 29 | |
| @@ -6,7 +6,7 @@ Un exemple prêt à l'emploi est dans le dépôt : [`agents/snippets/claude-acp` | |||
| 6 | 6 | ||
| 7 | ## Un kit fourni par un tiers | 7 | ## Un kit fourni par un tiers |
| 8 | 8 | ||
| 9 | -La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente d'écrire le `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dans la sandbox. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. | 9 | +La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit est fourni par un tiers, **pas par Sidekicks** : son contenu (Claude Code, `claude-agent-acp`), ses mises à jour (la sandbox télécharge `latest` à chaque création) et sa disponibilité dépendent de ce tiers. Sidekicks se contente de créer la sandbox à partir du `sbxenv.yaml` qui le nomme et de lancer `claude-agent-acp` dedans. Si le kit change ou disparaît, la sandbox peut ne plus pouvoir être créée, ou Claude ne plus démarrer : l'onglet **Log** montre alors ce que sbx a répondu. |
| 10 | 10 | ||
| 11 | ## Ce qu'il faut | 11 | ## Ce qu'il faut |
| 12 | 12 | ||
| @@ -16,14 +16,14 @@ La sandbox est construite à partir du kit `docker.io/sbx/claude-acp`. Ce kit es | |||
| 16 | | Le kit `docker.io/sbx/claude-acp` | l'image de la sandbox, avec Claude Code et `claude-agent-acp` installés. | | 16 | | Le kit `docker.io/sbx/claude-acp` | l'image de la sandbox, avec Claude Code et `claude-agent-acp` installés. | |
| 17 | | Votre clé d'API Anthropic, enregistrée dans sbx | sbx l'ajoute aux requêtes de Claude vers Anthropic : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | | 17 | | Votre clé d'API Anthropic, enregistrée dans sbx | sbx l'ajoute aux requêtes de Claude vers Anthropic : elle n'est écrite ni dans la sandbox, ni dans la configuration de Sidekicks. | |
| 18 | 18 | ||
| 19 | -## Le plus simple : laisser l'assistant préparer la sandbox | 19 | +## Le plus simple : avec l'assistant |
| 20 | 20 | ||
| 21 | -1. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). | 21 | +1. **Préparez le dossier** : copiez [`agents/snippets/claude-acp`](../../../agents/snippets/claude-acp/) (son `sbxenv.yaml` et `workspace/`) là où vivra l'agent, par exemple `/Users/moi/agents/claude-acp`, ou écrivez-les comme aux étapes 1 et 2 ci-dessous. Changez `name:` dans le `sbxenv.yaml` si vous voulez un autre nom de sandbox. |
| 22 | -2. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**. | 22 | +2. **Donnez votre clé d'API Anthropic à sbx** (étape 3 ci-dessous). |
| 23 | -3. **Programme** : choisissez `claude-agent-acp` dans la liste (il n'est proposé que dans une sandbox sbx). Une zone **Claude dans une sandbox sbx** apparaît. | 23 | +3. Dans le panneau **Agents**, cliquez sur **+ Ajouter un agent**. Remplissez **Nom affiché** (`Claude`) et, si vous voulez, une icône (📙). |
| 24 | -4. Vérifiez le **Dossier de la sandbox** (`~/agents/<nom>` par défaut, ou **Choisir…**) et le **Nom de la sandbox** (`<nom>-sbx` par défaut), puis cliquez sur **Préparer la sandbox**. Sidekicks écrit `sbxenv.yaml` (celui de l'étape 2 ci-dessous) et un `workspace/` vide dans ce dossier — un `sbxenv.yaml` déjà présent est gardé tel quel — et remplit le reste du formulaire : la sandbox, le dossier de l'agent (`…/workspace`), les commandes `sbx env`, aucun argument. | 24 | +4. **Où tourne-t-il ?** Choisissez **Dans une sandbox sbx**, puis déposez le `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu (facultatif)** (ou cliquez sur **Choisir un sbxenv.yaml…**). La sandbox, le dossier de l'agent (`…/workspace`) et les commandes `sbx env` sont remplis à partir de lui. |
| 25 | -5. Cliquez sur **Ajouter l'agent**. (Si vous cliquez sans avoir préparé, Sidekicks prépare d'abord la sandbox, avec le dossier affiché.) | 25 | +5. **Programme** : choisissez `claude-agent-acp` dans la liste (il n'est proposé que dans une sandbox sbx). Laissez **Arguments** vide. |
| 26 | -6. Donnez votre clé d'API Anthropic à sbx (étape 3 ci-dessous), puis démarrez Claude (étape 5 ci-dessous). | 26 | +6. Cliquez sur **Ajouter l'agent**, puis démarrez Claude (étape 5 ci-dessous). |
| 27 | 27 | ||
| 28 | ## À la main | 28 | ## À la main |
| 29 | 29 | ||
modified
docs/fr/how-to/ajouter-un-agent.md +1 -1 | @@ -18,7 +18,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | ||
| 18 | 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. |
| 19 | 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). |
| 20 | 20 | - **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). |
| 21 | -- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, puis le programme `claude-agent-acp`, et cliquez sur **Préparer la sandbox** : Sidekicks écrit le `sbxenv.yaml` de la sandbox et son dossier `workspace/`, et remplit le reste. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | |
| 21 | +- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, déposez le `sbxenv.yaml` de la sandbox (la sandbox, le dossier et les commandes sont remplis), puis choisissez le programme `claude-agent-acp`, sans argument. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | |
| 22 | 22 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. |
| 23 | 23 | |
| 24 | 24 | ## Voir aussi |
| @@ -18,7 +18,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass | |||
| 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. | 18 | - **Sur cet ordinateur** : le programme tourne ici, dans le dossier de l'agent. Si Sidekicks, ouvert depuis le Finder, ne trouve pas le programme, indiquez son chemin complet (`which mm` dans un terminal le donne). Sidekicks lit le `PATH` de votre shell au démarrage : c'est rarement nécessaire. |
| 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). | 19 | - **Dans un conteneur Docker** : indiquez le **Nom du conteneur**. Le conteneur doit exister (Sidekicks le démarre s'il est arrêté), avec le dossier de l'agent monté au même chemin, et contenir le programme : voir [Lancer un agent dans un conteneur Docker](lancer-un-agent-dans-docker.md). Sidekicks démarre l'agent avec `docker exec -i <conteneur> <programme> <arguments>`. Pour que le conteneur soit recréé quand il a disparu, déposez son `compose.yaml` sur **Recréer le conteneur s'il a disparu** et choisissez le service, ou tapez les commandes : voir [Redémarrer ou recréer le conteneur](lancer-un-agent-dans-docker.md#redémarrer-ou-recréer-le-conteneur). |
| 20 | - **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). | 20 | - **Dans une sandbox sbx** : indiquez le **Nom de la sandbox**. Elle doit exister, avec le dossier de l'agent au même chemin : voir [Lancer un agent dans une sandbox sbx](lancer-un-agent-dans-une-sandbox.md). Sidekicks démarre l'agent avec `sbx exec -i <sandbox> <programme> <arguments>`. Pour que la sandbox soit recréée quand elle a disparu, déposez son `sbxenv.yaml` sur **Recréer la sandbox si elle a disparu**, ou tapez les commandes : voir [Recréer la sandbox quand elle a disparu](lancer-un-agent-dans-une-sandbox.md#recréer-la-sandbox-quand-elle-a-disparu). |
| 21 | -- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, puis le programme `claude-agent-acp`, et cliquez sur **Préparer la sandbox** : Sidekicks écrit le `sbxenv.yaml` de la sandbox et son dossier `workspace/`, et remplit le reste. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). | 21 | +- **Claude dans une sandbox sbx** : choisissez **Dans une sandbox sbx**, déposez le `sbxenv.yaml` de la sandbox (la sandbox, le dossier et les commandes sont remplis), puis choisissez le programme `claude-agent-acp`, sans argument. Cela repose sur le kit `docker.io/sbx/claude-acp`, fourni par un tiers et non par Sidekicks. Voir [Ajouter un agent Claude dans une sandbox sbx](ajouter-un-agent-claude-dans-une-sandbox.md). |
| 22 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. | 22 | - **Les options que l'assistant ne demande pas** (`env`, `afterStop`, un autre `workspacePath`) : ajoutez l'agent avec l'assistant, puis complétez son entrée dans **Settings**. |
| 23 | 23 | ||
| 24 | ## Voir aussi | 24 | ## Voir aussi |
modified
docs/fr/reference/agents-et-evenements.md +0 -1 | @@ -225,7 +225,6 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | ||
| 225 | 225 | | `Choose()` | Affiche le sélecteur de fichier natif et ouvre le fichier choisi ; renvoie `""` en cas d'annulation. | |
| 226 | 226 | | `Recent()` | Les fichiers de configuration ouverts depuis l'application, du plus récent au plus ancien (8 au plus). | |
| 227 | 227 | | `ReadSandboxEnv(path)` | Lit un fichier d'environnement sbx pour l'assistant : `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commandes sur une ligne). Un fichier qui n'en est pas un est une erreur. | |
| 228 | -| `PrepareClaudeSandbox(folder, sandbox)` | Prépare Claude dans une sandbox sbx (issue #81) : dans `folder` (créé ; `~` est le dossier personnel ; un dossier relatif est refusé) écrit le `sbxenv.yaml` de la sandbox `sandbox` — le contenu de `agents/snippets/claude-acp`, kit `docker.io/sbx/claude-acp` (fourni par un tiers) — sauf s'il en existe déjà un, et crée `workspace/`. Renvoie ce que `ReadSandboxEnv` renvoie pour lui, plus `file` et `written` (false : un fichier existant a été gardé). | | |
| 229 | 228 | | `ChooseSandboxEnv()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel, pour un fichier d'environnement sbx ; renvoie son chemin, ou `""` en cas d'annulation. | |
| 230 | 229 | | `ChooseAgentConfig()` | De même, pour le fichier de configuration d'un agent (YAML). | |
| 231 | 230 | | `ReadCompose(path)` | Lit un fichier Docker Compose pour l'assistant : `folder`, et pour chaque service `name, container, createCommand, stopCommand, removeCommand`. Un fichier sans services est une erreur. | |
| @@ -225,7 +225,6 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident | |||
| 225 | | `Choose()` | Affiche le sélecteur de fichier natif et ouvre le fichier choisi ; renvoie `""` en cas d'annulation. | | 225 | | `Choose()` | Affiche le sélecteur de fichier natif et ouvre le fichier choisi ; renvoie `""` en cas d'annulation. | |
| 226 | | `Recent()` | Les fichiers de configuration ouverts depuis l'application, du plus récent au plus ancien (8 au plus). | | 226 | | `Recent()` | Les fichiers de configuration ouverts depuis l'application, du plus récent au plus ancien (8 au plus). | |
| 227 | | `ReadSandboxEnv(path)` | Lit un fichier d'environnement sbx pour l'assistant : `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commandes sur une ligne). Un fichier qui n'en est pas un est une erreur. | | 227 | | `ReadSandboxEnv(path)` | Lit un fichier d'environnement sbx pour l'assistant : `name, workspace, sandboxFolder, createCommand, stopCommand, removeCommand` (commandes sur une ligne). Un fichier qui n'en est pas un est une erreur. | |
| 228 | -| `PrepareClaudeSandbox(folder, sandbox)` | Prépare Claude dans une sandbox sbx (issue #81) : dans `folder` (créé ; `~` est le dossier personnel ; un dossier relatif est refusé) écrit le `sbxenv.yaml` de la sandbox `sandbox` — le contenu de `agents/snippets/claude-acp`, kit `docker.io/sbx/claude-acp` (fourni par un tiers) — sauf s'il en existe déjà un, et crée `workspace/`. Renvoie ce que `ReadSandboxEnv` renvoie pour lui, plus `file` et `written` (false : un fichier existant a été gardé). | | ||
| 229 | | `ChooseSandboxEnv()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel, pour un fichier d'environnement sbx ; renvoie son chemin, ou `""` en cas d'annulation. | | 228 | | `ChooseSandboxEnv()` | Affiche le sélecteur de fichier natif, depuis le dossier personnel, pour un fichier d'environnement sbx ; renvoie son chemin, ou `""` en cas d'annulation. | |
| 230 | | `ChooseAgentConfig()` | De même, pour le fichier de configuration d'un agent (YAML). | | 229 | | `ChooseAgentConfig()` | De même, pour le fichier de configuration d'un agent (YAML). | |
| 231 | | `ReadCompose(path)` | Lit un fichier Docker Compose pour l'assistant : `folder`, et pour chaque service `name, container, createCommand, stopCommand, removeCommand`. Un fichier sans services est une erreur. | | 230 | | `ReadCompose(path)` | Lit un fichier Docker Compose pour l'assistant : `folder`, et pour chaque service `name, container, createCommand, stopCommand, removeCommand`. Un fichier sans services est une erreur. | |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/configservice.ts +0 -14 | @@ -94,20 +94,6 @@ export function Open(path: string): $CancellablePromise<void> { | ||
| 94 | 94 | return $Call.ByID(1253958173, path); |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -/** | |
| 98 | - * PrepareClaudeSandbox prepares a Claude agent in an sbx sandbox (issue | |
| 99 | - * #81): in folder (created if needed, "~" is the home folder) it writes the | |
| 100 | - * sbxenv.yaml of a sandbox called sandbox, unless one is already there, and | |
| 101 | - * creates the workspace/ folder Claude works in. It returns what the | |
| 102 | - * assistant fills in, as when an sbxenv.yaml is dropped on it. | |
| 103 | - * | |
| 104 | - * prepared, err := service.PrepareClaudeSandbox("~/agents/claude", "claude-sbx") | |
| 105 | - * // prepared.Workspace == "/Users/me/agents/claude/workspace", prepared.CreateCommand == "sbx env create --force" | |
| 106 | - */ | |
| 107 | -export function PrepareClaudeSandbox(folder: string, sandbox: string): $CancellablePromise<$models.PreparedSandbox> { | |
| 108 | - return $Call.ByID(1375109349, folder, sandbox); | |
| 109 | -} | |
| 110 | - | |
| 111 | 97 | /** |
| 112 | 98 | * ReadCompose reads the Docker Compose file at path (dropped on the |
| 113 | 99 | * assistant, or chosen with ChooseCompose). |
| @@ -94,20 +94,6 @@ export function Open(path: string): $CancellablePromise<void> { | |||
| 94 | return $Call.ByID(1253958173, path); | 94 | return $Call.ByID(1253958173, path); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | -/** | ||
| 98 | - * PrepareClaudeSandbox prepares a Claude agent in an sbx sandbox (issue | ||
| 99 | - * #81): in folder (created if needed, "~" is the home folder) it writes the | ||
| 100 | - * sbxenv.yaml of a sandbox called sandbox, unless one is already there, and | ||
| 101 | - * creates the workspace/ folder Claude works in. It returns what the | ||
| 102 | - * assistant fills in, as when an sbxenv.yaml is dropped on it. | ||
| 103 | - * | ||
| 104 | - * prepared, err := service.PrepareClaudeSandbox("~/agents/claude", "claude-sbx") | ||
| 105 | - * // prepared.Workspace == "/Users/me/agents/claude/workspace", prepared.CreateCommand == "sbx env create --force" | ||
| 106 | - */ | ||
| 107 | -export function PrepareClaudeSandbox(folder: string, sandbox: string): $CancellablePromise<$models.PreparedSandbox> { | ||
| 108 | - return $Call.ByID(1375109349, folder, sandbox); | ||
| 109 | -} | ||
| 110 | - | ||
| 111 | /** | 97 | /** |
| 112 | * ReadCompose reads the Docker Compose file at path (dropped on the | 98 | * ReadCompose reads the Docker Compose file at path (dropped on the |
| 113 | * assistant, or chosen with ChooseCompose). | 99 | * assistant, or chosen with ChooseCompose). |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/index.ts +0 -1 | @@ -23,7 +23,6 @@ export type { | ||
| 23 | 23 | ConfigView, |
| 24 | 24 | LinkedFile, |
| 25 | 25 | OlderView, |
| 26 | - PreparedSandbox, | |
| 27 | 26 | ProblemView, |
| 28 | 27 | ResetResult, |
| 29 | 28 | SandboxEnv, |
| @@ -23,7 +23,6 @@ export type { | |||
| 23 | ConfigView, | 23 | ConfigView, |
| 24 | LinkedFile, | 24 | LinkedFile, |
| 25 | OlderView, | 25 | OlderView, |
| 26 | - PreparedSandbox, | ||
| 27 | ProblemView, | 26 | ProblemView, |
| 28 | ResetResult, | 27 | ResetResult, |
| 29 | SandboxEnv, | 28 | SandboxEnv, |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +0 -16 | @@ -135,22 +135,6 @@ export interface OlderView { | ||
| 135 | 135 | "more": boolean; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | -/** | |
| 139 | - * PreparedSandbox is a sandbox prepared by PrepareClaudeSandbox: what the | |
| 140 | - * assistant fills in, and whether the sbxenv.yaml was written or was | |
| 141 | - * already there (it is never overwritten). | |
| 142 | - */ | |
| 143 | -export interface PreparedSandbox { | |
| 144 | - "name": string; | |
| 145 | - "workspace": string; | |
| 146 | - "sandboxFolder": string; | |
| 147 | - "createCommand": string; | |
| 148 | - "stopCommand": string; | |
| 149 | - "removeCommand": string; | |
| 150 | - "file": string; | |
| 151 | - "written": boolean; | |
| 152 | -} | |
| 153 | - | |
| 154 | 138 | /** |
| 155 | 139 | * ProblemView is a problem of the text being edited, located for the editor. |
| 156 | 140 | */ |
| @@ -135,22 +135,6 @@ export interface OlderView { | |||
| 135 | "more": boolean; | 135 | "more": boolean; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | -/** | ||
| 139 | - * PreparedSandbox is a sandbox prepared by PrepareClaudeSandbox: what the | ||
| 140 | - * assistant fills in, and whether the sbxenv.yaml was written or was | ||
| 141 | - * already there (it is never overwritten). | ||
| 142 | - */ | ||
| 143 | -export interface PreparedSandbox { | ||
| 144 | - "name": string; | ||
| 145 | - "workspace": string; | ||
| 146 | - "sandboxFolder": string; | ||
| 147 | - "createCommand": string; | ||
| 148 | - "stopCommand": string; | ||
| 149 | - "removeCommand": string; | ||
| 150 | - "file": string; | ||
| 151 | - "written": boolean; | ||
| 152 | -} | ||
| 153 | - | ||
| 154 | /** | 138 | /** |
| 155 | * ProblemView is a problem of the text being edited, located for the editor. | 139 | * ProblemView is a problem of the text being edited, located for the editor. |
| 156 | */ | 140 | */ |
modified
frontend/src/lib/agent/AddAgentForm.svelte +5 -77 | @@ -7,7 +7,7 @@ | ||
| 7 | 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 9 | 9 | import { FilesDropped } from '../../../bindings/events' |
| 10 | - import { argumentsFor, emptyForm, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, sandboxNameFor, withAgentConfig, withComposeService, withPreparedSandbox, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | |
| 10 | + import { argumentsFor, emptyForm, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | |
| 11 | 11 | import { subscribe } from '../events' |
| 12 | 12 | import AgentAvatar from './AgentAvatar.svelte' |
| 13 | 13 | import { agentAdded, appState } from '../state.svelte' |
| @@ -100,54 +100,10 @@ | ||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | - // Claude in an sbx sandbox (issue #81): Sidekicks writes the sandbox's | |
| 104 | - // sbxenv.yaml and its workspace/ folder, then fills the form from them. | |
| 105 | - // The folder and the sandbox follow the agent's name until edited. | |
| 106 | - let claudeFolder = $state('') | |
| 107 | - let claudeSandbox = $state('') | |
| 108 | - let claudeFolderEdited = $state(false) | |
| 109 | - let claudeSandboxEdited = $state(false) | |
| 110 | - let preparing = $state(false) | |
| 111 | - let prepared = $state<{ file: string; written: boolean } | null>(null) | |
| 112 | - let prepareProblem = $state('') | |
| 103 | + // Claude in an sbx sandbox (issue #81): its sbxenv.yaml, dropped above, | |
| 104 | + // gives the sandbox; claude-agent-acp needs no configuration file. | |
| 113 | 105 | const claude = $derived(isClaudeSandbox(form)) |
| 114 | 106 | |
| 115 | - $effect(() => { | |
| 116 | - const name = form.name.trim() || 'claude' | |
| 117 | - if (!claudeFolderEdited) claudeFolder = `~/agents/${name}` | |
| 118 | - if (!claudeSandboxEdited) claudeSandbox = sandboxNameFor(name) | |
| 119 | - }) | |
| 120 | - | |
| 121 | - async function chooseClaudeFolder() { | |
| 122 | - try { | |
| 123 | - const folder = await ConfigService.ChooseFolder() | |
| 124 | - if (folder) { | |
| 125 | - claudeFolder = folder | |
| 126 | - claudeFolderEdited = true | |
| 127 | - } | |
| 128 | - } catch (error) { | |
| 129 | - prepareProblem = error instanceof Error ? error.message : String(error) | |
| 130 | - } | |
| 131 | - } | |
| 132 | - | |
| 133 | - async function prepareClaude(): Promise<boolean> { | |
| 134 | - prepareProblem = '' | |
| 135 | - preparing = true | |
| 136 | - try { | |
| 137 | - const result = await ConfigService.PrepareClaudeSandbox(claudeFolder, claudeSandbox) | |
| 138 | - form = withPreparedSandbox(form, result) | |
| 139 | - envFile = result.file | |
| 140 | - envProblem = '' | |
| 141 | - prepared = { file: result.file, written: result.written } | |
| 142 | - return true | |
| 143 | - } catch (error) { | |
| 144 | - prepareProblem = error instanceof Error ? error.message : String(error) | |
| 145 | - return false | |
| 146 | - } finally { | |
| 147 | - preparing = false | |
| 148 | - } | |
| 149 | - } | |
| 150 | - | |
| 151 | 107 | function useAgentConfig(path: string) { |
| 152 | 108 | if (!/\.ya?ml$/i.test(path)) { |
| 153 | 109 | configProblem = t('assistant.agentConfig.notYaml') |
| @@ -188,8 +144,6 @@ | ||
| 188 | 144 | tried = true |
| 189 | 145 | refused = [] |
| 190 | 146 | failure = '' |
| 191 | - // Claude in a sandbox not prepared yet: prepare it now, with the folder shown. | |
| 192 | - if (claude && !prepared && !(await prepareClaude())) return | |
| 193 | 147 | if (missing.length > 0) return |
| 194 | 148 | adding = true |
| 195 | 149 | try { |
| @@ -313,31 +267,7 @@ | ||
| 313 | 267 | <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : form.environment === 'sbx' ? t('assistant.programHintSbx') : t('assistant.programHint')}</small> |
| 314 | 268 | </label> |
| 315 | 269 | {#if claude} |
| 316 | - <div class="claude"> | |
| 317 | - <p> | |
| 318 | - <strong>{t('assistant.claude.title')}</strong> | |
| 319 | - <small>{t('assistant.claude.intro')}</small> | |
| 320 | - <small>{t('assistant.claude.thirdParty')}</small> | |
| 321 | - </p> | |
| 322 | - <label for="claude-folder">{t('assistant.claude.folder')}</label> | |
| 323 | - <div class="row centered"> | |
| 324 | - <input id="claude-folder" class="grow" bind:value={claudeFolder} oninput={() => { claudeFolderEdited = true; prepared = null }} spellcheck="false" autocapitalize="off" /> | |
| 325 | - <button type="button" onclick={chooseClaudeFolder}>{t('assistant.choose')}</button> | |
| 326 | - </div> | |
| 327 | - <label> | |
| 328 | - {t('assistant.claude.sandbox')} | |
| 329 | - <input bind:value={claudeSandbox} oninput={() => { claudeSandboxEdited = true; prepared = null }} spellcheck="false" autocapitalize="off" /> | |
| 330 | - </label> | |
| 331 | - <div class="row centered"> | |
| 332 | - <button type="button" class="primary" onclick={prepareClaude} disabled={preparing}>{preparing ? t('assistant.claude.preparing') : t('assistant.claude.prepare')}</button> | |
| 333 | - {#if prepareProblem} | |
| 334 | - <small class="problem grow" role="alert">{t('assistant.claude.failed', { error: prepareProblem })}</small> | |
| 335 | - {:else if prepared} | |
| 336 | - <small class="grow" role="status">{prepared.written ? t('assistant.claude.written', { file: prepared.file }) : t('assistant.claude.kept', { file: prepared.file })}</small> | |
| 337 | - {/if} | |
| 338 | - </div> | |
| 339 | - <small>{t('assistant.claude.key')}</small> | |
| 340 | - </div> | |
| 270 | + <small class="note">{t('assistant.claudeNote')}</small> | |
| 341 | 271 | {/if} |
| 342 | 272 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the |
| 343 | 273 | same path, and so must the container (as with docker exec today), so |
| @@ -418,9 +348,7 @@ | ||
| 418 | 348 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } |
| 419 | 349 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } |
| 420 | 350 | .actions { display: flex; justify-content: flex-end; gap: 8px; } |
| 421 | - .claude { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; } | |
| 422 | - .claude p { margin: 0; display: flex; flex-direction: column; gap: 2px; } | |
| 423 | - .claude small { overflow-wrap: anywhere; } | |
| 424 | 351 | .hidden { display: none; } |
| 352 | + .note { margin-top: -4px; } | |
| 425 | 353 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } |
| 426 | 354 | </style> |
| @@ -7,7 +7,7 @@ | |||
| 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 7 | import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | 8 | import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 9 | import { FilesDropped } from '../../../bindings/events' | 9 | import { FilesDropped } from '../../../bindings/events' |
| 10 | - import { argumentsFor, emptyForm, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, sandboxNameFor, withAgentConfig, withComposeService, withPreparedSandbox, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' | 10 | + import { argumentsFor, emptyForm, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform' |
| 11 | import { subscribe } from '../events' | 11 | import { subscribe } from '../events' |
| 12 | import AgentAvatar from './AgentAvatar.svelte' | 12 | import AgentAvatar from './AgentAvatar.svelte' |
| 13 | import { agentAdded, appState } from '../state.svelte' | 13 | import { agentAdded, appState } from '../state.svelte' |
| @@ -100,54 +100,10 @@ | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | 102 | ||
| 103 | - // Claude in an sbx sandbox (issue #81): Sidekicks writes the sandbox's | 103 | + // Claude in an sbx sandbox (issue #81): its sbxenv.yaml, dropped above, |
| 104 | - // sbxenv.yaml and its workspace/ folder, then fills the form from them. | 104 | + // gives the sandbox; claude-agent-acp needs no configuration file. |
| 105 | - // The folder and the sandbox follow the agent's name until edited. | ||
| 106 | - let claudeFolder = $state('') | ||
| 107 | - let claudeSandbox = $state('') | ||
| 108 | - let claudeFolderEdited = $state(false) | ||
| 109 | - let claudeSandboxEdited = $state(false) | ||
| 110 | - let preparing = $state(false) | ||
| 111 | - let prepared = $state<{ file: string; written: boolean } | null>(null) | ||
| 112 | - let prepareProblem = $state('') | ||
| 113 | const claude = $derived(isClaudeSandbox(form)) | 105 | const claude = $derived(isClaudeSandbox(form)) |
| 114 | 106 | ||
| 115 | - $effect(() => { | ||
| 116 | - const name = form.name.trim() || 'claude' | ||
| 117 | - if (!claudeFolderEdited) claudeFolder = `~/agents/${name}` | ||
| 118 | - if (!claudeSandboxEdited) claudeSandbox = sandboxNameFor(name) | ||
| 119 | - }) | ||
| 120 | - | ||
| 121 | - async function chooseClaudeFolder() { | ||
| 122 | - try { | ||
| 123 | - const folder = await ConfigService.ChooseFolder() | ||
| 124 | - if (folder) { | ||
| 125 | - claudeFolder = folder | ||
| 126 | - claudeFolderEdited = true | ||
| 127 | - } | ||
| 128 | - } catch (error) { | ||
| 129 | - prepareProblem = error instanceof Error ? error.message : String(error) | ||
| 130 | - } | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - async function prepareClaude(): Promise<boolean> { | ||
| 134 | - prepareProblem = '' | ||
| 135 | - preparing = true | ||
| 136 | - try { | ||
| 137 | - const result = await ConfigService.PrepareClaudeSandbox(claudeFolder, claudeSandbox) | ||
| 138 | - form = withPreparedSandbox(form, result) | ||
| 139 | - envFile = result.file | ||
| 140 | - envProblem = '' | ||
| 141 | - prepared = { file: result.file, written: result.written } | ||
| 142 | - return true | ||
| 143 | - } catch (error) { | ||
| 144 | - prepareProblem = error instanceof Error ? error.message : String(error) | ||
| 145 | - return false | ||
| 146 | - } finally { | ||
| 147 | - preparing = false | ||
| 148 | - } | ||
| 149 | - } | ||
| 150 | - | ||
| 151 | function useAgentConfig(path: string) { | 107 | function useAgentConfig(path: string) { |
| 152 | if (!/\.ya?ml$/i.test(path)) { | 108 | if (!/\.ya?ml$/i.test(path)) { |
| 153 | configProblem = t('assistant.agentConfig.notYaml') | 109 | configProblem = t('assistant.agentConfig.notYaml') |
| @@ -188,8 +144,6 @@ | |||
| 188 | tried = true | 144 | tried = true |
| 189 | refused = [] | 145 | refused = [] |
| 190 | failure = '' | 146 | failure = '' |
| 191 | - // Claude in a sandbox not prepared yet: prepare it now, with the folder shown. | ||
| 192 | - if (claude && !prepared && !(await prepareClaude())) return | ||
| 193 | if (missing.length > 0) return | 147 | if (missing.length > 0) return |
| 194 | adding = true | 148 | adding = true |
| 195 | try { | 149 | try { |
| @@ -313,31 +267,7 @@ | |||
| 313 | <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : form.environment === 'sbx' ? t('assistant.programHintSbx') : t('assistant.programHint')}</small> | 267 | <small id="program-hint" class:problem={has('program')}>{has('program') ? t('assistant.missing.program') : form.environment === 'sbx' ? t('assistant.programHintSbx') : t('assistant.programHint')}</small> |
| 314 | </label> | 268 | </label> |
| 315 | {#if claude} | 269 | {#if claude} |
| 316 | - <div class="claude"> | 270 | + <small class="note">{t('assistant.claudeNote')}</small> |
| 317 | - <p> | ||
| 318 | - <strong>{t('assistant.claude.title')}</strong> | ||
| 319 | - <small>{t('assistant.claude.intro')}</small> | ||
| 320 | - <small>{t('assistant.claude.thirdParty')}</small> | ||
| 321 | - </p> | ||
| 322 | - <label for="claude-folder">{t('assistant.claude.folder')}</label> | ||
| 323 | - <div class="row centered"> | ||
| 324 | - <input id="claude-folder" class="grow" bind:value={claudeFolder} oninput={() => { claudeFolderEdited = true; prepared = null }} spellcheck="false" autocapitalize="off" /> | ||
| 325 | - <button type="button" onclick={chooseClaudeFolder}>{t('assistant.choose')}</button> | ||
| 326 | - </div> | ||
| 327 | - <label> | ||
| 328 | - {t('assistant.claude.sandbox')} | ||
| 329 | - <input bind:value={claudeSandbox} oninput={() => { claudeSandboxEdited = true; prepared = null }} spellcheck="false" autocapitalize="off" /> | ||
| 330 | - </label> | ||
| 331 | - <div class="row centered"> | ||
| 332 | - <button type="button" class="primary" onclick={prepareClaude} disabled={preparing}>{preparing ? t('assistant.claude.preparing') : t('assistant.claude.prepare')}</button> | ||
| 333 | - {#if prepareProblem} | ||
| 334 | - <small class="problem grow" role="alert">{t('assistant.claude.failed', { error: prepareProblem })}</small> | ||
| 335 | - {:else if prepared} | ||
| 336 | - <small class="grow" role="status">{prepared.written ? t('assistant.claude.written', { file: prepared.file }) : t('assistant.claude.kept', { file: prepared.file })}</small> | ||
| 337 | - {/if} | ||
| 338 | - </div> | ||
| 339 | - <small>{t('assistant.claude.key')}</small> | ||
| 340 | - </div> | ||
| 341 | {/if} | 271 | {/if} |
| 342 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the | 272 | <!-- Wherever the agent runs: sbx mounts the shared host folders at the |
| 343 | same path, and so must the container (as with docker exec today), so | 273 | same path, and so must the container (as with docker exec today), so |
| @@ -418,9 +348,7 @@ | |||
| 418 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } | 348 | :global(.dropzone.file-drop-target-active) { border-color: var(--accent); background: var(--bg); } |
| 419 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } | 349 | :global(.dropzone.file-drop-target-active) .drop { color: var(--accent); } |
| 420 | .actions { display: flex; justify-content: flex-end; gap: 8px; } | 350 | .actions { display: flex; justify-content: flex-end; gap: 8px; } |
| 421 | - .claude { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--accent); border-radius: var(--radius); padding: 10px 12px; } | ||
| 422 | - .claude p { margin: 0; display: flex; flex-direction: column; gap: 2px; } | ||
| 423 | - .claude small { overflow-wrap: anywhere; } | ||
| 424 | .hidden { display: none; } | 351 | .hidden { display: none; } |
| 352 | + .note { margin-top: -4px; } | ||
| 425 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } | 353 | .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } |
| 426 | </style> | 354 | </style> |
modified
frontend/src/lib/agentform.test.ts +1 -18 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, sandboxNameFor, withAgentConfig, withComposeService, withPreparedSandbox, withSandboxEnv } from './agentform' | |
| 4 | +import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' | |
| 5 | 5 | |
| 6 | 6 | describe('nameFromTitle', () => { |
| 7 | 7 | it('folds accents, lowercases and joins words', () => { |
| @@ -110,21 +110,4 @@ describe('Claude in an sbx sandbox (issue #81)', () => { | ||
| 110 | 110 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'sbx', program: ' claude-agent-acp ' })).toBe(true) |
| 111 | 111 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'local', program: 'claude-agent-acp' })).toBe(false) |
| 112 | 112 | }) |
| 113 | - | |
| 114 | - it('proposes a sandbox name', () => { | |
| 115 | - expect(sandboxNameFor('claude')).toBe('claude-sbx') | |
| 116 | - expect(sandboxNameFor(' ')).toBe('claude-sbx') | |
| 117 | - }) | |
| 118 | - | |
| 119 | - it('fills the form from the prepared sandbox', () => { | |
| 120 | - const form = { ...emptyForm(), name: 'claude', program: 'claude-agent-acp', arguments: '--old', workspace: '/somewhere' } | |
| 121 | - const filled = withPreparedSandbox(form, { | |
| 122 | - name: 'claude-sbx', workspace: '/agents/claude/workspace', sandboxFolder: '/agents/claude', | |
| 123 | - createCommand: 'sbx env create --force', stopCommand: 'sbx stop claude-sbx', removeCommand: 'sbx env rm --force', | |
| 124 | - }) | |
| 125 | - expect(filled).toMatchObject({ | |
| 126 | - environment: 'sbx', box: 'claude-sbx', workspace: '/agents/claude/workspace', arguments: '', sandboxFolder: '/agents/claude', | |
| 127 | - createCommand: 'sbx env create --force', stopCommand: 'sbx stop claude-sbx', removeCommand: 'sbx env rm --force', | |
| 128 | - }) | |
| 129 | - }) | |
| 130 | 113 | }) |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, sandboxNameFor, withAgentConfig, withComposeService, withPreparedSandbox, withSandboxEnv } from './agentform' | 4 | +import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform' |
| 5 | 5 | ||
| 6 | describe('nameFromTitle', () => { | 6 | describe('nameFromTitle', () => { |
| 7 | it('folds accents, lowercases and joins words', () => { | 7 | it('folds accents, lowercases and joins words', () => { |
| @@ -110,21 +110,4 @@ describe('Claude in an sbx sandbox (issue #81)', () => { | |||
| 110 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'sbx', program: ' claude-agent-acp ' })).toBe(true) | 110 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'sbx', program: ' claude-agent-acp ' })).toBe(true) |
| 111 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'local', program: 'claude-agent-acp' })).toBe(false) | 111 | expect(isClaudeSandbox({ ...emptyForm(), environment: 'local', program: 'claude-agent-acp' })).toBe(false) |
| 112 | }) | 112 | }) |
| 113 | - | ||
| 114 | - it('proposes a sandbox name', () => { | ||
| 115 | - expect(sandboxNameFor('claude')).toBe('claude-sbx') | ||
| 116 | - expect(sandboxNameFor(' ')).toBe('claude-sbx') | ||
| 117 | - }) | ||
| 118 | - | ||
| 119 | - it('fills the form from the prepared sandbox', () => { | ||
| 120 | - const form = { ...emptyForm(), name: 'claude', program: 'claude-agent-acp', arguments: '--old', workspace: '/somewhere' } | ||
| 121 | - const filled = withPreparedSandbox(form, { | ||
| 122 | - name: 'claude-sbx', workspace: '/agents/claude/workspace', sandboxFolder: '/agents/claude', | ||
| 123 | - createCommand: 'sbx env create --force', stopCommand: 'sbx stop claude-sbx', removeCommand: 'sbx env rm --force', | ||
| 124 | - }) | ||
| 125 | - expect(filled).toMatchObject({ | ||
| 126 | - environment: 'sbx', box: 'claude-sbx', workspace: '/agents/claude/workspace', arguments: '', sandboxFolder: '/agents/claude', | ||
| 127 | - createCommand: 'sbx env create --force', stopCommand: 'sbx stop claude-sbx', removeCommand: 'sbx env rm --force', | ||
| 128 | - }) | ||
| 129 | - }) | ||
| 130 | }) | 113 | }) |
modified
frontend/src/lib/agentform.ts +3 -26 | @@ -115,7 +115,8 @@ export const claudeProgram = 'claude-agent-acp' | ||
| 115 | 115 | |
| 116 | 116 | /** |
| 117 | 117 | * The programs the "Program" field offers where the agent runs: in an sbx |
| 118 | - * sandbox, also claude-agent-acp, whose sandbox Sidekicks can prepare. | |
| 118 | + * sandbox, also claude-agent-acp (Claude Code's ACP adapter, in the | |
| 119 | + * docker.io/sbx/claude-acp kit). | |
| 119 | 120 | * |
| 120 | 121 | * @example |
| 121 | 122 | * programsFor('sbx') // ['mm', 'docker-agent', 'docker agent', 'claude-agent-acp'] |
| @@ -124,35 +125,11 @@ export function programsFor(environment: Environment): string[] { | ||
| 124 | 125 | return environment === 'sbx' ? [...knownPrograms, claudeProgram] : [...knownPrograms] |
| 125 | 126 | } |
| 126 | 127 | |
| 127 | -/** Whether the form describes Claude in an sbx sandbox: Sidekicks can prepare its sandbox. */ | |
| 128 | +/** Whether the form describes Claude in an sbx sandbox: its sbxenv.yaml gives the rest, it takes no configuration file. */ | |
| 128 | 129 | export function isClaudeSandbox(form: AgentFormValues): boolean { |
| 129 | 130 | return form.environment === 'sbx' && form.program.trim() === claudeProgram |
| 130 | 131 | } |
| 131 | 132 | |
| 132 | -/** | |
| 133 | - * The sandbox name proposed for an agent: its name followed by -sbx. | |
| 134 | - * | |
| 135 | - * @example | |
| 136 | - * sandboxNameFor('claude') // 'claude-sbx' | |
| 137 | - * sandboxNameFor('') // 'claude-sbx' | |
| 138 | - */ | |
| 139 | -export function sandboxNameFor(name: string): string { | |
| 140 | - return `${name.trim() || 'claude'}-sbx` | |
| 141 | -} | |
| 142 | - | |
| 143 | -/** | |
| 144 | - * Fills the form from a sandbox Sidekicks prepared (issue #81): as with a | |
| 145 | - * dropped sbxenv.yaml, and the agent's folder is the sandbox's workspace | |
| 146 | - * folder; claude-agent-acp takes no argument. | |
| 147 | - * | |
| 148 | - * @example | |
| 149 | - * withPreparedSandbox(form, { name: 'claude-sbx', workspace: '/agents/claude/workspace', … }) | |
| 150 | - * // { …, box: 'claude-sbx', workspace: '/agents/claude/workspace', arguments: '' } | |
| 151 | - */ | |
| 152 | -export function withPreparedSandbox(form: AgentFormValues, env: SandboxEnvValues): AgentFormValues { | |
| 153 | - return { ...withSandboxEnv(form, env), workspace: env.workspace || form.workspace, arguments: '' } | |
| 154 | -} | |
| 155 | - | |
| 156 | 133 | /** |
| 157 | 134 | * Quotes an argument for a field typed like a terminal line, as the backend |
| 158 | 135 | * splits it: double quotes when it holds a space or a quote, single quotes |
| @@ -115,7 +115,8 @@ export const claudeProgram = 'claude-agent-acp' | |||
| 115 | 115 | ||
| 116 | /** | 116 | /** |
| 117 | * The programs the "Program" field offers where the agent runs: in an sbx | 117 | * The programs the "Program" field offers where the agent runs: in an sbx |
| 118 | - * sandbox, also claude-agent-acp, whose sandbox Sidekicks can prepare. | 118 | + * sandbox, also claude-agent-acp (Claude Code's ACP adapter, in the |
| 119 | + * docker.io/sbx/claude-acp kit). | ||
| 119 | * | 120 | * |
| 120 | * @example | 121 | * @example |
| 121 | * programsFor('sbx') // ['mm', 'docker-agent', 'docker agent', 'claude-agent-acp'] | 122 | * programsFor('sbx') // ['mm', 'docker-agent', 'docker agent', 'claude-agent-acp'] |
| @@ -124,35 +125,11 @@ export function programsFor(environment: Environment): string[] { | |||
| 124 | return environment === 'sbx' ? [...knownPrograms, claudeProgram] : [...knownPrograms] | 125 | return environment === 'sbx' ? [...knownPrograms, claudeProgram] : [...knownPrograms] |
| 125 | } | 126 | } |
| 126 | 127 | ||
| 127 | -/** Whether the form describes Claude in an sbx sandbox: Sidekicks can prepare its sandbox. */ | 128 | +/** Whether the form describes Claude in an sbx sandbox: its sbxenv.yaml gives the rest, it takes no configuration file. */ |
| 128 | export function isClaudeSandbox(form: AgentFormValues): boolean { | 129 | export function isClaudeSandbox(form: AgentFormValues): boolean { |
| 129 | return form.environment === 'sbx' && form.program.trim() === claudeProgram | 130 | return form.environment === 'sbx' && form.program.trim() === claudeProgram |
| 130 | } | 131 | } |
| 131 | 132 | ||
| 132 | -/** | ||
| 133 | - * The sandbox name proposed for an agent: its name followed by -sbx. | ||
| 134 | - * | ||
| 135 | - * @example | ||
| 136 | - * sandboxNameFor('claude') // 'claude-sbx' | ||
| 137 | - * sandboxNameFor('') // 'claude-sbx' | ||
| 138 | - */ | ||
| 139 | -export function sandboxNameFor(name: string): string { | ||
| 140 | - return `${name.trim() || 'claude'}-sbx` | ||
| 141 | -} | ||
| 142 | - | ||
| 143 | -/** | ||
| 144 | - * Fills the form from a sandbox Sidekicks prepared (issue #81): as with a | ||
| 145 | - * dropped sbxenv.yaml, and the agent's folder is the sandbox's workspace | ||
| 146 | - * folder; claude-agent-acp takes no argument. | ||
| 147 | - * | ||
| 148 | - * @example | ||
| 149 | - * withPreparedSandbox(form, { name: 'claude-sbx', workspace: '/agents/claude/workspace', … }) | ||
| 150 | - * // { …, box: 'claude-sbx', workspace: '/agents/claude/workspace', arguments: '' } | ||
| 151 | - */ | ||
| 152 | -export function withPreparedSandbox(form: AgentFormValues, env: SandboxEnvValues): AgentFormValues { | ||
| 153 | - return { ...withSandboxEnv(form, env), workspace: env.workspace || form.workspace, arguments: '' } | ||
| 154 | -} | ||
| 155 | - | ||
| 156 | /** | 133 | /** |
| 157 | * Quotes an argument for a field typed like a terminal line, as the backend | 134 | * Quotes an argument for a field typed like a terminal line, as the backend |
| 158 | * splits it: double quotes when it holds a space or a quote, single quotes | 135 | * splits it: double quotes when it holds a space or a quote, single quotes |
modified
frontend/src/lib/i18n/messages.ts +4 -24 | @@ -346,18 +346,8 @@ export const en = { | ||
| 346 | 346 | 'assistant.program': 'Program', |
| 347 | 347 | 'assistant.programPlaceholder': 'mm', |
| 348 | 348 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', |
| 349 | - 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp: Sidekicks prepares the sandbox for Claude.', | |
| 350 | - 'assistant.claude.title': 'Claude in an sbx sandbox', | |
| 351 | - 'assistant.claude.intro': 'Sidekicks writes the sandbox\'s sbxenv.yaml and a workspace/ folder (where Claude works) in the folder below, then fills in the rest of this form. An sbxenv.yaml already there is kept as it is.', | |
| 352 | - 'assistant.claude.thirdParty': 'The sandbox uses the docker.io/sbx/claude-acp kit, which a third party provides, not Sidekicks: what it contains, its updates and its availability depend on that third party.', | |
| 353 | - 'assistant.claude.folder': 'Folder of the sandbox', | |
| 354 | - 'assistant.claude.sandbox': 'Name of the sandbox', | |
| 355 | - 'assistant.claude.prepare': 'Prepare the sandbox', | |
| 356 | - 'assistant.claude.preparing': 'Preparing…', | |
| 357 | - 'assistant.claude.written': 'Written: {file}. The form is filled in.', | |
| 358 | - 'assistant.claude.kept': 'Kept the existing {file}. The form is filled in from it.', | |
| 359 | - 'assistant.claude.failed': 'The sandbox cannot be prepared: {error}', | |
| 360 | - 'assistant.claude.key': 'Store your Anthropic API key in sbx before starting Claude: sbx adds it to Claude\'s requests, it is written nowhere in the folder. See the guide "Add a Claude agent in an sbx sandbox".', | |
| 349 | + 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp: Claude, with the sbxenv.yaml of its sandbox dropped above.', | |
| 350 | + 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".', | |
| 361 | 351 | 'assistant.arguments': 'Arguments', |
| 362 | 352 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 363 | 353 | 'assistant.workspace': 'Agent\'s folder', |
| @@ -731,18 +721,8 @@ export const fr: Record<MessageKey, string> = { | ||
| 731 | 721 | 'assistant.program': 'Programme', |
| 732 | 722 | 'assistant.programPlaceholder': 'mm', |
| 733 | 723 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", |
| 734 | - 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp : Sidekicks prépare la sandbox pour Claude.", | |
| 735 | - 'assistant.claude.title': 'Claude dans une sandbox sbx', | |
| 736 | - 'assistant.claude.intro': "Sidekicks écrit le sbxenv.yaml de la sandbox et un dossier workspace/ (où Claude travaille) dans le dossier ci-dessous, puis remplit le reste du formulaire. Un sbxenv.yaml déjà présent est gardé tel quel.", | |
| 737 | - 'assistant.claude.thirdParty': "La sandbox utilise le kit docker.io/sbx/claude-acp, fourni par un tiers et non par Sidekicks : son contenu, ses mises à jour et sa disponibilité dépendent de ce tiers.", | |
| 738 | - 'assistant.claude.folder': 'Dossier de la sandbox', | |
| 739 | - 'assistant.claude.sandbox': 'Nom de la sandbox', | |
| 740 | - 'assistant.claude.prepare': 'Préparer la sandbox', | |
| 741 | - 'assistant.claude.preparing': 'Préparation…', | |
| 742 | - 'assistant.claude.written': 'Écrit : {file}. Le formulaire est rempli.', | |
| 743 | - 'assistant.claude.kept': 'Le fichier {file} existant est gardé. Le formulaire est rempli à partir de lui.', | |
| 744 | - 'assistant.claude.failed': 'La sandbox ne peut pas être préparée : {error}', | |
| 745 | - 'assistant.claude.key': "Enregistrez votre clé d'API Anthropic dans sbx avant de démarrer Claude : sbx l'ajoute aux requêtes de Claude, elle n'est écrite nulle part dans le dossier. Voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", | |
| 724 | + 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp : Claude, avec le sbxenv.yaml de sa sandbox déposé plus haut.", | |
| 725 | + 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", | |
| 746 | 726 | 'assistant.arguments': 'Arguments', |
| 747 | 727 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 748 | 728 | 'assistant.workspace': "Dossier de l'agent", |
| @@ -346,18 +346,8 @@ export const en = { | |||
| 346 | 'assistant.program': 'Program', | 346 | 'assistant.program': 'Program', |
| 347 | 'assistant.programPlaceholder': 'mm', | 347 | 'assistant.programPlaceholder': 'mm', |
| 348 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', | 348 | 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.', |
| 349 | - 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp: Sidekicks prepares the sandbox for Claude.', | 349 | + 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp: Claude, with the sbxenv.yaml of its sandbox dropped above.', |
| 350 | - 'assistant.claude.title': 'Claude in an sbx sandbox', | 350 | + 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".', |
| 351 | - 'assistant.claude.intro': 'Sidekicks writes the sandbox\'s sbxenv.yaml and a workspace/ folder (where Claude works) in the folder below, then fills in the rest of this form. An sbxenv.yaml already there is kept as it is.', | ||
| 352 | - 'assistant.claude.thirdParty': 'The sandbox uses the docker.io/sbx/claude-acp kit, which a third party provides, not Sidekicks: what it contains, its updates and its availability depend on that third party.', | ||
| 353 | - 'assistant.claude.folder': 'Folder of the sandbox', | ||
| 354 | - 'assistant.claude.sandbox': 'Name of the sandbox', | ||
| 355 | - 'assistant.claude.prepare': 'Prepare the sandbox', | ||
| 356 | - 'assistant.claude.preparing': 'Preparing…', | ||
| 357 | - 'assistant.claude.written': 'Written: {file}. The form is filled in.', | ||
| 358 | - 'assistant.claude.kept': 'Kept the existing {file}. The form is filled in from it.', | ||
| 359 | - 'assistant.claude.failed': 'The sandbox cannot be prepared: {error}', | ||
| 360 | - 'assistant.claude.key': 'Store your Anthropic API key in sbx before starting Claude: sbx adds it to Claude\'s requests, it is written nowhere in the folder. See the guide "Add a Claude agent in an sbx sandbox".', | ||
| 361 | 'assistant.arguments': 'Arguments', | 351 | 'assistant.arguments': 'Arguments', |
| 362 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', | 352 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 363 | 'assistant.workspace': 'Agent\'s folder', | 353 | 'assistant.workspace': 'Agent\'s folder', |
| @@ -731,18 +721,8 @@ export const fr: Record<MessageKey, string> = { | |||
| 731 | 'assistant.program': 'Programme', | 721 | 'assistant.program': 'Programme', |
| 732 | 'assistant.programPlaceholder': 'mm', | 722 | 'assistant.programPlaceholder': 'mm', |
| 733 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", | 723 | 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.", |
| 734 | - 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp : Sidekicks prépare la sandbox pour Claude.", | 724 | + 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp : Claude, avec le sbxenv.yaml de sa sandbox déposé plus haut.", |
| 735 | - 'assistant.claude.title': 'Claude dans une sandbox sbx', | 725 | + 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", |
| 736 | - 'assistant.claude.intro': "Sidekicks écrit le sbxenv.yaml de la sandbox et un dossier workspace/ (où Claude travaille) dans le dossier ci-dessous, puis remplit le reste du formulaire. Un sbxenv.yaml déjà présent est gardé tel quel.", | ||
| 737 | - 'assistant.claude.thirdParty': "La sandbox utilise le kit docker.io/sbx/claude-acp, fourni par un tiers et non par Sidekicks : son contenu, ses mises à jour et sa disponibilité dépendent de ce tiers.", | ||
| 738 | - 'assistant.claude.folder': 'Dossier de la sandbox', | ||
| 739 | - 'assistant.claude.sandbox': 'Nom de la sandbox', | ||
| 740 | - 'assistant.claude.prepare': 'Préparer la sandbox', | ||
| 741 | - 'assistant.claude.preparing': 'Préparation…', | ||
| 742 | - 'assistant.claude.written': 'Écrit : {file}. Le formulaire est rempli.', | ||
| 743 | - 'assistant.claude.kept': 'Le fichier {file} existant est gardé. Le formulaire est rempli à partir de lui.', | ||
| 744 | - 'assistant.claude.failed': 'La sandbox ne peut pas être préparée : {error}', | ||
| 745 | - 'assistant.claude.key': "Enregistrez votre clé d'API Anthropic dans sbx avant de démarrer Claude : sbx l'ajoute aux requêtes de Claude, elle n'est écrite nulle part dans le dossier. Voir le guide « Ajouter un agent Claude dans une sandbox sbx ».", | ||
| 746 | 'assistant.arguments': 'Arguments', | 726 | 'assistant.arguments': 'Arguments', |
| 747 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', | 727 | 'assistant.argumentsPlaceholder': '--acp --config agent.yaml', |
| 748 | 'assistant.workspace': "Dossier de l'agent", | 728 | 'assistant.workspace': "Dossier de l'agent", |
deleted
internal/app/claudesandbox.go +0 -117 | deleted file mode 100644 | ||
| @@ -1,117 +0,0 @@ | ||
| 1 | -// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | - | |
| 3 | -package app | |
| 4 | - | |
| 5 | -import ( | |
| 6 | - "errors" | |
| 7 | - "fmt" | |
| 8 | - "os" | |
| 9 | - "path/filepath" | |
| 10 | - "regexp" | |
| 11 | - "strings" | |
| 12 | - | |
| 13 | - "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | |
| 14 | -) | |
| 15 | - | |
| 16 | -// ClaudeACPProgram is Claude Code's ACP adapter, installed in the | |
| 17 | -// docker.io/sbx/claude-acp kit (issue #81). | |
| 18 | -const ClaudeACPProgram = "claude-agent-acp" | |
| 19 | - | |
| 20 | -// claudeSbxEnv is the sbxenv.yaml of a Claude sandbox, as in | |
| 21 | -// agents/snippets/claude-acp; %s is the sandbox's name. | |
| 22 | -const claudeSbxEnv = `schemaVersion: "1" | |
| 23 | - | |
| 24 | -name: %s | |
| 25 | -agent: claude | |
| 26 | - | |
| 27 | -# The folder Claude works in, relative to this file. Sidekicks shows it as | |
| 28 | -# the agent's folder. | |
| 29 | -workspace: ./workspace | |
| 30 | - | |
| 31 | -kits: | |
| 32 | - - docker.io/sbx/claude-acp:latest | |
| 33 | - | |
| 34 | -# sbx injects the Anthropic API key, stored in sbx, into the requests to | |
| 35 | -# these domains: the key is written neither here nor in the sandbox. | |
| 36 | -bindings: | |
| 37 | - anthropic: | |
| 38 | - apiKey: | |
| 39 | - domains: | |
| 40 | - - api.anthropic.com | |
| 41 | - - console.anthropic.com | |
| 42 | - | |
| 43 | -sandboxOptions: | |
| 44 | - pullPolicy: always | |
| 45 | -` | |
| 46 | - | |
| 47 | -// sandboxName is what a sandbox name may be: it goes into commands and YAML. | |
| 48 | -var sandboxName = regexp.MustCompile(`^[a-z0-9][a-z0-9_.-]{0,62}$`) | |
| 49 | - | |
| 50 | -// PreparedSandbox is a sandbox prepared by PrepareClaudeSandbox: what the | |
| 51 | -// assistant fills in, and whether the sbxenv.yaml was written or was | |
| 52 | -// already there (it is never overwritten). | |
| 53 | -type PreparedSandbox struct { | |
| 54 | - SandboxEnv | |
| 55 | - File string `json:"file"` | |
| 56 | - Written bool `json:"written"` | |
| 57 | -} | |
| 58 | - | |
| 59 | -// PrepareClaudeSandbox prepares a Claude agent in an sbx sandbox (issue | |
| 60 | -// #81): in folder (created if needed, "~" is the home folder) it writes the | |
| 61 | -// sbxenv.yaml of a sandbox called sandbox, unless one is already there, and | |
| 62 | -// creates the workspace/ folder Claude works in. It returns what the | |
| 63 | -// assistant fills in, as when an sbxenv.yaml is dropped on it. | |
| 64 | -// | |
| 65 | -// prepared, err := service.PrepareClaudeSandbox("~/agents/claude", "claude-sbx") | |
| 66 | -// // prepared.Workspace == "/Users/me/agents/claude/workspace", prepared.CreateCommand == "sbx env create --force" | |
| 67 | -func (s *ConfigService) PrepareClaudeSandbox(folder, sandbox string) (PreparedSandbox, error) { | |
| 68 | - folder, sandbox = strings.TrimSpace(folder), strings.TrimSpace(sandbox) | |
| 69 | - if !sandboxName.MatchString(sandbox) { | |
| 70 | - return PreparedSandbox{}, fmt.Errorf("%q is not a sandbox name: use lowercase letters, digits, -, _ or dots", sandbox) | |
| 71 | - } | |
| 72 | - folder, err := absoluteFolder(folder) | |
| 73 | - if err != nil { | |
| 74 | - return PreparedSandbox{}, err | |
| 75 | - } | |
| 76 | - if err := os.MkdirAll(filepath.Join(folder, "workspace"), 0o755); err != nil { | |
| 77 | - return PreparedSandbox{}, err | |
| 78 | - } | |
| 79 | - file := filepath.Join(folder, lifecycle.SbxEnvFileName) | |
| 80 | - written := false | |
| 81 | - out, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) | |
| 82 | - switch { | |
| 83 | - case err == nil: | |
| 84 | - _, err = fmt.Fprintf(out, claudeSbxEnv, sandbox) | |
| 85 | - if closeErr := out.Close(); err == nil { | |
| 86 | - err = closeErr | |
| 87 | - } | |
| 88 | - if err != nil { | |
| 89 | - return PreparedSandbox{}, err | |
| 90 | - } | |
| 91 | - written = true | |
| 92 | - case !errors.Is(err, os.ErrExist): | |
| 93 | - return PreparedSandbox{}, err | |
| 94 | - } | |
| 95 | - env, err := s.ReadSandboxEnv(file) | |
| 96 | - if err != nil { | |
| 97 | - return PreparedSandbox{}, err | |
| 98 | - } | |
| 99 | - return PreparedSandbox{SandboxEnv: env, File: file, Written: written}, nil | |
| 100 | -} | |
| 101 | - | |
| 102 | -// absoluteFolder expands "~" and refuses a relative folder: sbx mounts the | |
| 103 | -// agent's folder at the same path, which must not depend on where | |
| 104 | -// Sidekicks was started. | |
| 105 | -func absoluteFolder(folder string) (string, error) { | |
| 106 | - if folder == "~" || strings.HasPrefix(folder, "~/") { | |
| 107 | - home, err := os.UserHomeDir() | |
| 108 | - if err != nil { | |
| 109 | - return "", err | |
| 110 | - } | |
| 111 | - folder = filepath.Join(home, strings.TrimPrefix(folder, "~")) | |
| 112 | - } | |
| 113 | - if folder == "" || !filepath.IsAbs(folder) { | |
| 114 | - return "", fmt.Errorf("%q: give the full path of the folder (or start it with ~/)", folder) | |
| 115 | - } | |
| 116 | - return filepath.Clean(folder), nil | |
| 117 | -} | |
| deleted file mode 100644 | |||
| @@ -1,117 +0,0 @@ | |||
| 1 | -// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | - | ||
| 3 | -package app | ||
| 4 | - | ||
| 5 | -import ( | ||
| 6 | - "errors" | ||
| 7 | - "fmt" | ||
| 8 | - "os" | ||
| 9 | - "path/filepath" | ||
| 10 | - "regexp" | ||
| 11 | - "strings" | ||
| 12 | - | ||
| 13 | - "git.rickub.com/bots-garden/sidekicks/internal/lifecycle" | ||
| 14 | -) | ||
| 15 | - | ||
| 16 | -// ClaudeACPProgram is Claude Code's ACP adapter, installed in the | ||
| 17 | -// docker.io/sbx/claude-acp kit (issue #81). | ||
| 18 | -const ClaudeACPProgram = "claude-agent-acp" | ||
| 19 | - | ||
| 20 | -// claudeSbxEnv is the sbxenv.yaml of a Claude sandbox, as in | ||
| 21 | -// agents/snippets/claude-acp; %s is the sandbox's name. | ||
| 22 | -const claudeSbxEnv = `schemaVersion: "1" | ||
| 23 | - | ||
| 24 | -name: %s | ||
| 25 | -agent: claude | ||
| 26 | - | ||
| 27 | -# The folder Claude works in, relative to this file. Sidekicks shows it as | ||
| 28 | -# the agent's folder. | ||
| 29 | -workspace: ./workspace | ||
| 30 | - | ||
| 31 | -kits: | ||
| 32 | - - docker.io/sbx/claude-acp:latest | ||
| 33 | - | ||
| 34 | -# sbx injects the Anthropic API key, stored in sbx, into the requests to | ||
| 35 | -# these domains: the key is written neither here nor in the sandbox. | ||
| 36 | -bindings: | ||
| 37 | - anthropic: | ||
| 38 | - apiKey: | ||
| 39 | - domains: | ||
| 40 | - - api.anthropic.com | ||
| 41 | - - console.anthropic.com | ||
| 42 | - | ||
| 43 | -sandboxOptions: | ||
| 44 | - pullPolicy: always | ||
| 45 | -` | ||
| 46 | - | ||
| 47 | -// sandboxName is what a sandbox name may be: it goes into commands and YAML. | ||
| 48 | -var sandboxName = regexp.MustCompile(`^[a-z0-9][a-z0-9_.-]{0,62}$`) | ||
| 49 | - | ||
| 50 | -// PreparedSandbox is a sandbox prepared by PrepareClaudeSandbox: what the | ||
| 51 | -// assistant fills in, and whether the sbxenv.yaml was written or was | ||
| 52 | -// already there (it is never overwritten). | ||
| 53 | -type PreparedSandbox struct { | ||
| 54 | - SandboxEnv | ||
| 55 | - File string `json:"file"` | ||
| 56 | - Written bool `json:"written"` | ||
| 57 | -} | ||
| 58 | - | ||
| 59 | -// PrepareClaudeSandbox prepares a Claude agent in an sbx sandbox (issue | ||
| 60 | -// #81): in folder (created if needed, "~" is the home folder) it writes the | ||
| 61 | -// sbxenv.yaml of a sandbox called sandbox, unless one is already there, and | ||
| 62 | -// creates the workspace/ folder Claude works in. It returns what the | ||
| 63 | -// assistant fills in, as when an sbxenv.yaml is dropped on it. | ||
| 64 | -// | ||
| 65 | -// prepared, err := service.PrepareClaudeSandbox("~/agents/claude", "claude-sbx") | ||
| 66 | -// // prepared.Workspace == "/Users/me/agents/claude/workspace", prepared.CreateCommand == "sbx env create --force" | ||
| 67 | -func (s *ConfigService) PrepareClaudeSandbox(folder, sandbox string) (PreparedSandbox, error) { | ||
| 68 | - folder, sandbox = strings.TrimSpace(folder), strings.TrimSpace(sandbox) | ||
| 69 | - if !sandboxName.MatchString(sandbox) { | ||
| 70 | - return PreparedSandbox{}, fmt.Errorf("%q is not a sandbox name: use lowercase letters, digits, -, _ or dots", sandbox) | ||
| 71 | - } | ||
| 72 | - folder, err := absoluteFolder(folder) | ||
| 73 | - if err != nil { | ||
| 74 | - return PreparedSandbox{}, err | ||
| 75 | - } | ||
| 76 | - if err := os.MkdirAll(filepath.Join(folder, "workspace"), 0o755); err != nil { | ||
| 77 | - return PreparedSandbox{}, err | ||
| 78 | - } | ||
| 79 | - file := filepath.Join(folder, lifecycle.SbxEnvFileName) | ||
| 80 | - written := false | ||
| 81 | - out, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0o644) | ||
| 82 | - switch { | ||
| 83 | - case err == nil: | ||
| 84 | - _, err = fmt.Fprintf(out, claudeSbxEnv, sandbox) | ||
| 85 | - if closeErr := out.Close(); err == nil { | ||
| 86 | - err = closeErr | ||
| 87 | - } | ||
| 88 | - if err != nil { | ||
| 89 | - return PreparedSandbox{}, err | ||
| 90 | - } | ||
| 91 | - written = true | ||
| 92 | - case !errors.Is(err, os.ErrExist): | ||
| 93 | - return PreparedSandbox{}, err | ||
| 94 | - } | ||
| 95 | - env, err := s.ReadSandboxEnv(file) | ||
| 96 | - if err != nil { | ||
| 97 | - return PreparedSandbox{}, err | ||
| 98 | - } | ||
| 99 | - return PreparedSandbox{SandboxEnv: env, File: file, Written: written}, nil | ||
| 100 | -} | ||
| 101 | - | ||
| 102 | -// absoluteFolder expands "~" and refuses a relative folder: sbx mounts the | ||
| 103 | -// agent's folder at the same path, which must not depend on where | ||
| 104 | -// Sidekicks was started. | ||
| 105 | -func absoluteFolder(folder string) (string, error) { | ||
| 106 | - if folder == "~" || strings.HasPrefix(folder, "~/") { | ||
| 107 | - home, err := os.UserHomeDir() | ||
| 108 | - if err != nil { | ||
| 109 | - return "", err | ||
| 110 | - } | ||
| 111 | - folder = filepath.Join(home, strings.TrimPrefix(folder, "~")) | ||
| 112 | - } | ||
| 113 | - if folder == "" || !filepath.IsAbs(folder) { | ||
| 114 | - return "", fmt.Errorf("%q: give the full path of the folder (or start it with ~/)", folder) | ||
| 115 | - } | ||
| 116 | - return filepath.Clean(folder), nil | ||
| 117 | -} | ||
modified
internal/app/sandboxes_test.go +0 -65 | @@ -13,7 +13,6 @@ import ( | ||
| 13 | 13 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 14 | 14 | "git.rickub.com/bots-garden/sidekicks/internal/app" |
| 15 | 15 | "git.rickub.com/bots-garden/sidekicks/internal/config" |
| 16 | - "go.yaml.in/yaml/v3" | |
| 17 | 16 | ) |
| 18 | 17 | |
| 19 | 18 | // fakeSbx keeps its sandboxes in a file next to it: "ls -q" lists them, |
| @@ -180,67 +179,3 @@ func TestReadComposeFillsTheAssistant(t *testing.T) { | ||
| 180 | 179 | t.Fatal("another file is refused") |
| 181 | 180 | } |
| 182 | 181 | } |
| 183 | - | |
| 184 | -func TestPrepareClaudeSandboxWritesTheSnippetsEnvironment(t *testing.T) { | |
| 185 | - dir := t.TempDir() | |
| 186 | - folder := filepath.Join(dir, "agents", "claude") | |
| 187 | - service := &app.ConfigService{Core: app.New(config.Location{Path: filepath.Join(dir, "config.yaml"), Source: config.SourceFlag}, app.Options{Starter: starter})} | |
| 188 | - prepared, err := service.PrepareClaudeSandbox(folder, "claude-sbx") | |
| 189 | - if err != nil { | |
| 190 | - t.Fatal(err) | |
| 191 | - } | |
| 192 | - want := app.SandboxEnv{ | |
| 193 | - Name: "claude-sbx", Workspace: filepath.Join(folder, "workspace"), SandboxFolder: folder, | |
| 194 | - CreateCommand: "sbx env create --force", StopCommand: "sbx stop claude-sbx", RemoveCommand: "sbx env rm --force", | |
| 195 | - } | |
| 196 | - if prepared.SandboxEnv != want || !prepared.Written || prepared.File != filepath.Join(folder, "sbxenv.yaml") { | |
| 197 | - t.Fatalf("got %+v\nwant %+v", prepared, want) | |
| 198 | - } | |
| 199 | - if info, err := os.Stat(filepath.Join(folder, "workspace")); err != nil || !info.IsDir() { | |
| 200 | - t.Fatal("the workspace folder is created") | |
| 201 | - } | |
| 202 | - // The same environment as agents/snippets/claude-acp, apart from the name. | |
| 203 | - written, _ := os.ReadFile(prepared.File) | |
| 204 | - snippet, err := os.ReadFile(filepath.Join("..", "..", "agents", "snippets", "claude-acp", "sbxenv.yaml")) | |
| 205 | - if err != nil { | |
| 206 | - t.Fatal(err) | |
| 207 | - } | |
| 208 | - if got, want := yamlWithout(t, written, "name"), yamlWithout(t, snippet, "name"); got != want { | |
| 209 | - t.Fatalf("the generated sbxenv.yaml differs from the snippet:\n%s\n---\n%s", got, want) | |
| 210 | - } | |
| 211 | -} | |
| 212 | - | |
| 213 | -func TestPrepareClaudeSandboxKeepsAnExistingFile(t *testing.T) { | |
| 214 | - dir := t.TempDir() | |
| 215 | - service := &app.ConfigService{Core: app.New(config.Location{Path: filepath.Join(dir, "config.yaml"), Source: config.SourceFlag}, app.Options{Starter: starter})} | |
| 216 | - write(t, filepath.Join(dir, "sbxenv.yaml"), "schemaVersion: \"1\"\nname: mine\nagent: claude\n") | |
| 217 | - prepared, err := service.PrepareClaudeSandbox(dir, "claude-sbx") | |
| 218 | - if err != nil || prepared.Written || prepared.Name != "mine" { | |
| 219 | - t.Fatalf("an existing sbxenv.yaml is read, never overwritten: %+v %v", prepared, err) | |
| 220 | - } | |
| 221 | - if content, _ := os.ReadFile(filepath.Join(dir, "sbxenv.yaml")); !strings.Contains(string(content), "name: mine") { | |
| 222 | - t.Fatalf("overwritten: %s", content) | |
| 223 | - } | |
| 224 | - if _, err := service.PrepareClaudeSandbox("relative/folder", "claude-sbx"); err == nil { | |
| 225 | - t.Fatal("a relative folder is refused") | |
| 226 | - } | |
| 227 | - if _, err := service.PrepareClaudeSandbox(dir, "Bad Name"); err == nil { | |
| 228 | - t.Fatal("an invalid sandbox name is refused") | |
| 229 | - } | |
| 230 | -} | |
| 231 | - | |
| 232 | -// yamlWithout decodes a YAML mapping, drops key, and encodes it again, so | |
| 233 | -// that two files compare by content, not by comments or layout. | |
| 234 | -func yamlWithout(t *testing.T, content []byte, key string) string { | |
| 235 | - t.Helper() | |
| 236 | - var values map[string]any | |
| 237 | - if err := yaml.Unmarshal(content, &values); err != nil { | |
| 238 | - t.Fatal(err) | |
| 239 | - } | |
| 240 | - delete(values, key) | |
| 241 | - out, err := yaml.Marshal(values) | |
| 242 | - if err != nil { | |
| 243 | - t.Fatal(err) | |
| 244 | - } | |
| 245 | - return string(out) | |
| 246 | -} | |
| @@ -13,7 +13,6 @@ import ( | |||
| 13 | "git.rickub.com/bots-garden/sidekicks/internal/agents" | 13 | "git.rickub.com/bots-garden/sidekicks/internal/agents" |
| 14 | "git.rickub.com/bots-garden/sidekicks/internal/app" | 14 | "git.rickub.com/bots-garden/sidekicks/internal/app" |
| 15 | "git.rickub.com/bots-garden/sidekicks/internal/config" | 15 | "git.rickub.com/bots-garden/sidekicks/internal/config" |
| 16 | - "go.yaml.in/yaml/v3" | ||
| 17 | ) | 16 | ) |
| 18 | 17 | ||
| 19 | // fakeSbx keeps its sandboxes in a file next to it: "ls -q" lists them, | 18 | // fakeSbx keeps its sandboxes in a file next to it: "ls -q" lists them, |
| @@ -180,67 +179,3 @@ func TestReadComposeFillsTheAssistant(t *testing.T) { | |||
| 180 | t.Fatal("another file is refused") | 179 | t.Fatal("another file is refused") |
| 181 | } | 180 | } |
| 182 | } | 181 | } |
| 183 | - | ||
| 184 | -func TestPrepareClaudeSandboxWritesTheSnippetsEnvironment(t *testing.T) { | ||
| 185 | - dir := t.TempDir() | ||
| 186 | - folder := filepath.Join(dir, "agents", "claude") | ||
| 187 | - service := &app.ConfigService{Core: app.New(config.Location{Path: filepath.Join(dir, "config.yaml"), Source: config.SourceFlag}, app.Options{Starter: starter})} | ||
| 188 | - prepared, err := service.PrepareClaudeSandbox(folder, "claude-sbx") | ||
| 189 | - if err != nil { | ||
| 190 | - t.Fatal(err) | ||
| 191 | - } | ||
| 192 | - want := app.SandboxEnv{ | ||
| 193 | - Name: "claude-sbx", Workspace: filepath.Join(folder, "workspace"), SandboxFolder: folder, | ||
| 194 | - CreateCommand: "sbx env create --force", StopCommand: "sbx stop claude-sbx", RemoveCommand: "sbx env rm --force", | ||
| 195 | - } | ||
| 196 | - if prepared.SandboxEnv != want || !prepared.Written || prepared.File != filepath.Join(folder, "sbxenv.yaml") { | ||
| 197 | - t.Fatalf("got %+v\nwant %+v", prepared, want) | ||
| 198 | - } | ||
| 199 | - if info, err := os.Stat(filepath.Join(folder, "workspace")); err != nil || !info.IsDir() { | ||
| 200 | - t.Fatal("the workspace folder is created") | ||
| 201 | - } | ||
| 202 | - // The same environment as agents/snippets/claude-acp, apart from the name. | ||
| 203 | - written, _ := os.ReadFile(prepared.File) | ||
| 204 | - snippet, err := os.ReadFile(filepath.Join("..", "..", "agents", "snippets", "claude-acp", "sbxenv.yaml")) | ||
| 205 | - if err != nil { | ||
| 206 | - t.Fatal(err) | ||
| 207 | - } | ||
| 208 | - if got, want := yamlWithout(t, written, "name"), yamlWithout(t, snippet, "name"); got != want { | ||
| 209 | - t.Fatalf("the generated sbxenv.yaml differs from the snippet:\n%s\n---\n%s", got, want) | ||
| 210 | - } | ||
| 211 | -} | ||
| 212 | - | ||
| 213 | -func TestPrepareClaudeSandboxKeepsAnExistingFile(t *testing.T) { | ||
| 214 | - dir := t.TempDir() | ||
| 215 | - service := &app.ConfigService{Core: app.New(config.Location{Path: filepath.Join(dir, "config.yaml"), Source: config.SourceFlag}, app.Options{Starter: starter})} | ||
| 216 | - write(t, filepath.Join(dir, "sbxenv.yaml"), "schemaVersion: \"1\"\nname: mine\nagent: claude\n") | ||
| 217 | - prepared, err := service.PrepareClaudeSandbox(dir, "claude-sbx") | ||
| 218 | - if err != nil || prepared.Written || prepared.Name != "mine" { | ||
| 219 | - t.Fatalf("an existing sbxenv.yaml is read, never overwritten: %+v %v", prepared, err) | ||
| 220 | - } | ||
| 221 | - if content, _ := os.ReadFile(filepath.Join(dir, "sbxenv.yaml")); !strings.Contains(string(content), "name: mine") { | ||
| 222 | - t.Fatalf("overwritten: %s", content) | ||
| 223 | - } | ||
| 224 | - if _, err := service.PrepareClaudeSandbox("relative/folder", "claude-sbx"); err == nil { | ||
| 225 | - t.Fatal("a relative folder is refused") | ||
| 226 | - } | ||
| 227 | - if _, err := service.PrepareClaudeSandbox(dir, "Bad Name"); err == nil { | ||
| 228 | - t.Fatal("an invalid sandbox name is refused") | ||
| 229 | - } | ||
| 230 | -} | ||
| 231 | - | ||
| 232 | -// yamlWithout decodes a YAML mapping, drops key, and encodes it again, so | ||
| 233 | -// that two files compare by content, not by comments or layout. | ||
| 234 | -func yamlWithout(t *testing.T, content []byte, key string) string { | ||
| 235 | - t.Helper() | ||
| 236 | - var values map[string]any | ||
| 237 | - if err := yaml.Unmarshal(content, &values); err != nil { | ||
| 238 | - t.Fatal(err) | ||
| 239 | - } | ||
| 240 | - delete(values, key) | ||
| 241 | - out, err := yaml.Marshal(values) | ||
| 242 | - if err != nil { | ||
| 243 | - t.Fatal(err) | ||
| 244 | - } | ||
| 245 | - return string(out) | ||
| 246 | -} | ||