#98 Progression du démarrage d'un agent (création de sa sandbox ou de son conteneur)
Événement agent:progress (étapes checking → preparing → connecting, chaque ligne du démarrage, heure de début ; Status.step/since). La conversation montre une carte : l'étape, le temps écoulé, une phrase qui rassure, une barre quand la ligne donne un pourcentage ou des tailles, la dernière ligne et « Voir le journal » ; le panneau Agents montre l'étape. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9572377 parent: b37a276 modified
.memory/history.md +9 -0 | @@ -282,3 +282,12 @@ | ||
| 282 | 282 | - **2026-11-15 — #86 closed** (owner's word) **and ticket #99** (owner: "in the wizard, the display name and the @ name: by default make the name from the display name"): #99 in v1.5.0 (listed in #93) — @ name derived from the title (agentform `nameFromTitle`, no `_` for sbx) and following it until edited, free variant suggested; also in the mini-me assistant (add the title field, prefilled by mm). Not started. |
| 283 | 283 | - **2026-11-15 — #86 confirmed** (owner: "the Vibe agent works"): comment added; `agent: vibe` + `vibe-acp` verified on the Mac. |
| 284 | 284 | - **2026-11-15 — ticket #100** (owner: "official brand logos for the 4 agents of the wizard"): #100 in v1.5.0 (listed in #93) — needs an image icon (`icon: "logo:<kind>"`, bundled SVGs) beyond emoji/letter, light/dark themes, and checking each brand's usage rules (trademarks; Simple Icons is CC0 but does not grant trademark rights). Not started. |
| 285 | + | |
| 286 | +## 2026-11-15 — #99, #100, #98 (branch feature/98-99-100) | |
| 287 | + | |
| 288 | +- Asked: "implement 98, 99 and 100" (+ mid-way: "for Codex take OpenAI's logo"). | |
| 289 | +- #99: `sbxNameFromTitle`, `freeName` (lib/creator.ts); Go returns `taken` (SbxCheck, CreatorStart); both assistants: @ name follows the name shown until typed, taken name flagged before sending with a suggestion; mini-me assistant got a "Name shown" field (CreatorFinish.title). For mini-me the @ name starts from mm's name and follows the title once it is edited. | |
| 290 | +- Flaky creator tests found when all packages run together: a message mm sends just before a form may come with the next view (SDK goroutines) — tests made order-tolerant (own commit). | |
| 291 | +- #100: icon `logo:<name>` (claude, gemini, openai, mistral) on a white disc; Simple Icons 16.37.0 (CC0) and 13.21.0 for OpenAI (removed later; owner chose to ship it); config warning + schema; Go↔TS list test; catalogue icons; wizard cards/picker draw logos. Brand rules not read in detail — owner's decision recorded in #100. | |
| 292 | +- #98: `agent:progress` events from agents.Manager (checking → preparing on first lifecycle line → connecting; every line during start; Status.step/since), `progress.ts` (percent / sizes, elapsed), `StartProgress.svelte`, Agents panel short step, `showLog`. Xvfb with a fake slow `sbx env create`: card, bar, log button, then the answer. Task 1 (real sbx/docker output) open. | |
| 293 | +- Checks: Go + vitest + lint + svelte-check green. Docs EN/FR (guides, references, release notes v1.5.0). | |
| @@ -282,3 +282,12 @@ | |||
| 282 | - **2026-11-15 — #86 closed** (owner's word) **and ticket #99** (owner: "in the wizard, the display name and the @ name: by default make the name from the display name"): #99 in v1.5.0 (listed in #93) — @ name derived from the title (agentform `nameFromTitle`, no `_` for sbx) and following it until edited, free variant suggested; also in the mini-me assistant (add the title field, prefilled by mm). Not started. | 282 | - **2026-11-15 — #86 closed** (owner's word) **and ticket #99** (owner: "in the wizard, the display name and the @ name: by default make the name from the display name"): #99 in v1.5.0 (listed in #93) — @ name derived from the title (agentform `nameFromTitle`, no `_` for sbx) and following it until edited, free variant suggested; also in the mini-me assistant (add the title field, prefilled by mm). Not started. |
| 283 | - **2026-11-15 — #86 confirmed** (owner: "the Vibe agent works"): comment added; `agent: vibe` + `vibe-acp` verified on the Mac. | 283 | - **2026-11-15 — #86 confirmed** (owner: "the Vibe agent works"): comment added; `agent: vibe` + `vibe-acp` verified on the Mac. |
| 284 | - **2026-11-15 — ticket #100** (owner: "official brand logos for the 4 agents of the wizard"): #100 in v1.5.0 (listed in #93) — needs an image icon (`icon: "logo:<kind>"`, bundled SVGs) beyond emoji/letter, light/dark themes, and checking each brand's usage rules (trademarks; Simple Icons is CC0 but does not grant trademark rights). Not started. | 284 | - **2026-11-15 — ticket #100** (owner: "official brand logos for the 4 agents of the wizard"): #100 in v1.5.0 (listed in #93) — needs an image icon (`icon: "logo:<kind>"`, bundled SVGs) beyond emoji/letter, light/dark themes, and checking each brand's usage rules (trademarks; Simple Icons is CC0 but does not grant trademark rights). Not started. |
| 285 | + | ||
| 286 | +## 2026-11-15 — #99, #100, #98 (branch feature/98-99-100) | ||
| 287 | + | ||
| 288 | +- Asked: "implement 98, 99 and 100" (+ mid-way: "for Codex take OpenAI's logo"). | ||
| 289 | +- #99: `sbxNameFromTitle`, `freeName` (lib/creator.ts); Go returns `taken` (SbxCheck, CreatorStart); both assistants: @ name follows the name shown until typed, taken name flagged before sending with a suggestion; mini-me assistant got a "Name shown" field (CreatorFinish.title). For mini-me the @ name starts from mm's name and follows the title once it is edited. | ||
| 290 | +- Flaky creator tests found when all packages run together: a message mm sends just before a form may come with the next view (SDK goroutines) — tests made order-tolerant (own commit). | ||
| 291 | +- #100: icon `logo:<name>` (claude, gemini, openai, mistral) on a white disc; Simple Icons 16.37.0 (CC0) and 13.21.0 for OpenAI (removed later; owner chose to ship it); config warning + schema; Go↔TS list test; catalogue icons; wizard cards/picker draw logos. Brand rules not read in detail — owner's decision recorded in #100. | ||
| 292 | +- #98: `agent:progress` events from agents.Manager (checking → preparing on first lifecycle line → connecting; every line during start; Status.step/since), `progress.ts` (percent / sizes, elapsed), `StartProgress.svelte`, Agents panel short step, `showLog`. Xvfb with a fake slow `sbx env create`: card, bar, log button, then the answer. Task 1 (real sbx/docker output) open. | ||
| 293 | +- Checks: Go + vitest + lint + svelte-check green. Docs EN/FR (guides, references, release notes v1.5.0). | ||
modified
.memory/summary.md +1 -0 | @@ -27,6 +27,7 @@ What exists: | ||
| 27 | 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). |
| 28 | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Gemini through Antigravity `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. |
| 30 | +- Agent icons (#100): `icon` may be `logo:<name>` (`config.LogoNames` = claude, gemini, openai, mistral; drawn by `frontend/src/lib/logos.ts` from Simple Icons, CC0 — OpenAI from 13.21.0; a Go test checks both lists; unknown name = warning, shows a letter). Start progress (#98): `agent:progress` {agent, step checking|preparing|connecting, line, since} from `agents.Manager`, card `chat/StartProgress.svelte`; `showLog(agent)` opens the Log panel. Assistants' @ name follows the name shown until edited, free variant from Go's `taken` list (#99). | |
| 30 | 31 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 31 | 32 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 32 | 33 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
| @@ -27,6 +27,7 @@ What exists: | |||
| 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). | 27 | - Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's). |
| 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. | 28 | - Agent forms (#95): every conversation agent is started with `acp.Spec.Forms` (advertises `elicitation.form`); a form goes to the session named in `_meta["mm.elicitationScope"]`, else to the only session with a prompt in flight, and is shown as a `FormCard` under the answer (`form:requested`/`form:resolved`, `ChannelService.AnswerForm`); Stop cancels it. Fields rendered by `chat/FormFields.svelte`, shared with the creator. |
| 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Gemini through Antigravity `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. | 29 | - Sandbox creation assistant (#96, `SbxCreatorService`, page `CreateSbxAgent.svelte`, package `internal/sbxcreate`): catalogue of kinds (Claude `claude-agent-acp`, Gemini through Antigravity `agy acp` with kit `docker.io/sbx/antigravity`, Codex `codex-acp`, Vibe `vibe-acp` with kit `docker.io/sbx/vibe-kit`, service `mistral` — #86); writes `<agentsFolder>/<name>/sbxenv.yaml` (English comments) + `workspace/`; name = agent = folder = sandbox (`^[a-z][a-z0-9-]{0,31}$`); API key checked with `sbx secret ls --service`, set with `sbx secret set <service>` on stdin (never in args, files or logs). `appState.creator` is `'' | 'mini-me' | 'sbx'`. |
| 30 | +- Agent icons (#100): `icon` may be `logo:<name>` (`config.LogoNames` = claude, gemini, openai, mistral; drawn by `frontend/src/lib/logos.ts` from Simple Icons, CC0 — OpenAI from 13.21.0; a Go test checks both lists; unknown name = warning, shows a letter). Start progress (#98): `agent:progress` {agent, step checking|preparing|connecting, line, since} from `agents.Manager`, card `chat/StartProgress.svelte`; `showLog(agent)` opens the Log panel. Assistants' @ name follows the name shown until edited, free variant from Go's `taken` list (#99). | ||
| 30 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. | 31 | - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English. |
| 31 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). | 32 | - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit). |
| 32 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. | 33 | - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`. |
modified
.tickets/issues/0098-afficher-la-progression-de-la-creation-d-une-san.yaml +29 -6 | @@ -6,7 +6,7 @@ author: | ||
| 6 | 6 | name: k33g |
| 7 | 7 | email: ph.charriere@gmail.com |
| 8 | 8 | createdAt: 2026-11-15T03:10:13.000Z |
| 9 | -updatedAt: 2026-11-15T03:10:13.000Z | |
| 9 | +updatedAt: 2026-11-15T03:34:55.000Z | |
| 10 | 10 | labels: |
| 11 | 11 | - kind::feature |
| 12 | 12 | - area::ui |
| @@ -66,34 +66,57 @@ tasks: | ||
| 66 | 66 | createdAt: 2026-11-15T03:10:13.000Z |
| 67 | 67 | - id: 2 |
| 68 | 68 | title: "Go : événement de progression (agent, étape, dernière ligne, début) depuis Ensure et le démarrage ACP" |
| 69 | - state: open | |
| 69 | + state: closed | |
| 70 | 70 | priority: high |
| 71 | 71 | author: |
| 72 | 72 | name: k33g |
| 73 | 73 | email: ph.charriere@gmail.com |
| 74 | 74 | createdAt: 2026-11-15T03:10:13.000Z |
| 75 | + updatedAt: 2026-11-15T03:34:55.000Z | |
| 76 | + closedAt: 2026-11-15T03:34:55.000Z | |
| 75 | 77 | - id: 3 |
| 76 | 78 | title: "Interface : carte de progression dans la conversation (étape, temps écoulé, dernière ligne, lien Journal) et sur la ligne de l'agent" |
| 77 | - state: open | |
| 79 | + state: closed | |
| 78 | 80 | priority: high |
| 79 | 81 | author: |
| 80 | 82 | name: k33g |
| 81 | 83 | email: ph.charriere@gmail.com |
| 82 | 84 | createdAt: 2026-11-15T03:10:13.000Z |
| 85 | + updatedAt: 2026-11-15T03:34:55.000Z | |
| 86 | + closedAt: 2026-11-15T03:34:55.000Z | |
| 83 | 87 | - id: 4 |
| 84 | 88 | title: "Lecture des pourcentages / tailles quand la sortie en donne (barre), sinon animation indéterminée" |
| 85 | - state: open | |
| 89 | + state: closed | |
| 86 | 90 | priority: medium |
| 87 | 91 | author: |
| 88 | 92 | name: k33g |
| 89 | 93 | email: ph.charriere@gmail.com |
| 90 | 94 | createdAt: 2026-11-15T03:10:13.000Z |
| 95 | + updatedAt: 2026-11-15T03:34:55.000Z | |
| 96 | + closedAt: 2026-11-15T03:34:55.000Z | |
| 91 | 97 | - id: 5 |
| 92 | 98 | title: "Tests Go + vitest, textes et doc EN + FR, notes de release v1.5.0" |
| 93 | - state: open | |
| 99 | + state: closed | |
| 94 | 100 | priority: medium |
| 95 | 101 | author: |
| 96 | 102 | name: k33g |
| 97 | 103 | email: ph.charriere@gmail.com |
| 98 | 104 | createdAt: 2026-11-15T03:10:13.000Z |
| 99 | -comments: [] | |
| 105 | + updatedAt: 2026-11-15T03:34:55.000Z | |
| 106 | + closedAt: 2026-11-15T03:34:55.000Z | |
| 107 | +comments: | |
| 108 | + - id: 1 | |
| 109 | + author: | |
| 110 | + name: k33g | |
| 111 | + email: ph.charriere@gmail.com | |
| 112 | + createdAt: 2026-11-15T03:34:55.000Z | |
| 113 | + body: | | |
| 114 | + Implémenté sur `feature/98-99-100` : événement `agent:progress` (`agents.Manager` : étapes `checking` → | |
| 115 | + `preparing` (une ligne de la commande de cycle de vie) → `connecting`, chaque ligne du démarrage, heure de | |
| 116 | + début ; `Status.step/since` pour une interface rechargée), `lib/progress.ts` (pourcentage ou tailles | |
| 117 | + `fait/total`, temps écoulé), carte `StartProgress.svelte` dans la conversation (étape, temps, phrase qui | |
| 118 | + rassure, barre, dernière ligne, « Voir le journal » qui ouvre le Journal sur l'agent), étape courte dans le panneau | |
| 119 | + Agents. Vérifié : tests Go et vitest ; sous Xvfb avec un faux sbx qui « télécharge » (5 % … 100 %) puis lance un | |
| 120 | + faux agent ACP : carte, barre, journal, puis la réponse. Reste la tâche 1 : la sortie réelle de `sbx env create` | |
| 121 | + et de `docker compose up` hors terminal (si elle ne donne pas de pourcentage, la carte montre l'animation et la | |
| 122 | + dernière ligne). | |
| @@ -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:10:13.000Z | 8 | createdAt: 2026-11-15T03:10:13.000Z |
| 9 | -updatedAt: 2026-11-15T03:10:13.000Z | 9 | +updatedAt: 2026-11-15T03:34:55.000Z |
| 10 | labels: | 10 | labels: |
| 11 | - kind::feature | 11 | - kind::feature |
| 12 | - area::ui | 12 | - area::ui |
| @@ -66,34 +66,57 @@ tasks: | |||
| 66 | createdAt: 2026-11-15T03:10:13.000Z | 66 | createdAt: 2026-11-15T03:10:13.000Z |
| 67 | - id: 2 | 67 | - id: 2 |
| 68 | title: "Go : événement de progression (agent, étape, dernière ligne, début) depuis Ensure et le démarrage ACP" | 68 | title: "Go : événement de progression (agent, étape, dernière ligne, début) depuis Ensure et le démarrage ACP" |
| 69 | - state: open | 69 | + state: closed |
| 70 | priority: high | 70 | priority: high |
| 71 | author: | 71 | author: |
| 72 | name: k33g | 72 | name: k33g |
| 73 | email: ph.charriere@gmail.com | 73 | email: ph.charriere@gmail.com |
| 74 | createdAt: 2026-11-15T03:10:13.000Z | 74 | createdAt: 2026-11-15T03:10:13.000Z |
| 75 | + updatedAt: 2026-11-15T03:34:55.000Z | ||
| 76 | + closedAt: 2026-11-15T03:34:55.000Z | ||
| 75 | - id: 3 | 77 | - id: 3 |
| 76 | title: "Interface : carte de progression dans la conversation (étape, temps écoulé, dernière ligne, lien Journal) et sur la ligne de l'agent" | 78 | title: "Interface : carte de progression dans la conversation (étape, temps écoulé, dernière ligne, lien Journal) et sur la ligne de l'agent" |
| 77 | - state: open | 79 | + state: closed |
| 78 | priority: high | 80 | priority: high |
| 79 | author: | 81 | author: |
| 80 | name: k33g | 82 | name: k33g |
| 81 | email: ph.charriere@gmail.com | 83 | email: ph.charriere@gmail.com |
| 82 | createdAt: 2026-11-15T03:10:13.000Z | 84 | createdAt: 2026-11-15T03:10:13.000Z |
| 85 | + updatedAt: 2026-11-15T03:34:55.000Z | ||
| 86 | + closedAt: 2026-11-15T03:34:55.000Z | ||
| 83 | - id: 4 | 87 | - id: 4 |
| 84 | title: "Lecture des pourcentages / tailles quand la sortie en donne (barre), sinon animation indéterminée" | 88 | title: "Lecture des pourcentages / tailles quand la sortie en donne (barre), sinon animation indéterminée" |
| 85 | - state: open | 89 | + state: closed |
| 86 | priority: medium | 90 | priority: medium |
| 87 | author: | 91 | author: |
| 88 | name: k33g | 92 | name: k33g |
| 89 | email: ph.charriere@gmail.com | 93 | email: ph.charriere@gmail.com |
| 90 | createdAt: 2026-11-15T03:10:13.000Z | 94 | createdAt: 2026-11-15T03:10:13.000Z |
| 95 | + updatedAt: 2026-11-15T03:34:55.000Z | ||
| 96 | + closedAt: 2026-11-15T03:34:55.000Z | ||
| 91 | - id: 5 | 97 | - id: 5 |
| 92 | title: "Tests Go + vitest, textes et doc EN + FR, notes de release v1.5.0" | 98 | title: "Tests Go + vitest, textes et doc EN + FR, notes de release v1.5.0" |
| 93 | - state: open | 99 | + state: closed |
| 94 | priority: medium | 100 | priority: medium |
| 95 | author: | 101 | author: |
| 96 | name: k33g | 102 | name: k33g |
| 97 | email: ph.charriere@gmail.com | 103 | email: ph.charriere@gmail.com |
| 98 | createdAt: 2026-11-15T03:10:13.000Z | 104 | createdAt: 2026-11-15T03:10:13.000Z |
| 99 | -comments: [] | 105 | + updatedAt: 2026-11-15T03:34:55.000Z |
| 106 | + closedAt: 2026-11-15T03:34:55.000Z | ||
| 107 | +comments: | ||
| 108 | + - id: 1 | ||
| 109 | + author: | ||
| 110 | + name: k33g | ||
| 111 | + email: ph.charriere@gmail.com | ||
| 112 | + createdAt: 2026-11-15T03:34:55.000Z | ||
| 113 | + body: | | ||
| 114 | + Implémenté sur `feature/98-99-100` : événement `agent:progress` (`agents.Manager` : étapes `checking` → | ||
| 115 | + `preparing` (une ligne de la commande de cycle de vie) → `connecting`, chaque ligne du démarrage, heure de | ||
| 116 | + début ; `Status.step/since` pour une interface rechargée), `lib/progress.ts` (pourcentage ou tailles | ||
| 117 | + `fait/total`, temps écoulé), carte `StartProgress.svelte` dans la conversation (étape, temps, phrase qui | ||
| 118 | + rassure, barre, dernière ligne, « Voir le journal » qui ouvre le Journal sur l'agent), étape courte dans le panneau | ||
| 119 | + Agents. Vérifié : tests Go et vitest ; sous Xvfb avec un faux sbx qui « télécharge » (5 % … 100 %) puis lance un | ||
| 120 | + faux agent ACP : carte, barre, journal, puis la réponse. Reste la tâche 1 : la sortie réelle de `sbx env create` | ||
| 121 | + et de `docker compose up` hors terminal (si elle ne donne pas de pourcentage, la carte montre l'animation et la | ||
| 122 | + dernière ligne). | ||
modified
docs/en/how-to/create-an-agent-in-a-sandbox.md +1 -1 | @@ -8,7 +8,7 @@ This guide shows how to create a new Claude, Gemini, Codex or Vibe agent that ru | ||
| 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 | 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 agent's logo is chosen first). 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: the conversation shows what is happening — the step, the time elapsed, what sbx is downloading — and **See the log** opens the details. | |
| 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. |
| 14 | 14 | |
| @@ -8,7 +8,7 @@ This guide shows how to create a new Claude, Gemini, Codex or Vibe agent that ru | |||
| 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** (the agent's logo is chosen first). 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. | 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 agent's logo is chosen first). 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: the conversation shows what is happening — the step, the time elapsed, what sbx is downloading — and **See the log** opens the details. |
| 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. |
| 14 | 14 | ||
modified
docs/en/reference/agents-and-events.md +2 -1 | @@ -38,6 +38,7 @@ Stopping an agent closes its stdin, waits 5 seconds, then kills its process grou | ||
| 38 | 38 | | `config:changed` | `{path, valid, problems[]}` | The configuration file was saved and reloaded (valid or not). | |
| 39 | 39 | | `agent:state` | `{agent, state, error?}` | An agent changes state or its definition changes. | |
| 40 | 40 | | `agent:log` | `{agent, line}` | An agent writes a line on its standard error, or a sandbox command of the agent prints one (prefixed with `sandbox: `). | |
| 41 | +| `agent:progress` | `{agent, step, line, since}` | A starting agent moved to another step — `checking` (its sandbox or container is looked at), `preparing` (it is created or started: a line came from its lifecycle command), `connecting` (its program starts and answers `initialize`) — or printed a line (`line`, without the `sandbox: ` prefix of the log); `since` is when the start began, in Unix milliseconds (issue #98). The conversation shows a progress card with the step, the time elapsed, the last line (a bar when it holds a percentage or `done/total` sizes) and **See the log**; the Agents panel shows the step. Ends with the next `agent:state`. | | |
| 41 | 42 | | `files:dropped` | `{target, files[]}` | Files are dropped from the system on an element marked `data-file-drop-target`; `target` is its `id`, `files` their absolute paths. | |
| 42 | 43 | |
| 43 | 44 | The Go names and types are in `internal/events`; the TypeScript constants and types are generated in `frontend/bindings/events` and `frontend/bindings/…/internal/events`. |
| @@ -46,7 +47,7 @@ The Go names and types are in `internal/events`; the TypeScript constants and ty | ||
| 46 | 47 | |
| 47 | 48 | | Service | Method | Effect | |
| 48 | 49 | | --- | --- | --- | |
| 49 | -| `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, in configuration order. | | |
| 50 | +| `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox` (and, while starting, `step, since` as `agent:progress` gives them), in configuration order. | | |
| 50 | 51 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | |
| 51 | 52 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | |
| 52 | 53 | | | `Unload(name)` | Has a running, idle agent that announced the `unload` command unload its model (issue #51): `/unload` is sent in a session of its own, which no conversation shows; the answer goes to the agent's log as `unload: …` lines. Errors: unknown agent, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | |
| @@ -38,6 +38,7 @@ Stopping an agent closes its stdin, waits 5 seconds, then kills its process grou | |||
| 38 | | `config:changed` | `{path, valid, problems[]}` | The configuration file was saved and reloaded (valid or not). | | 38 | | `config:changed` | `{path, valid, problems[]}` | The configuration file was saved and reloaded (valid or not). | |
| 39 | | `agent:state` | `{agent, state, error?}` | An agent changes state or its definition changes. | | 39 | | `agent:state` | `{agent, state, error?}` | An agent changes state or its definition changes. | |
| 40 | | `agent:log` | `{agent, line}` | An agent writes a line on its standard error, or a sandbox command of the agent prints one (prefixed with `sandbox: `). | | 40 | | `agent:log` | `{agent, line}` | An agent writes a line on its standard error, or a sandbox command of the agent prints one (prefixed with `sandbox: `). | |
| 41 | +| `agent:progress` | `{agent, step, line, since}` | A starting agent moved to another step — `checking` (its sandbox or container is looked at), `preparing` (it is created or started: a line came from its lifecycle command), `connecting` (its program starts and answers `initialize`) — or printed a line (`line`, without the `sandbox: ` prefix of the log); `since` is when the start began, in Unix milliseconds (issue #98). The conversation shows a progress card with the step, the time elapsed, the last line (a bar when it holds a percentage or `done/total` sizes) and **See the log**; the Agents panel shows the step. Ends with the next `agent:state`. | | ||
| 41 | | `files:dropped` | `{target, files[]}` | Files are dropped from the system on an element marked `data-file-drop-target`; `target` is its `id`, `files` their absolute paths. | | 42 | | `files:dropped` | `{target, files[]}` | Files are dropped from the system on an element marked `data-file-drop-target`; `target` is its `id`, `files` their absolute paths. | |
| 42 | 43 | ||
| 43 | The Go names and types are in `internal/events`; the TypeScript constants and types are generated in `frontend/bindings/events` and `frontend/bindings/…/internal/events`. | 44 | The Go names and types are in `internal/events`; the TypeScript constants and types are generated in `frontend/bindings/events` and `frontend/bindings/…/internal/events`. |
| @@ -46,7 +47,7 @@ The Go names and types are in `internal/events`; the TypeScript constants and ty | |||
| 46 | 47 | ||
| 47 | | Service | Method | Effect | | 48 | | Service | Method | Effect | |
| 48 | | --- | --- | --- | | 49 | | --- | --- | --- | |
| 49 | -| `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, in configuration order. | | 50 | +| `AgentService` | `List()` | Every agent with `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox` (and, while starting, `step, since` as `agent:progress` gives them), in configuration order. | |
| 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | | 51 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | As in the transitions above; an error is returned to the interface. A start first recreates a missing sandbox when `runtime.lifecycle.create` is set. | |
| 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | | 52 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Stops the agent, then runs `runtime.lifecycle.stop` or `remove` (container or sandbox); the output goes to the agent's log. | |
| 52 | | | `Unload(name)` | Has a running, idle agent that announced the `unload` command unload its model (issue #51): `/unload` is sent in a session of its own, which no conversation shows; the answer goes to the agent's log as `unload: …` lines. Errors: unknown agent, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | 53 | | | `Unload(name)` | Has a running, idle agent that announced the `unload` command unload its model (issue #51): `/unload` is sent in a session of its own, which no conversation shows; the answer goes to the agent's log as `unload: …` lines. Errors: unknown agent, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | |
modified
docs/fr/how-to/creer-un-agent-dans-une-sandbox.md +1 -1 | @@ -8,7 +8,7 @@ Ce guide montre comment créer un nouvel agent Claude, Gemini, Codex ou Vibe qui | ||
| 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 | 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 logo de l'agent est choisi d'abord). 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 ; la conversation montre ce qui se passe — l'étape, le temps écoulé, ce que sbx télécharge — et **Voir le journal** ouvre le détail. | |
| 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. |
| 14 | 14 | |
| @@ -8,7 +8,7 @@ Ce guide montre comment créer un nouvel agent Claude, Gemini, Codex ou Vibe qui | |||
| 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** (le logo de l'agent est choisi d'abord). 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. | 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 logo de l'agent est choisi d'abord). 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 ; la conversation montre ce qui se passe — l'étape, le temps écoulé, ce que sbx télécharge — et **Voir le journal** ouvre le détail. |
| 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. |
| 14 | 14 | ||
modified
docs/fr/reference/agents-et-evenements.md +2 -1 | @@ -38,6 +38,7 @@ Arrêter un agent ferme son entrée standard, attend 5 secondes, puis tue son gr | ||
| 38 | 38 | | `config:changed` | `{path, valid, problems[]}` | Le fichier de configuration a été enregistré et rechargé (valide ou non). | |
| 39 | 39 | | `agent:state` | `{agent, state, error?}` | Un agent change d'état ou sa définition change. | |
| 40 | 40 | | `agent:log` | `{agent, line}` | Un agent écrit une ligne sur sa sortie d'erreur, ou une commande de sa sandbox en affiche une (préfixée par `sandbox: `). | |
| 41 | +| `agent:progress` | `{agent, step, line, since}` | Un agent qui démarre passe à une autre étape — `checking` (sa sandbox ou son conteneur est examiné), `preparing` (il est créé ou démarré : une ligne est venue de sa commande de cycle de vie), `connecting` (son programme démarre et répond à `initialize`) — ou a écrit une ligne (`line`, sans le préfixe `sandbox: ` du journal) ; `since` est le début du démarrage, en millisecondes Unix (issue #98). La conversation montre une carte de progression avec l'étape, le temps écoulé, la dernière ligne (une barre quand elle contient un pourcentage ou des tailles `fait/total`) et **Voir le journal** ; le panneau Agents montre l'étape. Se termine avec le `agent:state` suivant. | | |
| 41 | 42 | | `files:dropped` | `{target, files[]}` | Des fichiers du système sont déposés sur un élément marqué `data-file-drop-target` ; `target` est son `id`, `files` leurs chemins absolus. | |
| 42 | 43 | |
| 43 | 44 | Les noms et types Go sont dans `internal/events` ; les constantes et types TypeScript sont générés dans `frontend/bindings/events` et `frontend/bindings/…/internal/events`. |
| @@ -46,7 +47,7 @@ Les noms et types Go sont dans `internal/events` ; les constantes et types TypeS | ||
| 46 | 47 | |
| 47 | 48 | | Service | Méthode | Effet | |
| 48 | 49 | | --- | --- | --- | |
| 49 | -| `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, dans l'ordre de la configuration. | | |
| 50 | +| `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox` (et, pendant un démarrage, `step, since` comme les donne `agent:progress`), dans l'ordre de la configuration. | | |
| 50 | 51 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | |
| 51 | 52 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | |
| 52 | 53 | | | `Unload(name)` | Demande à un agent en marche et inactif, qui a annoncé la commande `unload`, de décharger son modèle (ticket #51) : `/unload` est envoyé dans une session à part, qu'aucune conversation ne montre ; la réponse va dans le journal de l'agent, en lignes `unload: …`. Erreurs : agent inconnu, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | |
| @@ -38,6 +38,7 @@ Arrêter un agent ferme son entrée standard, attend 5 secondes, puis tue son gr | |||
| 38 | | `config:changed` | `{path, valid, problems[]}` | Le fichier de configuration a été enregistré et rechargé (valide ou non). | | 38 | | `config:changed` | `{path, valid, problems[]}` | Le fichier de configuration a été enregistré et rechargé (valide ou non). | |
| 39 | | `agent:state` | `{agent, state, error?}` | Un agent change d'état ou sa définition change. | | 39 | | `agent:state` | `{agent, state, error?}` | Un agent change d'état ou sa définition change. | |
| 40 | | `agent:log` | `{agent, line}` | Un agent écrit une ligne sur sa sortie d'erreur, ou une commande de sa sandbox en affiche une (préfixée par `sandbox: `). | | 40 | | `agent:log` | `{agent, line}` | Un agent écrit une ligne sur sa sortie d'erreur, ou une commande de sa sandbox en affiche une (préfixée par `sandbox: `). | |
| 41 | +| `agent:progress` | `{agent, step, line, since}` | Un agent qui démarre passe à une autre étape — `checking` (sa sandbox ou son conteneur est examiné), `preparing` (il est créé ou démarré : une ligne est venue de sa commande de cycle de vie), `connecting` (son programme démarre et répond à `initialize`) — ou a écrit une ligne (`line`, sans le préfixe `sandbox: ` du journal) ; `since` est le début du démarrage, en millisecondes Unix (issue #98). La conversation montre une carte de progression avec l'étape, le temps écoulé, la dernière ligne (une barre quand elle contient un pourcentage ou des tailles `fait/total`) et **Voir le journal** ; le panneau Agents montre l'étape. Se termine avec le `agent:state` suivant. | | ||
| 41 | | `files:dropped` | `{target, files[]}` | Des fichiers du système sont déposés sur un élément marqué `data-file-drop-target` ; `target` est son `id`, `files` leurs chemins absolus. | | 42 | | `files:dropped` | `{target, files[]}` | Des fichiers du système sont déposés sur un élément marqué `data-file-drop-target` ; `target` est son `id`, `files` leurs chemins absolus. | |
| 42 | 43 | ||
| 43 | Les noms et types Go sont dans `internal/events` ; les constantes et types TypeScript sont générés dans `frontend/bindings/events` et `frontend/bindings/…/internal/events`. | 44 | Les noms et types Go sont dans `internal/events` ; les constantes et types TypeScript sont générés dans `frontend/bindings/events` et `frontend/bindings/…/internal/events`. |
| @@ -46,7 +47,7 @@ Les noms et types Go sont dans `internal/events` ; les constantes et types TypeS | |||
| 46 | 47 | ||
| 47 | | Service | Méthode | Effet | | 48 | | Service | Méthode | Effet | |
| 48 | | --- | --- | --- | | 49 | | --- | --- | --- | |
| 49 | -| `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox`, dans l'ordre de la configuration. | | 50 | +| `AgentService` | `List()` | Tous les agents avec `name, title, icon, description, state, error, outdated, runtime, canStopSandbox, canRemoveSandbox` (et, pendant un démarrage, `step, since` comme les donne `agent:progress`), dans l'ordre de la configuration. | |
| 50 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | | 51 | | | `Start(name)`, `Stop(name)`, `Restart(name)` | Comme dans les transitions ci-dessus ; une erreur est renvoyée à l'interface. Un démarrage recrée d'abord une sandbox absente si `runtime.lifecycle.create` est défini. | |
| 51 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | | 52 | | | `StopSandbox(name)`, `RemoveSandbox(name)` | Arrête l'agent, puis lance `runtime.lifecycle.stop` ou `remove` (conteneur ou sandbox) ; la sortie va dans le journal de l'agent. | |
| 52 | | | `Unload(name)` | Demande à un agent en marche et inactif, qui a annoncé la commande `unload`, de décharger son modèle (ticket #51) : `/unload` est envoyé dans une session à part, qu'aucune conversation ne montre ; la réponse va dans le journal de l'agent, en lignes `unload: …`. Erreurs : agent inconnu, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | | 53 | | | `Unload(name)` | Demande à un agent en marche et inactif, qui a annoncé la commande `unload`, de décharger son modèle (ticket #51) : `/unload` est envoyé dans une session à part, qu'aucune conversation ne montre ; la réponse va dans le journal de l'agent, en lignes `unload: …`. Erreurs : agent inconnu, `the agent is not running…`, `the agent is answering…`, `this agent cannot unload its model…`. | |
modified
docs/release-notes/v1.5.0.fr.md +2 -0 | @@ -35,6 +35,8 @@ Sidekicks 1.5.0 rend la création d'agents facile pour tout le monde : deux assi | ||
| 35 | 35 | |
| 36 | 36 | ### Petits changements |
| 37 | 37 | |
| 38 | +- Pendant que la sandbox ou le conteneur d'un agent est créé à son premier démarrage — plusieurs minutes la première fois — la conversation montre l'étape, le temps écoulé et ce qui est téléchargé, avec une barre quand sbx ou docker donne un pourcentage, et **Voir le journal** (#98). Le panneau Agents montre aussi l'étape. | |
| 39 | + | |
| 38 | 40 | - Les commandes qui créent, arrêtent ou suppriment le conteneur ou la sandbox d'un agent s'exécutent maintenant avec `PWD` égal à leur dossier, comme dans un terminal : le `compose.yaml` de `mm dockerinit` monte `${PWD}`, qui valait `/` quand Sidekicks était ouvert depuis le Finder. |
| 39 | 41 | |
| 40 | 42 | ## Bon à savoir pour la mise à jour |
| @@ -35,6 +35,8 @@ Sidekicks 1.5.0 rend la création d'agents facile pour tout le monde : deux assi | |||
| 35 | 35 | ||
| 36 | ### Petits changements | 36 | ### Petits changements |
| 37 | 37 | ||
| 38 | +- Pendant que la sandbox ou le conteneur d'un agent est créé à son premier démarrage — plusieurs minutes la première fois — la conversation montre l'étape, le temps écoulé et ce qui est téléchargé, avec une barre quand sbx ou docker donne un pourcentage, et **Voir le journal** (#98). Le panneau Agents montre aussi l'étape. | ||
| 39 | + | ||
| 38 | - Les commandes qui créent, arrêtent ou suppriment le conteneur ou la sandbox d'un agent s'exécutent maintenant avec `PWD` égal à leur dossier, comme dans un terminal : le `compose.yaml` de `mm dockerinit` monte `${PWD}`, qui valait `/` quand Sidekicks était ouvert depuis le Finder. | 40 | - Les commandes qui créent, arrêtent ou suppriment le conteneur ou la sandbox d'un agent s'exécutent maintenant avec `PWD` égal à leur dossier, comme dans un terminal : le `compose.yaml` de `mm dockerinit` monte `${PWD}`, qui valait `/` quand Sidekicks était ouvert depuis le Finder. |
| 39 | 41 | ||
| 40 | ## Bon à savoir pour la mise à jour | 42 | ## Bon à savoir pour la mise à jour |
modified
docs/release-notes/v1.5.0.md +2 -0 | @@ -35,6 +35,8 @@ Sidekicks 1.5.0 makes creating agents easy for everyone: two assistants create a | ||
| 35 | 35 | |
| 36 | 36 | ### Smaller changes |
| 37 | 37 | |
| 38 | +- While an agent's sandbox or container is created at its first start — minutes the first time — the conversation shows the step, the time elapsed and what is being downloaded, with a bar when sbx or docker gives a percentage, and **See the log** (#98). The Agents panel shows the step too. | |
| 39 | + | |
| 38 | 40 | - The commands that create, stop or remove an agent's container or sandbox now run with `PWD` set to their folder, as in a terminal: the `compose.yaml` of `mm dockerinit` mounts `${PWD}`, which was `/` when Sidekicks was opened from the Finder. |
| 39 | 41 | |
| 40 | 42 | ## Worth knowing when upgrading |
| @@ -35,6 +35,8 @@ Sidekicks 1.5.0 makes creating agents easy for everyone: two assistants create a | |||
| 35 | 35 | ||
| 36 | ### Smaller changes | 36 | ### Smaller changes |
| 37 | 37 | ||
| 38 | +- While an agent's sandbox or container is created at its first start — minutes the first time — the conversation shows the step, the time elapsed and what is being downloaded, with a bar when sbx or docker gives a percentage, and **See the log** (#98). The Agents panel shows the step too. | ||
| 39 | + | ||
| 38 | - The commands that create, stop or remove an agent's container or sandbox now run with `PWD` set to their folder, as in a terminal: the `compose.yaml` of `mm dockerinit` mounts `${PWD}`, which was `/` when Sidekicks was opened from the Finder. | 40 | - The commands that create, stop or remove an agent's container or sandbox now run with `PWD` set to their folder, as in a terminal: the `compose.yaml` of `mm dockerinit` mounts `${PWD}`, which was `/` when Sidekicks was opened from the Finder. |
| 39 | 41 | ||
| 40 | ## Worth knowing when upgrading | 42 | ## Worth knowing when upgrading |
modified
frontend/bindings/events/index.ts +5 -0 | @@ -13,6 +13,11 @@ import "../github.com/wailsapp/wails/v3/internal/eventcreate.js"; | ||
| 13 | 13 | */ |
| 14 | 14 | export const AgentLog = "agent:log"; |
| 15 | 15 | |
| 16 | +/** | |
| 17 | + * Name of the custom event "agent:progress". | |
| 18 | + */ | |
| 19 | +export const AgentProgress = "agent:progress"; | |
| 20 | + | |
| 16 | 21 | /** |
| 17 | 22 | * Name of the custom event "agent:state". |
| 18 | 23 | */ |
| @@ -13,6 +13,11 @@ import "../github.com/wailsapp/wails/v3/internal/eventcreate.js"; | |||
| 13 | */ | 13 | */ |
| 14 | export const AgentLog = "agent:log"; | 14 | export const AgentLog = "agent:log"; |
| 15 | 15 | ||
| 16 | +/** | ||
| 17 | + * Name of the custom event "agent:progress". | ||
| 18 | + */ | ||
| 19 | +export const AgentProgress = "agent:progress"; | ||
| 20 | + | ||
| 16 | /** | 21 | /** |
| 17 | * Name of the custom event "agent:state". | 22 | * Name of the custom event "agent:state". |
| 18 | */ | 23 | */ |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/agents/models.ts +7 -0 | @@ -51,4 +51,11 @@ export interface Status { | ||
| 51 | 51 | */ |
| 52 | 52 | "canStopSandbox": boolean; |
| 53 | 53 | "canRemoveSandbox": boolean; |
| 54 | + | |
| 55 | + /** | |
| 56 | + * Step and Since: while starting, the step and when the start began | |
| 57 | + * (Unix milliseconds), as agent:progress gives them (issue #98). | |
| 58 | + */ | |
| 59 | + "step"?: string; | |
| 60 | + "since"?: number; | |
| 54 | 61 | } |
| @@ -51,4 +51,11 @@ export interface Status { | |||
| 51 | */ | 51 | */ |
| 52 | "canStopSandbox": boolean; | 52 | "canStopSandbox": boolean; |
| 53 | "canRemoveSandbox": boolean; | 53 | "canRemoveSandbox": boolean; |
| 54 | + | ||
| 55 | + /** | ||
| 56 | + * Step and Since: while starting, the step and when the start began | ||
| 57 | + * (Unix milliseconds), as agent:progress gives them (issue #98). | ||
| 58 | + */ | ||
| 59 | + "step"?: string; | ||
| 60 | + "since"?: number; | ||
| 54 | } | 61 | } |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/events/index.ts +1 -0 | @@ -3,6 +3,7 @@ | ||
| 3 | 3 | |
| 4 | 4 | export type { |
| 5 | 5 | AgentLogPayload, |
| 6 | + AgentProgressPayload, | |
| 6 | 7 | AgentStatePayload, |
| 7 | 8 | ConfigChangedPayload, |
| 8 | 9 | FilesDroppedPayload, |
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | export type { | 4 | export type { |
| 5 | AgentLogPayload, | 5 | AgentLogPayload, |
| 6 | + AgentProgressPayload, | ||
| 6 | AgentStatePayload, | 7 | AgentStatePayload, |
| 7 | ConfigChangedPayload, | 8 | ConfigChangedPayload, |
| 8 | FilesDroppedPayload, | 9 | FilesDroppedPayload, |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/events/models.ts +12 -0 | @@ -9,6 +9,18 @@ export interface AgentLogPayload { | ||
| 9 | 9 | "line": string; |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | +/** | |
| 13 | + * AgentProgressPayload is where the start of an agent is: its step, the last | |
| 14 | + * line printed (by sbx, docker or the agent), and when the start began | |
| 15 | + * (Unix milliseconds), for the time elapsed. | |
| 16 | + */ | |
| 17 | +export interface AgentProgressPayload { | |
| 18 | + "agent": string; | |
| 19 | + "step": string; | |
| 20 | + "line": string; | |
| 21 | + "since": number; | |
| 22 | +} | |
| 23 | + | |
| 12 | 24 | /** |
| 13 | 25 | * AgentStatePayload is one state transition of an agent. |
| 14 | 26 | */ |
| @@ -9,6 +9,18 @@ export interface AgentLogPayload { | |||
| 9 | "line": string; | 9 | "line": string; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | +/** | ||
| 13 | + * AgentProgressPayload is where the start of an agent is: its step, the last | ||
| 14 | + * line printed (by sbx, docker or the agent), and when the start began | ||
| 15 | + * (Unix milliseconds), for the time elapsed. | ||
| 16 | + */ | ||
| 17 | +export interface AgentProgressPayload { | ||
| 18 | + "agent": string; | ||
| 19 | + "step": string; | ||
| 20 | + "line": string; | ||
| 21 | + "since": number; | ||
| 22 | +} | ||
| 23 | + | ||
| 12 | /** | 24 | /** |
| 13 | * AgentStatePayload is one state transition of an agent. | 25 | * AgentStatePayload is one state transition of an agent. |
| 14 | */ | 26 | */ |
modified
frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/sbxcreate/models.ts +1 -2 | @@ -11,8 +11,7 @@ export interface Kind { | ||
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Icon is the agent's default icon: its brand's logo ("logo:<name>", |
| 14 | - * issue #100) when Sidekicks ships it, else an emoji (Codex: OpenAI's | |
| 15 | - * logo is not shipped). | |
| 14 | + * issue #100). | |
| 16 | 15 | */ |
| 17 | 16 | "icon": string; |
| 18 | 17 | |
| @@ -11,8 +11,7 @@ export interface Kind { | |||
| 11 | 11 | ||
| 12 | /** | 12 | /** |
| 13 | * Icon is the agent's default icon: its brand's logo ("logo:<name>", | 13 | * Icon is the agent's default icon: its brand's logo ("logo:<name>", |
| 14 | - * issue #100) when Sidekicks ships it, else an emoji (Codex: OpenAI's | 14 | + * issue #100). |
| 15 | - * logo is not shipped). | ||
| 16 | */ | 15 | */ |
| 17 | "icon": string; | 16 | "icon": string; |
| 18 | 17 | ||
modified
frontend/bindings/github.com/wailsapp/wails/v3/internal/eventdata.d.ts +1 -0 | @@ -19,6 +19,7 @@ declare module "@wailsio/runtime" { | ||
| 19 | 19 | namespace Events { |
| 20 | 20 | interface CustomEvents { |
| 21 | 21 | "agent:log": events$0.AgentLogPayload; |
| 22 | + "agent:progress": events$0.AgentProgressPayload; | |
| 22 | 23 | "agent:state": events$0.AgentStatePayload; |
| 23 | 24 | "channels:changed": channels$0.ListPayload; |
| 24 | 25 | "commands:changed": channels$0.CommandsPayload; |
| @@ -19,6 +19,7 @@ declare module "@wailsio/runtime" { | |||
| 19 | namespace Events { | 19 | namespace Events { |
| 20 | interface CustomEvents { | 20 | interface CustomEvents { |
| 21 | "agent:log": events$0.AgentLogPayload; | 21 | "agent:log": events$0.AgentLogPayload; |
| 22 | + "agent:progress": events$0.AgentProgressPayload; | ||
| 22 | "agent:state": events$0.AgentStatePayload; | 23 | "agent:state": events$0.AgentStatePayload; |
| 23 | "channels:changed": channels$0.ListPayload; | 24 | "channels:changed": channels$0.ListPayload; |
| 24 | "commands:changed": channels$0.CommandsPayload; | 25 | "commands:changed": channels$0.CommandsPayload; |
added
frontend/src/lib/chat/StartProgress.svelte +49 -0 | new file mode 100644 | ||
| @@ -0,0 +1,49 @@ | ||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | |
| 2 | +<script lang="ts"> | |
| 3 | + // The start of an agent, shown while the user waits (issue #98): the step | |
| 4 | + // in plain words, the time elapsed, the last line its sandbox or container | |
| 5 | + // printed (with a bar when the line tells a percentage), and the log. | |
| 6 | + // Creating a sandbox the first time pulls kits and images: minutes. | |
| 7 | + import { onDestroy } from 'svelte' | |
| 8 | + import { t, type MessageKey } from '../i18n/index.svelte' | |
| 9 | + import { agentTitle, appState, showLog } from '../state.svelte' | |
| 10 | + import { elapsed, percentOf } from '../progress' | |
| 11 | + import Spinner from './Spinner.svelte' | |
| 12 | + | |
| 13 | + let { agent }: { agent: string } = $props() | |
| 14 | + | |
| 15 | + const progress = $derived(appState.progress[agent]) | |
| 16 | + let now = $state(Date.now()) | |
| 17 | + const timer = setInterval(() => (now = Date.now()), 1000) | |
| 18 | + onDestroy(() => clearInterval(timer)) | |
| 19 | + | |
| 20 | + const time = $derived(progress ? elapsed(progress.since, now) : { minutes: 0, seconds: 0 }) | |
| 21 | + const percent = $derived(progress?.line ? percentOf(progress.line) : null) | |
| 22 | + // The reassuring sentence once the wait is long enough to worry. | |
| 23 | + const long = $derived(progress?.step === 'preparing' || time.minutes > 0 || time.seconds >= 15) | |
| 24 | +</script> | |
| 25 | + | |
| 26 | +{#if progress} | |
| 27 | + <section class="start" aria-live="polite" aria-label={t('progress.label', { agent: agentTitle(agent) })}> | |
| 28 | + <p class="step"><Spinner /> <strong>{t(`progress.step.${progress.step}` as MessageKey, { agent: agentTitle(agent) })}</strong> | |
| 29 | + <span class="time">{time.minutes > 0 ? t('progress.minutes', { minutes: String(time.minutes), seconds: String(time.seconds) }) : t('progress.seconds', { seconds: String(time.seconds) })}</span> | |
| 30 | + </p> | |
| 31 | + {#if long}<p class="hint">{t('progress.firstTime')}</p>{/if} | |
| 32 | + {#if percent !== null} | |
| 33 | + <div class="bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow={percent}><span style:width="{percent}%"></span></div> | |
| 34 | + {/if} | |
| 35 | + {#if progress.line}<code class="line" title={progress.line}>{progress.line}</code>{/if} | |
| 36 | + <button type="button" class="link" onclick={() => showLog(agent)}>{t('progress.log')}</button> | |
| 37 | + </section> | |
| 38 | +{/if} | |
| 39 | + | |
| 40 | +<style> | |
| 41 | + .start { margin: 4px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; } | |
| 42 | + .step { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } | |
| 43 | + .time { color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; } | |
| 44 | + .hint { margin: 0; color: var(--muted); font-size: 12px; } | |
| 45 | + .bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; } | |
| 46 | + .bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; } | |
| 47 | + .line { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | |
| 48 | + .link { align-self: flex-start; border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 12px; } | |
| 49 | +</style> | |
| new file mode 100644 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | +<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE --> | ||
| 2 | +<script lang="ts"> | ||
| 3 | + // The start of an agent, shown while the user waits (issue #98): the step | ||
| 4 | + // in plain words, the time elapsed, the last line its sandbox or container | ||
| 5 | + // printed (with a bar when the line tells a percentage), and the log. | ||
| 6 | + // Creating a sandbox the first time pulls kits and images: minutes. | ||
| 7 | + import { onDestroy } from 'svelte' | ||
| 8 | + import { t, type MessageKey } from '../i18n/index.svelte' | ||
| 9 | + import { agentTitle, appState, showLog } from '../state.svelte' | ||
| 10 | + import { elapsed, percentOf } from '../progress' | ||
| 11 | + import Spinner from './Spinner.svelte' | ||
| 12 | + | ||
| 13 | + let { agent }: { agent: string } = $props() | ||
| 14 | + | ||
| 15 | + const progress = $derived(appState.progress[agent]) | ||
| 16 | + let now = $state(Date.now()) | ||
| 17 | + const timer = setInterval(() => (now = Date.now()), 1000) | ||
| 18 | + onDestroy(() => clearInterval(timer)) | ||
| 19 | + | ||
| 20 | + const time = $derived(progress ? elapsed(progress.since, now) : { minutes: 0, seconds: 0 }) | ||
| 21 | + const percent = $derived(progress?.line ? percentOf(progress.line) : null) | ||
| 22 | + // The reassuring sentence once the wait is long enough to worry. | ||
| 23 | + const long = $derived(progress?.step === 'preparing' || time.minutes > 0 || time.seconds >= 15) | ||
| 24 | +</script> | ||
| 25 | + | ||
| 26 | +{#if progress} | ||
| 27 | + <section class="start" aria-live="polite" aria-label={t('progress.label', { agent: agentTitle(agent) })}> | ||
| 28 | + <p class="step"><Spinner /> <strong>{t(`progress.step.${progress.step}` as MessageKey, { agent: agentTitle(agent) })}</strong> | ||
| 29 | + <span class="time">{time.minutes > 0 ? t('progress.minutes', { minutes: String(time.minutes), seconds: String(time.seconds) }) : t('progress.seconds', { seconds: String(time.seconds) })}</span> | ||
| 30 | + </p> | ||
| 31 | + {#if long}<p class="hint">{t('progress.firstTime')}</p>{/if} | ||
| 32 | + {#if percent !== null} | ||
| 33 | + <div class="bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow={percent}><span style:width="{percent}%"></span></div> | ||
| 34 | + {/if} | ||
| 35 | + {#if progress.line}<code class="line" title={progress.line}>{progress.line}</code>{/if} | ||
| 36 | + <button type="button" class="link" onclick={() => showLog(agent)}>{t('progress.log')}</button> | ||
| 37 | + </section> | ||
| 38 | +{/if} | ||
| 39 | + | ||
| 40 | +<style> | ||
| 41 | + .start { margin: 4px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; } | ||
| 42 | + .step { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; } | ||
| 43 | + .time { color: var(--muted); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; } | ||
| 44 | + .hint { margin: 0; color: var(--muted); font-size: 12px; } | ||
| 45 | + .bar { height: 6px; border-radius: 3px; background: var(--border); overflow: hidden; } | ||
| 46 | + .bar span { display: block; height: 100%; background: var(--accent); transition: width 0.3s; } | ||
| 47 | + .line { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } | ||
| 48 | + .link { align-self: flex-start; border: none; background: none; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: 12px; } | ||
| 49 | +</style> | ||
modified
frontend/src/lib/i18n/messages.ts +22 -0 | @@ -112,6 +112,17 @@ export const en = { | ||
| 112 | 112 | 'message.thinking': 'thinking…', |
| 113 | 113 | 'message.usingTool': 'using a tool…', |
| 114 | 114 | 'message.preparing': '{agent} is getting ready…', |
| 115 | + 'progress.label': 'Start of {agent}', | |
| 116 | + 'progress.step.checking': 'Getting {agent} ready…', | |
| 117 | + 'progress.step.preparing': 'Creating the sandbox of {agent}: downloading and installing…', | |
| 118 | + 'progress.step.connecting': 'Starting {agent}…', | |
| 119 | + 'progress.short.checking': 'getting ready…', | |
| 120 | + 'progress.short.preparing': 'creating its sandbox…', | |
| 121 | + 'progress.short.connecting': 'starting…', | |
| 122 | + 'progress.seconds': '{seconds} s', | |
| 123 | + 'progress.minutes': '{minutes} min {seconds} s', | |
| 124 | + 'progress.firstTime': 'The first time, this can take several minutes: everything the agent needs is downloaded. The next times, it starts right away.', | |
| 125 | + 'progress.log': 'See the log', | |
| 115 | 126 | 'message.thought': 'Reasoning', |
| 116 | 127 | 'message.stop.cancelled': 'Answer stopped.', |
| 117 | 128 | 'message.stop.max_tokens': 'Answer cut: the agent reached its length limit.', |
| @@ -595,6 +606,17 @@ export const fr: Record<MessageKey, string> = { | ||
| 595 | 606 | 'message.thinking': 'réfléchit…', |
| 596 | 607 | 'message.usingTool': 'utilise un outil…', |
| 597 | 608 | 'message.preparing': '{agent} se prépare…', |
| 609 | + 'progress.label': 'Démarrage de {agent}', | |
| 610 | + 'progress.step.checking': 'Préparation de {agent}…', | |
| 611 | + 'progress.step.preparing': 'Création de la sandbox de {agent} : téléchargement et installation…', | |
| 612 | + 'progress.step.connecting': 'Démarrage de {agent}…', | |
| 613 | + 'progress.short.checking': 'se prépare…', | |
| 614 | + 'progress.short.preparing': 'crée sa sandbox…', | |
| 615 | + 'progress.short.connecting': 'démarre…', | |
| 616 | + 'progress.seconds': '{seconds} s', | |
| 617 | + 'progress.minutes': '{minutes} min {seconds} s', | |
| 618 | + 'progress.firstTime': "La première fois, cela peut prendre plusieurs minutes : tout ce dont l'agent a besoin est téléchargé. Les fois suivantes, il démarre tout de suite.", | |
| 619 | + 'progress.log': 'Voir le journal', | |
| 598 | 620 | 'message.thought': 'Réflexion', |
| 599 | 621 | 'message.stop.cancelled': 'Réponse arrêtée.', |
| 600 | 622 | 'message.stop.max_tokens': "Réponse coupée : l'agent a atteint sa limite de longueur.", |
| @@ -112,6 +112,17 @@ export const en = { | |||
| 112 | 'message.thinking': 'thinking…', | 112 | 'message.thinking': 'thinking…', |
| 113 | 'message.usingTool': 'using a tool…', | 113 | 'message.usingTool': 'using a tool…', |
| 114 | 'message.preparing': '{agent} is getting ready…', | 114 | 'message.preparing': '{agent} is getting ready…', |
| 115 | + 'progress.label': 'Start of {agent}', | ||
| 116 | + 'progress.step.checking': 'Getting {agent} ready…', | ||
| 117 | + 'progress.step.preparing': 'Creating the sandbox of {agent}: downloading and installing…', | ||
| 118 | + 'progress.step.connecting': 'Starting {agent}…', | ||
| 119 | + 'progress.short.checking': 'getting ready…', | ||
| 120 | + 'progress.short.preparing': 'creating its sandbox…', | ||
| 121 | + 'progress.short.connecting': 'starting…', | ||
| 122 | + 'progress.seconds': '{seconds} s', | ||
| 123 | + 'progress.minutes': '{minutes} min {seconds} s', | ||
| 124 | + 'progress.firstTime': 'The first time, this can take several minutes: everything the agent needs is downloaded. The next times, it starts right away.', | ||
| 125 | + 'progress.log': 'See the log', | ||
| 115 | 'message.thought': 'Reasoning', | 126 | 'message.thought': 'Reasoning', |
| 116 | 'message.stop.cancelled': 'Answer stopped.', | 127 | 'message.stop.cancelled': 'Answer stopped.', |
| 117 | 'message.stop.max_tokens': 'Answer cut: the agent reached its length limit.', | 128 | 'message.stop.max_tokens': 'Answer cut: the agent reached its length limit.', |
| @@ -595,6 +606,17 @@ export const fr: Record<MessageKey, string> = { | |||
| 595 | 'message.thinking': 'réfléchit…', | 606 | 'message.thinking': 'réfléchit…', |
| 596 | 'message.usingTool': 'utilise un outil…', | 607 | 'message.usingTool': 'utilise un outil…', |
| 597 | 'message.preparing': '{agent} se prépare…', | 608 | 'message.preparing': '{agent} se prépare…', |
| 609 | + 'progress.label': 'Démarrage de {agent}', | ||
| 610 | + 'progress.step.checking': 'Préparation de {agent}…', | ||
| 611 | + 'progress.step.preparing': 'Création de la sandbox de {agent} : téléchargement et installation…', | ||
| 612 | + 'progress.step.connecting': 'Démarrage de {agent}…', | ||
| 613 | + 'progress.short.checking': 'se prépare…', | ||
| 614 | + 'progress.short.preparing': 'crée sa sandbox…', | ||
| 615 | + 'progress.short.connecting': 'démarre…', | ||
| 616 | + 'progress.seconds': '{seconds} s', | ||
| 617 | + 'progress.minutes': '{minutes} min {seconds} s', | ||
| 618 | + 'progress.firstTime': "La première fois, cela peut prendre plusieurs minutes : tout ce dont l'agent a besoin est téléchargé. Les fois suivantes, il démarre tout de suite.", | ||
| 619 | + 'progress.log': 'Voir le journal', | ||
| 598 | 'message.thought': 'Réflexion', | 620 | 'message.thought': 'Réflexion', |
| 599 | 'message.stop.cancelled': 'Réponse arrêtée.', | 621 | 'message.stop.cancelled': 'Réponse arrêtée.', |
| 600 | 'message.stop.max_tokens': "Réponse coupée : l'agent a atteint sa limite de longueur.", | 622 | 'message.stop.max_tokens': "Réponse coupée : l'agent a atteint sa limite de longueur.", |
modified
frontend/src/lib/layout/Shell.svelte +5 -0 | @@ -69,6 +69,11 @@ | ||
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | + // showLog (issue #98) asks for the Log panel. | |
| 73 | + $effect(() => { | |
| 74 | + if (appState.logRequest > 0 && collapsed.bottom) toggle('bottom') | |
| 75 | + }) | |
| 76 | + | |
| 72 | 77 | function toggle(dock: 'left' | 'right' | 'bottom') { |
| 73 | 78 | const pane = { left, right, bottom }[dock] |
| 74 | 79 | if (!pane) return |
| @@ -69,6 +69,11 @@ | |||
| 69 | } | 69 | } |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | + // showLog (issue #98) asks for the Log panel. | ||
| 73 | + $effect(() => { | ||
| 74 | + if (appState.logRequest > 0 && collapsed.bottom) toggle('bottom') | ||
| 75 | + }) | ||
| 76 | + | ||
| 72 | function toggle(dock: 'left' | 'right' | 'bottom') { | 77 | function toggle(dock: 'left' | 'right' | 'bottom') { |
| 73 | const pane = { left, right, bottom }[dock] | 78 | const pane = { left, right, bottom }[dock] |
| 74 | if (!pane) return | 79 | if (!pane) return |
modified
frontend/src/lib/panels/AgentsPanel.svelte +1 -1 | @@ -40,7 +40,7 @@ | ||
| 40 | 40 | {#if runningTerminals(agent.name)} |
| 41 | 41 | <span class="terminals" title={t('terminal.running', { count: runningTerminals(agent.name) })} aria-label={t('terminal.running', { count: runningTerminals(agent.name) })}>⌨ {runningTerminals(agent.name)}</span> |
| 42 | 42 | {/if} |
| 43 | - <span class="state">{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{agent.outdated ? t('agent.outdated') : ''}</span> | |
| 43 | + <span class="state">{#if agent.state === 'starting' && appState.progress[agent.name]}{t(`progress.short.${appState.progress[agent.name].step}` as MessageKey)}{:else}{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{/if}{agent.outdated ? t('agent.outdated') : ''}</span> | |
| 44 | 44 | <span class="actions"> |
| 45 | 45 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> |
| 46 | 46 | {#if agent.state === 'stopped' || agent.state === 'error'} |
| @@ -40,7 +40,7 @@ | |||
| 40 | {#if runningTerminals(agent.name)} | 40 | {#if runningTerminals(agent.name)} |
| 41 | <span class="terminals" title={t('terminal.running', { count: runningTerminals(agent.name) })} aria-label={t('terminal.running', { count: runningTerminals(agent.name) })}>⌨ {runningTerminals(agent.name)}</span> | 41 | <span class="terminals" title={t('terminal.running', { count: runningTerminals(agent.name) })} aria-label={t('terminal.running', { count: runningTerminals(agent.name) })}>⌨ {runningTerminals(agent.name)}</span> |
| 42 | {/if} | 42 | {/if} |
| 43 | - <span class="state">{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{agent.outdated ? t('agent.outdated') : ''}</span> | 43 | + <span class="state">{#if agent.state === 'starting' && appState.progress[agent.name]}{t(`progress.short.${appState.progress[agent.name].step}` as MessageKey)}{:else}{hasMessage(`agent.state.${agent.state}`) ? t(`agent.state.${agent.state}` as MessageKey) : agent.state}{/if}{agent.outdated ? t('agent.outdated') : ''}</span> |
| 44 | <span class="actions"> | 44 | <span class="actions"> |
| 45 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> | 45 | <button onclick={() => openWorkspace(agent.name)} aria-label={t('workspace.open', { agent: agent.title })} title={t('workspace.open', { agent: agent.title })}>📂</button> |
| 46 | {#if agent.state === 'stopped' || agent.state === 'error'} | 46 | {#if agent.state === 'stopped' || agent.state === 'error'} |
modified
frontend/src/lib/panels/ConversationPanel.svelte +8 -1 | @@ -6,6 +6,7 @@ | ||
| 6 | 6 | import MessageView from '../chat/MessageView.svelte' |
| 7 | 7 | import PermissionCard from '../chat/PermissionCard.svelte' |
| 8 | 8 | import FormCard from '../chat/FormCard.svelte' |
| 9 | + import StartProgress from '../chat/StartProgress.svelte' | |
| 9 | 10 | import Spinner from '../chat/Spinner.svelte' |
| 10 | 11 | import AgentView from '../agent/AgentView.svelte' |
| 11 | 12 | import LinkedFilePanel from '../agent/LinkedFilePanel.svelte' |
| @@ -165,7 +166,10 @@ | ||
| 165 | 166 | // Between the user's message and the first words of the answer: the agents |
| 166 | 167 | // start, load their model, or wait for their turn elsewhere (several of |
| 167 | 168 | // them with /parallel). |
| 168 | - const gettingReady = $derived(conversation?.busy ? notStreaming(conversation.messages ?? [], answerers).map(agentTitle).join(', ') : '') | |
| 169 | + // The agents not answering yet: a starting one shows its progress (issue #98). | |
| 170 | + const readying = $derived(conversation?.busy ? notStreaming(conversation.messages ?? [], answerers) : []) | |
| 171 | + const starting = $derived(readying.filter((name) => appState.progress[name])) | |
| 172 | + const gettingReady = $derived(readying.filter((name) => !appState.progress[name]).map(agentTitle).join(', ')) | |
| 169 | 173 | |
| 170 | 174 | // Smart scrolling: follow new content only when the reader is at the bottom. |
| 171 | 175 | let list: HTMLElement | undefined = $state() |
| @@ -289,6 +293,9 @@ | ||
| 289 | 293 | {#each conversation.messages ?? [] as message (message.id)} |
| 290 | 294 | <MessageView {message} /> |
| 291 | 295 | {/each} |
| 296 | + {#each starting as name (name)} | |
| 297 | + <StartProgress agent={name} /> | |
| 298 | + {/each} | |
| 292 | 299 | {#if gettingReady} |
| 293 | 300 | <p class="pending"><Spinner /> {t('message.preparing', { agent: gettingReady })}</p> |
| 294 | 301 | {/if} |
| @@ -6,6 +6,7 @@ | |||
| 6 | import MessageView from '../chat/MessageView.svelte' | 6 | import MessageView from '../chat/MessageView.svelte' |
| 7 | import PermissionCard from '../chat/PermissionCard.svelte' | 7 | import PermissionCard from '../chat/PermissionCard.svelte' |
| 8 | import FormCard from '../chat/FormCard.svelte' | 8 | import FormCard from '../chat/FormCard.svelte' |
| 9 | + import StartProgress from '../chat/StartProgress.svelte' | ||
| 9 | import Spinner from '../chat/Spinner.svelte' | 10 | import Spinner from '../chat/Spinner.svelte' |
| 10 | import AgentView from '../agent/AgentView.svelte' | 11 | import AgentView from '../agent/AgentView.svelte' |
| 11 | import LinkedFilePanel from '../agent/LinkedFilePanel.svelte' | 12 | import LinkedFilePanel from '../agent/LinkedFilePanel.svelte' |
| @@ -165,7 +166,10 @@ | |||
| 165 | // Between the user's message and the first words of the answer: the agents | 166 | // Between the user's message and the first words of the answer: the agents |
| 166 | // start, load their model, or wait for their turn elsewhere (several of | 167 | // start, load their model, or wait for their turn elsewhere (several of |
| 167 | // them with /parallel). | 168 | // them with /parallel). |
| 168 | - const gettingReady = $derived(conversation?.busy ? notStreaming(conversation.messages ?? [], answerers).map(agentTitle).join(', ') : '') | 169 | + // The agents not answering yet: a starting one shows its progress (issue #98). |
| 170 | + const readying = $derived(conversation?.busy ? notStreaming(conversation.messages ?? [], answerers) : []) | ||
| 171 | + const starting = $derived(readying.filter((name) => appState.progress[name])) | ||
| 172 | + const gettingReady = $derived(readying.filter((name) => !appState.progress[name]).map(agentTitle).join(', ')) | ||
| 169 | 173 | ||
| 170 | // Smart scrolling: follow new content only when the reader is at the bottom. | 174 | // Smart scrolling: follow new content only when the reader is at the bottom. |
| 171 | let list: HTMLElement | undefined = $state() | 175 | let list: HTMLElement | undefined = $state() |
| @@ -289,6 +293,9 @@ | |||
| 289 | {#each conversation.messages ?? [] as message (message.id)} | 293 | {#each conversation.messages ?? [] as message (message.id)} |
| 290 | <MessageView {message} /> | 294 | <MessageView {message} /> |
| 291 | {/each} | 295 | {/each} |
| 296 | + {#each starting as name (name)} | ||
| 297 | + <StartProgress agent={name} /> | ||
| 298 | + {/each} | ||
| 292 | {#if gettingReady} | 299 | {#if gettingReady} |
| 293 | <p class="pending"><Spinner /> {t('message.preparing', { agent: gettingReady })}</p> | 300 | <p class="pending"><Spinner /> {t('message.preparing', { agent: gettingReady })}</p> |
| 294 | {/if} | 301 | {/if} |
modified
frontend/src/lib/panels/LogsPanel.svelte +4 -0 | @@ -9,6 +9,10 @@ | ||
| 9 | 9 | import { canUnload, unloadReady, unloadSummary, type UnloadLine } from '../unload' |
| 10 | 10 | |
| 11 | 11 | let selected = $state('') |
| 12 | + // showLog (issue #98) chooses the agent. | |
| 13 | + $effect(() => { | |
| 14 | + if (appState.logAgent) selected = appState.logAgent | |
| 15 | + }) | |
| 12 | 16 | const agentName = $derived(selected || appState.agents[0]?.name || '') |
| 13 | 17 | const agent = $derived(appState.agents.find((candidate) => candidate.name === agentName)) |
| 14 | 18 | |
| @@ -9,6 +9,10 @@ | |||
| 9 | import { canUnload, unloadReady, unloadSummary, type UnloadLine } from '../unload' | 9 | import { canUnload, unloadReady, unloadSummary, type UnloadLine } from '../unload' |
| 10 | 10 | ||
| 11 | let selected = $state('') | 11 | let selected = $state('') |
| 12 | + // showLog (issue #98) chooses the agent. | ||
| 13 | + $effect(() => { | ||
| 14 | + if (appState.logAgent) selected = appState.logAgent | ||
| 15 | + }) | ||
| 12 | const agentName = $derived(selected || appState.agents[0]?.name || '') | 16 | const agentName = $derived(selected || appState.agents[0]?.name || '') |
| 13 | const agent = $derived(appState.agents.find((candidate) => candidate.name === agentName)) | 17 | const agent = $derived(appState.agents.find((candidate) => candidate.name === agentName)) |
| 14 | 18 | ||
added
frontend/src/lib/progress.test.ts +36 -0 | new file mode 100644 | ||
| @@ -0,0 +1,36 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +import { describe, expect, it } from 'vitest' | |
| 4 | +import { elapsed, nextProgress, percentOf } from './progress' | |
| 5 | + | |
| 6 | +describe('percentOf', () => { | |
| 7 | + it('reads a percentage', () => { | |
| 8 | + expect(percentOf('pulling docker.io/sbx/claude-acp:latest 42%')).toBe(42) | |
| 9 | + expect(percentOf('extracting 99.5 %')).toBe(99.5) | |
| 10 | + expect(percentOf('weird 250%')).toBeNull() | |
| 11 | + }) | |
| 12 | + it('reads done/total sizes', () => { | |
| 13 | + expect(percentOf('Downloading 12.5MB/50MB')).toBe(25) | |
| 14 | + expect(percentOf('a1b2: 512kB / 1MB')).toBe(51) | |
| 15 | + expect(percentOf('1.5GiB/3GiB')).toBe(50) | |
| 16 | + }) | |
| 17 | + it('says nothing for other lines', () => { | |
| 18 | + expect(percentOf('sandbox milo-sbx not found: creating it')).toBeNull() | |
| 19 | + expect(percentOf('')).toBeNull() | |
| 20 | + }) | |
| 21 | +}) | |
| 22 | + | |
| 23 | +describe('elapsed', () => { | |
| 24 | + it('splits minutes and seconds', () => { | |
| 25 | + expect(elapsed(1_000, 81_000)).toEqual({ minutes: 1, seconds: 20 }) | |
| 26 | + expect(elapsed(5_000, 1_000)).toEqual({ minutes: 0, seconds: 0 }) | |
| 27 | + }) | |
| 28 | +}) | |
| 29 | + | |
| 30 | +describe('nextProgress', () => { | |
| 31 | + it('keeps the last line when an event has none', () => { | |
| 32 | + const first = nextProgress(undefined, { step: 'preparing', line: 'pulling 10%', since: 1 }) | |
| 33 | + expect(nextProgress(first, { step: 'connecting', line: '', since: 1 })).toEqual({ step: 'connecting', line: 'pulling 10%', since: 1 }) | |
| 34 | + expect(nextProgress(first, { step: 'preparing', line: 'pulling 20%', since: 1 }).line).toBe('pulling 20%') | |
| 35 | + }) | |
| 36 | +}) | |
| new file mode 100644 | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +import { describe, expect, it } from 'vitest' | ||
| 4 | +import { elapsed, nextProgress, percentOf } from './progress' | ||
| 5 | + | ||
| 6 | +describe('percentOf', () => { | ||
| 7 | + it('reads a percentage', () => { | ||
| 8 | + expect(percentOf('pulling docker.io/sbx/claude-acp:latest 42%')).toBe(42) | ||
| 9 | + expect(percentOf('extracting 99.5 %')).toBe(99.5) | ||
| 10 | + expect(percentOf('weird 250%')).toBeNull() | ||
| 11 | + }) | ||
| 12 | + it('reads done/total sizes', () => { | ||
| 13 | + expect(percentOf('Downloading 12.5MB/50MB')).toBe(25) | ||
| 14 | + expect(percentOf('a1b2: 512kB / 1MB')).toBe(51) | ||
| 15 | + expect(percentOf('1.5GiB/3GiB')).toBe(50) | ||
| 16 | + }) | ||
| 17 | + it('says nothing for other lines', () => { | ||
| 18 | + expect(percentOf('sandbox milo-sbx not found: creating it')).toBeNull() | ||
| 19 | + expect(percentOf('')).toBeNull() | ||
| 20 | + }) | ||
| 21 | +}) | ||
| 22 | + | ||
| 23 | +describe('elapsed', () => { | ||
| 24 | + it('splits minutes and seconds', () => { | ||
| 25 | + expect(elapsed(1_000, 81_000)).toEqual({ minutes: 1, seconds: 20 }) | ||
| 26 | + expect(elapsed(5_000, 1_000)).toEqual({ minutes: 0, seconds: 0 }) | ||
| 27 | + }) | ||
| 28 | +}) | ||
| 29 | + | ||
| 30 | +describe('nextProgress', () => { | ||
| 31 | + it('keeps the last line when an event has none', () => { | ||
| 32 | + const first = nextProgress(undefined, { step: 'preparing', line: 'pulling 10%', since: 1 }) | ||
| 33 | + expect(nextProgress(first, { step: 'connecting', line: '', since: 1 })).toEqual({ step: 'connecting', line: 'pulling 10%', since: 1 }) | ||
| 34 | + expect(nextProgress(first, { step: 'preparing', line: 'pulling 20%', since: 1 }).line).toBe('pulling 20%') | ||
| 35 | + }) | ||
| 36 | +}) | ||
added
frontend/src/lib/progress.ts +65 -0 | new file mode 100644 | ||
| @@ -0,0 +1,65 @@ | ||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | |
| 2 | + | |
| 3 | +// The start of an agent, step by step (issue #98): its sandbox or container | |
| 4 | +// may be created first — kits and images pulled, minutes the first time. | |
| 5 | +// Go sends agent:progress (step, last line, start time); this module reads a | |
| 6 | +// line for a percentage and splits the time elapsed, without Svelte, for | |
| 7 | +// vitest. | |
| 8 | + | |
| 9 | +/** Where a start is, as agent:progress gives it. */ | |
| 10 | +export interface Progress { | |
| 11 | + step: string | |
| 12 | + line: string | |
| 13 | + /** When the start began, in Unix milliseconds. */ | |
| 14 | + since: number | |
| 15 | +} | |
| 16 | + | |
| 17 | +/** The steps, in order. */ | |
| 18 | +export const steps = ['checking', 'preparing', 'connecting'] as const | |
| 19 | + | |
| 20 | +/** | |
| 21 | + * The progress a line of sbx or docker tells, from 0 to 100: a percentage, | |
| 22 | + * or "12.5MB/40MB"; null when it tells none. | |
| 23 | + * | |
| 24 | + * @example | |
| 25 | + * percentOf('pulling layer 42%') // 42 | |
| 26 | + * percentOf('Downloading 12.5MB/50MB') // 25 | |
| 27 | + * percentOf('sandbox milo not found: creating') // null | |
| 28 | + */ | |
| 29 | +export function percentOf(line: string): number | null { | |
| 30 | + const percent = /(\d{1,3}(?:\.\d+)?)\s?%/.exec(line) | |
| 31 | + if (percent) { | |
| 32 | + const value = Number(percent[1]) | |
| 33 | + return value <= 100 ? value : null | |
| 34 | + } | |
| 35 | + const sizes = /(\d+(?:\.\d+)?)\s*([kKMG]?i?B)\s*\/\s*(\d+(?:\.\d+)?)\s*([kKMG]?i?B)/.exec(line) | |
| 36 | + if (!sizes) return null | |
| 37 | + const done = Number(sizes[1]) * unit(sizes[2]) | |
| 38 | + const total = Number(sizes[3]) * unit(sizes[4]) | |
| 39 | + return total > 0 && done <= total ? Math.round((done / total) * 100) : null | |
| 40 | +} | |
| 41 | + | |
| 42 | +function unit(text: string): number { | |
| 43 | + const prefix = text[0].toUpperCase() | |
| 44 | + const base = text.includes('i') ? 1024 : 1000 | |
| 45 | + return prefix === 'K' ? base : prefix === 'M' ? base ** 2 : prefix === 'G' ? base ** 3 : 1 | |
| 46 | +} | |
| 47 | + | |
| 48 | +/** | |
| 49 | + * The time elapsed since a start, in whole minutes and seconds. | |
| 50 | + * | |
| 51 | + * @example | |
| 52 | + * elapsed(1_000, 81_000) // { minutes: 1, seconds: 20 } | |
| 53 | + */ | |
| 54 | +export function elapsed(since: number, now: number): { minutes: number; seconds: number } { | |
| 55 | + const total = Math.max(0, Math.floor((now - since) / 1000)) | |
| 56 | + return { minutes: Math.floor(total / 60), seconds: total % 60 } | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + * The progress after an agent:progress event: a line that says nothing | |
| 61 | + * keeps the last one shown. | |
| 62 | + */ | |
| 63 | +export function nextProgress(previous: Progress | undefined, event: Progress): Progress { | |
| 64 | + return { step: event.step, since: event.since, line: event.line || (previous?.line ?? '') } | |
| 65 | +} | |
| new file mode 100644 | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | +// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE | ||
| 2 | + | ||
| 3 | +// The start of an agent, step by step (issue #98): its sandbox or container | ||
| 4 | +// may be created first — kits and images pulled, minutes the first time. | ||
| 5 | +// Go sends agent:progress (step, last line, start time); this module reads a | ||
| 6 | +// line for a percentage and splits the time elapsed, without Svelte, for | ||
| 7 | +// vitest. | ||
| 8 | + | ||
| 9 | +/** Where a start is, as agent:progress gives it. */ | ||
| 10 | +export interface Progress { | ||
| 11 | + step: string | ||
| 12 | + line: string | ||
| 13 | + /** When the start began, in Unix milliseconds. */ | ||
| 14 | + since: number | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +/** The steps, in order. */ | ||
| 18 | +export const steps = ['checking', 'preparing', 'connecting'] as const | ||
| 19 | + | ||
| 20 | +/** | ||
| 21 | + * The progress a line of sbx or docker tells, from 0 to 100: a percentage, | ||
| 22 | + * or "12.5MB/40MB"; null when it tells none. | ||
| 23 | + * | ||
| 24 | + * @example | ||
| 25 | + * percentOf('pulling layer 42%') // 42 | ||
| 26 | + * percentOf('Downloading 12.5MB/50MB') // 25 | ||
| 27 | + * percentOf('sandbox milo not found: creating') // null | ||
| 28 | + */ | ||
| 29 | +export function percentOf(line: string): number | null { | ||
| 30 | + const percent = /(\d{1,3}(?:\.\d+)?)\s?%/.exec(line) | ||
| 31 | + if (percent) { | ||
| 32 | + const value = Number(percent[1]) | ||
| 33 | + return value <= 100 ? value : null | ||
| 34 | + } | ||
| 35 | + const sizes = /(\d+(?:\.\d+)?)\s*([kKMG]?i?B)\s*\/\s*(\d+(?:\.\d+)?)\s*([kKMG]?i?B)/.exec(line) | ||
| 36 | + if (!sizes) return null | ||
| 37 | + const done = Number(sizes[1]) * unit(sizes[2]) | ||
| 38 | + const total = Number(sizes[3]) * unit(sizes[4]) | ||
| 39 | + return total > 0 && done <= total ? Math.round((done / total) * 100) : null | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +function unit(text: string): number { | ||
| 43 | + const prefix = text[0].toUpperCase() | ||
| 44 | + const base = text.includes('i') ? 1024 : 1000 | ||
| 45 | + return prefix === 'K' ? base : prefix === 'M' ? base ** 2 : prefix === 'G' ? base ** 3 : 1 | ||
| 46 | +} | ||
| 47 | + | ||
| 48 | +/** | ||
| 49 | + * The time elapsed since a start, in whole minutes and seconds. | ||
| 50 | + * | ||
| 51 | + * @example | ||
| 52 | + * elapsed(1_000, 81_000) // { minutes: 1, seconds: 20 } | ||
| 53 | + */ | ||
| 54 | +export function elapsed(since: number, now: number): { minutes: number; seconds: number } { | ||
| 55 | + const total = Math.max(0, Math.floor((now - since) / 1000)) | ||
| 56 | + return { minutes: Math.floor(total / 60), seconds: total % 60 } | ||
| 57 | +} | ||
| 58 | + | ||
| 59 | +/** | ||
| 60 | + * The progress after an agent:progress event: a line that says nothing | ||
| 61 | + * keeps the last one shown. | ||
| 62 | + */ | ||
| 63 | +export function nextProgress(previous: Progress | undefined, event: Progress): Progress { | ||
| 64 | + return { step: event.step, since: event.since, line: event.line || (previous?.line ?? '') } | ||
| 65 | +} | ||
modified
frontend/src/lib/state.svelte.ts +21 -1 | @@ -8,7 +8,8 @@ import { AgentService, ChannelService, ConfigService, WorkspaceService } from '. | ||
| 8 | 8 | import type { ConfigView } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 9 | 9 | import type { Status } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/agents' |
| 10 | 10 | import type { Command } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/acp' |
| 11 | -import type { AgentLogPayload, AgentStatePayload, ConfigChangedPayload, WorkspaceChangedPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | |
| 11 | +import type { AgentLogPayload, AgentProgressPayload, AgentStatePayload, ConfigChangedPayload, WorkspaceChangedPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | |
| 12 | +import { nextProgress, type Progress } from './progress' | |
| 12 | 13 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| 13 | 14 | import { terminalExit, terminalOutput } from './terminals' |
| 14 | 15 | import type { |
| @@ -27,6 +28,7 @@ import type { | ||
| 27 | 28 | } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels' |
| 28 | 29 | import { |
| 29 | 30 | AgentLog, |
| 31 | + AgentProgress, | |
| 30 | 32 | AgentState, |
| 31 | 33 | ChannelsChanged, |
| 32 | 34 | CommandsChanged, |
| @@ -105,6 +107,11 @@ export const appState = $state({ | ||
| 105 | 107 | paletteOpen: false, |
| 106 | 108 | /** Incremented to ask the channels panel for its "new channel" field (⌘N). */ |
| 107 | 109 | newChannelRequest: 0, |
| 110 | + /** Where each starting agent is (issue #98), by agent name. */ | |
| 111 | + progress: {} as Record<string, Progress>, | |
| 112 | + /** The agent whose log the Log panel shows, and a counter that asks the shell to open it. */ | |
| 113 | + logAgent: '', | |
| 114 | + logRequest: 0, | |
| 108 | 115 | }) |
| 109 | 116 | |
| 110 | 117 | // The channels whose conversation was loaded from Go: from then on, the |
| @@ -120,6 +127,9 @@ async function refreshConfig() { | ||
| 120 | 127 | |
| 121 | 128 | async function refreshAgents() { |
| 122 | 129 | appState.agents = (await AgentService.List()) ?? [] |
| 130 | + for (const agent of appState.agents) { | |
| 131 | + if (agent.state === 'starting' && agent.step) appState.progress[agent.name] = nextProgress(appState.progress[agent.name], { step: agent.step, line: '', since: agent.since ?? Date.now() }) | |
| 132 | + } | |
| 123 | 133 | // The conversation or workspace of an agent removed from the |
| 124 | 134 | // configuration is no longer shown. |
| 125 | 135 | const names = appState.agents.map((agent) => agent.name) |
| @@ -217,6 +227,12 @@ export function openWorkspace(agent: string, file = '') { | ||
| 217 | 227 | appState.workspaceFile = file |
| 218 | 228 | } |
| 219 | 229 | |
| 230 | +/** Opens the Log panel on agent's log (issue #98: "See the log"). */ | |
| 231 | +export function showLog(agent: string) { | |
| 232 | + appState.logAgent = agent | |
| 233 | + appState.logRequest++ | |
| 234 | +} | |
| 235 | + | |
| 220 | 236 | /** Shows the "add an agent" assistant in the centre. */ |
| 221 | 237 | export function openAssistant() { |
| 222 | 238 | appState.workspaceAgent = '' |
| @@ -437,6 +453,10 @@ export function connect(): () => void { | ||
| 437 | 453 | } |
| 438 | 454 | agent.state = payload.state as Status['state'] |
| 439 | 455 | agent.error = payload.error ?? '' |
| 456 | + if (payload.state !== 'starting') delete appState.progress[payload.agent] | |
| 457 | + }), | |
| 458 | + subscribe<AgentProgressPayload>(AgentProgress, (payload) => { | |
| 459 | + appState.progress[payload.agent] = nextProgress(appState.progress[payload.agent], payload) | |
| 440 | 460 | }), |
| 441 | 461 | subscribe<AgentLogPayload>(AgentLog, (payload) => logBatcher.push(payload)), |
| 442 | 462 | subscribe<MessagePayload>(MessageUpdated, (payload) => messageBatcher.push({ message: payload })), |
| @@ -8,7 +8,8 @@ import { AgentService, ChannelService, ConfigService, WorkspaceService } from '. | |||
| 8 | import type { ConfigView } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' | 8 | import type { ConfigView } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app' |
| 9 | import type { Status } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/agents' | 9 | import type { Status } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/agents' |
| 10 | import type { Command } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/acp' | 10 | import type { Command } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/acp' |
| 11 | -import type { AgentLogPayload, AgentStatePayload, ConfigChangedPayload, WorkspaceChangedPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' | 11 | +import type { AgentLogPayload, AgentProgressPayload, AgentStatePayload, ConfigChangedPayload, WorkspaceChangedPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events' |
| 12 | +import { nextProgress, type Progress } from './progress' | ||
| 12 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' | 13 | import type { ExitPayload, OutputPayload } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/workspace' |
| 13 | import { terminalExit, terminalOutput } from './terminals' | 14 | import { terminalExit, terminalOutput } from './terminals' |
| 14 | import type { | 15 | import type { |
| @@ -27,6 +28,7 @@ import type { | |||
| 27 | } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels' | 28 | } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels' |
| 28 | import { | 29 | import { |
| 29 | AgentLog, | 30 | AgentLog, |
| 31 | + AgentProgress, | ||
| 30 | AgentState, | 32 | AgentState, |
| 31 | ChannelsChanged, | 33 | ChannelsChanged, |
| 32 | CommandsChanged, | 34 | CommandsChanged, |
| @@ -105,6 +107,11 @@ export const appState = $state({ | |||
| 105 | paletteOpen: false, | 107 | paletteOpen: false, |
| 106 | /** Incremented to ask the channels panel for its "new channel" field (⌘N). */ | 108 | /** Incremented to ask the channels panel for its "new channel" field (⌘N). */ |
| 107 | newChannelRequest: 0, | 109 | newChannelRequest: 0, |
| 110 | + /** Where each starting agent is (issue #98), by agent name. */ | ||
| 111 | + progress: {} as Record<string, Progress>, | ||
| 112 | + /** The agent whose log the Log panel shows, and a counter that asks the shell to open it. */ | ||
| 113 | + logAgent: '', | ||
| 114 | + logRequest: 0, | ||
| 108 | }) | 115 | }) |
| 109 | 116 | ||
| 110 | // The channels whose conversation was loaded from Go: from then on, the | 117 | // The channels whose conversation was loaded from Go: from then on, the |
| @@ -120,6 +127,9 @@ async function refreshConfig() { | |||
| 120 | 127 | ||
| 121 | async function refreshAgents() { | 128 | async function refreshAgents() { |
| 122 | appState.agents = (await AgentService.List()) ?? [] | 129 | appState.agents = (await AgentService.List()) ?? [] |
| 130 | + for (const agent of appState.agents) { | ||
| 131 | + if (agent.state === 'starting' && agent.step) appState.progress[agent.name] = nextProgress(appState.progress[agent.name], { step: agent.step, line: '', since: agent.since ?? Date.now() }) | ||
| 132 | + } | ||
| 123 | // The conversation or workspace of an agent removed from the | 133 | // The conversation or workspace of an agent removed from the |
| 124 | // configuration is no longer shown. | 134 | // configuration is no longer shown. |
| 125 | const names = appState.agents.map((agent) => agent.name) | 135 | const names = appState.agents.map((agent) => agent.name) |
| @@ -217,6 +227,12 @@ export function openWorkspace(agent: string, file = '') { | |||
| 217 | appState.workspaceFile = file | 227 | appState.workspaceFile = file |
| 218 | } | 228 | } |
| 219 | 229 | ||
| 230 | +/** Opens the Log panel on agent's log (issue #98: "See the log"). */ | ||
| 231 | +export function showLog(agent: string) { | ||
| 232 | + appState.logAgent = agent | ||
| 233 | + appState.logRequest++ | ||
| 234 | +} | ||
| 235 | + | ||
| 220 | /** Shows the "add an agent" assistant in the centre. */ | 236 | /** Shows the "add an agent" assistant in the centre. */ |
| 221 | export function openAssistant() { | 237 | export function openAssistant() { |
| 222 | appState.workspaceAgent = '' | 238 | appState.workspaceAgent = '' |
| @@ -437,6 +453,10 @@ export function connect(): () => void { | |||
| 437 | } | 453 | } |
| 438 | agent.state = payload.state as Status['state'] | 454 | agent.state = payload.state as Status['state'] |
| 439 | agent.error = payload.error ?? '' | 455 | agent.error = payload.error ?? '' |
| 456 | + if (payload.state !== 'starting') delete appState.progress[payload.agent] | ||
| 457 | + }), | ||
| 458 | + subscribe<AgentProgressPayload>(AgentProgress, (payload) => { | ||
| 459 | + appState.progress[payload.agent] = nextProgress(appState.progress[payload.agent], payload) | ||
| 440 | }), | 460 | }), |
| 441 | subscribe<AgentLogPayload>(AgentLog, (payload) => logBatcher.push(payload)), | 461 | subscribe<AgentLogPayload>(AgentLog, (payload) => logBatcher.push(payload)), |
| 442 | subscribe<MessagePayload>(MessageUpdated, (payload) => messageBatcher.push({ message: payload })), | 462 | subscribe<MessagePayload>(MessageUpdated, (payload) => messageBatcher.push({ message: payload })), |
modified
internal/agents/manager.go +39 -2 | @@ -122,6 +122,10 @@ type Status struct { | ||
| 122 | 122 | // to stop or to remove the agent's sandbox or container (runtime.lifecycle). |
| 123 | 123 | CanStopSandbox bool `json:"canStopSandbox"` |
| 124 | 124 | CanRemoveSandbox bool `json:"canRemoveSandbox"` |
| 125 | + // Step and Since: while starting, the step and when the start began | |
| 126 | + // (Unix milliseconds), as agent:progress gives them (issue #98). | |
| 127 | + Step string `json:"step,omitempty"` | |
| 128 | + Since int64 `json:"since,omitempty"` | |
| 125 | 129 | } |
| 126 | 130 | |
| 127 | 131 | // Manager owns the agent processes. It is safe for concurrent use. |
| @@ -150,6 +154,9 @@ type agent struct { | ||
| 150 | 154 | // stopRequested: Stop was called while the agent was starting. |
| 151 | 155 | stopRequested bool |
| 152 | 156 | logs []string |
| 157 | + // step and since: where the current start is, and when it began (issue #98). | |
| 158 | + step string | |
| 159 | + since time.Time | |
| 153 | 160 | } |
| 154 | 161 | |
| 155 | 162 | // NewManager returns a manager for the agents of the configuration. No agent |
| @@ -187,13 +194,17 @@ func (m *Manager) Statuses() []Status { | ||
| 187 | 194 | } |
| 188 | 195 | |
| 189 | 196 | func (a *agent) status() Status { |
| 190 | - return Status{ | |
| 197 | + status := Status{ | |
| 191 | 198 | Name: a.definition.Name, Title: a.definition.Title, Icon: a.definition.Icon, |
| 192 | 199 | Description: a.definition.Description, State: a.state, Error: a.err, Outdated: a.outdated, |
| 193 | 200 | Runtime: a.definition.Runtime.Type, |
| 194 | 201 | CanStopSandbox: len(a.definition.Runtime.Lifecycle.Stop) > 0, |
| 195 | 202 | CanRemoveSandbox: len(a.definition.Runtime.Lifecycle.Remove) > 0, |
| 196 | 203 | } |
| 204 | + if a.state == StateStarting { | |
| 205 | + status.Step, status.Since = a.step, a.since.UnixMilli() | |
| 206 | + } | |
| 207 | + return status | |
| 197 | 208 | } |
| 198 | 209 | |
| 199 | 210 | // Definition returns the configuration of the agent called name. |
| @@ -300,7 +311,9 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error | ||
| 300 | 311 | return nil, err |
| 301 | 312 | } |
| 302 | 313 | a.starting = make(chan struct{}) |
| 314 | + a.step, a.since = events.StepChecking, m.options.Now() | |
| 303 | 315 | m.setState(a, StateStarting, "") |
| 316 | + m.emitProgress(a, "") | |
| 304 | 317 | definition := a.definition |
| 305 | 318 | m.mu.Unlock() |
| 306 | 319 | |
| @@ -311,6 +324,7 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error | ||
| 311 | 324 | spec := m.specFor(definition) |
| 312 | 325 | startErr := m.prepare(ctx, a, definition) |
| 313 | 326 | if startErr == nil { |
| 327 | + m.toStep(a, events.StepConnecting) | |
| 314 | 328 | if m.options.Tools != nil { |
| 315 | 329 | m.log(a, toolsLine(spec)) |
| 316 | 330 | } |
| @@ -344,7 +358,27 @@ func (m *Manager) prepare(ctx context.Context, a *agent, definition config.Agent | ||
| 344 | 358 | if m.options.Prepare == nil { |
| 345 | 359 | return nil |
| 346 | 360 | } |
| 347 | - return m.options.Prepare(ctx, definition, func(line string) { m.log(a, "sandbox: "+line) }) | |
| 361 | + return m.options.Prepare(ctx, definition, func(line string) { | |
| 362 | + // A line means the sandbox or the container is being made. | |
| 363 | + m.toStep(a, events.StepPreparing) | |
| 364 | + m.log(a, "sandbox: "+line) | |
| 365 | + }) | |
| 366 | +} | |
| 367 | + | |
| 368 | +// toStep moves a starting agent to step (issue #98). | |
| 369 | +func (m *Manager) toStep(a *agent, step string) { | |
| 370 | + m.mu.Lock() | |
| 371 | + defer m.mu.Unlock() | |
| 372 | + if a.state != StateStarting || a.step == step { | |
| 373 | + return | |
| 374 | + } | |
| 375 | + a.step = step | |
| 376 | + m.emitProgress(a, "") | |
| 377 | +} | |
| 378 | + | |
| 379 | +// emitProgress sends agent:progress for a starting agent. The caller holds m.mu. | |
| 380 | +func (m *Manager) emitProgress(a *agent, line string) { | |
| 381 | + m.options.Emitter.Emit(events.AgentProgress, events.AgentProgressPayload{Agent: a.definition.Name, Step: a.step, Line: line, Since: a.since.UnixMilli()}) | |
| 348 | 382 | } |
| 349 | 383 | |
| 350 | 384 | // makeRoom keeps the number of running agents under the limit by stopping |
| @@ -637,6 +671,9 @@ func (m *Manager) log(a *agent, line string) { | ||
| 637 | 671 | a.logs = a.logs[len(a.logs)-logLines:] |
| 638 | 672 | } |
| 639 | 673 | m.options.Emitter.Emit(events.AgentLog, events.AgentLogPayload{Agent: a.definition.Name, Line: line}) |
| 674 | + if a.state == StateStarting { | |
| 675 | + m.emitProgress(a, strings.TrimPrefix(line, "sandbox: ")) | |
| 676 | + } | |
| 640 | 677 | } |
| 641 | 678 | |
| 642 | 679 | // setState changes the state and emits agent:state when it actually changes. |
| @@ -122,6 +122,10 @@ type Status struct { | |||
| 122 | // to stop or to remove the agent's sandbox or container (runtime.lifecycle). | 122 | // to stop or to remove the agent's sandbox or container (runtime.lifecycle). |
| 123 | CanStopSandbox bool `json:"canStopSandbox"` | 123 | CanStopSandbox bool `json:"canStopSandbox"` |
| 124 | CanRemoveSandbox bool `json:"canRemoveSandbox"` | 124 | CanRemoveSandbox bool `json:"canRemoveSandbox"` |
| 125 | + // Step and Since: while starting, the step and when the start began | ||
| 126 | + // (Unix milliseconds), as agent:progress gives them (issue #98). | ||
| 127 | + Step string `json:"step,omitempty"` | ||
| 128 | + Since int64 `json:"since,omitempty"` | ||
| 125 | } | 129 | } |
| 126 | 130 | ||
| 127 | // Manager owns the agent processes. It is safe for concurrent use. | 131 | // Manager owns the agent processes. It is safe for concurrent use. |
| @@ -150,6 +154,9 @@ type agent struct { | |||
| 150 | // stopRequested: Stop was called while the agent was starting. | 154 | // stopRequested: Stop was called while the agent was starting. |
| 151 | stopRequested bool | 155 | stopRequested bool |
| 152 | logs []string | 156 | logs []string |
| 157 | + // step and since: where the current start is, and when it began (issue #98). | ||
| 158 | + step string | ||
| 159 | + since time.Time | ||
| 153 | } | 160 | } |
| 154 | 161 | ||
| 155 | // NewManager returns a manager for the agents of the configuration. No agent | 162 | // NewManager returns a manager for the agents of the configuration. No agent |
| @@ -187,13 +194,17 @@ func (m *Manager) Statuses() []Status { | |||
| 187 | } | 194 | } |
| 188 | 195 | ||
| 189 | func (a *agent) status() Status { | 196 | func (a *agent) status() Status { |
| 190 | - return Status{ | 197 | + status := Status{ |
| 191 | Name: a.definition.Name, Title: a.definition.Title, Icon: a.definition.Icon, | 198 | Name: a.definition.Name, Title: a.definition.Title, Icon: a.definition.Icon, |
| 192 | Description: a.definition.Description, State: a.state, Error: a.err, Outdated: a.outdated, | 199 | Description: a.definition.Description, State: a.state, Error: a.err, Outdated: a.outdated, |
| 193 | Runtime: a.definition.Runtime.Type, | 200 | Runtime: a.definition.Runtime.Type, |
| 194 | CanStopSandbox: len(a.definition.Runtime.Lifecycle.Stop) > 0, | 201 | CanStopSandbox: len(a.definition.Runtime.Lifecycle.Stop) > 0, |
| 195 | CanRemoveSandbox: len(a.definition.Runtime.Lifecycle.Remove) > 0, | 202 | CanRemoveSandbox: len(a.definition.Runtime.Lifecycle.Remove) > 0, |
| 196 | } | 203 | } |
| 204 | + if a.state == StateStarting { | ||
| 205 | + status.Step, status.Since = a.step, a.since.UnixMilli() | ||
| 206 | + } | ||
| 207 | + return status | ||
| 197 | } | 208 | } |
| 198 | 209 | ||
| 199 | // Definition returns the configuration of the agent called name. | 210 | // Definition returns the configuration of the agent called name. |
| @@ -300,7 +311,9 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error | |||
| 300 | return nil, err | 311 | return nil, err |
| 301 | } | 312 | } |
| 302 | a.starting = make(chan struct{}) | 313 | a.starting = make(chan struct{}) |
| 314 | + a.step, a.since = events.StepChecking, m.options.Now() | ||
| 303 | m.setState(a, StateStarting, "") | 315 | m.setState(a, StateStarting, "") |
| 316 | + m.emitProgress(a, "") | ||
| 304 | definition := a.definition | 317 | definition := a.definition |
| 305 | m.mu.Unlock() | 318 | m.mu.Unlock() |
| 306 | 319 | ||
| @@ -311,6 +324,7 @@ func (m *Manager) ensureStarted(ctx context.Context, name string) (*agent, error | |||
| 311 | spec := m.specFor(definition) | 324 | spec := m.specFor(definition) |
| 312 | startErr := m.prepare(ctx, a, definition) | 325 | startErr := m.prepare(ctx, a, definition) |
| 313 | if startErr == nil { | 326 | if startErr == nil { |
| 327 | + m.toStep(a, events.StepConnecting) | ||
| 314 | if m.options.Tools != nil { | 328 | if m.options.Tools != nil { |
| 315 | m.log(a, toolsLine(spec)) | 329 | m.log(a, toolsLine(spec)) |
| 316 | } | 330 | } |
| @@ -344,7 +358,27 @@ func (m *Manager) prepare(ctx context.Context, a *agent, definition config.Agent | |||
| 344 | if m.options.Prepare == nil { | 358 | if m.options.Prepare == nil { |
| 345 | return nil | 359 | return nil |
| 346 | } | 360 | } |
| 347 | - return m.options.Prepare(ctx, definition, func(line string) { m.log(a, "sandbox: "+line) }) | 361 | + return m.options.Prepare(ctx, definition, func(line string) { |
| 362 | + // A line means the sandbox or the container is being made. | ||
| 363 | + m.toStep(a, events.StepPreparing) | ||
| 364 | + m.log(a, "sandbox: "+line) | ||
| 365 | + }) | ||
| 366 | +} | ||
| 367 | + | ||
| 368 | +// toStep moves a starting agent to step (issue #98). | ||
| 369 | +func (m *Manager) toStep(a *agent, step string) { | ||
| 370 | + m.mu.Lock() | ||
| 371 | + defer m.mu.Unlock() | ||
| 372 | + if a.state != StateStarting || a.step == step { | ||
| 373 | + return | ||
| 374 | + } | ||
| 375 | + a.step = step | ||
| 376 | + m.emitProgress(a, "") | ||
| 377 | +} | ||
| 378 | + | ||
| 379 | +// emitProgress sends agent:progress for a starting agent. The caller holds m.mu. | ||
| 380 | +func (m *Manager) emitProgress(a *agent, line string) { | ||
| 381 | + m.options.Emitter.Emit(events.AgentProgress, events.AgentProgressPayload{Agent: a.definition.Name, Step: a.step, Line: line, Since: a.since.UnixMilli()}) | ||
| 348 | } | 382 | } |
| 349 | 383 | ||
| 350 | // makeRoom keeps the number of running agents under the limit by stopping | 384 | // makeRoom keeps the number of running agents under the limit by stopping |
| @@ -637,6 +671,9 @@ func (m *Manager) log(a *agent, line string) { | |||
| 637 | a.logs = a.logs[len(a.logs)-logLines:] | 671 | a.logs = a.logs[len(a.logs)-logLines:] |
| 638 | } | 672 | } |
| 639 | m.options.Emitter.Emit(events.AgentLog, events.AgentLogPayload{Agent: a.definition.Name, Line: line}) | 673 | m.options.Emitter.Emit(events.AgentLog, events.AgentLogPayload{Agent: a.definition.Name, Line: line}) |
| 674 | + if a.state == StateStarting { | ||
| 675 | + m.emitProgress(a, strings.TrimPrefix(line, "sandbox: ")) | ||
| 676 | + } | ||
| 640 | } | 677 | } |
| 641 | 678 | ||
| 642 | // setState changes the state and emits agent:state when it actually changes. | 679 | // setState changes the state and emits agent:state when it actually changes. |
modified
internal/agents/manager_test.go +42 -0 | @@ -416,6 +416,48 @@ func TestPrepareRunsBeforeEachStartAndCanFailIt(t *testing.T) { | ||
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | +// Issue #98: a start says where it is — checking, preparing (the sandbox | |
| 420 | +// prints lines), connecting (the agent prints lines) — with when it began. | |
| 421 | +func TestAStartSaysItsStepsAndLines(t *testing.T) { | |
| 422 | + starter, recorder := newFakeStarter(), &events.Recorder{} | |
| 423 | + began := time.Date(2026, 11, 15, 9, 0, 0, 0, time.UTC) | |
| 424 | + var during agents.Status | |
| 425 | + var manager *agents.Manager | |
| 426 | + prepare := func(_ context.Context, _ config.Agent, log func(string)) error { | |
| 427 | + log("sandbox milo-sbx not found: creating it") | |
| 428 | + log("pulling docker.io/sbx/claude-acp:latest 42%") | |
| 429 | + during = manager.Statuses()[0] | |
| 430 | + return nil | |
| 431 | + } | |
| 432 | + manager = agents.NewManager(definitions("milo"), agents.Options{ | |
| 433 | + MaxRunning: maxRunning, Emitter: recorder, Starter: starter.start, Prepare: prepare, Now: func() time.Time { return began }, | |
| 434 | + }) | |
| 435 | + if err := manager.Start(ctx, "milo"); err != nil { | |
| 436 | + t.Fatal(err) | |
| 437 | + } | |
| 438 | + var got []string | |
| 439 | + for _, payload := range recorder.Named(events.AgentProgress) { | |
| 440 | + progress := payload.(events.AgentProgressPayload) | |
| 441 | + if progress.Agent != "milo" || progress.Since != began.UnixMilli() { | |
| 442 | + t.Fatalf("progress: %+v", progress) | |
| 443 | + } | |
| 444 | + got = append(got, progress.Step+"|"+progress.Line) | |
| 445 | + } | |
| 446 | + want := []string{ | |
| 447 | + "checking|", "preparing|", "preparing|sandbox milo-sbx not found: creating it", "preparing|pulling docker.io/sbx/claude-acp:latest 42%", | |
| 448 | + "connecting|", "connecting|milo started in /agents/milo", | |
| 449 | + } | |
| 450 | + if strings.Join(got, "\n") != strings.Join(want, "\n") { | |
| 451 | + t.Fatalf("progress:\n%s", strings.Join(got, "\n")) | |
| 452 | + } | |
| 453 | + if during.State != agents.StateStarting || during.Step != "preparing" || during.Since != began.UnixMilli() { | |
| 454 | + t.Fatalf("status while starting: %+v", during) | |
| 455 | + } | |
| 456 | + if after := manager.Statuses()[0]; after.Step != "" || after.Since != 0 { | |
| 457 | + t.Fatalf("no step once ready: %+v", after) | |
| 458 | + } | |
| 459 | +} | |
| 460 | + | |
| 419 | 461 | func TestStatusSaysWhichSandboxCommandsExist(t *testing.T) { |
| 420 | 462 | definition := config.Agent{Name: "milo", Command: "sbx", Runtime: config.Runtime{Type: "sbx", Sandbox: "milo-sbx", Lifecycle: config.Lifecycle{Stop: []string{"sbx", "stop", "milo-sbx"}}}} |
| 421 | 463 | manager := agents.NewManager([]config.Agent{definition}, agents.Options{Starter: newFakeStarter().start}) |
| @@ -416,6 +416,48 @@ func TestPrepareRunsBeforeEachStartAndCanFailIt(t *testing.T) { | |||
| 416 | } | 416 | } |
| 417 | } | 417 | } |
| 418 | 418 | ||
| 419 | +// Issue #98: a start says where it is — checking, preparing (the sandbox | ||
| 420 | +// prints lines), connecting (the agent prints lines) — with when it began. | ||
| 421 | +func TestAStartSaysItsStepsAndLines(t *testing.T) { | ||
| 422 | + starter, recorder := newFakeStarter(), &events.Recorder{} | ||
| 423 | + began := time.Date(2026, 11, 15, 9, 0, 0, 0, time.UTC) | ||
| 424 | + var during agents.Status | ||
| 425 | + var manager *agents.Manager | ||
| 426 | + prepare := func(_ context.Context, _ config.Agent, log func(string)) error { | ||
| 427 | + log("sandbox milo-sbx not found: creating it") | ||
| 428 | + log("pulling docker.io/sbx/claude-acp:latest 42%") | ||
| 429 | + during = manager.Statuses()[0] | ||
| 430 | + return nil | ||
| 431 | + } | ||
| 432 | + manager = agents.NewManager(definitions("milo"), agents.Options{ | ||
| 433 | + MaxRunning: maxRunning, Emitter: recorder, Starter: starter.start, Prepare: prepare, Now: func() time.Time { return began }, | ||
| 434 | + }) | ||
| 435 | + if err := manager.Start(ctx, "milo"); err != nil { | ||
| 436 | + t.Fatal(err) | ||
| 437 | + } | ||
| 438 | + var got []string | ||
| 439 | + for _, payload := range recorder.Named(events.AgentProgress) { | ||
| 440 | + progress := payload.(events.AgentProgressPayload) | ||
| 441 | + if progress.Agent != "milo" || progress.Since != began.UnixMilli() { | ||
| 442 | + t.Fatalf("progress: %+v", progress) | ||
| 443 | + } | ||
| 444 | + got = append(got, progress.Step+"|"+progress.Line) | ||
| 445 | + } | ||
| 446 | + want := []string{ | ||
| 447 | + "checking|", "preparing|", "preparing|sandbox milo-sbx not found: creating it", "preparing|pulling docker.io/sbx/claude-acp:latest 42%", | ||
| 448 | + "connecting|", "connecting|milo started in /agents/milo", | ||
| 449 | + } | ||
| 450 | + if strings.Join(got, "\n") != strings.Join(want, "\n") { | ||
| 451 | + t.Fatalf("progress:\n%s", strings.Join(got, "\n")) | ||
| 452 | + } | ||
| 453 | + if during.State != agents.StateStarting || during.Step != "preparing" || during.Since != began.UnixMilli() { | ||
| 454 | + t.Fatalf("status while starting: %+v", during) | ||
| 455 | + } | ||
| 456 | + if after := manager.Statuses()[0]; after.Step != "" || after.Since != 0 { | ||
| 457 | + t.Fatalf("no step once ready: %+v", after) | ||
| 458 | + } | ||
| 459 | +} | ||
| 460 | + | ||
| 419 | func TestStatusSaysWhichSandboxCommandsExist(t *testing.T) { | 461 | func TestStatusSaysWhichSandboxCommandsExist(t *testing.T) { |
| 420 | definition := config.Agent{Name: "milo", Command: "sbx", Runtime: config.Runtime{Type: "sbx", Sandbox: "milo-sbx", Lifecycle: config.Lifecycle{Stop: []string{"sbx", "stop", "milo-sbx"}}}} | 462 | definition := config.Agent{Name: "milo", Command: "sbx", Runtime: config.Runtime{Type: "sbx", Sandbox: "milo-sbx", Lifecycle: config.Lifecycle{Stop: []string{"sbx", "stop", "milo-sbx"}}}} |
| 421 | manager := agents.NewManager([]config.Agent{definition}, agents.Options{Starter: newFakeStarter().start}) | 463 | manager := agents.NewManager([]config.Agent{definition}, agents.Options{Starter: newFakeStarter().start}) |
modified
internal/events/events.go +20 -0 | @@ -21,6 +21,9 @@ const ( | ||
| 21 | 21 | AgentState = "agent:state" |
| 22 | 22 | // AgentLog: an agent wrote a line on its standard error. Payload: AgentLogPayload. |
| 23 | 23 | AgentLog = "agent:log" |
| 24 | + // AgentProgress: a starting agent moved to another step, or its sandbox | |
| 25 | + // or container printed a line (issue #98). Payload: AgentProgressPayload. | |
| 26 | + AgentProgress = "agent:progress" | |
| 24 | 27 | |
| 25 | 28 | // The channel events (milestones M2 and M3). Their payloads are defined in |
| 26 | 29 | // internal/channels, next to the types they carry. |
| @@ -100,6 +103,23 @@ type AgentLogPayload struct { | ||
| 100 | 103 | Line string `json:"line"` |
| 101 | 104 | } |
| 102 | 105 | |
| 106 | +// The steps of a start (issue #98), in order. | |
| 107 | +const ( | |
| 108 | + StepChecking = "checking" // its sandbox or container is looked at | |
| 109 | + StepPreparing = "preparing" // its sandbox or container is created or started | |
| 110 | + StepConnecting = "connecting" // its program starts and answers ACP's initialize | |
| 111 | +) | |
| 112 | + | |
| 113 | +// AgentProgressPayload is where the start of an agent is: its step, the last | |
| 114 | +// line printed (by sbx, docker or the agent), and when the start began | |
| 115 | +// (Unix milliseconds), for the time elapsed. | |
| 116 | +type AgentProgressPayload struct { | |
| 117 | + Agent string `json:"agent"` | |
| 118 | + Step string `json:"step"` | |
| 119 | + Line string `json:"line"` | |
| 120 | + Since int64 `json:"since"` | |
| 121 | +} | |
| 122 | + | |
| 103 | 123 | // Emitter sends an event to the interface. Implementations must be safe for |
| 104 | 124 | // concurrent use: agents report from their own goroutines. |
| 105 | 125 | type Emitter interface { |
| @@ -21,6 +21,9 @@ const ( | |||
| 21 | AgentState = "agent:state" | 21 | AgentState = "agent:state" |
| 22 | // AgentLog: an agent wrote a line on its standard error. Payload: AgentLogPayload. | 22 | // AgentLog: an agent wrote a line on its standard error. Payload: AgentLogPayload. |
| 23 | AgentLog = "agent:log" | 23 | AgentLog = "agent:log" |
| 24 | + // AgentProgress: a starting agent moved to another step, or its sandbox | ||
| 25 | + // or container printed a line (issue #98). Payload: AgentProgressPayload. | ||
| 26 | + AgentProgress = "agent:progress" | ||
| 24 | 27 | ||
| 25 | // The channel events (milestones M2 and M3). Their payloads are defined in | 28 | // The channel events (milestones M2 and M3). Their payloads are defined in |
| 26 | // internal/channels, next to the types they carry. | 29 | // internal/channels, next to the types they carry. |
| @@ -100,6 +103,23 @@ type AgentLogPayload struct { | |||
| 100 | Line string `json:"line"` | 103 | Line string `json:"line"` |
| 101 | } | 104 | } |
| 102 | 105 | ||
| 106 | +// The steps of a start (issue #98), in order. | ||
| 107 | +const ( | ||
| 108 | + StepChecking = "checking" // its sandbox or container is looked at | ||
| 109 | + StepPreparing = "preparing" // its sandbox or container is created or started | ||
| 110 | + StepConnecting = "connecting" // its program starts and answers ACP's initialize | ||
| 111 | +) | ||
| 112 | + | ||
| 113 | +// AgentProgressPayload is where the start of an agent is: its step, the last | ||
| 114 | +// line printed (by sbx, docker or the agent), and when the start began | ||
| 115 | +// (Unix milliseconds), for the time elapsed. | ||
| 116 | +type AgentProgressPayload struct { | ||
| 117 | + Agent string `json:"agent"` | ||
| 118 | + Step string `json:"step"` | ||
| 119 | + Line string `json:"line"` | ||
| 120 | + Since int64 `json:"since"` | ||
| 121 | +} | ||
| 122 | + | ||
| 103 | // Emitter sends an event to the interface. Implementations must be safe for | 123 | // Emitter sends an event to the interface. Implementations must be safe for |
| 104 | // concurrent use: agents report from their own goroutines. | 124 | // concurrent use: agents report from their own goroutines. |
| 105 | type Emitter interface { | 125 | type Emitter interface { |
modified
main.go +1 -0 | @@ -45,6 +45,7 @@ func init() { | ||
| 45 | 45 | application.RegisterEvent[events.ConfigChangedPayload](events.ConfigChanged) |
| 46 | 46 | application.RegisterEvent[events.AgentStatePayload](events.AgentState) |
| 47 | 47 | application.RegisterEvent[events.AgentLogPayload](events.AgentLog) |
| 48 | + application.RegisterEvent[events.AgentProgressPayload](events.AgentProgress) | |
| 48 | 49 | application.RegisterEvent[channels.ListPayload](events.ChannelsChanged) |
| 49 | 50 | application.RegisterEvent[channels.MessagePayload](events.MessageUpdated) |
| 50 | 51 | application.RegisterEvent[channels.DeltaPayload](events.MessageDelta) |
| @@ -45,6 +45,7 @@ func init() { | |||
| 45 | application.RegisterEvent[events.ConfigChangedPayload](events.ConfigChanged) | 45 | application.RegisterEvent[events.ConfigChangedPayload](events.ConfigChanged) |
| 46 | application.RegisterEvent[events.AgentStatePayload](events.AgentState) | 46 | application.RegisterEvent[events.AgentStatePayload](events.AgentState) |
| 47 | application.RegisterEvent[events.AgentLogPayload](events.AgentLog) | 47 | application.RegisterEvent[events.AgentLogPayload](events.AgentLog) |
| 48 | + application.RegisterEvent[events.AgentProgressPayload](events.AgentProgress) | ||
| 48 | application.RegisterEvent[channels.ListPayload](events.ChannelsChanged) | 49 | application.RegisterEvent[channels.ListPayload](events.ChannelsChanged) |
| 49 | application.RegisterEvent[channels.MessagePayload](events.MessageUpdated) | 50 | application.RegisterEvent[channels.MessagePayload](events.MessageUpdated) |
| 50 | application.RegisterEvent[channels.DeltaPayload](events.MessageDelta) | 51 | application.RegisterEvent[channels.DeltaPayload](events.MessageDelta) |