#99 Nom @ créé à partir du nom affiché dans les assistants
Le nom @ suit le nom affiché tant qu'il n'est pas tapé à la main (sbxNameFromTitle sans « _ » pour une sandbox) ; Go renvoie les noms pris (agents, dossiers, sandboxes) et l'interface propose une variante libre et prévient avant l'envoi. L'assistant mini-me a son nom affiché. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0bd44f0 parent: bb1554b modified
.tickets/issues/0099-assistants-nom-utilise-avec-cree-a-partir-du-nom.yaml +29 -7 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-15T03:18:04.000Z |
| 9 | -updatedAt: 2026-11-15T03:18:04.000Z | |
| 9 | +updatedAt: 2026-11-15T03:25:02.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::ui |
| @@ -42,42 +42,64 @@ body: | | ||
| 42 | 42 | tasks: |
| 43 | 43 | - id: 1 |
| 44 | 44 | title: "Dérivation du nom @ depuis le nom affiché (agentform nameFromTitle ; variante sans _ pour sbx) et suivi tant qu'il n'est pas modifié" |
| 45 | - state: open | |
| 45 | + state: closed | |
| 46 | 46 | priority: high |
| 47 | 47 | author: |
| 48 | 48 | name: k33g |
| 49 | 49 | email: ph.charriere@gmail.com |
| 50 | 50 | createdAt: 2026-11-15T03:18:04.000Z |
| 51 | + updatedAt: 2026-11-15T03:25:02.000Z | |
| 52 | + closedAt: 2026-11-15T03:25:02.000Z | |
| 51 | 53 | - id: 2 |
| 52 | 54 | title: "Variante libre proposée (agent, dossier, sandbox) avant l'envoi" |
| 53 | - state: open | |
| 55 | + state: closed | |
| 54 | 56 | priority: medium |
| 55 | 57 | author: |
| 56 | 58 | name: k33g |
| 57 | 59 | email: ph.charriere@gmail.com |
| 58 | 60 | createdAt: 2026-11-15T03:18:04.000Z |
| 61 | + updatedAt: 2026-11-15T03:25:02.000Z | |
| 62 | + closedAt: 2026-11-15T03:25:02.000Z | |
| 59 | 63 | - id: 3 |
| 60 | 64 | title: "Assistant des sandboxes : nom affiché d'abord, nom @ qui suit" |
| 61 | - state: open | |
| 65 | + state: closed | |
| 62 | 66 | priority: high |
| 63 | 67 | author: |
| 64 | 68 | name: k33g |
| 65 | 69 | email: ph.charriere@gmail.com |
| 66 | 70 | createdAt: 2026-11-15T03:18:04.000Z |
| 71 | + updatedAt: 2026-11-15T03:25:02.000Z | |
| 72 | + closedAt: 2026-11-15T03:25:02.000Z | |
| 67 | 73 | - id: 4 |
| 68 | 74 | title: "Assistant mini-me : ajouter le nom affiché (prérempli par mm), nom @ qui suit" |
| 69 | - state: open | |
| 75 | + state: closed | |
| 70 | 76 | priority: high |
| 71 | 77 | author: |
| 72 | 78 | name: k33g |
| 73 | 79 | email: ph.charriere@gmail.com |
| 74 | 80 | createdAt: 2026-11-15T03:18:04.000Z |
| 81 | + updatedAt: 2026-11-15T03:25:02.000Z | |
| 82 | + closedAt: 2026-11-15T03:25:02.000Z | |
| 75 | 83 | - id: 5 |
| 76 | 84 | title: "Tests vitest, textes EN + FR, doc des guides" |
| 77 | - state: open | |
| 85 | + state: closed | |
| 78 | 86 | priority: medium |
| 79 | 87 | author: |
| 80 | 88 | name: k33g |
| 81 | 89 | email: ph.charriere@gmail.com |
| 82 | 90 | createdAt: 2026-11-15T03:18:04.000Z |
| 83 | -comments: [] | |
| 91 | + updatedAt: 2026-11-15T03:25:02.000Z | |
| 92 | + closedAt: 2026-11-15T03:25:02.000Z | |
| 93 | +comments: | |
| 94 | + - id: 1 | |
| 95 | + author: | |
| 96 | + name: k33g | |
| 97 | + email: ph.charriere@gmail.com | |
| 98 | + createdAt: 2026-11-15T03:25:02.000Z | |
| 99 | + body: | | |
| 100 | + Implémenté sur `feature/98-99-100` : `sbxNameFromTitle` et `freeName` (`lib/creator.ts`) ; Go renvoie les | |
| 101 | + noms pris (`SbxCheck.taken`, `CreatorStart.taken` : agents, dossiers, sandboxes) ; dans les deux assistants le | |
| 102 | + nom @ suit le nom affiché tant qu'il n'est pas tapé à la main, un nom pris est signalé avant l'envoi avec une | |
| 103 | + suggestion ; l'assistant mini-me a son champ « Nom affiché » (prérempli par mm, transmis à `Finish` en | |
| 104 | + `title`). Pour mini-me, le nom @ part du nom donné à mm (`marcel`) et ne suit le nom affiché qu'une fois | |
| 105 | + celui-ci modifié. Tests Go et vitest, svelte-check ; doc des deux guides et de la référence. | |
| @@ -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-15T03:18:04.000Z | 8 | createdAt: 2026-11-15T03:18:04.000Z |
| 9 | -updatedAt: 2026-11-15T03:18:04.000Z | 9 | +updatedAt: 2026-11-15T03:25:02.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::ui | 12 | - area::ui |
| @@ -42,42 +42,64 @@ body: | | |||
| 42 | tasks: | 42 | tasks: |
| 43 | - id: 1 | 43 | - id: 1 |
| 44 | title: "Dérivation du nom @ depuis le nom affiché (agentform nameFromTitle ; variante sans _ pour sbx) et suivi tant qu'il n'est pas modifié" | 44 | title: "Dérivation du nom @ depuis le nom affiché (agentform nameFromTitle ; variante sans _ pour sbx) et suivi tant qu'il n'est pas modifié" |
| 45 | - state: open | 45 | + state: closed |
| 46 | priority: high | 46 | priority: high |
| 47 | author: | 47 | author: |
| 48 | name: k33g | 48 | name: k33g |
| 49 | email: ph.charriere@gmail.com | 49 | email: ph.charriere@gmail.com |
| 50 | createdAt: 2026-11-15T03:18:04.000Z | 50 | createdAt: 2026-11-15T03:18:04.000Z |
| 51 | + updatedAt: 2026-11-15T03:25:02.000Z | ||
| 52 | + closedAt: 2026-11-15T03:25:02.000Z | ||
| 51 | - id: 2 | 53 | - id: 2 |
| 52 | title: "Variante libre proposée (agent, dossier, sandbox) avant l'envoi" | 54 | title: "Variante libre proposée (agent, dossier, sandbox) avant l'envoi" |
| 53 | - state: open | 55 | + state: closed |
| 54 | priority: medium | 56 | priority: medium |
| 55 | author: | 57 | author: |
| 56 | name: k33g | 58 | name: k33g |
| 57 | email: ph.charriere@gmail.com | 59 | email: ph.charriere@gmail.com |
| 58 | createdAt: 2026-11-15T03:18:04.000Z | 60 | createdAt: 2026-11-15T03:18:04.000Z |
| 61 | + updatedAt: 2026-11-15T03:25:02.000Z | ||
| 62 | + closedAt: 2026-11-15T03:25:02.000Z | ||
| 59 | - id: 3 | 63 | - id: 3 |
| 60 | title: "Assistant des sandboxes : nom affiché d'abord, nom @ qui suit" | 64 | title: "Assistant des sandboxes : nom affiché d'abord, nom @ qui suit" |
| 61 | - state: open | 65 | + state: closed |
| 62 | priority: high | 66 | priority: high |
| 63 | author: | 67 | author: |
| 64 | name: k33g | 68 | name: k33g |
| 65 | email: ph.charriere@gmail.com | 69 | email: ph.charriere@gmail.com |
| 66 | createdAt: 2026-11-15T03:18:04.000Z | 70 | createdAt: 2026-11-15T03:18:04.000Z |
| 71 | + updatedAt: 2026-11-15T03:25:02.000Z | ||
| 72 | + closedAt: 2026-11-15T03:25:02.000Z | ||
| 67 | - id: 4 | 73 | - id: 4 |
| 68 | title: "Assistant mini-me : ajouter le nom affiché (prérempli par mm), nom @ qui suit" | 74 | title: "Assistant mini-me : ajouter le nom affiché (prérempli par mm), nom @ qui suit" |
| 69 | - state: open | 75 | + state: closed |
| 70 | priority: high | 76 | priority: high |
| 71 | author: | 77 | author: |
| 72 | name: k33g | 78 | name: k33g |
| 73 | email: ph.charriere@gmail.com | 79 | email: ph.charriere@gmail.com |
| 74 | createdAt: 2026-11-15T03:18:04.000Z | 80 | createdAt: 2026-11-15T03:18:04.000Z |
| 81 | + updatedAt: 2026-11-15T03:25:02.000Z | ||
| 82 | + closedAt: 2026-11-15T03:25:02.000Z | ||
| 75 | - id: 5 | 83 | - id: 5 |
| 76 | title: "Tests vitest, textes EN + FR, doc des guides" | 84 | title: "Tests vitest, textes EN + FR, doc des guides" |
| 77 | - state: open | 85 | + state: closed |
| 78 | priority: medium | 86 | priority: medium |
| 79 | author: | 87 | author: |
| 80 | name: k33g | 88 | name: k33g |
| 81 | email: ph.charriere@gmail.com | 89 | email: ph.charriere@gmail.com |
| 82 | createdAt: 2026-11-15T03:18:04.000Z | 90 | createdAt: 2026-11-15T03:18:04.000Z |
| 83 | -comments: [] | 91 | + updatedAt: 2026-11-15T03:25:02.000Z |
| 92 | + closedAt: 2026-11-15T03:25:02.000Z | ||
| 93 | +comments: | ||
| 94 | + - id: 1 | ||
| 95 | + author: | ||
| 96 | + name: k33g | ||
| 97 | + email: ph.charriere@gmail.com | ||
| 98 | + createdAt: 2026-11-15T03:25:02.000Z | ||
| 99 | + body: | | ||
| 100 | + Implémenté sur `feature/98-99-100` : `sbxNameFromTitle` et `freeName` (`lib/creator.ts`) ; Go renvoie les | ||
| 101 | + noms pris (`SbxCheck.taken`, `CreatorStart.taken` : agents, dossiers, sandboxes) ; dans les deux assistants le | ||
| 102 | + nom @ suit le nom affiché tant qu'il n'est pas tapé à la main, un nom pris est signalé avant l'envoi avec une | ||
| 103 | + suggestion ; l'assistant mini-me a son champ « Nom affiché » (prérempli par mm, transmis à `Finish` en | ||
| 104 | + `title`). Pour mini-me, le nom @ part du nom donné à mm (`marcel`) et ne suit le nom affiché qu'une fois | ||
| 105 | + celui-ci modifié. Tests Go et vitest, svelte-check ; doc des deux guides et de la référence. | ||
modified
docs/en/how-to/create-a-mini-me-agent.md +2 -1 | @@ -7,7 +7,8 @@ This guide shows how to create a new [mini-me](https://git.rickub.com/bots-garde | ||
| 7 | 7 | 1. Open the assistant: **✨ Create my first agent** on the welcome screen, **✨ Create a mini-me agent** under the agents list, or **Create a mini-me agent** in the command palette (⌘K, Ctrl+K on Linux and Windows). |
| 8 | 8 | 2. Answer the questions of mini-me, a few at a time: the model server, the model, what the agent is for, which machine runs the model, whether it asks before each command or file change, the agent's name… Each question comes with mini-me's default: **Next →** takes it. **About these choices** explains the options. |
| 9 | 9 | 3. When mini-me has written the agent, give its last details: |
| 10 | - - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me; lowercase letters, digits, `-` and `_`, starting with a letter. | |
| 10 | + - **Name shown**: mini-me's (`Marcel (developer)`), which you can change. | |
| 11 | + - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me, then follows the **Name shown** when you change it, until you type it yourself; lowercase letters, digits, `-` and `_`, starting with a letter. A name already used is said before you click, with a free one to try. | |
| 11 | 12 | - **Emoji**: pick one, or type any emoji. |
| 12 | 13 | - **Where does it run?** **On this computer** (the simplest), **In a Docker container** (Docker must be installed) or **In a Docker Sandbox (sbx)** (sbx must be installed). |
| 13 | 14 | 4. Click **Add the agent**. Its direct conversation opens: write to it. |
| @@ -7,7 +7,8 @@ This guide shows how to create a new [mini-me](https://git.rickub.com/bots-garde | |||
| 7 | 1. Open the assistant: **✨ Create my first agent** on the welcome screen, **✨ Create a mini-me agent** under the agents list, or **Create a mini-me agent** in the command palette (⌘K, Ctrl+K on Linux and Windows). | 7 | 1. Open the assistant: **✨ Create my first agent** on the welcome screen, **✨ Create a mini-me agent** under the agents list, or **Create a mini-me agent** in the command palette (⌘K, Ctrl+K on Linux and Windows). |
| 8 | 2. Answer the questions of mini-me, a few at a time: the model server, the model, what the agent is for, which machine runs the model, whether it asks before each command or file change, the agent's name… Each question comes with mini-me's default: **Next →** takes it. **About these choices** explains the options. | 8 | 2. Answer the questions of mini-me, a few at a time: the model server, the model, what the agent is for, which machine runs the model, whether it asks before each command or file change, the agent's name… Each question comes with mini-me's default: **Next →** takes it. **About these choices** explains the options. |
| 9 | 3. When mini-me has written the agent, give its last details: | 9 | 3. When mini-me has written the agent, give its last details: |
| 10 | - - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me; lowercase letters, digits, `-` and `_`, starting with a letter. | 10 | + - **Name shown**: mini-me's (`Marcel (developer)`), which you can change. |
| 11 | + - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me, then follows the **Name shown** when you change it, until you type it yourself; lowercase letters, digits, `-` and `_`, starting with a letter. A name already used is said before you click, with a free one to try. | ||
| 11 | - **Emoji**: pick one, or type any emoji. | 12 | - **Emoji**: pick one, or type any emoji. |
| 12 | - **Where does it run?** **On this computer** (the simplest), **In a Docker container** (Docker must be installed) or **In a Docker Sandbox (sbx)** (sbx must be installed). | 13 | - **Where does it run?** **On this computer** (the simplest), **In a Docker container** (Docker must be installed) or **In a Docker Sandbox (sbx)** (sbx must be installed). |
| 13 | 4. Click **Add the agent**. Its direct conversation opens: write to it. | 14 | 4. Click **Add the agent**. Its direct conversation opens: write to it. |
modified
docs/en/how-to/create-an-agent-in-a-sandbox.md +1 -1 | @@ -7,7 +7,7 @@ This guide shows how to create a new Claude, Gemini, Codex or Vibe agent that ru | ||
| 7 | 7 | 1. Open the assistant: **✨ Create a Claude, Gemini, Codex or Vibe agent** on the welcome screen, **✨ Create an agent in a sandbox** under the agents list, or **Create an agent in a sandbox** in the command palette (⌘K, Ctrl+K on Linux and Windows). |
| 8 | 8 | 2. Choose the agent: **Claude** (Anthropic's Claude Code), **Gemini** (Google's, through Antigravity), **Codex** (OpenAI's) or **Vibe** (Mistral AI's). |
| 9 | 9 | 3. If sbx does not hold its key yet, paste it in **API key** and click **Save the key**. **Get a key…** opens the page where the company gives you one. Sidekicks hands the key to sbx, which keeps it and gives it to your sandboxes for their calls to that company only; it is never written in a file. A key already saved is shown as **✓ Your … key is stored in sbx**. |
| 10 | -4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. Sidekicks suggests a name nobody uses yet. | |
| 10 | +4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. The **Name** follows the **Name shown** (`Marcel (assistant)` gives `marcel-assistant`) until you type it yourself; Sidekicks always suggests one nobody uses yet, and says so before you click when the one you typed is taken. | |
| 11 | 11 | 5. Click **Add the agent**. Its conversation opens. Its sandbox is created the first time you write to it, so that first answer takes a while. |
| 12 | 12 | |
| 13 | 13 | The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/claude`): its `sbxenv.yaml` and its `workspace/` folder, where the agent works. |
| @@ -7,7 +7,7 @@ This guide shows how to create a new Claude, Gemini, Codex or Vibe agent that ru | |||
| 7 | 1. Open the assistant: **✨ Create a Claude, Gemini, Codex or Vibe agent** on the welcome screen, **✨ Create an agent in a sandbox** under the agents list, or **Create an agent in a sandbox** in the command palette (⌘K, Ctrl+K on Linux and Windows). | 7 | 1. Open the assistant: **✨ Create a Claude, Gemini, Codex or Vibe agent** on the welcome screen, **✨ Create an agent in a sandbox** under the agents list, or **Create an agent in a sandbox** in the command palette (⌘K, Ctrl+K on Linux and Windows). |
| 8 | 2. Choose the agent: **Claude** (Anthropic's Claude Code), **Gemini** (Google's, through Antigravity), **Codex** (OpenAI's) or **Vibe** (Mistral AI's). | 8 | 2. Choose the agent: **Claude** (Anthropic's Claude Code), **Gemini** (Google's, through Antigravity), **Codex** (OpenAI's) or **Vibe** (Mistral AI's). |
| 9 | 3. If sbx does not hold its key yet, paste it in **API key** and click **Save the key**. **Get a key…** opens the page where the company gives you one. Sidekicks hands the key to sbx, which keeps it and gives it to your sandboxes for their calls to that company only; it is never written in a file. A key already saved is shown as **✓ Your … key is stored in sbx**. | 9 | 3. If sbx does not hold its key yet, paste it in **API key** and click **Save the key**. **Get a key…** opens the page where the company gives you one. Sidekicks hands the key to sbx, which keeps it and gives it to your sandboxes for their calls to that company only; it is never written in a file. A key already saved is shown as **✓ Your … key is stored in sbx**. |
| 10 | -4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. Sidekicks suggests a name nobody uses yet. | 10 | +4. Give the agent its last details: **Name shown**, **Name** (what you call it with, `@claude`, and the name of its folder and of its sandbox: lowercase letters, digits and `-`, starting with a letter) and an **Emoji**. The **Name** follows the **Name shown** (`Marcel (assistant)` gives `marcel-assistant`) until you type it yourself; Sidekicks always suggests one nobody uses yet, and says so before you click when the one you typed is taken. |
| 11 | 5. Click **Add the agent**. Its conversation opens. Its sandbox is created the first time you write to it, so that first answer takes a while. | 11 | 5. Click **Add the agent**. Its conversation opens. Its sandbox is created the first time you write to it, so that first answer takes a while. |
| 12 | 12 | ||
| 13 | The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/claude`): its `sbxenv.yaml` and its `workspace/` folder, where the agent works. | 13 | The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/claude`): its `sbxenv.yaml` and its `workspace/` folder, where the agent works. |
modified
docs/en/reference/agents-and-events.md +3 -3 | @@ -244,10 +244,10 @@ The assistant that creates a mini-me agent (issue #94, [How to create a mini-me | ||
| 244 | 244 | |
| 245 | 245 | | Method | Effect | |
| 246 | 246 | | --- | --- | |
| 247 | -| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version}`. | | |
| 247 | +| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version, taken[]}` (`taken`: the names of the agents and of the folders of the agents' folder, issue #99). | | |
| 248 | 248 | | `Answer(answer)` | Answers the form shown: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. Returns the next `view`. | |
| 249 | 249 | | `Send(text)` | Sends a message to mm (`/back`, `/restart`, `/start`…); refused while a form waits (decline it first). Returns the next `view`. | |
| 250 | -| `Finish({name, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title from `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. | | |
| 250 | +| `Finish({name, title, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title `title`, else `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. | | |
| 251 | 251 | | `Cancel()` | Stops mm; before `Finish`, removes the temporary folder. Also done when Sidekicks quits. | |
| 252 | 252 | |
| 253 | 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. |
| @@ -266,7 +266,7 @@ The assistant that creates an agent in a Docker Sandbox (issue #96, [How to crea | ||
| 266 | 266 | | Method | Effect | |
| 267 | 267 | | --- | --- | |
| 268 | 268 | | `Kinds()` | The catalogue, in order: `{id, title, icon, agent, kit, program, service, keyUrl}`. | |
| 269 | -| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder}`: whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | | |
| 269 | +| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder, taken[]}` (`taken`: the names used by an agent, a folder or a sandbox, issue #99): whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | | |
| 270 | 270 | | `SetKey(kind, key)` | `sbx secret set <service>` with the key on its standard input — never in its arguments, a file or a log; an error never repeats it. Global: every sandbox gets it. | |
| 271 | 271 | | `Login()` | Runs `sbx login` (issue #97) — or joins the one in progress — and returns once sbx printed its device code and URL, 20 seconds at most: `{code, url, done, user, error, output[]}`. The code is the first `XXXX-XXXX`, the URL the first `https://…` naming `login`; `output` keeps every line for when sbx prints something else. Its standard input is empty: a question asked on the keyboard gets no answer. | |
| 272 | 272 | | `LoginStatus()` | Waits, 20 seconds at most, for `sbx login` to end and returns the same state; `done` with `user` (from `Signed in as <user>.`) when signed in, else `error` (`cancelled` after `CancelLogin`). The interface calls it again until `done`. | |
| @@ -244,10 +244,10 @@ The assistant that creates a mini-me agent (issue #94, [How to create a mini-me | |||
| 244 | 244 | ||
| 245 | | Method | Effect | | 245 | | Method | Effect | |
| 246 | | --- | --- | | 246 | | --- | --- | |
| 247 | -| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version}`. | | 247 | +| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version, taken[]}` (`taken`: the names of the agents and of the folders of the agents' folder, issue #99). | |
| 248 | | `Answer(answer)` | Answers the form shown: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. Returns the next `view`. | | 248 | | `Answer(answer)` | Answers the form shown: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. Returns the next `view`. | |
| 249 | | `Send(text)` | Sends a message to mm (`/back`, `/restart`, `/start`…); refused while a form waits (decline it first). Returns the next `view`. | | 249 | | `Send(text)` | Sends a message to mm (`/back`, `/restart`, `/start`…); refused while a form waits (decline it first). Returns the next `view`. | |
| 250 | -| `Finish({name, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title from `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. | | 250 | +| `Finish({name, title, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title `title`, else `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. | |
| 251 | | `Cancel()` | Stops mm; before `Finish`, removes the temporary folder. Also done when Sidekicks quits. | | 251 | | `Cancel()` | Stops mm; before `Finish`, removes the temporary folder. Also done when Sidekicks quits. | |
| 252 | 252 | ||
| 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. | 253 | A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered. |
| @@ -266,7 +266,7 @@ The assistant that creates an agent in a Docker Sandbox (issue #96, [How to crea | |||
| 266 | | Method | Effect | | 266 | | Method | Effect | |
| 267 | | --- | --- | | 267 | | --- | --- | |
| 268 | | `Kinds()` | The catalogue, in order: `{id, title, icon, agent, kit, program, service, keyUrl}`. | | 268 | | `Kinds()` | The catalogue, in order: `{id, title, icon, agent, kit, program, service, keyUrl}`. | |
| 269 | -| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder}`: whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | | 269 | +| `Check(kind)` | `sbx is not installed` when sbx cannot be found (`sbx` in PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Returns `{hasKey, name, agentsFolder, taken[]}` (`taken`: the names used by an agent, a folder or a sandbox, issue #99): whether `sbx secret ls --service <service>` shows a global secret, and the first free name among `<kind>`, `<kind>-2`… — free as an agent of the configuration, a folder of the agents' folder and a sandbox (`sbx ls -q`). | |
| 270 | | `SetKey(kind, key)` | `sbx secret set <service>` with the key on its standard input — never in its arguments, a file or a log; an error never repeats it. Global: every sandbox gets it. | | 270 | | `SetKey(kind, key)` | `sbx secret set <service>` with the key on its standard input — never in its arguments, a file or a log; an error never repeats it. Global: every sandbox gets it. | |
| 271 | | `Login()` | Runs `sbx login` (issue #97) — or joins the one in progress — and returns once sbx printed its device code and URL, 20 seconds at most: `{code, url, done, user, error, output[]}`. The code is the first `XXXX-XXXX`, the URL the first `https://…` naming `login`; `output` keeps every line for when sbx prints something else. Its standard input is empty: a question asked on the keyboard gets no answer. | | 271 | | `Login()` | Runs `sbx login` (issue #97) — or joins the one in progress — and returns once sbx printed its device code and URL, 20 seconds at most: `{code, url, done, user, error, output[]}`. The code is the first `XXXX-XXXX`, the URL the first `https://…` naming `login`; `output` keeps every line for when sbx prints something else. Its standard input is empty: a question asked on the keyboard gets no answer. | |
| 272 | | `LoginStatus()` | Waits, 20 seconds at most, for `sbx login` to end and returns the same state; `done` with `user` (from `Signed in as <user>.`) when signed in, else `error` (`cancelled` after `CancelLogin`). The interface calls it again until `done`. | | 272 | | `LoginStatus()` | Waits, 20 seconds at most, for `sbx login` to end and returns the same state; `done` with `user` (from `Signed in as <user>.`) when signed in, else `error` (`cancelled` after `CancelLogin`). The interface calls it again until `done`. | |
modified
docs/fr/how-to/creer-un-agent-dans-une-sandbox.md +1 -1 | @@ -7,7 +7,7 @@ Ce guide montre comment créer un nouvel agent Claude, Gemini, Codex ou Vibe qui | ||
| 7 | 7 | 1. Ouvrez l'assistant : **✨ Créer un agent Claude, Gemini, Codex ou Vibe** sur l'écran d'accueil, **✨ Créer un agent dans une sandbox** sous la liste des agents, ou **Créer un agent dans une sandbox** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). |
| 8 | 8 | 2. Choisissez l'agent : **Claude** (Claude Code, d'Anthropic), **Gemini** (de Google, via Antigravity), **Codex** (d'OpenAI) ou **Vibe** (de Mistral AI). |
| 9 | 9 | 3. Si sbx n'a pas encore sa clé, collez-la dans **Clé d'API** et cliquez sur **Enregistrer la clé**. **Obtenir une clé…** ouvre la page où l'éditeur vous en donne une. Sidekicks confie la clé à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à cet éditeur ; elle n'est jamais écrite dans un fichier. Une clé déjà enregistrée s'affiche **✓ Votre clé … est enregistrée dans sbx**. |
| 10 | -4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Sidekicks propose un nom que personne n'utilise encore. | |
| 10 | +4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Le **Nom** suit le **Nom affiché** (`Marcel (assistant)` donne `marcel-assistant`) tant que vous ne le tapez pas vous-même ; Sidekicks en propose toujours un que personne n'utilise encore, et prévient avant le clic quand celui que vous avez tapé est pris. | |
| 11 | 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation s'ouvre. Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment. |
| 12 | 12 | |
| 13 | 13 | Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/claude`) : son `sbxenv.yaml` et son dossier `workspace/`, où l'agent travaille. |
| @@ -7,7 +7,7 @@ Ce guide montre comment créer un nouvel agent Claude, Gemini, Codex ou Vibe qui | |||
| 7 | 1. Ouvrez l'assistant : **✨ Créer un agent Claude, Gemini, Codex ou Vibe** sur l'écran d'accueil, **✨ Créer un agent dans une sandbox** sous la liste des agents, ou **Créer un agent dans une sandbox** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). | 7 | 1. Ouvrez l'assistant : **✨ Créer un agent Claude, Gemini, Codex ou Vibe** sur l'écran d'accueil, **✨ Créer un agent dans une sandbox** sous la liste des agents, ou **Créer un agent dans une sandbox** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). |
| 8 | 2. Choisissez l'agent : **Claude** (Claude Code, d'Anthropic), **Gemini** (de Google, via Antigravity), **Codex** (d'OpenAI) ou **Vibe** (de Mistral AI). | 8 | 2. Choisissez l'agent : **Claude** (Claude Code, d'Anthropic), **Gemini** (de Google, via Antigravity), **Codex** (d'OpenAI) ou **Vibe** (de Mistral AI). |
| 9 | 3. Si sbx n'a pas encore sa clé, collez-la dans **Clé d'API** et cliquez sur **Enregistrer la clé**. **Obtenir une clé…** ouvre la page où l'éditeur vous en donne une. Sidekicks confie la clé à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à cet éditeur ; elle n'est jamais écrite dans un fichier. Une clé déjà enregistrée s'affiche **✓ Votre clé … est enregistrée dans sbx**. | 9 | 3. Si sbx n'a pas encore sa clé, collez-la dans **Clé d'API** et cliquez sur **Enregistrer la clé**. **Obtenir une clé…** ouvre la page où l'éditeur vous en donne une. Sidekicks confie la clé à sbx, qui la garde et la fournit à vos sandboxes seulement pour leurs appels à cet éditeur ; elle n'est jamais écrite dans un fichier. Une clé déjà enregistrée s'affiche **✓ Votre clé … est enregistrée dans sbx**. |
| 10 | -4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Sidekicks propose un nom que personne n'utilise encore. | 10 | +4. Donnez à l'agent ses derniers détails : **Nom affiché**, **Nom** (ce qui l'appelle, `@claude`, et le nom de son dossier et de sa sandbox : minuscules, chiffres et `-`, en commençant par une lettre) et un **Emoji**. Le **Nom** suit le **Nom affiché** (`Marcel (assistant)` donne `marcel-assistant`) tant que vous ne le tapez pas vous-même ; Sidekicks en propose toujours un que personne n'utilise encore, et prévient avant le clic quand celui que vous avez tapé est pris. |
| 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation s'ouvre. Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment. | 11 | 5. Cliquez sur **Ajouter l'agent**. Sa conversation s'ouvre. Sa sandbox est créée la première fois que vous lui écrivez : cette première réponse prend un moment. |
| 12 | 12 | ||
| 13 | Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/claude`) : son `sbxenv.yaml` et son dossier `workspace/`, où l'agent travaille. | 13 | Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/claude`) : son `sbxenv.yaml` et son dossier `workspace/`, où l'agent travaille. |
modified
docs/fr/how-to/creer-un-agent-mini-me.md +2 -1 | @@ -7,7 +7,8 @@ Ce guide montre comment créer un nouvel agent [mini-me](https://git.rickub.com/ | ||
| 7 | 7 | 1. Ouvrez l'assistant : **✨ Créer mon premier agent** sur l'écran d'accueil, **✨ Créer un agent mini-me** sous la liste des agents, ou **Créer un agent mini-me** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). |
| 8 | 8 | 2. Répondez aux questions de mini-me, quelques-unes à la fois : le serveur de modèles, le modèle, à quoi sert l'agent, quelle machine fait tourner le modèle, s'il demande avant chaque commande ou modification de fichier, le nom de l'agent… Chaque question arrive avec la valeur par défaut de mini-me : **Suivant →** la prend. **À propos de ces choix** explique les options. Les questions sont celles de mini-me, en anglais. |
| 9 | 9 | 3. Quand mini-me a écrit l'agent, donnez ses derniers détails : |
| 10 | - - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me ; minuscules, chiffres, `-` et `_`, en commençant par une lettre. | |
| 10 | + - **Nom affiché** : celui de mini-me (`Marcel (developer)`), modifiable. | |
| 11 | + - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me, puis suit le **Nom affiché** quand vous le changez, tant que vous ne le tapez pas vous-même ; minuscules, chiffres, `-` et `_`, en commençant par une lettre. Un nom déjà utilisé est signalé avant le clic, avec un nom libre à essayer. | |
| 11 | 12 | - **Emoji** : choisissez-en un, ou tapez n'importe quel emoji. |
| 12 | 13 | - **Où s'exécute-t-il ?** **Sur cet ordinateur** (le plus simple), **Dans un conteneur Docker** (Docker doit être installé) ou **Dans une Docker Sandbox (sbx)** (sbx doit être installé). |
| 13 | 14 | 4. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre : écrivez-lui. |
| @@ -7,7 +7,8 @@ Ce guide montre comment créer un nouvel agent [mini-me](https://git.rickub.com/ | |||
| 7 | 1. Ouvrez l'assistant : **✨ Créer mon premier agent** sur l'écran d'accueil, **✨ Créer un agent mini-me** sous la liste des agents, ou **Créer un agent mini-me** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). | 7 | 1. Ouvrez l'assistant : **✨ Créer mon premier agent** sur l'écran d'accueil, **✨ Créer un agent mini-me** sous la liste des agents, ou **Créer un agent mini-me** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows). |
| 8 | 2. Répondez aux questions de mini-me, quelques-unes à la fois : le serveur de modèles, le modèle, à quoi sert l'agent, quelle machine fait tourner le modèle, s'il demande avant chaque commande ou modification de fichier, le nom de l'agent… Chaque question arrive avec la valeur par défaut de mini-me : **Suivant →** la prend. **À propos de ces choix** explique les options. Les questions sont celles de mini-me, en anglais. | 8 | 2. Répondez aux questions de mini-me, quelques-unes à la fois : le serveur de modèles, le modèle, à quoi sert l'agent, quelle machine fait tourner le modèle, s'il demande avant chaque commande ou modification de fichier, le nom de l'agent… Chaque question arrive avec la valeur par défaut de mini-me : **Suivant →** la prend. **À propos de ces choix** explique les options. Les questions sont celles de mini-me, en anglais. |
| 9 | 3. Quand mini-me a écrit l'agent, donnez ses derniers détails : | 9 | 3. Quand mini-me a écrit l'agent, donnez ses derniers détails : |
| 10 | - - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me ; minuscules, chiffres, `-` et `_`, en commençant par une lettre. | 10 | + - **Nom affiché** : celui de mini-me (`Marcel (developer)`), modifiable. |
| 11 | + - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me, puis suit le **Nom affiché** quand vous le changez, tant que vous ne le tapez pas vous-même ; minuscules, chiffres, `-` et `_`, en commençant par une lettre. Un nom déjà utilisé est signalé avant le clic, avec un nom libre à essayer. | ||
| 11 | - **Emoji** : choisissez-en un, ou tapez n'importe quel emoji. | 12 | - **Emoji** : choisissez-en un, ou tapez n'importe quel emoji. |
| 12 | - **Où s'exécute-t-il ?** **Sur cet ordinateur** (le plus simple), **Dans un conteneur Docker** (Docker doit être installé) ou **Dans une Docker Sandbox (sbx)** (sbx doit être installé). | 13 | - **Où s'exécute-t-il ?** **Sur cet ordinateur** (le plus simple), **Dans un conteneur Docker** (Docker doit être installé) ou **Dans une Docker Sandbox (sbx)** (sbx doit être installé). |
| 13 | 4. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre : écrivez-lui. | 14 | 4. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre : écrivez-lui. |
modified
docs/fr/reference/agents-et-evenements.md +3 -3 | @@ -244,10 +244,10 @@ L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../ | ||
| 244 | 244 | |
| 245 | 245 | | Méthode | Effet | |
| 246 | 246 | | --- | --- | |
| 247 | -| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version}`. | | |
| 247 | +| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version, taken[]}` (`taken` : les noms des agents et des dossiers du dossier des agents, issue #99). | | |
| 248 | 248 | | `Answer(answer)` | Répond au formulaire affiché : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Renvoie la `view` suivante. | |
| 249 | 249 | | `Send(text)` | Envoie un message à mm (`/back`, `/restart`, `/start`…) ; refusé tant qu'un formulaire attend (le refuser d'abord). Renvoie la `view` suivante. | |
| 250 | -| `Finish({name, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre venant de `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. | | |
| 250 | +| `Finish({name, title, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre étant `title`, sinon `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. | | |
| 251 | 251 | | `Cancel()` | Arrête mm ; avant `Finish`, supprime le dossier temporaire. Fait aussi quand Sidekicks se ferme. | |
| 252 | 252 | |
| 253 | 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. |
| @@ -266,7 +266,7 @@ L'assistant qui crée un agent dans une Docker Sandbox (issue #96, [Créer un ag | ||
| 266 | 266 | | Méthode | Effet | |
| 267 | 267 | | --- | --- | |
| 268 | 268 | | `Kinds()` | Le catalogue, dans l'ordre : `{id, title, icon, agent, kit, program, service, keyUrl}`. | |
| 269 | -| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder}` : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | | |
| 269 | +| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder, taken[]}` (`taken` : les noms pris par un agent, un dossier ou une sandbox, issue #99) : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | | |
| 270 | 270 | | `SetKey(kind, key)` | `sbx secret set <service>` avec la clé sur son entrée standard — jamais dans ses arguments, un fichier ou un journal ; une erreur ne la répète jamais. Globale : toutes les sandboxes l'ont. | |
| 271 | 271 | | `Login()` | Lance `sbx login` (issue #97) — ou rejoint celui en cours — et revient dès que sbx a affiché son code et son adresse, 20 secondes au plus : `{code, url, done, user, error, output[]}`. Le code est le premier `XXXX-XXXX`, l'adresse le premier `https://…` qui contient `login` ; `output` garde chaque ligne pour le cas où sbx affiche autre chose. Son entrée standard est vide : une question posée au clavier n'a pas de réponse. | |
| 272 | 272 | | `LoginStatus()` | Attend, 20 secondes au plus, la fin de `sbx login` et renvoie le même état ; `done` avec `user` (tiré de `Signed in as <user>.`) une fois connecté, sinon `error` (`cancelled` après `CancelLogin`). L'interface le rappelle jusqu'à `done`. | |
| @@ -244,10 +244,10 @@ L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../ | |||
| 244 | 244 | ||
| 245 | | Méthode | Effet | | 245 | | Méthode | Effet | |
| 246 | | --- | --- | | 246 | | --- | --- | |
| 247 | -| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version}`. | | 247 | +| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version, taken[]}` (`taken` : les noms des agents et des dossiers du dossier des agents, issue #99). | |
| 248 | | `Answer(answer)` | Répond au formulaire affiché : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Renvoie la `view` suivante. | | 248 | | `Answer(answer)` | Répond au formulaire affiché : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Renvoie la `view` suivante. | |
| 249 | | `Send(text)` | Envoie un message à mm (`/back`, `/restart`, `/start`…) ; refusé tant qu'un formulaire attend (le refuser d'abord). Renvoie la `view` suivante. | | 249 | | `Send(text)` | Envoie un message à mm (`/back`, `/restart`, `/start`…) ; refusé tant qu'un formulaire attend (le refuser d'abord). Renvoie la `view` suivante. | |
| 250 | -| `Finish({name, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre venant de `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. | | 250 | +| `Finish({name, title, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre étant `title`, sinon `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. | |
| 251 | | `Cancel()` | Arrête mm ; avant `Finish`, supprime le dossier temporaire. Fait aussi quand Sidekicks se ferme. | | 251 | | `Cancel()` | Arrête mm ; avant `Finish`, supprime le dossier temporaire. Fait aussi quand Sidekicks se ferme. | |
| 252 | 252 | ||
| 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. | 253 | Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu. |
| @@ -266,7 +266,7 @@ L'assistant qui crée un agent dans une Docker Sandbox (issue #96, [Créer un ag | |||
| 266 | | Méthode | Effet | | 266 | | Méthode | Effet | |
| 267 | | --- | --- | | 267 | | --- | --- | |
| 268 | | `Kinds()` | Le catalogue, dans l'ordre : `{id, title, icon, agent, kit, program, service, keyUrl}`. | | 268 | | `Kinds()` | Le catalogue, dans l'ordre : `{id, title, icon, agent, kit, program, service, keyUrl}`. | |
| 269 | -| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder}` : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | | 269 | +| `Check(kind)` | `sbx is not installed` quand sbx est introuvable (`sbx` dans le PATH, `/usr/local/bin`, `/opt/homebrew/bin`). Renvoie `{hasKey, name, agentsFolder, taken[]}` (`taken` : les noms pris par un agent, un dossier ou une sandbox, issue #99) : si `sbx secret ls --service <service>` montre un secret global, et le premier nom libre parmi `<type>`, `<type>-2`… — libre comme agent de la configuration, dossier du dossier des agents et sandbox (`sbx ls -q`). | |
| 270 | | `SetKey(kind, key)` | `sbx secret set <service>` avec la clé sur son entrée standard — jamais dans ses arguments, un fichier ou un journal ; une erreur ne la répète jamais. Globale : toutes les sandboxes l'ont. | | 270 | | `SetKey(kind, key)` | `sbx secret set <service>` avec la clé sur son entrée standard — jamais dans ses arguments, un fichier ou un journal ; une erreur ne la répète jamais. Globale : toutes les sandboxes l'ont. | |
| 271 | | `Login()` | Lance `sbx login` (issue #97) — ou rejoint celui en cours — et revient dès que sbx a affiché son code et son adresse, 20 secondes au plus : `{code, url, done, user, error, output[]}`. Le code est le premier `XXXX-XXXX`, l'adresse le premier `https://…` qui contient `login` ; `output` garde chaque ligne pour le cas où sbx affiche autre chose. Son entrée standard est vide : une question posée au clavier n'a pas de réponse. | | 271 | | `Login()` | Lance `sbx login` (issue #97) — ou rejoint celui en cours — et revient dès que sbx a affiché son code et son adresse, 20 secondes au plus : `{code, url, done, user, error, output[]}`. Le code est le premier `XXXX-XXXX`, l'adresse le premier `https://…` qui contient `login` ; `output` garde chaque ligne pour le cas où sbx affiche autre chose. Son entrée standard est vide : une question posée au clavier n'a pas de réponse. | |
| 272 | | `LoginStatus()` | Attend, 20 secondes au plus, la fin de `sbx login` et renvoie le même état ; `done` avec `user` (tiré de `Signed in as <user>.`) une fois connecté, sinon `error` (`cancelled` après `CancelLogin`). L'interface le rappelle jusqu'à `done`. | | 272 | | `LoginStatus()` | Attend, 20 secondes au plus, la fin de `sbx login` et renvoie le même état ; `done` avec `user` (tiré de `Signed in as <user>.`) une fois connecté, sinon `error` (`cancelled` après `CancelLogin`). L'interface le rappelle jusqu'à `done`. | |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +17 -0 | @@ -119,6 +119,11 @@ export interface ConfigView { | ||
| 119 | 119 | */ |
| 120 | 120 | export interface CreatorFinish { |
| 121 | 121 | "name": string; |
| 122 | + | |
| 123 | + /** | |
| 124 | + * Title is the name shown; "" keeps mm's (acp.title). | |
| 125 | + */ | |
| 126 | + "title": string; | |
| 122 | 127 | "icon": string; |
| 123 | 128 | "environment": string; |
| 124 | 129 | } |
| @@ -157,6 +162,12 @@ export interface CreatorStart { | ||
| 157 | 162 | * Version is what mm --version said. |
| 158 | 163 | */ |
| 159 | 164 | "version": string; |
| 165 | + | |
| 166 | + /** | |
| 167 | + * Taken is the names already used, by an agent or by a folder of the | |
| 168 | + * agents' folder: the interface suggests a free one (issue #99). | |
| 169 | + */ | |
| 170 | + "taken": string[] | null; | |
| 160 | 171 | } |
| 161 | 172 | |
| 162 | 173 | /** |
| @@ -243,6 +254,12 @@ export interface SbxCheck { | ||
| 243 | 254 | "hasKey": boolean; |
| 244 | 255 | "name": string; |
| 245 | 256 | "agentsFolder": string; |
| 257 | + | |
| 258 | + /** | |
| 259 | + * Taken is the names already used, by an agent, a folder of the agents' | |
| 260 | + * folder or a sandbox: the interface suggests a free one (issue #99). | |
| 261 | + */ | |
| 262 | + "taken": string[] | null; | |
| 246 | 263 | } |
| 247 | 264 | |
| 248 | 265 | /** |
| @@ -119,6 +119,11 @@ export interface ConfigView { | |||
| 119 | */ | 119 | */ |
| 120 | export interface CreatorFinish { | 120 | export interface CreatorFinish { |
| 121 | "name": string; | 121 | "name": string; |
| 122 | + | ||
| 123 | + /** | ||
| 124 | + * Title is the name shown; "" keeps mm's (acp.title). | ||
| 125 | + */ | ||
| 126 | + "title": string; | ||
| 122 | "icon": string; | 127 | "icon": string; |
| 123 | "environment": string; | 128 | "environment": string; |
| 124 | } | 129 | } |
| @@ -157,6 +162,12 @@ export interface CreatorStart { | |||
| 157 | * Version is what mm --version said. | 162 | * Version is what mm --version said. |
| 158 | */ | 163 | */ |
| 159 | "version": string; | 164 | "version": string; |
| 165 | + | ||
| 166 | + /** | ||
| 167 | + * Taken is the names already used, by an agent or by a folder of the | ||
| 168 | + * agents' folder: the interface suggests a free one (issue #99). | ||
| 169 | + */ | ||
| 170 | + "taken": string[] | null; | ||
| 160 | } | 171 | } |
| 161 | 172 | ||
| 162 | /** | 173 | /** |
| @@ -243,6 +254,12 @@ export interface SbxCheck { | |||
| 243 | "hasKey": boolean; | 254 | "hasKey": boolean; |
| 244 | "name": string; | 255 | "name": string; |
| 245 | "agentsFolder": string; | 256 | "agentsFolder": string; |
| 257 | + | ||
| 258 | + /** | ||
| 259 | + * Taken is the names already used, by an agent, a folder of the agents' | ||
| 260 | + * folder or a sandbox: the interface suggests a free one (issue #99). | ||
| 261 | + */ | ||
| 262 | + "taken": string[] | null; | ||
| 246 | } | 263 | } |
| 247 | 264 | ||
| 248 | /** | 265 | /** |
modified
frontend/src/lib/agent/CreateMiniMeAgent.svelte +28 -8 | @@ -10,7 +10,8 @@ | ||
| 10 | 10 | import { t, type MessageKey } from '../i18n/index.svelte' |
| 11 | 11 | import { CreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 12 | 12 | import { agentAdded, appState } from '../state.svelte' |
| 13 | - import { agentFolder, contentOf, environments, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator' | |
| 13 | + import { agentFolder, contentOf, environments, freeName, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator' | |
| 14 | + import { nameFromTitle } from '../agentform' | |
| 14 | 15 | import AgentAvatar from './AgentAvatar.svelte' |
| 15 | 16 | import ErrorText from '../chat/ErrorText.svelte' |
| 16 | 17 | import Markdown from '../chat/Markdown.svelte' |
| @@ -32,6 +33,11 @@ | ||
| 32 | 33 | // The last step. |
| 33 | 34 | let name = $state('') |
| 34 | 35 | let title = $state('') |
| 36 | + // Issue #99: the @ name follows the name shown until it is typed by hand; | |
| 37 | + // taken is the names already used (agents, folders of the agents' folder). | |
| 38 | + let nameEdited = $state(false) | |
| 39 | + let taken = $state<string[]>([]) | |
| 40 | + const takenNow = $derived(name !== '' && taken.includes(name)) | |
| 35 | 41 | let icon = $state('🤖') |
| 36 | 42 | let environment = $state<Environment>('local') |
| 37 | 43 | let problem = $state('') |
| @@ -64,8 +70,9 @@ | ||
| 64 | 70 | step = 'questions' |
| 65 | 71 | } else if (view.written) { |
| 66 | 72 | form = null |
| 67 | - name = name || view.name | |
| 68 | - title = view.title | |
| 73 | + // mm's name, the one the user typed in the wizard, made free. | |
| 74 | + name = name || freeName(view.name, taken) | |
| 75 | + title = title || view.title | |
| 69 | 76 | step = 'ready' |
| 70 | 77 | } else { |
| 71 | 78 | form = null |
| @@ -92,6 +99,7 @@ | ||
| 92 | 99 | try { |
| 93 | 100 | const started = await CreatorService.Start() |
| 94 | 101 | agentsFolder = started.agentsFolder |
| 102 | + taken = started.taken ?? [] | |
| 95 | 103 | show(started.view) |
| 96 | 104 | } catch (caught) { |
| 97 | 105 | failure = caught instanceof Error ? caught.message : String(caught) |
| @@ -128,7 +136,7 @@ | ||
| 128 | 136 | } |
| 129 | 137 | busy = true |
| 130 | 138 | try { |
| 131 | - const result = await CreatorService.Finish({ name, icon: icon.trim(), environment }) | |
| 139 | + const result = await CreatorService.Finish({ name, title: title.trim(), icon: icon.trim(), environment }) | |
| 132 | 140 | if (result.problem) problem = result.problem |
| 133 | 141 | else if (result.problems && result.problems.length > 0) refused = result.problems |
| 134 | 142 | else { |
| @@ -142,6 +150,14 @@ | ||
| 142 | 150 | } |
| 143 | 151 | } |
| 144 | 152 | |
| 153 | + // The @ name made from the name shown, free, while it was not typed by hand. | |
| 154 | + function followTitle() { | |
| 155 | + if (nameEdited) return | |
| 156 | + const made = nameFromTitle(title) | |
| 157 | + if (made) name = freeName(made, taken) | |
| 158 | + problem = '' | |
| 159 | + } | |
| 160 | + | |
| 145 | 161 | function close() { |
| 146 | 162 | appState.creator = '' |
| 147 | 163 | } |
| @@ -210,12 +226,16 @@ | ||
| 210 | 226 | <div class="row"> |
| 211 | 227 | <span class="preview"><AgentAvatar icon={icon} title={title || name} name={name} size={34} /></span> |
| 212 | 228 | <label class="grow"> |
| 213 | - {t('creator.name')} | |
| 214 | - <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" /> | |
| 229 | + {t('creator.agentTitle')} | |
| 230 | + <input bind:value={title} oninput={followTitle} /> | |
| 215 | 231 | </label> |
| 216 | 232 | </div> |
| 217 | - <small id="creator-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | |
| 218 | - {problem ? t(problemKey(problem)) : t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | |
| 233 | + <label> | |
| 234 | + {t('creator.name')} | |
| 235 | + <input bind:value={name} oninput={() => ((problem = ''), (nameEdited = true))} aria-invalid={problem !== '' || takenNow} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" /> | |
| 236 | + </label> | |
| 237 | + <small id="creator-name-hint" class:problem-text={problem !== '' || takenNow} role={problem || takenNow ? 'alert' : undefined}> | |
| 238 | + {#if problem}{t(problemKey(problem))}{:else if takenNow}{t('creator.problem.taken', { suggestion: freeName(name, taken) })}{:else}{t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}{/if} | |
| 219 | 239 | </small> |
| 220 | 240 | <div class="group" aria-label={t('creator.icon')}> |
| 221 | 241 | <span class="label">{t('creator.icon')}</span> |
| @@ -10,7 +10,8 @@ | |||
| 10 | import { t, type MessageKey } from '../i18n/index.svelte' | 10 | import { t, type MessageKey } from '../i18n/index.svelte' |
| 11 | import { CreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 11 | import { CreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 12 | import { agentAdded, appState } from '../state.svelte' | 12 | import { agentAdded, appState } from '../state.svelte' |
| 13 | - import { agentFolder, contentOf, environments, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator' | 13 | + import { agentFolder, contentOf, environments, freeName, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator' |
| 14 | + import { nameFromTitle } from '../agentform' | ||
| 14 | import AgentAvatar from './AgentAvatar.svelte' | 15 | import AgentAvatar from './AgentAvatar.svelte' |
| 15 | import ErrorText from '../chat/ErrorText.svelte' | 16 | import ErrorText from '../chat/ErrorText.svelte' |
| 16 | import Markdown from '../chat/Markdown.svelte' | 17 | import Markdown from '../chat/Markdown.svelte' |
| @@ -32,6 +33,11 @@ | |||
| 32 | // The last step. | 33 | // The last step. |
| 33 | let name = $state('') | 34 | let name = $state('') |
| 34 | let title = $state('') | 35 | let title = $state('') |
| 36 | + // Issue #99: the @ name follows the name shown until it is typed by hand; | ||
| 37 | + // taken is the names already used (agents, folders of the agents' folder). | ||
| 38 | + let nameEdited = $state(false) | ||
| 39 | + let taken = $state<string[]>([]) | ||
| 40 | + const takenNow = $derived(name !== '' && taken.includes(name)) | ||
| 35 | let icon = $state('🤖') | 41 | let icon = $state('🤖') |
| 36 | let environment = $state<Environment>('local') | 42 | let environment = $state<Environment>('local') |
| 37 | let problem = $state('') | 43 | let problem = $state('') |
| @@ -64,8 +70,9 @@ | |||
| 64 | step = 'questions' | 70 | step = 'questions' |
| 65 | } else if (view.written) { | 71 | } else if (view.written) { |
| 66 | form = null | 72 | form = null |
| 67 | - name = name || view.name | 73 | + // mm's name, the one the user typed in the wizard, made free. |
| 68 | - title = view.title | 74 | + name = name || freeName(view.name, taken) |
| 75 | + title = title || view.title | ||
| 69 | step = 'ready' | 76 | step = 'ready' |
| 70 | } else { | 77 | } else { |
| 71 | form = null | 78 | form = null |
| @@ -92,6 +99,7 @@ | |||
| 92 | try { | 99 | try { |
| 93 | const started = await CreatorService.Start() | 100 | const started = await CreatorService.Start() |
| 94 | agentsFolder = started.agentsFolder | 101 | agentsFolder = started.agentsFolder |
| 102 | + taken = started.taken ?? [] | ||
| 95 | show(started.view) | 103 | show(started.view) |
| 96 | } catch (caught) { | 104 | } catch (caught) { |
| 97 | failure = caught instanceof Error ? caught.message : String(caught) | 105 | failure = caught instanceof Error ? caught.message : String(caught) |
| @@ -128,7 +136,7 @@ | |||
| 128 | } | 136 | } |
| 129 | busy = true | 137 | busy = true |
| 130 | try { | 138 | try { |
| 131 | - const result = await CreatorService.Finish({ name, icon: icon.trim(), environment }) | 139 | + const result = await CreatorService.Finish({ name, title: title.trim(), icon: icon.trim(), environment }) |
| 132 | if (result.problem) problem = result.problem | 140 | if (result.problem) problem = result.problem |
| 133 | else if (result.problems && result.problems.length > 0) refused = result.problems | 141 | else if (result.problems && result.problems.length > 0) refused = result.problems |
| 134 | else { | 142 | else { |
| @@ -142,6 +150,14 @@ | |||
| 142 | } | 150 | } |
| 143 | } | 151 | } |
| 144 | 152 | ||
| 153 | + // The @ name made from the name shown, free, while it was not typed by hand. | ||
| 154 | + function followTitle() { | ||
| 155 | + if (nameEdited) return | ||
| 156 | + const made = nameFromTitle(title) | ||
| 157 | + if (made) name = freeName(made, taken) | ||
| 158 | + problem = '' | ||
| 159 | + } | ||
| 160 | + | ||
| 145 | function close() { | 161 | function close() { |
| 146 | appState.creator = '' | 162 | appState.creator = '' |
| 147 | } | 163 | } |
| @@ -210,12 +226,16 @@ | |||
| 210 | <div class="row"> | 226 | <div class="row"> |
| 211 | <span class="preview"><AgentAvatar icon={icon} title={title || name} name={name} size={34} /></span> | 227 | <span class="preview"><AgentAvatar icon={icon} title={title || name} name={name} size={34} /></span> |
| 212 | <label class="grow"> | 228 | <label class="grow"> |
| 213 | - {t('creator.name')} | 229 | + {t('creator.agentTitle')} |
| 214 | - <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" /> | 230 | + <input bind:value={title} oninput={followTitle} /> |
| 215 | </label> | 231 | </label> |
| 216 | </div> | 232 | </div> |
| 217 | - <small id="creator-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | 233 | + <label> |
| 218 | - {problem ? t(problemKey(problem)) : t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | 234 | + {t('creator.name')} |
| 235 | + <input bind:value={name} oninput={() => ((problem = ''), (nameEdited = true))} aria-invalid={problem !== '' || takenNow} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" /> | ||
| 236 | + </label> | ||
| 237 | + <small id="creator-name-hint" class:problem-text={problem !== '' || takenNow} role={problem || takenNow ? 'alert' : undefined}> | ||
| 238 | + {#if problem}{t(problemKey(problem))}{:else if takenNow}{t('creator.problem.taken', { suggestion: freeName(name, taken) })}{:else}{t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}{/if} | ||
| 219 | </small> | 239 | </small> |
| 220 | <div class="group" aria-label={t('creator.icon')}> | 240 | <div class="group" aria-label={t('creator.icon')}> |
| 221 | <span class="label">{t('creator.icon')}</span> | 241 | <span class="label">{t('creator.icon')}</span> |
modified
frontend/src/lib/agent/CreateSbxAgent.svelte +19 -5 | @@ -11,7 +11,7 @@ | ||
| 11 | 11 | import { SbxCreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 12 | 12 | import type { Kind } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate' |
| 13 | 13 | import { agentAdded, appState } from '../state.svelte' |
| 14 | - import { agentFolder, iconChoices, problemKey, sbxMissing, validSbxName } from '../creator' | |
| 14 | + import { agentFolder, freeName, iconChoices, problemKey, sbxMissing, sbxNameFromTitle, validSbxName } from '../creator' | |
| 15 | 15 | import AgentAvatar from './AgentAvatar.svelte' |
| 16 | 16 | import ErrorText from '../chat/ErrorText.svelte' |
| 17 | 17 | import Spinner from '../chat/Spinner.svelte' |
| @@ -31,6 +31,11 @@ | ||
| 31 | 31 | let title = $state('') |
| 32 | 32 | let icon = $state('') |
| 33 | 33 | let problem = $state('') |
| 34 | + // Issue #99: the @ name follows the name shown until it is typed by hand; | |
| 35 | + // taken is the names already used (agents, folders, sandboxes). | |
| 36 | + let nameEdited = $state(false) | |
| 37 | + let taken = $state<string[]>([]) | |
| 38 | + const takenNow = $derived(name !== '' && taken.includes(name)) | |
| 34 | 39 | let refused = $state<string[]>([]) |
| 35 | 40 | let error = $state('') |
| 36 | 41 | |
| @@ -54,6 +59,7 @@ | ||
| 54 | 59 | const result = await SbxCreatorService.Check(kind.id) |
| 55 | 60 | hasKey = result.hasKey |
| 56 | 61 | agentsFolder = result.agentsFolder |
| 62 | + taken = result.taken ?? [] | |
| 57 | 63 | name = name || result.name |
| 58 | 64 | step = hasKey ? 'details' : 'key' |
| 59 | 65 | } catch (caught) { |
| @@ -101,9 +107,17 @@ | ||
| 101 | 107 | } |
| 102 | 108 | } |
| 103 | 109 | |
| 110 | + // The @ name made from the name shown, free, while it was not typed by hand. | |
| 111 | + function followTitle() { | |
| 112 | + if (nameEdited || !kind) return | |
| 113 | + name = freeName(sbxNameFromTitle(title) || kind.id, taken) | |
| 114 | + problem = '' | |
| 115 | + } | |
| 116 | + | |
| 104 | 117 | function another() { |
| 105 | 118 | kind = null |
| 106 | 119 | name = '' |
| 120 | + nameEdited = false | |
| 107 | 121 | problem = '' |
| 108 | 122 | step = 'kind' |
| 109 | 123 | } |
| @@ -168,15 +182,15 @@ | ||
| 168 | 182 | <span class="preview"><AgentAvatar {icon} title={title || name} {name} size={34} /></span> |
| 169 | 183 | <label class="grow"> |
| 170 | 184 | {t('sbxCreator.agentTitle')} |
| 171 | - <input bind:value={title} /> | |
| 185 | + <input bind:value={title} oninput={followTitle} /> | |
| 172 | 186 | </label> |
| 173 | 187 | </div> |
| 174 | 188 | <label> |
| 175 | 189 | {t('sbxCreator.name')} |
| 176 | - <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> | |
| 190 | + <input bind:value={name} oninput={() => ((problem = ''), (nameEdited = true))} aria-invalid={problem !== '' || takenNow} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> | |
| 177 | 191 | </label> |
| 178 | - <small id="sbx-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | |
| 179 | - {problem ? t(problemKey(problem)) : t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | |
| 192 | + <small id="sbx-name-hint" class:problem-text={problem !== '' || takenNow} role={problem || takenNow ? 'alert' : undefined}> | |
| 193 | + {#if problem}{t(problemKey(problem))}{:else if takenNow}{t('creator.problem.taken', { suggestion: freeName(name, taken) })}{:else}{t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}{/if} | |
| 180 | 194 | </small> |
| 181 | 195 | <div class="group" aria-label={t('creator.icon')}> |
| 182 | 196 | <span class="label">{t('creator.icon')}</span> |
| @@ -11,7 +11,7 @@ | |||
| 11 | import { SbxCreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 11 | import { SbxCreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 12 | import type { Kind } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate' | 12 | import type { Kind } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate' |
| 13 | import { agentAdded, appState } from '../state.svelte' | 13 | import { agentAdded, appState } from '../state.svelte' |
| 14 | - import { agentFolder, iconChoices, problemKey, sbxMissing, validSbxName } from '../creator' | 14 | + import { agentFolder, freeName, iconChoices, problemKey, sbxMissing, sbxNameFromTitle, validSbxName } from '../creator' |
| 15 | import AgentAvatar from './AgentAvatar.svelte' | 15 | import AgentAvatar from './AgentAvatar.svelte' |
| 16 | import ErrorText from '../chat/ErrorText.svelte' | 16 | import ErrorText from '../chat/ErrorText.svelte' |
| 17 | import Spinner from '../chat/Spinner.svelte' | 17 | import Spinner from '../chat/Spinner.svelte' |
| @@ -31,6 +31,11 @@ | |||
| 31 | let title = $state('') | 31 | let title = $state('') |
| 32 | let icon = $state('') | 32 | let icon = $state('') |
| 33 | let problem = $state('') | 33 | let problem = $state('') |
| 34 | + // Issue #99: the @ name follows the name shown until it is typed by hand; | ||
| 35 | + // taken is the names already used (agents, folders, sandboxes). | ||
| 36 | + let nameEdited = $state(false) | ||
| 37 | + let taken = $state<string[]>([]) | ||
| 38 | + const takenNow = $derived(name !== '' && taken.includes(name)) | ||
| 34 | let refused = $state<string[]>([]) | 39 | let refused = $state<string[]>([]) |
| 35 | let error = $state('') | 40 | let error = $state('') |
| 36 | 41 | ||
| @@ -54,6 +59,7 @@ | |||
| 54 | const result = await SbxCreatorService.Check(kind.id) | 59 | const result = await SbxCreatorService.Check(kind.id) |
| 55 | hasKey = result.hasKey | 60 | hasKey = result.hasKey |
| 56 | agentsFolder = result.agentsFolder | 61 | agentsFolder = result.agentsFolder |
| 62 | + taken = result.taken ?? [] | ||
| 57 | name = name || result.name | 63 | name = name || result.name |
| 58 | step = hasKey ? 'details' : 'key' | 64 | step = hasKey ? 'details' : 'key' |
| 59 | } catch (caught) { | 65 | } catch (caught) { |
| @@ -101,9 +107,17 @@ | |||
| 101 | } | 107 | } |
| 102 | } | 108 | } |
| 103 | 109 | ||
| 110 | + // The @ name made from the name shown, free, while it was not typed by hand. | ||
| 111 | + function followTitle() { | ||
| 112 | + if (nameEdited || !kind) return | ||
| 113 | + name = freeName(sbxNameFromTitle(title) || kind.id, taken) | ||
| 114 | + problem = '' | ||
| 115 | + } | ||
| 116 | + | ||
| 104 | function another() { | 117 | function another() { |
| 105 | kind = null | 118 | kind = null |
| 106 | name = '' | 119 | name = '' |
| 120 | + nameEdited = false | ||
| 107 | problem = '' | 121 | problem = '' |
| 108 | step = 'kind' | 122 | step = 'kind' |
| 109 | } | 123 | } |
| @@ -168,15 +182,15 @@ | |||
| 168 | <span class="preview"><AgentAvatar {icon} title={title || name} {name} size={34} /></span> | 182 | <span class="preview"><AgentAvatar {icon} title={title || name} {name} size={34} /></span> |
| 169 | <label class="grow"> | 183 | <label class="grow"> |
| 170 | {t('sbxCreator.agentTitle')} | 184 | {t('sbxCreator.agentTitle')} |
| 171 | - <input bind:value={title} /> | 185 | + <input bind:value={title} oninput={followTitle} /> |
| 172 | </label> | 186 | </label> |
| 173 | </div> | 187 | </div> |
| 174 | <label> | 188 | <label> |
| 175 | {t('sbxCreator.name')} | 189 | {t('sbxCreator.name')} |
| 176 | - <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> | 190 | + <input bind:value={name} oninput={() => ((problem = ''), (nameEdited = true))} aria-invalid={problem !== '' || takenNow} aria-describedby="sbx-name-hint" spellcheck="false" autocapitalize="off" /> |
| 177 | </label> | 191 | </label> |
| 178 | - <small id="sbx-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}> | 192 | + <small id="sbx-name-hint" class:problem-text={problem !== '' || takenNow} role={problem || takenNow ? 'alert' : undefined}> |
| 179 | - {problem ? t(problemKey(problem)) : t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })} | 193 | + {#if problem}{t(problemKey(problem))}{:else if takenNow}{t('creator.problem.taken', { suggestion: freeName(name, taken) })}{:else}{t('sbxCreator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}{/if} |
| 180 | </small> | 194 | </small> |
| 181 | <div class="group" aria-label={t('creator.icon')}> | 195 | <div class="group" aria-label={t('creator.icon')}> |
| 182 | <span class="label">{t('creator.icon')}</span> | 196 | <span class="label">{t('creator.icon')}</span> |
modified
frontend/src/lib/creator.test.ts +16 -1 | @@ -1,7 +1,7 @@ | ||
| 1 | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | |
| 3 | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { agentFolder, contentOf, sbxMissing, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | |
| 4 | +import { agentFolder, contentOf, freeName, sbxMissing, sbxNameFromTitle, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | |
| 5 | 5 | |
| 6 | 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { |
| 7 | 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } |
| @@ -83,6 +83,21 @@ describe('names and folders', () => { | ||
| 83 | 83 | }) |
| 84 | 84 | }) |
| 85 | 85 | |
| 86 | +describe('the @ name from the name shown (issue #99)', () => { | |
| 87 | + it('makes a sandbox name: no underscore', () => { | |
| 88 | + expect(sbxNameFromTitle('Marcel (assistant)')).toBe('marcel-assistant') | |
| 89 | + expect(sbxNameFromTitle('my_agent')).toBe('my-agent') | |
| 90 | + expect(sbxNameFromTitle('Élodie')).toBe('elodie') | |
| 91 | + expect(sbxNameFromTitle('42')).toBe('') | |
| 92 | + }) | |
| 93 | + it('suggests the first free variant, within 32 characters', () => { | |
| 94 | + expect(freeName('claude', [])).toBe('claude') | |
| 95 | + expect(freeName('claude', ['claude', 'claude-2'])).toBe('claude-3') | |
| 96 | + expect(freeName('a'.repeat(32), ['a'.repeat(32)])).toBe('a'.repeat(30) + '-2') | |
| 97 | + expect(freeName('', ['x'])).toBe('') | |
| 98 | + }) | |
| 99 | +}) | |
| 100 | + | |
| 86 | 101 | describe('the sbx assistant (issue #96)', () => { |
| 87 | 102 | it('accepts sandbox names: no underscore', () => { |
| 88 | 103 | expect(validSbxName('claude-2')).toBe(true) |
| @@ -1,7 +1,7 @@ | |||
| 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | 1 | // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE |
| 2 | 2 | ||
| 3 | import { describe, expect, it } from 'vitest' | 3 | import { describe, expect, it } from 'vitest' |
| 4 | -import { agentFolder, contentOf, sbxMissing, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' | 4 | +import { agentFolder, contentOf, freeName, sbxMissing, sbxNameFromTitle, validSbxName, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator' |
| 5 | 5 | ||
| 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { | 6 | function field(name: string, type: string, extra: Partial<Field> = {}): Field { |
| 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } | 7 | return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra } |
| @@ -83,6 +83,21 @@ describe('names and folders', () => { | |||
| 83 | }) | 83 | }) |
| 84 | }) | 84 | }) |
| 85 | 85 | ||
| 86 | +describe('the @ name from the name shown (issue #99)', () => { | ||
| 87 | + it('makes a sandbox name: no underscore', () => { | ||
| 88 | + expect(sbxNameFromTitle('Marcel (assistant)')).toBe('marcel-assistant') | ||
| 89 | + expect(sbxNameFromTitle('my_agent')).toBe('my-agent') | ||
| 90 | + expect(sbxNameFromTitle('Élodie')).toBe('elodie') | ||
| 91 | + expect(sbxNameFromTitle('42')).toBe('') | ||
| 92 | + }) | ||
| 93 | + it('suggests the first free variant, within 32 characters', () => { | ||
| 94 | + expect(freeName('claude', [])).toBe('claude') | ||
| 95 | + expect(freeName('claude', ['claude', 'claude-2'])).toBe('claude-3') | ||
| 96 | + expect(freeName('a'.repeat(32), ['a'.repeat(32)])).toBe('a'.repeat(30) + '-2') | ||
| 97 | + expect(freeName('', ['x'])).toBe('') | ||
| 98 | + }) | ||
| 99 | +}) | ||
| 100 | + | ||
| 86 | describe('the sbx assistant (issue #96)', () => { | 101 | describe('the sbx assistant (issue #96)', () => { |
| 87 | it('accepts sandbox names: no underscore', () => { | 102 | it('accepts sandbox names: no underscore', () => { |
| 88 | expect(validSbxName('claude-2')).toBe(true) | 103 | expect(validSbxName('claude-2')).toBe(true) |
modified
frontend/src/lib/creator.ts +33 -0 | @@ -6,6 +6,7 @@ | ||
| 6 | 6 | // answer mm expects. No Svelte here, so that vitest can test it. |
| 7 | 7 | |
| 8 | 8 | import type { MessageKey } from './i18n/index.svelte' |
| 9 | +import { nameFromTitle } from './agentform' | |
| 9 | 10 | |
| 10 | 11 | /** A question of a form, as acp.FormField gives it. */ |
| 11 | 12 | export interface Field { |
| @@ -119,6 +120,38 @@ export function validSbxName(name: string): boolean { | ||
| 119 | 120 | return /^[a-z][a-z0-9-]{0,31}$/.test(name) |
| 120 | 121 | } |
| 121 | 122 | |
| 123 | +/** | |
| 124 | + * The @ name made from the name shown (issue #99), for an agent in a | |
| 125 | + * sandbox: as the "add an agent" assistant makes it, without "_", which sbx | |
| 126 | + * refuses in a sandbox's name. | |
| 127 | + * | |
| 128 | + * @example | |
| 129 | + * sbxNameFromTitle('Marcel (assistant)') // 'marcel-assistant' | |
| 130 | + * sbxNameFromTitle('my_agent') // 'my-agent' | |
| 131 | + */ | |
| 132 | +export function sbxNameFromTitle(title: string): string { | |
| 133 | + return nameFromTitle(title).replace(/_/g, '-').replace(/-{2,}/g, '-').replace(/-+$/, '') | |
| 134 | +} | |
| 135 | + | |
| 136 | +/** | |
| 137 | + * The first of name, name-2, name-3… that is not taken; the suffix still | |
| 138 | + * fits the 32 characters of a name. '' stays ''. | |
| 139 | + * | |
| 140 | + * @example | |
| 141 | + * freeName('claude', ['claude', 'claude-2']) // 'claude-3' | |
| 142 | + */ | |
| 143 | +export function freeName(name: string, taken: string[] | null | undefined): string { | |
| 144 | + if (!name) return '' | |
| 145 | + const used = new Set(taken ?? []) | |
| 146 | + if (!used.has(name)) return name | |
| 147 | + for (let index = 2; index < 1000; index++) { | |
| 148 | + const suffix = `-${index}` | |
| 149 | + const candidate = name.slice(0, 32 - suffix.length).replace(/-+$/, '') + suffix | |
| 150 | + if (!used.has(candidate)) return candidate | |
| 151 | + } | |
| 152 | + return name | |
| 153 | +} | |
| 154 | + | |
| 122 | 155 | /** An agent name Sidekicks accepts, which is also its folder's name. */ |
| 123 | 156 | export function validName(name: string): boolean { |
| 124 | 157 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) |
| @@ -6,6 +6,7 @@ | |||
| 6 | // answer mm expects. No Svelte here, so that vitest can test it. | 6 | // answer mm expects. No Svelte here, so that vitest can test it. |
| 7 | 7 | ||
| 8 | import type { MessageKey } from './i18n/index.svelte' | 8 | import type { MessageKey } from './i18n/index.svelte' |
| 9 | +import { nameFromTitle } from './agentform' | ||
| 9 | 10 | ||
| 10 | /** A question of a form, as acp.FormField gives it. */ | 11 | /** A question of a form, as acp.FormField gives it. */ |
| 11 | export interface Field { | 12 | export interface Field { |
| @@ -119,6 +120,38 @@ export function validSbxName(name: string): boolean { | |||
| 119 | return /^[a-z][a-z0-9-]{0,31}$/.test(name) | 120 | return /^[a-z][a-z0-9-]{0,31}$/.test(name) |
| 120 | } | 121 | } |
| 121 | 122 | ||
| 123 | +/** | ||
| 124 | + * The @ name made from the name shown (issue #99), for an agent in a | ||
| 125 | + * sandbox: as the "add an agent" assistant makes it, without "_", which sbx | ||
| 126 | + * refuses in a sandbox's name. | ||
| 127 | + * | ||
| 128 | + * @example | ||
| 129 | + * sbxNameFromTitle('Marcel (assistant)') // 'marcel-assistant' | ||
| 130 | + * sbxNameFromTitle('my_agent') // 'my-agent' | ||
| 131 | + */ | ||
| 132 | +export function sbxNameFromTitle(title: string): string { | ||
| 133 | + return nameFromTitle(title).replace(/_/g, '-').replace(/-{2,}/g, '-').replace(/-+$/, '') | ||
| 134 | +} | ||
| 135 | + | ||
| 136 | +/** | ||
| 137 | + * The first of name, name-2, name-3… that is not taken; the suffix still | ||
| 138 | + * fits the 32 characters of a name. '' stays ''. | ||
| 139 | + * | ||
| 140 | + * @example | ||
| 141 | + * freeName('claude', ['claude', 'claude-2']) // 'claude-3' | ||
| 142 | + */ | ||
| 143 | +export function freeName(name: string, taken: string[] | null | undefined): string { | ||
| 144 | + if (!name) return '' | ||
| 145 | + const used = new Set(taken ?? []) | ||
| 146 | + if (!used.has(name)) return name | ||
| 147 | + for (let index = 2; index < 1000; index++) { | ||
| 148 | + const suffix = `-${index}` | ||
| 149 | + const candidate = name.slice(0, 32 - suffix.length).replace(/-+$/, '') + suffix | ||
| 150 | + if (!used.has(candidate)) return candidate | ||
| 151 | + } | ||
| 152 | + return name | ||
| 153 | +} | ||
| 154 | + | ||
| 122 | /** An agent name Sidekicks accepts, which is also its folder's name. */ | 155 | /** An agent name Sidekicks accepts, which is also its folder's name. */ |
| 123 | export function validName(name: string): boolean { | 156 | export function validName(name: string): boolean { |
| 124 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) | 157 | return /^[a-z][a-z0-9_-]{0,31}$/.test(name) |
modified
frontend/src/lib/i18n/messages.ts +4 -0 | @@ -338,6 +338,8 @@ export const en = { | ||
| 338 | 338 | 'welcome.createSbxFirst': '✨ Create a Claude, Gemini, Codex or Vibe agent', |
| 339 | 339 | 'action.createSbxAgent': 'Create an agent in a sandbox (Claude, Gemini, Codex, Vibe)', |
| 340 | 340 | 'creator.problem.sandboxExists': 'A sandbox with this name already exists: choose another name.', |
| 341 | + 'creator.problem.taken': 'This name is already used (by an agent, a folder or a sandbox): try {suggestion}.', | |
| 342 | + 'creator.agentTitle': 'Name shown', | |
| 341 | 343 | 'sbxCreator.title': 'Create an agent in a sandbox', |
| 342 | 344 | 'sbxCreator.intro': 'Choose the agent: it runs in a Docker Sandbox, isolated from your computer. Sidekicks prepares everything.', |
| 343 | 345 | 'sbxCreator.choose': 'Which agent?', |
| @@ -814,6 +816,8 @@ export const fr: Record<MessageKey, string> = { | ||
| 814 | 816 | 'welcome.createSbxFirst': '✨ Créer un agent Claude, Gemini, Codex ou Vibe', |
| 815 | 817 | 'action.createSbxAgent': 'Créer un agent dans une sandbox (Claude, Gemini, Codex, Vibe)', |
| 816 | 818 | 'creator.problem.sandboxExists': 'Une sandbox porte déjà ce nom : choisissez un autre nom.', |
| 819 | + 'creator.problem.taken': 'Ce nom est déjà utilisé (par un agent, un dossier ou une sandbox) : essayez {suggestion}.', | |
| 820 | + 'creator.agentTitle': 'Nom affiché', | |
| 817 | 821 | 'sbxCreator.title': 'Créer un agent dans une sandbox', |
| 818 | 822 | 'sbxCreator.intro': "Choisissez l'agent : il tourne dans une Docker Sandbox, isolé de votre ordinateur. Sidekicks prépare tout.", |
| 819 | 823 | 'sbxCreator.choose': 'Quel agent ?', |
| @@ -338,6 +338,8 @@ export const en = { | |||
| 338 | 'welcome.createSbxFirst': '✨ Create a Claude, Gemini, Codex or Vibe agent', | 338 | 'welcome.createSbxFirst': '✨ Create a Claude, Gemini, Codex or Vibe agent', |
| 339 | 'action.createSbxAgent': 'Create an agent in a sandbox (Claude, Gemini, Codex, Vibe)', | 339 | 'action.createSbxAgent': 'Create an agent in a sandbox (Claude, Gemini, Codex, Vibe)', |
| 340 | 'creator.problem.sandboxExists': 'A sandbox with this name already exists: choose another name.', | 340 | 'creator.problem.sandboxExists': 'A sandbox with this name already exists: choose another name.', |
| 341 | + 'creator.problem.taken': 'This name is already used (by an agent, a folder or a sandbox): try {suggestion}.', | ||
| 342 | + 'creator.agentTitle': 'Name shown', | ||
| 341 | 'sbxCreator.title': 'Create an agent in a sandbox', | 343 | 'sbxCreator.title': 'Create an agent in a sandbox', |
| 342 | 'sbxCreator.intro': 'Choose the agent: it runs in a Docker Sandbox, isolated from your computer. Sidekicks prepares everything.', | 344 | 'sbxCreator.intro': 'Choose the agent: it runs in a Docker Sandbox, isolated from your computer. Sidekicks prepares everything.', |
| 343 | 'sbxCreator.choose': 'Which agent?', | 345 | 'sbxCreator.choose': 'Which agent?', |
| @@ -814,6 +816,8 @@ export const fr: Record<MessageKey, string> = { | |||
| 814 | 'welcome.createSbxFirst': '✨ Créer un agent Claude, Gemini, Codex ou Vibe', | 816 | 'welcome.createSbxFirst': '✨ Créer un agent Claude, Gemini, Codex ou Vibe', |
| 815 | 'action.createSbxAgent': 'Créer un agent dans une sandbox (Claude, Gemini, Codex, Vibe)', | 817 | 'action.createSbxAgent': 'Créer un agent dans une sandbox (Claude, Gemini, Codex, Vibe)', |
| 816 | 'creator.problem.sandboxExists': 'Une sandbox porte déjà ce nom : choisissez un autre nom.', | 818 | 'creator.problem.sandboxExists': 'Une sandbox porte déjà ce nom : choisissez un autre nom.', |
| 819 | + 'creator.problem.taken': 'Ce nom est déjà utilisé (par un agent, un dossier ou une sandbox) : essayez {suggestion}.', | ||
| 820 | + 'creator.agentTitle': 'Nom affiché', | ||
| 817 | 'sbxCreator.title': 'Créer un agent dans une sandbox', | 821 | 'sbxCreator.title': 'Créer un agent dans une sandbox', |
| 818 | 'sbxCreator.intro': "Choisissez l'agent : il tourne dans une Docker Sandbox, isolé de votre ordinateur. Sidekicks prépare tout.", | 822 | 'sbxCreator.intro': "Choisissez l'agent : il tourne dans une Docker Sandbox, isolé de votre ordinateur. Sidekicks prépare tout.", |
| 819 | 'sbxCreator.choose': 'Quel agent ?', | 823 | 'sbxCreator.choose': 'Quel agent ?', |
modified
internal/app/creator.go +45 -3 | @@ -6,7 +6,10 @@ import ( | ||
| 6 | 6 | "context" |
| 7 | 7 | "errors" |
| 8 | 8 | "fmt" |
| 9 | + "os" | |
| 9 | 10 | "path/filepath" |
| 11 | + "slices" | |
| 12 | + "strings" | |
| 10 | 13 | "sync" |
| 11 | 14 | |
| 12 | 15 | "git.rickub.com/bots-garden/sidekicks/internal/acp" |
| @@ -42,12 +45,17 @@ type CreatorStart struct { | ||
| 42 | 45 | AgentsFolder string `json:"agentsFolder"` |
| 43 | 46 | // Version is what mm --version said. |
| 44 | 47 | Version string `json:"version"` |
| 48 | + // Taken is the names already used, by an agent or by a folder of the | |
| 49 | + // agents' folder: the interface suggests a free one (issue #99). | |
| 50 | + Taken []string `json:"taken"` | |
| 45 | 51 | } |
| 46 | 52 | |
| 47 | 53 | // CreatorFinish is the last step: the agent's name (its folder's too), its |
| 48 | 54 | // emoji, and where it runs: local, container or sbx. |
| 49 | 55 | type CreatorFinish struct { |
| 50 | - Name string `json:"name"` | |
| 56 | + Name string `json:"name"` | |
| 57 | + // Title is the name shown; "" keeps mm's (acp.title). | |
| 58 | + Title string `json:"title"` | |
| 51 | 59 | Icon string `json:"icon"` |
| 52 | 60 | Environment string `json:"environment"` |
| 53 | 61 | } |
| @@ -112,7 +120,7 @@ func (s *CreatorService) Start(ctx context.Context) (CreatorStart, error) { | ||
| 112 | 120 | } |
| 113 | 121 | creation.session = session |
| 114 | 122 | view, err := session.Begin(ctx) |
| 115 | - return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version}, err | |
| 123 | + return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version, Taken: s.Core.takenNames(options.AgentsFolder, nil)}, err | |
| 116 | 124 | } |
| 117 | 125 | |
| 118 | 126 | // session is the wizard in progress, or ErrClosed. |
| @@ -191,6 +199,40 @@ func (s *CreatorService) Cancel() { | ||
| 191 | 199 | } |
| 192 | 200 | } |
| 193 | 201 | |
| 202 | +// takenNames is the names an agent created by an assistant cannot take: the | |
| 203 | +// agents of the configuration, the folders of the agents' folder (but the | |
| 204 | +// assistants' temporary ones) and the sandboxes given, sorted. | |
| 205 | +func (c *Core) takenNames(folder string, sandboxes []string) []string { | |
| 206 | + taken := map[string]bool{} | |
| 207 | + c.mu.Lock() | |
| 208 | + for _, agent := range c.cfg.Agents { | |
| 209 | + taken[agent.Name] = true | |
| 210 | + } | |
| 211 | + c.mu.Unlock() | |
| 212 | + entries, _ := os.ReadDir(folder) | |
| 213 | + for _, entry := range entries { | |
| 214 | + if !strings.HasPrefix(entry.Name(), ".") { | |
| 215 | + taken[entry.Name()] = true | |
| 216 | + } | |
| 217 | + } | |
| 218 | + for _, sandbox := range sandboxes { | |
| 219 | + taken[sandbox] = true | |
| 220 | + } | |
| 221 | + names := make([]string, 0, len(taken)) | |
| 222 | + for name := range taken { | |
| 223 | + names = append(names, name) | |
| 224 | + } | |
| 225 | + slices.Sort(names) | |
| 226 | + return names | |
| 227 | +} | |
| 228 | + | |
| 229 | +func orDefault(value, fallback string) string { | |
| 230 | + if value == "" { | |
| 231 | + return fallback | |
| 232 | + } | |
| 233 | + return value | |
| 234 | +} | |
| 235 | + | |
| 194 | 236 | func (c *Core) hasAgent(name string) bool { |
| 195 | 237 | c.mu.Lock() |
| 196 | 238 | defer c.mu.Unlock() |
| @@ -205,7 +247,7 @@ func (c *Core) hasAgent(name string) bool { | ||
| 205 | 247 | // agent file's path is the same inside. |
| 206 | 248 | func agentFormOf(form CreatorFinish, result creator.Result) (AgentForm, error) { |
| 207 | 249 | agent := AgentForm{ |
| 208 | - Name: form.Name, Title: result.Title, Icon: form.Icon, Environment: result.Environment, | |
| 250 | + Name: form.Name, Title: orDefault(strings.TrimSpace(form.Title), result.Title), Icon: form.Icon, Environment: result.Environment, | |
| 209 | 251 | Program: "mm", Arguments: joinArguments([]string{"--acp", "--config", result.AgentFile}), Workspace: result.Folder, |
| 210 | 252 | } |
| 211 | 253 | switch result.Environment { |
| @@ -6,7 +6,10 @@ import ( | |||
| 6 | "context" | 6 | "context" |
| 7 | "errors" | 7 | "errors" |
| 8 | "fmt" | 8 | "fmt" |
| 9 | + "os" | ||
| 9 | "path/filepath" | 10 | "path/filepath" |
| 11 | + "slices" | ||
| 12 | + "strings" | ||
| 10 | "sync" | 13 | "sync" |
| 11 | 14 | ||
| 12 | "git.rickub.com/bots-garden/sidekicks/internal/acp" | 15 | "git.rickub.com/bots-garden/sidekicks/internal/acp" |
| @@ -42,12 +45,17 @@ type CreatorStart struct { | |||
| 42 | AgentsFolder string `json:"agentsFolder"` | 45 | AgentsFolder string `json:"agentsFolder"` |
| 43 | // Version is what mm --version said. | 46 | // Version is what mm --version said. |
| 44 | Version string `json:"version"` | 47 | Version string `json:"version"` |
| 48 | + // Taken is the names already used, by an agent or by a folder of the | ||
| 49 | + // agents' folder: the interface suggests a free one (issue #99). | ||
| 50 | + Taken []string `json:"taken"` | ||
| 45 | } | 51 | } |
| 46 | 52 | ||
| 47 | // CreatorFinish is the last step: the agent's name (its folder's too), its | 53 | // CreatorFinish is the last step: the agent's name (its folder's too), its |
| 48 | // emoji, and where it runs: local, container or sbx. | 54 | // emoji, and where it runs: local, container or sbx. |
| 49 | type CreatorFinish struct { | 55 | type CreatorFinish struct { |
| 50 | - Name string `json:"name"` | 56 | + Name string `json:"name"` |
| 57 | + // Title is the name shown; "" keeps mm's (acp.title). | ||
| 58 | + Title string `json:"title"` | ||
| 51 | Icon string `json:"icon"` | 59 | Icon string `json:"icon"` |
| 52 | Environment string `json:"environment"` | 60 | Environment string `json:"environment"` |
| 53 | } | 61 | } |
| @@ -112,7 +120,7 @@ func (s *CreatorService) Start(ctx context.Context) (CreatorStart, error) { | |||
| 112 | } | 120 | } |
| 113 | creation.session = session | 121 | creation.session = session |
| 114 | view, err := session.Begin(ctx) | 122 | view, err := session.Begin(ctx) |
| 115 | - return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version}, err | 123 | + return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version, Taken: s.Core.takenNames(options.AgentsFolder, nil)}, err |
| 116 | } | 124 | } |
| 117 | 125 | ||
| 118 | // session is the wizard in progress, or ErrClosed. | 126 | // session is the wizard in progress, or ErrClosed. |
| @@ -191,6 +199,40 @@ func (s *CreatorService) Cancel() { | |||
| 191 | } | 199 | } |
| 192 | } | 200 | } |
| 193 | 201 | ||
| 202 | +// takenNames is the names an agent created by an assistant cannot take: the | ||
| 203 | +// agents of the configuration, the folders of the agents' folder (but the | ||
| 204 | +// assistants' temporary ones) and the sandboxes given, sorted. | ||
| 205 | +func (c *Core) takenNames(folder string, sandboxes []string) []string { | ||
| 206 | + taken := map[string]bool{} | ||
| 207 | + c.mu.Lock() | ||
| 208 | + for _, agent := range c.cfg.Agents { | ||
| 209 | + taken[agent.Name] = true | ||
| 210 | + } | ||
| 211 | + c.mu.Unlock() | ||
| 212 | + entries, _ := os.ReadDir(folder) | ||
| 213 | + for _, entry := range entries { | ||
| 214 | + if !strings.HasPrefix(entry.Name(), ".") { | ||
| 215 | + taken[entry.Name()] = true | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + for _, sandbox := range sandboxes { | ||
| 219 | + taken[sandbox] = true | ||
| 220 | + } | ||
| 221 | + names := make([]string, 0, len(taken)) | ||
| 222 | + for name := range taken { | ||
| 223 | + names = append(names, name) | ||
| 224 | + } | ||
| 225 | + slices.Sort(names) | ||
| 226 | + return names | ||
| 227 | +} | ||
| 228 | + | ||
| 229 | +func orDefault(value, fallback string) string { | ||
| 230 | + if value == "" { | ||
| 231 | + return fallback | ||
| 232 | + } | ||
| 233 | + return value | ||
| 234 | +} | ||
| 235 | + | ||
| 194 | func (c *Core) hasAgent(name string) bool { | 236 | func (c *Core) hasAgent(name string) bool { |
| 195 | c.mu.Lock() | 237 | c.mu.Lock() |
| 196 | defer c.mu.Unlock() | 238 | defer c.mu.Unlock() |
| @@ -205,7 +247,7 @@ func (c *Core) hasAgent(name string) bool { | |||
| 205 | // agent file's path is the same inside. | 247 | // agent file's path is the same inside. |
| 206 | func agentFormOf(form CreatorFinish, result creator.Result) (AgentForm, error) { | 248 | func agentFormOf(form CreatorFinish, result creator.Result) (AgentForm, error) { |
| 207 | agent := AgentForm{ | 249 | agent := AgentForm{ |
| 208 | - Name: form.Name, Title: result.Title, Icon: form.Icon, Environment: result.Environment, | 250 | + Name: form.Name, Title: orDefault(strings.TrimSpace(form.Title), result.Title), Icon: form.Icon, Environment: result.Environment, |
| 209 | Program: "mm", Arguments: joinArguments([]string{"--acp", "--config", result.AgentFile}), Workspace: result.Folder, | 251 | Program: "mm", Arguments: joinArguments([]string{"--acp", "--config", result.AgentFile}), Workspace: result.Folder, |
| 210 | } | 252 | } |
| 211 | switch result.Environment { | 253 | switch result.Environment { |
modified
internal/app/creator_test.go +3 -3 | @@ -38,7 +38,7 @@ func written(t *testing.T, service *app.CreatorService, name string) { | ||
| 38 | 38 | if err != nil { |
| 39 | 39 | t.Fatal(err) |
| 40 | 40 | } |
| 41 | - if start.View.Form == nil || start.Version != "mm v1.0.9" { | |
| 41 | + if start.View.Form == nil || start.Version != "mm v1.0.9" || !slices.Contains(start.Taken, "alice") { | |
| 42 | 42 | t.Fatalf("start: %+v", start) |
| 43 | 43 | } |
| 44 | 44 | view, err := service.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}}) |
| @@ -50,7 +50,7 @@ func written(t *testing.T, service *app.CreatorService, name string) { | ||
| 50 | 50 | func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) { |
| 51 | 51 | service, path, folder := creatorFixture(t, "mm v1.0.9") |
| 52 | 52 | written(t, service, "Bob") |
| 53 | - result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Icon: "🦊", Environment: creator.Local}) | |
| 53 | + result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Title: "Bob the fox", Icon: "🦊", Environment: creator.Local}) | |
| 54 | 54 | if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "bob" { |
| 55 | 55 | t.Fatalf("finish: %+v %v", result, err) |
| 56 | 56 | } |
| @@ -60,7 +60,7 @@ func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) { | ||
| 60 | 60 | } |
| 61 | 61 | bob, ok := cfg.Agent("bob") |
| 62 | 62 | agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml") |
| 63 | - if !ok || bob.Icon != "🦊" || bob.Title != "Bob (developer)" || bob.Workspace != filepath.Join(folder, "bob") || | |
| 63 | + if !ok || bob.Icon != "🦊" || bob.Title != "Bob the fox" || bob.Workspace != filepath.Join(folder, "bob") || | |
| 64 | 64 | !slices.Equal(bob.Args, []string{"--acp", "--config", agentFile}) || filepath.Base(bob.Command) != "mm" { |
| 65 | 65 | t.Fatalf("bob: %+v", bob) |
| 66 | 66 | } |
| @@ -38,7 +38,7 @@ func written(t *testing.T, service *app.CreatorService, name string) { | |||
| 38 | if err != nil { | 38 | if err != nil { |
| 39 | t.Fatal(err) | 39 | t.Fatal(err) |
| 40 | } | 40 | } |
| 41 | - if start.View.Form == nil || start.Version != "mm v1.0.9" { | 41 | + if start.View.Form == nil || start.Version != "mm v1.0.9" || !slices.Contains(start.Taken, "alice") { |
| 42 | t.Fatalf("start: %+v", start) | 42 | t.Fatalf("start: %+v", start) |
| 43 | } | 43 | } |
| 44 | view, err := service.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}}) | 44 | view, err := service.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}}) |
| @@ -50,7 +50,7 @@ func written(t *testing.T, service *app.CreatorService, name string) { | |||
| 50 | func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) { | 50 | func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) { |
| 51 | service, path, folder := creatorFixture(t, "mm v1.0.9") | 51 | service, path, folder := creatorFixture(t, "mm v1.0.9") |
| 52 | written(t, service, "Bob") | 52 | written(t, service, "Bob") |
| 53 | - result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Icon: "🦊", Environment: creator.Local}) | 53 | + result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Title: "Bob the fox", Icon: "🦊", Environment: creator.Local}) |
| 54 | if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "bob" { | 54 | if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "bob" { |
| 55 | t.Fatalf("finish: %+v %v", result, err) | 55 | t.Fatalf("finish: %+v %v", result, err) |
| 56 | } | 56 | } |
| @@ -60,7 +60,7 @@ func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) { | |||
| 60 | } | 60 | } |
| 61 | bob, ok := cfg.Agent("bob") | 61 | bob, ok := cfg.Agent("bob") |
| 62 | agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml") | 62 | agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml") |
| 63 | - if !ok || bob.Icon != "🦊" || bob.Title != "Bob (developer)" || bob.Workspace != filepath.Join(folder, "bob") || | 63 | + if !ok || bob.Icon != "🦊" || bob.Title != "Bob the fox" || bob.Workspace != filepath.Join(folder, "bob") || |
| 64 | !slices.Equal(bob.Args, []string{"--acp", "--config", agentFile}) || filepath.Base(bob.Command) != "mm" { | 64 | !slices.Equal(bob.Args, []string{"--acp", "--config", agentFile}) || filepath.Base(bob.Command) != "mm" { |
| 65 | t.Fatalf("bob: %+v", bob) | 65 | t.Fatalf("bob: %+v", bob) |
| 66 | } | 66 | } |
modified
internal/app/sbxcreator.go +4 -1 | @@ -41,6 +41,9 @@ type SbxCheck struct { | ||
| 41 | 41 | HasKey bool `json:"hasKey"` |
| 42 | 42 | Name string `json:"name"` |
| 43 | 43 | AgentsFolder string `json:"agentsFolder"` |
| 44 | + // Taken is the names already used, by an agent, a folder of the agents' | |
| 45 | + // folder or a sandbox: the interface suggests a free one (issue #99). | |
| 46 | + Taken []string `json:"taken"` | |
| 44 | 47 | } |
| 45 | 48 | |
| 46 | 49 | // SbxCreateForm is the agent to create: its kind, its name (its folder's and |
| @@ -93,7 +96,7 @@ func (s *SbxCreatorService) Check(ctx context.Context, kindID string) (SbxCheck, | ||
| 93 | 96 | return SbxCheck{}, err |
| 94 | 97 | } |
| 95 | 98 | folder := s.Core.agentsFolder() |
| 96 | - check := SbxCheck{HasKey: hasKey, AgentsFolder: folder} | |
| 99 | + check := SbxCheck{HasKey: hasKey, AgentsFolder: folder, Taken: s.Core.takenNames(folder, sandboxes)} | |
| 97 | 100 | for index := 1; index < 100; index++ { |
| 98 | 101 | name := kind.ID |
| 99 | 102 | if index > 1 { |
| @@ -41,6 +41,9 @@ type SbxCheck struct { | |||
| 41 | HasKey bool `json:"hasKey"` | 41 | HasKey bool `json:"hasKey"` |
| 42 | Name string `json:"name"` | 42 | Name string `json:"name"` |
| 43 | AgentsFolder string `json:"agentsFolder"` | 43 | AgentsFolder string `json:"agentsFolder"` |
| 44 | + // Taken is the names already used, by an agent, a folder of the agents' | ||
| 45 | + // folder or a sandbox: the interface suggests a free one (issue #99). | ||
| 46 | + Taken []string `json:"taken"` | ||
| 44 | } | 47 | } |
| 45 | 48 | ||
| 46 | // SbxCreateForm is the agent to create: its kind, its name (its folder's and | 49 | // SbxCreateForm is the agent to create: its kind, its name (its folder's and |
| @@ -93,7 +96,7 @@ func (s *SbxCreatorService) Check(ctx context.Context, kindID string) (SbxCheck, | |||
| 93 | return SbxCheck{}, err | 96 | return SbxCheck{}, err |
| 94 | } | 97 | } |
| 95 | folder := s.Core.agentsFolder() | 98 | folder := s.Core.agentsFolder() |
| 96 | - check := SbxCheck{HasKey: hasKey, AgentsFolder: folder} | 99 | + check := SbxCheck{HasKey: hasKey, AgentsFolder: folder, Taken: s.Core.takenNames(folder, sandboxes)} |
| 97 | for index := 1; index < 100; index++ { | 100 | for index := 1; index < 100; index++ { |
| 98 | name := kind.ID | 101 | name := kind.ID |
| 99 | if index > 1 { | 102 | if index > 1 { |
modified
internal/app/sbxcreator_test.go +7 -1 | @@ -8,6 +8,7 @@ import ( | ||
| 8 | 8 | "fmt" |
| 9 | 9 | "os" |
| 10 | 10 | "path/filepath" |
| 11 | + "slices" | |
| 11 | 12 | "strings" |
| 12 | 13 | "testing" |
| 13 | 14 | |
| @@ -62,9 +63,14 @@ func TestCheckSuggestsAFreeNameAndTellsWhetherTheKeyIsStored(t *testing.T) { | ||
| 62 | 63 | "gemini": {Name: "gemini-2", AgentsFolder: folder}, |
| 63 | 64 | "codex": {Name: "codex-2", HasKey: true, AgentsFolder: folder}, |
| 64 | 65 | } { |
| 65 | - if got, err := service.Check(context.Background(), kind); err != nil || got != want { | |
| 66 | + got, err := service.Check(context.Background(), kind) | |
| 67 | + if err != nil || got.Name != want.Name || got.HasKey != want.HasKey || got.AgentsFolder != want.AgentsFolder { | |
| 66 | 68 | t.Errorf("%s: %+v %v, want %+v", kind, got, err, want) |
| 67 | 69 | } |
| 70 | + // Issue #99: the names taken by an agent, a folder or a sandbox. | |
| 71 | + if !slices.Equal(got.Taken, []string{"claude", "codex", "gemini"}) { | |
| 72 | + t.Errorf("%s: taken %v", kind, got.Taken) | |
| 73 | + } | |
| 68 | 74 | } |
| 69 | 75 | if _, err := service.Check(context.Background(), "nope"); err == nil { |
| 70 | 76 | t.Error("an unknown kind must be refused") |
| @@ -8,6 +8,7 @@ import ( | |||
| 8 | "fmt" | 8 | "fmt" |
| 9 | "os" | 9 | "os" |
| 10 | "path/filepath" | 10 | "path/filepath" |
| 11 | + "slices" | ||
| 11 | "strings" | 12 | "strings" |
| 12 | "testing" | 13 | "testing" |
| 13 | 14 | ||
| @@ -62,9 +63,14 @@ func TestCheckSuggestsAFreeNameAndTellsWhetherTheKeyIsStored(t *testing.T) { | |||
| 62 | "gemini": {Name: "gemini-2", AgentsFolder: folder}, | 63 | "gemini": {Name: "gemini-2", AgentsFolder: folder}, |
| 63 | "codex": {Name: "codex-2", HasKey: true, AgentsFolder: folder}, | 64 | "codex": {Name: "codex-2", HasKey: true, AgentsFolder: folder}, |
| 64 | } { | 65 | } { |
| 65 | - if got, err := service.Check(context.Background(), kind); err != nil || got != want { | 66 | + got, err := service.Check(context.Background(), kind) |
| 67 | + if err != nil || got.Name != want.Name || got.HasKey != want.HasKey || got.AgentsFolder != want.AgentsFolder { | ||
| 66 | t.Errorf("%s: %+v %v, want %+v", kind, got, err, want) | 68 | t.Errorf("%s: %+v %v, want %+v", kind, got, err, want) |
| 67 | } | 69 | } |
| 70 | + // Issue #99: the names taken by an agent, a folder or a sandbox. | ||
| 71 | + if !slices.Equal(got.Taken, []string{"claude", "codex", "gemini"}) { | ||
| 72 | + t.Errorf("%s: taken %v", kind, got.Taken) | ||
| 73 | + } | ||
| 68 | } | 74 | } |
| 69 | if _, err := service.Check(context.Background(), "nope"); err == nil { | 75 | if _, err := service.Check(context.Background(), "nope"); err == nil { |
| 70 | t.Error("an unknown kind must be refused") | 76 | t.Error("an unknown kind must be refused") |