bots-garden/sidekickspublic Fork
⑂ dc2dbc0
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Merge feature/94-mini-me-creator into main

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
agent committed 2026-11-14T19:13:47+01:00 Browse files
dc2dbc0 parents: b1d3ddd f25badb
added .memory/handoffs/2026-11-14-mini-me-creator.md +23 -0
new file mode 100644
@@ -0,0 +1,23 @@
1+# Handoff — 2026-11-14 — #94 mini-me creation assistant
2+
3+## State
4+
5+Branch `feature/94-mini-me-creator`, not pushed. Implemented, tested in the Linux sandbox (unit + real mm 1.0.9 + Xvfb UI for a local agent). Tickets #94 and #95 closed (an sbx agent created by the assistant was never started from Sidekicks).
6+
7+## Next steps
8+
9+1. Container part verified on the Mac (mini-me feature/dockerinit-account; the owner releases it). Left: on the Mac with mm ≥ 1.0.9, create one agent per mode (local, Docker container, sbx) and start each from Sidekicks (task 7). For the container, the first start runs `docker compose up -d --wait` (build of mm's Dockerfile, network needed).
10+2. Release notes v1.5.0 EN/FR mention the assistant and `agentsFolder` (#93, task 8 of #94).
11+3. Merge into main when the owner agrees.
12+
13+## Watch out for
14+
15+- No released mm 1.0.9 existed at the time (mini-me tree at v1.0.8-8): an mm built by hand says `unknown`, which the version check accepts on purpose.
16+- mm's wizard texts are English; only Sidekicks' own texts are translated.
17+- Emoji show as boxes under Xvfb (no emoji font in the sandbox), not a bug.
18+
19+## Also on this branch: #95 (ask_user forms in conversations)
20+
21+- Done; tested by the owner with a real mini-me agent — #95 closed.
22+- Every agent (Claude, Codex, Gemini, docker-agent too) now advertises `elicitation.form`; one that sends a form gets the card. Not tried with them.
23+- `MINI-ME-DOCKERINIT-UID.md` at the root is a note for the mini-me project (dockerinit uid defect); delete it once handed over.
new file mode 100644
@@ -0,0 +1,23 @@
1+# Handoff — 2026-11-14 — #94 mini-me creation assistant
2+
3+## State
4+
5+Branch `feature/94-mini-me-creator`, not pushed. Implemented, tested in the Linux sandbox (unit + real mm 1.0.9 + Xvfb UI for a local agent). Tickets #94 and #95 closed (an sbx agent created by the assistant was never started from Sidekicks).
6+
7+## Next steps
8+
9+1. Container part verified on the Mac (mini-me feature/dockerinit-account; the owner releases it). Left: on the Mac with mm ≥ 1.0.9, create one agent per mode (local, Docker container, sbx) and start each from Sidekicks (task 7). For the container, the first start runs `docker compose up -d --wait` (build of mm's Dockerfile, network needed).
10+2. Release notes v1.5.0 EN/FR mention the assistant and `agentsFolder` (#93, task 8 of #94).
11+3. Merge into main when the owner agrees.
12+
13+## Watch out for
14+
15+- No released mm 1.0.9 existed at the time (mini-me tree at v1.0.8-8): an mm built by hand says `unknown`, which the version check accepts on purpose.
16+- mm's wizard texts are English; only Sidekicks' own texts are translated.
17+- Emoji show as boxes under Xvfb (no emoji font in the sandbox), not a bug.
18+
19+## Also on this branch: #95 (ask_user forms in conversations)
20+
21+- Done; tested by the owner with a real mini-me agent — #95 closed.
22+- Every agent (Claude, Codex, Gemini, docker-agent too) now advertises `elicitation.form`; one that sends a form gets the card. Not tried with them.
23+- `MINI-ME-DOCKERINIT-UID.md` at the root is a note for the mini-me project (dockerinit uid defect); delete it once handed over.
added .memory/handoffs/2026-11-14-release-v1.5.0.md +18 -0
new file mode 100644
@@ -0,0 +1,18 @@
1+# Handoff — 2026-11-14 — v1.4.0 closed, v1.5.0 opened
2+
3+## State
4+
5+- #92 and milestone `v1.4.0 · Release` closed in `.tickets/` (on the owner's word; the publication itself was not checked from here).
6+- Milestone `v1.5.0 · Release` + ticket #93 created; nothing attached to 1.5.0 yet. `info.version` still 1.4.0, `.release.env` still `TAG="v1.4.0"`.
7+- Ticket changes are not committed.
8+
9+## Next steps
10+
11+- Decide what goes into 1.5.0 (development milestone(s), tickets) and list it in #93's body.
12+- When ready: follow #93 tasks (same flow as #92 / RELEASING.fr.md).
13+- Locally: `git fetch --tags` (local tags stop at v1.2.0).
14+
15+## Ticket #94 (v1.5.0) — mini-me creation assistant
16+
17+- Specified, not started. Decisions in the ticket body: ACP client of `mm --acp-create --project yes` (.mm imposed), folder = agent name (temporary folder renamed if needed), emoji → `icon`, three plain error messages.
18+- To check first on a real mm ≥ 1.0.9: whether the session cwd can be a temporary folder renamed after `/write`, and the exact `/dockerinit` / `/sbxinit` output used to add the agent.
new file mode 100644
@@ -0,0 +1,18 @@
1+# Handoff — 2026-11-14 — v1.4.0 closed, v1.5.0 opened
2+
3+## State
4+
5+- #92 and milestone `v1.4.0 · Release` closed in `.tickets/` (on the owner's word; the publication itself was not checked from here).
6+- Milestone `v1.5.0 · Release` + ticket #93 created; nothing attached to 1.5.0 yet. `info.version` still 1.4.0, `.release.env` still `TAG="v1.4.0"`.
7+- Ticket changes are not committed.
8+
9+## Next steps
10+
11+- Decide what goes into 1.5.0 (development milestone(s), tickets) and list it in #93's body.
12+- When ready: follow #93 tasks (same flow as #92 / RELEASING.fr.md).
13+- Locally: `git fetch --tags` (local tags stop at v1.2.0).
14+
15+## Ticket #94 (v1.5.0) — mini-me creation assistant
16+
17+- Specified, not started. Decisions in the ticket body: ACP client of `mm --acp-create --project yes` (.mm imposed), folder = agent name (temporary folder renamed if needed), emoji → `icon`, three plain error messages.
18+- To check first on a real mm ≥ 1.0.9: whether the session cwd can be a temporary folder renamed after `/write`, and the exact `/dockerinit` / `/sbxinit` output used to add the agent.
modified .memory/history.md +23 -0
@@ -234,3 +234,26 @@
234234 - **2026-11-10 — #68 done**: macOS install guide EN/FR — signed & notarized path (Open once), update by replacing the app; variants: spctl check, unsigned 0.1.0/1.0.0 keep Open Anyway / xattr.
235235 - **2026-11-10 — M8 closed, v1.3.0 prepared** (owner: "close M8 and prepare milestone v1.3.0"): branch release/v1.3.0 — info.version 1.3.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.3.0 EN/FR, README status, ticket #88 "Publier la version 1.3.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). make verify stops only on the owner's agents/ralph/hello.go; every other check passes. Not pushed, not merged.
236236 - **2026-11-11 — M9 and M10 closed, v1.4.0 prepared** (owner: "prepare the next release"): branch release/v1.4.0 — info.version 1.4.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.4.0 EN/FR (/parallel #89, agent tools #90/#91, drafts per conversation), README status, milestone v1.4.0 · Release, ticket #92 "Publier la version 1.4.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). Not pushed.
237+- **2026-11-14 — v1.4.0 closed, v1.5.0 opened** (owner: "close ticket 92 and its release, create a new release"): #92 closed (tasks 4–8 closed on the owner's word, comment added), milestone `v1.4.0 · Release` closed; new milestone `v1.5.0 · Release` (open, content to define) and ticket #93 "Publier la version 1.5.0" (same 8 tasks as #92, all open, related #92). Publication of v1.4.0 not verified from the sandbox (origin unreachable via ssh, local tags stop at v1.2.0). No version bump, no branch, not committed.
238+- **2026-11-14 — /zedconfig request, blocked** (owner: "after the /start wizard a Zed config is shown; add a /zedconfig command that shows the options for docker compose, sbxenv or neither"): the wizard is mini-me's ACP create mode (`mini-me/internal/acpcreate/session.go`: `commands`, `howToUse`), not Sidekicks; mini-me is mounted read-only in this sandbox, so nothing was changed. Needs a session with mini-me writable.
239+- **2026-11-14 — /zedconfig dropped** (owner: "forget this last request"): nothing to do, no follow-up.
240+- **2026-11-14 — ticket #94** (owner: "a new assistant to create mini-me agents, for non-technical users"): #94 in `v1.5.0 · Release`, epic Agents — one folder per agent (default: host Documents, setting to change it), `mm acp-create` (mini-me ≥ 1.0.9) driven by `/start`, ".mm folder" checked by default, then local / compose (`/dockerinit`) / sbx (`/sbxinit`) and the agent is added. Open points listed in the ticket (how to pre-check the .mm question: `--project yes` skips it). Listed in #93. Not committed.
241+- **2026-11-14 — #94 precised** (owner): Sidekicks is an ACP client of `mm --acp-create` (standard ACP: elicitation forms, messages, commands); folder = agent name (asked near the end of the wizard), emoji choice → agent `icon`; error messages agreed (mm missing/too old, no model server, folder exists).
242+- **2026-11-14 — #94 decisions** (owner): `.mm` layout imposed (`mm --acp-create --project yes`, question not asked; bare `--project` is a string flag needing yes/no); temporary folder renamed to the agent name if needed.
243+
244+## 2026-11-14 — #94 mini-me creation assistant (branch feature/94-mini-me-creator)
245+
246+- Asked: "create a feature branch and implement the ticket" (#94, decisions in the ticket: ACP client of `mm --acp-create`, `.mm` imposed with `--project yes`, folder = agent name with a temporary folder, emoji, plain errors).
247+- Done: `internal/acp/forms.go` (elicitation forms; capability advertised only with `Spec.OnForm`; fields ordered by `required`), `internal/creator` (+ `creatortest` fake mm), `internal/app/creator.go` `CreatorService` (Start/Answer/Send/Finish/Cancel; problems `nameTaken`/`folderExists`/`invalidName`), config key `agentsFolder` (default `~/Documents`; schema, default file, allowedKeys — which also lacked `agentTools`), page `CreateMiniMeAgent.svelte` + `lib/creator.ts`, entry points (welcome, Agents panel, palette). Also `--output .mm/agent.yaml` so the file question is not asked either.
248+- Fix found on the way: lifecycle commands now get `PWD=<folder>` — mm's `compose.yaml` mounts `${PWD}`, and Sidekicks' PWD is "/" from the Finder.
249+- Tests: Go (acp forms, creator, app service, lifecycle PWD, config), vitest (creator.ts), `make lint-go` and svelte-check clean; real mm 1.0.9 built from the read-only mini-me tree (`-ldflags -X mm/internal/version.stamped=v1.0.9`) in local/container/sbx; UI under Xvfb: local agent created end to end with the host's llmman (models listed), Back, Cancel (temp folder removed, mm stopped), mm missing, mm 1.0.8. `make lint-headers` fails only on the owner's untracked `citizens/` and `sbxenv.yaml`. qlty absent from this sandbox: no qlty gate.
250+- Not done: a created container/sbx agent actually started (needs the Mac); release notes v1.5.0 (with #93). Docs EN/FR: how-to create-a-mini-me-agent / creer-un-agent-mini-me, configuration (`agentsFolder`), agents-and-events (`CreatorService`), shortcuts (palette), READMEs, add-an-agent see-also.
251+- **2026-11-14 — "I have no name!" in a created container's terminal** (owner): cause in mini-me, not Sidekicks — `mm dockerinit`'s compose.yaml runs the container as the host uid:gid (`${MM_UID:-<uid>}:${MM_GID:-<gid>}`, 501:20 on the Mac) while its Dockerfile only creates `mm` with uid 1000, so uid 501 has no /etc/passwd entry (bash prints "I have no name!", `whoami` fails, git without user.name/email and ssh refuse). Fix belongs to mini-me's dockerinit (create the user with the host uid via build args); mini-me is read-only in this sandbox. Nothing changed; waiting for the owner's choice.
252+- **2026-11-14 — note for mini-me + ticket #95** (owner): `MINI-ME-DOCKERINIT-UID.md` at the root explains the "I have no name!" defect of mm dockerinit (Dockerfile account uid 1000 vs compose `user:` = host uid) and the fix (account created from build args MM_UID/MM_GID, `groupadd -o`/`useradd -o`), checked in debian:bookworm-slim with -u 501:20 (whoami: before "cannot find name for user ID 501", after "mm"). #95 (no milestone): mm's `ask_user` text questions have no input in Sidekicks — conversation agents do not advertise `elicitation.form` (only #94's creator does), so mm falls back to permission dialogs (choices/yes-no only) or "unavailable"; routing needs the session id the SDK form type drops. Not committed.
253+- **2026-11-14 — #95 implemented** (owner: "#95 goes in v1.5.0, then implement it"): `acp.Spec.Forms` + `FormAsker` routing (`_meta["mm.elicitationScope"].sessionId`, else the only session with a turn in flight — `sessions.turns` counted in `Conn.Prompt`); agents manager sets `Forms: true` for every agent; channels `FormRequest`, events `form:requested|resolved`, `Manager.AnswerForm`, Cancel cancels forms; `ChannelService.AnswerForm`; UI `FormCard.svelte` + shared `FormFields.svelte` (the creator now uses it). Verified: Go/vitest/lint; Xvfb with a Python fake ACP agent imitating ask_user (empty required text refused, answer returned, Decline). Not verified: a real mm whose model calls ask_user. Docs EN/FR: agents-and-events (events, AnswerForm), permissions explanation.
254+- **2026-11-14 — #95 closed** (owner tested the ask_user form with a real mini-me agent: it works). #94's container part waits for a mini-me release with the dockerinit uid fix (MINI-ME-DOCKERINIT-UID.md) to be tested on the Mac.
255+- **2026-11-14 — mini-me feature/dockerinit-account checked** (owner: "the fix is on mini-me's branch feature/dockerinit-account, check it works"): mini-me's dockerinit/acpcreate tests pass; `mm init --project yes` + `mm dockerinit` from that branch, then `docker compose up -d --wait --build` (image downloads the published mm v1.0.9): as uid 1000 and with MM_UID=501 MM_GID=20 (the Mac's), `whoami` = mm, prompt `mm@<container>:…$`, `id` uid=501(mm) gid=20(dialout); git now only asks for user.name/email ("Author identity unknown", normal git); ACP initialize through `docker exec -i jimmy-box mm --acp --config <abs>/.mm/agent.yaml` answers (agentInfo jimmy, v1.0.9). Not checkable on Linux: a 501 container writing in a folder owned by 1000 is refused here (on the Mac Docker Desktop's file sharing maps it). Nothing changed in Sidekicks.
256+- **2026-11-14 — #94 container verified on the Mac** (owner, with mm from mini-me's feature/dockerinit-account: "it works"); the owner is releasing a new mini-me with the fix. Task 7 of #94 still needs an sbx agent started from Sidekicks.
257+- **2026-11-14 — #94 closed** (owner: "close the task, do the docs, close the task and the ticket"): tasks 7 (sbx agent start not tried — closed on the owner's word) and 8 closed. Docs: create-a-mini-me-agent EN/FR gained "I have no name!" (update mini-me, `mm dockerinit`, `docker compose up -d --build`); release notes v1.5.0 EN/FR drafted with #94 and #95 (comment on #93, its task 2 left open). README status still says 1.4.0 (#93's job).
258+- **2026-11-14 — ticket #96** (owner: "a new wizard 'create a sbx agent': Claude, Gemini or Codex for now, more later; folder in Documents by default, changeable; examples in ./tmp and config entries pasted"): #96 written (epic Docker SBX, no milestone yet): catalogue of types, `<agentsFolder>/<name>/sbxenv.yaml` + `workspace/`, config entries as the owner's, reuse of agentform.ts sbx knowledge. Open points in the ticket: sandbox name (name vs name-acp, uniqueness via `sbx ls`), API keys / OAuth (`sbx secret set …`), English comments, Gemini kit deprecation. Not committed.
259+- **2026-11-14 — #96 decisions** (owner): sandbox name = agent name; keys: explain, check the sbx secret exists, else ask and set it; English comments; Gemini moves to the `antigravity` kit once its ACP is understood (task 8); #96 in v1.5.0 (listed in #93). Branch feature/94-mini-me-creator merged into main (not pushed); new branch feature/96-sbx-creator.
@@ -234,3 +234,26 @@
234 - **2026-11-10 — #68 done**: macOS install guide EN/FR — signed & notarized path (Open once), update by replacing the app; variants: spctl check, unsigned 0.1.0/1.0.0 keep Open Anyway / xattr.234 - **2026-11-10 — #68 done**: macOS install guide EN/FR — signed & notarized path (Open once), update by replacing the app; variants: spctl check, unsigned 0.1.0/1.0.0 keep Open Anyway / xattr.
235 - **2026-11-10 — M8 closed, v1.3.0 prepared** (owner: "close M8 and prepare milestone v1.3.0"): branch release/v1.3.0 — info.version 1.3.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.3.0 EN/FR, README status, ticket #88 "Publier la version 1.3.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). make verify stops only on the owner's agents/ralph/hello.go; every other check passes. Not pushed, not merged.235 - **2026-11-10 — M8 closed, v1.3.0 prepared** (owner: "close M8 and prepare milestone v1.3.0"): branch release/v1.3.0 — info.version 1.3.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.3.0 EN/FR, README status, ticket #88 "Publier la version 1.3.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). make verify stops only on the owner's agents/ralph/hello.go; every other check passes. Not pushed, not merged.
236 - **2026-11-11 — M9 and M10 closed, v1.4.0 prepared** (owner: "prepare the next release"): branch release/v1.4.0 — info.version 1.4.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.4.0 EN/FR (/parallel #89, agent tools #90/#91, drafts per conversation), README status, milestone v1.4.0 · Release, ticket #92 "Publier la version 1.4.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). Not pushed.236 - **2026-11-11 — M9 and M10 closed, v1.4.0 prepared** (owner: "prepare the next release"): branch release/v1.4.0 — info.version 1.4.0 + build assets synced (LSMinimumSystemVersion 13.0.0), release notes v1.4.0 EN/FR (/parallel #89, agent tools #90/#91, drafts per conversation), README status, milestone v1.4.0 · Release, ticket #92 "Publier la version 1.4.0" (tasks 1–3 done; verify/push, build+sign on the Mac, draft/upload/publish, fetch tags left). Not pushed.
237+- **2026-11-14 — v1.4.0 closed, v1.5.0 opened** (owner: "close ticket 92 and its release, create a new release"): #92 closed (tasks 4–8 closed on the owner's word, comment added), milestone `v1.4.0 · Release` closed; new milestone `v1.5.0 · Release` (open, content to define) and ticket #93 "Publier la version 1.5.0" (same 8 tasks as #92, all open, related #92). Publication of v1.4.0 not verified from the sandbox (origin unreachable via ssh, local tags stop at v1.2.0). No version bump, no branch, not committed.
238+- **2026-11-14 — /zedconfig request, blocked** (owner: "after the /start wizard a Zed config is shown; add a /zedconfig command that shows the options for docker compose, sbxenv or neither"): the wizard is mini-me's ACP create mode (`mini-me/internal/acpcreate/session.go`: `commands`, `howToUse`), not Sidekicks; mini-me is mounted read-only in this sandbox, so nothing was changed. Needs a session with mini-me writable.
239+- **2026-11-14 — /zedconfig dropped** (owner: "forget this last request"): nothing to do, no follow-up.
240+- **2026-11-14 — ticket #94** (owner: "a new assistant to create mini-me agents, for non-technical users"): #94 in `v1.5.0 · Release`, epic Agents — one folder per agent (default: host Documents, setting to change it), `mm acp-create` (mini-me ≥ 1.0.9) driven by `/start`, ".mm folder" checked by default, then local / compose (`/dockerinit`) / sbx (`/sbxinit`) and the agent is added. Open points listed in the ticket (how to pre-check the .mm question: `--project yes` skips it). Listed in #93. Not committed.
241+- **2026-11-14 — #94 precised** (owner): Sidekicks is an ACP client of `mm --acp-create` (standard ACP: elicitation forms, messages, commands); folder = agent name (asked near the end of the wizard), emoji choice → agent `icon`; error messages agreed (mm missing/too old, no model server, folder exists).
242+- **2026-11-14 — #94 decisions** (owner): `.mm` layout imposed (`mm --acp-create --project yes`, question not asked; bare `--project` is a string flag needing yes/no); temporary folder renamed to the agent name if needed.
243+
244+## 2026-11-14 — #94 mini-me creation assistant (branch feature/94-mini-me-creator)
245+
246+- Asked: "create a feature branch and implement the ticket" (#94, decisions in the ticket: ACP client of `mm --acp-create`, `.mm` imposed with `--project yes`, folder = agent name with a temporary folder, emoji, plain errors).
247+- Done: `internal/acp/forms.go` (elicitation forms; capability advertised only with `Spec.OnForm`; fields ordered by `required`), `internal/creator` (+ `creatortest` fake mm), `internal/app/creator.go` `CreatorService` (Start/Answer/Send/Finish/Cancel; problems `nameTaken`/`folderExists`/`invalidName`), config key `agentsFolder` (default `~/Documents`; schema, default file, allowedKeys — which also lacked `agentTools`), page `CreateMiniMeAgent.svelte` + `lib/creator.ts`, entry points (welcome, Agents panel, palette). Also `--output .mm/agent.yaml` so the file question is not asked either.
248+- Fix found on the way: lifecycle commands now get `PWD=<folder>` — mm's `compose.yaml` mounts `${PWD}`, and Sidekicks' PWD is "/" from the Finder.
249+- Tests: Go (acp forms, creator, app service, lifecycle PWD, config), vitest (creator.ts), `make lint-go` and svelte-check clean; real mm 1.0.9 built from the read-only mini-me tree (`-ldflags -X mm/internal/version.stamped=v1.0.9`) in local/container/sbx; UI under Xvfb: local agent created end to end with the host's llmman (models listed), Back, Cancel (temp folder removed, mm stopped), mm missing, mm 1.0.8. `make lint-headers` fails only on the owner's untracked `citizens/` and `sbxenv.yaml`. qlty absent from this sandbox: no qlty gate.
250+- Not done: a created container/sbx agent actually started (needs the Mac); release notes v1.5.0 (with #93). Docs EN/FR: how-to create-a-mini-me-agent / creer-un-agent-mini-me, configuration (`agentsFolder`), agents-and-events (`CreatorService`), shortcuts (palette), READMEs, add-an-agent see-also.
251+- **2026-11-14 — "I have no name!" in a created container's terminal** (owner): cause in mini-me, not Sidekicks — `mm dockerinit`'s compose.yaml runs the container as the host uid:gid (`${MM_UID:-<uid>}:${MM_GID:-<gid>}`, 501:20 on the Mac) while its Dockerfile only creates `mm` with uid 1000, so uid 501 has no /etc/passwd entry (bash prints "I have no name!", `whoami` fails, git without user.name/email and ssh refuse). Fix belongs to mini-me's dockerinit (create the user with the host uid via build args); mini-me is read-only in this sandbox. Nothing changed; waiting for the owner's choice.
252+- **2026-11-14 — note for mini-me + ticket #95** (owner): `MINI-ME-DOCKERINIT-UID.md` at the root explains the "I have no name!" defect of mm dockerinit (Dockerfile account uid 1000 vs compose `user:` = host uid) and the fix (account created from build args MM_UID/MM_GID, `groupadd -o`/`useradd -o`), checked in debian:bookworm-slim with -u 501:20 (whoami: before "cannot find name for user ID 501", after "mm"). #95 (no milestone): mm's `ask_user` text questions have no input in Sidekicks — conversation agents do not advertise `elicitation.form` (only #94's creator does), so mm falls back to permission dialogs (choices/yes-no only) or "unavailable"; routing needs the session id the SDK form type drops. Not committed.
253+- **2026-11-14 — #95 implemented** (owner: "#95 goes in v1.5.0, then implement it"): `acp.Spec.Forms` + `FormAsker` routing (`_meta["mm.elicitationScope"].sessionId`, else the only session with a turn in flight — `sessions.turns` counted in `Conn.Prompt`); agents manager sets `Forms: true` for every agent; channels `FormRequest`, events `form:requested|resolved`, `Manager.AnswerForm`, Cancel cancels forms; `ChannelService.AnswerForm`; UI `FormCard.svelte` + shared `FormFields.svelte` (the creator now uses it). Verified: Go/vitest/lint; Xvfb with a Python fake ACP agent imitating ask_user (empty required text refused, answer returned, Decline). Not verified: a real mm whose model calls ask_user. Docs EN/FR: agents-and-events (events, AnswerForm), permissions explanation.
254+- **2026-11-14 — #95 closed** (owner tested the ask_user form with a real mini-me agent: it works). #94's container part waits for a mini-me release with the dockerinit uid fix (MINI-ME-DOCKERINIT-UID.md) to be tested on the Mac.
255+- **2026-11-14 — mini-me feature/dockerinit-account checked** (owner: "the fix is on mini-me's branch feature/dockerinit-account, check it works"): mini-me's dockerinit/acpcreate tests pass; `mm init --project yes` + `mm dockerinit` from that branch, then `docker compose up -d --wait --build` (image downloads the published mm v1.0.9): as uid 1000 and with MM_UID=501 MM_GID=20 (the Mac's), `whoami` = mm, prompt `mm@<container>:…$`, `id` uid=501(mm) gid=20(dialout); git now only asks for user.name/email ("Author identity unknown", normal git); ACP initialize through `docker exec -i jimmy-box mm --acp --config <abs>/.mm/agent.yaml` answers (agentInfo jimmy, v1.0.9). Not checkable on Linux: a 501 container writing in a folder owned by 1000 is refused here (on the Mac Docker Desktop's file sharing maps it). Nothing changed in Sidekicks.
256+- **2026-11-14 — #94 container verified on the Mac** (owner, with mm from mini-me's feature/dockerinit-account: "it works"); the owner is releasing a new mini-me with the fix. Task 7 of #94 still needs an sbx agent started from Sidekicks.
257+- **2026-11-14 — #94 closed** (owner: "close the task, do the docs, close the task and the ticket"): tasks 7 (sbx agent start not tried — closed on the owner's word) and 8 closed. Docs: create-a-mini-me-agent EN/FR gained "I have no name!" (update mini-me, `mm dockerinit`, `docker compose up -d --build`); release notes v1.5.0 EN/FR drafted with #94 and #95 (comment on #93, its task 2 left open). README status still says 1.4.0 (#93's job).
258+- **2026-11-14 — ticket #96** (owner: "a new wizard 'create a sbx agent': Claude, Gemini or Codex for now, more later; folder in Documents by default, changeable; examples in ./tmp and config entries pasted"): #96 written (epic Docker SBX, no milestone yet): catalogue of types, `<agentsFolder>/<name>/sbxenv.yaml` + `workspace/`, config entries as the owner's, reuse of agentform.ts sbx knowledge. Open points in the ticket: sandbox name (name vs name-acp, uniqueness via `sbx ls`), API keys / OAuth (`sbx secret set …`), English comments, Gemini kit deprecation. Not committed.
259+- **2026-11-14 — #96 decisions** (owner): sandbox name = agent name; keys: explain, check the sbx secret exists, else ask and set it; English comments; Gemini moves to the `antigravity` kit once its ACP is understood (task 8); #96 in v1.5.0 (listed in #93). Branch feature/94-mini-me-creator merged into main (not pushed); new branch feature/96-sbx-creator.
modified .memory/summary.md +4 -2
@@ -13,7 +13,7 @@ Milestones **Initialize**, **M1**, **M2**, **M3** and **M4 · Workspace des agen
1313
1414 What exists:
1515
16-- `main.go` (root, only Wails importer; registers 11 typed events; injects the native file dialog; its emitter ignores events sent before the Wails app exists) · `internal/app` (Core, AgentService, ChannelService, ConfigService; opens the history per config file) · `internal/channels` (routing, sessions, context, queue, permissions) · `internal/store` (Pebble) · `internal/workspace` (Local, Container, Terminals; contract tests local + alpine container) · `internal/agents` · `internal/acp` (sessions, readable AgentError, stdin→TERM→KILL) · `internal/config` (+ `WatchWithReady`, `AppendAgent` keeps comments and unescapes emoji) · `internal/prefs` · `internal/events` · `internal/shellpath` · `schema`.
16+- `main.go` (root, only Wails importer; registers 11 typed events; injects the native file dialog; its emitter ignores events sent before the Wails app exists) · `internal/app` (Core, AgentService, ChannelService, ConfigService; opens the history per config file) · `internal/channels` (routing, sessions, context, queue, permissions) · `internal/store` (Pebble) · `internal/workspace` (Local, Container, Terminals; contract tests local + alpine container) · `internal/agents` · `internal/acp` (sessions, readable AgentError, stdin→TERM→KILL; elicitation forms with `Spec.OnForm`, #94) · `internal/creator` (drives `mm --acp-create` for the mini-me creation assistant, #94; fake mm in `creator/creatortest`) · `internal/config` (+ `WatchWithReady`, `AppendAgent` keeps comments and unescapes emoji) · `internal/prefs` · `internal/events` · `internal/shellpath` · `schema`.
1717 - `frontend/`: shell + panel registry, `state.svelte.ts` (`appState`, one ordered frame batcher for message events), `lib/chat/*` (Markdown, MessageView, ToolCallCard, PermissionCard, Composer), `lib/settings/ConfigEditor.svelte`, `lib/i18n` (en/fr catalogue, `t()`), pure modules with vitest (`markdown`, `conversation`, `composer`, `suggestions`, `tools`, `yamlSchema`, `events`, `theme`, `panels/registry`). State is keyed by channel id; a `$derived` must never call `conversationOf` (it writes state → `state_unsafe_mutation` freezes the UI).
1818 - Tooling: `Makefile`, golangci-lint (`tools/go.mod`), no hosted CI (owner's choice: checks run locally, `make verify`; releases by the local CI `local-ci-*.sh` + `.release.env`/`.ci.cd.token.env`, see RELEASING.md — the old workflow is `.github.bak/`; `make check-linux` runs `make check` in the Linux Docker image), `scripts/agents.sh`, `scripts/install-test-config.sh`, `scripts/check-license-headers.sh`, `scripts/package.sh` (+ `package_test.sh`), `scripts/build-release.sh`, `scripts/tag-release.sh` (+ `tag-release_test.sh`), `scripts/linux-packages.Dockerfile`, `scripts/check-linux.sh`, release workflow (tag push → release) `.github/workflows/release.yml`.
1919
@@ -24,6 +24,8 @@ What exists:
2424 - Conversations, permissions, settings: ADR 0004 (direct conversation per agent, in memory; new session after an agent restart + system message; queue; events `message:updated|delta`, `turn:changed`, `permission:requested|resolved`, `usage:changed`; never-before-reject ordering; stuck banner after 3 failed tool calls; Go validates, the editor only displays; prefs.json).
2525 - Channels: ADR 0006 — routing (`/agent:cmd` > mentions in order > last speaker > nobody), one session per (channel, agent), unseen messages re-sent (20 max, 1500 chars each, prompt ends with "answer directly, without your name in front"), one channel at a time per agent, commands sent alone, fresh session after restart gets the last messages, no Sidekicks-local slash commands (owner's choice), deleting a channel deletes its history after confirmation. Store: keys of ADR 0003 + `direct/<agent>` + `value/<key>`, `ErrClosed` after Close, in-memory fallback when the DB is locked (`historyProblem`).
2626 - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths.
27+- Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's).
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.
2729 - 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.
2830 - 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).
2931 - 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/`.
@@ -38,7 +40,7 @@ What exists:
3840 | | |
3941 | --- | --- |
4042 | Before merging (no CI) | `make verify` = `make check` (lint + tests; needs `wails3`, `pnpm`, GTK/WebKit dev packages on Linux) + `make bindings-check` · Linux from the Mac: `make check-linux` |
41-| Tests only | `make test` (Go + vitest + shell) · real agents: `make test-real` |
43+| Tests only | `make test` (Go + vitest + shell) · real agents: `make test-real` (the creator's: `MM_BIN=<mm ≥ 1.0.9> go test -tags realagents ./internal/creator`, no model server needed) |
4244 | Run | `SIDEKICKS_CONFIG="$PWD/examples/test-agents.yaml" make dev` · build `make build` · macOS app `make package` |
4345 | Release | `make release-build` (Mac: all packages → dist/, Linux in Docker) · `make release-tag` · single systems: `make package-linux` / `package-windows` / `package-macos`; see RELEASING.md |
4446 | Bindings | `make bindings` after changing a service/event, stage them; `make bindings-check` compares with the index |
@@ -13,7 +13,7 @@ Milestones **Initialize**, **M1**, **M2**, **M3** and **M4 · Workspace des agen
13 13
14 What exists:14 What exists:
15 15
16-- `main.go` (root, only Wails importer; registers 11 typed events; injects the native file dialog; its emitter ignores events sent before the Wails app exists) · `internal/app` (Core, AgentService, ChannelService, ConfigService; opens the history per config file) · `internal/channels` (routing, sessions, context, queue, permissions) · `internal/store` (Pebble) · `internal/workspace` (Local, Container, Terminals; contract tests local + alpine container) · `internal/agents` · `internal/acp` (sessions, readable AgentError, stdin→TERM→KILL) · `internal/config` (+ `WatchWithReady`, `AppendAgent` keeps comments and unescapes emoji) · `internal/prefs` · `internal/events` · `internal/shellpath` · `schema`.16+- `main.go` (root, only Wails importer; registers 11 typed events; injects the native file dialog; its emitter ignores events sent before the Wails app exists) · `internal/app` (Core, AgentService, ChannelService, ConfigService; opens the history per config file) · `internal/channels` (routing, sessions, context, queue, permissions) · `internal/store` (Pebble) · `internal/workspace` (Local, Container, Terminals; contract tests local + alpine container) · `internal/agents` · `internal/acp` (sessions, readable AgentError, stdin→TERM→KILL; elicitation forms with `Spec.OnForm`, #94) · `internal/creator` (drives `mm --acp-create` for the mini-me creation assistant, #94; fake mm in `creator/creatortest`) · `internal/config` (+ `WatchWithReady`, `AppendAgent` keeps comments and unescapes emoji) · `internal/prefs` · `internal/events` · `internal/shellpath` · `schema`.
17 - `frontend/`: shell + panel registry, `state.svelte.ts` (`appState`, one ordered frame batcher for message events), `lib/chat/*` (Markdown, MessageView, ToolCallCard, PermissionCard, Composer), `lib/settings/ConfigEditor.svelte`, `lib/i18n` (en/fr catalogue, `t()`), pure modules with vitest (`markdown`, `conversation`, `composer`, `suggestions`, `tools`, `yamlSchema`, `events`, `theme`, `panels/registry`). State is keyed by channel id; a `$derived` must never call `conversationOf` (it writes state → `state_unsafe_mutation` freezes the UI).17 - `frontend/`: shell + panel registry, `state.svelte.ts` (`appState`, one ordered frame batcher for message events), `lib/chat/*` (Markdown, MessageView, ToolCallCard, PermissionCard, Composer), `lib/settings/ConfigEditor.svelte`, `lib/i18n` (en/fr catalogue, `t()`), pure modules with vitest (`markdown`, `conversation`, `composer`, `suggestions`, `tools`, `yamlSchema`, `events`, `theme`, `panels/registry`). State is keyed by channel id; a `$derived` must never call `conversationOf` (it writes state → `state_unsafe_mutation` freezes the UI).
18 - Tooling: `Makefile`, golangci-lint (`tools/go.mod`), no hosted CI (owner's choice: checks run locally, `make verify`; releases by the local CI `local-ci-*.sh` + `.release.env`/`.ci.cd.token.env`, see RELEASING.md — the old workflow is `.github.bak/`; `make check-linux` runs `make check` in the Linux Docker image), `scripts/agents.sh`, `scripts/install-test-config.sh`, `scripts/check-license-headers.sh`, `scripts/package.sh` (+ `package_test.sh`), `scripts/build-release.sh`, `scripts/tag-release.sh` (+ `tag-release_test.sh`), `scripts/linux-packages.Dockerfile`, `scripts/check-linux.sh`, release workflow (tag push → release) `.github/workflows/release.yml`.18 - Tooling: `Makefile`, golangci-lint (`tools/go.mod`), no hosted CI (owner's choice: checks run locally, `make verify`; releases by the local CI `local-ci-*.sh` + `.release.env`/`.ci.cd.token.env`, see RELEASING.md — the old workflow is `.github.bak/`; `make check-linux` runs `make check` in the Linux Docker image), `scripts/agents.sh`, `scripts/install-test-config.sh`, `scripts/check-license-headers.sh`, `scripts/package.sh` (+ `package_test.sh`), `scripts/build-release.sh`, `scripts/tag-release.sh` (+ `tag-release_test.sh`), `scripts/linux-packages.Dockerfile`, `scripts/check-linux.sh`, release workflow (tag push → release) `.github/workflows/release.yml`.
19 19
@@ -24,6 +24,8 @@ What exists:
24 - Conversations, permissions, settings: ADR 0004 (direct conversation per agent, in memory; new session after an agent restart + system message; queue; events `message:updated|delta`, `turn:changed`, `permission:requested|resolved`, `usage:changed`; never-before-reject ordering; stuck banner after 3 failed tool calls; Go validates, the editor only displays; prefs.json).24 - Conversations, permissions, settings: ADR 0004 (direct conversation per agent, in memory; new session after an agent restart + system message; queue; events `message:updated|delta`, `turn:changed`, `permission:requested|resolved`, `usage:changed`; never-before-reject ordering; stuck banner after 3 failed tool calls; Go validates, the editor only displays; prefs.json).
25 - Channels: ADR 0006 — routing (`/agent:cmd` > mentions in order > last speaker > nobody), one session per (channel, agent), unseen messages re-sent (20 max, 1500 chars each, prompt ends with "answer directly, without your name in front"), one channel at a time per agent, commands sent alone, fresh session after restart gets the last messages, no Sidekicks-local slash commands (owner's choice), deleting a channel deletes its history after confirmation. Store: keys of ADR 0003 + `direct/<agent>` + `value/<key>`, `ErrClosed` after Close, in-memory fallback when the DB is locked (`historyProblem`).25 - Channels: ADR 0006 — routing (`/agent:cmd` > mentions in order > last speaker > nobody), one session per (channel, agent), unseen messages re-sent (20 max, 1500 chars each, prompt ends with "answer directly, without your name in front"), one channel at a time per agent, commands sent alone, fresh session after restart gets the last messages, no Sidekicks-local slash commands (owner's choice), deleting a channel deletes its history after confirmation. Store: keys of ADR 0003 + `direct/<agent>` + `value/<key>`, `ErrClosed` after Close, in-memory fallback when the DB is locked (`historyProblem`).
26 - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths.26 - Workspaces: ADR 0007 — one `Workspace` interface (local: os/fsnotify/creack pty; container: docker exec + busybox-compatible POSIX scripts; sbx: ErrNotSupported until #39); paths relative, never leaving the folder; versioned writes (content hash) + atomic rename; local delete → system trash (EXDEV → final), container delete final; only the shown workspace is watched (fsnotify / 2 s polling in containers); terminals: output events every 16 ms/32 KB UTF-8-safe, Close hangs up the whole session (`pkill -s`) and, in a container, the session inside it (pid file + /proc); `docker` looked up in PATH then Docker Desktop/Homebrew paths.
27+- Mini-me creation assistant (#94, `CreatorService`, page `CreateMiniMeAgent.svelte`): Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mm ≥ 1.0.9, checked with `mm --version`; an unparsable version is accepted); `.mm` layout imposed; the wizard runs in `<agentsFolder>/.sidekicks-new-agent-*`, renamed to `<agentsFolder>/<name>` at Finish (name = folder = agent name; an existing folder is never touched); container/sbx files come from `/dockerinit` / `/sbxinit` in an mm restarted in the final folder. `agentsFolder` (top-level config key) defaults to `~/Documents`. mm's questions stay in English (they are mm's).
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.
27 - 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.29 - Interface language: ADR 0005 — `ui.language` defaults to `en`; every UI text is a key of `frontend/src/lib/i18n/messages.ts` (`fr` typed `Record<MessageKey,string>`, test checks keys and variables); config errors use the Go catalogue in the same language; agent titles and channel names are user data, never translated. Default config file and `examples/test-agents.yaml` are in English.
28 - 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).30 - Packages and data model: ADR 0003 + Amendments 1 and 2 (main at the root, only main.go imports Wails, `internal/events` with an `Emitter` interface, LRU eviction of idle agents at the limit).
29 - 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/`.31 - Frontend dependencies with **pnpm 12.11.2** and `frontend/pnpm-workspace.yaml` `supportedArchitectures` (darwin+linux): the repository folder is shared between the Mac and the Linux sandbox. Never use npm in `frontend/`.
@@ -38,7 +40,7 @@ What exists:
38 | | |40 | | |
39 | --- | --- |41 | --- | --- |
40 | Before merging (no CI) | `make verify` = `make check` (lint + tests; needs `wails3`, `pnpm`, GTK/WebKit dev packages on Linux) + `make bindings-check` · Linux from the Mac: `make check-linux` |42 | Before merging (no CI) | `make verify` = `make check` (lint + tests; needs `wails3`, `pnpm`, GTK/WebKit dev packages on Linux) + `make bindings-check` · Linux from the Mac: `make check-linux` |
41-| Tests only | `make test` (Go + vitest + shell) · real agents: `make test-real` |43+| Tests only | `make test` (Go + vitest + shell) · real agents: `make test-real` (the creator's: `MM_BIN=<mm ≥ 1.0.9> go test -tags realagents ./internal/creator`, no model server needed) |
42 | Run | `SIDEKICKS_CONFIG="$PWD/examples/test-agents.yaml" make dev` · build `make build` · macOS app `make package` |44 | Run | `SIDEKICKS_CONFIG="$PWD/examples/test-agents.yaml" make dev` · build `make build` · macOS app `make package` |
43 | Release | `make release-build` (Mac: all packages → dist/, Linux in Docker) · `make release-tag` · single systems: `make package-linux` / `package-windows` / `package-macos`; see RELEASING.md |45 | Release | `make release-build` (Mac: all packages → dist/, Linux in Docker) · `make release-tag` · single systems: `make package-linux` / `package-windows` / `package-macos`; see RELEASING.md |
44 | Bindings | `make bindings` after changing a service/event, stage them; `make bindings-check` compares with the index |46 | Bindings | `make bindings` after changing a service/event, stage them; `make bindings-check` compares with the index |
modified .tickets/issues/0092-publier-la-version-1-4-0.yaml +26 -8
@@ -1,12 +1,12 @@
11 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
22 id: 92
33 title: Publier la version 1.4.0
4-state: open
4+state: closed
55 author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-11T00:26:53.000Z
9-updatedAt: 2026-11-11T00:26:53.000Z
9+updatedAt: 2026-11-14T05:24:28.000Z
1010 labels:
1111 - kind::chore
1212 - area::infra
@@ -65,42 +65,60 @@ tasks:
6565 closedAt: 2026-11-11T00:26:53.000Z
6666 - id: 4
6767 title: "make verify, commit, fusion et push sur main ; TAG=\"v1.4.0\" dans .release.env"
68- state: open
68+ state: closed
6969 priority: high
7070 author:
7171 name: k33g
7272 email: ph.charriere@gmail.com
7373 createdAt: 2026-11-11T00:26:53.000Z
74+ updatedAt: 2026-11-14T05:24:28.000Z
75+ closedAt: 2026-11-14T05:24:28.000Z
7476 - id: 5
7577 title: "./local-ci-02-build.sh : paquets macOS signés et notarisés, Windows, SHA256SUMS (kDrive en pause)"
76- state: open
78+ state: closed
7779 priority: high
7880 author:
7981 name: k33g
8082 email: ph.charriere@gmail.com
8183 createdAt: 2026-11-11T00:26:53.000Z
84+ updatedAt: 2026-11-14T05:24:28.000Z
85+ closedAt: 2026-11-14T05:24:28.000Z
8286 - id: 6
8387 title: "Essayer le .dmg sur un autre Mac ou un autre compte"
84- state: open
88+ state: closed
8589 priority: medium
8690 author:
8791 name: k33g
8892 email: ph.charriere@gmail.com
8993 createdAt: 2026-11-11T00:26:53.000Z
94+ updatedAt: 2026-11-14T05:24:28.000Z
95+ closedAt: 2026-11-14T05:24:28.000Z
9096 - id: 7
9197 title: "./local-ci-03 à 05 : brouillon, envoi, publication ; vérifier le .dmg téléchargé"
92- state: open
98+ state: closed
9399 priority: high
94100 author:
95101 name: k33g
96102 email: ph.charriere@gmail.com
97103 createdAt: 2026-11-11T00:26:53.000Z
104+ updatedAt: 2026-11-14T05:24:28.000Z
105+ closedAt: 2026-11-14T05:24:28.000Z
98106 - id: 8
99107 title: "git fetch --tags, fermer la milestone v1.4.0"
100- state: open
108+ state: closed
101109 priority: low
102110 author:
103111 name: k33g
104112 email: ph.charriere@gmail.com
105113 createdAt: 2026-11-11T00:26:53.000Z
106-comments: []
114+ updatedAt: 2026-11-14T05:24:28.000Z
115+ closedAt: 2026-11-14T05:24:28.000Z
116+comments:
117+ - id: 1
118+ author:
119+ name: k33g
120+ email: ph.charriere@gmail.com
121+ createdAt: 2026-11-14T05:24:28.000Z
122+ body: |
123+ Version 1.4.0 publiée. Ticket et milestone v1.4.0 · Release fermés ; la suite est dans
124+ [#93 — Publier la version 1.5.0](.tickets/issues/0093-publier-la-version-1-5-0.yaml).
@@ -1,12 +1,12 @@
1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.1 # Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2 id: 922 id: 92
3 title: Publier la version 1.4.03 title: Publier la version 1.4.0
4-state: open4+state: closed
5 author:5 author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-11T00:26:53.000Z8 createdAt: 2026-11-11T00:26:53.000Z
9-updatedAt: 2026-11-11T00:26:53.000Z9+updatedAt: 2026-11-14T05:24:28.000Z
10 labels:10 labels:
11 - kind::chore11 - kind::chore
12 - area::infra12 - area::infra
@@ -65,42 +65,60 @@ tasks:
65 closedAt: 2026-11-11T00:26:53.000Z65 closedAt: 2026-11-11T00:26:53.000Z
66 - id: 466 - id: 4
67 title: "make verify, commit, fusion et push sur main ; TAG=\"v1.4.0\" dans .release.env"67 title: "make verify, commit, fusion et push sur main ; TAG=\"v1.4.0\" dans .release.env"
68- state: open68+ state: closed
69 priority: high69 priority: high
70 author:70 author:
71 name: k33g71 name: k33g
72 email: ph.charriere@gmail.com72 email: ph.charriere@gmail.com
73 createdAt: 2026-11-11T00:26:53.000Z73 createdAt: 2026-11-11T00:26:53.000Z
74+ updatedAt: 2026-11-14T05:24:28.000Z
75+ closedAt: 2026-11-14T05:24:28.000Z
74 - id: 576 - id: 5
75 title: "./local-ci-02-build.sh : paquets macOS signés et notarisés, Windows, SHA256SUMS (kDrive en pause)"77 title: "./local-ci-02-build.sh : paquets macOS signés et notarisés, Windows, SHA256SUMS (kDrive en pause)"
76- state: open78+ state: closed
77 priority: high79 priority: high
78 author:80 author:
79 name: k33g81 name: k33g
80 email: ph.charriere@gmail.com82 email: ph.charriere@gmail.com
81 createdAt: 2026-11-11T00:26:53.000Z83 createdAt: 2026-11-11T00:26:53.000Z
84+ updatedAt: 2026-11-14T05:24:28.000Z
85+ closedAt: 2026-11-14T05:24:28.000Z
82 - id: 686 - id: 6
83 title: "Essayer le .dmg sur un autre Mac ou un autre compte"87 title: "Essayer le .dmg sur un autre Mac ou un autre compte"
84- state: open88+ state: closed
85 priority: medium89 priority: medium
86 author:90 author:
87 name: k33g91 name: k33g
88 email: ph.charriere@gmail.com92 email: ph.charriere@gmail.com
89 createdAt: 2026-11-11T00:26:53.000Z93 createdAt: 2026-11-11T00:26:53.000Z
94+ updatedAt: 2026-11-14T05:24:28.000Z
95+ closedAt: 2026-11-14T05:24:28.000Z
90 - id: 796 - id: 7
91 title: "./local-ci-03 à 05 : brouillon, envoi, publication ; vérifier le .dmg téléchargé"97 title: "./local-ci-03 à 05 : brouillon, envoi, publication ; vérifier le .dmg téléchargé"
92- state: open98+ state: closed
93 priority: high99 priority: high
94 author:100 author:
95 name: k33g101 name: k33g
96 email: ph.charriere@gmail.com102 email: ph.charriere@gmail.com
97 createdAt: 2026-11-11T00:26:53.000Z103 createdAt: 2026-11-11T00:26:53.000Z
104+ updatedAt: 2026-11-14T05:24:28.000Z
105+ closedAt: 2026-11-14T05:24:28.000Z
98 - id: 8106 - id: 8
99 title: "git fetch --tags, fermer la milestone v1.4.0"107 title: "git fetch --tags, fermer la milestone v1.4.0"
100- state: open108+ state: closed
101 priority: low109 priority: low
102 author:110 author:
103 name: k33g111 name: k33g
104 email: ph.charriere@gmail.com112 email: ph.charriere@gmail.com
105 createdAt: 2026-11-11T00:26:53.000Z113 createdAt: 2026-11-11T00:26:53.000Z
106-comments: []114+ updatedAt: 2026-11-14T05:24:28.000Z
115+ closedAt: 2026-11-14T05:24:28.000Z
116+comments:
117+ - id: 1
118+ author:
119+ name: k33g
120+ email: ph.charriere@gmail.com
121+ createdAt: 2026-11-14T05:24:28.000Z
122+ body: |
123+ Version 1.4.0 publiée. Ticket et milestone v1.4.0 · Release fermés ; la suite est dans
124+ [#93 — Publier la version 1.5.0](.tickets/issues/0093-publier-la-version-1-5-0.yaml).
added .tickets/issues/0093-publier-la-version-1-5-0.yaml +106 -0
new file mode 100644
@@ -0,0 +1,106 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 93
3+title: Publier la version 1.5.0
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T05:24:28.000Z
9+updatedAt: 2026-11-14T18:13:47.000Z
10+labels:
11+ - kind::chore
12+ - area::infra
13+milestone: "v1.5.0 · Release"
14+epic: Qualité & Release
15+related:
16+ - 92
17+body: |
18+ Publier Sidekicks 1.5.0 avec ce qui sera fait après la 1.4.0 (liste à compléter) :
19+ - [#94](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml) — assistant de création d'agents mini-me pour les utilisateurs non techniques
20+ - [#95](.tickets/issues/0095-ask-user-de-mini-me-pas-de-zone-de-saisie-dans-s.yaml) — `ask_user` de mini-me : zone de saisie dans la conversation
21+ - [#96](.tickets/issues/0096-assistant-create-a-sbx-agent-claude-gemini-codex.yaml) — assistant « Create a sbx agent » (Claude, Gemini, Codex)
22+
23+ Même déroulé que [#92 — Publier la version 1.4.0](.tickets/issues/0092-publier-la-version-1-4-0.yaml), en suivant
24+ [RELEASING.fr.md](RELEASING.fr.md) (scripts `local-ci-*.sh`), **kDrive en pause** pendant la construction.
25+
26+ ## Critères d'acceptation
27+ - `info.version` vaut `1.5.0`, les fichiers de build sont régénérés et `LSMinimumSystemVersion` vaut `13.0.0`.
28+ - `docs/release-notes/v1.5.0.md` et `v1.5.0.fr.md` décrivent les nouveautés ; le README annonce la 1.5.0.
29+ - `make verify` vert, tout commité et poussé sur `main`.
30+ - `.dmg` et `.zip` macOS signés, notarisés, agrafés (`spctl` : `accepted` · `Notarized Developer ID`) ; `SHA256SUMS` recalculé.
31+ - Tag `v1.5.0`, release publiée avec ses 7 fichiers, `.dmg` téléchargé conforme à `SHA256SUMS` et ouvert sans « Ouvrir quand même ».
32+ - `git fetch --tags` fait en local, milestone v1.5.0 fermée.
33+tasks:
34+ - id: 1
35+ title: "Fixer la version 1.5.0, régénérer les fichiers de build (LSMinimumSystemVersion 13.0.0), README"
36+ state: open
37+ priority: high
38+ author:
39+ name: k33g
40+ email: ph.charriere@gmail.com
41+ createdAt: 2026-11-14T05:24:28.000Z
42+ - id: 2
43+ title: "Écrire les notes de release v1.5.0 (EN + FR)"
44+ state: open
45+ priority: high
46+ author:
47+ name: k33g
48+ email: ph.charriere@gmail.com
49+ createdAt: 2026-11-14T05:24:28.000Z
50+ - id: 3
51+ title: "Vérifier la documentation des nouveautés (EN + FR) et les liens des notes de release"
52+ state: open
53+ priority: high
54+ author:
55+ name: k33g
56+ email: ph.charriere@gmail.com
57+ createdAt: 2026-11-14T05:24:28.000Z
58+ - id: 4
59+ title: "make verify, commit, fusion et push sur main ; TAG=\"v1.5.0\" dans .release.env"
60+ state: open
61+ priority: high
62+ author:
63+ name: k33g
64+ email: ph.charriere@gmail.com
65+ createdAt: 2026-11-14T05:24:28.000Z
66+ - id: 5
67+ title: "./local-ci-02-build.sh : paquets macOS signés et notarisés, Windows, SHA256SUMS (kDrive en pause)"
68+ state: open
69+ priority: high
70+ author:
71+ name: k33g
72+ email: ph.charriere@gmail.com
73+ createdAt: 2026-11-14T05:24:28.000Z
74+ - id: 6
75+ title: "Essayer le .dmg sur un autre Mac ou un autre compte"
76+ state: open
77+ priority: medium
78+ author:
79+ name: k33g
80+ email: ph.charriere@gmail.com
81+ createdAt: 2026-11-14T05:24:28.000Z
82+ - id: 7
83+ title: "./local-ci-03 à 05 : brouillon, envoi, publication ; vérifier le .dmg téléchargé"
84+ state: open
85+ priority: high
86+ author:
87+ name: k33g
88+ email: ph.charriere@gmail.com
89+ createdAt: 2026-11-14T05:24:28.000Z
90+ - id: 8
91+ title: "git fetch --tags, fermer la milestone v1.5.0"
92+ state: open
93+ priority: low
94+ author:
95+ name: k33g
96+ email: ph.charriere@gmail.com
97+ createdAt: 2026-11-14T05:24:28.000Z
98+comments:
99+ - id: 1
100+ author:
101+ name: k33g
102+ email: ph.charriere@gmail.com
103+ createdAt: 2026-11-14T17:49:05.000Z
104+ body: |
105+ Premier jet des notes de release v1.5.0 (EN + FR) écrit avec #94 et #95 : `docs/release-notes/v1.5.0.md`
106+ et `v1.5.0.fr.md`. À compléter si d'autres tickets entrent dans la 1.5.0 ; tâche 2 laissée ouverte.
new file mode 100644
@@ -0,0 +1,106 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 93
3+title: Publier la version 1.5.0
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T05:24:28.000Z
9+updatedAt: 2026-11-14T18:13:47.000Z
10+labels:
11+ - kind::chore
12+ - area::infra
13+milestone: "v1.5.0 · Release"
14+epic: Qualité & Release
15+related:
16+ - 92
17+body: |
18+ Publier Sidekicks 1.5.0 avec ce qui sera fait après la 1.4.0 (liste à compléter) :
19+ - [#94](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml) — assistant de création d'agents mini-me pour les utilisateurs non techniques
20+ - [#95](.tickets/issues/0095-ask-user-de-mini-me-pas-de-zone-de-saisie-dans-s.yaml) — `ask_user` de mini-me : zone de saisie dans la conversation
21+ - [#96](.tickets/issues/0096-assistant-create-a-sbx-agent-claude-gemini-codex.yaml) — assistant « Create a sbx agent » (Claude, Gemini, Codex)
22+
23+ Même déroulé que [#92 — Publier la version 1.4.0](.tickets/issues/0092-publier-la-version-1-4-0.yaml), en suivant
24+ [RELEASING.fr.md](RELEASING.fr.md) (scripts `local-ci-*.sh`), **kDrive en pause** pendant la construction.
25+
26+ ## Critères d'acceptation
27+ - `info.version` vaut `1.5.0`, les fichiers de build sont régénérés et `LSMinimumSystemVersion` vaut `13.0.0`.
28+ - `docs/release-notes/v1.5.0.md` et `v1.5.0.fr.md` décrivent les nouveautés ; le README annonce la 1.5.0.
29+ - `make verify` vert, tout commité et poussé sur `main`.
30+ - `.dmg` et `.zip` macOS signés, notarisés, agrafés (`spctl` : `accepted` · `Notarized Developer ID`) ; `SHA256SUMS` recalculé.
31+ - Tag `v1.5.0`, release publiée avec ses 7 fichiers, `.dmg` téléchargé conforme à `SHA256SUMS` et ouvert sans « Ouvrir quand même ».
32+ - `git fetch --tags` fait en local, milestone v1.5.0 fermée.
33+tasks:
34+ - id: 1
35+ title: "Fixer la version 1.5.0, régénérer les fichiers de build (LSMinimumSystemVersion 13.0.0), README"
36+ state: open
37+ priority: high
38+ author:
39+ name: k33g
40+ email: ph.charriere@gmail.com
41+ createdAt: 2026-11-14T05:24:28.000Z
42+ - id: 2
43+ title: "Écrire les notes de release v1.5.0 (EN + FR)"
44+ state: open
45+ priority: high
46+ author:
47+ name: k33g
48+ email: ph.charriere@gmail.com
49+ createdAt: 2026-11-14T05:24:28.000Z
50+ - id: 3
51+ title: "Vérifier la documentation des nouveautés (EN + FR) et les liens des notes de release"
52+ state: open
53+ priority: high
54+ author:
55+ name: k33g
56+ email: ph.charriere@gmail.com
57+ createdAt: 2026-11-14T05:24:28.000Z
58+ - id: 4
59+ title: "make verify, commit, fusion et push sur main ; TAG=\"v1.5.0\" dans .release.env"
60+ state: open
61+ priority: high
62+ author:
63+ name: k33g
64+ email: ph.charriere@gmail.com
65+ createdAt: 2026-11-14T05:24:28.000Z
66+ - id: 5
67+ title: "./local-ci-02-build.sh : paquets macOS signés et notarisés, Windows, SHA256SUMS (kDrive en pause)"
68+ state: open
69+ priority: high
70+ author:
71+ name: k33g
72+ email: ph.charriere@gmail.com
73+ createdAt: 2026-11-14T05:24:28.000Z
74+ - id: 6
75+ title: "Essayer le .dmg sur un autre Mac ou un autre compte"
76+ state: open
77+ priority: medium
78+ author:
79+ name: k33g
80+ email: ph.charriere@gmail.com
81+ createdAt: 2026-11-14T05:24:28.000Z
82+ - id: 7
83+ title: "./local-ci-03 à 05 : brouillon, envoi, publication ; vérifier le .dmg téléchargé"
84+ state: open
85+ priority: high
86+ author:
87+ name: k33g
88+ email: ph.charriere@gmail.com
89+ createdAt: 2026-11-14T05:24:28.000Z
90+ - id: 8
91+ title: "git fetch --tags, fermer la milestone v1.5.0"
92+ state: open
93+ priority: low
94+ author:
95+ name: k33g
96+ email: ph.charriere@gmail.com
97+ createdAt: 2026-11-14T05:24:28.000Z
98+comments:
99+ - id: 1
100+ author:
101+ name: k33g
102+ email: ph.charriere@gmail.com
103+ createdAt: 2026-11-14T17:49:05.000Z
104+ body: |
105+ Premier jet des notes de release v1.5.0 (EN + FR) écrit avec #94 et #95 : `docs/release-notes/v1.5.0.md`
106+ et `v1.5.0.fr.md`. À compléter si d'autres tickets entrent dans la 1.5.0 ; tâche 2 laissée ouverte.
added .tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml +195 -0
new file mode 100644
@@ -0,0 +1,195 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 94
3+title: "Assistant de création d'agents mini-me pour les utilisateurs non techniques"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T16:32:06.000Z
9+updatedAt: 2026-11-14T17:49:05.000Z
10+labels:
11+ - kind::feature
12+ - area::ui
13+ - area::acp
14+ - citizen-ux
15+ - real-agents
16+ - size::L
17+milestone: "v1.5.0 · Release"
18+epic: Agents
19+body: |
20+ Un nouvel assistant pour **créer** un agent mini-me depuis Sidekicks, pensé pour des utilisateurs non techniques :
21+ aucun fichier à éditer, aucun dossier à choisir, tout se fait par des questions simples. Une fois l'agent créé, il est
22+ ajouté à la liste des agents. Pour le moment, l'assistant ne concerne que mini-me.
23+
24+ ## Principe
25+ - **Un agent = un dossier.** Par défaut, les dossiers des agents sont créés dans le dossier **Documents** de l'OS hôte ;
26+ l'emplacement pourra être changé dans le fichier des settings.
27+ - **Sidekicks est un client ACP de mini-me**, lancé avec **`mm --acp-create --project yes`** (mini-me ≥ **1.0.9**), qui sert le
28+ wizard de `mm init`. Le wizard s'affiche dans Sidekicks avec les possibilités standard du protocole ACP :
29+ Sidekicks annonce la capacité `elicitation.form` et affiche les formulaires `elicitation/create` (défauts
30+ pré-remplis), les messages de l'agent, les commandes disponibles ; sans formulaire, repli sur les questions
31+ numérotées en messages.
32+ - La création démarre avec la commande ACP **`/start`**.
33+ - **Nom du dossier = nom de l'agent**, donné vers la fin du wizard. Le dossier est créé sous le dossier parent des
34+ agents (Documents par défaut). L'utilisateur peut aussi **choisir un emoji** pour l'agent (champ `icon` de la
35+ configuration Sidekicks).
36+ - **Mode `.mm` imposé** : Sidekicks passe `--project yes`, la question « Keep everything in a .mm folder? » n'est donc
37+ pas posée et l'agent est toujours écrit dans `<dossier de l'agent>/.mm/agent.yaml`. (`--project` seul ne suffit
38+ pas : c'est un flag texte qui attend `yes` ou `no`.)
39+ - Une fois l'agent écrit, Sidekicks demande **où il s'exécute** :
40+ - **localement** → l'agent est ajouté directement ;
41+ - **dans docker compose** → Sidekicks envoie `/dockerinit` (écrit `Dockerfile` et `compose.yaml`), puis ajoute l'agent ;
42+ - **dans sbx** → Sidekicks envoie `/sbxinit` (écrit `sbxenv.yaml`), puis ajoute l'agent.
43+ - L'ajout réutilise ce que fait déjà l'assistant d'ajout d'agents (remplissage depuis un `compose.yaml` / `sbxenv.yaml` /
44+ configuration d'agent), sans que l'utilisateur ait à déposer ou choisir un fichier.
45+
46+ ## Références mini-me
47+ - [Create an agent from your editor](../mini-me/docs/en/how-to/create-an-agent-from-an-editor.md) (dépôt mini-me)
48+ - CLI : `mm acp-create`, flags de `mm init` (`--project yes` impose le mode .mm), `/dockerinit`, `/sbxinit`.
49+
50+ ## Messages d'erreur (simples, pour un utilisateur non technique)
51+ - `mm` absent ou version < 1.0.9 : dire quoi installer / mettre à jour ; rien n'est créé.
52+ - Aucun serveur de modèles ne tourne (le wizard liste ses modèles) : dire lequel lancer.
53+ - Un dossier du même nom existe déjà : proposer un autre nom.
54+
55+ ## Dossier temporaire (si besoin)
56+ - mm acp-create écrit dans le `cwd` fixé au `session/new`, avant que le nom de l'agent soit connu. Si c'est
57+ nécessaire, la session travaille dans un dossier temporaire, renommé au nom de l'agent avant `/dockerinit` /
58+ `/sbxinit` (les chemins de `.mm/agent.yaml` sont relatifs au projet) — à vérifier sur un vrai mm 1.0.9.
59+
60+ ## Critères d'acceptation
61+ - Un utilisateur crée un agent mini-me sans éditer de fichier ni choisir de dossier ; le dossier porte le nom de
62+ l'agent et est créé dans Documents (ou l'emplacement des settings) ; l'emoji choisi apparaît dans la liste.
63+ - L'agent est toujours écrit en mode `.mm` (`.mm/agent.yaml`), sans que la question soit posée.
64+ - Les trois modes (local, docker compose, sbx) produisent un agent qui apparaît dans la liste et démarre.
65+ - Les trois messages d'erreur ci-dessus sont affichés dans les cas correspondants.
66+ - Tests unitaires de la logique (hors API Wails), doc EN + FR (how-to + référence du réglage).
67+tasks:
68+ - id: 1
69+ title: "Réglage du dossier parent des agents (défaut : Documents de l'OS hôte)"
70+ state: closed
71+ priority: high
72+ author:
73+ name: k33g
74+ email: ph.charriere@gmail.com
75+ createdAt: 2026-11-14T16:32:06.000Z
76+ updatedAt: 2026-11-14T17:04:26.000Z
77+ closedAt: 2026-11-14T17:04:26.000Z
78+ - id: 2
79+ title: "Détecter mm et sa version (>= 1.0.9), message clair sinon"
80+ state: closed
81+ priority: high
82+ author:
83+ name: k33g
84+ email: ph.charriere@gmail.com
85+ createdAt: 2026-11-14T16:32:06.000Z
86+ updatedAt: 2026-11-14T17:04:26.000Z
87+ closedAt: 2026-11-14T17:04:26.000Z
88+ - id: 3
89+ title: "Client ACP de mm --acp-create : /start, formulaires elicitation/create, messages et commandes ; repli en questions numérotées"
90+ state: closed
91+ priority: high
92+ author:
93+ name: k33g
94+ email: ph.charriere@gmail.com
95+ createdAt: 2026-11-14T16:32:06.000Z
96+ updatedAt: 2026-11-14T17:04:26.000Z
97+ closedAt: 2026-11-14T17:04:26.000Z
98+ - id: 4
99+ title: "Mode .mm imposé (--project yes) ; dossier = nom de l'agent (dossier temporaire si besoin), choix d'un emoji (icon)"
100+ state: closed
101+ priority: medium
102+ author:
103+ name: k33g
104+ email: ph.charriere@gmail.com
105+ createdAt: 2026-11-14T16:32:06.000Z
106+ updatedAt: 2026-11-14T17:04:26.000Z
107+ closedAt: 2026-11-14T17:04:26.000Z
108+ - id: 5
109+ title: "Après l'écriture : choix local / docker compose / sbx ; envoyer /dockerinit ou /sbxinit selon le choix"
110+ state: closed
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-14T16:32:06.000Z
116+ updatedAt: 2026-11-14T17:04:26.000Z
117+ closedAt: 2026-11-14T17:04:26.000Z
118+ - id: 6
119+ title: "Ajouter l'agent à la liste à partir des fichiers générés"
120+ state: closed
121+ priority: high
122+ author:
123+ name: k33g
124+ email: ph.charriere@gmail.com
125+ createdAt: 2026-11-14T16:32:06.000Z
126+ updatedAt: 2026-11-14T17:04:26.000Z
127+ closedAt: 2026-11-14T17:04:26.000Z
128+ - id: 7
129+ title: "Tests unitaires, essai avec un vrai mm 1.0.9 (local, compose, sbx)"
130+ state: closed
131+ priority: high
132+ author:
133+ name: k33g
134+ email: ph.charriere@gmail.com
135+ createdAt: 2026-11-14T16:32:06.000Z
136+ updatedAt: 2026-11-14T17:49:05.000Z
137+ closedAt: 2026-11-14T17:49:05.000Z
138+ - id: 8
139+ title: "Documentation EN + FR (how-to, référence du réglage), notes de release v1.5.0"
140+ state: closed
141+ priority: medium
142+ author:
143+ name: k33g
144+ email: ph.charriere@gmail.com
145+ createdAt: 2026-11-14T16:32:06.000Z
146+ updatedAt: 2026-11-14T17:49:05.000Z
147+ closedAt: 2026-11-14T17:49:05.000Z
148+comments:
149+ - id: 1
150+ author:
151+ name: k33g
152+ email: ph.charriere@gmail.com
153+ createdAt: 2026-11-14T17:04:26.000Z
154+ body: |
155+ Implémenté sur la branche `feature/94-mini-me-creator` (pas poussée).
156+
157+ - Client ACP : formulaires d'élicitation (`internal/acp/forms.go`, `Spec.OnForm`, capacité
158+ `elicitation.form` annoncée seulement si quelqu'un répond).
159+ - `internal/creator` : `mm --acp-create --project yes --output .mm/agent.yaml` dans un dossier temporaire
160+ `<agentsFolder>/.sidekicks-new-agent-…`, renommé au nom de l'agent par `Finish` ; `/dockerinit` ou `/sbxinit`
161+ dans un mm relancé dans le dossier final ; version ≥ 1.0.9 vérifiée (`mm --version`).
162+ - `CreatorService` (Start, Answer, Send, Finish, Cancel) ; l'agent est ajouté avec `mm --acp --config
163+ <dossier>/.mm/agent.yaml`, en local, `docker exec -i` ou `sbx exec -i` avec les commandes de cycle de vie du
164+ `compose.yaml` / `sbxenv.yaml`.
165+ - Réglage `agentsFolder` (défaut `~/Documents`).
166+ - Page « Créer un agent mini-me » : formulaires, ← Question précédente (/back), Recommencer (/restart),
167+ dernière étape nom + emoji + local / conteneur / sbx ; messages d'erreur mm absent, trop ancien, pas de
168+ serveur de modèles, nom ou dossier déjà pris.
169+ - Correctif : les commandes de cycle de vie reçoivent `PWD=<dossier>` (le `compose.yaml` de mm monte `${PWD}`).
170+
171+ Vérifié : tests Go + vitest, `make lint-go`, svelte-check ; vrai mm 1.0.9 (compilé depuis mini-me) dans les
172+ trois modes (`go test -tags realagents ./internal/creator`) ; l'application sous Xvfb : création d'un agent
173+ local de bout en bout avec le llmman de l'hôte, Annuler, mm absent, mm 1.0.8.
174+
175+ Reste : tâche 7 — démarrer pour de vrai un agent créé en conteneur et en sbx (sur le Mac) ; tâche 8 — les
176+ notes de release v1.5.0 (avec #93). Doc EN + FR faite.
177+ - id: 2
178+ author:
179+ name: k33g
180+ email: ph.charriere@gmail.com
181+ createdAt: 2026-11-14T17:46:14.000Z
182+ body: |
183+ Conteneur vérifié sur le Mac par l'owner avec le `mm` de la branche `feature/dockerinit-account` de mini-me :
184+ prompt `mm@…` dans le terminal, fichiers créés par l'agent à l'utilisateur. Une nouvelle release de mini-me
185+ embarque la correction. Reste pour la tâche 7 : un agent créé en sandbox sbx, démarré depuis Sidekicks.
186+ - id: 3
187+ author:
188+ name: k33g
189+ email: ph.charriere@gmail.com
190+ createdAt: 2026-11-14T17:49:05.000Z
191+ body: |
192+ Tâches 7 et 8 closes à la demande de l'owner (le test d'un agent sbx démarré depuis Sidekicks n'a pas été fait).
193+ Doc : guide « Créer un agent mini-me » complété (« I have no name! » dans le terminal d'un conteneur : mettre
194+ mini-me à jour, `mm dockerinit`, `docker compose up -d --build`) ; notes de release v1.5.0 EN + FR
195+ (`docs/release-notes/v1.5.0.md`, `.fr.md`) avec #94 et #95. Ticket fermé.
new file mode 100644
@@ -0,0 +1,195 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 94
3+title: "Assistant de création d'agents mini-me pour les utilisateurs non techniques"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T16:32:06.000Z
9+updatedAt: 2026-11-14T17:49:05.000Z
10+labels:
11+ - kind::feature
12+ - area::ui
13+ - area::acp
14+ - citizen-ux
15+ - real-agents
16+ - size::L
17+milestone: "v1.5.0 · Release"
18+epic: Agents
19+body: |
20+ Un nouvel assistant pour **créer** un agent mini-me depuis Sidekicks, pensé pour des utilisateurs non techniques :
21+ aucun fichier à éditer, aucun dossier à choisir, tout se fait par des questions simples. Une fois l'agent créé, il est
22+ ajouté à la liste des agents. Pour le moment, l'assistant ne concerne que mini-me.
23+
24+ ## Principe
25+ - **Un agent = un dossier.** Par défaut, les dossiers des agents sont créés dans le dossier **Documents** de l'OS hôte ;
26+ l'emplacement pourra être changé dans le fichier des settings.
27+ - **Sidekicks est un client ACP de mini-me**, lancé avec **`mm --acp-create --project yes`** (mini-me ≥ **1.0.9**), qui sert le
28+ wizard de `mm init`. Le wizard s'affiche dans Sidekicks avec les possibilités standard du protocole ACP :
29+ Sidekicks annonce la capacité `elicitation.form` et affiche les formulaires `elicitation/create` (défauts
30+ pré-remplis), les messages de l'agent, les commandes disponibles ; sans formulaire, repli sur les questions
31+ numérotées en messages.
32+ - La création démarre avec la commande ACP **`/start`**.
33+ - **Nom du dossier = nom de l'agent**, donné vers la fin du wizard. Le dossier est créé sous le dossier parent des
34+ agents (Documents par défaut). L'utilisateur peut aussi **choisir un emoji** pour l'agent (champ `icon` de la
35+ configuration Sidekicks).
36+ - **Mode `.mm` imposé** : Sidekicks passe `--project yes`, la question « Keep everything in a .mm folder? » n'est donc
37+ pas posée et l'agent est toujours écrit dans `<dossier de l'agent>/.mm/agent.yaml`. (`--project` seul ne suffit
38+ pas : c'est un flag texte qui attend `yes` ou `no`.)
39+ - Une fois l'agent écrit, Sidekicks demande **où il s'exécute** :
40+ - **localement** → l'agent est ajouté directement ;
41+ - **dans docker compose** → Sidekicks envoie `/dockerinit` (écrit `Dockerfile` et `compose.yaml`), puis ajoute l'agent ;
42+ - **dans sbx** → Sidekicks envoie `/sbxinit` (écrit `sbxenv.yaml`), puis ajoute l'agent.
43+ - L'ajout réutilise ce que fait déjà l'assistant d'ajout d'agents (remplissage depuis un `compose.yaml` / `sbxenv.yaml` /
44+ configuration d'agent), sans que l'utilisateur ait à déposer ou choisir un fichier.
45+
46+ ## Références mini-me
47+ - [Create an agent from your editor](../mini-me/docs/en/how-to/create-an-agent-from-an-editor.md) (dépôt mini-me)
48+ - CLI : `mm acp-create`, flags de `mm init` (`--project yes` impose le mode .mm), `/dockerinit`, `/sbxinit`.
49+
50+ ## Messages d'erreur (simples, pour un utilisateur non technique)
51+ - `mm` absent ou version < 1.0.9 : dire quoi installer / mettre à jour ; rien n'est créé.
52+ - Aucun serveur de modèles ne tourne (le wizard liste ses modèles) : dire lequel lancer.
53+ - Un dossier du même nom existe déjà : proposer un autre nom.
54+
55+ ## Dossier temporaire (si besoin)
56+ - mm acp-create écrit dans le `cwd` fixé au `session/new`, avant que le nom de l'agent soit connu. Si c'est
57+ nécessaire, la session travaille dans un dossier temporaire, renommé au nom de l'agent avant `/dockerinit` /
58+ `/sbxinit` (les chemins de `.mm/agent.yaml` sont relatifs au projet) — à vérifier sur un vrai mm 1.0.9.
59+
60+ ## Critères d'acceptation
61+ - Un utilisateur crée un agent mini-me sans éditer de fichier ni choisir de dossier ; le dossier porte le nom de
62+ l'agent et est créé dans Documents (ou l'emplacement des settings) ; l'emoji choisi apparaît dans la liste.
63+ - L'agent est toujours écrit en mode `.mm` (`.mm/agent.yaml`), sans que la question soit posée.
64+ - Les trois modes (local, docker compose, sbx) produisent un agent qui apparaît dans la liste et démarre.
65+ - Les trois messages d'erreur ci-dessus sont affichés dans les cas correspondants.
66+ - Tests unitaires de la logique (hors API Wails), doc EN + FR (how-to + référence du réglage).
67+tasks:
68+ - id: 1
69+ title: "Réglage du dossier parent des agents (défaut : Documents de l'OS hôte)"
70+ state: closed
71+ priority: high
72+ author:
73+ name: k33g
74+ email: ph.charriere@gmail.com
75+ createdAt: 2026-11-14T16:32:06.000Z
76+ updatedAt: 2026-11-14T17:04:26.000Z
77+ closedAt: 2026-11-14T17:04:26.000Z
78+ - id: 2
79+ title: "Détecter mm et sa version (>= 1.0.9), message clair sinon"
80+ state: closed
81+ priority: high
82+ author:
83+ name: k33g
84+ email: ph.charriere@gmail.com
85+ createdAt: 2026-11-14T16:32:06.000Z
86+ updatedAt: 2026-11-14T17:04:26.000Z
87+ closedAt: 2026-11-14T17:04:26.000Z
88+ - id: 3
89+ title: "Client ACP de mm --acp-create : /start, formulaires elicitation/create, messages et commandes ; repli en questions numérotées"
90+ state: closed
91+ priority: high
92+ author:
93+ name: k33g
94+ email: ph.charriere@gmail.com
95+ createdAt: 2026-11-14T16:32:06.000Z
96+ updatedAt: 2026-11-14T17:04:26.000Z
97+ closedAt: 2026-11-14T17:04:26.000Z
98+ - id: 4
99+ title: "Mode .mm imposé (--project yes) ; dossier = nom de l'agent (dossier temporaire si besoin), choix d'un emoji (icon)"
100+ state: closed
101+ priority: medium
102+ author:
103+ name: k33g
104+ email: ph.charriere@gmail.com
105+ createdAt: 2026-11-14T16:32:06.000Z
106+ updatedAt: 2026-11-14T17:04:26.000Z
107+ closedAt: 2026-11-14T17:04:26.000Z
108+ - id: 5
109+ title: "Après l'écriture : choix local / docker compose / sbx ; envoyer /dockerinit ou /sbxinit selon le choix"
110+ state: closed
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-14T16:32:06.000Z
116+ updatedAt: 2026-11-14T17:04:26.000Z
117+ closedAt: 2026-11-14T17:04:26.000Z
118+ - id: 6
119+ title: "Ajouter l'agent à la liste à partir des fichiers générés"
120+ state: closed
121+ priority: high
122+ author:
123+ name: k33g
124+ email: ph.charriere@gmail.com
125+ createdAt: 2026-11-14T16:32:06.000Z
126+ updatedAt: 2026-11-14T17:04:26.000Z
127+ closedAt: 2026-11-14T17:04:26.000Z
128+ - id: 7
129+ title: "Tests unitaires, essai avec un vrai mm 1.0.9 (local, compose, sbx)"
130+ state: closed
131+ priority: high
132+ author:
133+ name: k33g
134+ email: ph.charriere@gmail.com
135+ createdAt: 2026-11-14T16:32:06.000Z
136+ updatedAt: 2026-11-14T17:49:05.000Z
137+ closedAt: 2026-11-14T17:49:05.000Z
138+ - id: 8
139+ title: "Documentation EN + FR (how-to, référence du réglage), notes de release v1.5.0"
140+ state: closed
141+ priority: medium
142+ author:
143+ name: k33g
144+ email: ph.charriere@gmail.com
145+ createdAt: 2026-11-14T16:32:06.000Z
146+ updatedAt: 2026-11-14T17:49:05.000Z
147+ closedAt: 2026-11-14T17:49:05.000Z
148+comments:
149+ - id: 1
150+ author:
151+ name: k33g
152+ email: ph.charriere@gmail.com
153+ createdAt: 2026-11-14T17:04:26.000Z
154+ body: |
155+ Implémenté sur la branche `feature/94-mini-me-creator` (pas poussée).
156+
157+ - Client ACP : formulaires d'élicitation (`internal/acp/forms.go`, `Spec.OnForm`, capacité
158+ `elicitation.form` annoncée seulement si quelqu'un répond).
159+ - `internal/creator` : `mm --acp-create --project yes --output .mm/agent.yaml` dans un dossier temporaire
160+ `<agentsFolder>/.sidekicks-new-agent-…`, renommé au nom de l'agent par `Finish` ; `/dockerinit` ou `/sbxinit`
161+ dans un mm relancé dans le dossier final ; version ≥ 1.0.9 vérifiée (`mm --version`).
162+ - `CreatorService` (Start, Answer, Send, Finish, Cancel) ; l'agent est ajouté avec `mm --acp --config
163+ <dossier>/.mm/agent.yaml`, en local, `docker exec -i` ou `sbx exec -i` avec les commandes de cycle de vie du
164+ `compose.yaml` / `sbxenv.yaml`.
165+ - Réglage `agentsFolder` (défaut `~/Documents`).
166+ - Page « Créer un agent mini-me » : formulaires, ← Question précédente (/back), Recommencer (/restart),
167+ dernière étape nom + emoji + local / conteneur / sbx ; messages d'erreur mm absent, trop ancien, pas de
168+ serveur de modèles, nom ou dossier déjà pris.
169+ - Correctif : les commandes de cycle de vie reçoivent `PWD=<dossier>` (le `compose.yaml` de mm monte `${PWD}`).
170+
171+ Vérifié : tests Go + vitest, `make lint-go`, svelte-check ; vrai mm 1.0.9 (compilé depuis mini-me) dans les
172+ trois modes (`go test -tags realagents ./internal/creator`) ; l'application sous Xvfb : création d'un agent
173+ local de bout en bout avec le llmman de l'hôte, Annuler, mm absent, mm 1.0.8.
174+
175+ Reste : tâche 7 — démarrer pour de vrai un agent créé en conteneur et en sbx (sur le Mac) ; tâche 8 — les
176+ notes de release v1.5.0 (avec #93). Doc EN + FR faite.
177+ - id: 2
178+ author:
179+ name: k33g
180+ email: ph.charriere@gmail.com
181+ createdAt: 2026-11-14T17:46:14.000Z
182+ body: |
183+ Conteneur vérifié sur le Mac par l'owner avec le `mm` de la branche `feature/dockerinit-account` de mini-me :
184+ prompt `mm@…` dans le terminal, fichiers créés par l'agent à l'utilisateur. Une nouvelle release de mini-me
185+ embarque la correction. Reste pour la tâche 7 : un agent créé en sandbox sbx, démarré depuis Sidekicks.
186+ - id: 3
187+ author:
188+ name: k33g
189+ email: ph.charriere@gmail.com
190+ createdAt: 2026-11-14T17:49:05.000Z
191+ body: |
192+ Tâches 7 et 8 closes à la demande de l'owner (le test d'un agent sbx démarré depuis Sidekicks n'a pas été fait).
193+ Doc : guide « Créer un agent mini-me » complété (« I have no name! » dans le terminal d'un conteneur : mettre
194+ mini-me à jour, `mm dockerinit`, `docker compose up -d --build`) ; notes de release v1.5.0 EN + FR
195+ (`docs/release-notes/v1.5.0.md`, `.fr.md`) avec #94 et #95. Ticket fermé.
added .tickets/issues/0095-ask-user-de-mini-me-pas-de-zone-de-saisie-dans-s.yaml +140 -0
new file mode 100644
@@ -0,0 +1,140 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 95
3+title: "ask_user de mini-me : pas de zone de saisie dans Sidekicks"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T17:21:25.000Z
9+updatedAt: 2026-11-14T17:37:28.000Z
10+labels:
11+ - kind::bug
12+ - area::acp
13+ - area::ui
14+ - citizen-ux
15+ - real-agents
16+milestone: "v1.5.0 · Release"
17+epic: Client ACP
18+related:
19+ - 94
20+body: |
21+ Constat (owner) : quand un agent mini-me appelle son outil `ask_user` et attend une réponse, Sidekicks ne
22+ propose pas de zone de saisie.
23+
24+ ## Cause (lue dans le code de mini-me, `internal/acp/elicit.go`)
25+ mm pose les questions d'`ask_user` de la meilleure façon que le client permet :
26+ 1. le client a annoncé `clientCapabilities.elicitation.form` à l'`initialize` → tout le formulaire part en une
27+ requête `elicitation/create` (texte libre, choix, plusieurs choix, oui/non) ;
28+ 2. sinon, si toutes les questions sont des choix ou des oui/non → une boîte `session/request_permission` par
29+ question, dont les boutons sont les options (Sidekicks l'affiche comme une carte de permission) ;
30+ 3. sinon (texte libre, plusieurs choix) → personne ne peut répondre : l'outil répond « indisponible » au modèle.
31+
32+ Sidekicks n'annonce `elicitation.form` que pour l'assistant de création ([#94](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml),
33+ `Spec.OnForm`), pas pour les agents des conversations : une question à réponse libre tombe donc dans le cas 3, sans
34+ zone de saisie, et un choix multiple aussi.
35+
36+ ## Proposition
37+ - Donner un `OnForm` aux agents des conversations (`internal/agents` → `acp.Spec`) : la capacité est alors annoncée
38+ et mm envoie ses formulaires.
39+ - Afficher le formulaire **dans la conversation**, comme une carte de permission (événements `form:requested` /
40+ `form:resolved`, à la manière de `permission:requested|resolved`) : champs texte, choix, plusieurs choix, oui/non,
41+ boutons Répondre / Refuser. Réutiliser le rendu des champs de `CreateMiniMeAgent.svelte` (`lib/creator.ts`) en
42+ l'extrayant dans un composant commun.
43+ - Stop (■) pendant la question → `cancel` ; changement de channel → la carte reste en attente dans sa conversation.
44+
45+ ## Points à vérifier
46+ - **Routage** : la requête de mm porte la session dans `sessionId` (et `toolCallId`) au niveau de la requête,
47+ mais le type `UnstableCreateElicitationForm` du SDK Go v0.13.5 ne les expose pas. Pistes : un agent ne répond
48+ que dans un channel à la fois (ADR 0006), donc la session dont le tour est en cours ; ou lire le JSON brut.
49+ - Les autres agents ACP (Claude, Codex, Gemini, docker-agent) : annoncer la capacité ne doit rien changer pour eux.
50+ - Un agent qui pose une question à un autre agent (#26, ask_agent côté mm) : à qui va le formulaire.
51+
52+ ## Critères d'acceptation
53+ - Un agent mini-me qui appelle `ask_user` avec une question à réponse libre affiche une zone de saisie dans la
54+ conversation ; la réponse revient au modèle.
55+ - Les choix, plusieurs choix et oui/non passent aussi par le formulaire.
56+ - Refuser ou Stop rend la main au modèle sans bloquer le tour.
57+ - Tests unitaires (faux agent qui envoie un formulaire), essai avec un vrai mm ; doc EN + FR.
58+tasks:
59+ - id: 1
60+ title: "acp : Spec.Forms, routage par session (_meta mm.elicitationScope, sinon le seul tour en cours)"
61+ state: closed
62+ priority: high
63+ author:
64+ name: k33g
65+ email: ph.charriere@gmail.com
66+ createdAt: 2026-11-14T17:30:42.000Z
67+ updatedAt: 2026-11-14T17:30:42.000Z
68+ closedAt: 2026-11-14T17:30:42.000Z
69+ - id: 2
70+ title: "channels : FormRequest, événements form:requested / form:resolved, AnswerForm, annulé par Stop"
71+ state: closed
72+ priority: high
73+ author:
74+ name: k33g
75+ email: ph.charriere@gmail.com
76+ createdAt: 2026-11-14T17:30:42.000Z
77+ updatedAt: 2026-11-14T17:30:42.000Z
78+ closedAt: 2026-11-14T17:30:42.000Z
79+ - id: 3
80+ title: "Interface : carte de formulaire dans la conversation, champs partagés avec l'assistant de création (FormFields)"
81+ state: closed
82+ priority: high
83+ author:
84+ name: k33g
85+ email: ph.charriere@gmail.com
86+ createdAt: 2026-11-14T17:30:42.000Z
87+ updatedAt: 2026-11-14T17:30:42.000Z
88+ closedAt: 2026-11-14T17:30:42.000Z
89+ - id: 4
90+ title: "Tests Go + vitest, essai sous Xvfb avec un faux agent ACP"
91+ state: closed
92+ priority: high
93+ author:
94+ name: k33g
95+ email: ph.charriere@gmail.com
96+ createdAt: 2026-11-14T17:30:42.000Z
97+ updatedAt: 2026-11-14T17:30:42.000Z
98+ closedAt: 2026-11-14T17:30:42.000Z
99+ - id: 5
100+ title: "Doc EN + FR (référence, explication des permissions)"
101+ state: closed
102+ priority: medium
103+ author:
104+ name: k33g
105+ email: ph.charriere@gmail.com
106+ createdAt: 2026-11-14T17:30:42.000Z
107+ updatedAt: 2026-11-14T17:30:42.000Z
108+ closedAt: 2026-11-14T17:30:42.000Z
109+ - id: 6
110+ title: "Essai avec un vrai agent mini-me qui appelle ask_user (sur le Mac)"
111+ state: closed
112+ priority: high
113+ author:
114+ name: k33g
115+ email: ph.charriere@gmail.com
116+ createdAt: 2026-11-14T17:30:42.000Z
117+ updatedAt: 2026-11-14T17:37:28.000Z
118+ closedAt: 2026-11-14T17:37:28.000Z
119+comments:
120+ - id: 1
121+ author:
122+ name: k33g
123+ email: ph.charriere@gmail.com
124+ createdAt: 2026-11-14T17:30:42.000Z
125+ body: |
126+ Implémenté sur la branche `feature/94-mini-me-creator`. Tous les agents des conversations annoncent
127+ `elicitation.form` ; chaque formulaire s'affiche comme une carte sous la réponse (texte, choix, plusieurs choix,
128+ oui/non ; Répondre, Refuser, Arrêter). Routage : la session lue dans `_meta["mm.elicitationScope"]` (mm l'y
129+ recopie parce que le SDK perd `sessionId`), sinon la seule session dont un tour est en cours.
130+
131+ Vérifié : tests Go (acp, channels) et vitest, lint ; sous Xvfb avec un faux agent ACP (Python) qui imite
132+ `ask_user` : texte obligatoire refusé vide, réponse « Lyon » + « coffee » rendue à l'agent, Refuser.
133+ Reste : un vrai mm dont le modèle appelle `ask_user` (tâche 6).
134+ - id: 2
135+ author:
136+ name: k33g
137+ email: ph.charriere@gmail.com
138+ createdAt: 2026-11-14T17:37:28.000Z
139+ body: |
140+ Testé par l'owner avec un vrai agent mini-me : le formulaire d'`ask_user` s'affiche et fonctionne. Ticket fermé.
new file mode 100644
@@ -0,0 +1,140 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 95
3+title: "ask_user de mini-me : pas de zone de saisie dans Sidekicks"
4+state: closed
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T17:21:25.000Z
9+updatedAt: 2026-11-14T17:37:28.000Z
10+labels:
11+ - kind::bug
12+ - area::acp
13+ - area::ui
14+ - citizen-ux
15+ - real-agents
16+milestone: "v1.5.0 · Release"
17+epic: Client ACP
18+related:
19+ - 94
20+body: |
21+ Constat (owner) : quand un agent mini-me appelle son outil `ask_user` et attend une réponse, Sidekicks ne
22+ propose pas de zone de saisie.
23+
24+ ## Cause (lue dans le code de mini-me, `internal/acp/elicit.go`)
25+ mm pose les questions d'`ask_user` de la meilleure façon que le client permet :
26+ 1. le client a annoncé `clientCapabilities.elicitation.form` à l'`initialize` → tout le formulaire part en une
27+ requête `elicitation/create` (texte libre, choix, plusieurs choix, oui/non) ;
28+ 2. sinon, si toutes les questions sont des choix ou des oui/non → une boîte `session/request_permission` par
29+ question, dont les boutons sont les options (Sidekicks l'affiche comme une carte de permission) ;
30+ 3. sinon (texte libre, plusieurs choix) → personne ne peut répondre : l'outil répond « indisponible » au modèle.
31+
32+ Sidekicks n'annonce `elicitation.form` que pour l'assistant de création ([#94](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml),
33+ `Spec.OnForm`), pas pour les agents des conversations : une question à réponse libre tombe donc dans le cas 3, sans
34+ zone de saisie, et un choix multiple aussi.
35+
36+ ## Proposition
37+ - Donner un `OnForm` aux agents des conversations (`internal/agents` → `acp.Spec`) : la capacité est alors annoncée
38+ et mm envoie ses formulaires.
39+ - Afficher le formulaire **dans la conversation**, comme une carte de permission (événements `form:requested` /
40+ `form:resolved`, à la manière de `permission:requested|resolved`) : champs texte, choix, plusieurs choix, oui/non,
41+ boutons Répondre / Refuser. Réutiliser le rendu des champs de `CreateMiniMeAgent.svelte` (`lib/creator.ts`) en
42+ l'extrayant dans un composant commun.
43+ - Stop (■) pendant la question → `cancel` ; changement de channel → la carte reste en attente dans sa conversation.
44+
45+ ## Points à vérifier
46+ - **Routage** : la requête de mm porte la session dans `sessionId` (et `toolCallId`) au niveau de la requête,
47+ mais le type `UnstableCreateElicitationForm` du SDK Go v0.13.5 ne les expose pas. Pistes : un agent ne répond
48+ que dans un channel à la fois (ADR 0006), donc la session dont le tour est en cours ; ou lire le JSON brut.
49+ - Les autres agents ACP (Claude, Codex, Gemini, docker-agent) : annoncer la capacité ne doit rien changer pour eux.
50+ - Un agent qui pose une question à un autre agent (#26, ask_agent côté mm) : à qui va le formulaire.
51+
52+ ## Critères d'acceptation
53+ - Un agent mini-me qui appelle `ask_user` avec une question à réponse libre affiche une zone de saisie dans la
54+ conversation ; la réponse revient au modèle.
55+ - Les choix, plusieurs choix et oui/non passent aussi par le formulaire.
56+ - Refuser ou Stop rend la main au modèle sans bloquer le tour.
57+ - Tests unitaires (faux agent qui envoie un formulaire), essai avec un vrai mm ; doc EN + FR.
58+tasks:
59+ - id: 1
60+ title: "acp : Spec.Forms, routage par session (_meta mm.elicitationScope, sinon le seul tour en cours)"
61+ state: closed
62+ priority: high
63+ author:
64+ name: k33g
65+ email: ph.charriere@gmail.com
66+ createdAt: 2026-11-14T17:30:42.000Z
67+ updatedAt: 2026-11-14T17:30:42.000Z
68+ closedAt: 2026-11-14T17:30:42.000Z
69+ - id: 2
70+ title: "channels : FormRequest, événements form:requested / form:resolved, AnswerForm, annulé par Stop"
71+ state: closed
72+ priority: high
73+ author:
74+ name: k33g
75+ email: ph.charriere@gmail.com
76+ createdAt: 2026-11-14T17:30:42.000Z
77+ updatedAt: 2026-11-14T17:30:42.000Z
78+ closedAt: 2026-11-14T17:30:42.000Z
79+ - id: 3
80+ title: "Interface : carte de formulaire dans la conversation, champs partagés avec l'assistant de création (FormFields)"
81+ state: closed
82+ priority: high
83+ author:
84+ name: k33g
85+ email: ph.charriere@gmail.com
86+ createdAt: 2026-11-14T17:30:42.000Z
87+ updatedAt: 2026-11-14T17:30:42.000Z
88+ closedAt: 2026-11-14T17:30:42.000Z
89+ - id: 4
90+ title: "Tests Go + vitest, essai sous Xvfb avec un faux agent ACP"
91+ state: closed
92+ priority: high
93+ author:
94+ name: k33g
95+ email: ph.charriere@gmail.com
96+ createdAt: 2026-11-14T17:30:42.000Z
97+ updatedAt: 2026-11-14T17:30:42.000Z
98+ closedAt: 2026-11-14T17:30:42.000Z
99+ - id: 5
100+ title: "Doc EN + FR (référence, explication des permissions)"
101+ state: closed
102+ priority: medium
103+ author:
104+ name: k33g
105+ email: ph.charriere@gmail.com
106+ createdAt: 2026-11-14T17:30:42.000Z
107+ updatedAt: 2026-11-14T17:30:42.000Z
108+ closedAt: 2026-11-14T17:30:42.000Z
109+ - id: 6
110+ title: "Essai avec un vrai agent mini-me qui appelle ask_user (sur le Mac)"
111+ state: closed
112+ priority: high
113+ author:
114+ name: k33g
115+ email: ph.charriere@gmail.com
116+ createdAt: 2026-11-14T17:30:42.000Z
117+ updatedAt: 2026-11-14T17:37:28.000Z
118+ closedAt: 2026-11-14T17:37:28.000Z
119+comments:
120+ - id: 1
121+ author:
122+ name: k33g
123+ email: ph.charriere@gmail.com
124+ createdAt: 2026-11-14T17:30:42.000Z
125+ body: |
126+ Implémenté sur la branche `feature/94-mini-me-creator`. Tous les agents des conversations annoncent
127+ `elicitation.form` ; chaque formulaire s'affiche comme une carte sous la réponse (texte, choix, plusieurs choix,
128+ oui/non ; Répondre, Refuser, Arrêter). Routage : la session lue dans `_meta["mm.elicitationScope"]` (mm l'y
129+ recopie parce que le SDK perd `sessionId`), sinon la seule session dont un tour est en cours.
130+
131+ Vérifié : tests Go (acp, channels) et vitest, lint ; sous Xvfb avec un faux agent ACP (Python) qui imite
132+ `ask_user` : texte obligatoire refusé vide, réponse « Lyon » + « coffee » rendue à l'agent, Refuser.
133+ Reste : un vrai mm dont le modèle appelle `ask_user` (tâche 6).
134+ - id: 2
135+ author:
136+ name: k33g
137+ email: ph.charriere@gmail.com
138+ createdAt: 2026-11-14T17:37:28.000Z
139+ body: |
140+ Testé par l'owner avec un vrai agent mini-me : le formulaire d'`ask_user` s'affiche et fonctionne. Ticket fermé.
added .tickets/issues/0096-assistant-create-a-sbx-agent-claude-gemini-codex.yaml +164 -0
new file mode 100644
@@ -0,0 +1,164 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 96
3+title: "Assistant « Create a sbx agent » : Claude, Gemini, Codex dans une Docker Sandbox"
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T18:04:31.000Z
9+updatedAt: 2026-11-14T18:13:47.000Z
10+labels:
11+ - kind::feature
12+ - area::ui
13+ - area::config
14+ - citizen-ux
15+ - size::L
16+milestone: "v1.5.0 · Release"
17+epic: Docker SBX
18+related:
19+ - 94
20+ - 81
21+ - 82
22+ - 84
23+body: |
24+ Un nouvel assistant, sur le modèle de [#94 — Assistant de création d'agents mini-me](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml),
25+ pour créer un agent qui tourne dans une Docker Sandbox (sbx), sans fichier à écrire ni dossier à choisir.
26+
27+ ## Déroulé
28+ 1. Au lancement, l'assistant propose le **type d'agent** : **Claude**, **Gemini** ou **Codex**. D'autres viendront
29+ (Mistral Vibe #86, Docker Agent #87…) : les types sont un **catalogue** (une entrée par type), pas du code en dur
30+ dans l'interface.
31+ 2. L'utilisateur donne le **nom** de l'agent (qui est aussi le nom de son dossier et de sa sandbox) et un **emoji**
32+ (par défaut celui du type : 📙 Claude, 📘 Gemini, 📗 Codex ; titre par défaut : Claude, Gemini, Codex).
33+ 3. Sidekicks crée le dossier de l'agent, écrit son `sbxenv.yaml`, l'ajoute à la configuration et ouvre sa
34+ conversation ; la sandbox est créée au premier démarrage (`runtime.lifecycle.create`).
35+
36+ Comme pour #94, le dossier de l'agent est créé dans **Documents** par défaut, modifiable avec le réglage
37+ `agentsFolder` (déjà en place).
38+
39+ ## Ce que l'assistant écrit
40+ Dossier `<agentsFolder>/<nom>/` :
41+ - `sbxenv.yaml`, d'après les exemples de [tmp/claude-acp/sbxenv.yaml](tmp/claude-acp/sbxenv.yaml),
42+ [tmp/gemini-acp/sbxenv.yaml](tmp/gemini-acp/sbxenv.yaml) et [tmp/codex-acp/sbxenv.yaml](tmp/codex-acp/sbxenv.yaml),
43+ avec `name: <nom>` et `workspace: ./workspace` ;
44+ - `workspace/`, le dossier de travail de l'agent.
45+
46+ | Type | `agent:` | kit | programme lancé | `bindings` |
47+ | --- | --- | --- | --- | --- |
48+ | Claude | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` (apiKey) |
49+ | Gemini | `gemini` | `docker.io/sbx/gemini-kit:latest` | `gemini --acp` | `google` (apiKey, oauth) |
50+ | Codex | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` (apiKey, oauth) |
51+
52+ Tous avec `sandboxOptions.pullPolicy: always`.
53+
54+ Entrée de configuration (comme celles données par l'owner, ici pour Claude) :
55+
56+ ```yaml
57+ - name: claude
58+ title: Claude
59+ icon: "📙"
60+ command: sbx
61+ args: [exec, -i, claude-acp, claude-agent-acp]
62+ workspace: <agentsFolder>/claude-acp/workspace
63+ runtime:
64+ type: sbx
65+ sandbox: claude-acp
66+ lifecycle:
67+ folder: <agentsFolder>/claude-acp
68+ create: [sbx, env, create, --force]
69+ stop: [sbx, stop, claude-acp]
70+ remove: [sbx, env, rm, --force]
71+ ```
72+
73+ Gemini : `args: [exec, -i, <sandbox>, gemini, --acp]` ; Codex : `args: [exec, -i, <sandbox>, codex-acp]`.
74+ L'assistant « Ajouter un agent » sait déjà tout cela (`sbxPrograms`, `sbxArguments`, `withSandboxEnv` dans
75+ `frontend/src/lib/agentform.ts`, `ConfigService.ReadSandboxEnv`) : réutiliser plutôt que dupliquer, et faire
76+ du catalogue la source commune.
77+
78+ ## Décisions (owner)
79+ - **Nom de la sandbox = nom de l'agent** (= nom du dossier). Il doit être unique pour sbx (lettres, chiffres,
80+ tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (\`sbx ls\`), comme le dossier et le nom d'agent.
81+ - **Clés et connexion** : l'assistant **explique** ce qu'il faut (clé de l'API ou connexion OAuth), **vérifie** si la
82+ clé existe déjà dans sbx et, sinon, la **demande** à l'utilisateur et la **pose** lui-même
83+ (\`sbx secret set anthropic|google|openai\`), sans jamais l'écrire dans un fichier ni dans les journaux.
84+ - **Commentaires du \`sbxenv.yaml\` en anglais** (ADR 0005) ; les exemples de \`tmp/\` sont en français.
85+ - **Gemini : passer au kit \`antigravity\`** qui remplace \`docker.io/sbx/gemini-kit\` (déprécié par Docker), après avoir
86+ vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, \`bindings\`).
87+
88+ ## Messages d'erreur (simples)
89+ - `sbx` absent : dire quoi installer ; rien n'est créé.
90+ - Nom d'agent, dossier ou sandbox déjà pris : proposer un autre nom ; un dossier existant n'est jamais touché.
91+ - Clé absente (si vérifiable) : dire quelle commande lancer, ou la demander.
92+
93+ ## Critères d'acceptation
94+ - Depuis l'assistant, sans fichier à éditer ni dossier à choisir, un utilisateur crée un agent Claude, Gemini ou
95+ Codex ; son dossier (`sbxenv.yaml` + `workspace/`) est dans Documents (ou `agentsFolder`) ; l'agent apparaît
96+ dans la liste avec son emoji et démarre (la sandbox est créée au premier démarrage).
97+ - Ajouter un nouveau type = une entrée de catalogue (et son modèle de `sbxenv.yaml`).
98+ - Tests unitaires (génération du `sbxenv.yaml`, entrée de configuration, noms pris), doc EN + FR.
99+tasks:
100+ - id: 1
101+ title: "Catalogue des types sbx (Claude, Gemini, Codex) : agent, kit, programme, arguments, bindings, emoji et titre par défaut ; source commune avec l'assistant Ajouter un agent"
102+ state: open
103+ priority: high
104+ author:
105+ name: k33g
106+ email: ph.charriere@gmail.com
107+ createdAt: 2026-11-14T18:04:31.000Z
108+ - id: 2
109+ title: "Génération du dossier : sbxenv.yaml (name, workspace ./workspace, kit, bindings, pullPolicy) + workspace/"
110+ state: open
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-14T18:04:31.000Z
116+ - id: 3
117+ title: "Service Go : vérifier sbx, noms (agent, dossier, sandbox), écrire, ajouter l'entrée de configuration"
118+ state: open
119+ priority: high
120+ author:
121+ name: k33g
122+ email: ph.charriere@gmail.com
123+ createdAt: 2026-11-14T18:04:31.000Z
124+ - id: 4
125+ title: "Page de l'assistant : choix du type, nom, emoji ; accès depuis l'accueil, la liste des agents, la palette"
126+ state: open
127+ priority: high
128+ author:
129+ name: k33g
130+ email: ph.charriere@gmail.com
131+ createdAt: 2026-11-14T18:04:31.000Z
132+ - id: 5
133+ title: "Clés et connexion : expliquer, vérifier si le secret sbx existe, sinon le demander et le poser (jamais écrit ni journalisé)"
134+ state: open
135+ priority: medium
136+ author:
137+ name: k33g
138+ email: ph.charriere@gmail.com
139+ createdAt: 2026-11-14T18:04:31.000Z
140+ - id: 6
141+ title: "Tests unitaires ; essai sur le Mac avec les trois types"
142+ state: open
143+ priority: high
144+ author:
145+ name: k33g
146+ email: ph.charriere@gmail.com
147+ createdAt: 2026-11-14T18:04:31.000Z
148+ - id: 7
149+ title: "Documentation EN + FR (how-to, référence), notes de release"
150+ state: open
151+ priority: medium
152+ author:
153+ name: k33g
154+ email: ph.charriere@gmail.com
155+ createdAt: 2026-11-14T18:04:31.000Z
156+ - id: 8
157+ title: "Gemini : étudier le kit antigravity et son ACP (programme, arguments, clés, bindings) avant de l'adopter"
158+ state: open
159+ priority: high
160+ author:
161+ name: k33g
162+ email: ph.charriere@gmail.com
163+ createdAt: 2026-11-14T18:13:47.000Z
164+comments: []
new file mode 100644
@@ -0,0 +1,164 @@
1+# Managed by IssueSpec. Hand edits are welcome; keep the schema valid.
2+id: 96
3+title: "Assistant « Create a sbx agent » : Claude, Gemini, Codex dans une Docker Sandbox"
4+state: open
5+author:
6+ name: k33g
7+ email: ph.charriere@gmail.com
8+createdAt: 2026-11-14T18:04:31.000Z
9+updatedAt: 2026-11-14T18:13:47.000Z
10+labels:
11+ - kind::feature
12+ - area::ui
13+ - area::config
14+ - citizen-ux
15+ - size::L
16+milestone: "v1.5.0 · Release"
17+epic: Docker SBX
18+related:
19+ - 94
20+ - 81
21+ - 82
22+ - 84
23+body: |
24+ Un nouvel assistant, sur le modèle de [#94 — Assistant de création d'agents mini-me](.tickets/issues/0094-assistant-de-creation-d-agents-mini-me-pour-les.yaml),
25+ pour créer un agent qui tourne dans une Docker Sandbox (sbx), sans fichier à écrire ni dossier à choisir.
26+
27+ ## Déroulé
28+ 1. Au lancement, l'assistant propose le **type d'agent** : **Claude**, **Gemini** ou **Codex**. D'autres viendront
29+ (Mistral Vibe #86, Docker Agent #87…) : les types sont un **catalogue** (une entrée par type), pas du code en dur
30+ dans l'interface.
31+ 2. L'utilisateur donne le **nom** de l'agent (qui est aussi le nom de son dossier et de sa sandbox) et un **emoji**
32+ (par défaut celui du type : 📙 Claude, 📘 Gemini, 📗 Codex ; titre par défaut : Claude, Gemini, Codex).
33+ 3. Sidekicks crée le dossier de l'agent, écrit son `sbxenv.yaml`, l'ajoute à la configuration et ouvre sa
34+ conversation ; la sandbox est créée au premier démarrage (`runtime.lifecycle.create`).
35+
36+ Comme pour #94, le dossier de l'agent est créé dans **Documents** par défaut, modifiable avec le réglage
37+ `agentsFolder` (déjà en place).
38+
39+ ## Ce que l'assistant écrit
40+ Dossier `<agentsFolder>/<nom>/` :
41+ - `sbxenv.yaml`, d'après les exemples de [tmp/claude-acp/sbxenv.yaml](tmp/claude-acp/sbxenv.yaml),
42+ [tmp/gemini-acp/sbxenv.yaml](tmp/gemini-acp/sbxenv.yaml) et [tmp/codex-acp/sbxenv.yaml](tmp/codex-acp/sbxenv.yaml),
43+ avec `name: <nom>` et `workspace: ./workspace` ;
44+ - `workspace/`, le dossier de travail de l'agent.
45+
46+ | Type | `agent:` | kit | programme lancé | `bindings` |
47+ | --- | --- | --- | --- | --- |
48+ | Claude | `claude` | `docker.io/sbx/claude-acp:latest` | `claude-agent-acp` | `anthropic` (apiKey) |
49+ | Gemini | `gemini` | `docker.io/sbx/gemini-kit:latest` | `gemini --acp` | `google` (apiKey, oauth) |
50+ | Codex | `codex` | `docker.io/sbx/codex-acp:latest` | `codex-acp` | `openai` (apiKey, oauth) |
51+
52+ Tous avec `sandboxOptions.pullPolicy: always`.
53+
54+ Entrée de configuration (comme celles données par l'owner, ici pour Claude) :
55+
56+ ```yaml
57+ - name: claude
58+ title: Claude
59+ icon: "📙"
60+ command: sbx
61+ args: [exec, -i, claude-acp, claude-agent-acp]
62+ workspace: <agentsFolder>/claude-acp/workspace
63+ runtime:
64+ type: sbx
65+ sandbox: claude-acp
66+ lifecycle:
67+ folder: <agentsFolder>/claude-acp
68+ create: [sbx, env, create, --force]
69+ stop: [sbx, stop, claude-acp]
70+ remove: [sbx, env, rm, --force]
71+ ```
72+
73+ Gemini : `args: [exec, -i, <sandbox>, gemini, --acp]` ; Codex : `args: [exec, -i, <sandbox>, codex-acp]`.
74+ L'assistant « Ajouter un agent » sait déjà tout cela (`sbxPrograms`, `sbxArguments`, `withSandboxEnv` dans
75+ `frontend/src/lib/agentform.ts`, `ConfigService.ReadSandboxEnv`) : réutiliser plutôt que dupliquer, et faire
76+ du catalogue la source commune.
77+
78+ ## Décisions (owner)
79+ - **Nom de la sandbox = nom de l'agent** (= nom du dossier). Il doit être unique pour sbx (lettres, chiffres,
80+ tirets) : vérifier qu'aucune sandbox de ce nom n'existe déjà (\`sbx ls\`), comme le dossier et le nom d'agent.
81+ - **Clés et connexion** : l'assistant **explique** ce qu'il faut (clé de l'API ou connexion OAuth), **vérifie** si la
82+ clé existe déjà dans sbx et, sinon, la **demande** à l'utilisateur et la **pose** lui-même
83+ (\`sbx secret set anthropic|google|openai\`), sans jamais l'écrire dans un fichier ni dans les journaux.
84+ - **Commentaires du \`sbxenv.yaml\` en anglais** (ADR 0005) ; les exemples de \`tmp/\` sont en français.
85+ - **Gemini : passer au kit \`antigravity\`** qui remplace \`docker.io/sbx/gemini-kit\` (déprécié par Docker), après avoir
86+ vérifié comment ACP fonctionne avec lui (programme et arguments à lancer, clés, \`bindings\`).
87+
88+ ## Messages d'erreur (simples)
89+ - `sbx` absent : dire quoi installer ; rien n'est créé.
90+ - Nom d'agent, dossier ou sandbox déjà pris : proposer un autre nom ; un dossier existant n'est jamais touché.
91+ - Clé absente (si vérifiable) : dire quelle commande lancer, ou la demander.
92+
93+ ## Critères d'acceptation
94+ - Depuis l'assistant, sans fichier à éditer ni dossier à choisir, un utilisateur crée un agent Claude, Gemini ou
95+ Codex ; son dossier (`sbxenv.yaml` + `workspace/`) est dans Documents (ou `agentsFolder`) ; l'agent apparaît
96+ dans la liste avec son emoji et démarre (la sandbox est créée au premier démarrage).
97+ - Ajouter un nouveau type = une entrée de catalogue (et son modèle de `sbxenv.yaml`).
98+ - Tests unitaires (génération du `sbxenv.yaml`, entrée de configuration, noms pris), doc EN + FR.
99+tasks:
100+ - id: 1
101+ title: "Catalogue des types sbx (Claude, Gemini, Codex) : agent, kit, programme, arguments, bindings, emoji et titre par défaut ; source commune avec l'assistant Ajouter un agent"
102+ state: open
103+ priority: high
104+ author:
105+ name: k33g
106+ email: ph.charriere@gmail.com
107+ createdAt: 2026-11-14T18:04:31.000Z
108+ - id: 2
109+ title: "Génération du dossier : sbxenv.yaml (name, workspace ./workspace, kit, bindings, pullPolicy) + workspace/"
110+ state: open
111+ priority: high
112+ author:
113+ name: k33g
114+ email: ph.charriere@gmail.com
115+ createdAt: 2026-11-14T18:04:31.000Z
116+ - id: 3
117+ title: "Service Go : vérifier sbx, noms (agent, dossier, sandbox), écrire, ajouter l'entrée de configuration"
118+ state: open
119+ priority: high
120+ author:
121+ name: k33g
122+ email: ph.charriere@gmail.com
123+ createdAt: 2026-11-14T18:04:31.000Z
124+ - id: 4
125+ title: "Page de l'assistant : choix du type, nom, emoji ; accès depuis l'accueil, la liste des agents, la palette"
126+ state: open
127+ priority: high
128+ author:
129+ name: k33g
130+ email: ph.charriere@gmail.com
131+ createdAt: 2026-11-14T18:04:31.000Z
132+ - id: 5
133+ title: "Clés et connexion : expliquer, vérifier si le secret sbx existe, sinon le demander et le poser (jamais écrit ni journalisé)"
134+ state: open
135+ priority: medium
136+ author:
137+ name: k33g
138+ email: ph.charriere@gmail.com
139+ createdAt: 2026-11-14T18:04:31.000Z
140+ - id: 6
141+ title: "Tests unitaires ; essai sur le Mac avec les trois types"
142+ state: open
143+ priority: high
144+ author:
145+ name: k33g
146+ email: ph.charriere@gmail.com
147+ createdAt: 2026-11-14T18:04:31.000Z
148+ - id: 7
149+ title: "Documentation EN + FR (how-to, référence), notes de release"
150+ state: open
151+ priority: medium
152+ author:
153+ name: k33g
154+ email: ph.charriere@gmail.com
155+ createdAt: 2026-11-14T18:04:31.000Z
156+ - id: 8
157+ title: "Gemini : étudier le kit antigravity et son ACP (programme, arguments, clés, bindings) avant de l'adopter"
158+ state: open
159+ priority: high
160+ author:
161+ name: k33g
162+ email: ph.charriere@gmail.com
163+ createdAt: 2026-11-14T18:13:47.000Z
164+comments: []
modified .tickets/milestones.yaml +4 -1
@@ -58,5 +58,8 @@ milestones:
5858 state: closed
5959 description: "Sidekicks propose ses propres outils aux agents, en tant que client ACP, par les méthodes d'extension (protocole org.mini-me/tools de mini-me) : pression mémoire, à propos de Sidekicks, channel courant."
6060 - title: "v1.4.0 · Release"
61- state: open
61+ state: closed
6262 description: "Version 1.4.0 avec ce qu'apportent M9 · Agents en parallèle et M10 · Outils client ACP : version, notes de release, vérifications, paquets macOS signés et notarisés et Windows, tag v1.4.0 et publication."
63+ - title: "v1.5.0 · Release"
64+ state: open
65+ description: "Version 1.5.0 avec ce qui sera fait après la 1.4.0 : version, notes de release, vérifications, paquets macOS signés et notarisés et Windows, tag v1.5.0 et publication."
@@ -58,5 +58,8 @@ milestones:
58 state: closed58 state: closed
59 description: "Sidekicks propose ses propres outils aux agents, en tant que client ACP, par les méthodes d'extension (protocole org.mini-me/tools de mini-me) : pression mémoire, à propos de Sidekicks, channel courant."59 description: "Sidekicks propose ses propres outils aux agents, en tant que client ACP, par les méthodes d'extension (protocole org.mini-me/tools de mini-me) : pression mémoire, à propos de Sidekicks, channel courant."
60 - title: "v1.4.0 · Release"60 - title: "v1.4.0 · Release"
61- state: open61+ state: closed
62 description: "Version 1.4.0 avec ce qu'apportent M9 · Agents en parallèle et M10 · Outils client ACP : version, notes de release, vérifications, paquets macOS signés et notarisés et Windows, tag v1.4.0 et publication."62 description: "Version 1.4.0 avec ce qu'apportent M9 · Agents en parallèle et M10 · Outils client ACP : version, notes de release, vérifications, paquets macOS signés et notarisés et Windows, tag v1.4.0 et publication."
63+ - title: "v1.5.0 · Release"
64+ state: open
65+ description: "Version 1.5.0 avec ce qui sera fait après la 1.4.0 : version, notes de release, vérifications, paquets macOS signés et notarisés et Windows, tag v1.5.0 et publication."
added MINI-ME-DOCKERINIT-UID.md +123 -0
new file mode 100644
@@ -0,0 +1,123 @@
1+# mm dockerinit : « I have no name! » dans le conteneur
2+
3+Note pour le projet mini-me, rédigée depuis Sidekicks (ticket #94, assistant de création d'agents mini-me) le
4+2026-11-14. Elle décrit un défaut des fichiers écrits par `mm dockerinit` (et `/dockerinit` de `mm --acp-create`),
5+sa cause, et une correction vérifiée dans un conteneur Debian.
6+
7+## Symptôme
8+
9+Un agent créé avec l'option conteneur (Sidekicks → `/dockerinit` de `mm --acp-create`), puis un terminal ouvert dans
10+ce conteneur (`docker exec -it jimmy-box bash -l`, ce que fait l'onglet Terminal de Sidekicks), affiche le prompt :
11+
12+```text
13+I have no name!@cd5ed2bf5dad:/Users/k33g/Documents/jimmy$
14+```
15+
16+## Cause
17+
18+Les deux fichiers écrits par `mm dockerinit` ne s'accordent pas sur l'utilisateur :
19+
20+- `compose.yaml` lance le conteneur avec l'uid et le gid **de la machine qui a lancé `mm dockerinit`**, pour que les
21+ fichiers créés par l'agent dans le projet monté appartiennent à l'utilisateur :
22+
23+ ```yaml
24+ user: "${MM_UID:-501}:${MM_GID:-20}" # 501:20 sur un Mac
25+ ```
26+
27+- le `Dockerfile` ne crée qu'un compte `mm` avec l'uid **1000** :
28+
29+ ```dockerfile
30+ RUN useradd --create-home --uid 1000 mm && chmod 777 /home/mm
31+ ENV HOME=/home/mm
32+ USER mm
33+ ```
34+
35+Sur un Mac, l'uid 501 n'a donc **aucune entrée dans `/etc/passwd`** de l'image. bash ne trouve pas de nom pour
36+`\u` dans son prompt et affiche « I have no name! ». Sous Linux, où l'utilisateur a souvent l'uid 1000, le défaut
37+ne se voit pas, ce qui explique qu'il soit passé inaperçu.
38+
39+## Conséquences
40+
41+Ce n'est pas seulement cosmétique : `HOME=/home/mm` est bien inscriptible (`chmod 777`), donc mm tourne, mais tout
42+programme qui cherche l'utilisateur courant dans `/etc/passwd` échoue :
43+
44+| Commande | Résultat (uid 501 sans compte) |
45+| --- | --- |
46+| `whoami` | `whoami: cannot find name for user ID 501` (constaté) |
47+| `id` | `uid=501 gid=20(dialout) groups=20(dialout)` — pas de nom d'utilisateur (constaté) |
48+| prompt de bash | `I have no name!@<conteneur>:…$` (constaté) |
49+| `git commit` sans `user.name` / `user.email` configurés | git ne peut pas déduire l'identité depuis le compte (non testé ici : `git` n'est pas dans l'image de test) |
50+| `ssh` | refuse de démarrer sans compte pour l'uid (non testé ici) |
51+
52+Un agent qui utilise git ou ssh avec son outil bash peut donc s'y heurter.
53+
54+## Correction proposée
55+
56+Créer le compte `mm` **avec l'uid et le gid de l'utilisateur**, au moment de construire l'image, en les passant de
57+`compose.yaml` au `Dockerfile` comme arguments de build.
58+
59+`Dockerfile` (remplace la ligne `useradd` actuelle) :
60+
61+```dockerfile
62+# The agent never runs as root. Its account has the uid and gid of the user
63+# who runs compose (MM_UID, MM_GID), so that every program finds it in
64+# /etc/passwd and the files it writes in the project belong to that user.
65+ARG MM_UID=1000
66+ARG MM_GID=1000
67+RUN groupadd -o -g "$MM_GID" mm \
68+ && useradd -o --create-home --uid "$MM_UID" --gid "$MM_GID" mm \
69+ && chmod 777 /home/mm
70+ENV HOME=/home/mm
71+USER mm
72+```
73+
74+`compose.yaml` (le `build: .` actuel devient) :
75+
76+```yaml
77+ build:
78+ context: .
79+ args:
80+ MM_UID: ${MM_UID:-501}
81+ MM_GID: ${MM_GID:-20}
82+ image: mm-jimmy:latest
83+ container_name: jimmy-box
84+ user: "${MM_UID:-501}:${MM_GID:-20}"
85+```
86+
87+Les valeurs par défaut sont celles que `mm dockerinit` écrit déjà dans `user:` (`usableID(uid)`, `usableID(gid)`),
88+il suffit de les écrire aussi sous `args:`.
89+
90+Points à noter :
91+
92+- **`-o` est nécessaire** : le gid 20 existe déjà dans Debian (`dialout`), et `groupadd` refuserait un gid en double.
93+ Avec `-o`, le groupe `mm` partage le gid 20 ; `id` affiche toujours `gid=20(dialout)` (premier nom trouvé),
94+ ce qui est sans conséquence. `useradd -o` couvre de même un uid déjà pris par un compte de l'image.
95+- **Une image par utilisateur** : l'uid fait partie de l'image. C'est déjà le cas en pratique (l'image est construite
96+ sur la machine de l'utilisateur) ; une image poussée sur un registre (`docker buildx … --push`, mentionné dans
97+ les commentaires de `compose.yaml`) garde l'uid 1000 par défaut, comme aujourd'hui.
98+- **Windows** : `usableID` remplace déjà un uid négatif ou nul par la valeur de repli ; rien ne change.
99+- **Les agents déjà créés** : après avoir modifié leurs deux fichiers, reconstruire l'image avec
100+ `docker compose up -d --build`.
101+
102+## Vérification
103+
104+Faite le 2026-11-14 dans un conteneur `debian:bookworm-slim`, avec uniquement les lignes du compte (sans le
105+téléchargement de mm), lancé avec `-u 501:20` comme le fait `compose.yaml` sur un Mac :
106+
107+| | Avant (`useradd --uid 1000`) | Après (`--build-arg MM_UID=501 --build-arg MM_GID=20`) |
108+| --- | --- | --- |
109+| `whoami` | `cannot find name for user ID 501` | `mm` |
110+| `id` | `uid=501 gid=20(dialout)` | `uid=501(mm) gid=20(dialout)` |
111+| `HOME` inscriptible | oui | oui (`/home/mm`) |
112+
113+Avec les valeurs par défaut (`MM_UID=1000`, `MM_GID=1000`, cas Linux), `whoami` répond aussi `mm`.
114+
115+À vérifier côté mini-me avec le vrai `Dockerfile` : la construction complète (téléchargement de mm), puis
116+`docker compose exec <service> bash -l` (prompt `mm@…`), `git commit` et `mm tui` dans le conteneur.
117+
118+## Où regarder dans mini-me
119+
120+- `internal/dockerinit/files.go` : la constante `dockerfile` (ligne `useradd`) et la fonction `compose`
121+ (ligne `build: .` et `user:`).
122+- Les tests de `internal/dockerinit` qui comparent le contenu écrit.
123+- La doc « run mini-me in a container » (EN et FR), qui explique `MM_UID` et `MM_GID`.
new file mode 100644
@@ -0,0 +1,123 @@
1+# mm dockerinit : « I have no name! » dans le conteneur
2+
3+Note pour le projet mini-me, rédigée depuis Sidekicks (ticket #94, assistant de création d'agents mini-me) le
4+2026-11-14. Elle décrit un défaut des fichiers écrits par `mm dockerinit` (et `/dockerinit` de `mm --acp-create`),
5+sa cause, et une correction vérifiée dans un conteneur Debian.
6+
7+## Symptôme
8+
9+Un agent créé avec l'option conteneur (Sidekicks → `/dockerinit` de `mm --acp-create`), puis un terminal ouvert dans
10+ce conteneur (`docker exec -it jimmy-box bash -l`, ce que fait l'onglet Terminal de Sidekicks), affiche le prompt :
11+
12+```text
13+I have no name!@cd5ed2bf5dad:/Users/k33g/Documents/jimmy$
14+```
15+
16+## Cause
17+
18+Les deux fichiers écrits par `mm dockerinit` ne s'accordent pas sur l'utilisateur :
19+
20+- `compose.yaml` lance le conteneur avec l'uid et le gid **de la machine qui a lancé `mm dockerinit`**, pour que les
21+ fichiers créés par l'agent dans le projet monté appartiennent à l'utilisateur :
22+
23+ ```yaml
24+ user: "${MM_UID:-501}:${MM_GID:-20}" # 501:20 sur un Mac
25+ ```
26+
27+- le `Dockerfile` ne crée qu'un compte `mm` avec l'uid **1000** :
28+
29+ ```dockerfile
30+ RUN useradd --create-home --uid 1000 mm && chmod 777 /home/mm
31+ ENV HOME=/home/mm
32+ USER mm
33+ ```
34+
35+Sur un Mac, l'uid 501 n'a donc **aucune entrée dans `/etc/passwd`** de l'image. bash ne trouve pas de nom pour
36+`\u` dans son prompt et affiche « I have no name! ». Sous Linux, où l'utilisateur a souvent l'uid 1000, le défaut
37+ne se voit pas, ce qui explique qu'il soit passé inaperçu.
38+
39+## Conséquences
40+
41+Ce n'est pas seulement cosmétique : `HOME=/home/mm` est bien inscriptible (`chmod 777`), donc mm tourne, mais tout
42+programme qui cherche l'utilisateur courant dans `/etc/passwd` échoue :
43+
44+| Commande | Résultat (uid 501 sans compte) |
45+| --- | --- |
46+| `whoami` | `whoami: cannot find name for user ID 501` (constaté) |
47+| `id` | `uid=501 gid=20(dialout) groups=20(dialout)` — pas de nom d'utilisateur (constaté) |
48+| prompt de bash | `I have no name!@<conteneur>:…$` (constaté) |
49+| `git commit` sans `user.name` / `user.email` configurés | git ne peut pas déduire l'identité depuis le compte (non testé ici : `git` n'est pas dans l'image de test) |
50+| `ssh` | refuse de démarrer sans compte pour l'uid (non testé ici) |
51+
52+Un agent qui utilise git ou ssh avec son outil bash peut donc s'y heurter.
53+
54+## Correction proposée
55+
56+Créer le compte `mm` **avec l'uid et le gid de l'utilisateur**, au moment de construire l'image, en les passant de
57+`compose.yaml` au `Dockerfile` comme arguments de build.
58+
59+`Dockerfile` (remplace la ligne `useradd` actuelle) :
60+
61+```dockerfile
62+# The agent never runs as root. Its account has the uid and gid of the user
63+# who runs compose (MM_UID, MM_GID), so that every program finds it in
64+# /etc/passwd and the files it writes in the project belong to that user.
65+ARG MM_UID=1000
66+ARG MM_GID=1000
67+RUN groupadd -o -g "$MM_GID" mm \
68+ && useradd -o --create-home --uid "$MM_UID" --gid "$MM_GID" mm \
69+ && chmod 777 /home/mm
70+ENV HOME=/home/mm
71+USER mm
72+```
73+
74+`compose.yaml` (le `build: .` actuel devient) :
75+
76+```yaml
77+ build:
78+ context: .
79+ args:
80+ MM_UID: ${MM_UID:-501}
81+ MM_GID: ${MM_GID:-20}
82+ image: mm-jimmy:latest
83+ container_name: jimmy-box
84+ user: "${MM_UID:-501}:${MM_GID:-20}"
85+```
86+
87+Les valeurs par défaut sont celles que `mm dockerinit` écrit déjà dans `user:` (`usableID(uid)`, `usableID(gid)`),
88+il suffit de les écrire aussi sous `args:`.
89+
90+Points à noter :
91+
92+- **`-o` est nécessaire** : le gid 20 existe déjà dans Debian (`dialout`), et `groupadd` refuserait un gid en double.
93+ Avec `-o`, le groupe `mm` partage le gid 20 ; `id` affiche toujours `gid=20(dialout)` (premier nom trouvé),
94+ ce qui est sans conséquence. `useradd -o` couvre de même un uid déjà pris par un compte de l'image.
95+- **Une image par utilisateur** : l'uid fait partie de l'image. C'est déjà le cas en pratique (l'image est construite
96+ sur la machine de l'utilisateur) ; une image poussée sur un registre (`docker buildx … --push`, mentionné dans
97+ les commentaires de `compose.yaml`) garde l'uid 1000 par défaut, comme aujourd'hui.
98+- **Windows** : `usableID` remplace déjà un uid négatif ou nul par la valeur de repli ; rien ne change.
99+- **Les agents déjà créés** : après avoir modifié leurs deux fichiers, reconstruire l'image avec
100+ `docker compose up -d --build`.
101+
102+## Vérification
103+
104+Faite le 2026-11-14 dans un conteneur `debian:bookworm-slim`, avec uniquement les lignes du compte (sans le
105+téléchargement de mm), lancé avec `-u 501:20` comme le fait `compose.yaml` sur un Mac :
106+
107+| | Avant (`useradd --uid 1000`) | Après (`--build-arg MM_UID=501 --build-arg MM_GID=20`) |
108+| --- | --- | --- |
109+| `whoami` | `cannot find name for user ID 501` | `mm` |
110+| `id` | `uid=501 gid=20(dialout)` | `uid=501(mm) gid=20(dialout)` |
111+| `HOME` inscriptible | oui | oui (`/home/mm`) |
112+
113+Avec les valeurs par défaut (`MM_UID=1000`, `MM_GID=1000`, cas Linux), `whoami` répond aussi `mm`.
114+
115+À vérifier côté mini-me avec le vrai `Dockerfile` : la construction complète (téléchargement de mm), puis
116+`docker compose exec <service> bash -l` (prompt `mm@…`), `git commit` et `mm tui` dans le conteneur.
117+
118+## Où regarder dans mini-me
119+
120+- `internal/dockerinit/files.go` : la constante `dockerfile` (ligne `useradd`) et la fonction `compose`
121+ (ligne `build: .` et `user:`).
122+- Les tests de `internal/dockerinit` qui comparent le contenu écrit.
123+- La doc « run mini-me in a container » (EN et FR), qui explique `MM_UID` et `MM_GID`.
modified docs/en/README.md +1 -1
@@ -7,7 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
77 | You want to… | Section | Pages |
88 | --- | --- | --- |
99 | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) |
10-| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) |
10+| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Create a mini-me agent](how-to/create-a-mini-me-agent.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) |
1111 | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) |
1212 | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) |
1313
@@ -7,7 +7,7 @@ This documentation follows [Diátaxis](https://diataxis.fr): pick the section th
7 | You want to… | Section | Pages |7 | You want to… | Section | Pages |
8 | --- | --- | --- |8 | --- | --- | --- |
9 | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) |9 | **learn** by doing | Tutorials | [Your first agent, without writing any configuration](tutorials/your-first-agent.md) · [A channel with two agents](tutorials/first-channel.md) · [Your first conversation with an agent](tutorials/first-conversation.md) · [Your first launch of Sidekicks](tutorials/first-launch.md) · [Your first ACP exchange with a test agent](tutorials/first-acp-exchange.md) |
10-| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) |10+| **do** a specific task | How-to guides | [Install Sidekicks](how-to/install-sidekicks.md) · [Create a mini-me agent](how-to/create-a-mini-me-agent.md) · [Add an agent](how-to/add-an-agent.md) · [Work with an agent's files and terminal](how-to/work-with-an-agents-files.md) · [Run an agent in a Docker container](how-to/run-an-agent-in-docker.md) · [Run an agent in an sbx sandbox](how-to/run-an-agent-in-a-sandbox.md) · [Add a Claude agent in an sbx sandbox](how-to/add-a-claude-agent-in-a-sandbox.md) · [Add a Codex agent in an sbx sandbox](how-to/add-a-codex-agent-in-a-sandbox.md) · [Add a Gemini agent in an sbx sandbox](how-to/add-a-gemini-agent-in-a-sandbox.md) · [Join files to a message](how-to/join-files-to-a-message.md) · [Manage channels and their agents](how-to/manage-channels.md) · [Edit or switch the configuration](how-to/edit-or-switch-the-configuration.md) · [Reset Sidekicks](how-to/reset-sidekicks.md) · [Watch the memory pressure](how-to/watch-the-memory-pressure.md) · [Let an agent use Sidekicks' tools](how-to/use-sidekicks-tools-from-an-agent.md) · [Develop the application](how-to/develop-the-application.md) · [Run the tests](how-to/run-the-tests.md) · [Check a change before merging it](how-to/check-before-merging.md) · [Run a test agent](how-to/run-a-test-agent.md) · [Run the end-to-end scenarios (v0.1)](how-to/run-the-end-to-end-scenarios.md) · [Set the version](how-to/set-the-version.md) · [Publish a release](how-to/publish-a-release.md) · [Sign and notarize for macOS](how-to/sign-and-notarize-on-macos.md) · [Test issue #52 on macOS](how-to/test-issue-52-on-macos.md) · [Test issues #49 and #50 on macOS](how-to/test-issues-49-and-50-on-macos.md) · [Test issue #47 on macOS](how-to/test-issue-47-on-macos.md) · [Test milestone M4 on macOS](how-to/test-milestone-m4-on-macos.md) · [Test milestone M3 on macOS](how-to/test-milestone-m3-on-macos.md) · [Test milestone M2 on macOS](how-to/test-milestone-m2-on-macos.md) · [Test milestone M1 on macOS](how-to/test-milestone-m1-on-macos.md) · [Test milestone Initialize on macOS](how-to/test-milestone-initialize-on-macos.md) |
11 | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) |11 | **look up** an exact detail | Reference | [The configuration file](reference/configuration.md) · [Keyboard shortcuts](reference/keyboard-shortcuts.md) · [Agents, channels and events](reference/agents-and-events.md) · [Commands](reference/commands.md) · [scripts/agents.sh](reference/agents-script.md) |
12 | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) |12 | **understand** why | Explanation | [Workspaces and terminals](explanation/workspaces-and-terminals.md) · [Channels and what each agent knows](explanation/channels-and-context.md) · [Permissions and trust](explanation/permissions.md) · [Why ACP](explanation/why-acp.md) · [The interface stack](explanation/ui-stack.md) · [Architecture](explanation/architecture.md) · [Memory and local models](explanation/memory-and-local-models.md) |
13 13
modified docs/en/explanation/permissions.md +4 -0
@@ -20,6 +20,10 @@ Small local models do not take no for an answer. During the ACP spike, Riker ref
2020
2121 The card appears in the conversation of the agent that asks, not in a window over everything: the other conversations go on, and the question stays next to what led to it. Stopping the agent answers its pending questions "cancelled", as ACP requires.
2222
23+## Questions from an agent
24+
25+An agent may also ask the user questions — mini-me's `ask_user` tool does — with an ACP form (`elicitation/create`). Sidekicks tells every agent it can show forms, and shows each one as a card in the conversation of its session, under the answer that asks it, like a permission card: free text, a choice, several choices, yes or no; **Answer**, **Decline**, and **Stop**. Without forms, mini-me could only ask choices as permission buttons, and a question that needs typed text could not be asked at all (issue #95).
26+
2327 ## Rejected alternatives
2428
2529 - **A modal dialog**: it blocks every conversation for one agent's question.
@@ -20,6 +20,10 @@ Small local models do not take no for an answer. During the ACP spike, Riker ref
20 20
21 The card appears in the conversation of the agent that asks, not in a window over everything: the other conversations go on, and the question stays next to what led to it. Stopping the agent answers its pending questions "cancelled", as ACP requires.21 The card appears in the conversation of the agent that asks, not in a window over everything: the other conversations go on, and the question stays next to what led to it. Stopping the agent answers its pending questions "cancelled", as ACP requires.
22 22
23+## Questions from an agent
24+
25+An agent may also ask the user questions — mini-me's `ask_user` tool does — with an ACP form (`elicitation/create`). Sidekicks tells every agent it can show forms, and shows each one as a card in the conversation of its session, under the answer that asks it, like a permission card: free text, a choice, several choices, yes or no; **Answer**, **Decline**, and **Stop**. Without forms, mini-me could only ask choices as permission buttons, and a question that needs typed text could not be asked at all (issue #95).
26+
23 ## Rejected alternatives27 ## Rejected alternatives
24 28
25 - **A modal dialog**: it blocks every conversation for one agent's question.29 - **A modal dialog**: it blocks every conversation for one agent's question.
modified docs/en/how-to/add-an-agent.md +1 -0
@@ -24,6 +24,7 @@ When the agent cannot be added (a name already used, for instance), the assistan
2424
2525 ## See also
2626
27+- To create a new mini-me agent by answering questions, with no file and no folder to choose: [How to create a mini-me agent](create-a-mini-me-agent.md)
2728 - What the assistant writes: [The configuration file](../reference/configuration.md)
2829 - [How to edit or switch the configuration](edit-or-switch-the-configuration.md)
2930 - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md)
@@ -24,6 +24,7 @@ When the agent cannot be added (a name already used, for instance), the assistan
24 24
25 ## See also25 ## See also
26 26
27+- To create a new mini-me agent by answering questions, with no file and no folder to choose: [How to create a mini-me agent](create-a-mini-me-agent.md)
27 - What the assistant writes: [The configuration file](../reference/configuration.md)28 - What the assistant writes: [The configuration file](../reference/configuration.md)
28 - [How to edit or switch the configuration](edit-or-switch-the-configuration.md)29 - [How to edit or switch the configuration](edit-or-switch-the-configuration.md)
29 - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md)30 - [Tutorial: your first agent, without writing any configuration](../tutorials/your-first-agent.md)
added docs/en/how-to/create-a-mini-me-agent.md +36 -0
new file mode 100644
@@ -0,0 +1,36 @@
1+# How to create a mini-me agent
2+
3+This guide shows how to create a new [mini-me](https://git.rickub.com/bots-garden/mini-me) agent from the Sidekicks window, by answering questions, without writing a file or choosing a folder. It assumes mini-me (`mm`) **1.0.9 or later** is installed, and that a model server runs (Docker Model Runner, llmman, Ollama…): the questions list its models. To add an agent that already exists, or another program than mini-me, use [How to add an agent](add-an-agent.md) instead.
4+
5+## Steps
6+
7+1. Open the assistant: **✨ Create my first agent** on the welcome screen, **✨ Create a mini-me agent** under the agents list, or **Create a mini-me agent** in the command palette (⌘K, Ctrl+K on Linux and Windows).
8+2. Answer the questions of mini-me, a few at a time: the model server, the model, what the agent is for, which machine runs the model, whether it asks before each command or file change, the agent's name… Each question comes with mini-me's default: **Next →** takes it. **About these choices** explains the options.
9+3. When mini-me has written the agent, give its last details:
10+ - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me; lowercase letters, digits, `-` and `_`, starting with a letter.
11+ - **Emoji**: pick one, or type any emoji.
12+ - **Where does it run?** **On this computer** (the simplest), **In a Docker container** (Docker must be installed) or **In a Docker Sandbox (sbx)** (sbx must be installed).
13+4. Click **Add the agent**. Its direct conversation opens: write to it.
14+
15+The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/marcel`). Its settings are in `.mm/agent.yaml` there; for a container or a sandbox, mini-me also writes `Dockerfile` and `compose.yaml`, or `sbxenv.yaml`, and Sidekicks creates the container or the sandbox the first time the agent starts.
16+
17+## When something goes wrong
18+
19+- **"mini-me (mm) is not installed on this computer"**: install mini-me, then click **Try again**. If it is installed but Sidekicks was opened from the Finder, quit Sidekicks and open it again: it reads your shell's `PATH` at startup.
20+- **"mini-me 1.0.8 is installed, but this assistant needs mini-me 1.0.9 or later"**: update mini-me, then click **Try again**.
21+- **"No model server answered"**: the model is then asked as text. Start your model server, then click **Start again**; or type the model's name yourself if you know it.
22+- **"A folder with this name already exists"** or **"Another agent already has this name"**: change the **Name** and click **Add the agent** again. An existing folder is never changed.
23+- **The Terminal of an agent in a container shows `I have no name!`** (and `whoami` fails): its files were written by an mm without the account fix of `mm dockerinit`. Update mini-me, then, in the agent's folder, write the files again and rebuild the image: `rm Dockerfile compose.yaml && mm dockerinit`, then `docker compose up -d --build` (Sidekicks' own create command does not rebuild an image that exists). Open a new terminal: the prompt shows `mm@…`.
24+- **The questions stopped** (after **← Previous question**, for instance): click **Continue** to go on where you were, or **Start again**.
25+
26+## Variants
27+
28+- **Go back**: **← Previous question** takes back your last answer and asks it again; **Start again** forgets every answer.
29+- **Give up**: **Cancel**, or opening a channel, closes the assistant; what mini-me had written is removed.
30+- **Another folder than Documents**: set [`agentsFolder`](../reference/configuration.md#top-level) in **Settings**, for example `agentsFolder: ~/agents`. The next agents are created there.
31+
32+## See also
33+
34+- [How to add an agent](add-an-agent.md) — any program, any folder, with every field.
35+- [How to run an agent in a Docker container](run-an-agent-in-docker.md) · [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md)
36+- How it works: [`CreatorService`](../reference/agents-and-events.md#creatorservice)
new file mode 100644
@@ -0,0 +1,36 @@
1+# How to create a mini-me agent
2+
3+This guide shows how to create a new [mini-me](https://git.rickub.com/bots-garden/mini-me) agent from the Sidekicks window, by answering questions, without writing a file or choosing a folder. It assumes mini-me (`mm`) **1.0.9 or later** is installed, and that a model server runs (Docker Model Runner, llmman, Ollama…): the questions list its models. To add an agent that already exists, or another program than mini-me, use [How to add an agent](add-an-agent.md) instead.
4+
5+## Steps
6+
7+1. Open the assistant: **✨ Create my first agent** on the welcome screen, **✨ Create a mini-me agent** under the agents list, or **Create a mini-me agent** in the command palette (⌘K, Ctrl+K on Linux and Windows).
8+2. Answer the questions of mini-me, a few at a time: the model server, the model, what the agent is for, which machine runs the model, whether it asks before each command or file change, the agent's name… Each question comes with mini-me's default: **Next →** takes it. **About these choices** explains the options.
9+3. When mini-me has written the agent, give its last details:
10+ - **Name**: what you call it with in a conversation (`@marcel`), and the name of its folder. It starts from the name you gave mini-me; lowercase letters, digits, `-` and `_`, starting with a letter.
11+ - **Emoji**: pick one, or type any emoji.
12+ - **Where does it run?** **On this computer** (the simplest), **In a Docker container** (Docker must be installed) or **In a Docker Sandbox (sbx)** (sbx must be installed).
13+4. Click **Add the agent**. Its direct conversation opens: write to it.
14+
15+The agent's folder is created in your **Documents** folder, named after the agent (`~/Documents/marcel`). Its settings are in `.mm/agent.yaml` there; for a container or a sandbox, mini-me also writes `Dockerfile` and `compose.yaml`, or `sbxenv.yaml`, and Sidekicks creates the container or the sandbox the first time the agent starts.
16+
17+## When something goes wrong
18+
19+- **"mini-me (mm) is not installed on this computer"**: install mini-me, then click **Try again**. If it is installed but Sidekicks was opened from the Finder, quit Sidekicks and open it again: it reads your shell's `PATH` at startup.
20+- **"mini-me 1.0.8 is installed, but this assistant needs mini-me 1.0.9 or later"**: update mini-me, then click **Try again**.
21+- **"No model server answered"**: the model is then asked as text. Start your model server, then click **Start again**; or type the model's name yourself if you know it.
22+- **"A folder with this name already exists"** or **"Another agent already has this name"**: change the **Name** and click **Add the agent** again. An existing folder is never changed.
23+- **The Terminal of an agent in a container shows `I have no name!`** (and `whoami` fails): its files were written by an mm without the account fix of `mm dockerinit`. Update mini-me, then, in the agent's folder, write the files again and rebuild the image: `rm Dockerfile compose.yaml && mm dockerinit`, then `docker compose up -d --build` (Sidekicks' own create command does not rebuild an image that exists). Open a new terminal: the prompt shows `mm@…`.
24+- **The questions stopped** (after **← Previous question**, for instance): click **Continue** to go on where you were, or **Start again**.
25+
26+## Variants
27+
28+- **Go back**: **← Previous question** takes back your last answer and asks it again; **Start again** forgets every answer.
29+- **Give up**: **Cancel**, or opening a channel, closes the assistant; what mini-me had written is removed.
30+- **Another folder than Documents**: set [`agentsFolder`](../reference/configuration.md#top-level) in **Settings**, for example `agentsFolder: ~/agents`. The next agents are created there.
31+
32+## See also
33+
34+- [How to add an agent](add-an-agent.md) — any program, any folder, with every field.
35+- [How to run an agent in a Docker container](run-an-agent-in-docker.md) · [How to run an agent in an sbx sandbox](run-an-agent-in-a-sandbox.md)
36+- How it works: [`CreatorService`](../reference/agents-and-events.md#creatorservice)
modified docs/en/reference/agents-and-events.md +19 -2
@@ -124,6 +124,8 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
124124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | the channel starts or stops answering, or an agent's turn begins or ends; `queued` messages wait; `answerers` are all the agents answering (several after `/parallel`), `answering` the first of them |
125125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | an agent asks to run a tool; `rejections` counts the refusals already given in this turn |
126126 | `permission:resolved` | `{id, channel}` | the request was answered, or cancelled by Stop |
127+| `form:requested` | `{id, channel, agent, messageId, form: {message, fields[], sessionId, toolCallId}}` | an agent asks the user to fill in a form (ACP `elicitation/create`, form mode; mini-me's `ask_user`, issue #95); the fields are those of [`CreatorService`](#creatorservice)'s forms |
128+| `form:resolved` | `{id, channel}` | the form was answered or declined, or cancelled by Stop or the end of the turn |
127129 | `usage:changed` | `{channel, agent, usage: {used, size}}` | an agent reported its context window use (`size` is 0 when unknown) |
128130 | `commands:changed` | `{agent, commands[]}` | an agent announced its slash commands (`name, description, hint`) |
129131
@@ -139,9 +141,10 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
139141 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invites or removes an agent; the channel shows `agent-joined` or `agent-left`. |
140142 | `Direct(agent)` | The direct conversation with `agent`, created the first time. |
141143 | `Send(id, text)` | Adds a user message and returns its id; the agents that answer are started if needed; the message is queued if the channel is answering. Empty text and unknown channels are errors. Each `$path` joins a file of an agent's folder (see [Joined files](#joined-files)); more than 10 is an error. |
142-| `Cancel(id)` | Stops the current answer (`session/cancel`), the agents still to answer and the queued messages; answers pending permission requests "cancelled". |
144+| `Cancel(id)` | Stops the current answer (`session/cancel`), the agents still to answer and the queued messages; answers pending permission requests and forms "cancelled". |
143145 | `AnswerPermission(id, optionId)` | Answers a pending request with one of its options. |
144-| `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions`. |
146+| `AnswerForm(id, answer)` | Answers a pending form: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. An unknown form or action is an error. |
147+| `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
145148 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |
146149 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |
147150 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |
@@ -235,6 +238,20 @@ A file opened for editing has `path, content, version`; `version` identifies the
235238 | `ChooseCompose()` | The native file dialog, for a Compose file. |
236239 | `Reset(choice)` | The Danger zone: `settings` (default configuration, preferences forgotten), `history` (this configuration's), `allHistory` (every configuration's) or `everything`. Each thing reset is first kept as a dated copy; returns `{copies[]}`. The history is reopened empty and the declared channels created again; then `config:changed` is sent. |
237240
241+## `CreatorService`
242+
243+The assistant that creates a mini-me agent (issue #94, [How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)). Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mini-me 1.0.9 and later): mm's `mm init` wizard, with the `.mm` layout imposed and neither of those two questions asked. Sidekicks advertises `clientCapabilities.elicitation.form` and shows each `elicitation/create` form of mm (fields in the order of `required`; `string` with `enum` → choice, `boolean`, `array` → several choices, `number`, other `string` → text). The wizard works in a temporary folder `<agentsFolder>/.sidekicks-new-agent-…`, because the agent's name, which names its folder, comes near the end. One wizard at a time.
244+
245+| Method | Effect |
246+| --- | --- |
247+| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version}`. |
248+| `Answer(answer)` | Answers the form shown: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. Returns the next `view`. |
249+| `Send(text)` | Sends a message to mm (`/back`, `/restart`, `/start`…); refused while a form waits (decline it first). Returns the next `view`. |
250+| `Finish({name, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title from `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. |
251+| `Cancel()` | Stops mm; before `Finish`, removes the temporary folder. Also done when Sidekicks quits. |
252+
253+A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered.
254+
238255 ## Tools offered to the agents
239256
240257 Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent).
@@ -124,6 +124,8 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | the channel starts or stops answering, or an agent's turn begins or ends; `queued` messages wait; `answerers` are all the agents answering (several after `/parallel`), `answering` the first of them |124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | the channel starts or stops answering, or an agent's turn begins or ends; `queued` messages wait; `answerers` are all the agents answering (several after `/parallel`), `answering` the first of them |
125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | an agent asks to run a tool; `rejections` counts the refusals already given in this turn |125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | an agent asks to run a tool; `rejections` counts the refusals already given in this turn |
126 | `permission:resolved` | `{id, channel}` | the request was answered, or cancelled by Stop |126 | `permission:resolved` | `{id, channel}` | the request was answered, or cancelled by Stop |
127+| `form:requested` | `{id, channel, agent, messageId, form: {message, fields[], sessionId, toolCallId}}` | an agent asks the user to fill in a form (ACP `elicitation/create`, form mode; mini-me's `ask_user`, issue #95); the fields are those of [`CreatorService`](#creatorservice)'s forms |
128+| `form:resolved` | `{id, channel}` | the form was answered or declined, or cancelled by Stop or the end of the turn |
127 | `usage:changed` | `{channel, agent, usage: {used, size}}` | an agent reported its context window use (`size` is 0 when unknown) |129 | `usage:changed` | `{channel, agent, usage: {used, size}}` | an agent reported its context window use (`size` is 0 when unknown) |
128 | `commands:changed` | `{agent, commands[]}` | an agent announced its slash commands (`name, description, hint`) |130 | `commands:changed` | `{agent, commands[]}` | an agent announced its slash commands (`name, description, hint`) |
129 131
@@ -139,9 +141,10 @@ A tool call has `id, title, kind` (`read, edit, delete, move, search, execute, t
139 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invites or removes an agent; the channel shows `agent-joined` or `agent-left`. |141 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invites or removes an agent; the channel shows `agent-joined` or `agent-left`. |
140 | `Direct(agent)` | The direct conversation with `agent`, created the first time. |142 | `Direct(agent)` | The direct conversation with `agent`, created the first time. |
141 | `Send(id, text)` | Adds a user message and returns its id; the agents that answer are started if needed; the message is queued if the channel is answering. Empty text and unknown channels are errors. Each `$path` joins a file of an agent's folder (see [Joined files](#joined-files)); more than 10 is an error. |143 | `Send(id, text)` | Adds a user message and returns its id; the agents that answer are started if needed; the message is queued if the channel is answering. Empty text and unknown channels are errors. Each `$path` joins a file of an agent's folder (see [Joined files](#joined-files)); more than 10 is an error. |
142-| `Cancel(id)` | Stops the current answer (`session/cancel`), the agents still to answer and the queued messages; answers pending permission requests "cancelled". |144+| `Cancel(id)` | Stops the current answer (`session/cancel`), the agents still to answer and the queued messages; answers pending permission requests and forms "cancelled". |
143 | `AnswerPermission(id, optionId)` | Answers a pending request with one of its options. |145 | `AnswerPermission(id, optionId)` | Answers a pending request with one of its options. |
144-| `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions`. |146+| `AnswerForm(id, answer)` | Answers a pending form: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. An unknown form or action is an error. |
147+| `Conversation(id)` | `channel, messages` (the last 100), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
145 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |148 | `Older(id, beforeId)` | `{messages, more}`: the 100 messages before `beforeId`. |
146 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |149 | `Commands(agent)` | The commands the agent announced last, kept from one run to the next; empty if it never announced any. |
147 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |150 | `Prepare(id)` | Starts the members of the channel that never announced their commands and opens their session for it (no model is loaded); returns once the sessions are open, the commands arrive as `commands:changed`. A member answering elsewhere is skipped. The session serves the member's first answer, which is still told the channel's past. |
@@ -235,6 +238,20 @@ A file opened for editing has `path, content, version`; `version` identifies the
235 | `ChooseCompose()` | The native file dialog, for a Compose file. |238 | `ChooseCompose()` | The native file dialog, for a Compose file. |
236 | `Reset(choice)` | The Danger zone: `settings` (default configuration, preferences forgotten), `history` (this configuration's), `allHistory` (every configuration's) or `everything`. Each thing reset is first kept as a dated copy; returns `{copies[]}`. The history is reopened empty and the declared channels created again; then `config:changed` is sent. |239 | `Reset(choice)` | The Danger zone: `settings` (default configuration, preferences forgotten), `history` (this configuration's), `allHistory` (every configuration's) or `everything`. Each thing reset is first kept as a dated copy; returns `{copies[]}`. The history is reopened empty and the declared channels created again; then `config:changed` is sent. |
237 240
241+## `CreatorService`
242+
243+The assistant that creates a mini-me agent (issue #94, [How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)). Sidekicks is the ACP client of `mm --acp-create --project yes --output .mm/agent.yaml` (mini-me 1.0.9 and later): mm's `mm init` wizard, with the `.mm` layout imposed and neither of those two questions asked. Sidekicks advertises `clientCapabilities.elicitation.form` and shows each `elicitation/create` form of mm (fields in the order of `required`; `string` with `enum` → choice, `boolean`, `array` → several choices, `number`, other `string` → text). The wizard works in a temporary folder `<agentsFolder>/.sidekicks-new-agent-…`, because the agent's name, which names its folder, comes near the end. One wizard at a time.
244+
245+| Method | Effect |
246+| --- | --- |
247+| `Start()` | Runs `mm --version` (`mini-me (mm) is not installed`; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed`; a version mm cannot tell is accepted), closes a wizard left open, creates the temporary folder (and removes those older than a day), starts mm there and sends `/start`. Returns `{view, agentsFolder, version}`. |
248+| `Answer(answer)` | Answers the form shown: `{action: "accept", content: {name: value…}}`, `decline` or `cancel`. Returns the next `view`. |
249+| `Send(text)` | Sends a message to mm (`/back`, `/restart`, `/start`…); refused while a form waits (decline it first). Returns the next `view`. |
250+| `Finish({name, icon, environment})` | Renames the temporary folder `<agentsFolder>/<name>` (mode 0755), then, for `container` or `sbx`, starts mm again in it and sends `/dockerinit` or `/sbxinit`; adds the agent with `mm --acp --config <folder>/.mm/agent.yaml`, through `docker exec -i <container>` or `sbx exec -i <sandbox>` with the lifecycle commands of the `compose.yaml` or `sbxenv.yaml` (as the "add an agent" assistant does with a dropped file), its title from `acp.title`. Returns `{problem, problems[], name, folder, messages[]}`: `problem` is `nameTaken`, `folderExists` or `invalidName` when nothing was changed and another name can be tried; `problems` are the configuration's. An existing folder is never touched. |
251+| `Cancel()` | Stops mm; before `Finish`, removes the temporary folder. Also done when Sidekicks quits. |
252+
253+A `view` is `{messages[], form, written, name, title}`: mm's messages since the last call (each one whole), the form waiting (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` when none), and, once `.mm/agent.yaml` exists, `written` with mm's `acp.name` (turned into a valid name) and `acp.title`. The page shows mm's `⚠️` messages and folds the others; a `model` field asked as text means that no model server answered.
254+
238 ## Tools offered to the agents255 ## Tools offered to the agents
239 256
240 Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent).257 Issues #90 and #91. Sidekicks offers every agent six tools, as [`agentTools`](configuration.md#agenttools) allows (all by default), with mini-me's protocol (`org.mini-me/tools`, ACP extension methods). An agent that knows it (`acp.clientTools` in an `mm` file) gives them to its model as `client_<name>`; the others ignore them. Few ACP agents discover a client's tools: among the agents Sidekicks documents, only mini-me does (not Claude, Codex, Gemini nor docker-agent).
modified docs/en/reference/configuration.md +1 -0
@@ -39,6 +39,7 @@ The file is looked up in this order; the first one that applies wins:
3939 | `ui` | object | no | | Interface preferences. |
4040 | `limits` | object | no | | Resource limits. |
4141 | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). |
42+| `agentsFolder` | path | no | `~/Documents` | Where the assistant that creates mini-me agents makes one folder per agent ([How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)): absolute, `~/…`, or relative to this file. Created when missing. |
4243 | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. |
4344 | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. |
4445
@@ -39,6 +39,7 @@ The file is looked up in this order; the first one that applies wins:
39 | `ui` | object | no | | Interface preferences. |39 | `ui` | object | no | | Interface preferences. |
40 | `limits` | object | no | | Resource limits. |40 | `limits` | object | no | | Resource limits. |
41 | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). |41 | `agentTools` | object | no | | The tools Sidekicks offers the agents ([below](#agenttools)). |
42+| `agentsFolder` | path | no | `~/Documents` | Where the assistant that creates mini-me agents makes one folder per agent ([How to create a mini-me agent](../how-to/create-a-mini-me-agent.md)): absolute, `~/…`, or relative to this file. Created when missing. |
42 | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. |43 | `agents` | list of agents | yes | | The agents available with `@name`. May be empty. |
43 | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. |44 | `channels` | list of channels | no | `[]` | Channels created at startup when they do not exist yet. |
44 45
modified docs/en/reference/keyboard-shortcuts.md +1 -1
@@ -25,7 +25,7 @@ On Linux and Windows, when the cursor is in an agent's terminal, the terminal ke
2525 | Enter | Runs the selection |
2626 | Escape, or a click outside | Closes the palette |
2727
28-The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, and **Open a configuration…**.
28+The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent** and **Open a configuration…**.
2929
3030 ## Message box
3131
@@ -25,7 +25,7 @@ On Linux and Windows, when the cursor is in an agent's terminal, the terminal ke
25 | Enter | Runs the selection |25 | Enter | Runs the selection |
26 | Escape, or a click outside | Closes the palette |26 | Escape, or a click outside | Closes the palette |
27 27
28-The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, and **Open a configuration…**.28+The palette lists, in order: the channels, a conversation per agent, the files of each agent, the actions of the table above, **Create a mini-me agent** and **Open a configuration…**.
29 29
30 ## Message box30 ## Message box
31 31
modified docs/fr/README.md +1 -1
@@ -7,7 +7,7 @@ Cette documentation suit la méthode [Diátaxis](https://diataxis.fr) : choisiss
77 | Vous voulez… | Section | Pages |
88 | --- | --- | --- |
99 | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) |
10-| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) |
10+| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) |
1111 | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) |
1212 | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) |
1313
@@ -7,7 +7,7 @@ Cette documentation suit la méthode [Diátaxis](https://diataxis.fr) : choisiss
7 | Vous voulez… | Section | Pages |7 | Vous voulez… | Section | Pages |
8 | --- | --- | --- |8 | --- | --- | --- |
9 | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) |9 | **apprendre** en pratiquant | Tutoriels | [Votre premier agent, sans écrire de configuration](tutorials/premier-agent.md) · [Un channel avec deux agents](tutorials/premier-channel.md) · [Votre première conversation avec un agent](tutorials/premiere-conversation.md) · [Votre premier lancement de Sidekicks](tutorials/premier-lancement.md) · [Votre premier échange ACP avec un agent de test](tutorials/premier-echange-acp.md) |
10-| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) |10+| **réaliser** une tâche précise | Guides pratiques | [Installer Sidekicks](how-to/installer-sidekicks.md) · [Créer un agent mini-me](how-to/creer-un-agent-mini-me.md) · [Ajouter un agent](how-to/ajouter-un-agent.md) · [Travailler avec les fichiers et le terminal d'un agent](how-to/fichiers-et-terminal-d-un-agent.md) · [Lancer un agent dans un conteneur Docker](how-to/lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox sbx](how-to/lancer-un-agent-dans-une-sandbox.md) · [Ajouter un agent Claude dans une sandbox sbx](how-to/ajouter-un-agent-claude-dans-une-sandbox.md) · [Ajouter un agent Codex dans une sandbox sbx](how-to/ajouter-un-agent-codex-dans-une-sandbox.md) · [Ajouter un agent Gemini dans une sandbox sbx](how-to/ajouter-un-agent-gemini-dans-une-sandbox.md) · [Joindre des fichiers à un message](how-to/joindre-des-fichiers-a-un-message.md) · [Gérer les channels et leurs agents](how-to/gerer-les-channels.md) · [Modifier ou changer la configuration](how-to/modifier-ou-changer-la-configuration.md) · [Repartir de zéro](how-to/repartir-de-zero.md) · [Surveiller la pression mémoire](how-to/surveiller-la-pression-memoire.md) · [Laisser un agent utiliser les outils de Sidekicks](how-to/utiliser-les-outils-de-sidekicks-depuis-un-agent.md) · [Développer l'application](how-to/developper-l-application.md) · [Lancer les tests](how-to/lancer-les-tests.md) · [Vérifier une modification avant de la fusionner](how-to/verifier-avant-de-fusionner.md) · [Lancer un agent de test](how-to/lancer-un-agent-de-test.md) · [Dérouler les scénarios de bout en bout (v0.1)](how-to/derouler-les-scenarios-de-bout-en-bout.md) · [Définir la version](how-to/definir-la-version.md) · [Tester la CI locale (temporaire)](how-to/tester-la-ci-locale.md) · [Publier une release](how-to/publier-une-release.md) · [Signer et notariser pour macOS](how-to/signer-et-notariser-sous-macos.md) · [Tester l'issue #52 sous macOS](how-to/tester-l-issue-52-sous-macos.md) · [Tester les issues #49 et #50 sous macOS](how-to/tester-les-issues-49-et-50-sous-macos.md) · [Tester l'issue #47 sous macOS](how-to/tester-l-issue-47-sous-macos.md) · [Tester la milestone M4 sous macOS](how-to/tester-la-milestone-m4-sous-macos.md) · [Tester la milestone M3 sous macOS](how-to/tester-la-milestone-m3-sous-macos.md) · [Tester la milestone M2 sous macOS](how-to/tester-la-milestone-m2-sous-macos.md) · [Tester la milestone M1 sous macOS](how-to/tester-la-milestone-m1-sous-macos.md) · [Tester la milestone Initialize sous macOS](how-to/tester-la-milestone-initialize-sous-macos.md) |
11 | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) |11 | **consulter** un détail exact | Référence | [Le fichier de configuration](reference/configuration.md) · [Raccourcis clavier](reference/raccourcis-clavier.md) · [Agents, channels et événements](reference/agents-et-evenements.md) · [Commandes](reference/commandes.md) · [scripts/agents.sh](reference/script-agents.md) |
12 | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) |12 | **comprendre** le pourquoi | Explications | [Workspaces et terminaux](explanation/workspaces-et-terminaux.md) · [Les channels et ce que sait chaque agent](explanation/channels-et-contexte.md) · [Permissions et confiance](explanation/permissions-et-confiance.md) · [Pourquoi ACP](explanation/pourquoi-acp.md) · [La stack de l'interface](explanation/stack-interface.md) · [Architecture](explanation/architecture.md) · [Mémoire et modèles locaux](explanation/memoire-et-modeles-locaux.md) |
13 13
modified docs/fr/explanation/permissions-et-confiance.md +4 -0
@@ -20,6 +20,10 @@ Les petits modèles locaux n'acceptent pas un refus. Pendant le spike ACP, Riker
2020
2121 La carte apparaît dans la conversation de l'agent qui demande, pas dans une fenêtre par-dessus tout : les autres conversations continuent, et la question reste à côté de ce qui l'a amenée. Arrêter l'agent répond « annulé » à ses questions en attente, comme ACP l'exige.
2222
23+## Les questions d'un agent
24+
25+Un agent peut aussi poser des questions à l'utilisateur — l'outil `ask_user` de mini-me le fait — avec un formulaire ACP (`elicitation/create`). Sidekicks dit à chaque agent qu'il sait afficher des formulaires, et montre chacun comme une carte dans la conversation de sa session, sous la réponse qui le pose, comme une carte de permission : texte libre, choix, plusieurs choix, oui ou non ; **Répondre**, **Refuser** et **Arrêter**. Sans formulaires, mini-me ne pouvait poser que des choix sous forme de boutons de permission, et une question qui demande un texte ne pouvait pas être posée du tout (issue #95).
26+
2327 ## Alternatives écartées
2428
2529 - **Une fenêtre modale** : elle bloque toutes les conversations pour la question d'un seul agent.
@@ -20,6 +20,10 @@ Les petits modèles locaux n'acceptent pas un refus. Pendant le spike ACP, Riker
20 20
21 La carte apparaît dans la conversation de l'agent qui demande, pas dans une fenêtre par-dessus tout : les autres conversations continuent, et la question reste à côté de ce qui l'a amenée. Arrêter l'agent répond « annulé » à ses questions en attente, comme ACP l'exige.21 La carte apparaît dans la conversation de l'agent qui demande, pas dans une fenêtre par-dessus tout : les autres conversations continuent, et la question reste à côté de ce qui l'a amenée. Arrêter l'agent répond « annulé » à ses questions en attente, comme ACP l'exige.
22 22
23+## Les questions d'un agent
24+
25+Un agent peut aussi poser des questions à l'utilisateur — l'outil `ask_user` de mini-me le fait — avec un formulaire ACP (`elicitation/create`). Sidekicks dit à chaque agent qu'il sait afficher des formulaires, et montre chacun comme une carte dans la conversation de sa session, sous la réponse qui le pose, comme une carte de permission : texte libre, choix, plusieurs choix, oui ou non ; **Répondre**, **Refuser** et **Arrêter**. Sans formulaires, mini-me ne pouvait poser que des choix sous forme de boutons de permission, et une question qui demande un texte ne pouvait pas être posée du tout (issue #95).
26+
23 ## Alternatives écartées27 ## Alternatives écartées
24 28
25 - **Une fenêtre modale** : elle bloque toutes les conversations pour la question d'un seul agent.29 - **Une fenêtre modale** : elle bloque toutes les conversations pour la question d'un seul agent.
modified docs/fr/how-to/ajouter-un-agent.md +1 -0
@@ -24,6 +24,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass
2424
2525 ## Voir aussi
2626
27+- Pour créer un nouvel agent mini-me en répondant à des questions, sans fichier ni dossier à choisir : [Créer un agent mini-me](creer-un-agent-mini-me.md)
2728 - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md)
2829 - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md)
2930 - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md)
@@ -24,6 +24,7 @@ Quand l'agent ne peut pas être ajouté (un nom déjà pris, par exemple), l'ass
24 24
25 ## Voir aussi25 ## Voir aussi
26 26
27+- Pour créer un nouvel agent mini-me en répondant à des questions, sans fichier ni dossier à choisir : [Créer un agent mini-me](creer-un-agent-mini-me.md)
27 - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md)28 - Ce que l'assistant écrit : [Le fichier de configuration](../reference/configuration.md)
28 - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md)29 - [Modifier ou changer la configuration](modifier-ou-changer-la-configuration.md)
29 - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md)30 - [Tutoriel : votre premier agent, sans écrire de configuration](../tutorials/premier-agent.md)
added docs/fr/how-to/creer-un-agent-mini-me.md +36 -0
new file mode 100644
@@ -0,0 +1,36 @@
1+# Créer un agent mini-me
2+
3+Ce guide montre comment créer un nouvel agent [mini-me](https://git.rickub.com/bots-garden/mini-me) depuis la fenêtre de Sidekicks, en répondant à des questions, sans écrire de fichier ni choisir de dossier. Il suppose que mini-me (`mm`) **1.0.9 ou plus récent** est installé, et qu'un serveur de modèles tourne (Docker Model Runner, llmman, Ollama…) : les questions listent ses modèles. Pour ajouter un agent qui existe déjà, ou un autre programme que mini-me, suivez plutôt [Ajouter un agent](ajouter-un-agent.md).
4+
5+## Étapes
6+
7+1. Ouvrez l'assistant : **✨ Créer mon premier agent** sur l'écran d'accueil, **✨ Créer un agent mini-me** sous la liste des agents, ou **Créer un agent mini-me** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows).
8+2. Répondez aux questions de mini-me, quelques-unes à la fois : le serveur de modèles, le modèle, à quoi sert l'agent, quelle machine fait tourner le modèle, s'il demande avant chaque commande ou modification de fichier, le nom de l'agent… Chaque question arrive avec la valeur par défaut de mini-me : **Suivant →** la prend. **À propos de ces choix** explique les options. Les questions sont celles de mini-me, en anglais.
9+3. Quand mini-me a écrit l'agent, donnez ses derniers détails :
10+ - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me ; minuscules, chiffres, `-` et `_`, en commençant par une lettre.
11+ - **Emoji** : choisissez-en un, ou tapez n'importe quel emoji.
12+ - **Où s'exécute-t-il ?** **Sur cet ordinateur** (le plus simple), **Dans un conteneur Docker** (Docker doit être installé) ou **Dans une Docker Sandbox (sbx)** (sbx doit être installé).
13+4. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre : écrivez-lui.
14+
15+Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/marcel`). Ses réglages y sont dans `.mm/agent.yaml` ; pour un conteneur ou une sandbox, mini-me écrit aussi `Dockerfile` et `compose.yaml`, ou `sbxenv.yaml`, et Sidekicks crée le conteneur ou la sandbox au premier démarrage de l'agent.
16+
17+## Quand quelque chose ne va pas
18+
19+- **« mini-me (mm) n'est pas installé sur cet ordinateur »** : installez mini-me, puis cliquez sur **Réessayer**. S'il est installé mais que Sidekicks a été ouvert depuis le Finder, quittez Sidekicks et rouvrez-le : il lit le `PATH` de votre shell au démarrage.
20+- **« mini-me 1.0.8 est installé, mais cet assistant a besoin de mini-me 1.0.9 ou plus récent »** : mettez mini-me à jour, puis cliquez sur **Réessayer**.
21+- **« Aucun serveur de modèles n'a répondu »** : le modèle est alors demandé en texte. Démarrez votre serveur de modèles, puis cliquez sur **Recommencer** ; ou tapez vous-même le nom du modèle si vous le connaissez.
22+- **« Un dossier porte déjà ce nom »** ou **« Un autre agent porte déjà ce nom »** : changez le **Nom** et cliquez de nouveau sur **Ajouter l'agent**. Un dossier existant n'est jamais modifié.
23+- **Le Terminal d'un agent en conteneur affiche `I have no name!`** (et `whoami` échoue) : ses fichiers ont été écrits par un mm sans la correction du compte de `mm dockerinit`. Mettez mini-me à jour puis, dans le dossier de l'agent, réécrivez les fichiers et reconstruisez l'image : `rm Dockerfile compose.yaml && mm dockerinit`, puis `docker compose up -d --build` (la commande de création de Sidekicks ne reconstruit pas une image qui existe). Ouvrez un nouveau terminal : le prompt affiche `mm@…`.
24+- **Les questions se sont arrêtées** (après **← Question précédente**, par exemple) : cliquez sur **Continuer** pour reprendre où vous en étiez, ou sur **Recommencer**.
25+
26+## Variantes
27+
28+- **Revenir en arrière** : **← Question précédente** reprend votre dernière réponse et la repose ; **Recommencer** oublie toutes les réponses.
29+- **Abandonner** : **Annuler**, ou ouvrir un channel, ferme l'assistant ; ce que mini-me avait écrit est supprimé.
30+- **Un autre dossier que Documents** : réglez [`agentsFolder`](../reference/configuration.md#racine) dans **Settings**, par exemple `agentsFolder: ~/agents`. Les agents suivants y sont créés.
31+
32+## Voir aussi
33+
34+- [Ajouter un agent](ajouter-un-agent.md) — n'importe quel programme, n'importe quel dossier, avec tous les champs.
35+- [Lancer un agent dans Docker](lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox](lancer-un-agent-dans-une-sandbox.md)
36+- Comment ça marche : [`CreatorService`](../reference/agents-et-evenements.md#creatorservice)
new file mode 100644
@@ -0,0 +1,36 @@
1+# Créer un agent mini-me
2+
3+Ce guide montre comment créer un nouvel agent [mini-me](https://git.rickub.com/bots-garden/mini-me) depuis la fenêtre de Sidekicks, en répondant à des questions, sans écrire de fichier ni choisir de dossier. Il suppose que mini-me (`mm`) **1.0.9 ou plus récent** est installé, et qu'un serveur de modèles tourne (Docker Model Runner, llmman, Ollama…) : les questions listent ses modèles. Pour ajouter un agent qui existe déjà, ou un autre programme que mini-me, suivez plutôt [Ajouter un agent](ajouter-un-agent.md).
4+
5+## Étapes
6+
7+1. Ouvrez l'assistant : **✨ Créer mon premier agent** sur l'écran d'accueil, **✨ Créer un agent mini-me** sous la liste des agents, ou **Créer un agent mini-me** dans la palette de commandes (⌘K, Ctrl+K sous Linux et Windows).
8+2. Répondez aux questions de mini-me, quelques-unes à la fois : le serveur de modèles, le modèle, à quoi sert l'agent, quelle machine fait tourner le modèle, s'il demande avant chaque commande ou modification de fichier, le nom de l'agent… Chaque question arrive avec la valeur par défaut de mini-me : **Suivant →** la prend. **À propos de ces choix** explique les options. Les questions sont celles de mini-me, en anglais.
9+3. Quand mini-me a écrit l'agent, donnez ses derniers détails :
10+ - **Nom** : ce qui l'appelle dans une conversation (`@marcel`), et le nom de son dossier. Il part du nom donné à mini-me ; minuscules, chiffres, `-` et `_`, en commençant par une lettre.
11+ - **Emoji** : choisissez-en un, ou tapez n'importe quel emoji.
12+ - **Où s'exécute-t-il ?** **Sur cet ordinateur** (le plus simple), **Dans un conteneur Docker** (Docker doit être installé) ou **Dans une Docker Sandbox (sbx)** (sbx doit être installé).
13+4. Cliquez sur **Ajouter l'agent**. Sa conversation directe s'ouvre : écrivez-lui.
14+
15+Le dossier de l'agent est créé dans votre dossier **Documents**, au nom de l'agent (`~/Documents/marcel`). Ses réglages y sont dans `.mm/agent.yaml` ; pour un conteneur ou une sandbox, mini-me écrit aussi `Dockerfile` et `compose.yaml`, ou `sbxenv.yaml`, et Sidekicks crée le conteneur ou la sandbox au premier démarrage de l'agent.
16+
17+## Quand quelque chose ne va pas
18+
19+- **« mini-me (mm) n'est pas installé sur cet ordinateur »** : installez mini-me, puis cliquez sur **Réessayer**. S'il est installé mais que Sidekicks a été ouvert depuis le Finder, quittez Sidekicks et rouvrez-le : il lit le `PATH` de votre shell au démarrage.
20+- **« mini-me 1.0.8 est installé, mais cet assistant a besoin de mini-me 1.0.9 ou plus récent »** : mettez mini-me à jour, puis cliquez sur **Réessayer**.
21+- **« Aucun serveur de modèles n'a répondu »** : le modèle est alors demandé en texte. Démarrez votre serveur de modèles, puis cliquez sur **Recommencer** ; ou tapez vous-même le nom du modèle si vous le connaissez.
22+- **« Un dossier porte déjà ce nom »** ou **« Un autre agent porte déjà ce nom »** : changez le **Nom** et cliquez de nouveau sur **Ajouter l'agent**. Un dossier existant n'est jamais modifié.
23+- **Le Terminal d'un agent en conteneur affiche `I have no name!`** (et `whoami` échoue) : ses fichiers ont été écrits par un mm sans la correction du compte de `mm dockerinit`. Mettez mini-me à jour puis, dans le dossier de l'agent, réécrivez les fichiers et reconstruisez l'image : `rm Dockerfile compose.yaml && mm dockerinit`, puis `docker compose up -d --build` (la commande de création de Sidekicks ne reconstruit pas une image qui existe). Ouvrez un nouveau terminal : le prompt affiche `mm@…`.
24+- **Les questions se sont arrêtées** (après **← Question précédente**, par exemple) : cliquez sur **Continuer** pour reprendre où vous en étiez, ou sur **Recommencer**.
25+
26+## Variantes
27+
28+- **Revenir en arrière** : **← Question précédente** reprend votre dernière réponse et la repose ; **Recommencer** oublie toutes les réponses.
29+- **Abandonner** : **Annuler**, ou ouvrir un channel, ferme l'assistant ; ce que mini-me avait écrit est supprimé.
30+- **Un autre dossier que Documents** : réglez [`agentsFolder`](../reference/configuration.md#racine) dans **Settings**, par exemple `agentsFolder: ~/agents`. Les agents suivants y sont créés.
31+
32+## Voir aussi
33+
34+- [Ajouter un agent](ajouter-un-agent.md) — n'importe quel programme, n'importe quel dossier, avec tous les champs.
35+- [Lancer un agent dans Docker](lancer-un-agent-dans-docker.md) · [Lancer un agent dans une sandbox](lancer-un-agent-dans-une-sandbox.md)
36+- Comment ça marche : [`CreatorService`](../reference/agents-et-evenements.md#creatorservice)
modified docs/fr/reference/agents-et-evenements.md +19 -2
@@ -124,6 +124,8 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
124124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | le channel commence ou arrête de répondre, ou le tour d'un agent commence ou finit ; `queued` messages attendent ; `answerers` sont tous les agents qui répondent (plusieurs après `/parallel`), `answering` le premier d'entre eux |
125125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | un agent demande à utiliser un outil ; `rejections` compte les refus déjà donnés pendant ce tour |
126126 | `permission:resolved` | `{id, channel}` | la demande a reçu une réponse, ou a été annulée par Stop |
127+| `form:requested` | `{id, channel, agent, messageId, form: {message, fields[], sessionId, toolCallId}}` | un agent demande à l'utilisateur de remplir un formulaire (`elicitation/create` d'ACP, mode formulaire ; `ask_user` de mini-me, issue #95) ; les champs sont ceux des formulaires de [`CreatorService`](#creatorservice) |
128+| `form:resolved` | `{id, channel}` | le formulaire a reçu une réponse ou a été refusé, ou a été annulé par Stop ou la fin du tour |
127129 | `usage:changed` | `{channel, agent, usage: {used, size}}` | un agent a indiqué l'occupation de sa fenêtre de contexte (`size` vaut 0 si elle est inconnue) |
128130 | `commands:changed` | `{agent, commands[]}` | un agent a annoncé ses commandes slash (`name, description, hint`) |
129131
@@ -139,9 +141,10 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
139141 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invite ou retire un agent ; le channel affiche `agent-joined` ou `agent-left`. |
140142 | `Direct(agent)` | La conversation directe avec `agent`, créée la première fois. |
141143 | `Send(id, text)` | Ajoute un message de l'utilisateur et renvoie son id ; les agents qui répondent sont démarrés si besoin ; le message attend si le channel répond déjà. Un texte vide ou un channel inconnu sont des erreurs. Chaque `$chemin` joint un fichier du dossier d'un agent (voir [Fichiers joints](#fichiers-joints)) ; plus de 10 est une erreur. |
142-| `Cancel(id)` | Arrête la réponse en cours (`session/cancel`), les agents qui devaient encore répondre et les messages en attente ; répond « cancelled » aux demandes de permission en attente. |
144+| `Cancel(id)` | Arrête la réponse en cours (`session/cancel`), les agents qui devaient encore répondre et les messages en attente ; répond « cancelled » aux demandes de permission et aux formulaires en attente. |
143145 | `AnswerPermission(id, optionId)` | Répond à une demande en attente avec l'une de ses options. |
144-| `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions`. |
146+| `AnswerForm(id, answer)` | Répond à un formulaire en attente : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Un formulaire ou une action inconnus sont une erreur. |
147+| `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
145148 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |
146149 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |
147150 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |
@@ -235,6 +238,20 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident
235238 | `ChooseCompose()` | Le sélecteur de fichier natif, pour un fichier Compose. |
236239 | `Reset(choice)` | La Danger zone : `settings` (configuration par défaut, préférences oubliées), `history` (celui de cette configuration), `allHistory` (celui de toutes les configurations) ou `everything`. Chaque élément réinitialisé est d'abord gardé en copie datée ; renvoie `{copies[]}`. L'historique est rouvert vide et les channels déclarés sont recréés ; puis `config:changed` est envoyé. |
237240
241+## `CreatorService`
242+
243+L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)). Sidekicks est le client ACP de `mm --acp-create --project yes --output .mm/agent.yaml` (mini-me 1.0.9 et plus récent) : l'assistant `mm init` de mm, avec la disposition `.mm` imposée et sans poser ces deux questions. Sidekicks annonce `clientCapabilities.elicitation.form` et affiche chaque formulaire `elicitation/create` de mm (champs dans l'ordre de `required` ; `string` avec `enum` → choix, `boolean`, `array` → plusieurs choix, `number`, autre `string` → texte). L'assistant travaille dans un dossier temporaire `<agentsFolder>/.sidekicks-new-agent-…`, parce que le nom de l'agent, qui nomme son dossier, arrive vers la fin. Un assistant à la fois.
244+
245+| Méthode | Effet |
246+| --- | --- |
247+| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version}`. |
248+| `Answer(answer)` | Répond au formulaire affiché : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Renvoie la `view` suivante. |
249+| `Send(text)` | Envoie un message à mm (`/back`, `/restart`, `/start`…) ; refusé tant qu'un formulaire attend (le refuser d'abord). Renvoie la `view` suivante. |
250+| `Finish({name, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre venant de `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. |
251+| `Cancel()` | Arrête mm ; avant `Finish`, supprime le dossier temporaire. Fait aussi quand Sidekicks se ferme. |
252+
253+Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu.
254+
238255 ## Outils proposés aux agents
239256
240257 Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent).
@@ -124,6 +124,8 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | le channel commence ou arrête de répondre, ou le tour d'un agent commence ou finit ; `queued` messages attendent ; `answerers` sont tous les agents qui répondent (plusieurs après `/parallel`), `answering` le premier d'entre eux |124 | `turn:changed` | `{channel, busy, queued, answering, answerers}` | le channel commence ou arrête de répondre, ou le tour d'un agent commence ou finit ; `queued` messages attendent ; `answerers` sont tous les agents qui répondent (plusieurs après `/parallel`), `answering` le premier d'entre eux |
125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | un agent demande à utiliser un outil ; `rejections` compte les refus déjà donnés pendant ce tour |125 | `permission:requested` | `{id, channel, agent, messageId, toolCall, options[], rejections}` | un agent demande à utiliser un outil ; `rejections` compte les refus déjà donnés pendant ce tour |
126 | `permission:resolved` | `{id, channel}` | la demande a reçu une réponse, ou a été annulée par Stop |126 | `permission:resolved` | `{id, channel}` | la demande a reçu une réponse, ou a été annulée par Stop |
127+| `form:requested` | `{id, channel, agent, messageId, form: {message, fields[], sessionId, toolCallId}}` | un agent demande à l'utilisateur de remplir un formulaire (`elicitation/create` d'ACP, mode formulaire ; `ask_user` de mini-me, issue #95) ; les champs sont ceux des formulaires de [`CreatorService`](#creatorservice) |
128+| `form:resolved` | `{id, channel}` | le formulaire a reçu une réponse ou a été refusé, ou a été annulé par Stop ou la fin du tour |
127 | `usage:changed` | `{channel, agent, usage: {used, size}}` | un agent a indiqué l'occupation de sa fenêtre de contexte (`size` vaut 0 si elle est inconnue) |129 | `usage:changed` | `{channel, agent, usage: {used, size}}` | un agent a indiqué l'occupation de sa fenêtre de contexte (`size` vaut 0 si elle est inconnue) |
128 | `commands:changed` | `{agent, commands[]}` | un agent a annoncé ses commandes slash (`name, description, hint`) |130 | `commands:changed` | `{agent, commands[]}` | un agent a annoncé ses commandes slash (`name, description, hint`) |
129 131
@@ -139,9 +141,10 @@ Un appel d'outil a `id, title, kind` (`read, edit, delete, move, search, execute
139 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invite ou retire un agent ; le channel affiche `agent-joined` ou `agent-left`. |141 | `AddMember(id, agent)`, `RemoveMember(id, agent)` | Invite ou retire un agent ; le channel affiche `agent-joined` ou `agent-left`. |
140 | `Direct(agent)` | La conversation directe avec `agent`, créée la première fois. |142 | `Direct(agent)` | La conversation directe avec `agent`, créée la première fois. |
141 | `Send(id, text)` | Ajoute un message de l'utilisateur et renvoie son id ; les agents qui répondent sont démarrés si besoin ; le message attend si le channel répond déjà. Un texte vide ou un channel inconnu sont des erreurs. Chaque `$chemin` joint un fichier du dossier d'un agent (voir [Fichiers joints](#fichiers-joints)) ; plus de 10 est une erreur. |143 | `Send(id, text)` | Ajoute un message de l'utilisateur et renvoie son id ; les agents qui répondent sont démarrés si besoin ; le message attend si le channel répond déjà. Un texte vide ou un channel inconnu sont des erreurs. Chaque `$chemin` joint un fichier du dossier d'un agent (voir [Fichiers joints](#fichiers-joints)) ; plus de 10 est une erreur. |
142-| `Cancel(id)` | Arrête la réponse en cours (`session/cancel`), les agents qui devaient encore répondre et les messages en attente ; répond « cancelled » aux demandes de permission en attente. |144+| `Cancel(id)` | Arrête la réponse en cours (`session/cancel`), les agents qui devaient encore répondre et les messages en attente ; répond « cancelled » aux demandes de permission et aux formulaires en attente. |
143 | `AnswerPermission(id, optionId)` | Répond à une demande en attente avec l'une de ses options. |145 | `AnswerPermission(id, optionId)` | Répond à une demande en attente avec l'une de ses options. |
144-| `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions`. |146+| `AnswerForm(id, answer)` | Répond à un formulaire en attente : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Un formulaire ou une action inconnus sont une erreur. |
147+| `Conversation(id)` | `channel, messages` (les 100 derniers), `more, busy, queued, answering, answerers, usage{agent: …}, permissions, forms`. |
145 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |148 | `Older(id, beforeId)` | `{messages, more}` : les 100 messages précédant `beforeId`. |
146 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |149 | `Commands(agent)` | Les dernières commandes annoncées par l'agent, gardées d'un lancement à l'autre ; vide s'il n'en a jamais annoncé. |
147 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |150 | `Prepare(id)` | Démarre les membres du channel qui n'ont jamais annoncé leurs commandes et ouvre leur session pour ce channel (aucun modèle n'est chargé) ; rend la main une fois les sessions ouvertes, les commandes arrivent par `commands:changed`. Un membre qui répond ailleurs est ignoré. La session sert la première réponse du membre, à qui l'on donne quand même le passé du channel. |
@@ -235,6 +238,20 @@ Un fichier ouvert pour modification a `path, content, version` ; `version` ident
235 | `ChooseCompose()` | Le sélecteur de fichier natif, pour un fichier Compose. |238 | `ChooseCompose()` | Le sélecteur de fichier natif, pour un fichier Compose. |
236 | `Reset(choice)` | La Danger zone : `settings` (configuration par défaut, préférences oubliées), `history` (celui de cette configuration), `allHistory` (celui de toutes les configurations) ou `everything`. Chaque élément réinitialisé est d'abord gardé en copie datée ; renvoie `{copies[]}`. L'historique est rouvert vide et les channels déclarés sont recréés ; puis `config:changed` est envoyé. |239 | `Reset(choice)` | La Danger zone : `settings` (configuration par défaut, préférences oubliées), `history` (celui de cette configuration), `allHistory` (celui de toutes les configurations) ou `everything`. Chaque élément réinitialisé est d'abord gardé en copie datée ; renvoie `{copies[]}`. L'historique est rouvert vide et les channels déclarés sont recréés ; puis `config:changed` est envoyé. |
237 240
241+## `CreatorService`
242+
243+L'assistant qui crée un agent mini-me (issue #94, [Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)). Sidekicks est le client ACP de `mm --acp-create --project yes --output .mm/agent.yaml` (mini-me 1.0.9 et plus récent) : l'assistant `mm init` de mm, avec la disposition `.mm` imposée et sans poser ces deux questions. Sidekicks annonce `clientCapabilities.elicitation.form` et affiche chaque formulaire `elicitation/create` de mm (champs dans l'ordre de `required` ; `string` avec `enum` → choix, `boolean`, `array` → plusieurs choix, `number`, autre `string` → texte). L'assistant travaille dans un dossier temporaire `<agentsFolder>/.sidekicks-new-agent-…`, parce que le nom de l'agent, qui nomme son dossier, arrive vers la fin. Un assistant à la fois.
244+
245+| Méthode | Effet |
246+| --- | --- |
247+| `Start()` | Lance `mm --version` (`mini-me (mm) is not installed` ; `mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed` ; une version que mm ne sait pas dire est acceptée), ferme un assistant resté ouvert, crée le dossier temporaire (et supprime ceux de plus d'un jour), y démarre mm et envoie `/start`. Renvoie `{view, agentsFolder, version}`. |
248+| `Answer(answer)` | Répond au formulaire affiché : `{action: "accept", content: {nom: valeur…}}`, `decline` ou `cancel`. Renvoie la `view` suivante. |
249+| `Send(text)` | Envoie un message à mm (`/back`, `/restart`, `/start`…) ; refusé tant qu'un formulaire attend (le refuser d'abord). Renvoie la `view` suivante. |
250+| `Finish({name, icon, environment})` | Renomme le dossier temporaire en `<agentsFolder>/<name>` (mode 0755), puis, pour `container` ou `sbx`, y redémarre mm et envoie `/dockerinit` ou `/sbxinit` ; ajoute l'agent avec `mm --acp --config <dossier>/.mm/agent.yaml`, à travers `docker exec -i <conteneur>` ou `sbx exec -i <sandbox>` avec les commandes de cycle de vie du `compose.yaml` ou du `sbxenv.yaml` (comme l'assistant « ajouter un agent » avec un fichier déposé), son titre venant de `acp.title`. Renvoie `{problem, problems[], name, folder, messages[]}` : `problem` vaut `nameTaken`, `folderExists` ou `invalidName` quand rien n'a été changé et qu'un autre nom peut être essayé ; `problems` sont ceux de la configuration. Un dossier existant n'est jamais touché. |
251+| `Cancel()` | Arrête mm ; avant `Finish`, supprime le dossier temporaire. Fait aussi quand Sidekicks se ferme. |
252+
253+Une `view` vaut `{messages[], form, written, name, title}` : les messages de mm depuis le dernier appel (chacun entier), le formulaire en attente (`{message, fields[{name, title, description, type, options[], default, required}]}`, `null` sinon) et, dès que `.mm/agent.yaml` existe, `written` avec le `acp.name` de mm (transformé en nom valide) et le `acp.title`. La page affiche les messages `⚠️` de mm et replie les autres ; un champ `model` demandé en texte signifie qu'aucun serveur de modèles n'a répondu.
254+
238 ## Outils proposés aux agents255 ## Outils proposés aux agents
239 256
240 Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent).257 Tickets #90 et #91. Sidekicks propose six outils à chaque agent, dans la limite de [`agentTools`](configuration.md#agenttools) (tous par défaut), avec le protocole de mini-me (`org.mini-me/tools`, méthodes d'extension ACP). Un agent qui le connaît (`acp.clientTools` dans un fichier `mm`) les donne à son modèle sous le nom `client_<nom>` ; les autres les ignorent. Peu d'agents ACP découvrent les outils d'un client : parmi les agents que documente Sidekicks, seul mini-me le fait (ni Claude, ni Codex, ni Gemini, ni docker-agent).
modified docs/fr/reference/configuration.md +1 -0
@@ -39,6 +39,7 @@ Le fichier est cherché dans cet ordre ; la première source applicable l'emport
3939 | `ui` | objet | non | | Préférences d'interface. |
4040 | `limits` | objet | non | | Limites de ressources. |
4141 | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). |
42+| `agentsFolder` | chemin | non | `~/Documents` | Où l'assistant qui crée des agents mini-me fait un dossier par agent ([Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. |
4243 | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. |
4344 | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. |
4445
@@ -39,6 +39,7 @@ Le fichier est cherché dans cet ordre ; la première source applicable l'emport
39 | `ui` | objet | non | | Préférences d'interface. |39 | `ui` | objet | non | | Préférences d'interface. |
40 | `limits` | objet | non | | Limites de ressources. |40 | `limits` | objet | non | | Limites de ressources. |
41 | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). |41 | `agentTools` | objet | non | | Les outils que Sidekicks propose aux agents ([plus bas](#agenttools)). |
42+| `agentsFolder` | chemin | non | `~/Documents` | Où l'assistant qui crée des agents mini-me fait un dossier par agent ([Créer un agent mini-me](../how-to/creer-un-agent-mini-me.md)) : absolu, `~/…`, ou relatif à ce fichier. Créé s'il manque. |
42 | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. |43 | `agents` | liste d'agents | oui | | Les agents disponibles avec `@nom`. Peut être vide. |
43 | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. |44 | `channels` | liste de channels | non | `[]` | Channels créés au démarrage s'ils n'existent pas encore. |
44 45
modified docs/fr/reference/raccourcis-clavier.md +1 -1
@@ -25,7 +25,7 @@ Sous Linux et Windows, quand le curseur est dans le terminal d'un agent, le term
2525 | Entrée | Lance la sélection |
2626 | Échap, ou un clic à côté | Ferme la palette |
2727
28-La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, et **Ouvrir une configuration…**.
28+La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me** et **Ouvrir une configuration…**.
2929
3030 ## Zone de message
3131
@@ -25,7 +25,7 @@ Sous Linux et Windows, quand le curseur est dans le terminal d'un agent, le term
25 | Entrée | Lance la sélection |25 | Entrée | Lance la sélection |
26 | Échap, ou un clic à côté | Ferme la palette |26 | Échap, ou un clic à côté | Ferme la palette |
27 27
28-La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, et **Ouvrir une configuration…**.28+La palette liste, dans l'ordre : les channels, une conversation par agent, les fichiers de chaque agent, les actions du tableau ci-dessus, **Créer un agent mini-me** et **Ouvrir une configuration…**.
29 29
30 ## Zone de message30 ## Zone de message
31 31
added docs/release-notes/v1.5.0.fr.md +43 -0
new file mode 100644
@@ -0,0 +1,43 @@
1+# Sidekicks 1.5.0
2+
3+[English](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.md)
4+
5+Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un assistant en crée un nouveau en répondant à des questions, sans fichier à écrire ni dossier à choisir, et les questions d'un agent ont un vrai formulaire dans la conversation.
6+
7+## Nouveautés
8+
9+### Créer un agent mini-me en répondant à des questions (#94)
10+
11+- **✨ Créer un agent mini-me** — sous la liste des agents, sur l'écran d'accueil (**✨ Créer mon premier agent**) et dans la palette de commandes — déroule dans Sidekicks l'assistant de mini-me (`mm init`) : le serveur de modèles, le modèle, à quoi sert l'agent… chaque question avec sa valeur par défaut, **← Question précédente** et **Recommencer** pour changer d'avis.
12+- Donnez ensuite à l'agent son nom, un emoji, et l'endroit où il tourne : **sur cet ordinateur**, **dans un conteneur Docker** ou **dans une Docker Sandbox (sbx)**. Sidekicks l'ajoute à vos agents et ouvre sa conversation.
13+- Chaque agent a son propre dossier, à son nom, dans votre dossier **Documents** ; ses réglages y sont dans `.mm/agent.yaml`. Pour un conteneur ou une sandbox, mini-me écrit son `compose.yaml` ou son `sbxenv.yaml`, et Sidekicks crée le conteneur ou la sandbox au premier démarrage de l'agent.
14+- Des messages simples quand mini-me n'est pas installé ou trop ancien, quand aucun serveur de modèles ne répond, ou quand le nom est déjà pris. **Annuler** ne laisse rien derrière.
15+
16+→ [Créer un agent mini-me](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-mini-me.md)
17+
18+### Répondre aux questions d'un agent dans un formulaire (#95)
19+
20+- Quand un agent mini-me vous pose une question avec son outil `ask_user`, une carte apparaît dans la conversation, sous sa réponse : un champ où écrire, un choix, plusieurs choix ou oui/non — puis **Répondre**, **Refuser** ou **Arrêter**.
21+- Les questions qui demandent un texte ne pouvaient pas être posées avant : mini-me n'avait que des boutons de permission. Tout agent ACP qui envoie un formulaire (élicitation ACP) a la même carte.
22+
23+→ [Les questions d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/explanation/permissions-et-confiance.md#les-questions-dun-agent)
24+
25+### Petits changements
26+
27+- 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.
28+
29+## Bon à savoir pour la mise à jour
30+
31+- Glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement ; votre configuration et votre historique sont gardés.
32+- Vos fichiers de configuration fonctionnent tels quels. Une nouvelle clé facultative : `agentsFolder`, où l'assistant crée les dossiers des agents (`~/Documents` par défaut).
33+- L'assistant de création a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`).
34+
35+## Fichiers
36+
37+| Fichier | Système |
38+| --- | --- |
39+| `Sidekicks-1.5.0-macos-arm64.dmg` | macOS 13 ou plus récent, Apple Silicon — signé et notarisé |
40+| `Sidekicks-1.5.0-macos-arm64.zip` | la même application, dans un `.zip` |
41+| `Sidekicks-1.5.0-windows-amd64-installer.exe`, `Sidekicks-1.5.0-windows-arm64-installer.exe` | Windows, x86-64 ou Arm — installeur (ajoute WebView2 s'il manque ; non signé : SmartScreen demande une fois) |
42+| `sidekicks_1.5.0_windows_amd64.zip`, `sidekicks_1.5.0_windows_arm64.zip` | le `sidekicks.exe` seul, là où WebView2 est déjà présent |
43+| `SHA256SUMS` | sommes de contrôle : `shasum -a 256 -c SHA256SUMS --ignore-missing` |
new file mode 100644
@@ -0,0 +1,43 @@
1+# Sidekicks 1.5.0
2+
3+[English](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.md)
4+
5+Sidekicks 1.5.0 rend les agents mini-me plus faciles pour tout le monde : un assistant en crée un nouveau en répondant à des questions, sans fichier à écrire ni dossier à choisir, et les questions d'un agent ont un vrai formulaire dans la conversation.
6+
7+## Nouveautés
8+
9+### Créer un agent mini-me en répondant à des questions (#94)
10+
11+- **✨ Créer un agent mini-me** — sous la liste des agents, sur l'écran d'accueil (**✨ Créer mon premier agent**) et dans la palette de commandes — déroule dans Sidekicks l'assistant de mini-me (`mm init`) : le serveur de modèles, le modèle, à quoi sert l'agent… chaque question avec sa valeur par défaut, **← Question précédente** et **Recommencer** pour changer d'avis.
12+- Donnez ensuite à l'agent son nom, un emoji, et l'endroit où il tourne : **sur cet ordinateur**, **dans un conteneur Docker** ou **dans une Docker Sandbox (sbx)**. Sidekicks l'ajoute à vos agents et ouvre sa conversation.
13+- Chaque agent a son propre dossier, à son nom, dans votre dossier **Documents** ; ses réglages y sont dans `.mm/agent.yaml`. Pour un conteneur ou une sandbox, mini-me écrit son `compose.yaml` ou son `sbxenv.yaml`, et Sidekicks crée le conteneur ou la sandbox au premier démarrage de l'agent.
14+- Des messages simples quand mini-me n'est pas installé ou trop ancien, quand aucun serveur de modèles ne répond, ou quand le nom est déjà pris. **Annuler** ne laisse rien derrière.
15+
16+→ [Créer un agent mini-me](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/how-to/creer-un-agent-mini-me.md)
17+
18+### Répondre aux questions d'un agent dans un formulaire (#95)
19+
20+- Quand un agent mini-me vous pose une question avec son outil `ask_user`, une carte apparaît dans la conversation, sous sa réponse : un champ où écrire, un choix, plusieurs choix ou oui/non — puis **Répondre**, **Refuser** ou **Arrêter**.
21+- Les questions qui demandent un texte ne pouvaient pas être posées avant : mini-me n'avait que des boutons de permission. Tout agent ACP qui envoie un formulaire (élicitation ACP) a la même carte.
22+
23+→ [Les questions d'un agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/fr/explanation/permissions-et-confiance.md#les-questions-dun-agent)
24+
25+### Petits changements
26+
27+- 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.
28+
29+## Bon à savoir pour la mise à jour
30+
31+- Glissez le nouveau **sidekicks** dans **Applications** et confirmez le remplacement ; votre configuration et votre historique sont gardés.
32+- Vos fichiers de configuration fonctionnent tels quels. Une nouvelle clé facultative : `agentsFolder`, où l'assistant crée les dossiers des agents (`~/Documents` par défaut).
33+- L'assistant de création a besoin de mini-me (`mm`) **1.0.9 ou plus récent**. Pour un agent dans un conteneur Docker, utilisez la version de mini-me qui corrige le compte de `mm dockerinit` ; un agent créé avant affiche `I have no name!` dans son terminal : réécrivez ses fichiers (`mm dockerinit`) et reconstruisez son image (`docker compose up -d --build`).
34+
35+## Fichiers
36+
37+| Fichier | Système |
38+| --- | --- |
39+| `Sidekicks-1.5.0-macos-arm64.dmg` | macOS 13 ou plus récent, Apple Silicon — signé et notarisé |
40+| `Sidekicks-1.5.0-macos-arm64.zip` | la même application, dans un `.zip` |
41+| `Sidekicks-1.5.0-windows-amd64-installer.exe`, `Sidekicks-1.5.0-windows-arm64-installer.exe` | Windows, x86-64 ou Arm — installeur (ajoute WebView2 s'il manque ; non signé : SmartScreen demande une fois) |
42+| `sidekicks_1.5.0_windows_amd64.zip`, `sidekicks_1.5.0_windows_arm64.zip` | le `sidekicks.exe` seul, là où WebView2 est déjà présent |
43+| `SHA256SUMS` | sommes de contrôle : `shasum -a 256 -c SHA256SUMS --ignore-missing` |
added docs/release-notes/v1.5.0.md +43 -0
new file mode 100644
@@ -0,0 +1,43 @@
1+# Sidekicks 1.5.0
2+
3+[Français](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.fr.md)
4+
5+Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a new one by answering questions, with no file to write and no folder to choose, and an agent's questions get a real form in the conversation.
6+
7+## What's new
8+
9+### Create a mini-me agent by answering questions (#94)
10+
11+- **✨ Create a mini-me agent** — under the agents list, on the welcome screen (**✨ Create my first agent**) and in the command palette — runs mini-me's own wizard (`mm init`) inside Sidekicks: the model server, the model, what the agent is for… each question with its default, **← Previous question** and **Start again** to change your mind.
12+- Then give the agent its name, an emoji, and where it runs: **on this computer**, **in a Docker container** or **in a Docker Sandbox (sbx)**. Sidekicks adds it to your agents and opens its conversation.
13+- Each agent gets its own folder, named after it, in your **Documents** folder; its settings are kept in `.mm/agent.yaml` there. For a container or a sandbox, mini-me writes its `compose.yaml` or `sbxenv.yaml`, and Sidekicks creates the container or the sandbox the first time the agent starts.
14+- Plain messages when mini-me is not installed or too old, when no model server answers, or when the name is already taken. **Cancel** leaves nothing behind.
15+
16+→ [Create a mini-me agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-a-mini-me-agent.md)
17+
18+### Answer an agent's questions in a form (#95)
19+
20+- When a mini-me agent asks you something with its `ask_user` tool, a card appears in the conversation, under its answer: a field to type in, a choice, several choices or yes/no — then **Answer**, **Decline** or **Stop**.
21+- Questions that need typed text could not be asked before: mini-me only had permission buttons. Any ACP agent that sends a form (ACP elicitation) gets the same card.
22+
23+→ [Questions from an agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/explanation/permissions.md#questions-from-an-agent)
24+
25+### Smaller changes
26+
27+- 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.
28+
29+## Worth knowing when upgrading
30+
31+- Drag the new **sidekicks** into **Applications** and confirm the replacement; your configuration and your history are kept.
32+- Your configuration files keep working as they are. One new optional key: `agentsFolder`, where the assistant creates the agents' folders (`~/Documents` by default).
33+- The creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`).
34+
35+## Files
36+
37+| File | System |
38+| --- | --- |
39+| `Sidekicks-1.5.0-macos-arm64.dmg` | macOS 13 or later, Apple Silicon — signed and notarized |
40+| `Sidekicks-1.5.0-macos-arm64.zip` | the same application, in a `.zip` |
41+| `Sidekicks-1.5.0-windows-amd64-installer.exe`, `Sidekicks-1.5.0-windows-arm64-installer.exe` | Windows, x86-64 or Arm — installer (adds WebView2 when missing; not signed: SmartScreen asks once) |
42+| `sidekicks_1.5.0_windows_amd64.zip`, `sidekicks_1.5.0_windows_arm64.zip` | the bare `sidekicks.exe`, where WebView2 is already present |
43+| `SHA256SUMS` | checksums: `shasum -a 256 -c SHA256SUMS --ignore-missing` |
new file mode 100644
@@ -0,0 +1,43 @@
1+# Sidekicks 1.5.0
2+
3+[Français](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/release-notes/v1.5.0.fr.md)
4+
5+Sidekicks 1.5.0 makes mini-me agents easier for everyone: an assistant creates a new one by answering questions, with no file to write and no folder to choose, and an agent's questions get a real form in the conversation.
6+
7+## What's new
8+
9+### Create a mini-me agent by answering questions (#94)
10+
11+- **✨ Create a mini-me agent** — under the agents list, on the welcome screen (**✨ Create my first agent**) and in the command palette — runs mini-me's own wizard (`mm init`) inside Sidekicks: the model server, the model, what the agent is for… each question with its default, **← Previous question** and **Start again** to change your mind.
12+- Then give the agent its name, an emoji, and where it runs: **on this computer**, **in a Docker container** or **in a Docker Sandbox (sbx)**. Sidekicks adds it to your agents and opens its conversation.
13+- Each agent gets its own folder, named after it, in your **Documents** folder; its settings are kept in `.mm/agent.yaml` there. For a container or a sandbox, mini-me writes its `compose.yaml` or `sbxenv.yaml`, and Sidekicks creates the container or the sandbox the first time the agent starts.
14+- Plain messages when mini-me is not installed or too old, when no model server answers, or when the name is already taken. **Cancel** leaves nothing behind.
15+
16+→ [Create a mini-me agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/how-to/create-a-mini-me-agent.md)
17+
18+### Answer an agent's questions in a form (#95)
19+
20+- When a mini-me agent asks you something with its `ask_user` tool, a card appears in the conversation, under its answer: a field to type in, a choice, several choices or yes/no — then **Answer**, **Decline** or **Stop**.
21+- Questions that need typed text could not be asked before: mini-me only had permission buttons. Any ACP agent that sends a form (ACP elicitation) gets the same card.
22+
23+→ [Questions from an agent](https://rickub.com/bots-garden/sidekicks/blob/v1.5.0/docs/en/explanation/permissions.md#questions-from-an-agent)
24+
25+### Smaller changes
26+
27+- 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.
28+
29+## Worth knowing when upgrading
30+
31+- Drag the new **sidekicks** into **Applications** and confirm the replacement; your configuration and your history are kept.
32+- Your configuration files keep working as they are. One new optional key: `agentsFolder`, where the assistant creates the agents' folders (`~/Documents` by default).
33+- The creation assistant needs mini-me (`mm`) **1.0.9 or later**. For an agent in a Docker container, use the mini-me release with the account fix of `mm dockerinit`; an agent created before it shows `I have no name!` in its terminal: write its files again (`mm dockerinit`) and rebuild its image (`docker compose up -d --build`).
34+
35+## Files
36+
37+| File | System |
38+| --- | --- |
39+| `Sidekicks-1.5.0-macos-arm64.dmg` | macOS 13 or later, Apple Silicon — signed and notarized |
40+| `Sidekicks-1.5.0-macos-arm64.zip` | the same application, in a `.zip` |
41+| `Sidekicks-1.5.0-windows-amd64-installer.exe`, `Sidekicks-1.5.0-windows-arm64-installer.exe` | Windows, x86-64 or Arm — installer (adds WebView2 when missing; not signed: SmartScreen asks once) |
42+| `sidekicks_1.5.0_windows_amd64.zip`, `sidekicks_1.5.0_windows_arm64.zip` | the bare `sidekicks.exe`, where WebView2 is already present |
43+| `SHA256SUMS` | checksums: `shasum -a 256 -c SHA256SUMS --ignore-missing` |
modified frontend/bindings/events/index.ts +10 -0
@@ -38,6 +38,16 @@ export const ConfigChanged = "config:changed";
3838 */
3939 export const FilesDropped = "files:dropped";
4040
41+/**
42+ * Name of the custom event "form:requested".
43+ */
44+export const FormRequested = "form:requested";
45+
46+/**
47+ * Name of the custom event "form:resolved".
48+ */
49+export const FormResolved = "form:resolved";
50+
4151 /**
4252 * Name of the custom event "message:delta".
4353 */
@@ -38,6 +38,16 @@ export const ConfigChanged = "config:changed";
38 */38 */
39 export const FilesDropped = "files:dropped";39 export const FilesDropped = "files:dropped";
40 40
41+/**
42+ * Name of the custom event "form:requested".
43+ */
44+export const FormRequested = "form:requested";
45+
46+/**
47+ * Name of the custom event "form:resolved".
48+ */
49+export const FormResolved = "form:resolved";
50+
41 /**51 /**
42 * Name of the custom event "message:delta".52 * Name of the custom event "message:delta".
43 */53 */
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/acp/index.ts +3 -0
@@ -4,6 +4,9 @@
44 export type {
55 Command,
66 Diff,
7+ Form,
8+ FormAnswer,
9+ FormField,
710 PermissionOption,
811 PlanEntry,
912 ToolCall,
@@ -4,6 +4,9 @@
4 export type {4 export type {
5 Command,5 Command,
6 Diff,6 Diff,
7+ Form,
8+ FormAnswer,
9+ FormField,
7 PermissionOption,10 PermissionOption,
8 PlanEntry,11 PlanEntry,
9 ToolCall,12 ToolCall,
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/acp/models.ts +56 -0
@@ -24,6 +24,62 @@ export interface Diff {
2424 "newFile": boolean;
2525 }
2626
27+/**
28+ * Form is what an agent asks the user to fill in.
29+ */
30+export interface Form {
31+ /**
32+ * Message says what the form is for (Markdown or plain text).
33+ */
34+ "message": string;
35+ "fields": FormField[] | null;
36+
37+ /**
38+ * SessionID and ToolCallID tie the form to a session and a tool call,
39+ * when the agent says so; "" otherwise.
40+ */
41+ "sessionId": string;
42+ "toolCallId": string;
43+}
44+
45+/**
46+ * FormAnswer is the user's answer: Action is accept, decline or cancel;
47+ * Content holds the values by field name when the form is accepted.
48+ */
49+export interface FormAnswer {
50+ "action": string;
51+ "content": { [_ in string]?: any } | null;
52+}
53+
54+/**
55+ * FormField is one question of a Form.
56+ */
57+export interface FormField {
58+ /**
59+ * Name is the key of the answer in FormAnswer.Content.
60+ */
61+ "name": string;
62+ "title": string;
63+
64+ /**
65+ * Description is optional help shown under the title.
66+ */
67+ "description": string;
68+
69+ /**
70+ * Type is one of the Field… constants.
71+ */
72+ "type": string;
73+ "options": string[] | null;
74+
75+ /**
76+ * Default is a string, a boolean, a number or a list of strings
77+ * (FieldMulti), as the agent gave it; nil when there is none.
78+ */
79+ "default": any;
80+ "required": boolean;
81+}
82+
2783 /**
2884 * PermissionOption is one possible answer, as proposed by the agent.
2985 */
@@ -24,6 +24,62 @@ export interface Diff {
24 "newFile": boolean;24 "newFile": boolean;
25 }25 }
26 26
27+/**
28+ * Form is what an agent asks the user to fill in.
29+ */
30+export interface Form {
31+ /**
32+ * Message says what the form is for (Markdown or plain text).
33+ */
34+ "message": string;
35+ "fields": FormField[] | null;
36+
37+ /**
38+ * SessionID and ToolCallID tie the form to a session and a tool call,
39+ * when the agent says so; "" otherwise.
40+ */
41+ "sessionId": string;
42+ "toolCallId": string;
43+}
44+
45+/**
46+ * FormAnswer is the user's answer: Action is accept, decline or cancel;
47+ * Content holds the values by field name when the form is accepted.
48+ */
49+export interface FormAnswer {
50+ "action": string;
51+ "content": { [_ in string]?: any } | null;
52+}
53+
54+/**
55+ * FormField is one question of a Form.
56+ */
57+export interface FormField {
58+ /**
59+ * Name is the key of the answer in FormAnswer.Content.
60+ */
61+ "name": string;
62+ "title": string;
63+
64+ /**
65+ * Description is optional help shown under the title.
66+ */
67+ "description": string;
68+
69+ /**
70+ * Type is one of the Field… constants.
71+ */
72+ "type": string;
73+ "options": string[] | null;
74+
75+ /**
76+ * Default is a string, a boolean, a number or a list of strings
77+ * (FieldMulti), as the agent gave it; nil when there is none.
78+ */
79+ "default": any;
80+ "required": boolean;
81+}
82+
27 /**83 /**
28 * PermissionOption is one possible answer, as proposed by the agent.84 * PermissionOption is one possible answer, as proposed by the agent.
29 */85 */
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/channelservice.ts +8 -0
@@ -31,6 +31,14 @@ export function AddMember(id: string, agent: string): $CancellablePromise<void>
3131 return $Call.ByID(863382753, id, agent);
3232 }
3333
34+/**
35+ * AnswerForm gives the user's answer to a form an agent asked (issue #95):
36+ * action accept with content (values by field name), decline or cancel.
37+ */
38+export function AnswerForm(id: string, answer: acp$0.FormAnswer): $CancellablePromise<void> {
39+ return $Call.ByID(1558912636, id, answer);
40+}
41+
3442 /**
3543 * AnswerPermission gives the user's choice for a permission request.
3644 */
@@ -31,6 +31,14 @@ export function AddMember(id: string, agent: string): $CancellablePromise<void>
31 return $Call.ByID(863382753, id, agent);31 return $Call.ByID(863382753, id, agent);
32 }32 }
33 33
34+/**
35+ * AnswerForm gives the user's answer to a form an agent asked (issue #95):
36+ * action accept with content (values by field name), decline or cancel.
37+ */
38+export function AnswerForm(id: string, answer: acp$0.FormAnswer): $CancellablePromise<void> {
39+ return $Call.ByID(1558912636, id, answer);
40+}
41+
34 /**42 /**
35 * AnswerPermission gives the user's choice for a permission request.43 * AnswerPermission gives the user's choice for a permission request.
36 */44 */
added frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/creatorservice.ts +71 -0
new file mode 100644
@@ -0,0 +1,71 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+/**
5+ * CreatorService is the assistant that creates a mini-me agent for people
6+ * who do not write files (issue #94): Sidekicks drives mm's wizard
7+ * (mm --acp-create) and shows its questions as forms, then adds the agent
8+ * to the configuration. One wizard at a time.
9+ *
10+ * view, err := service.Start(ctx) // the first form
11+ * view, err = service.Answer(ctx, answer) // … until view.Written
12+ * result, err := service.Finish(ctx, CreatorFinish{Name: view.Name, Icon: "🤖", Environment: "local"})
13+ * @module
14+ */
15+
16+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
17+// @ts-ignore: Unused imports
18+import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
19+
20+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
21+// @ts-ignore: Unused imports
22+import * as acp$0 from "../acp/models.js";
23+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
24+// @ts-ignore: Unused imports
25+import * as creator$0 from "../creator/models.js";
26+
27+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
28+// @ts-ignore: Unused imports
29+import * as $models from "./models.js";
30+
31+/**
32+ * Answer answers the form shown (action accept, decline or cancel) and
33+ * returns the next step.
34+ */
35+export function Answer(answer: acp$0.FormAnswer): $CancellablePromise<creator$0.View> {
36+ return $Call.ByID(4016253217, answer);
37+}
38+
39+/**
40+ * Cancel closes the wizard. Before Finish, what it wrote is removed.
41+ */
42+export function Cancel(): $CancellablePromise<void> {
43+ return $Call.ByID(4106769953);
44+}
45+
46+/**
47+ * Finish gives the agent its folder, named after it in the agents' folder,
48+ * writes the files of its container or sandbox, and adds it to the
49+ * configuration. A name already used, by an agent or by a folder, is a
50+ * Problem: nothing is changed and another name can be tried.
51+ */
52+export function Finish(form: $models.CreatorFinish): $CancellablePromise<$models.CreatorResult> {
53+ return $Call.ByID(599336288, form);
54+}
55+
56+/**
57+ * Send sends a message to the wizard, such as /back or /restart, and
58+ * returns the next step.
59+ */
60+export function Send(text: string): $CancellablePromise<creator$0.View> {
61+ return $Call.ByID(815611089, text);
62+}
63+
64+/**
65+ * Start checks that mm 1.0.9 or later is installed, then starts its wizard
66+ * and returns its first step. A wizard already open is closed first, and
67+ * what it wrote is removed.
68+ */
69+export function Start(): $CancellablePromise<$models.CreatorStart> {
70+ return $Call.ByID(1360837005);
71+}
new file mode 100644
@@ -0,0 +1,71 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+/**
5+ * CreatorService is the assistant that creates a mini-me agent for people
6+ * who do not write files (issue #94): Sidekicks drives mm's wizard
7+ * (mm --acp-create) and shows its questions as forms, then adds the agent
8+ * to the configuration. One wizard at a time.
9+ *
10+ * view, err := service.Start(ctx) // the first form
11+ * view, err = service.Answer(ctx, answer) // … until view.Written
12+ * result, err := service.Finish(ctx, CreatorFinish{Name: view.Name, Icon: "🤖", Environment: "local"})
13+ * @module
14+ */
15+
16+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
17+// @ts-ignore: Unused imports
18+import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";
19+
20+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
21+// @ts-ignore: Unused imports
22+import * as acp$0 from "../acp/models.js";
23+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
24+// @ts-ignore: Unused imports
25+import * as creator$0 from "../creator/models.js";
26+
27+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
28+// @ts-ignore: Unused imports
29+import * as $models from "./models.js";
30+
31+/**
32+ * Answer answers the form shown (action accept, decline or cancel) and
33+ * returns the next step.
34+ */
35+export function Answer(answer: acp$0.FormAnswer): $CancellablePromise<creator$0.View> {
36+ return $Call.ByID(4016253217, answer);
37+}
38+
39+/**
40+ * Cancel closes the wizard. Before Finish, what it wrote is removed.
41+ */
42+export function Cancel(): $CancellablePromise<void> {
43+ return $Call.ByID(4106769953);
44+}
45+
46+/**
47+ * Finish gives the agent its folder, named after it in the agents' folder,
48+ * writes the files of its container or sandbox, and adds it to the
49+ * configuration. A name already used, by an agent or by a folder, is a
50+ * Problem: nothing is changed and another name can be tried.
51+ */
52+export function Finish(form: $models.CreatorFinish): $CancellablePromise<$models.CreatorResult> {
53+ return $Call.ByID(599336288, form);
54+}
55+
56+/**
57+ * Send sends a message to the wizard, such as /back or /restart, and
58+ * returns the next step.
59+ */
60+export function Send(text: string): $CancellablePromise<creator$0.View> {
61+ return $Call.ByID(815611089, text);
62+}
63+
64+/**
65+ * Start checks that mm 1.0.9 or later is installed, then starts its wizard
66+ * and returns its first step. A wizard already open is closed first, and
67+ * what it wrote is removed.
68+ */
69+export function Start(): $CancellablePromise<$models.CreatorStart> {
70+ return $Call.ByID(1360837005);
71+}
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/index.ts +5 -0
@@ -4,6 +4,7 @@
44 import * as AgentService from "./agentservice.js";
55 import * as ChannelService from "./channelservice.js";
66 import * as ConfigService from "./configservice.js";
7+import * as CreatorService from "./creatorservice.js";
78 import * as SystemService from "./systemservice.js";
89 import * as TerminalService from "./terminalservice.js";
910 import * as WorkspaceService from "./workspaceservice.js";
@@ -11,6 +12,7 @@ export {
1112 AgentService,
1213 ChannelService,
1314 ConfigService,
15+ CreatorService,
1416 SystemService,
1517 TerminalService,
1618 WorkspaceService
@@ -21,6 +23,9 @@ export type {
2123 ComposeServiceView,
2224 ComposeView,
2325 ConfigView,
26+ CreatorFinish,
27+ CreatorResult,
28+ CreatorStart,
2429 LinkedFile,
2530 OlderView,
2631 ProblemView,
@@ -4,6 +4,7 @@
4 import * as AgentService from "./agentservice.js";4 import * as AgentService from "./agentservice.js";
5 import * as ChannelService from "./channelservice.js";5 import * as ChannelService from "./channelservice.js";
6 import * as ConfigService from "./configservice.js";6 import * as ConfigService from "./configservice.js";
7+import * as CreatorService from "./creatorservice.js";
7 import * as SystemService from "./systemservice.js";8 import * as SystemService from "./systemservice.js";
8 import * as TerminalService from "./terminalservice.js";9 import * as TerminalService from "./terminalservice.js";
9 import * as WorkspaceService from "./workspaceservice.js";10 import * as WorkspaceService from "./workspaceservice.js";
@@ -11,6 +12,7 @@ export {
11 AgentService,12 AgentService,
12 ChannelService,13 ChannelService,
13 ConfigService,14 ConfigService,
15+ CreatorService,
14 SystemService,16 SystemService,
15 TerminalService,17 TerminalService,
16 WorkspaceService18 WorkspaceService
@@ -21,6 +23,9 @@ export type {
21 ComposeServiceView,23 ComposeServiceView,
22 ComposeView,24 ComposeView,
23 ConfigView,25 ConfigView,
26+ CreatorFinish,
27+ CreatorResult,
28+ CreatorStart,
24 LinkedFile,29 LinkedFile,
25 OlderView,30 OlderView,
26 ProblemView,31 ProblemView,
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +49 -0
@@ -6,6 +6,9 @@
66 import * as channels$0 from "../channels/models.js";
77 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
88 // @ts-ignore: Unused imports
9+import * as creator$0 from "../creator/models.js";
10+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
11+// @ts-ignore: Unused imports
912 import * as workspace$0 from "../workspace/models.js";
1013
1114 /**
@@ -110,6 +113,52 @@ export interface ConfigView {
110113 "historyProblem": string;
111114 }
112115
116+/**
117+ * CreatorFinish is the last step: the agent's name (its folder's too), its
118+ * emoji, and where it runs: local, container or sbx.
119+ */
120+export interface CreatorFinish {
121+ "name": string;
122+ "icon": string;
123+ "environment": string;
124+}
125+
126+/**
127+ * CreatorResult is how Finish ended: Problem (one of the Creator…
128+ * constants) or Problems (from the configuration) when the agent was not
129+ * added, else the agent's name and folder.
130+ */
131+export interface CreatorResult {
132+ "problem": string;
133+ "problems": string[] | null;
134+ "name": string;
135+ "folder": string;
136+
137+ /**
138+ * Messages are what mm said while writing the container's or the
139+ * sandbox's files.
140+ */
141+ "messages": string[] | null;
142+}
143+
144+/**
145+ * CreatorStart is what Start returns: the wizard's first step, and where
146+ * the agent's folder will be.
147+ */
148+export interface CreatorStart {
149+ "view": creator$0.View;
150+
151+ /**
152+ * AgentsFolder is the folder that receives the agent's folder.
153+ */
154+ "agentsFolder": string;
155+
156+ /**
157+ * Version is what mm --version said.
158+ */
159+ "version": string;
160+}
161+
113162 /**
114163 * LinkedFile is the file of an agent's folder a link of its answer leads to
115164 * (issue #65).
@@ -6,6 +6,9 @@
6 import * as channels$0 from "../channels/models.js";6 import * as channels$0 from "../channels/models.js";
7 // eslint-disable-next-line @typescript-eslint/ban-ts-comment7 // eslint-disable-next-line @typescript-eslint/ban-ts-comment
8 // @ts-ignore: Unused imports8 // @ts-ignore: Unused imports
9+import * as creator$0 from "../creator/models.js";
10+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
11+// @ts-ignore: Unused imports
9 import * as workspace$0 from "../workspace/models.js";12 import * as workspace$0 from "../workspace/models.js";
10 13
11 /**14 /**
@@ -110,6 +113,52 @@ export interface ConfigView {
110 "historyProblem": string;113 "historyProblem": string;
111 }114 }
112 115
116+/**
117+ * CreatorFinish is the last step: the agent's name (its folder's too), its
118+ * emoji, and where it runs: local, container or sbx.
119+ */
120+export interface CreatorFinish {
121+ "name": string;
122+ "icon": string;
123+ "environment": string;
124+}
125+
126+/**
127+ * CreatorResult is how Finish ended: Problem (one of the Creator…
128+ * constants) or Problems (from the configuration) when the agent was not
129+ * added, else the agent's name and folder.
130+ */
131+export interface CreatorResult {
132+ "problem": string;
133+ "problems": string[] | null;
134+ "name": string;
135+ "folder": string;
136+
137+ /**
138+ * Messages are what mm said while writing the container's or the
139+ * sandbox's files.
140+ */
141+ "messages": string[] | null;
142+}
143+
144+/**
145+ * CreatorStart is what Start returns: the wizard's first step, and where
146+ * the agent's folder will be.
147+ */
148+export interface CreatorStart {
149+ "view": creator$0.View;
150+
151+ /**
152+ * AgentsFolder is the folder that receives the agent's folder.
153+ */
154+ "agentsFolder": string;
155+
156+ /**
157+ * Version is what mm --version said.
158+ */
159+ "version": string;
160+}
161+
113 /**162 /**
114 * LinkedFile is the file of an agent's folder a link of its answer leads to163 * LinkedFile is the file of an agent's folder a link of its answer leads to
115 * (issue #65).164 * (issue #65).
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/channels/index.ts +2 -0
@@ -11,6 +11,8 @@ export type {
1111 CommandsPayload,
1212 Conversation,
1313 DeltaPayload,
14+ FormRequest,
15+ FormResolvedPayload,
1416 ListPayload,
1517 Message,
1618 MessagePayload,
@@ -11,6 +11,8 @@ export type {
11 CommandsPayload,11 CommandsPayload,
12 Conversation,12 Conversation,
13 DeltaPayload,13 DeltaPayload,
14+ FormRequest,
15+ FormResolvedPayload,
14 ListPayload,16 ListPayload,
15 Message,17 Message,
16 MessagePayload,18 MessagePayload,
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/channels/models.ts +25 -0
@@ -66,6 +66,11 @@ export interface Conversation {
6666 */
6767 "usage": { [_ in string]?: acp$0.Usage } | null;
6868 "permissions": Permission[] | null;
69+
70+ /**
71+ * Forms are the forms waiting for an answer (issue #95).
72+ */
73+ "forms": FormRequest[] | null;
6974 }
7075
7176 /**
@@ -81,6 +86,26 @@ export interface DeltaPayload {
8186 "part"?: Part | null;
8287 }
8388
89+/**
90+ * FormRequest is a form an agent asks the user to fill in, waiting for the
91+ * answer (issue #95: mini-me's ask_user).
92+ */
93+export interface FormRequest {
94+ "id": string;
95+ "channel": string;
96+ "agent": string;
97+ "messageId": string;
98+ "form": acp$0.Form;
99+}
100+
101+/**
102+ * FormResolvedPayload says a form no longer waits.
103+ */
104+export interface FormResolvedPayload {
105+ "id": string;
106+ "channel": string;
107+}
108+
84109 /**
85110 * ListPayload is the whole list of channels, after any change (channels:changed).
86111 */
@@ -66,6 +66,11 @@ export interface Conversation {
66 */66 */
67 "usage": { [_ in string]?: acp$0.Usage } | null;67 "usage": { [_ in string]?: acp$0.Usage } | null;
68 "permissions": Permission[] | null;68 "permissions": Permission[] | null;
69+
70+ /**
71+ * Forms are the forms waiting for an answer (issue #95).
72+ */
73+ "forms": FormRequest[] | null;
69 }74 }
70 75
71 /**76 /**
@@ -81,6 +86,26 @@ export interface DeltaPayload {
81 "part"?: Part | null;86 "part"?: Part | null;
82 }87 }
83 88
89+/**
90+ * FormRequest is a form an agent asks the user to fill in, waiting for the
91+ * answer (issue #95: mini-me's ask_user).
92+ */
93+export interface FormRequest {
94+ "id": string;
95+ "channel": string;
96+ "agent": string;
97+ "messageId": string;
98+ "form": acp$0.Form;
99+}
100+
101+/**
102+ * FormResolvedPayload says a form no longer waits.
103+ */
104+export interface FormResolvedPayload {
105+ "id": string;
106+ "channel": string;
107+}
108+
84 /**109 /**
85 * ListPayload is the whole list of channels, after any change (channels:changed).110 * ListPayload is the whole list of channels, after any change (channels:changed).
86 */111 */
added frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/creator/index.ts +6 -0
new file mode 100644
@@ -0,0 +1,6 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+export type {
5+ View
6+} from "./models.js";
new file mode 100644
@@ -0,0 +1,6 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+export type {
5+ View
6+} from "./models.js";
added frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/creator/models.ts +23 -0
new file mode 100644
@@ -0,0 +1,23 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+// @ts-ignore: Unused imports
6+import * as acp$0 from "../acp/models.js";
7+
8+/**
9+ * View is what the interface shows after each step: the messages mm sent
10+ * since the last step, the form waiting for an answer (nil when none), and
11+ * the agent once it is written.
12+ */
13+export interface View {
14+ "messages": string[] | null;
15+ "form": acp$0.Form | null;
16+
17+ /**
18+ * Written: .mm/agent.yaml exists; Name and Title are mm's.
19+ */
20+ "written": boolean;
21+ "name": string;
22+ "title": string;
23+}
new file mode 100644
@@ -0,0 +1,23 @@
1+// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
2+// This file is automatically generated. DO NOT EDIT
3+
4+// eslint-disable-next-line @typescript-eslint/ban-ts-comment
5+// @ts-ignore: Unused imports
6+import * as acp$0 from "../acp/models.js";
7+
8+/**
9+ * View is what the interface shows after each step: the messages mm sent
10+ * since the last step, the form waiting for an answer (nil when none), and
11+ * the agent once it is written.
12+ */
13+export interface View {
14+ "messages": string[] | null;
15+ "form": acp$0.Form | null;
16+
17+ /**
18+ * Written: .mm/agent.yaml exists; Name and Title are mm's.
19+ */
20+ "written": boolean;
21+ "name": string;
22+ "title": string;
23+}
modified frontend/bindings/github.com/wailsapp/wails/v3/internal/eventdata.d.ts +2 -0
@@ -24,6 +24,8 @@ declare module "@wailsio/runtime" {
2424 "commands:changed": channels$0.CommandsPayload;
2525 "config:changed": events$0.ConfigChangedPayload;
2626 "files:dropped": events$0.FilesDroppedPayload;
27+ "form:requested": channels$0.FormRequest;
28+ "form:resolved": channels$0.FormResolvedPayload;
2729 "message:delta": channels$0.DeltaPayload;
2830 "message:updated": channels$0.MessagePayload;
2931 "permission:requested": channels$0.Permission;
@@ -24,6 +24,8 @@ declare module "@wailsio/runtime" {
24 "commands:changed": channels$0.CommandsPayload;24 "commands:changed": channels$0.CommandsPayload;
25 "config:changed": events$0.ConfigChangedPayload;25 "config:changed": events$0.ConfigChangedPayload;
26 "files:dropped": events$0.FilesDroppedPayload;26 "files:dropped": events$0.FilesDroppedPayload;
27+ "form:requested": channels$0.FormRequest;
28+ "form:resolved": channels$0.FormResolvedPayload;
27 "message:delta": channels$0.DeltaPayload;29 "message:delta": channels$0.DeltaPayload;
28 "message:updated": channels$0.MessagePayload;30 "message:updated": channels$0.MessagePayload;
29 "permission:requested": channels$0.Permission;31 "permission:requested": channels$0.Permission;
added frontend/src/lib/agent/CreateMiniMeAgent.svelte +295 -0
new file mode 100644
@@ -0,0 +1,295 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // The assistant that creates a mini-me agent (issue #94), for people who
4+ // never write a file: Go runs mm's wizard (mm --acp-create, mini-me 1.0.9
5+ // and later) and sends its questions as forms, shown here one after the
6+ // other. Once mm has written the agent, the user gives its name (its
7+ // folder's too), an emoji and where it runs; CreatorService.Finish then
8+ // adds it to the configuration and its conversation opens.
9+ import { onDestroy } from 'svelte'
10+ import { t, type MessageKey } from '../i18n/index.svelte'
11+ import { CreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
12+ import { agentAdded, appState } from '../state.svelte'
13+ import { agentFolder, contentOf, environments, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator'
14+ import AgentAvatar from './AgentAvatar.svelte'
15+ import ErrorText from '../chat/ErrorText.svelte'
16+ import Markdown from '../chat/Markdown.svelte'
17+ import Spinner from '../chat/Spinner.svelte'
18+ import FormFields from '../chat/FormFields.svelte'
19+
20+ type Step = 'starting' | 'questions' | 'stopped' | 'ready' | 'failed'
21+
22+ let step = $state<Step>('starting')
23+ let busy = $state(false)
24+ let agentsFolder = $state('')
25+ // Why Start failed: mm missing or too old, or another error.
26+ let failure = $state('')
27+ let form = $state<Form | null>(null)
28+ let values = $state<Record<string, Value>>({})
29+ let tried = $state(false)
30+ let warnings = $state<string[]>([])
31+ let details = $state<string[]>([])
32+ // The last step.
33+ let name = $state('')
34+ let title = $state('')
35+ let icon = $state('🤖')
36+ let environment = $state<Environment>('local')
37+ let problem = $state('')
38+ let refused = $state<string[]>([])
39+ let error = $state('')
40+ let finished = false
41+
42+ const missing = $derived(form && tried ? missingFields(form, values) : [])
43+ const startIssue = $derived(startProblem(failure))
44+ const nameOk = $derived(validName(name))
45+
46+ interface ViewLike {
47+ messages: string[] | null
48+ form: Form | null
49+ written: boolean
50+ name: string
51+ title: string
52+ }
53+
54+ // show takes the step Go returned: a form to fill in, the agent written,
55+ // or the questions stopped (a form declined, mm's answer over).
56+ function show(view: ViewLike) {
57+ const said = splitMessages(view.messages)
58+ warnings = said.warnings
59+ details = [...details, ...said.details].slice(-20)
60+ tried = false
61+ if (view.form) {
62+ form = view.form
63+ values = initialValues(view.form)
64+ step = 'questions'
65+ } else if (view.written) {
66+ form = null
67+ name = name || view.name
68+ title = view.title
69+ step = 'ready'
70+ } else {
71+ form = null
72+ step = 'stopped'
73+ }
74+ }
75+
76+ async function run(action: () => Promise<ViewLike>) {
77+ busy = true
78+ error = ''
79+ try {
80+ show(await action())
81+ } catch (caught) {
82+ error = caught instanceof Error ? caught.message : String(caught)
83+ } finally {
84+ busy = false
85+ }
86+ }
87+
88+ async function start() {
89+ step = 'starting'
90+ failure = ''
91+ details = []
92+ try {
93+ const started = await CreatorService.Start()
94+ agentsFolder = started.agentsFolder
95+ show(started.view)
96+ } catch (caught) {
97+ failure = caught instanceof Error ? caught.message : String(caught)
98+ step = 'failed'
99+ }
100+ }
101+
102+ function next(event: SubmitEvent) {
103+ event.preventDefault()
104+ if (!form) return
105+ tried = true
106+ if (missingFields(form, values).length > 0) return
107+ const answer = { action: 'accept', content: contentOf(form, values) }
108+ void run(() => CreatorService.Answer(answer))
109+ }
110+
111+ // A form waits for its answer: it is declined first, then mm gets the
112+ // command (/back takes back the last answer, /restart forgets them all).
113+ async function command(text: string) {
114+ await run(async () => {
115+ if (form) await CreatorService.Answer({ action: 'decline', content: {} })
116+ return CreatorService.Send(text)
117+ })
118+ }
119+
120+ async function finish(event: SubmitEvent) {
121+ event.preventDefault()
122+ problem = ''
123+ refused = []
124+ error = ''
125+ if (!nameOk) {
126+ problem = 'invalidName'
127+ return
128+ }
129+ busy = true
130+ try {
131+ const result = await CreatorService.Finish({ name, icon: icon.trim(), environment })
132+ if (result.problem) problem = result.problem
133+ else if (result.problems && result.problems.length > 0) refused = result.problems
134+ else {
135+ finished = true
136+ agentAdded(name)
137+ }
138+ } catch (caught) {
139+ error = caught instanceof Error ? caught.message : String(caught)
140+ } finally {
141+ busy = false
142+ }
143+ }
144+
145+ function close() {
146+ appState.creator = false
147+ }
148+
149+ // Leaving the assistant before the end removes what mm wrote.
150+ onDestroy(() => {
151+ if (!finished) void CreatorService.Cancel()
152+ })
153+
154+ void start()
155+</script>
156+
157+<div class="creator">
158+ <h1>{t('creator.title')}</h1>
159+ {#if agentsFolder}<p class="intro">{t('creator.intro', { folder: agentsFolder })}</p>{/if}
160+
161+ {#if step === 'starting'}
162+ <p class="status" role="status"><Spinner /> {t('creator.starting')}</p>
163+ {:else if step === 'failed'}
164+ <div class="problem" role="alert">
165+ {#if startIssue}{t(startIssue.key, { found: startIssue.found })}{:else}<ErrorText raw={failure} />{/if}
166+ </div>
167+ <div class="actions">
168+ <button type="button" onclick={close}>{t('creator.cancel')}</button>
169+ <button type="button" class="primary" onclick={start}>{t('creator.retry')}</button>
170+ </div>
171+ {:else}
172+ {#each warnings as warning, index (index)}
173+ <div class="warning" role="alert"><Markdown text={warning} /></div>
174+ {/each}
175+
176+ {#if step === 'questions' && form}
177+ {#if noModelServer(form)}
178+ <div class="warning" role="alert">{t('creator.noModelServer')}</div>
179+ {/if}
180+ <form class="questions" onsubmit={next} novalidate>
181+ <fieldset disabled={busy}>
182+ <FormFields {form} bind:values {missing} idPrefix="creator" />
183+ </fieldset>
184+ {#if form.message.includes('\n')}
185+ <details class="about">
186+ <summary>{t('creator.about')}</summary>
187+ <pre>{form.message}</pre>
188+ </details>
189+ {/if}
190+ <div class="actions">
191+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
192+ <span class="grow"></span>
193+ <button type="button" onclick={() => command('/restart')} disabled={busy}>{t('creator.restart')}</button>
194+ <button type="button" onclick={() => command('/back')} disabled={busy}>{t('creator.back')}</button>
195+ <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {/if}{t('creator.next')}</button>
196+ </div>
197+ </form>
198+ {:else if step === 'stopped'}
199+ <p>{t('creator.stopped')}</p>
200+ <div class="actions">
201+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
202+ <span class="grow"></span>
203+ <button type="button" onclick={() => command('/restart')} disabled={busy}>{t('creator.restart')}</button>
204+ <button type="button" class="primary" onclick={() => command('/start')} disabled={busy}>{t('creator.continue')}</button>
205+ </div>
206+ {:else if step === 'ready'}
207+ <form class="questions" onsubmit={finish} novalidate>
208+ <p>{t('creator.ready')}</p>
209+ <fieldset disabled={busy}>
210+ <div class="row">
211+ <span class="preview"><AgentAvatar icon={icon} title={title || name} name={name} size={34} /></span>
212+ <label class="grow">
213+ {t('creator.name')}
214+ <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" />
215+ </label>
216+ </div>
217+ <small id="creator-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}>
218+ {problem ? t(problemKey(problem)) : t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}
219+ </small>
220+ <div class="group" aria-label={t('creator.icon')}>
221+ <span class="label">{t('creator.icon')}</span>
222+ <div class="icons">
223+ {#each iconChoices as choice (choice)}
224+ <button type="button" class="icon" class:chosen={icon === choice} onclick={() => (icon = choice)} aria-label={choice} aria-pressed={icon === choice}>{choice}</button>
225+ {/each}
226+ <input class="custom" bind:value={icon} maxlength="8" aria-label={t('creator.icon')} />
227+ </div>
228+ <small>{t('creator.iconHint')}</small>
229+ </div>
230+ <div class="group" role="radiogroup" aria-label={t('creator.where')}>
231+ <span class="label">{t('creator.where')}</span>
232+ {#each environments as choice (choice)}
233+ <label class="choice wide" class:chosen={environment === choice}>
234+ <input type="radio" name="environment" value={choice} bind:group={environment} />
235+ <span><strong>{t(`creator.env.${choice}` as MessageKey)}</strong><br /><small>{t(`creator.env.${choice}Hint` as MessageKey)}</small></span>
236+ </label>
237+ {/each}
238+ </div>
239+ </fieldset>
240+ {#if refused.length > 0}
241+ <div class="problem" role="alert">
242+ <strong>{t('creator.refused')}</strong>
243+ <ul>{#each refused as reason, index (index)}<li>{reason}</li>{/each}</ul>
244+ </div>
245+ {/if}
246+ <div class="actions">
247+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
248+ <span class="grow"></span>
249+ <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {t('creator.creating')}{:else}{t('creator.create')}{/if}</button>
250+ </div>
251+ </form>
252+ {/if}
253+
254+ {#if busy && step !== 'ready'}<p class="status" role="status"><Spinner /> {t('creator.waiting')}</p>{/if}
255+ {#if error}<div class="problem" role="alert"><ErrorText raw={error} /></div>{/if}
256+ {#if details.length > 0}
257+ <details class="said">
258+ <summary>{t('creator.details')}</summary>
259+ {#each details as message, index (index)}<Markdown text={message} />{/each}
260+ </details>
261+ {/if}
262+ {/if}
263+</div>
264+
265+<style>
266+ .creator { max-width: 620px; width: 100%; margin: 0 auto; padding: 24px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; }
267+ h1 { font-size: 20px; margin: 0; }
268+ .intro, .status { color: var(--muted); margin: 0; }
269+ .status { display: flex; align-items: center; gap: 8px; }
270+ .questions { display: flex; flex-direction: column; gap: 12px; }
271+ fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); margin: 0; }
272+ label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
273+ .label { font-size: 13px; }
274+ input:not([type='radio']):not([type='checkbox']) { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
275+ input[aria-invalid='true'] { border-color: var(--danger); }
276+ small { color: var(--muted); font-size: 12px; }
277+ .problem-text { color: var(--danger); }
278+ .icons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
279+ .choice { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
280+ .choice.wide { align-items: flex-start; }
281+ .choice.wide input { margin-top: 3px; }
282+ .choice.chosen, .icon.chosen { border-color: var(--accent); }
283+ .icon { font-size: 20px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
284+ .custom { width: 64px; text-align: center; }
285+ .row { display: flex; gap: 10px; align-items: flex-end; }
286+ .preview { display: flex; align-items: center; justify-content: center; width: 38px; height: 34px; }
287+ .grow { flex: 1; min-width: 0; }
288+ .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
289+ .warning { border: 1px solid var(--warn); border-radius: var(--radius); color: var(--warn); padding: 8px 12px; font-size: 13px; }
290+ .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; }
291+ .problem ul { margin: 4px 0 0; padding-left: 18px; }
292+ .about pre { white-space: pre-wrap; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
293+ .said { font-size: 12px; color: var(--muted); }
294+ .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
295+</style>
new file mode 100644
@@ -0,0 +1,295 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // The assistant that creates a mini-me agent (issue #94), for people who
4+ // never write a file: Go runs mm's wizard (mm --acp-create, mini-me 1.0.9
5+ // and later) and sends its questions as forms, shown here one after the
6+ // other. Once mm has written the agent, the user gives its name (its
7+ // folder's too), an emoji and where it runs; CreatorService.Finish then
8+ // adds it to the configuration and its conversation opens.
9+ import { onDestroy } from 'svelte'
10+ import { t, type MessageKey } from '../i18n/index.svelte'
11+ import { CreatorService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
12+ import { agentAdded, appState } from '../state.svelte'
13+ import { agentFolder, contentOf, environments, iconChoices, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Environment, type Form, type Value } from '../creator'
14+ import AgentAvatar from './AgentAvatar.svelte'
15+ import ErrorText from '../chat/ErrorText.svelte'
16+ import Markdown from '../chat/Markdown.svelte'
17+ import Spinner from '../chat/Spinner.svelte'
18+ import FormFields from '../chat/FormFields.svelte'
19+
20+ type Step = 'starting' | 'questions' | 'stopped' | 'ready' | 'failed'
21+
22+ let step = $state<Step>('starting')
23+ let busy = $state(false)
24+ let agentsFolder = $state('')
25+ // Why Start failed: mm missing or too old, or another error.
26+ let failure = $state('')
27+ let form = $state<Form | null>(null)
28+ let values = $state<Record<string, Value>>({})
29+ let tried = $state(false)
30+ let warnings = $state<string[]>([])
31+ let details = $state<string[]>([])
32+ // The last step.
33+ let name = $state('')
34+ let title = $state('')
35+ let icon = $state('🤖')
36+ let environment = $state<Environment>('local')
37+ let problem = $state('')
38+ let refused = $state<string[]>([])
39+ let error = $state('')
40+ let finished = false
41+
42+ const missing = $derived(form && tried ? missingFields(form, values) : [])
43+ const startIssue = $derived(startProblem(failure))
44+ const nameOk = $derived(validName(name))
45+
46+ interface ViewLike {
47+ messages: string[] | null
48+ form: Form | null
49+ written: boolean
50+ name: string
51+ title: string
52+ }
53+
54+ // show takes the step Go returned: a form to fill in, the agent written,
55+ // or the questions stopped (a form declined, mm's answer over).
56+ function show(view: ViewLike) {
57+ const said = splitMessages(view.messages)
58+ warnings = said.warnings
59+ details = [...details, ...said.details].slice(-20)
60+ tried = false
61+ if (view.form) {
62+ form = view.form
63+ values = initialValues(view.form)
64+ step = 'questions'
65+ } else if (view.written) {
66+ form = null
67+ name = name || view.name
68+ title = view.title
69+ step = 'ready'
70+ } else {
71+ form = null
72+ step = 'stopped'
73+ }
74+ }
75+
76+ async function run(action: () => Promise<ViewLike>) {
77+ busy = true
78+ error = ''
79+ try {
80+ show(await action())
81+ } catch (caught) {
82+ error = caught instanceof Error ? caught.message : String(caught)
83+ } finally {
84+ busy = false
85+ }
86+ }
87+
88+ async function start() {
89+ step = 'starting'
90+ failure = ''
91+ details = []
92+ try {
93+ const started = await CreatorService.Start()
94+ agentsFolder = started.agentsFolder
95+ show(started.view)
96+ } catch (caught) {
97+ failure = caught instanceof Error ? caught.message : String(caught)
98+ step = 'failed'
99+ }
100+ }
101+
102+ function next(event: SubmitEvent) {
103+ event.preventDefault()
104+ if (!form) return
105+ tried = true
106+ if (missingFields(form, values).length > 0) return
107+ const answer = { action: 'accept', content: contentOf(form, values) }
108+ void run(() => CreatorService.Answer(answer))
109+ }
110+
111+ // A form waits for its answer: it is declined first, then mm gets the
112+ // command (/back takes back the last answer, /restart forgets them all).
113+ async function command(text: string) {
114+ await run(async () => {
115+ if (form) await CreatorService.Answer({ action: 'decline', content: {} })
116+ return CreatorService.Send(text)
117+ })
118+ }
119+
120+ async function finish(event: SubmitEvent) {
121+ event.preventDefault()
122+ problem = ''
123+ refused = []
124+ error = ''
125+ if (!nameOk) {
126+ problem = 'invalidName'
127+ return
128+ }
129+ busy = true
130+ try {
131+ const result = await CreatorService.Finish({ name, icon: icon.trim(), environment })
132+ if (result.problem) problem = result.problem
133+ else if (result.problems && result.problems.length > 0) refused = result.problems
134+ else {
135+ finished = true
136+ agentAdded(name)
137+ }
138+ } catch (caught) {
139+ error = caught instanceof Error ? caught.message : String(caught)
140+ } finally {
141+ busy = false
142+ }
143+ }
144+
145+ function close() {
146+ appState.creator = false
147+ }
148+
149+ // Leaving the assistant before the end removes what mm wrote.
150+ onDestroy(() => {
151+ if (!finished) void CreatorService.Cancel()
152+ })
153+
154+ void start()
155+</script>
156+
157+<div class="creator">
158+ <h1>{t('creator.title')}</h1>
159+ {#if agentsFolder}<p class="intro">{t('creator.intro', { folder: agentsFolder })}</p>{/if}
160+
161+ {#if step === 'starting'}
162+ <p class="status" role="status"><Spinner /> {t('creator.starting')}</p>
163+ {:else if step === 'failed'}
164+ <div class="problem" role="alert">
165+ {#if startIssue}{t(startIssue.key, { found: startIssue.found })}{:else}<ErrorText raw={failure} />{/if}
166+ </div>
167+ <div class="actions">
168+ <button type="button" onclick={close}>{t('creator.cancel')}</button>
169+ <button type="button" class="primary" onclick={start}>{t('creator.retry')}</button>
170+ </div>
171+ {:else}
172+ {#each warnings as warning, index (index)}
173+ <div class="warning" role="alert"><Markdown text={warning} /></div>
174+ {/each}
175+
176+ {#if step === 'questions' && form}
177+ {#if noModelServer(form)}
178+ <div class="warning" role="alert">{t('creator.noModelServer')}</div>
179+ {/if}
180+ <form class="questions" onsubmit={next} novalidate>
181+ <fieldset disabled={busy}>
182+ <FormFields {form} bind:values {missing} idPrefix="creator" />
183+ </fieldset>
184+ {#if form.message.includes('\n')}
185+ <details class="about">
186+ <summary>{t('creator.about')}</summary>
187+ <pre>{form.message}</pre>
188+ </details>
189+ {/if}
190+ <div class="actions">
191+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
192+ <span class="grow"></span>
193+ <button type="button" onclick={() => command('/restart')} disabled={busy}>{t('creator.restart')}</button>
194+ <button type="button" onclick={() => command('/back')} disabled={busy}>{t('creator.back')}</button>
195+ <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {/if}{t('creator.next')}</button>
196+ </div>
197+ </form>
198+ {:else if step === 'stopped'}
199+ <p>{t('creator.stopped')}</p>
200+ <div class="actions">
201+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
202+ <span class="grow"></span>
203+ <button type="button" onclick={() => command('/restart')} disabled={busy}>{t('creator.restart')}</button>
204+ <button type="button" class="primary" onclick={() => command('/start')} disabled={busy}>{t('creator.continue')}</button>
205+ </div>
206+ {:else if step === 'ready'}
207+ <form class="questions" onsubmit={finish} novalidate>
208+ <p>{t('creator.ready')}</p>
209+ <fieldset disabled={busy}>
210+ <div class="row">
211+ <span class="preview"><AgentAvatar icon={icon} title={title || name} name={name} size={34} /></span>
212+ <label class="grow">
213+ {t('creator.name')}
214+ <input bind:value={name} oninput={() => (problem = '')} aria-invalid={problem !== ''} aria-describedby="creator-name-hint" spellcheck="false" autocapitalize="off" />
215+ </label>
216+ </div>
217+ <small id="creator-name-hint" class:problem-text={problem !== ''} role={problem ? 'alert' : undefined}>
218+ {problem ? t(problemKey(problem)) : t('creator.nameHint', { name, folder: agentFolder(agentsFolder, name) })}
219+ </small>
220+ <div class="group" aria-label={t('creator.icon')}>
221+ <span class="label">{t('creator.icon')}</span>
222+ <div class="icons">
223+ {#each iconChoices as choice (choice)}
224+ <button type="button" class="icon" class:chosen={icon === choice} onclick={() => (icon = choice)} aria-label={choice} aria-pressed={icon === choice}>{choice}</button>
225+ {/each}
226+ <input class="custom" bind:value={icon} maxlength="8" aria-label={t('creator.icon')} />
227+ </div>
228+ <small>{t('creator.iconHint')}</small>
229+ </div>
230+ <div class="group" role="radiogroup" aria-label={t('creator.where')}>
231+ <span class="label">{t('creator.where')}</span>
232+ {#each environments as choice (choice)}
233+ <label class="choice wide" class:chosen={environment === choice}>
234+ <input type="radio" name="environment" value={choice} bind:group={environment} />
235+ <span><strong>{t(`creator.env.${choice}` as MessageKey)}</strong><br /><small>{t(`creator.env.${choice}Hint` as MessageKey)}</small></span>
236+ </label>
237+ {/each}
238+ </div>
239+ </fieldset>
240+ {#if refused.length > 0}
241+ <div class="problem" role="alert">
242+ <strong>{t('creator.refused')}</strong>
243+ <ul>{#each refused as reason, index (index)}<li>{reason}</li>{/each}</ul>
244+ </div>
245+ {/if}
246+ <div class="actions">
247+ <button type="button" onclick={close} disabled={busy}>{t('creator.cancel')}</button>
248+ <span class="grow"></span>
249+ <button type="submit" class="primary" disabled={busy}>{#if busy}<Spinner /> {t('creator.creating')}{:else}{t('creator.create')}{/if}</button>
250+ </div>
251+ </form>
252+ {/if}
253+
254+ {#if busy && step !== 'ready'}<p class="status" role="status"><Spinner /> {t('creator.waiting')}</p>{/if}
255+ {#if error}<div class="problem" role="alert"><ErrorText raw={error} /></div>{/if}
256+ {#if details.length > 0}
257+ <details class="said">
258+ <summary>{t('creator.details')}</summary>
259+ {#each details as message, index (index)}<Markdown text={message} />{/each}
260+ </details>
261+ {/if}
262+ {/if}
263+</div>
264+
265+<style>
266+ .creator { max-width: 620px; width: 100%; margin: 0 auto; padding: 24px 24px 32px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; box-sizing: border-box; }
267+ h1 { font-size: 20px; margin: 0; }
268+ .intro, .status { color: var(--muted); margin: 0; }
269+ .status { display: flex; align-items: center; gap: 8px; }
270+ .questions { display: flex; flex-direction: column; gap: 12px; }
271+ fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); margin: 0; }
272+ label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
273+ .label { font-size: 13px; }
274+ input:not([type='radio']):not([type='checkbox']) { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
275+ input[aria-invalid='true'] { border-color: var(--danger); }
276+ small { color: var(--muted); font-size: 12px; }
277+ .problem-text { color: var(--danger); }
278+ .icons { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
279+ .choice { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
280+ .choice.wide { align-items: flex-start; }
281+ .choice.wide input { margin-top: 3px; }
282+ .choice.chosen, .icon.chosen { border-color: var(--accent); }
283+ .icon { font-size: 20px; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
284+ .custom { width: 64px; text-align: center; }
285+ .row { display: flex; gap: 10px; align-items: flex-end; }
286+ .preview { display: flex; align-items: center; justify-content: center; width: 38px; height: 34px; }
287+ .grow { flex: 1; min-width: 0; }
288+ .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
289+ .warning { border: 1px solid var(--warn); border-radius: var(--radius); color: var(--warn); padding: 8px 12px; font-size: 13px; }
290+ .problem { border: 1px solid var(--danger); border-radius: var(--radius); color: var(--danger); padding: 8px 12px; font-size: 13px; }
291+ .problem ul { margin: 4px 0 0; padding-left: 18px; }
292+ .about pre { white-space: pre-wrap; font-size: 12px; color: var(--muted); margin: 6px 0 0; }
293+ .said { font-size: 12px; color: var(--muted); }
294+ .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
295+</style>
added frontend/src/lib/chat/FormCard.svelte +64 -0
new file mode 100644
@@ -0,0 +1,64 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // A form an agent asks in a conversation (issue #95): mini-me's ask_user
4+ // sends its questions as an ACP elicitation form — free text included,
5+ // which a permission card cannot ask. Shown under the answer, like a
6+ // permission card: Answer sends the values, Decline tells the agent the
7+ // user does not want to answer, Stop ends the agent's turn.
8+ import { t } from '../i18n/index.svelte'
9+ import type { FormRequest } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
10+ import { agentTitle as titleOf, answerForm, cancel } from '../state.svelte'
11+ import { contentOf, initialValues, missingFields, type Form, type Value } from '../creator'
12+ import FormFields from './FormFields.svelte'
13+
14+ let { request }: { request: FormRequest } = $props()
15+
16+ const agentTitle = $derived(titleOf(request.agent))
17+ const form = $derived(request.form as Form)
18+ // The values start from the form's defaults, once: the card is keyed by the request's id.
19+ // svelte-ignore state_referenced_locally
20+ let values = $state<Record<string, Value>>(initialValues(request.form as Form))
21+ let tried = $state(false)
22+ let sending = $state(false)
23+ const missing = $derived(tried ? missingFields(form, values) : [])
24+ // mm's message repeats the questions: shown only when it says more than one line.
25+ const message = $derived(form.message.trim())
26+
27+ async function answer(event: SubmitEvent) {
28+ event.preventDefault()
29+ tried = true
30+ if (missingFields(form, values).length > 0) return
31+ sending = true
32+ await answerForm(request, { action: 'accept', content: contentOf(form, values) })
33+ sending = false
34+ }
35+
36+ async function decline() {
37+ sending = true
38+ await answerForm(request, { action: 'decline', content: {} })
39+ sending = false
40+ }
41+</script>
42+
43+<form class="form-card" aria-label={t('form.label', { agent: agentTitle })} onsubmit={answer} novalidate>
44+ <h3>{t('form.asks', { agent: agentTitle })}</h3>
45+ {#if message && message.includes('\n')}<pre>{message}</pre>{/if}
46+ <fieldset disabled={sending}>
47+ <FormFields {form} bind:values {missing} idPrefix={request.id} />
48+ </fieldset>
49+ <div class="buttons">
50+ <button type="submit" class="primary" disabled={sending}>{t('form.answer')}</button>
51+ <button type="button" onclick={decline} disabled={sending}>{t('form.decline')}</button>
52+ <button type="button" class="stop" onclick={() => cancel(request.channel)}>{t('conversation.stop', { agent: agentTitle })}</button>
53+ </div>
54+</form>
55+
56+<style>
57+ .form-card { margin: 8px 0; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
58+ h3 { margin: 0; font-size: 15px; }
59+ pre { margin: 0; padding: 8px 10px; background: var(--code-bg); border-radius: 6px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
60+ fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
61+ .buttons { display: flex; flex-wrap: wrap; gap: 6px; }
62+ .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
63+ .stop { color: var(--danger); border-color: var(--danger); margin-left: auto; }
64+</style>
new file mode 100644
@@ -0,0 +1,64 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // A form an agent asks in a conversation (issue #95): mini-me's ask_user
4+ // sends its questions as an ACP elicitation form — free text included,
5+ // which a permission card cannot ask. Shown under the answer, like a
6+ // permission card: Answer sends the values, Decline tells the agent the
7+ // user does not want to answer, Stop ends the agent's turn.
8+ import { t } from '../i18n/index.svelte'
9+ import type { FormRequest } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
10+ import { agentTitle as titleOf, answerForm, cancel } from '../state.svelte'
11+ import { contentOf, initialValues, missingFields, type Form, type Value } from '../creator'
12+ import FormFields from './FormFields.svelte'
13+
14+ let { request }: { request: FormRequest } = $props()
15+
16+ const agentTitle = $derived(titleOf(request.agent))
17+ const form = $derived(request.form as Form)
18+ // The values start from the form's defaults, once: the card is keyed by the request's id.
19+ // svelte-ignore state_referenced_locally
20+ let values = $state<Record<string, Value>>(initialValues(request.form as Form))
21+ let tried = $state(false)
22+ let sending = $state(false)
23+ const missing = $derived(tried ? missingFields(form, values) : [])
24+ // mm's message repeats the questions: shown only when it says more than one line.
25+ const message = $derived(form.message.trim())
26+
27+ async function answer(event: SubmitEvent) {
28+ event.preventDefault()
29+ tried = true
30+ if (missingFields(form, values).length > 0) return
31+ sending = true
32+ await answerForm(request, { action: 'accept', content: contentOf(form, values) })
33+ sending = false
34+ }
35+
36+ async function decline() {
37+ sending = true
38+ await answerForm(request, { action: 'decline', content: {} })
39+ sending = false
40+ }
41+</script>
42+
43+<form class="form-card" aria-label={t('form.label', { agent: agentTitle })} onsubmit={answer} novalidate>
44+ <h3>{t('form.asks', { agent: agentTitle })}</h3>
45+ {#if message && message.includes('\n')}<pre>{message}</pre>{/if}
46+ <fieldset disabled={sending}>
47+ <FormFields {form} bind:values {missing} idPrefix={request.id} />
48+ </fieldset>
49+ <div class="buttons">
50+ <button type="submit" class="primary" disabled={sending}>{t('form.answer')}</button>
51+ <button type="button" onclick={decline} disabled={sending}>{t('form.decline')}</button>
52+ <button type="button" class="stop" onclick={() => cancel(request.channel)}>{t('conversation.stop', { agent: agentTitle })}</button>
53+ </div>
54+</form>
55+
56+<style>
57+ .form-card { margin: 8px 0; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 10px; }
58+ h3 { margin: 0; font-size: 15px; }
59+ pre { margin: 0; padding: 8px 10px; background: var(--code-bg); border-radius: 6px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
60+ fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
61+ .buttons { display: flex; flex-wrap: wrap; gap: 6px; }
62+ .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
63+ .stop { color: var(--danger); border-color: var(--danger); margin-left: auto; }
64+</style>
added frontend/src/lib/chat/FormFields.svelte +97 -0
new file mode 100644
@@ -0,0 +1,97 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // The fields of a form an agent asks (ACP elicitation): a checkbox for
4+ // yes/no, radio buttons for a choice among few options, a list for more,
5+ // checkboxes for several choices, an input for text and numbers. Used by
6+ // the mini-me creation assistant (issue #94) and by the form card of a
7+ // conversation (issue #95: mini-me's ask_user). The values live in the
8+ // caller, which builds them with lib/creator.ts initialValues.
9+ import { t } from '../i18n/index.svelte'
10+ import type { Form, Value } from '../creator'
11+
12+ let {
13+ form,
14+ values = $bindable(),
15+ missing = [],
16+ idPrefix,
17+ }: {
18+ form: Form
19+ values: Record<string, Value>
20+ /** The names of the required fields left empty, marked as such. */
21+ missing?: string[]
22+ /** Makes the radio groups' names unique on the page. */
23+ idPrefix: string
24+ } = $props()
25+
26+ function toggle(field: string, option: string, on: boolean) {
27+ const chosen = (values[field] as string[]) ?? []
28+ values[field] = on ? [...chosen, option] : chosen.filter((value) => value !== option)
29+ }
30+</script>
31+
32+{#each form.fields ?? [] as field (field.name)}
33+ {#if field.type === 'boolean'}
34+ <label class="check">
35+ <input type="checkbox" checked={values[field.name] === true} onchange={(event) => (values[field.name] = event.currentTarget.checked)} />
36+ {field.title}
37+ </label>
38+ {:else if field.type === 'choice' && (field.options ?? []).length <= 4}
39+ <div class="group" role="radiogroup" aria-label={field.title}>
40+ <span class="label">{field.title}</span>
41+ <div class="choices">
42+ {#each field.options ?? [] as option (option)}
43+ <label class="choice" class:chosen={values[field.name] === option}>
44+ <input type="radio" name={`${idPrefix}-${field.name}`} value={option} checked={values[field.name] === option} onchange={() => (values[field.name] = option)} />
45+ {option}
46+ </label>
47+ {/each}
48+ </div>
49+ </div>
50+ {:else if field.type === 'choice'}
51+ <label>
52+ {field.title}
53+ <select value={values[field.name]} onchange={(event) => (values[field.name] = event.currentTarget.value)}>
54+ {#each field.options ?? [] as option (option)}<option value={option}>{option}</option>{/each}
55+ </select>
56+ </label>
57+ {:else if field.type === 'multi'}
58+ <div class="group" aria-label={field.title}>
59+ <span class="label">{field.title}</span>
60+ <div class="choices">
61+ {#each field.options ?? [] as option (option)}
62+ <label class="choice">
63+ <input type="checkbox" checked={((values[field.name] as string[]) ?? []).includes(option)} onchange={(event) => toggle(field.name, option, event.currentTarget.checked)} />
64+ {option}
65+ </label>
66+ {/each}
67+ </div>
68+ </div>
69+ {:else}
70+ <label>
71+ {field.title}
72+ <input
73+ value={values[field.name] as string}
74+ oninput={(event) => (values[field.name] = event.currentTarget.value)}
75+ inputmode={field.type === 'number' ? 'decimal' : undefined}
76+ aria-invalid={missing.includes(field.name)}
77+ spellcheck="false"
78+ autocapitalize="off"
79+ />
80+ {#if missing.includes(field.name)}<small class="problem-text">{t('form.missing')}</small>{/if}
81+ </label>
82+ {/if}
83+ {#if field.description}<small>{field.description}</small>{/if}
84+{/each}
85+
86+<style>
87+ label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
88+ .label { font-size: 13px; }
89+ label.check { flex-direction: row; align-items: center; gap: 8px; }
90+ input:not([type='radio']):not([type='checkbox']), select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
91+ input[aria-invalid='true'] { border-color: var(--danger); }
92+ small { color: var(--muted); font-size: 12px; }
93+ .problem-text { color: var(--danger); }
94+ .choices { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
95+ .choice { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
96+ .choice.chosen { border-color: var(--accent); }
97+</style>
new file mode 100644
@@ -0,0 +1,97 @@
1+<!-- Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE -->
2+<script lang="ts">
3+ // The fields of a form an agent asks (ACP elicitation): a checkbox for
4+ // yes/no, radio buttons for a choice among few options, a list for more,
5+ // checkboxes for several choices, an input for text and numbers. Used by
6+ // the mini-me creation assistant (issue #94) and by the form card of a
7+ // conversation (issue #95: mini-me's ask_user). The values live in the
8+ // caller, which builds them with lib/creator.ts initialValues.
9+ import { t } from '../i18n/index.svelte'
10+ import type { Form, Value } from '../creator'
11+
12+ let {
13+ form,
14+ values = $bindable(),
15+ missing = [],
16+ idPrefix,
17+ }: {
18+ form: Form
19+ values: Record<string, Value>
20+ /** The names of the required fields left empty, marked as such. */
21+ missing?: string[]
22+ /** Makes the radio groups' names unique on the page. */
23+ idPrefix: string
24+ } = $props()
25+
26+ function toggle(field: string, option: string, on: boolean) {
27+ const chosen = (values[field] as string[]) ?? []
28+ values[field] = on ? [...chosen, option] : chosen.filter((value) => value !== option)
29+ }
30+</script>
31+
32+{#each form.fields ?? [] as field (field.name)}
33+ {#if field.type === 'boolean'}
34+ <label class="check">
35+ <input type="checkbox" checked={values[field.name] === true} onchange={(event) => (values[field.name] = event.currentTarget.checked)} />
36+ {field.title}
37+ </label>
38+ {:else if field.type === 'choice' && (field.options ?? []).length <= 4}
39+ <div class="group" role="radiogroup" aria-label={field.title}>
40+ <span class="label">{field.title}</span>
41+ <div class="choices">
42+ {#each field.options ?? [] as option (option)}
43+ <label class="choice" class:chosen={values[field.name] === option}>
44+ <input type="radio" name={`${idPrefix}-${field.name}`} value={option} checked={values[field.name] === option} onchange={() => (values[field.name] = option)} />
45+ {option}
46+ </label>
47+ {/each}
48+ </div>
49+ </div>
50+ {:else if field.type === 'choice'}
51+ <label>
52+ {field.title}
53+ <select value={values[field.name]} onchange={(event) => (values[field.name] = event.currentTarget.value)}>
54+ {#each field.options ?? [] as option (option)}<option value={option}>{option}</option>{/each}
55+ </select>
56+ </label>
57+ {:else if field.type === 'multi'}
58+ <div class="group" aria-label={field.title}>
59+ <span class="label">{field.title}</span>
60+ <div class="choices">
61+ {#each field.options ?? [] as option (option)}
62+ <label class="choice">
63+ <input type="checkbox" checked={((values[field.name] as string[]) ?? []).includes(option)} onchange={(event) => toggle(field.name, option, event.currentTarget.checked)} />
64+ {option}
65+ </label>
66+ {/each}
67+ </div>
68+ </div>
69+ {:else}
70+ <label>
71+ {field.title}
72+ <input
73+ value={values[field.name] as string}
74+ oninput={(event) => (values[field.name] = event.currentTarget.value)}
75+ inputmode={field.type === 'number' ? 'decimal' : undefined}
76+ aria-invalid={missing.includes(field.name)}
77+ spellcheck="false"
78+ autocapitalize="off"
79+ />
80+ {#if missing.includes(field.name)}<small class="problem-text">{t('form.missing')}</small>{/if}
81+ </label>
82+ {/if}
83+ {#if field.description}<small>{field.description}</small>{/if}
84+{/each}
85+
86+<style>
87+ label, .group { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
88+ .label { font-size: 13px; }
89+ label.check { flex-direction: row; align-items: center; gap: 8px; }
90+ input:not([type='radio']):not([type='checkbox']), select { font: inherit; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
91+ input[aria-invalid='true'] { border-color: var(--danger); }
92+ small { color: var(--muted); font-size: 12px; }
93+ .problem-text { color: var(--danger); }
94+ .choices { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
95+ .choice { flex-direction: row; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
96+ .choice.chosen { border-color: var(--accent); }
97+</style>
modified frontend/src/lib/conversation.test.ts +12 -1
@@ -3,7 +3,7 @@
33 import { describe, expect, it } from 'vitest'
44 import type { Channel, Message } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
55 import { Role } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
6-import { activityOf, addPermission, answerText, directOf, applyDelta, applyMessage, emptyConversation, notStreaming, prependMessages, removePermission, usagePercent } from './conversation'
6+import { activityOf, addForm, addPermission, answerText, directOf, applyDelta, applyMessage, emptyConversation, notStreaming, prependMessages, removeForm, removePermission, usagePercent } from './conversation'
77
88 const general: Channel = { id: 'c1', name: 'general', description: '', direct: '', members: ['alice'] }
99
@@ -57,6 +57,17 @@ describe('conversation events', () => {
5757 expect(conversation.permissions).toHaveLength(0)
5858 })
5959
60+ it('keeps each form once until it is resolved', () => {
61+ const conversation = emptyConversation(general)
62+ const request = { id: 'f-1', channel: 'c1', agent: 'alice', messageId: 'm-1', form: { message: '', fields: [], sessionId: '', toolCallId: '' } }
63+ expect(conversation.forms).toEqual([])
64+ addForm(conversation, request)
65+ addForm(conversation, request)
66+ expect(conversation.forms).toHaveLength(1)
67+ removeForm(conversation, 'f-1')
68+ expect(conversation.forms).toHaveLength(0)
69+ })
70+
6071 it('computes the context gauge', () => {
6172 const conversation = emptyConversation(general)
6273 expect(usagePercent(conversation, 'alice')).toBeNull()
@@ -3,7 +3,7 @@
3 import { describe, expect, it } from 'vitest'3 import { describe, expect, it } from 'vitest'
4 import type { Channel, Message } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'4 import type { Channel, Message } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
5 import { Role } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'5 import { Role } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
6-import { activityOf, addPermission, answerText, directOf, applyDelta, applyMessage, emptyConversation, notStreaming, prependMessages, removePermission, usagePercent } from './conversation'6+import { activityOf, addForm, addPermission, answerText, directOf, applyDelta, applyMessage, emptyConversation, notStreaming, prependMessages, removeForm, removePermission, usagePercent } from './conversation'
7 7
8 const general: Channel = { id: 'c1', name: 'general', description: '', direct: '', members: ['alice'] }8 const general: Channel = { id: 'c1', name: 'general', description: '', direct: '', members: ['alice'] }
9 9
@@ -57,6 +57,17 @@ describe('conversation events', () => {
57 expect(conversation.permissions).toHaveLength(0)57 expect(conversation.permissions).toHaveLength(0)
58 })58 })
59 59
60+ it('keeps each form once until it is resolved', () => {
61+ const conversation = emptyConversation(general)
62+ const request = { id: 'f-1', channel: 'c1', agent: 'alice', messageId: 'm-1', form: { message: '', fields: [], sessionId: '', toolCallId: '' } }
63+ expect(conversation.forms).toEqual([])
64+ addForm(conversation, request)
65+ addForm(conversation, request)
66+ expect(conversation.forms).toHaveLength(1)
67+ removeForm(conversation, 'f-1')
68+ expect(conversation.forms).toHaveLength(0)
69+ })
70+
60 it('computes the context gauge', () => {71 it('computes the context gauge', () => {
61 const conversation = emptyConversation(general)72 const conversation = emptyConversation(general)
62 expect(usagePercent(conversation, 'alice')).toBeNull()73 expect(usagePercent(conversation, 'alice')).toBeNull()
modified frontend/src/lib/conversation.ts +13 -2
@@ -3,11 +3,11 @@
33 // Applies the channel events of the Go side to a conversation held by the
44 // interface (issues #15 and #23). Pure functions: the Svelte state calls them.
55
6-import type { Channel, Conversation, DeltaPayload, Message, Permission } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
6+import type { Channel, Conversation, DeltaPayload, FormRequest, Message, Permission } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
77
88 /** An empty conversation of channel, before the Go side has sent anything. */
99 export function emptyConversation(channel: Channel): Conversation {
10- return { channel, messages: [], more: false, busy: false, queued: 0, answering: '', answerers: [], usage: {}, permissions: [] }
10+ return { channel, messages: [], more: false, busy: false, queued: 0, answering: '', answerers: [], usage: {}, permissions: [], forms: [] }
1111 }
1212
1313 /**
@@ -74,6 +74,17 @@ export function removePermission(conversation: Conversation, id: string) {
7474 conversation.permissions = (conversation.permissions ?? []).filter((candidate) => candidate.id !== id)
7575 }
7676
77+/** Adds a pending form (issue #95), once. */
78+export function addForm(conversation: Conversation, request: FormRequest) {
79+ const forms = (conversation.forms ??= [])
80+ if (!forms.some((candidate) => candidate.id === request.id)) forms.push(request)
81+}
82+
83+/** Removes a form that was answered or cancelled. */
84+export function removeForm(conversation: Conversation, id: string) {
85+ conversation.forms = (conversation.forms ?? []).filter((candidate) => candidate.id !== id)
86+}
87+
7788 /** Share of agent's context window used, from 0 to 100, or null when unknown. */
7889 export function usagePercent(conversation: Conversation, agent: string): number | null {
7990 const usage = conversation.usage?.[agent]
@@ -3,11 +3,11 @@
3 // Applies the channel events of the Go side to a conversation held by the3 // Applies the channel events of the Go side to a conversation held by the
4 // interface (issues #15 and #23). Pure functions: the Svelte state calls them.4 // interface (issues #15 and #23). Pure functions: the Svelte state calls them.
5 5
6-import type { Channel, Conversation, DeltaPayload, Message, Permission } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'6+import type { Channel, Conversation, DeltaPayload, FormRequest, Message, Permission } from '../../bindings/git.rickub.com/bots-garden/sidekicks/internal/channels'
7 7
8 /** An empty conversation of channel, before the Go side has sent anything. */8 /** An empty conversation of channel, before the Go side has sent anything. */
9 export function emptyConversation(channel: Channel): Conversation {9 export function emptyConversation(channel: Channel): Conversation {
10- return { channel, messages: [], more: false, busy: false, queued: 0, answering: '', answerers: [], usage: {}, permissions: [] }10+ return { channel, messages: [], more: false, busy: false, queued: 0, answering: '', answerers: [], usage: {}, permissions: [], forms: [] }
11 }11 }
12 12
13 /**13 /**
@@ -74,6 +74,17 @@ export function removePermission(conversation: Conversation, id: string) {
74 conversation.permissions = (conversation.permissions ?? []).filter((candidate) => candidate.id !== id)74 conversation.permissions = (conversation.permissions ?? []).filter((candidate) => candidate.id !== id)
75 }75 }
76 76
77+/** Adds a pending form (issue #95), once. */
78+export function addForm(conversation: Conversation, request: FormRequest) {
79+ const forms = (conversation.forms ??= [])
80+ if (!forms.some((candidate) => candidate.id === request.id)) forms.push(request)
81+}
82+
83+/** Removes a form that was answered or cancelled. */
84+export function removeForm(conversation: Conversation, id: string) {
85+ conversation.forms = (conversation.forms ?? []).filter((candidate) => candidate.id !== id)
86+}
87+
77 /** Share of agent's context window used, from 0 to 100, or null when unknown. */88 /** Share of agent's context window used, from 0 to 100, or null when unknown. */
78 export function usagePercent(conversation: Conversation, agent: string): number | null {89 export function usagePercent(conversation: Conversation, agent: string): number | null {
79 const usage = conversation.usage?.[agent]90 const usage = conversation.usage?.[agent]
added frontend/src/lib/creator.test.ts +97 -0
new file mode 100644
@@ -0,0 +1,97 @@
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 { agentFolder, contentOf, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator'
5+
6+function field(name: string, type: string, extra: Partial<Field> = {}): Field {
7+ return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra }
8+}
9+
10+const form: Form = {
11+ message: 'mm init — create an agent',
12+ fields: [
13+ field('provider', 'choice', { options: ['llmman', 'ollama'], default: 'ollama' }),
14+ field('usage', 'choice', { options: ['developer', 'writer'] }),
15+ field('yolo', 'boolean', { default: true }),
16+ field('skills', 'multi', { options: ['a', 'b'], default: ['b'] }),
17+ field('name', 'text', { default: 'developer' }),
18+ field('model', 'text'),
19+ field('size', 'number', { required: false }),
20+ ],
21+}
22+
23+describe('initialValues', () => {
24+ it('starts from the defaults, the first option of a choice without one', () => {
25+ expect(initialValues(form)).toEqual({ provider: 'ollama', usage: 'developer', yolo: true, skills: ['b'], name: 'developer', model: '', size: '' })
26+ })
27+ it('reads a yes/no default given as text', () => {
28+ expect(initialValues({ message: '', fields: [field('yolo', 'boolean', { default: 'yes' })] })).toEqual({ yolo: true })
29+ })
30+ it('accepts a form without fields', () => {
31+ expect(initialValues({ message: '', fields: null })).toEqual({})
32+ })
33+})
34+
35+describe('contentOf', () => {
36+ it('trims text and sends numbers as numbers', () => {
37+ const values = { ...initialValues(form), name: ' Bob ', size: ' 12 ', yolo: false }
38+ expect(contentOf(form, values)).toEqual({ provider: 'ollama', usage: 'developer', yolo: false, skills: ['b'], name: 'Bob', model: '', size: 12 })
39+ })
40+ it('keeps a number field that is not a number as text, for mm to refuse', () => {
41+ expect(contentOf({ message: '', fields: [field('size', 'number')] }, { size: 'big' })).toEqual({ size: 'big' })
42+ })
43+})
44+
45+describe('missingFields', () => {
46+ it('lists the required text fields left empty', () => {
47+ expect(missingFields(form, initialValues(form))).toEqual(['model'])
48+ expect(missingFields(form, { ...initialValues(form), model: 'qwen' })).toEqual([])
49+ })
50+})
51+
52+describe('noModelServer', () => {
53+ it('is true when mm asks the model as text', () => {
54+ expect(noModelServer(form)).toBe(true)
55+ expect(noModelServer({ message: '', fields: [field('model', 'choice', { options: ['qwen'] })] })).toBe(false)
56+ expect(noModelServer(null)).toBe(false)
57+ })
58+})
59+
60+describe('splitMessages', () => {
61+ it('shows the warnings and folds the rest', () => {
62+ expect(splitMessages(['**mm init** — let us start', '⚠️ unknown provider "x"', ' ⚠️ again'])).toEqual({
63+ warnings: ['⚠️ unknown provider "x"', ' ⚠️ again'],
64+ details: ['**mm init** — let us start'],
65+ })
66+ expect(splitMessages(null)).toEqual({ warnings: [], details: [] })
67+ })
68+})
69+
70+describe('names and folders', () => {
71+ it('accepts the names of the configuration', () => {
72+ expect(validName('bob')).toBe(true)
73+ expect(validName('bob-2_x')).toBe(true)
74+ expect(validName('Bob')).toBe(false)
75+ expect(validName('2bob')).toBe(false)
76+ expect(validName('')).toBe(false)
77+ expect(validName('a'.repeat(33))).toBe(false)
78+ })
79+ it('joins the folder with its own separator', () => {
80+ expect(agentFolder('/Users/me/Documents', 'bob')).toBe('/Users/me/Documents/bob')
81+ expect(agentFolder('/Users/me/Documents/', 'bob')).toBe('/Users/me/Documents/bob')
82+ expect(agentFolder('C:\\Users\\me\\Documents', 'bob')).toBe('C:\\Users\\me\\Documents\\bob')
83+ })
84+})
85+
86+describe('problems', () => {
87+ it('explains the problems of Finish', () => {
88+ expect(problemKey('nameTaken')).toBe('creator.problem.nameTaken')
89+ expect(problemKey('folderExists')).toBe('creator.problem.folderExists')
90+ expect(problemKey('invalidName')).toBe('creator.problem.invalidName')
91+ })
92+ it('recognises a missing or old mm', () => {
93+ expect(startProblem('mini-me (mm) is not installed')).toEqual({ key: 'creator.mmMissing', found: '' })
94+ expect(startProblem('mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed')).toEqual({ key: 'creator.mmTooOld', found: '1.0.8' })
95+ expect(startProblem('connection refused')).toBeNull()
96+ })
97+})
new file mode 100644
@@ -0,0 +1,97 @@
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 { agentFolder, contentOf, initialValues, missingFields, noModelServer, problemKey, splitMessages, startProblem, validName, type Field, type Form } from './creator'
5+
6+function field(name: string, type: string, extra: Partial<Field> = {}): Field {
7+ return { name, title: name, description: '', type, options: null, default: null, required: true, ...extra }
8+}
9+
10+const form: Form = {
11+ message: 'mm init — create an agent',
12+ fields: [
13+ field('provider', 'choice', { options: ['llmman', 'ollama'], default: 'ollama' }),
14+ field('usage', 'choice', { options: ['developer', 'writer'] }),
15+ field('yolo', 'boolean', { default: true }),
16+ field('skills', 'multi', { options: ['a', 'b'], default: ['b'] }),
17+ field('name', 'text', { default: 'developer' }),
18+ field('model', 'text'),
19+ field('size', 'number', { required: false }),
20+ ],
21+}
22+
23+describe('initialValues', () => {
24+ it('starts from the defaults, the first option of a choice without one', () => {
25+ expect(initialValues(form)).toEqual({ provider: 'ollama', usage: 'developer', yolo: true, skills: ['b'], name: 'developer', model: '', size: '' })
26+ })
27+ it('reads a yes/no default given as text', () => {
28+ expect(initialValues({ message: '', fields: [field('yolo', 'boolean', { default: 'yes' })] })).toEqual({ yolo: true })
29+ })
30+ it('accepts a form without fields', () => {
31+ expect(initialValues({ message: '', fields: null })).toEqual({})
32+ })
33+})
34+
35+describe('contentOf', () => {
36+ it('trims text and sends numbers as numbers', () => {
37+ const values = { ...initialValues(form), name: ' Bob ', size: ' 12 ', yolo: false }
38+ expect(contentOf(form, values)).toEqual({ provider: 'ollama', usage: 'developer', yolo: false, skills: ['b'], name: 'Bob', model: '', size: 12 })
39+ })
40+ it('keeps a number field that is not a number as text, for mm to refuse', () => {
41+ expect(contentOf({ message: '', fields: [field('size', 'number')] }, { size: 'big' })).toEqual({ size: 'big' })
42+ })
43+})
44+
45+describe('missingFields', () => {
46+ it('lists the required text fields left empty', () => {
47+ expect(missingFields(form, initialValues(form))).toEqual(['model'])
48+ expect(missingFields(form, { ...initialValues(form), model: 'qwen' })).toEqual([])
49+ })
50+})
51+
52+describe('noModelServer', () => {
53+ it('is true when mm asks the model as text', () => {
54+ expect(noModelServer(form)).toBe(true)
55+ expect(noModelServer({ message: '', fields: [field('model', 'choice', { options: ['qwen'] })] })).toBe(false)
56+ expect(noModelServer(null)).toBe(false)
57+ })
58+})
59+
60+describe('splitMessages', () => {
61+ it('shows the warnings and folds the rest', () => {
62+ expect(splitMessages(['**mm init** — let us start', '⚠️ unknown provider "x"', ' ⚠️ again'])).toEqual({
63+ warnings: ['⚠️ unknown provider "x"', ' ⚠️ again'],
64+ details: ['**mm init** — let us start'],
65+ })
66+ expect(splitMessages(null)).toEqual({ warnings: [], details: [] })
67+ })
68+})
69+
70+describe('names and folders', () => {
71+ it('accepts the names of the configuration', () => {
72+ expect(validName('bob')).toBe(true)
73+ expect(validName('bob-2_x')).toBe(true)
74+ expect(validName('Bob')).toBe(false)
75+ expect(validName('2bob')).toBe(false)
76+ expect(validName('')).toBe(false)
77+ expect(validName('a'.repeat(33))).toBe(false)
78+ })
79+ it('joins the folder with its own separator', () => {
80+ expect(agentFolder('/Users/me/Documents', 'bob')).toBe('/Users/me/Documents/bob')
81+ expect(agentFolder('/Users/me/Documents/', 'bob')).toBe('/Users/me/Documents/bob')
82+ expect(agentFolder('C:\\Users\\me\\Documents', 'bob')).toBe('C:\\Users\\me\\Documents\\bob')
83+ })
84+})
85+
86+describe('problems', () => {
87+ it('explains the problems of Finish', () => {
88+ expect(problemKey('nameTaken')).toBe('creator.problem.nameTaken')
89+ expect(problemKey('folderExists')).toBe('creator.problem.folderExists')
90+ expect(problemKey('invalidName')).toBe('creator.problem.invalidName')
91+ })
92+ it('recognises a missing or old mm', () => {
93+ expect(startProblem('mini-me (mm) is not installed')).toEqual({ key: 'creator.mmMissing', found: '' })
94+ expect(startProblem('mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed')).toEqual({ key: 'creator.mmTooOld', found: '1.0.8' })
95+ expect(startProblem('connection refused')).toBeNull()
96+ })
97+})
added frontend/src/lib/creator.ts +155 -0
new file mode 100644
@@ -0,0 +1,155 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// The assistant that creates a mini-me agent (issue #94): Go drives mm's
4+// wizard (CreatorService) and sends its questions as forms; this module
5+// turns a form into values the page edits, and those values back into the
6+// answer mm expects. No Svelte here, so that vitest can test it.
7+
8+import type { MessageKey } from './i18n/index.svelte'
9+
10+/** A question of a form, as acp.FormField gives it. */
11+export interface Field {
12+ name: string
13+ title: string
14+ description: string
15+ /** text, choice, multi, boolean or number. */
16+ type: string
17+ options: string[] | null
18+ default: unknown
19+ required: boolean
20+}
21+
22+export interface Form {
23+ message: string
24+ fields: Field[] | null
25+}
26+
27+export type Value = string | boolean | string[]
28+
29+/** Where the agent runs, as CreatorService.Finish takes it. */
30+export type Environment = 'local' | 'container' | 'sbx'
31+export const environments: Environment[] = ['local', 'container', 'sbx']
32+
33+/** A few emojis to pick from; any other can be typed. */
34+export const iconChoices = ['🤖', '🦊', '🐱', '🐼', '🦉', '🐙', '🧙', '👩‍🔬', '👨‍🍳', '🧑‍🚀', '🎨', '📚']
35+
36+/**
37+ * The values a form starts with: the defaults mm gives, else nothing (the
38+ * first option for a choice, which a select shows anyway).
39+ *
40+ * @example
41+ * initialValues({ message: '', fields: [{ name: 'yolo', type: 'boolean', default: true, … }] }) // { yolo: true }
42+ */
43+export function initialValues(form: Form): Record<string, Value> {
44+ const values: Record<string, Value> = {}
45+ for (const field of form.fields ?? []) {
46+ const value = field.default
47+ switch (field.type) {
48+ case 'boolean':
49+ values[field.name] = value === true || value === 'yes' || value === 'true'
50+ break
51+ case 'multi':
52+ values[field.name] = Array.isArray(value) ? value.map(String) : []
53+ break
54+ case 'choice':
55+ values[field.name] = value !== undefined && value !== null ? String(value) : (field.options?.[0] ?? '')
56+ break
57+ default:
58+ values[field.name] = value !== undefined && value !== null ? String(value) : ''
59+ }
60+ }
61+ return values
62+}
63+
64+/**
65+ * The content of an accepted form: each value with the type its field
66+ * asks for (a number field sends a number when the text is one).
67+ *
68+ * @example
69+ * contentOf(form, { name: ' bob ', yolo: false }) // { name: 'bob', yolo: false }
70+ */
71+export function contentOf(form: Form, values: Record<string, Value>): Record<string, unknown> {
72+ const content: Record<string, unknown> = {}
73+ for (const field of form.fields ?? []) {
74+ const value = values[field.name]
75+ if (typeof value === 'string') {
76+ const text = value.trim()
77+ content[field.name] = field.type === 'number' && text !== '' && !Number.isNaN(Number(text)) ? Number(text) : text
78+ } else {
79+ content[field.name] = value
80+ }
81+ }
82+ return content
83+}
84+
85+/** The required text fields still empty, by name: the form cannot be sent. */
86+export function missingFields(form: Form, values: Record<string, Value>): string[] {
87+ return (form.fields ?? [])
88+ .filter((field) => field.required && (field.type === 'text' || field.type === 'number' || field.type === 'choice'))
89+ .filter((field) => String(values[field.name] ?? '').trim() === '')
90+ .map((field) => field.name)
91+}
92+
93+/**
94+ * True when mm asks the model as plain text: no model server answered, so
95+ * it could not list the models (mm's "model" question has choices otherwise).
96+ */
97+export function noModelServer(form: Form | null | undefined): boolean {
98+ return (form?.fields ?? []).some((field) => field.name === 'model' && field.type === 'text')
99+}
100+
101+/**
102+ * mm's messages, split: its warnings (⚠️) are shown, the rest — meant for a
103+ * developer — stays folded.
104+ */
105+export function splitMessages(messages: string[] | null | undefined): { warnings: string[]; details: string[] } {
106+ const warnings: string[] = []
107+ const details: string[] = []
108+ for (const message of messages ?? []) {
109+ ;(message.trimStart().startsWith('⚠️') ? warnings : details).push(message)
110+ }
111+ return { warnings, details }
112+}
113+
114+/** An agent name Sidekicks accepts, which is also its folder's name. */
115+export function validName(name: string): boolean {
116+ return /^[a-z][a-z0-9_-]{0,31}$/.test(name)
117+}
118+
119+/**
120+ * The agent's folder: name in the agents' folder, with that folder's separator.
121+ *
122+ * @example
123+ * agentFolder('/Users/me/Documents', 'bob') // '/Users/me/Documents/bob'
124+ * agentFolder('C:\\Users\\me\\Documents', 'bob') // 'C:\\Users\\me\\Documents\\bob'
125+ */
126+export function agentFolder(folder: string, name: string): string {
127+ const separator = folder.includes('\\') && !folder.includes('/') ? '\\' : '/'
128+ return folder.endsWith(separator) ? folder + name : folder + separator + name
129+}
130+
131+/** The message key explaining a Problem of CreatorService.Finish. */
132+export function problemKey(problem: string): MessageKey {
133+ switch (problem) {
134+ case 'nameTaken':
135+ return 'creator.problem.nameTaken'
136+ case 'folderExists':
137+ return 'creator.problem.folderExists'
138+ default:
139+ return 'creator.problem.invalidName'
140+ }
141+}
142+
143+/**
144+ * What a Start error means for the user: mm missing, too old, or another
145+ * problem (shown with ErrorText).
146+ *
147+ * @example
148+ * startProblem('mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed') // { key: 'creator.mmTooOld', found: '1.0.8' }
149+ */
150+export function startProblem(raw: string): { key: MessageKey; found: string } | null {
151+ if (/mini-me \(mm\) is not installed/.test(raw)) return { key: 'creator.mmMissing', found: '' }
152+ const old = /mini-me \(mm\) (\S+) is too old/.exec(raw)
153+ if (old) return { key: 'creator.mmTooOld', found: old[1] }
154+ return null
155+}
new file mode 100644
@@ -0,0 +1,155 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// The assistant that creates a mini-me agent (issue #94): Go drives mm's
4+// wizard (CreatorService) and sends its questions as forms; this module
5+// turns a form into values the page edits, and those values back into the
6+// answer mm expects. No Svelte here, so that vitest can test it.
7+
8+import type { MessageKey } from './i18n/index.svelte'
9+
10+/** A question of a form, as acp.FormField gives it. */
11+export interface Field {
12+ name: string
13+ title: string
14+ description: string
15+ /** text, choice, multi, boolean or number. */
16+ type: string
17+ options: string[] | null
18+ default: unknown
19+ required: boolean
20+}
21+
22+export interface Form {
23+ message: string
24+ fields: Field[] | null
25+}
26+
27+export type Value = string | boolean | string[]
28+
29+/** Where the agent runs, as CreatorService.Finish takes it. */
30+export type Environment = 'local' | 'container' | 'sbx'
31+export const environments: Environment[] = ['local', 'container', 'sbx']
32+
33+/** A few emojis to pick from; any other can be typed. */
34+export const iconChoices = ['🤖', '🦊', '🐱', '🐼', '🦉', '🐙', '🧙', '👩‍🔬', '👨‍🍳', '🧑‍🚀', '🎨', '📚']
35+
36+/**
37+ * The values a form starts with: the defaults mm gives, else nothing (the
38+ * first option for a choice, which a select shows anyway).
39+ *
40+ * @example
41+ * initialValues({ message: '', fields: [{ name: 'yolo', type: 'boolean', default: true, … }] }) // { yolo: true }
42+ */
43+export function initialValues(form: Form): Record<string, Value> {
44+ const values: Record<string, Value> = {}
45+ for (const field of form.fields ?? []) {
46+ const value = field.default
47+ switch (field.type) {
48+ case 'boolean':
49+ values[field.name] = value === true || value === 'yes' || value === 'true'
50+ break
51+ case 'multi':
52+ values[field.name] = Array.isArray(value) ? value.map(String) : []
53+ break
54+ case 'choice':
55+ values[field.name] = value !== undefined && value !== null ? String(value) : (field.options?.[0] ?? '')
56+ break
57+ default:
58+ values[field.name] = value !== undefined && value !== null ? String(value) : ''
59+ }
60+ }
61+ return values
62+}
63+
64+/**
65+ * The content of an accepted form: each value with the type its field
66+ * asks for (a number field sends a number when the text is one).
67+ *
68+ * @example
69+ * contentOf(form, { name: ' bob ', yolo: false }) // { name: 'bob', yolo: false }
70+ */
71+export function contentOf(form: Form, values: Record<string, Value>): Record<string, unknown> {
72+ const content: Record<string, unknown> = {}
73+ for (const field of form.fields ?? []) {
74+ const value = values[field.name]
75+ if (typeof value === 'string') {
76+ const text = value.trim()
77+ content[field.name] = field.type === 'number' && text !== '' && !Number.isNaN(Number(text)) ? Number(text) : text
78+ } else {
79+ content[field.name] = value
80+ }
81+ }
82+ return content
83+}
84+
85+/** The required text fields still empty, by name: the form cannot be sent. */
86+export function missingFields(form: Form, values: Record<string, Value>): string[] {
87+ return (form.fields ?? [])
88+ .filter((field) => field.required && (field.type === 'text' || field.type === 'number' || field.type === 'choice'))
89+ .filter((field) => String(values[field.name] ?? '').trim() === '')
90+ .map((field) => field.name)
91+}
92+
93+/**
94+ * True when mm asks the model as plain text: no model server answered, so
95+ * it could not list the models (mm's "model" question has choices otherwise).
96+ */
97+export function noModelServer(form: Form | null | undefined): boolean {
98+ return (form?.fields ?? []).some((field) => field.name === 'model' && field.type === 'text')
99+}
100+
101+/**
102+ * mm's messages, split: its warnings (⚠️) are shown, the rest — meant for a
103+ * developer — stays folded.
104+ */
105+export function splitMessages(messages: string[] | null | undefined): { warnings: string[]; details: string[] } {
106+ const warnings: string[] = []
107+ const details: string[] = []
108+ for (const message of messages ?? []) {
109+ ;(message.trimStart().startsWith('⚠️') ? warnings : details).push(message)
110+ }
111+ return { warnings, details }
112+}
113+
114+/** An agent name Sidekicks accepts, which is also its folder's name. */
115+export function validName(name: string): boolean {
116+ return /^[a-z][a-z0-9_-]{0,31}$/.test(name)
117+}
118+
119+/**
120+ * The agent's folder: name in the agents' folder, with that folder's separator.
121+ *
122+ * @example
123+ * agentFolder('/Users/me/Documents', 'bob') // '/Users/me/Documents/bob'
124+ * agentFolder('C:\\Users\\me\\Documents', 'bob') // 'C:\\Users\\me\\Documents\\bob'
125+ */
126+export function agentFolder(folder: string, name: string): string {
127+ const separator = folder.includes('\\') && !folder.includes('/') ? '\\' : '/'
128+ return folder.endsWith(separator) ? folder + name : folder + separator + name
129+}
130+
131+/** The message key explaining a Problem of CreatorService.Finish. */
132+export function problemKey(problem: string): MessageKey {
133+ switch (problem) {
134+ case 'nameTaken':
135+ return 'creator.problem.nameTaken'
136+ case 'folderExists':
137+ return 'creator.problem.folderExists'
138+ default:
139+ return 'creator.problem.invalidName'
140+ }
141+}
142+
143+/**
144+ * What a Start error means for the user: mm missing, too old, or another
145+ * problem (shown with ErrorText).
146+ *
147+ * @example
148+ * startProblem('mini-me (mm) 1.0.8 is too old: version 1.0.9 or later is needed') // { key: 'creator.mmTooOld', found: '1.0.8' }
149+ */
150+export function startProblem(raw: string): { key: MessageKey; found: string } | null {
151+ if (/mini-me \(mm\) is not installed/.test(raw)) return { key: 'creator.mmMissing', found: '' }
152+ const old = /mini-me \(mm\) (\S+) is too old/.exec(raw)
153+ if (old) return { key: 'creator.mmTooOld', found: old[1] }
154+ return null
155+}
modified frontend/src/lib/i18n/messages.ts +84 -0
@@ -323,6 +323,48 @@ export const en = {
323323 'welcome.configAt': 'Configuration: {path}',
324324 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.',
325325 'agents.add': '+ Add an agent',
326+ 'agents.create': '✨ Create a mini-me agent',
327+ 'welcome.createFirst': '✨ Create my first agent',
328+ 'action.createAgent': 'Create a mini-me agent',
329+ 'creator.title': 'Create a mini-me agent',
330+ 'creator.intro': 'Answer a few questions: mini-me prepares the agent, then Sidekicks adds it to your agents. Its folder will be in {folder}.',
331+ 'creator.starting': 'Starting mini-me…',
332+ 'creator.waiting': 'mini-me is working…',
333+ 'creator.mmMissing': 'mini-me (mm) is not installed on this computer. Install it, then try again.',
334+ 'creator.mmTooOld': 'mini-me {found} is installed, but this assistant needs mini-me 1.0.9 or later. Update it, then try again.',
335+ 'creator.retry': 'Try again',
336+ 'creator.cancel': 'Cancel',
337+ 'creator.back': '← Previous question',
338+ 'creator.restart': 'Start again',
339+ 'creator.next': 'Next →',
340+ 'creator.about': 'About these choices',
341+ 'creator.details': 'What mini-me said',
342+ 'form.missing': 'Please fill this in.',
343+ 'form.label': 'Questions from {agent}',
344+ 'form.asks': '{agent} asks you:',
345+ 'form.answer': 'Answer',
346+ 'form.decline': 'Decline',
347+ 'creator.noModelServer': 'No model server answered, so mini-me cannot list the models. Start your model server (Docker Model Runner, llmman, Ollama…), then click "Start again". You can also type the name of a model yourself.',
348+ 'creator.stopped': 'The questions stopped: nothing was written yet.',
349+ 'creator.continue': 'Continue',
350+ 'creator.ready': 'Your agent is ready. Last details:',
351+ 'creator.name': 'Name',
352+ 'creator.nameHint': 'Used to call it with @{name}, and as the name of its folder: {folder}',
353+ 'creator.icon': 'Emoji',
354+ 'creator.iconHint': 'Pick one, or type any emoji.',
355+ 'creator.where': 'Where does it run?',
356+ 'creator.env.local': 'On this computer',
357+ 'creator.env.localHint': 'The simplest: mini-me runs directly on your computer.',
358+ 'creator.env.container': 'In a Docker container',
359+ 'creator.env.containerHint': 'mini-me prepares a Docker container; Docker must be installed.',
360+ 'creator.env.sbx': 'In a Docker Sandbox (sbx)',
361+ 'creator.env.sbxHint': 'mini-me prepares a sandbox, isolated from your computer; sbx must be installed.',
362+ 'creator.create': 'Add the agent',
363+ 'creator.creating': 'Adding…',
364+ 'creator.problem.nameTaken': 'Another agent already has this name: choose another one.',
365+ 'creator.problem.folderExists': 'A folder with this name already exists: choose another name.',
366+ 'creator.problem.invalidName': 'Use lowercase letters, digits, - or _, starting with a letter (32 characters at most).',
367+ 'creator.refused': 'The agent could not be added:',
326368 'palette.label': 'Command palette',
327369 'palette.placeholder': 'Go to a channel or an agent, or run an action…',
328370 'palette.none': 'Nothing matches.',
@@ -717,6 +759,48 @@ export const fr: Record<MessageKey, string> = {
717759 'welcome.configAt': 'Configuration : {path}',
718760 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.',
719761 'agents.add': '+ Ajouter un agent',
762+ 'agents.create': '✨ Créer un agent mini-me',
763+ 'welcome.createFirst': '✨ Créer mon premier agent',
764+ 'action.createAgent': 'Créer un agent mini-me',
765+ 'creator.title': 'Créer un agent mini-me',
766+ 'creator.intro': "Répondez à quelques questions : mini-me prépare l'agent, puis Sidekicks l'ajoute à vos agents. Son dossier sera dans {folder}.",
767+ 'creator.starting': 'Démarrage de mini-me…',
768+ 'creator.waiting': 'mini-me travaille…',
769+ 'creator.mmMissing': "mini-me (mm) n'est pas installé sur cet ordinateur. Installez-le, puis réessayez.",
770+ 'creator.mmTooOld': 'mini-me {found} est installé, mais cet assistant a besoin de mini-me 1.0.9 ou plus récent. Mettez-le à jour, puis réessayez.',
771+ 'creator.retry': 'Réessayer',
772+ 'creator.cancel': 'Annuler',
773+ 'creator.back': '← Question précédente',
774+ 'creator.restart': 'Recommencer',
775+ 'creator.next': 'Suivant →',
776+ 'creator.about': 'À propos de ces choix',
777+ 'creator.details': 'Ce que mini-me a dit',
778+ 'form.missing': 'Merci de remplir ce champ.',
779+ 'form.label': 'Questions de {agent}',
780+ 'form.asks': '{agent} vous demande :',
781+ 'form.answer': 'Répondre',
782+ 'form.decline': 'Refuser',
783+ 'creator.noModelServer': "Aucun serveur de modèles n'a répondu : mini-me ne peut pas lister les modèles. Démarrez votre serveur de modèles (Docker Model Runner, llmman, Ollama…), puis cliquez sur « Recommencer ». Vous pouvez aussi taper vous-même le nom d'un modèle.",
784+ 'creator.stopped': "Les questions se sont arrêtées : rien n'est encore écrit.",
785+ 'creator.continue': 'Continuer',
786+ 'creator.ready': 'Votre agent est prêt. Derniers détails :',
787+ 'creator.name': 'Nom',
788+ 'creator.nameHint': "Pour l'appeler avec @{name}, et comme nom de son dossier : {folder}",
789+ 'creator.icon': 'Emoji',
790+ 'creator.iconHint': "Choisissez-en un, ou tapez n'importe quel emoji.",
791+ 'creator.where': "Où s'exécute-t-il ?",
792+ 'creator.env.local': 'Sur cet ordinateur',
793+ 'creator.env.localHint': 'Le plus simple : mini-me tourne directement sur votre ordinateur.',
794+ 'creator.env.container': 'Dans un conteneur Docker',
795+ 'creator.env.containerHint': 'mini-me prépare un conteneur Docker ; Docker doit être installé.',
796+ 'creator.env.sbx': 'Dans une Docker Sandbox (sbx)',
797+ 'creator.env.sbxHint': 'mini-me prépare une sandbox, isolée de votre ordinateur ; sbx doit être installé.',
798+ 'creator.create': "Ajouter l'agent",
799+ 'creator.creating': 'Ajout…',
800+ 'creator.problem.nameTaken': 'Un autre agent porte déjà ce nom : choisissez-en un autre.',
801+ 'creator.problem.folderExists': 'Un dossier porte déjà ce nom : choisissez un autre nom.',
802+ 'creator.problem.invalidName': 'Utilisez des minuscules, des chiffres, - ou _, en commençant par une lettre (32 caractères au plus).',
803+ 'creator.refused': "L'agent n'a pas pu être ajouté :",
720804 'palette.label': 'Palette de commandes',
721805 'palette.placeholder': 'Aller à un channel ou un agent, ou lancer une action…',
722806 'palette.none': 'Aucun résultat.',
@@ -323,6 +323,48 @@ export const en = {
323 'welcome.configAt': 'Configuration: {path}',323 'welcome.configAt': 'Configuration: {path}',
324 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.',324 'welcome.pick': 'Pick a channel, or click an agent to talk with it directly.',
325 'agents.add': '+ Add an agent',325 'agents.add': '+ Add an agent',
326+ 'agents.create': '✨ Create a mini-me agent',
327+ 'welcome.createFirst': '✨ Create my first agent',
328+ 'action.createAgent': 'Create a mini-me agent',
329+ 'creator.title': 'Create a mini-me agent',
330+ 'creator.intro': 'Answer a few questions: mini-me prepares the agent, then Sidekicks adds it to your agents. Its folder will be in {folder}.',
331+ 'creator.starting': 'Starting mini-me…',
332+ 'creator.waiting': 'mini-me is working…',
333+ 'creator.mmMissing': 'mini-me (mm) is not installed on this computer. Install it, then try again.',
334+ 'creator.mmTooOld': 'mini-me {found} is installed, but this assistant needs mini-me 1.0.9 or later. Update it, then try again.',
335+ 'creator.retry': 'Try again',
336+ 'creator.cancel': 'Cancel',
337+ 'creator.back': '← Previous question',
338+ 'creator.restart': 'Start again',
339+ 'creator.next': 'Next →',
340+ 'creator.about': 'About these choices',
341+ 'creator.details': 'What mini-me said',
342+ 'form.missing': 'Please fill this in.',
343+ 'form.label': 'Questions from {agent}',
344+ 'form.asks': '{agent} asks you:',
345+ 'form.answer': 'Answer',
346+ 'form.decline': 'Decline',
347+ 'creator.noModelServer': 'No model server answered, so mini-me cannot list the models. Start your model server (Docker Model Runner, llmman, Ollama…), then click "Start again". You can also type the name of a model yourself.',
348+ 'creator.stopped': 'The questions stopped: nothing was written yet.',
349+ 'creator.continue': 'Continue',
350+ 'creator.ready': 'Your agent is ready. Last details:',
351+ 'creator.name': 'Name',
352+ 'creator.nameHint': 'Used to call it with @{name}, and as the name of its folder: {folder}',
353+ 'creator.icon': 'Emoji',
354+ 'creator.iconHint': 'Pick one, or type any emoji.',
355+ 'creator.where': 'Where does it run?',
356+ 'creator.env.local': 'On this computer',
357+ 'creator.env.localHint': 'The simplest: mini-me runs directly on your computer.',
358+ 'creator.env.container': 'In a Docker container',
359+ 'creator.env.containerHint': 'mini-me prepares a Docker container; Docker must be installed.',
360+ 'creator.env.sbx': 'In a Docker Sandbox (sbx)',
361+ 'creator.env.sbxHint': 'mini-me prepares a sandbox, isolated from your computer; sbx must be installed.',
362+ 'creator.create': 'Add the agent',
363+ 'creator.creating': 'Adding…',
364+ 'creator.problem.nameTaken': 'Another agent already has this name: choose another one.',
365+ 'creator.problem.folderExists': 'A folder with this name already exists: choose another name.',
366+ 'creator.problem.invalidName': 'Use lowercase letters, digits, - or _, starting with a letter (32 characters at most).',
367+ 'creator.refused': 'The agent could not be added:',
326 'palette.label': 'Command palette',368 'palette.label': 'Command palette',
327 'palette.placeholder': 'Go to a channel or an agent, or run an action…',369 'palette.placeholder': 'Go to a channel or an agent, or run an action…',
328 'palette.none': 'Nothing matches.',370 'palette.none': 'Nothing matches.',
@@ -717,6 +759,48 @@ export const fr: Record<MessageKey, string> = {
717 'welcome.configAt': 'Configuration : {path}',759 'welcome.configAt': 'Configuration : {path}',
718 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.',760 'welcome.pick': 'Choisissez un channel, ou cliquez sur un agent pour lui parler directement.',
719 'agents.add': '+ Ajouter un agent',761 'agents.add': '+ Ajouter un agent',
762+ 'agents.create': '✨ Créer un agent mini-me',
763+ 'welcome.createFirst': '✨ Créer mon premier agent',
764+ 'action.createAgent': 'Créer un agent mini-me',
765+ 'creator.title': 'Créer un agent mini-me',
766+ 'creator.intro': "Répondez à quelques questions : mini-me prépare l'agent, puis Sidekicks l'ajoute à vos agents. Son dossier sera dans {folder}.",
767+ 'creator.starting': 'Démarrage de mini-me…',
768+ 'creator.waiting': 'mini-me travaille…',
769+ 'creator.mmMissing': "mini-me (mm) n'est pas installé sur cet ordinateur. Installez-le, puis réessayez.",
770+ 'creator.mmTooOld': 'mini-me {found} est installé, mais cet assistant a besoin de mini-me 1.0.9 ou plus récent. Mettez-le à jour, puis réessayez.',
771+ 'creator.retry': 'Réessayer',
772+ 'creator.cancel': 'Annuler',
773+ 'creator.back': '← Question précédente',
774+ 'creator.restart': 'Recommencer',
775+ 'creator.next': 'Suivant →',
776+ 'creator.about': 'À propos de ces choix',
777+ 'creator.details': 'Ce que mini-me a dit',
778+ 'form.missing': 'Merci de remplir ce champ.',
779+ 'form.label': 'Questions de {agent}',
780+ 'form.asks': '{agent} vous demande :',
781+ 'form.answer': 'Répondre',
782+ 'form.decline': 'Refuser',
783+ 'creator.noModelServer': "Aucun serveur de modèles n'a répondu : mini-me ne peut pas lister les modèles. Démarrez votre serveur de modèles (Docker Model Runner, llmman, Ollama…), puis cliquez sur « Recommencer ». Vous pouvez aussi taper vous-même le nom d'un modèle.",
784+ 'creator.stopped': "Les questions se sont arrêtées : rien n'est encore écrit.",
785+ 'creator.continue': 'Continuer',
786+ 'creator.ready': 'Votre agent est prêt. Derniers détails :',
787+ 'creator.name': 'Nom',
788+ 'creator.nameHint': "Pour l'appeler avec @{name}, et comme nom de son dossier : {folder}",
789+ 'creator.icon': 'Emoji',
790+ 'creator.iconHint': "Choisissez-en un, ou tapez n'importe quel emoji.",
791+ 'creator.where': "Où s'exécute-t-il ?",
792+ 'creator.env.local': 'Sur cet ordinateur',
793+ 'creator.env.localHint': 'Le plus simple : mini-me tourne directement sur votre ordinateur.',
794+ 'creator.env.container': 'Dans un conteneur Docker',
795+ 'creator.env.containerHint': 'mini-me prépare un conteneur Docker ; Docker doit être installé.',
796+ 'creator.env.sbx': 'Dans une Docker Sandbox (sbx)',
797+ 'creator.env.sbxHint': 'mini-me prépare une sandbox, isolée de votre ordinateur ; sbx doit être installé.',
798+ 'creator.create': "Ajouter l'agent",
799+ 'creator.creating': 'Ajout…',
800+ 'creator.problem.nameTaken': 'Un autre agent porte déjà ce nom : choisissez-en un autre.',
801+ 'creator.problem.folderExists': 'Un dossier porte déjà ce nom : choisissez un autre nom.',
802+ 'creator.problem.invalidName': 'Utilisez des minuscules, des chiffres, - ou _, en commençant par une lettre (32 caractères au plus).',
803+ 'creator.refused': "L'agent n'a pas pu être ajouté :",
720 'palette.label': 'Palette de commandes',804 'palette.label': 'Palette de commandes',
721 'palette.placeholder': 'Aller à un channel ou un agent, ou lancer une action…',805 'palette.placeholder': 'Aller à un channel ou un agent, ou lancer une action…',
722 'palette.none': 'Aucun résultat.',806 'palette.none': 'Aucun résultat.',
modified frontend/src/lib/layout/CommandPalette.svelte +2 -1
@@ -6,7 +6,7 @@
66 import { t } from '../i18n/index.svelte'
77 import { textIcon } from '../avatar'
88 import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts'
9- import { act, appState, openDirect, openWorkspace, selectChannel } from '../state.svelte'
9+ import { act, appState, openCreator, openDirect, openWorkspace, selectChannel } from '../state.svelte'
1010 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
1111
1212 let { run }: { run: (action: Action) => void } = $props()
@@ -31,6 +31,7 @@
3131 id: `files:${agent.name}`, label: t('palette.filesOf', { agent: agent.title }), hint: t('palette.files'), run: () => openWorkspace(agent.name),
3232 })),
3333 ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })),
34+ { id: 'action:createAgent', label: t('action.createAgent'), hint: '', run: openCreator },
3435 { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) },
3536 ]
3637 })
@@ -6,7 +6,7 @@
6 import { t } from '../i18n/index.svelte'6 import { t } from '../i18n/index.svelte'
7 import { textIcon } from '../avatar'7 import { textIcon } from '../avatar'
8 import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts'8 import { filterEntries, isMac, shortcutLabel, type Action, type PaletteEntry } from '../shortcuts'
9- import { act, appState, openDirect, openWorkspace, selectChannel } from '../state.svelte'9+ import { act, appState, openCreator, openDirect, openWorkspace, selectChannel } from '../state.svelte'
10 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'10 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
11 11
12 let { run }: { run: (action: Action) => void } = $props()12 let { run }: { run: (action: Action) => void } = $props()
@@ -31,6 +31,7 @@
31 id: `files:${agent.name}`, label: t('palette.filesOf', { agent: agent.title }), hint: t('palette.files'), run: () => openWorkspace(agent.name),31 id: `files:${agent.name}`, label: t('palette.filesOf', { agent: agent.title }), hint: t('palette.files'), run: () => openWorkspace(agent.name),
32 })),32 })),
33 ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })),33 ...actions.map((action) => ({ id: `action:${action}`, label: t(`action.${action}`), hint: shortcutLabel(action, mac), run: () => run(action) })),
34+ { id: 'action:createAgent', label: t('action.createAgent'), hint: '', run: openCreator },
34 { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) },35 { id: 'action:openConfig', label: t('action.openConfig'), hint: '', run: () => void act(() => ConfigService.Choose()) },
35 ]36 ]
36 })37 })
modified frontend/src/lib/panels/AgentsPanel.svelte +2 -1
@@ -6,7 +6,7 @@
66 import ErrorText from '../chat/ErrorText.svelte'
77 import AgentAvatar from '../agent/AgentAvatar.svelte'
88 import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
9- import { act, appState, channelOf, loadCommands, openAssistant, openDirect, openWorkspace } from '../state.svelte'
9+ import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openWorkspace } from '../state.svelte'
1010 import { directOf } from '../conversation'
1111 import { canUnload, unloadReady } from '../unload'
1212
@@ -60,6 +60,7 @@
6060 {/each}
6161 </ul>
6262 {/if}
63+<button class="add" onclick={openCreator}>{t('agents.create')}</button>
6364 <button class="add" onclick={openAssistant}>{t('agents.add')}</button>
6465 <ActionError />
6566
@@ -6,7 +6,7 @@
6 import ErrorText from '../chat/ErrorText.svelte'6 import ErrorText from '../chat/ErrorText.svelte'
7 import AgentAvatar from '../agent/AgentAvatar.svelte'7 import AgentAvatar from '../agent/AgentAvatar.svelte'
8 import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'8 import { AgentService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
9- import { act, appState, channelOf, loadCommands, openAssistant, openDirect, openWorkspace } from '../state.svelte'9+ import { act, appState, channelOf, loadCommands, openAssistant, openCreator, openDirect, openWorkspace } from '../state.svelte'
10 import { directOf } from '../conversation'10 import { directOf } from '../conversation'
11 import { canUnload, unloadReady } from '../unload'11 import { canUnload, unloadReady } from '../unload'
12 12
@@ -60,6 +60,7 @@
60 {/each}60 {/each}
61 </ul>61 </ul>
62 {/if}62 {/if}
63+<button class="add" onclick={openCreator}>{t('agents.create')}</button>
63 <button class="add" onclick={openAssistant}>{t('agents.add')}</button>64 <button class="add" onclick={openAssistant}>{t('agents.add')}</button>
64 <ActionError />65 <ActionError />
65 66
modified frontend/src/lib/panels/ConversationPanel.svelte +12 -3
@@ -5,18 +5,20 @@
55 import Composer from '../chat/Composer.svelte'
66 import MessageView from '../chat/MessageView.svelte'
77 import PermissionCard from '../chat/PermissionCard.svelte'
8+ import FormCard from '../chat/FormCard.svelte'
89 import Spinner from '../chat/Spinner.svelte'
910 import AgentView from '../agent/AgentView.svelte'
1011 import LinkedFilePanel from '../agent/LinkedFilePanel.svelte'
1112 import { Pane, PaneGroup, PaneResizer } from 'paneforge'
1213 import AddAgentForm from '../agent/AddAgentForm.svelte'
14+ import CreateMiniMeAgent from '../agent/CreateMiniMeAgent.svelte'
1315 import AgentAvatar from '../agent/AgentAvatar.svelte'
1416 import { textIcon } from '../avatar'
1517 import ActionError from '../chat/ActionError.svelte'
1618 import Logo from '../layout/Logo.svelte'
1719 import { drafts, isNearBottom, type Trigger } from '../composer'
1820 import { notStreaming, usagePercent } from '../conversation'
19- import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, prepareCommands, removeMember, send } from '../state.svelte'
21+ import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, prepareCommands, removeMember, send } from '../state.svelte'
2022 import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
2123 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
2224 import { FilesDropped } from '../../../bindings/events'
@@ -175,6 +177,7 @@
175177 JSON.stringify(conversation?.messages?.at(-1))
176178 void conversation?.messages?.length
177179 void conversation?.permissions?.length
180+ void conversation?.forms?.length
178181 if (following && list) tick().then(() => list && (list.scrollTop = list.scrollHeight))
179182 })
180183 $effect(() => {
@@ -203,7 +206,9 @@
203206 <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div>
204207 {/if}
205208
206- {#if appState.assistant}
209+ {#if appState.creator}
210+ <CreateMiniMeAgent />
211+ {:else if appState.assistant}
207212 <AddAgentForm />
208213 {:else if appState.workspaceAgent}
209214 {#key appState.workspaceAgent}
@@ -287,6 +292,9 @@
287292 {#each conversation.permissions ?? [] as permission (permission.id)}
288293 <PermissionCard {permission} />
289294 {/each}
295+ {#each conversation.forms ?? [] as request (request.id)}
296+ <FormCard {request} />
297+ {/each}
290298 </div>
291299 {#if failures >= stuckAfter}
292300 <div class="stuck" role="alert">
@@ -337,7 +345,8 @@
337345 {/each}
338346 </ol>
339347 <div class="buttons">
340- <button class="primary" onclick={openAssistant}>{t('welcome.addFirst')}</button>
348+ <button class="primary" onclick={openCreator}>{t('welcome.createFirst')}</button>
349+ <button onclick={openAssistant}>{t('welcome.addFirst')}</button>
341350 <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button>
342351 </div>
343352 {#if appState.config?.path}
@@ -5,18 +5,20 @@
5 import Composer from '../chat/Composer.svelte'5 import Composer from '../chat/Composer.svelte'
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 Spinner from '../chat/Spinner.svelte'9 import Spinner from '../chat/Spinner.svelte'
9 import AgentView from '../agent/AgentView.svelte'10 import AgentView from '../agent/AgentView.svelte'
10 import LinkedFilePanel from '../agent/LinkedFilePanel.svelte'11 import LinkedFilePanel from '../agent/LinkedFilePanel.svelte'
11 import { Pane, PaneGroup, PaneResizer } from 'paneforge'12 import { Pane, PaneGroup, PaneResizer } from 'paneforge'
12 import AddAgentForm from '../agent/AddAgentForm.svelte'13 import AddAgentForm from '../agent/AddAgentForm.svelte'
14+ import CreateMiniMeAgent from '../agent/CreateMiniMeAgent.svelte'
13 import AgentAvatar from '../agent/AgentAvatar.svelte'15 import AgentAvatar from '../agent/AgentAvatar.svelte'
14 import { textIcon } from '../avatar'16 import { textIcon } from '../avatar'
15 import ActionError from '../chat/ActionError.svelte'17 import ActionError from '../chat/ActionError.svelte'
16 import Logo from '../layout/Logo.svelte'18 import Logo from '../layout/Logo.svelte'
17 import { drafts, isNearBottom, type Trigger } from '../composer'19 import { drafts, isNearBottom, type Trigger } from '../composer'
18 import { notStreaming, usagePercent } from '../conversation'20 import { notStreaming, usagePercent } from '../conversation'
19- import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, prepareCommands, removeMember, send } from '../state.svelte'21+ import { act, addMember, agentTitle, appState, cancel, channelOf, clearHistory, loadOlder, openAssistant, openCreator, prepareCommands, removeMember, send } from '../state.svelte'
20 import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'22 import { ConfigService, WorkspaceService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
21 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'23 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
22 import { FilesDropped } from '../../../bindings/events'24 import { FilesDropped } from '../../../bindings/events'
@@ -175,6 +177,7 @@
175 JSON.stringify(conversation?.messages?.at(-1))177 JSON.stringify(conversation?.messages?.at(-1))
176 void conversation?.messages?.length178 void conversation?.messages?.length
177 void conversation?.permissions?.length179 void conversation?.permissions?.length
180+ void conversation?.forms?.length
178 if (following && list) tick().then(() => list && (list.scrollTop = list.scrollHeight))181 if (following && list) tick().then(() => list && (list.scrollTop = list.scrollHeight))
179 })182 })
180 $effect(() => {183 $effect(() => {
@@ -203,7 +206,9 @@
203 <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div>206 <div class="banner warning" role="alert">{t('conversation.historyProblem', { problem: appState.config.historyProblem })}</div>
204 {/if}207 {/if}
205 208
206- {#if appState.assistant}209+ {#if appState.creator}
210+ <CreateMiniMeAgent />
211+ {:else if appState.assistant}
207 <AddAgentForm />212 <AddAgentForm />
208 {:else if appState.workspaceAgent}213 {:else if appState.workspaceAgent}
209 {#key appState.workspaceAgent}214 {#key appState.workspaceAgent}
@@ -287,6 +292,9 @@
287 {#each conversation.permissions ?? [] as permission (permission.id)}292 {#each conversation.permissions ?? [] as permission (permission.id)}
288 <PermissionCard {permission} />293 <PermissionCard {permission} />
289 {/each}294 {/each}
295+ {#each conversation.forms ?? [] as request (request.id)}
296+ <FormCard {request} />
297+ {/each}
290 </div>298 </div>
291 {#if failures >= stuckAfter}299 {#if failures >= stuckAfter}
292 <div class="stuck" role="alert">300 <div class="stuck" role="alert">
@@ -337,7 +345,8 @@
337 {/each}345 {/each}
338 </ol>346 </ol>
339 <div class="buttons">347 <div class="buttons">
340- <button class="primary" onclick={openAssistant}>{t('welcome.addFirst')}</button>348+ <button class="primary" onclick={openCreator}>{t('welcome.createFirst')}</button>
349+ <button onclick={openAssistant}>{t('welcome.addFirst')}</button>
341 <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button>350 <button onclick={() => act(() => ConfigService.Choose())}>{t('welcome.openConfig')}</button>
342 </div>351 </div>
343 {#if appState.config?.path}352 {#if appState.config?.path}
modified frontend/src/lib/state.svelte.ts +25 -1
@@ -17,6 +17,8 @@ import type {
1717 CommandsPayload,
1818 Conversation,
1919 DeltaPayload,
20+ FormRequest,
21+ FormResolvedPayload,
2022 MessagePayload,
2123 Permission,
2224 PermissionResolvedPayload,
@@ -29,6 +31,8 @@ import {
2931 ChannelsChanged,
3032 CommandsChanged,
3133 ConfigChanged,
34+ FormRequested,
35+ FormResolved,
3236 MessageDelta,
3337 MessageUpdated,
3438 PermissionRequested,
@@ -39,7 +43,7 @@ import {
3943 UsageChanged,
4044 WorkspaceChanged,
4145 } from '../../bindings/events'
42-import { addPermission, applyDelta, applyMessage, emptyConversation, prependMessages, removePermission } from './conversation'
46+import { addForm, addPermission, applyDelta, applyMessage, emptyConversation, prependMessages, removeForm, removePermission } from './conversation'
4347 import { createFrameBatcher, subscribe } from './events'
4448 import { applyTheme } from './theme'
4549 import { setLanguage } from './i18n/index.svelte'
@@ -93,6 +97,8 @@ export const appState = $state({
9397 actionError: '',
9498 /** The "add an agent" assistant is shown in the centre. */
9599 assistant: false,
100+ /** The assistant that creates a mini-me agent (issue #94) is shown in the centre. */
101+ creator: false,
96102 /** An agent just added with the assistant: its conversation opens once it is loaded. */
97103 pendingAgent: '',
98104 /** The command palette (⌘K) is open. */
@@ -172,6 +178,7 @@ export async function selectChannel(id: string) {
172178 conversationOf(id) // shown empty until loaded
173179 appState.workspaceAgent = ''
174180 appState.assistant = false
181+ appState.creator = false
175182 appState.selectedChannel = id
176183 appState.unread[id] = 0
177184 const channel = channelOf(id)
@@ -205,6 +212,7 @@ export function closeLinkedFile(channel: string) {
205212 /** Shows the workspace of agent (files, terminal, log) in the centre. */
206213 export function openWorkspace(agent: string, file = '') {
207214 appState.assistant = false
215+ appState.creator = false
208216 appState.workspaceAgent = agent
209217 appState.workspaceFile = file
210218 }
@@ -212,9 +220,17 @@ export function openWorkspace(agent: string, file = '') {
212220 /** Shows the "add an agent" assistant in the centre. */
213221 export function openAssistant() {
214222 appState.workspaceAgent = ''
223+ appState.creator = false
215224 appState.assistant = true
216225 }
217226
227+/** Shows the assistant that creates a mini-me agent (issue #94) in the centre. */
228+export function openCreator() {
229+ appState.workspaceAgent = ''
230+ appState.assistant = false
231+ appState.creator = true
232+}
233+
218234 /**
219235 * Called once the assistant has written the agent to the configuration:
220236 * its direct conversation opens when the reloaded configuration lists it.
@@ -236,6 +252,7 @@ export async function historyReset() {
236252
237253 export function agentAdded(name: string) {
238254 appState.assistant = false
255+ appState.creator = false
239256 appState.pendingAgent = name
240257 if (appState.agents.some((agent) => agent.name === name)) void refreshAgents()
241258 }
@@ -303,6 +320,11 @@ export function answerPermission(permission: Permission, optionId: string) {
303320 return act(() => ChannelService.AnswerPermission(permission.id, optionId))
304321 }
305322
323+/** Answers a form an agent asked (issue #95): accept with the values, or decline. */
324+export function answerForm(request: FormRequest, answer: { action: string; content: Record<string, unknown> }) {
325+ return act(() => ChannelService.AnswerForm(request.id, answer))
326+}
327+
306328 export function createChannel(name: string) {
307329 return act(async () => {
308330 const channel = await ChannelService.Create(name, '')
@@ -419,6 +441,8 @@ export function connect(): () => void {
419441 }),
420442 subscribe<Permission>(PermissionRequested, (payload) => addPermission(conversationOf(payload.channel), payload)),
421443 subscribe<PermissionResolvedPayload>(PermissionResolved, (payload) => removePermission(conversationOf(payload.channel), payload.id)),
444+ subscribe<FormRequest>(FormRequested, (payload) => addForm(conversationOf(payload.channel), payload)),
445+ subscribe<FormResolvedPayload>(FormResolved, (payload) => removeForm(conversationOf(payload.channel), payload.id)),
422446 subscribe<UsagePayload>(UsageChanged, (payload) => {
423447 const conversation = conversationOf(payload.channel)
424448 conversation.usage = { ...(conversation.usage ?? {}), [payload.agent]: payload.usage }
@@ -17,6 +17,8 @@ import type {
17 CommandsPayload,17 CommandsPayload,
18 Conversation,18 Conversation,
19 DeltaPayload,19 DeltaPayload,
20+ FormRequest,
21+ FormResolvedPayload,
20 MessagePayload,22 MessagePayload,
21 Permission,23 Permission,
22 PermissionResolvedPayload,24 PermissionResolvedPayload,
@@ -29,6 +31,8 @@ import {
29 ChannelsChanged,31 ChannelsChanged,
30 CommandsChanged,32 CommandsChanged,
31 ConfigChanged,33 ConfigChanged,
34+ FormRequested,
35+ FormResolved,
32 MessageDelta,36 MessageDelta,
33 MessageUpdated,37 MessageUpdated,
34 PermissionRequested,38 PermissionRequested,
@@ -39,7 +43,7 @@ import {
39 UsageChanged,43 UsageChanged,
40 WorkspaceChanged,44 WorkspaceChanged,
41 } from '../../bindings/events'45 } from '../../bindings/events'
42-import { addPermission, applyDelta, applyMessage, emptyConversation, prependMessages, removePermission } from './conversation'46+import { addForm, addPermission, applyDelta, applyMessage, emptyConversation, prependMessages, removeForm, removePermission } from './conversation'
43 import { createFrameBatcher, subscribe } from './events'47 import { createFrameBatcher, subscribe } from './events'
44 import { applyTheme } from './theme'48 import { applyTheme } from './theme'
45 import { setLanguage } from './i18n/index.svelte'49 import { setLanguage } from './i18n/index.svelte'
@@ -93,6 +97,8 @@ export const appState = $state({
93 actionError: '',97 actionError: '',
94 /** The "add an agent" assistant is shown in the centre. */98 /** The "add an agent" assistant is shown in the centre. */
95 assistant: false,99 assistant: false,
100+ /** The assistant that creates a mini-me agent (issue #94) is shown in the centre. */
101+ creator: false,
96 /** An agent just added with the assistant: its conversation opens once it is loaded. */102 /** An agent just added with the assistant: its conversation opens once it is loaded. */
97 pendingAgent: '',103 pendingAgent: '',
98 /** The command palette (⌘K) is open. */104 /** The command palette (⌘K) is open. */
@@ -172,6 +178,7 @@ export async function selectChannel(id: string) {
172 conversationOf(id) // shown empty until loaded178 conversationOf(id) // shown empty until loaded
173 appState.workspaceAgent = ''179 appState.workspaceAgent = ''
174 appState.assistant = false180 appState.assistant = false
181+ appState.creator = false
175 appState.selectedChannel = id182 appState.selectedChannel = id
176 appState.unread[id] = 0183 appState.unread[id] = 0
177 const channel = channelOf(id)184 const channel = channelOf(id)
@@ -205,6 +212,7 @@ export function closeLinkedFile(channel: string) {
205 /** Shows the workspace of agent (files, terminal, log) in the centre. */212 /** Shows the workspace of agent (files, terminal, log) in the centre. */
206 export function openWorkspace(agent: string, file = '') {213 export function openWorkspace(agent: string, file = '') {
207 appState.assistant = false214 appState.assistant = false
215+ appState.creator = false
208 appState.workspaceAgent = agent216 appState.workspaceAgent = agent
209 appState.workspaceFile = file217 appState.workspaceFile = file
210 }218 }
@@ -212,9 +220,17 @@ export function openWorkspace(agent: string, file = '') {
212 /** Shows the "add an agent" assistant in the centre. */220 /** Shows the "add an agent" assistant in the centre. */
213 export function openAssistant() {221 export function openAssistant() {
214 appState.workspaceAgent = ''222 appState.workspaceAgent = ''
223+ appState.creator = false
215 appState.assistant = true224 appState.assistant = true
216 }225 }
217 226
227+/** Shows the assistant that creates a mini-me agent (issue #94) in the centre. */
228+export function openCreator() {
229+ appState.workspaceAgent = ''
230+ appState.assistant = false
231+ appState.creator = true
232+}
233+
218 /**234 /**
219 * Called once the assistant has written the agent to the configuration:235 * Called once the assistant has written the agent to the configuration:
220 * its direct conversation opens when the reloaded configuration lists it.236 * its direct conversation opens when the reloaded configuration lists it.
@@ -236,6 +252,7 @@ export async function historyReset() {
236 252
237 export function agentAdded(name: string) {253 export function agentAdded(name: string) {
238 appState.assistant = false254 appState.assistant = false
255+ appState.creator = false
239 appState.pendingAgent = name256 appState.pendingAgent = name
240 if (appState.agents.some((agent) => agent.name === name)) void refreshAgents()257 if (appState.agents.some((agent) => agent.name === name)) void refreshAgents()
241 }258 }
@@ -303,6 +320,11 @@ export function answerPermission(permission: Permission, optionId: string) {
303 return act(() => ChannelService.AnswerPermission(permission.id, optionId))320 return act(() => ChannelService.AnswerPermission(permission.id, optionId))
304 }321 }
305 322
323+/** Answers a form an agent asked (issue #95): accept with the values, or decline. */
324+export function answerForm(request: FormRequest, answer: { action: string; content: Record<string, unknown> }) {
325+ return act(() => ChannelService.AnswerForm(request.id, answer))
326+}
327+
306 export function createChannel(name: string) {328 export function createChannel(name: string) {
307 return act(async () => {329 return act(async () => {
308 const channel = await ChannelService.Create(name, '')330 const channel = await ChannelService.Create(name, '')
@@ -419,6 +441,8 @@ export function connect(): () => void {
419 }),441 }),
420 subscribe<Permission>(PermissionRequested, (payload) => addPermission(conversationOf(payload.channel), payload)),442 subscribe<Permission>(PermissionRequested, (payload) => addPermission(conversationOf(payload.channel), payload)),
421 subscribe<PermissionResolvedPayload>(PermissionResolved, (payload) => removePermission(conversationOf(payload.channel), payload.id)),443 subscribe<PermissionResolvedPayload>(PermissionResolved, (payload) => removePermission(conversationOf(payload.channel), payload.id)),
444+ subscribe<FormRequest>(FormRequested, (payload) => addForm(conversationOf(payload.channel), payload)),
445+ subscribe<FormResolvedPayload>(FormResolved, (payload) => removeForm(conversationOf(payload.channel), payload.id)),
422 subscribe<UsagePayload>(UsageChanged, (payload) => {446 subscribe<UsagePayload>(UsageChanged, (payload) => {
423 const conversation = conversationOf(payload.channel)447 const conversation = conversationOf(payload.channel)
424 conversation.usage = { ...(conversation.usage ?? {}), [payload.agent]: payload.usage }448 conversation.usage = { ...(conversation.usage ?? {}), [payload.agent]: payload.usage }
modified frontend/src/lib/yamlSchema.test.ts +1 -1
@@ -11,7 +11,7 @@ const labels = (suggestions: Array<{ label: string }>) => suggestions.map((sugge
1111
1212 describe('createSchemaIndex', () => {
1313 it('lists the keys of the schema, following $ref and list items', () => {
14- expect(labels(schema.keysAt([]))).toEqual(['version', 'ui', 'limits', 'agentTools', 'agents', 'channels'])
14+ expect(labels(schema.keysAt([]))).toEqual(['version', 'ui', 'limits', 'agentTools', 'agentsFolder', 'agents', 'channels'])
1515 expect(labels(schema.keysAt(['agentTools']))).toEqual(['enabled', 'offer'])
1616 expect(labels(schema.keysAt(['agents', item]))).toContain('workspace')
1717 expect(labels(schema.keysAt(['agents', item, 'runtime']))).toEqual(['type', 'container', 'sandbox', 'workspacePath', 'lifecycle'])
@@ -11,7 +11,7 @@ const labels = (suggestions: Array<{ label: string }>) => suggestions.map((sugge
11 11
12 describe('createSchemaIndex', () => {12 describe('createSchemaIndex', () => {
13 it('lists the keys of the schema, following $ref and list items', () => {13 it('lists the keys of the schema, following $ref and list items', () => {
14- expect(labels(schema.keysAt([]))).toEqual(['version', 'ui', 'limits', 'agentTools', 'agents', 'channels'])14+ expect(labels(schema.keysAt([]))).toEqual(['version', 'ui', 'limits', 'agentTools', 'agentsFolder', 'agents', 'channels'])
15 expect(labels(schema.keysAt(['agentTools']))).toEqual(['enabled', 'offer'])15 expect(labels(schema.keysAt(['agentTools']))).toEqual(['enabled', 'offer'])
16 expect(labels(schema.keysAt(['agents', item]))).toContain('workspace')16 expect(labels(schema.keysAt(['agents', item]))).toContain('workspace')
17 expect(labels(schema.keysAt(['agents', item, 'runtime']))).toEqual(['type', 'container', 'sandbox', 'workspacePath', 'lifecycle'])17 expect(labels(schema.keysAt(['agents', item, 'runtime']))).toEqual(['type', 'container', 'sandbox', 'workspacePath', 'lifecycle'])
modified internal/acp/client.go +4 -1
@@ -10,11 +10,14 @@ import (
1010
1111 // client answers the requests an agent sends to Sidekicks: session updates
1212 // and permission requests go to the handler of their session; the tools
13-// Sidekicks offers are answered (tools.go); file and terminal access — which
13+// Sidekicks offers are answered (tools.go), and so are forms when
14+// Spec.OnForm is set (forms.go); file and terminal access — which
1415 // Sidekicks does not advertise (ADR 0001, decision 5) — is refused.
1516 type client struct {
1617 sessions *sessions
1718 tools []Tool
19+ onForm FormHandler
20+ forms bool
1821 }
1922
2023 func (c *client) SessionUpdate(_ context.Context, notification sdk.SessionNotification) error {
@@ -10,11 +10,14 @@ import (
10 10
11 // client answers the requests an agent sends to Sidekicks: session updates11 // client answers the requests an agent sends to Sidekicks: session updates
12 // and permission requests go to the handler of their session; the tools12 // and permission requests go to the handler of their session; the tools
13-// Sidekicks offers are answered (tools.go); file and terminal access — which13+// Sidekicks offers are answered (tools.go), and so are forms when
14+// Spec.OnForm is set (forms.go); file and terminal access — which
14 // Sidekicks does not advertise (ADR 0001, decision 5) — is refused.15 // Sidekicks does not advertise (ADR 0001, decision 5) — is refused.
15 type client struct {16 type client struct {
16 sessions *sessions17 sessions *sessions
17 tools []Tool18 tools []Tool
19+ onForm FormHandler
20+ forms bool
18 }21 }
19 22
20 func (c *client) SessionUpdate(_ context.Context, notification sdk.SessionNotification) error {23 func (c *client) SessionUpdate(_ context.Context, notification sdk.SessionNotification) error {
modified internal/acp/conn.go +8 -2
@@ -64,6 +64,12 @@ type Spec struct {
6464 ToolDiscovery string
6565 // ClientVersion is Sidekicks' version, told in initialize.
6666 ClientVersion string
67+ // OnForm answers the forms the agent asks the user to fill in (ACP
68+ // elicitation, issue #94). Forms (issue #95) sends each form to the
69+ // handler of its session instead, when it is a FormAsker. With neither,
70+ // no form support is advertised.
71+ OnForm FormHandler
72+ Forms bool
6773 }
6874
6975 // Options tunes Start. The zero value is usable.
@@ -159,7 +165,7 @@ func (c *Conn) launch(onStderr func(string)) error {
159165 stderrDone := make(chan struct{})
160166 go c.readStderr(stderr, onStderr, stderrDone)
161167 go c.wait(stderrDone)
162- c.connection = sdk.NewClientSideConnection(&client{sessions: c.sessions, tools: c.spec.Tools}, stdin, stdout)
168+ c.connection = sdk.NewClientSideConnection(&client{sessions: c.sessions, tools: c.spec.Tools, onForm: c.spec.OnForm, forms: c.spec.Forms}, stdin, stdout)
163169 // The SDK logs its own diagnostics ("connection closed"…); the agent's
164170 // stderr already tells what matters.
165171 c.connection.SetLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))
@@ -207,7 +213,7 @@ func (c *Conn) initialize(ctx context.Context) error {
207213 go func() {
208214 response, err := c.connection.Initialize(ctx, sdk.InitializeRequest{
209215 ProtocolVersion: sdk.ProtocolVersion(ProtocolVersion),
210- ClientCapabilities: sdk.ClientCapabilities{Meta: toolsMeta(c.spec.Tools, c.spec.ToolDiscovery)},
216+ ClientCapabilities: sdk.ClientCapabilities{Meta: toolsMeta(c.spec.Tools, c.spec.ToolDiscovery), Elicitation: elicitationCapabilities(c.spec.OnForm, c.spec.Forms)},
211217 ClientInfo: &sdk.Implementation{Name: "sidekicks", Version: clientVersion(c.spec.ClientVersion)},
212218 })
213219 answer <- result{response, err}
@@ -64,6 +64,12 @@ type Spec struct {
64 ToolDiscovery string64 ToolDiscovery string
65 // ClientVersion is Sidekicks' version, told in initialize.65 // ClientVersion is Sidekicks' version, told in initialize.
66 ClientVersion string66 ClientVersion string
67+ // OnForm answers the forms the agent asks the user to fill in (ACP
68+ // elicitation, issue #94). Forms (issue #95) sends each form to the
69+ // handler of its session instead, when it is a FormAsker. With neither,
70+ // no form support is advertised.
71+ OnForm FormHandler
72+ Forms bool
67 }73 }
68 74
69 // Options tunes Start. The zero value is usable.75 // Options tunes Start. The zero value is usable.
@@ -159,7 +165,7 @@ func (c *Conn) launch(onStderr func(string)) error {
159 stderrDone := make(chan struct{})165 stderrDone := make(chan struct{})
160 go c.readStderr(stderr, onStderr, stderrDone)166 go c.readStderr(stderr, onStderr, stderrDone)
161 go c.wait(stderrDone)167 go c.wait(stderrDone)
162- c.connection = sdk.NewClientSideConnection(&client{sessions: c.sessions, tools: c.spec.Tools}, stdin, stdout)168+ c.connection = sdk.NewClientSideConnection(&client{sessions: c.sessions, tools: c.spec.Tools, onForm: c.spec.OnForm, forms: c.spec.Forms}, stdin, stdout)
163 // The SDK logs its own diagnostics ("connection closed"…); the agent's169 // The SDK logs its own diagnostics ("connection closed"…); the agent's
164 // stderr already tells what matters.170 // stderr already tells what matters.
165 c.connection.SetLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))171 c.connection.SetLogger(slog.New(slog.NewTextHandler(io.Discard, nil)))
@@ -207,7 +213,7 @@ func (c *Conn) initialize(ctx context.Context) error {
207 go func() {213 go func() {
208 response, err := c.connection.Initialize(ctx, sdk.InitializeRequest{214 response, err := c.connection.Initialize(ctx, sdk.InitializeRequest{
209 ProtocolVersion: sdk.ProtocolVersion(ProtocolVersion),215 ProtocolVersion: sdk.ProtocolVersion(ProtocolVersion),
210- ClientCapabilities: sdk.ClientCapabilities{Meta: toolsMeta(c.spec.Tools, c.spec.ToolDiscovery)},216+ ClientCapabilities: sdk.ClientCapabilities{Meta: toolsMeta(c.spec.Tools, c.spec.ToolDiscovery), Elicitation: elicitationCapabilities(c.spec.OnForm, c.spec.Forms)},
211 ClientInfo: &sdk.Implementation{Name: "sidekicks", Version: clientVersion(c.spec.ClientVersion)},217 ClientInfo: &sdk.Implementation{Name: "sidekicks", Version: clientVersion(c.spec.ClientVersion)},
212 })218 })
213 answer <- result{response, err}219 answer <- result{response, err}
modified internal/acp/conn_test.go +38 -0
@@ -340,6 +340,12 @@ func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.
340340 _, err = a.conn.CallExtension(ctx, "_test/missing", nil)
341341 send(sdk.UpdateAgentMessageText(fmt.Sprintf("missing=%v", err)))
342342 return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
343+ case "form":
344+ send(sdk.UpdateAgentMessageText(a.askForm(ctx, "")))
345+ return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
346+ case "form-scoped":
347+ send(sdk.UpdateAgentMessageText(a.askForm(ctx, string(request.SessionId))))
348+ return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
343349 case "long":
344350 for {
345351 select {
@@ -353,6 +359,38 @@ func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.
353359 return sdk.PromptResponse{}, sdk.NewInternalError(map[string]any{"error": "exceeded maximum tool call iterations (40)"})
354360 }
355361
362+// askForm plays mm acp-create, or mm's ask_user with session (its scope in
363+// _meta, as mm puts it): it asks a form and tells what came back and
364+// whether initialize advertised forms.
365+func (a *fakeAgent) askForm(ctx context.Context, session string) string {
366+ advertised := a.client.ClientCapabilities.Elicitation != nil && a.client.ClientCapabilities.Elicitation.Form != nil
367+ req := sdk.NewUnstableCreateElicitationRequestForm(sdk.UnstableElicitationSchema{
368+ Type: sdk.UnstableElicitationSchemaTypeObject,
369+ Properties: map[string]any{
370+ "provider": map[string]any{"type": "string", "title": "Model server?", "enum": []any{"llmman", "ollama"}, "default": "llmman"},
371+ "yolo": map[string]any{"type": "boolean", "title": "Ask first?", "default": true},
372+ "name": map[string]any{"type": "string", "title": "Agent name?"},
373+ },
374+ Required: []string{"provider", "yolo", "name"},
375+ })
376+ req.Form.Message = "mm init — create an agent"
377+ if session != "" {
378+ req.Form.Meta = map[string]any{"mm.elicitationScope": map[string]any{"sessionId": session, "toolCallId": "call_7"}}
379+ }
380+ resp, err := a.conn.UnstableCreateElicitation(ctx, req)
381+ switch {
382+ case err != nil:
383+ return fmt.Sprintf("advertised=%v error=%v", advertised, err)
384+ case resp.Accept != nil:
385+ content, _ := json.Marshal(resp.Accept.Content)
386+ return fmt.Sprintf("advertised=%v accept=%s", advertised, content)
387+ case resp.Decline != nil:
388+ return fmt.Sprintf("advertised=%v decline", advertised)
389+ default:
390+ return fmt.Sprintf("advertised=%v cancel", advertised)
391+ }
392+}
393+
356394 // LoadSession resumes "s-1" and, as ACP requires, replays its history before
357395 // answering; any other id is unknown.
358396 func (a *fakeAgent) LoadSession(ctx context.Context, request sdk.LoadSessionRequest) (sdk.LoadSessionResponse, error) {
@@ -340,6 +340,12 @@ func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.
340 _, err = a.conn.CallExtension(ctx, "_test/missing", nil)340 _, err = a.conn.CallExtension(ctx, "_test/missing", nil)
341 send(sdk.UpdateAgentMessageText(fmt.Sprintf("missing=%v", err)))341 send(sdk.UpdateAgentMessageText(fmt.Sprintf("missing=%v", err)))
342 return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil342 return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
343+ case "form":
344+ send(sdk.UpdateAgentMessageText(a.askForm(ctx, "")))
345+ return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
346+ case "form-scoped":
347+ send(sdk.UpdateAgentMessageText(a.askForm(ctx, string(request.SessionId))))
348+ return sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}, nil
343 case "long":349 case "long":
344 for {350 for {
345 select {351 select {
@@ -353,6 +359,38 @@ func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.
353 return sdk.PromptResponse{}, sdk.NewInternalError(map[string]any{"error": "exceeded maximum tool call iterations (40)"})359 return sdk.PromptResponse{}, sdk.NewInternalError(map[string]any{"error": "exceeded maximum tool call iterations (40)"})
354 }360 }
355 361
362+// askForm plays mm acp-create, or mm's ask_user with session (its scope in
363+// _meta, as mm puts it): it asks a form and tells what came back and
364+// whether initialize advertised forms.
365+func (a *fakeAgent) askForm(ctx context.Context, session string) string {
366+ advertised := a.client.ClientCapabilities.Elicitation != nil && a.client.ClientCapabilities.Elicitation.Form != nil
367+ req := sdk.NewUnstableCreateElicitationRequestForm(sdk.UnstableElicitationSchema{
368+ Type: sdk.UnstableElicitationSchemaTypeObject,
369+ Properties: map[string]any{
370+ "provider": map[string]any{"type": "string", "title": "Model server?", "enum": []any{"llmman", "ollama"}, "default": "llmman"},
371+ "yolo": map[string]any{"type": "boolean", "title": "Ask first?", "default": true},
372+ "name": map[string]any{"type": "string", "title": "Agent name?"},
373+ },
374+ Required: []string{"provider", "yolo", "name"},
375+ })
376+ req.Form.Message = "mm init — create an agent"
377+ if session != "" {
378+ req.Form.Meta = map[string]any{"mm.elicitationScope": map[string]any{"sessionId": session, "toolCallId": "call_7"}}
379+ }
380+ resp, err := a.conn.UnstableCreateElicitation(ctx, req)
381+ switch {
382+ case err != nil:
383+ return fmt.Sprintf("advertised=%v error=%v", advertised, err)
384+ case resp.Accept != nil:
385+ content, _ := json.Marshal(resp.Accept.Content)
386+ return fmt.Sprintf("advertised=%v accept=%s", advertised, content)
387+ case resp.Decline != nil:
388+ return fmt.Sprintf("advertised=%v decline", advertised)
389+ default:
390+ return fmt.Sprintf("advertised=%v cancel", advertised)
391+ }
392+}
393+
356 // LoadSession resumes "s-1" and, as ACP requires, replays its history before394 // LoadSession resumes "s-1" and, as ACP requires, replays its history before
357 // answering; any other id is unknown.395 // answering; any other id is unknown.
358 func (a *fakeAgent) LoadSession(ctx context.Context, request sdk.LoadSessionRequest) (sdk.LoadSessionResponse, error) {396 func (a *fakeAgent) LoadSession(ctx context.Context, request sdk.LoadSessionRequest) (sdk.LoadSessionResponse, error) {
added internal/acp/forms.go +227 -0
new file mode 100644
@@ -0,0 +1,227 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package acp
4+
5+import (
6+ "context"
7+ "fmt"
8+ "slices"
9+ "sort"
10+
11+ sdk "github.com/coder/acp-go-sdk"
12+)
13+
14+// Forms (issues #94 and #95): an agent may ask the user to fill in a form
15+// with ACP's elicitation/create request, in its "form" mode (still marked
16+// unstable in the protocol) — mini-me does for its ask_user tool.
17+// Sidekicks advertises clientCapabilities.elicitation.form when Spec.OnForm
18+// is set (every request goes to it) or Spec.Forms is true (each request goes
19+// to the handler of its session, when it is a FormAsker). The "url" mode is
20+// not supported: such a request is cancelled.
21+
22+// Field types of a Form, from the JSON Schema of the request.
23+const (
24+ FieldText = "text" // a string without choices
25+ FieldChoice = "choice" // a string among Options
26+ FieldMulti = "multi" // several strings among Options
27+ FieldBoolean = "boolean" // yes or no
28+ FieldNumber = "number" // a number, typed as text
29+)
30+
31+// The actions that end a form.
32+const (
33+ FormAccept = "accept"
34+ FormDecline = "decline"
35+ FormCancel = "cancel"
36+)
37+
38+// Form is what an agent asks the user to fill in.
39+type Form struct {
40+ // Message says what the form is for (Markdown or plain text).
41+ Message string `json:"message"`
42+ Fields []FormField `json:"fields"`
43+ // SessionID and ToolCallID tie the form to a session and a tool call,
44+ // when the agent says so; "" otherwise.
45+ SessionID string `json:"sessionId"`
46+ ToolCallID string `json:"toolCallId"`
47+}
48+
49+// FormAsker is a SessionHandler that can show a form to the user (#95). It
50+// may block until the user answers, and must return a cancel answer once
51+// ctx is done.
52+type FormAsker interface {
53+ RequestForm(ctx context.Context, form Form) FormAnswer
54+}
55+
56+// scopeMetaKey is where mini-me parks a form's session and tool call in
57+// `_meta`: the SDK drops the top-level sessionId and toolCallId that ACP
58+// specifies, so mm also copies them there.
59+const scopeMetaKey = "mm.elicitationScope"
60+
61+// FormField is one question of a Form.
62+type FormField struct {
63+ // Name is the key of the answer in FormAnswer.Content.
64+ Name string `json:"name"`
65+ Title string `json:"title"`
66+ // Description is optional help shown under the title.
67+ Description string `json:"description"`
68+ // Type is one of the Field… constants.
69+ Type string `json:"type"`
70+ Options []string `json:"options"`
71+ // Default is a string, a boolean, a number or a list of strings
72+ // (FieldMulti), as the agent gave it; nil when there is none.
73+ Default any `json:"default"`
74+ Required bool `json:"required"`
75+}
76+
77+// FormAnswer is the user's answer: Action is accept, decline or cancel;
78+// Content holds the values by field name when the form is accepted.
79+type FormAnswer struct {
80+ Action string `json:"action"`
81+ Content map[string]any `json:"content"`
82+}
83+
84+// FormHandler answers a form. It may block until the user answers, and
85+// must return a cancel answer once ctx is done.
86+type FormHandler func(ctx context.Context, form Form) FormAnswer
87+
88+// formFrom reads the JSON Schema of a form request into a Form. Its fields
89+// come in the order of `required` (mm lists every field there, in order:
90+// a JSON object has no order of its own), then the others by name.
91+func formFrom(request sdk.UnstableCreateElicitationForm) Form {
92+ schema := request.RequestedSchema
93+ form := Form{Message: request.Message, Fields: []FormField{}}
94+ if scope, ok := request.Meta[scopeMetaKey].(map[string]any); ok {
95+ form.SessionID, form.ToolCallID = text(scope["sessionId"]), text(scope["toolCallId"])
96+ }
97+ names := make([]string, 0, len(schema.Properties))
98+ for name := range schema.Properties {
99+ names = append(names, name)
100+ }
101+ sort.Strings(names)
102+ sort.SliceStable(names, func(i, j int) bool {
103+ return rank(schema.Required, names[i], len(names)) < rank(schema.Required, names[j], len(names))
104+ })
105+ for _, name := range names {
106+ property, _ := schema.Properties[name].(map[string]any)
107+ if property == nil {
108+ continue
109+ }
110+ form.Fields = append(form.Fields, fieldFrom(name, property, slices.Contains(schema.Required, name)))
111+ }
112+ return form
113+}
114+
115+// rank is the place of name in required, or after them all (then by name,
116+// as names was sorted before).
117+func rank(required []string, name string, others int) int {
118+ if index := slices.Index(required, name); index >= 0 {
119+ return index
120+ }
121+ return len(required) + others
122+}
123+
124+func fieldFrom(name string, property map[string]any, required bool) FormField {
125+ field := FormField{
126+ Name: name, Title: text(property["title"]), Description: text(property["description"]),
127+ Type: FieldText, Default: property["default"], Required: required,
128+ }
129+ if field.Title == "" {
130+ field.Title = name
131+ }
132+ switch text(property["type"]) {
133+ case "boolean":
134+ field.Type = FieldBoolean
135+ case "number", "integer":
136+ field.Type = FieldNumber
137+ case "array":
138+ field.Type = FieldMulti
139+ items, _ := property["items"].(map[string]any)
140+ field.Options = choices(items)
141+ default:
142+ if field.Options = choices(property); len(field.Options) > 0 {
143+ field.Type = FieldChoice
144+ }
145+ }
146+ return field
147+}
148+
149+// choices reads the values of an `enum`, or of a titled `oneOf`/`anyOf`
150+// (`const` of each), as the elicitation schema allows.
151+func choices(property map[string]any) []string {
152+ if property == nil {
153+ return nil
154+ }
155+ var values []string
156+ if list, ok := property["enum"].([]any); ok {
157+ for _, value := range list {
158+ values = append(values, fmt.Sprint(value))
159+ }
160+ return values
161+ }
162+ for _, key := range []string{"oneOf", "anyOf"} {
163+ list, _ := property[key].([]any)
164+ for _, item := range list {
165+ if option, ok := item.(map[string]any); ok && option["const"] != nil {
166+ values = append(values, fmt.Sprint(option["const"]))
167+ }
168+ }
169+ }
170+ return values
171+}
172+
173+func text(value any) string {
174+ if s, ok := value.(string); ok {
175+ return s
176+ }
177+ return ""
178+}
179+
180+// elicitationResponse turns the user's answer into the protocol's.
181+func elicitationResponse(answer FormAnswer) sdk.UnstableCreateElicitationResponse {
182+ switch answer.Action {
183+ case FormAccept:
184+ content := answer.Content
185+ if content == nil {
186+ content = map[string]any{}
187+ }
188+ return sdk.UnstableCreateElicitationResponse{Accept: &sdk.UnstableCreateElicitationAccept{Action: FormAccept, Content: content}}
189+ case FormDecline:
190+ return sdk.UnstableCreateElicitationResponse{Decline: &sdk.UnstableCreateElicitationDecline{Action: FormDecline}}
191+ }
192+ return sdk.UnstableCreateElicitationResponse{Cancel: &sdk.UnstableCreateElicitationCancel{Action: FormCancel}}
193+}
194+
195+// elicitationCapabilities is what initialize advertises: forms only, and
196+// only when someone answers them.
197+func elicitationCapabilities(onForm FormHandler, forms bool) *sdk.ElicitationCapabilities {
198+ if onForm == nil && !forms {
199+ return nil
200+ }
201+ return &sdk.ElicitationCapabilities{Form: &sdk.ElicitationFormCapabilities{}}
202+}
203+
204+// UnstableCreateElicitation answers an agent's elicitation/create request
205+// (the SDK finds it by this name).
206+func (c *client) UnstableCreateElicitation(ctx context.Context, request sdk.UnstableCreateElicitationRequest) (sdk.UnstableCreateElicitationResponse, error) {
207+ if request.Form == nil {
208+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
209+ }
210+ form := formFrom(*request.Form)
211+ if c.onForm != nil {
212+ return elicitationResponse(c.onForm(ctx, form)), nil
213+ }
214+ if !c.forms {
215+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
216+ }
217+ if asker, ok := c.sessions.formAsker(form.SessionID); ok {
218+ return elicitationResponse(asker.RequestForm(ctx, form)), nil
219+ }
220+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
221+}
222+
223+// UnstableCompleteElicitation is the end of a "url" elicitation: nothing
224+// to do, Sidekicks never starts one.
225+func (*client) UnstableCompleteElicitation(context.Context, sdk.UnstableCompleteElicitationNotification) error {
226+ return nil
227+}
new file mode 100644
@@ -0,0 +1,227 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package acp
4+
5+import (
6+ "context"
7+ "fmt"
8+ "slices"
9+ "sort"
10+
11+ sdk "github.com/coder/acp-go-sdk"
12+)
13+
14+// Forms (issues #94 and #95): an agent may ask the user to fill in a form
15+// with ACP's elicitation/create request, in its "form" mode (still marked
16+// unstable in the protocol) — mini-me does for its ask_user tool.
17+// Sidekicks advertises clientCapabilities.elicitation.form when Spec.OnForm
18+// is set (every request goes to it) or Spec.Forms is true (each request goes
19+// to the handler of its session, when it is a FormAsker). The "url" mode is
20+// not supported: such a request is cancelled.
21+
22+// Field types of a Form, from the JSON Schema of the request.
23+const (
24+ FieldText = "text" // a string without choices
25+ FieldChoice = "choice" // a string among Options
26+ FieldMulti = "multi" // several strings among Options
27+ FieldBoolean = "boolean" // yes or no
28+ FieldNumber = "number" // a number, typed as text
29+)
30+
31+// The actions that end a form.
32+const (
33+ FormAccept = "accept"
34+ FormDecline = "decline"
35+ FormCancel = "cancel"
36+)
37+
38+// Form is what an agent asks the user to fill in.
39+type Form struct {
40+ // Message says what the form is for (Markdown or plain text).
41+ Message string `json:"message"`
42+ Fields []FormField `json:"fields"`
43+ // SessionID and ToolCallID tie the form to a session and a tool call,
44+ // when the agent says so; "" otherwise.
45+ SessionID string `json:"sessionId"`
46+ ToolCallID string `json:"toolCallId"`
47+}
48+
49+// FormAsker is a SessionHandler that can show a form to the user (#95). It
50+// may block until the user answers, and must return a cancel answer once
51+// ctx is done.
52+type FormAsker interface {
53+ RequestForm(ctx context.Context, form Form) FormAnswer
54+}
55+
56+// scopeMetaKey is where mini-me parks a form's session and tool call in
57+// `_meta`: the SDK drops the top-level sessionId and toolCallId that ACP
58+// specifies, so mm also copies them there.
59+const scopeMetaKey = "mm.elicitationScope"
60+
61+// FormField is one question of a Form.
62+type FormField struct {
63+ // Name is the key of the answer in FormAnswer.Content.
64+ Name string `json:"name"`
65+ Title string `json:"title"`
66+ // Description is optional help shown under the title.
67+ Description string `json:"description"`
68+ // Type is one of the Field… constants.
69+ Type string `json:"type"`
70+ Options []string `json:"options"`
71+ // Default is a string, a boolean, a number or a list of strings
72+ // (FieldMulti), as the agent gave it; nil when there is none.
73+ Default any `json:"default"`
74+ Required bool `json:"required"`
75+}
76+
77+// FormAnswer is the user's answer: Action is accept, decline or cancel;
78+// Content holds the values by field name when the form is accepted.
79+type FormAnswer struct {
80+ Action string `json:"action"`
81+ Content map[string]any `json:"content"`
82+}
83+
84+// FormHandler answers a form. It may block until the user answers, and
85+// must return a cancel answer once ctx is done.
86+type FormHandler func(ctx context.Context, form Form) FormAnswer
87+
88+// formFrom reads the JSON Schema of a form request into a Form. Its fields
89+// come in the order of `required` (mm lists every field there, in order:
90+// a JSON object has no order of its own), then the others by name.
91+func formFrom(request sdk.UnstableCreateElicitationForm) Form {
92+ schema := request.RequestedSchema
93+ form := Form{Message: request.Message, Fields: []FormField{}}
94+ if scope, ok := request.Meta[scopeMetaKey].(map[string]any); ok {
95+ form.SessionID, form.ToolCallID = text(scope["sessionId"]), text(scope["toolCallId"])
96+ }
97+ names := make([]string, 0, len(schema.Properties))
98+ for name := range schema.Properties {
99+ names = append(names, name)
100+ }
101+ sort.Strings(names)
102+ sort.SliceStable(names, func(i, j int) bool {
103+ return rank(schema.Required, names[i], len(names)) < rank(schema.Required, names[j], len(names))
104+ })
105+ for _, name := range names {
106+ property, _ := schema.Properties[name].(map[string]any)
107+ if property == nil {
108+ continue
109+ }
110+ form.Fields = append(form.Fields, fieldFrom(name, property, slices.Contains(schema.Required, name)))
111+ }
112+ return form
113+}
114+
115+// rank is the place of name in required, or after them all (then by name,
116+// as names was sorted before).
117+func rank(required []string, name string, others int) int {
118+ if index := slices.Index(required, name); index >= 0 {
119+ return index
120+ }
121+ return len(required) + others
122+}
123+
124+func fieldFrom(name string, property map[string]any, required bool) FormField {
125+ field := FormField{
126+ Name: name, Title: text(property["title"]), Description: text(property["description"]),
127+ Type: FieldText, Default: property["default"], Required: required,
128+ }
129+ if field.Title == "" {
130+ field.Title = name
131+ }
132+ switch text(property["type"]) {
133+ case "boolean":
134+ field.Type = FieldBoolean
135+ case "number", "integer":
136+ field.Type = FieldNumber
137+ case "array":
138+ field.Type = FieldMulti
139+ items, _ := property["items"].(map[string]any)
140+ field.Options = choices(items)
141+ default:
142+ if field.Options = choices(property); len(field.Options) > 0 {
143+ field.Type = FieldChoice
144+ }
145+ }
146+ return field
147+}
148+
149+// choices reads the values of an `enum`, or of a titled `oneOf`/`anyOf`
150+// (`const` of each), as the elicitation schema allows.
151+func choices(property map[string]any) []string {
152+ if property == nil {
153+ return nil
154+ }
155+ var values []string
156+ if list, ok := property["enum"].([]any); ok {
157+ for _, value := range list {
158+ values = append(values, fmt.Sprint(value))
159+ }
160+ return values
161+ }
162+ for _, key := range []string{"oneOf", "anyOf"} {
163+ list, _ := property[key].([]any)
164+ for _, item := range list {
165+ if option, ok := item.(map[string]any); ok && option["const"] != nil {
166+ values = append(values, fmt.Sprint(option["const"]))
167+ }
168+ }
169+ }
170+ return values
171+}
172+
173+func text(value any) string {
174+ if s, ok := value.(string); ok {
175+ return s
176+ }
177+ return ""
178+}
179+
180+// elicitationResponse turns the user's answer into the protocol's.
181+func elicitationResponse(answer FormAnswer) sdk.UnstableCreateElicitationResponse {
182+ switch answer.Action {
183+ case FormAccept:
184+ content := answer.Content
185+ if content == nil {
186+ content = map[string]any{}
187+ }
188+ return sdk.UnstableCreateElicitationResponse{Accept: &sdk.UnstableCreateElicitationAccept{Action: FormAccept, Content: content}}
189+ case FormDecline:
190+ return sdk.UnstableCreateElicitationResponse{Decline: &sdk.UnstableCreateElicitationDecline{Action: FormDecline}}
191+ }
192+ return sdk.UnstableCreateElicitationResponse{Cancel: &sdk.UnstableCreateElicitationCancel{Action: FormCancel}}
193+}
194+
195+// elicitationCapabilities is what initialize advertises: forms only, and
196+// only when someone answers them.
197+func elicitationCapabilities(onForm FormHandler, forms bool) *sdk.ElicitationCapabilities {
198+ if onForm == nil && !forms {
199+ return nil
200+ }
201+ return &sdk.ElicitationCapabilities{Form: &sdk.ElicitationFormCapabilities{}}
202+}
203+
204+// UnstableCreateElicitation answers an agent's elicitation/create request
205+// (the SDK finds it by this name).
206+func (c *client) UnstableCreateElicitation(ctx context.Context, request sdk.UnstableCreateElicitationRequest) (sdk.UnstableCreateElicitationResponse, error) {
207+ if request.Form == nil {
208+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
209+ }
210+ form := formFrom(*request.Form)
211+ if c.onForm != nil {
212+ return elicitationResponse(c.onForm(ctx, form)), nil
213+ }
214+ if !c.forms {
215+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
216+ }
217+ if asker, ok := c.sessions.formAsker(form.SessionID); ok {
218+ return elicitationResponse(asker.RequestForm(ctx, form)), nil
219+ }
220+ return elicitationResponse(FormAnswer{Action: FormCancel}), nil
221+}
222+
223+// UnstableCompleteElicitation is the end of a "url" elicitation: nothing
224+// to do, Sidekicks never starts one.
225+func (*client) UnstableCompleteElicitation(context.Context, sdk.UnstableCompleteElicitationNotification) error {
226+ return nil
227+}
added internal/acp/forms_test.go +144 -0
new file mode 100644
@@ -0,0 +1,144 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package acp_test
4+
5+import (
6+ "context"
7+ "reflect"
8+ "strings"
9+ "testing"
10+
11+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
12+)
13+
14+// formSession opens a session on the fake agent with onForm answering its forms.
15+func formSession(t *testing.T, onForm acp.FormHandler) (*acp.Conn, string, *recordingHandler) {
16+ t.Helper()
17+ spec := fakeSpec(t, "ready")
18+ spec.OnForm = onForm
19+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
20+ if err != nil {
21+ t.Fatal(err)
22+ }
23+ t.Cleanup(func() { _ = conn.Close(context.Background()) })
24+ handler := &recordingHandler{}
25+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
26+ if err != nil {
27+ t.Fatal(err)
28+ }
29+ return conn, id, handler
30+}
31+
32+func answerText(t *testing.T, conn *acp.Conn, id string, handler *recordingHandler) string {
33+ t.Helper()
34+ if _, err := conn.Prompt(context.Background(), id, "form"); err != nil {
35+ t.Fatal(err)
36+ }
37+ var text strings.Builder
38+ for _, update := range handler.ofKind(acp.UpdateMessage) {
39+ text.WriteString(update.Text)
40+ }
41+ return text.String()
42+}
43+
44+func TestAFormIsReadInOrderAndAnswered(t *testing.T) {
45+ var got acp.Form
46+ conn, id, handler := formSession(t, func(_ context.Context, form acp.Form) acp.FormAnswer {
47+ got = form
48+ return acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "ollama", "yolo": false, "name": "bob"}}
49+ })
50+ text := answerText(t, conn, id, handler)
51+ if text != `advertised=true accept={"name":"bob","provider":"ollama","yolo":false}` {
52+ t.Fatalf("answer: %s", text)
53+ }
54+ if got.Message != "mm init — create an agent" {
55+ t.Fatalf("message: %q", got.Message)
56+ }
57+ want := []acp.FormField{
58+ {Name: "provider", Title: "Model server?", Type: acp.FieldChoice, Options: []string{"llmman", "ollama"}, Default: "llmman", Required: true},
59+ {Name: "yolo", Title: "Ask first?", Type: acp.FieldBoolean, Default: true, Required: true},
60+ {Name: "name", Title: "Agent name?", Type: acp.FieldText, Required: true},
61+ }
62+ if !reflect.DeepEqual(got.Fields, want) {
63+ t.Fatalf("fields:\n got %+v\nwant %+v", got.Fields, want)
64+ }
65+}
66+
67+func TestADeclinedFormIsDeclined(t *testing.T) {
68+ conn, id, handler := formSession(t, func(context.Context, acp.Form) acp.FormAnswer {
69+ return acp.FormAnswer{Action: acp.FormDecline}
70+ })
71+ if text := answerText(t, conn, id, handler); text != "advertised=true decline" {
72+ t.Fatalf("answer: %s", text)
73+ }
74+}
75+
76+func TestWithoutOnFormNoFormIsAdvertisedAndFormsAreCancelled(t *testing.T) {
77+ handler := &recordingHandler{}
78+ conn, id := openSession(t, handler)
79+ if text := answerText(t, conn, id, handler); text != "advertised=false cancel" {
80+ t.Fatalf("answer: %s", text)
81+ }
82+}
83+
84+// askingHandler is a session handler that shows forms (#95).
85+type askingHandler struct {
86+ recordingHandler
87+ forms chan acp.Form
88+}
89+
90+func (h *askingHandler) RequestForm(_ context.Context, form acp.Form) acp.FormAnswer {
91+ h.forms <- form
92+ return acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"name": "from " + form.SessionID}}
93+}
94+
95+func TestWithFormsEachFormGoesToItsSessionsHandler(t *testing.T) {
96+ spec := fakeSpec(t, "ready")
97+ spec.Forms = true
98+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
99+ if err != nil {
100+ t.Fatal(err)
101+ }
102+ defer func() { _ = conn.Close(context.Background()) }()
103+ handler := &askingHandler{forms: make(chan acp.Form, 2)}
104+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
105+ if err != nil {
106+ t.Fatal(err)
107+ }
108+ for _, prompt := range []string{"form-scoped", "form"} {
109+ if _, err := conn.Prompt(context.Background(), id, prompt); err != nil {
110+ t.Fatal(err)
111+ }
112+ }
113+ scoped, unscoped := <-handler.forms, <-handler.forms
114+ if scoped.SessionID != id || scoped.ToolCallID != "call_7" || unscoped.SessionID != "" {
115+ t.Fatalf("scopes: %+v / %+v", scoped, unscoped)
116+ }
117+ var text strings.Builder
118+ for _, update := range handler.ofKind(acp.UpdateMessage) {
119+ text.WriteString(update.Text + "|")
120+ }
121+ // The unscoped form went to the only session with a prompt in flight.
122+ want := `advertised=true accept={"name":"from s-1"}|advertised=true accept={"name":"from "}|`
123+ if text.String() != want {
124+ t.Fatalf("answers:\n got %s\nwant %s", text.String(), want)
125+ }
126+}
127+
128+func TestAFormForAHandlerThatCannotShowItIsCancelled(t *testing.T) {
129+ spec := fakeSpec(t, "ready")
130+ spec.Forms = true
131+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
132+ if err != nil {
133+ t.Fatal(err)
134+ }
135+ defer func() { _ = conn.Close(context.Background()) }()
136+ handler := &recordingHandler{}
137+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
138+ if err != nil {
139+ t.Fatal(err)
140+ }
141+ if text := answerText(t, conn, id, handler); text != "advertised=true cancel" {
142+ t.Fatalf("answer: %s", text)
143+ }
144+}
new file mode 100644
@@ -0,0 +1,144 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package acp_test
4+
5+import (
6+ "context"
7+ "reflect"
8+ "strings"
9+ "testing"
10+
11+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
12+)
13+
14+// formSession opens a session on the fake agent with onForm answering its forms.
15+func formSession(t *testing.T, onForm acp.FormHandler) (*acp.Conn, string, *recordingHandler) {
16+ t.Helper()
17+ spec := fakeSpec(t, "ready")
18+ spec.OnForm = onForm
19+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
20+ if err != nil {
21+ t.Fatal(err)
22+ }
23+ t.Cleanup(func() { _ = conn.Close(context.Background()) })
24+ handler := &recordingHandler{}
25+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
26+ if err != nil {
27+ t.Fatal(err)
28+ }
29+ return conn, id, handler
30+}
31+
32+func answerText(t *testing.T, conn *acp.Conn, id string, handler *recordingHandler) string {
33+ t.Helper()
34+ if _, err := conn.Prompt(context.Background(), id, "form"); err != nil {
35+ t.Fatal(err)
36+ }
37+ var text strings.Builder
38+ for _, update := range handler.ofKind(acp.UpdateMessage) {
39+ text.WriteString(update.Text)
40+ }
41+ return text.String()
42+}
43+
44+func TestAFormIsReadInOrderAndAnswered(t *testing.T) {
45+ var got acp.Form
46+ conn, id, handler := formSession(t, func(_ context.Context, form acp.Form) acp.FormAnswer {
47+ got = form
48+ return acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "ollama", "yolo": false, "name": "bob"}}
49+ })
50+ text := answerText(t, conn, id, handler)
51+ if text != `advertised=true accept={"name":"bob","provider":"ollama","yolo":false}` {
52+ t.Fatalf("answer: %s", text)
53+ }
54+ if got.Message != "mm init — create an agent" {
55+ t.Fatalf("message: %q", got.Message)
56+ }
57+ want := []acp.FormField{
58+ {Name: "provider", Title: "Model server?", Type: acp.FieldChoice, Options: []string{"llmman", "ollama"}, Default: "llmman", Required: true},
59+ {Name: "yolo", Title: "Ask first?", Type: acp.FieldBoolean, Default: true, Required: true},
60+ {Name: "name", Title: "Agent name?", Type: acp.FieldText, Required: true},
61+ }
62+ if !reflect.DeepEqual(got.Fields, want) {
63+ t.Fatalf("fields:\n got %+v\nwant %+v", got.Fields, want)
64+ }
65+}
66+
67+func TestADeclinedFormIsDeclined(t *testing.T) {
68+ conn, id, handler := formSession(t, func(context.Context, acp.Form) acp.FormAnswer {
69+ return acp.FormAnswer{Action: acp.FormDecline}
70+ })
71+ if text := answerText(t, conn, id, handler); text != "advertised=true decline" {
72+ t.Fatalf("answer: %s", text)
73+ }
74+}
75+
76+func TestWithoutOnFormNoFormIsAdvertisedAndFormsAreCancelled(t *testing.T) {
77+ handler := &recordingHandler{}
78+ conn, id := openSession(t, handler)
79+ if text := answerText(t, conn, id, handler); text != "advertised=false cancel" {
80+ t.Fatalf("answer: %s", text)
81+ }
82+}
83+
84+// askingHandler is a session handler that shows forms (#95).
85+type askingHandler struct {
86+ recordingHandler
87+ forms chan acp.Form
88+}
89+
90+func (h *askingHandler) RequestForm(_ context.Context, form acp.Form) acp.FormAnswer {
91+ h.forms <- form
92+ return acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"name": "from " + form.SessionID}}
93+}
94+
95+func TestWithFormsEachFormGoesToItsSessionsHandler(t *testing.T) {
96+ spec := fakeSpec(t, "ready")
97+ spec.Forms = true
98+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
99+ if err != nil {
100+ t.Fatal(err)
101+ }
102+ defer func() { _ = conn.Close(context.Background()) }()
103+ handler := &askingHandler{forms: make(chan acp.Form, 2)}
104+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
105+ if err != nil {
106+ t.Fatal(err)
107+ }
108+ for _, prompt := range []string{"form-scoped", "form"} {
109+ if _, err := conn.Prompt(context.Background(), id, prompt); err != nil {
110+ t.Fatal(err)
111+ }
112+ }
113+ scoped, unscoped := <-handler.forms, <-handler.forms
114+ if scoped.SessionID != id || scoped.ToolCallID != "call_7" || unscoped.SessionID != "" {
115+ t.Fatalf("scopes: %+v / %+v", scoped, unscoped)
116+ }
117+ var text strings.Builder
118+ for _, update := range handler.ofKind(acp.UpdateMessage) {
119+ text.WriteString(update.Text + "|")
120+ }
121+ // The unscoped form went to the only session with a prompt in flight.
122+ want := `advertised=true accept={"name":"from s-1"}|advertised=true accept={"name":"from "}|`
123+ if text.String() != want {
124+ t.Fatalf("answers:\n got %s\nwant %s", text.String(), want)
125+ }
126+}
127+
128+func TestAFormForAHandlerThatCannotShowItIsCancelled(t *testing.T) {
129+ spec := fakeSpec(t, "ready")
130+ spec.Forms = true
131+ conn, err := acp.Start(context.Background(), spec, acp.Options{})
132+ if err != nil {
133+ t.Fatal(err)
134+ }
135+ defer func() { _ = conn.Close(context.Background()) }()
136+ handler := &recordingHandler{}
137+ id, err := conn.NewSession(context.Background(), t.TempDir(), handler)
138+ if err != nil {
139+ t.Fatal(err)
140+ }
141+ if text := answerText(t, conn, id, handler); text != "advertised=true cancel" {
142+ t.Fatalf("answer: %s", text)
143+ }
144+}
modified internal/acp/session.go +30 -1
@@ -166,6 +166,8 @@ type Attachment struct {
166166 // An error is either a transport problem or an error the agent returned
167167 // instead of a stop reason (mm does so when a tool loop goes on too long).
168168 func (c *Conn) Prompt(ctx context.Context, sessionID, text string, attachments ...Attachment) (TurnResult, error) {
169+ c.sessions.turn(sessionID, 1)
170+ defer c.sessions.turn(sessionID, -1)
169171 response, err := c.connection.Prompt(ctx, sdk.PromptRequest{
170172 SessionId: sdk.SessionId(sessionID),
171173 Prompt: PromptBlocks(c.info, text, attachments),
@@ -256,12 +258,15 @@ type sessions struct {
256258 mu sync.Mutex
257259 handlers map[string]SessionHandler
258260 early map[string][]Update
261+ // turns counts the prompts in flight by session, to find the session
262+ // of a form that does not name one.
263+ turns map[string]int
259264 }
260265
261266 const maxEarlyUpdates = 100
262267
263268 func newSessions() *sessions {
264- return &sessions{handlers: map[string]SessionHandler{}, early: map[string][]Update{}}
269+ return &sessions{handlers: map[string]SessionHandler{}, early: map[string][]Update{}, turns: map[string]int{}}
265270 }
266271
267272 func (s *sessions) register(id string, handler SessionHandler) {
@@ -281,6 +286,30 @@ func (s *sessions) handler(id string) SessionHandler {
281286 return s.handlers[id]
282287 }
283288
289+// turn marks a prompt of session id in flight (+1) or over (-1).
290+func (s *sessions) turn(id string, delta int) {
291+ s.mu.Lock()
292+ defer s.mu.Unlock()
293+ if s.turns[id] += delta; s.turns[id] <= 0 {
294+ delete(s.turns, id)
295+ }
296+}
297+
298+// formAsker is the handler of session id that can show a form. A form that
299+// names no session goes to the only session with a prompt in flight — an
300+// agent answers in one channel at a time (ADR 0006).
301+func (s *sessions) formAsker(id string) (FormAsker, bool) {
302+ s.mu.Lock()
303+ defer s.mu.Unlock()
304+ if id == "" && len(s.turns) == 1 {
305+ for only := range s.turns {
306+ id = only
307+ }
308+ }
309+ asker, ok := s.handlers[id].(FormAsker)
310+ return asker, ok
311+}
312+
284313 func (s *sessions) deliver(id string, update Update) {
285314 s.mu.Lock()
286315 handler := s.handlers[id]
@@ -166,6 +166,8 @@ type Attachment struct {
166 // An error is either a transport problem or an error the agent returned166 // An error is either a transport problem or an error the agent returned
167 // instead of a stop reason (mm does so when a tool loop goes on too long).167 // instead of a stop reason (mm does so when a tool loop goes on too long).
168 func (c *Conn) Prompt(ctx context.Context, sessionID, text string, attachments ...Attachment) (TurnResult, error) {168 func (c *Conn) Prompt(ctx context.Context, sessionID, text string, attachments ...Attachment) (TurnResult, error) {
169+ c.sessions.turn(sessionID, 1)
170+ defer c.sessions.turn(sessionID, -1)
169 response, err := c.connection.Prompt(ctx, sdk.PromptRequest{171 response, err := c.connection.Prompt(ctx, sdk.PromptRequest{
170 SessionId: sdk.SessionId(sessionID),172 SessionId: sdk.SessionId(sessionID),
171 Prompt: PromptBlocks(c.info, text, attachments),173 Prompt: PromptBlocks(c.info, text, attachments),
@@ -256,12 +258,15 @@ type sessions struct {
256 mu sync.Mutex258 mu sync.Mutex
257 handlers map[string]SessionHandler259 handlers map[string]SessionHandler
258 early map[string][]Update260 early map[string][]Update
261+ // turns counts the prompts in flight by session, to find the session
262+ // of a form that does not name one.
263+ turns map[string]int
259 }264 }
260 265
261 const maxEarlyUpdates = 100266 const maxEarlyUpdates = 100
262 267
263 func newSessions() *sessions {268 func newSessions() *sessions {
264- return &sessions{handlers: map[string]SessionHandler{}, early: map[string][]Update{}}269+ return &sessions{handlers: map[string]SessionHandler{}, early: map[string][]Update{}, turns: map[string]int{}}
265 }270 }
266 271
267 func (s *sessions) register(id string, handler SessionHandler) {272 func (s *sessions) register(id string, handler SessionHandler) {
@@ -281,6 +286,30 @@ func (s *sessions) handler(id string) SessionHandler {
281 return s.handlers[id]286 return s.handlers[id]
282 }287 }
283 288
289+// turn marks a prompt of session id in flight (+1) or over (-1).
290+func (s *sessions) turn(id string, delta int) {
291+ s.mu.Lock()
292+ defer s.mu.Unlock()
293+ if s.turns[id] += delta; s.turns[id] <= 0 {
294+ delete(s.turns, id)
295+ }
296+}
297+
298+// formAsker is the handler of session id that can show a form. A form that
299+// names no session goes to the only session with a prompt in flight — an
300+// agent answers in one channel at a time (ADR 0006).
301+func (s *sessions) formAsker(id string) (FormAsker, bool) {
302+ s.mu.Lock()
303+ defer s.mu.Unlock()
304+ if id == "" && len(s.turns) == 1 {
305+ for only := range s.turns {
306+ id = only
307+ }
308+ }
309+ asker, ok := s.handlers[id].(FormAsker)
310+ return asker, ok
311+}
312+
284 func (s *sessions) deliver(id string, update Update) {313 func (s *sessions) deliver(id string, update Update) {
285 s.mu.Lock()314 s.mu.Lock()
286 handler := s.handlers[id]315 handler := s.handlers[id]
modified internal/agents/manager.go +3 -0
@@ -618,6 +618,9 @@ func (m *Manager) specFor(definition config.Agent) acp.Spec {
618618 spec := acp.Spec{
619619 Name: definition.Name, Command: definition.Command, Args: definition.Args,
620620 Env: definition.Env, Dir: definition.Workspace, ClientVersion: m.options.ClientVersion,
621+ // The forms an agent asks (mini-me's ask_user, issue #95) are shown
622+ // in the conversation of their session.
623+ Forms: true,
621624 }
622625 if m.options.Tools != nil {
623626 spec.Tools = m.options.Tools(definition)
@@ -618,6 +618,9 @@ func (m *Manager) specFor(definition config.Agent) acp.Spec {
618 spec := acp.Spec{618 spec := acp.Spec{
619 Name: definition.Name, Command: definition.Command, Args: definition.Args,619 Name: definition.Name, Command: definition.Command, Args: definition.Args,
620 Env: definition.Env, Dir: definition.Workspace, ClientVersion: m.options.ClientVersion,620 Env: definition.Env, Dir: definition.Workspace, ClientVersion: m.options.ClientVersion,
621+ // The forms an agent asks (mini-me's ask_user, issue #95) are shown
622+ // in the conversation of their session.
623+ Forms: true,
621 }624 }
622 if m.options.Tools != nil {625 if m.options.Tools != nil {
623 spec.Tools = m.options.Tools(definition)626 spec.Tools = m.options.Tools(definition)
modified internal/app/app.go +9 -1
@@ -61,6 +61,11 @@ type Options struct {
6161 // OpenStore opens the history of the configuration file at path; nil
6262 // opens it in the user's configuration folder (store.DirFor).
6363 OpenStore func(configPath string) (*store.Store, error)
64+ // MiniMe is mm's program for the assistant that creates mini-me agents
65+ // (issue #94); "" looks mm up in PATH. MiniMeEnv is added to its
66+ // environment. Tests pass a fake.
67+ MiniMe string
68+ MiniMeEnv map[string]string
6469 }
6570
6671 // Core holds the loaded configuration, the agent manager, and the channels
@@ -84,6 +89,8 @@ type Core struct {
8489 historyProblem string
8590 runCtx context.Context
8691 stopWait context.CancelFunc
92+ // creator is the mini-me creation assistant's wizard (issue #94).
93+ creator *creation
8794 }
8895
8996 // New loads the configuration at location — creating the default file first
@@ -283,9 +290,10 @@ func (c *Core) Open(ctx context.Context, path string) error {
283290 return nil
284291 }
285292
286-// Shutdown cancels the answers, closes the terminals, stops every agent and
293+// Shutdown closes the creation assistant, cancels the answers, closes the terminals, stops every agent and
287294 // closes the history.
288295 func (c *Core) Shutdown(ctx context.Context) {
296+ (&CreatorService{Core: c}).Cancel()
289297 c.closeChannels()
290298 c.stopWorkspaces()
291299 c.manager.StopAll(ctx)
@@ -61,6 +61,11 @@ type Options struct {
61 // OpenStore opens the history of the configuration file at path; nil61 // OpenStore opens the history of the configuration file at path; nil
62 // opens it in the user's configuration folder (store.DirFor).62 // opens it in the user's configuration folder (store.DirFor).
63 OpenStore func(configPath string) (*store.Store, error)63 OpenStore func(configPath string) (*store.Store, error)
64+ // MiniMe is mm's program for the assistant that creates mini-me agents
65+ // (issue #94); "" looks mm up in PATH. MiniMeEnv is added to its
66+ // environment. Tests pass a fake.
67+ MiniMe string
68+ MiniMeEnv map[string]string
64 }69 }
65 70
66 // Core holds the loaded configuration, the agent manager, and the channels71 // Core holds the loaded configuration, the agent manager, and the channels
@@ -84,6 +89,8 @@ type Core struct {
84 historyProblem string89 historyProblem string
85 runCtx context.Context90 runCtx context.Context
86 stopWait context.CancelFunc91 stopWait context.CancelFunc
92+ // creator is the mini-me creation assistant's wizard (issue #94).
93+ creator *creation
87 }94 }
88 95
89 // New loads the configuration at location — creating the default file first96 // New loads the configuration at location — creating the default file first
@@ -283,9 +290,10 @@ func (c *Core) Open(ctx context.Context, path string) error {
283 return nil290 return nil
284 }291 }
285 292
286-// Shutdown cancels the answers, closes the terminals, stops every agent and293+// Shutdown closes the creation assistant, cancels the answers, closes the terminals, stops every agent and
287 // closes the history.294 // closes the history.
288 func (c *Core) Shutdown(ctx context.Context) {295 func (c *Core) Shutdown(ctx context.Context) {
296+ (&CreatorService{Core: c}).Cancel()
289 c.closeChannels()297 c.closeChannels()
290 c.stopWorkspaces()298 c.stopWorkspaces()
291 c.manager.StopAll(ctx)299 c.manager.StopAll(ctx)
modified internal/app/app_test.go +2 -0
@@ -15,6 +15,7 @@ import (
1515 "git.rickub.com/bots-garden/sidekicks/internal/app"
1616 "git.rickub.com/bots-garden/sidekicks/internal/channels"
1717 "git.rickub.com/bots-garden/sidekicks/internal/config"
18+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
1819 "git.rickub.com/bots-garden/sidekicks/internal/events"
1920 "git.rickub.com/bots-garden/sidekicks/internal/prefs"
2021 "git.rickub.com/bots-garden/sidekicks/internal/workspace"
@@ -23,6 +24,7 @@ import (
2324 // TestMain points the user's configuration folder, where the history is
2425 // kept, to a temporary folder: tests never touch the real one.
2526 func TestMain(m *testing.M) {
27+ creatortest.RunIfFake()
2628 home, err := os.MkdirTemp("", "sidekicks-app-test")
2729 if err != nil {
2830 panic(err)
@@ -15,6 +15,7 @@ import (
15 "git.rickub.com/bots-garden/sidekicks/internal/app"15 "git.rickub.com/bots-garden/sidekicks/internal/app"
16 "git.rickub.com/bots-garden/sidekicks/internal/channels"16 "git.rickub.com/bots-garden/sidekicks/internal/channels"
17 "git.rickub.com/bots-garden/sidekicks/internal/config"17 "git.rickub.com/bots-garden/sidekicks/internal/config"
18+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
18 "git.rickub.com/bots-garden/sidekicks/internal/events"19 "git.rickub.com/bots-garden/sidekicks/internal/events"
19 "git.rickub.com/bots-garden/sidekicks/internal/prefs"20 "git.rickub.com/bots-garden/sidekicks/internal/prefs"
20 "git.rickub.com/bots-garden/sidekicks/internal/workspace"21 "git.rickub.com/bots-garden/sidekicks/internal/workspace"
@@ -23,6 +24,7 @@ import (
23 // TestMain points the user's configuration folder, where the history is24 // TestMain points the user's configuration folder, where the history is
24 // kept, to a temporary folder: tests never touch the real one.25 // kept, to a temporary folder: tests never touch the real one.
25 func TestMain(m *testing.M) {26 func TestMain(m *testing.M) {
27+ creatortest.RunIfFake()
26 home, err := os.MkdirTemp("", "sidekicks-app-test")28 home, err := os.MkdirTemp("", "sidekicks-app-test")
27 if err != nil {29 if err != nil {
28 panic(err)30 panic(err)
added internal/app/creator.go +233 -0
new file mode 100644
@@ -0,0 +1,233 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package app
4+
5+import (
6+ "context"
7+ "errors"
8+ "fmt"
9+ "path/filepath"
10+ "sync"
11+
12+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
13+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
14+ "git.rickub.com/bots-garden/sidekicks/internal/lifecycle"
15+)
16+
17+// CreatorService is the assistant that creates a mini-me agent for people
18+// who do not write files (issue #94): Sidekicks drives mm's wizard
19+// (mm --acp-create) and shows its questions as forms, then adds the agent
20+// to the configuration. One wizard at a time.
21+//
22+// view, err := service.Start(ctx) // the first form
23+// view, err = service.Answer(ctx, answer) // … until view.Written
24+// result, err := service.Finish(ctx, CreatorFinish{Name: view.Name, Icon: "🤖", Environment: "local"})
25+type CreatorService struct {
26+ Core *Core
27+}
28+
29+// Problems Finish reports instead of an error, for the user to fix: the
30+// interface explains each one.
31+const (
32+ CreatorNameTaken = "nameTaken" // an agent already has this name
33+ CreatorFolderExists = "folderExists" // the agents' folder already has one with this name
34+ CreatorInvalidName = "invalidName" // not a name Sidekicks accepts
35+)
36+
37+// CreatorStart is what Start returns: the wizard's first step, and where
38+// the agent's folder will be.
39+type CreatorStart struct {
40+ View creator.View `json:"view"`
41+ // AgentsFolder is the folder that receives the agent's folder.
42+ AgentsFolder string `json:"agentsFolder"`
43+ // Version is what mm --version said.
44+ Version string `json:"version"`
45+}
46+
47+// CreatorFinish is the last step: the agent's name (its folder's too), its
48+// emoji, and where it runs: local, container or sbx.
49+type CreatorFinish struct {
50+ Name string `json:"name"`
51+ Icon string `json:"icon"`
52+ Environment string `json:"environment"`
53+}
54+
55+// CreatorResult is how Finish ended: Problem (one of the Creator…
56+// constants) or Problems (from the configuration) when the agent was not
57+// added, else the agent's name and folder.
58+type CreatorResult struct {
59+ Problem string `json:"problem"`
60+ Problems []string `json:"problems"`
61+ Name string `json:"name"`
62+ Folder string `json:"folder"`
63+ // Messages are what mm said while writing the container's or the
64+ // sandbox's files.
65+ Messages []string `json:"messages"`
66+}
67+
68+// creation holds the wizard in progress.
69+type creation struct {
70+ mu sync.Mutex
71+ session *creator.Session
72+}
73+
74+func (c *Core) creation() *creation {
75+ c.mu.Lock()
76+ defer c.mu.Unlock()
77+ if c.creator == nil {
78+ c.creator = &creation{}
79+ }
80+ return c.creator
81+}
82+
83+func (c *Core) agentsFolder() string {
84+ c.mu.Lock()
85+ defer c.mu.Unlock()
86+ return c.cfg.AgentsFolder
87+}
88+
89+func (c *Core) creatorOptions() creator.Options {
90+ return creator.Options{Command: c.options.MiniMe, AgentsFolder: c.agentsFolder(), Env: c.options.MiniMeEnv}
91+}
92+
93+// Start checks that mm 1.0.9 or later is installed, then starts its wizard
94+// and returns its first step. A wizard already open is closed first, and
95+// what it wrote is removed.
96+func (s *CreatorService) Start(ctx context.Context) (CreatorStart, error) {
97+ options := s.Core.creatorOptions()
98+ version, err := creator.Version(ctx, options)
99+ if err != nil {
100+ return CreatorStart{}, err
101+ }
102+ creation := s.Core.creation()
103+ creation.mu.Lock()
104+ defer creation.mu.Unlock()
105+ if creation.session != nil {
106+ creation.session.Close()
107+ creation.session = nil
108+ }
109+ session, err := creator.Start(ctx, options)
110+ if err != nil {
111+ return CreatorStart{}, err
112+ }
113+ creation.session = session
114+ view, err := session.Begin(ctx)
115+ return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version}, err
116+}
117+
118+// session is the wizard in progress, or ErrClosed.
119+func (s *CreatorService) session() (*creator.Session, error) {
120+ creation := s.Core.creation()
121+ creation.mu.Lock()
122+ defer creation.mu.Unlock()
123+ if creation.session == nil {
124+ return nil, creator.ErrClosed
125+ }
126+ return creation.session, nil
127+}
128+
129+// Answer answers the form shown (action accept, decline or cancel) and
130+// returns the next step.
131+func (s *CreatorService) Answer(ctx context.Context, answer acp.FormAnswer) (creator.View, error) {
132+ session, err := s.session()
133+ if err != nil {
134+ return creator.View{}, err
135+ }
136+ return session.Answer(ctx, answer)
137+}
138+
139+// Send sends a message to the wizard, such as /back or /restart, and
140+// returns the next step.
141+func (s *CreatorService) Send(ctx context.Context, text string) (creator.View, error) {
142+ session, err := s.session()
143+ if err != nil {
144+ return creator.View{}, err
145+ }
146+ return session.Send(ctx, text)
147+}
148+
149+// Finish gives the agent its folder, named after it in the agents' folder,
150+// writes the files of its container or sandbox, and adds it to the
151+// configuration. A name already used, by an agent or by a folder, is a
152+// Problem: nothing is changed and another name can be tried.
153+func (s *CreatorService) Finish(ctx context.Context, form CreatorFinish) (CreatorResult, error) {
154+ session, err := s.session()
155+ if err != nil {
156+ return CreatorResult{}, err
157+ }
158+ if !creator.ValidName(form.Name) {
159+ return CreatorResult{Problem: CreatorInvalidName}, nil
160+ }
161+ if s.Core.hasAgent(form.Name) {
162+ return CreatorResult{Problem: CreatorNameTaken}, nil
163+ }
164+ result, err := session.Finish(ctx, form.Name, form.Environment)
165+ if errors.Is(err, creator.ErrFolderExists) {
166+ return CreatorResult{Problem: CreatorFolderExists}, nil
167+ }
168+ if err != nil {
169+ return CreatorResult{Messages: result.Messages}, err
170+ }
171+ agent, err := agentFormOf(form, result)
172+ if err != nil {
173+ return CreatorResult{Messages: result.Messages}, err
174+ }
175+ problems, err := (&ConfigService{Core: s.Core}).AddAgent(agent)
176+ if err != nil || len(problems) > 0 {
177+ return CreatorResult{Problems: problems, Messages: result.Messages}, err
178+ }
179+ s.Cancel()
180+ return CreatorResult{Problems: []string{}, Name: form.Name, Folder: result.Folder, Messages: result.Messages}, nil
181+}
182+
183+// Cancel closes the wizard. Before Finish, what it wrote is removed.
184+func (s *CreatorService) Cancel() {
185+ creation := s.Core.creation()
186+ creation.mu.Lock()
187+ defer creation.mu.Unlock()
188+ if creation.session != nil {
189+ creation.session.Close()
190+ creation.session = nil
191+ }
192+}
193+
194+func (c *Core) hasAgent(name string) bool {
195+ c.mu.Lock()
196+ defer c.mu.Unlock()
197+ _, ok := c.cfg.Agent(name)
198+ return ok
199+}
200+
201+// agentFormOf is the configuration entry of a created agent: mm started
202+// with its .mm/agent.yaml, on this computer, with docker exec in the
203+// container of its compose.yaml, or with sbx exec in the sandbox of its
204+// sbxenv.yaml. Both mount the agent's folder at the same path, so the
205+// agent file's path is the same inside.
206+func agentFormOf(form CreatorFinish, result creator.Result) (AgentForm, error) {
207+ agent := AgentForm{
208+ Name: form.Name, Title: result.Title, Icon: form.Icon, Environment: result.Environment,
209+ Program: "mm", Arguments: joinArguments([]string{"--acp", "--config", result.AgentFile}), Workspace: result.Folder,
210+ }
211+ switch result.Environment {
212+ case creator.Container:
213+ compose, err := lifecycle.ReadCompose(filepath.Join(result.Folder, "compose.yaml"))
214+ if err != nil {
215+ return AgentForm{}, err
216+ }
217+ if len(compose.Services) == 0 {
218+ return AgentForm{}, fmt.Errorf("no service in %s", filepath.Join(result.Folder, "compose.yaml"))
219+ }
220+ service := compose.Services[0]
221+ create, stop, remove := compose.Commands(service.Name)
222+ agent.Box, agent.SandboxFolder = service.Container, compose.Folder
223+ agent.CreateCommand, agent.StopCommand, agent.RemoveCommand = joinArguments(create), joinArguments(stop), joinArguments(remove)
224+ case creator.Sandbox:
225+ env, err := lifecycle.ReadSbxEnv(filepath.Join(result.Folder, "sbxenv.yaml"))
226+ if err != nil {
227+ return AgentForm{}, err
228+ }
229+ agent.Box, agent.SandboxFolder = env.Name, env.Folder
230+ agent.CreateCommand, agent.StopCommand, agent.RemoveCommand = joinArguments(env.Create), joinArguments(env.Stop), joinArguments(env.Remove)
231+ }
232+ return agent, nil
233+}
new file mode 100644
@@ -0,0 +1,233 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package app
4+
5+import (
6+ "context"
7+ "errors"
8+ "fmt"
9+ "path/filepath"
10+ "sync"
11+
12+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
13+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
14+ "git.rickub.com/bots-garden/sidekicks/internal/lifecycle"
15+)
16+
17+// CreatorService is the assistant that creates a mini-me agent for people
18+// who do not write files (issue #94): Sidekicks drives mm's wizard
19+// (mm --acp-create) and shows its questions as forms, then adds the agent
20+// to the configuration. One wizard at a time.
21+//
22+// view, err := service.Start(ctx) // the first form
23+// view, err = service.Answer(ctx, answer) // … until view.Written
24+// result, err := service.Finish(ctx, CreatorFinish{Name: view.Name, Icon: "🤖", Environment: "local"})
25+type CreatorService struct {
26+ Core *Core
27+}
28+
29+// Problems Finish reports instead of an error, for the user to fix: the
30+// interface explains each one.
31+const (
32+ CreatorNameTaken = "nameTaken" // an agent already has this name
33+ CreatorFolderExists = "folderExists" // the agents' folder already has one with this name
34+ CreatorInvalidName = "invalidName" // not a name Sidekicks accepts
35+)
36+
37+// CreatorStart is what Start returns: the wizard's first step, and where
38+// the agent's folder will be.
39+type CreatorStart struct {
40+ View creator.View `json:"view"`
41+ // AgentsFolder is the folder that receives the agent's folder.
42+ AgentsFolder string `json:"agentsFolder"`
43+ // Version is what mm --version said.
44+ Version string `json:"version"`
45+}
46+
47+// CreatorFinish is the last step: the agent's name (its folder's too), its
48+// emoji, and where it runs: local, container or sbx.
49+type CreatorFinish struct {
50+ Name string `json:"name"`
51+ Icon string `json:"icon"`
52+ Environment string `json:"environment"`
53+}
54+
55+// CreatorResult is how Finish ended: Problem (one of the Creator…
56+// constants) or Problems (from the configuration) when the agent was not
57+// added, else the agent's name and folder.
58+type CreatorResult struct {
59+ Problem string `json:"problem"`
60+ Problems []string `json:"problems"`
61+ Name string `json:"name"`
62+ Folder string `json:"folder"`
63+ // Messages are what mm said while writing the container's or the
64+ // sandbox's files.
65+ Messages []string `json:"messages"`
66+}
67+
68+// creation holds the wizard in progress.
69+type creation struct {
70+ mu sync.Mutex
71+ session *creator.Session
72+}
73+
74+func (c *Core) creation() *creation {
75+ c.mu.Lock()
76+ defer c.mu.Unlock()
77+ if c.creator == nil {
78+ c.creator = &creation{}
79+ }
80+ return c.creator
81+}
82+
83+func (c *Core) agentsFolder() string {
84+ c.mu.Lock()
85+ defer c.mu.Unlock()
86+ return c.cfg.AgentsFolder
87+}
88+
89+func (c *Core) creatorOptions() creator.Options {
90+ return creator.Options{Command: c.options.MiniMe, AgentsFolder: c.agentsFolder(), Env: c.options.MiniMeEnv}
91+}
92+
93+// Start checks that mm 1.0.9 or later is installed, then starts its wizard
94+// and returns its first step. A wizard already open is closed first, and
95+// what it wrote is removed.
96+func (s *CreatorService) Start(ctx context.Context) (CreatorStart, error) {
97+ options := s.Core.creatorOptions()
98+ version, err := creator.Version(ctx, options)
99+ if err != nil {
100+ return CreatorStart{}, err
101+ }
102+ creation := s.Core.creation()
103+ creation.mu.Lock()
104+ defer creation.mu.Unlock()
105+ if creation.session != nil {
106+ creation.session.Close()
107+ creation.session = nil
108+ }
109+ session, err := creator.Start(ctx, options)
110+ if err != nil {
111+ return CreatorStart{}, err
112+ }
113+ creation.session = session
114+ view, err := session.Begin(ctx)
115+ return CreatorStart{View: view, AgentsFolder: options.AgentsFolder, Version: version}, err
116+}
117+
118+// session is the wizard in progress, or ErrClosed.
119+func (s *CreatorService) session() (*creator.Session, error) {
120+ creation := s.Core.creation()
121+ creation.mu.Lock()
122+ defer creation.mu.Unlock()
123+ if creation.session == nil {
124+ return nil, creator.ErrClosed
125+ }
126+ return creation.session, nil
127+}
128+
129+// Answer answers the form shown (action accept, decline or cancel) and
130+// returns the next step.
131+func (s *CreatorService) Answer(ctx context.Context, answer acp.FormAnswer) (creator.View, error) {
132+ session, err := s.session()
133+ if err != nil {
134+ return creator.View{}, err
135+ }
136+ return session.Answer(ctx, answer)
137+}
138+
139+// Send sends a message to the wizard, such as /back or /restart, and
140+// returns the next step.
141+func (s *CreatorService) Send(ctx context.Context, text string) (creator.View, error) {
142+ session, err := s.session()
143+ if err != nil {
144+ return creator.View{}, err
145+ }
146+ return session.Send(ctx, text)
147+}
148+
149+// Finish gives the agent its folder, named after it in the agents' folder,
150+// writes the files of its container or sandbox, and adds it to the
151+// configuration. A name already used, by an agent or by a folder, is a
152+// Problem: nothing is changed and another name can be tried.
153+func (s *CreatorService) Finish(ctx context.Context, form CreatorFinish) (CreatorResult, error) {
154+ session, err := s.session()
155+ if err != nil {
156+ return CreatorResult{}, err
157+ }
158+ if !creator.ValidName(form.Name) {
159+ return CreatorResult{Problem: CreatorInvalidName}, nil
160+ }
161+ if s.Core.hasAgent(form.Name) {
162+ return CreatorResult{Problem: CreatorNameTaken}, nil
163+ }
164+ result, err := session.Finish(ctx, form.Name, form.Environment)
165+ if errors.Is(err, creator.ErrFolderExists) {
166+ return CreatorResult{Problem: CreatorFolderExists}, nil
167+ }
168+ if err != nil {
169+ return CreatorResult{Messages: result.Messages}, err
170+ }
171+ agent, err := agentFormOf(form, result)
172+ if err != nil {
173+ return CreatorResult{Messages: result.Messages}, err
174+ }
175+ problems, err := (&ConfigService{Core: s.Core}).AddAgent(agent)
176+ if err != nil || len(problems) > 0 {
177+ return CreatorResult{Problems: problems, Messages: result.Messages}, err
178+ }
179+ s.Cancel()
180+ return CreatorResult{Problems: []string{}, Name: form.Name, Folder: result.Folder, Messages: result.Messages}, nil
181+}
182+
183+// Cancel closes the wizard. Before Finish, what it wrote is removed.
184+func (s *CreatorService) Cancel() {
185+ creation := s.Core.creation()
186+ creation.mu.Lock()
187+ defer creation.mu.Unlock()
188+ if creation.session != nil {
189+ creation.session.Close()
190+ creation.session = nil
191+ }
192+}
193+
194+func (c *Core) hasAgent(name string) bool {
195+ c.mu.Lock()
196+ defer c.mu.Unlock()
197+ _, ok := c.cfg.Agent(name)
198+ return ok
199+}
200+
201+// agentFormOf is the configuration entry of a created agent: mm started
202+// with its .mm/agent.yaml, on this computer, with docker exec in the
203+// container of its compose.yaml, or with sbx exec in the sandbox of its
204+// sbxenv.yaml. Both mount the agent's folder at the same path, so the
205+// agent file's path is the same inside.
206+func agentFormOf(form CreatorFinish, result creator.Result) (AgentForm, error) {
207+ agent := AgentForm{
208+ Name: form.Name, Title: result.Title, Icon: form.Icon, Environment: result.Environment,
209+ Program: "mm", Arguments: joinArguments([]string{"--acp", "--config", result.AgentFile}), Workspace: result.Folder,
210+ }
211+ switch result.Environment {
212+ case creator.Container:
213+ compose, err := lifecycle.ReadCompose(filepath.Join(result.Folder, "compose.yaml"))
214+ if err != nil {
215+ return AgentForm{}, err
216+ }
217+ if len(compose.Services) == 0 {
218+ return AgentForm{}, fmt.Errorf("no service in %s", filepath.Join(result.Folder, "compose.yaml"))
219+ }
220+ service := compose.Services[0]
221+ create, stop, remove := compose.Commands(service.Name)
222+ agent.Box, agent.SandboxFolder = service.Container, compose.Folder
223+ agent.CreateCommand, agent.StopCommand, agent.RemoveCommand = joinArguments(create), joinArguments(stop), joinArguments(remove)
224+ case creator.Sandbox:
225+ env, err := lifecycle.ReadSbxEnv(filepath.Join(result.Folder, "sbxenv.yaml"))
226+ if err != nil {
227+ return AgentForm{}, err
228+ }
229+ agent.Box, agent.SandboxFolder = env.Name, env.Folder
230+ agent.CreateCommand, agent.StopCommand, agent.RemoveCommand = joinArguments(env.Create), joinArguments(env.Stop), joinArguments(env.Remove)
231+ }
232+ return agent, nil
233+}
added internal/app/creator_test.go +141 -0
new file mode 100644
@@ -0,0 +1,141 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package app_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "os"
9+ "path/filepath"
10+ "slices"
11+ "testing"
12+
13+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
14+ "git.rickub.com/bots-garden/sidekicks/internal/app"
15+ "git.rickub.com/bots-garden/sidekicks/internal/config"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
17+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
18+)
19+
20+// creatorFixture is a configuration whose agents' folder is a temporary
21+// one, and the creation assistant with the fake mm of creatortest.
22+func creatorFixture(t *testing.T, version string) (*app.CreatorService, string, string) {
23+ t.Helper()
24+ dir := t.TempDir()
25+ folder := filepath.Join(dir, "Documents")
26+ path := filepath.Join(dir, "config.yaml")
27+ write(t, path, "version: 1\nagentsFolder: "+folder+"\nagents:\n - name: alice\n command: sh\n")
28+ command, env := creatortest.Fake(t, version)
29+ core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, MiniMe: command, MiniMeEnv: env})
30+ t.Cleanup(func() { core.Shutdown(context.Background()) })
31+ return &app.CreatorService{Core: core}, path, folder
32+}
33+
34+// written runs the wizard of the fake mm up to the agent file.
35+func written(t *testing.T, service *app.CreatorService, name string) {
36+ t.Helper()
37+ start, err := service.Start(context.Background())
38+ if err != nil {
39+ t.Fatal(err)
40+ }
41+ if start.View.Form == nil || start.Version != "mm v1.0.9" {
42+ t.Fatalf("start: %+v", start)
43+ }
44+ view, err := service.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}})
45+ if err != nil || !view.Written {
46+ t.Fatalf("answer: %+v %v", view, err)
47+ }
48+}
49+
50+func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) {
51+ service, path, folder := creatorFixture(t, "mm v1.0.9")
52+ written(t, service, "Bob")
53+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Icon: "🦊", Environment: creator.Local})
54+ if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "bob" {
55+ t.Fatalf("finish: %+v %v", result, err)
56+ }
57+ cfg, err := config.Load(path)
58+ if err != nil {
59+ t.Fatal(err)
60+ }
61+ bob, ok := cfg.Agent("bob")
62+ agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml")
63+ if !ok || bob.Icon != "🦊" || bob.Title != "Bob (developer)" || bob.Workspace != filepath.Join(folder, "bob") ||
64+ !slices.Equal(bob.Args, []string{"--acp", "--config", agentFile}) || filepath.Base(bob.Command) != "mm" {
65+ t.Fatalf("bob: %+v", bob)
66+ }
67+ if _, err := service.Send(context.Background(), "/start"); !errors.Is(err, creator.ErrClosed) {
68+ t.Fatalf("the wizard should be closed after Finish: %v", err)
69+ }
70+}
71+
72+func TestACreatedAgentInAContainerOrASandboxGetsItsRuntime(t *testing.T) {
73+ for _, environment := range []string{creator.Container, creator.Sandbox} {
74+ service, path, folder := creatorFixture(t, "mm v1.0.9")
75+ written(t, service, "bob")
76+ if _, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Environment: environment}); err != nil {
77+ t.Fatalf("%s: %v", environment, err)
78+ }
79+ cfg, err := config.Load(path)
80+ if err != nil {
81+ t.Fatal(err)
82+ }
83+ bob, _ := cfg.Agent("bob")
84+ agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml")
85+ runtime := bob.Runtime
86+ switch environment {
87+ case creator.Container:
88+ if runtime.Type != "container" || runtime.Container != "bob-box" || !slices.Equal(bob.Args, []string{"exec", "-i", "bob-box", "mm", "--acp", "--config", agentFile}) ||
89+ !slices.Equal(runtime.Lifecycle.Create[1:], []string{"compose", "-f", "compose.yaml", "up", "-d", "--wait", "bob"}) {
90+ t.Fatalf("container: %+v", bob)
91+ }
92+ case creator.Sandbox:
93+ if runtime.Type != "sbx" || runtime.Sandbox != "bob-sbx" || !slices.Equal(bob.Args, []string{"exec", "-i", "bob-sbx", "mm", "--acp", "--config", agentFile}) ||
94+ len(runtime.Lifecycle.Create) == 0 || runtime.Lifecycle.Folder != filepath.Join(folder, "bob") {
95+ t.Fatalf("sbx: %+v", bob)
96+ }
97+ }
98+ }
99+}
100+
101+func TestANameAlreadyUsedIsAProblemToFix(t *testing.T) {
102+ service, _, folder := creatorFixture(t, "mm v1.0.9")
103+ written(t, service, "alice")
104+ cases := []struct{ name, problem string }{
105+ {"alice", app.CreatorNameTaken},
106+ {"Not A Name", app.CreatorInvalidName},
107+ }
108+ for _, c := range cases {
109+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: c.name, Environment: creator.Local})
110+ if err != nil || result.Problem != c.problem {
111+ t.Fatalf("%s: %+v %v", c.name, result, err)
112+ }
113+ }
114+ if err := os.MkdirAll(filepath.Join(folder, "alice-2"), 0o755); err != nil {
115+ t.Fatal(err)
116+ }
117+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "alice-2", Environment: creator.Local})
118+ if err != nil || result.Problem != app.CreatorFolderExists {
119+ t.Fatalf("existing folder: %+v %v", result, err)
120+ }
121+ result, err = service.Finish(context.Background(), app.CreatorFinish{Name: "alice-3", Environment: creator.Local})
122+ if err != nil || result.Problem != "" || result.Name != "alice-3" {
123+ t.Fatalf("a free name: %+v %v", result, err)
124+ }
125+}
126+
127+func TestAnOldMMIsRefusedAndCancelRemovesTheWizardsFolder(t *testing.T) {
128+ old, _, _ := creatorFixture(t, "mm v1.0.8")
129+ var tooOld *creator.TooOldError
130+ if _, err := old.Start(context.Background()); !errors.As(err, &tooOld) || tooOld.Found != "1.0.8" {
131+ t.Fatalf("an old mm: %v", err)
132+ }
133+ service, _, folder := creatorFixture(t, "mm v1.0.9")
134+ if _, err := service.Start(context.Background()); err != nil {
135+ t.Fatal(err)
136+ }
137+ service.Cancel()
138+ if entries, _ := os.ReadDir(folder); len(entries) != 0 {
139+ t.Fatalf("the agents' folder should be left empty: %v", entries)
140+ }
141+}
new file mode 100644
@@ -0,0 +1,141 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package app_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "os"
9+ "path/filepath"
10+ "slices"
11+ "testing"
12+
13+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
14+ "git.rickub.com/bots-garden/sidekicks/internal/app"
15+ "git.rickub.com/bots-garden/sidekicks/internal/config"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
17+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
18+)
19+
20+// creatorFixture is a configuration whose agents' folder is a temporary
21+// one, and the creation assistant with the fake mm of creatortest.
22+func creatorFixture(t *testing.T, version string) (*app.CreatorService, string, string) {
23+ t.Helper()
24+ dir := t.TempDir()
25+ folder := filepath.Join(dir, "Documents")
26+ path := filepath.Join(dir, "config.yaml")
27+ write(t, path, "version: 1\nagentsFolder: "+folder+"\nagents:\n - name: alice\n command: sh\n")
28+ command, env := creatortest.Fake(t, version)
29+ core := app.New(config.Location{Path: path, Source: config.SourceFlag}, app.Options{Starter: starter, MiniMe: command, MiniMeEnv: env})
30+ t.Cleanup(func() { core.Shutdown(context.Background()) })
31+ return &app.CreatorService{Core: core}, path, folder
32+}
33+
34+// written runs the wizard of the fake mm up to the agent file.
35+func written(t *testing.T, service *app.CreatorService, name string) {
36+ t.Helper()
37+ start, err := service.Start(context.Background())
38+ if err != nil {
39+ t.Fatal(err)
40+ }
41+ if start.View.Form == nil || start.Version != "mm v1.0.9" {
42+ t.Fatalf("start: %+v", start)
43+ }
44+ view, err := service.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}})
45+ if err != nil || !view.Written {
46+ t.Fatalf("answer: %+v %v", view, err)
47+ }
48+}
49+
50+func TestTheCreatedAgentIsAddedToTheConfiguration(t *testing.T) {
51+ service, path, folder := creatorFixture(t, "mm v1.0.9")
52+ written(t, service, "Bob")
53+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Icon: "🦊", Environment: creator.Local})
54+ if err != nil || result.Problem != "" || len(result.Problems) != 0 || result.Name != "bob" {
55+ t.Fatalf("finish: %+v %v", result, err)
56+ }
57+ cfg, err := config.Load(path)
58+ if err != nil {
59+ t.Fatal(err)
60+ }
61+ bob, ok := cfg.Agent("bob")
62+ agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml")
63+ if !ok || bob.Icon != "🦊" || bob.Title != "Bob (developer)" || bob.Workspace != filepath.Join(folder, "bob") ||
64+ !slices.Equal(bob.Args, []string{"--acp", "--config", agentFile}) || filepath.Base(bob.Command) != "mm" {
65+ t.Fatalf("bob: %+v", bob)
66+ }
67+ if _, err := service.Send(context.Background(), "/start"); !errors.Is(err, creator.ErrClosed) {
68+ t.Fatalf("the wizard should be closed after Finish: %v", err)
69+ }
70+}
71+
72+func TestACreatedAgentInAContainerOrASandboxGetsItsRuntime(t *testing.T) {
73+ for _, environment := range []string{creator.Container, creator.Sandbox} {
74+ service, path, folder := creatorFixture(t, "mm v1.0.9")
75+ written(t, service, "bob")
76+ if _, err := service.Finish(context.Background(), app.CreatorFinish{Name: "bob", Environment: environment}); err != nil {
77+ t.Fatalf("%s: %v", environment, err)
78+ }
79+ cfg, err := config.Load(path)
80+ if err != nil {
81+ t.Fatal(err)
82+ }
83+ bob, _ := cfg.Agent("bob")
84+ agentFile := filepath.Join(folder, "bob", ".mm", "agent.yaml")
85+ runtime := bob.Runtime
86+ switch environment {
87+ case creator.Container:
88+ if runtime.Type != "container" || runtime.Container != "bob-box" || !slices.Equal(bob.Args, []string{"exec", "-i", "bob-box", "mm", "--acp", "--config", agentFile}) ||
89+ !slices.Equal(runtime.Lifecycle.Create[1:], []string{"compose", "-f", "compose.yaml", "up", "-d", "--wait", "bob"}) {
90+ t.Fatalf("container: %+v", bob)
91+ }
92+ case creator.Sandbox:
93+ if runtime.Type != "sbx" || runtime.Sandbox != "bob-sbx" || !slices.Equal(bob.Args, []string{"exec", "-i", "bob-sbx", "mm", "--acp", "--config", agentFile}) ||
94+ len(runtime.Lifecycle.Create) == 0 || runtime.Lifecycle.Folder != filepath.Join(folder, "bob") {
95+ t.Fatalf("sbx: %+v", bob)
96+ }
97+ }
98+ }
99+}
100+
101+func TestANameAlreadyUsedIsAProblemToFix(t *testing.T) {
102+ service, _, folder := creatorFixture(t, "mm v1.0.9")
103+ written(t, service, "alice")
104+ cases := []struct{ name, problem string }{
105+ {"alice", app.CreatorNameTaken},
106+ {"Not A Name", app.CreatorInvalidName},
107+ }
108+ for _, c := range cases {
109+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: c.name, Environment: creator.Local})
110+ if err != nil || result.Problem != c.problem {
111+ t.Fatalf("%s: %+v %v", c.name, result, err)
112+ }
113+ }
114+ if err := os.MkdirAll(filepath.Join(folder, "alice-2"), 0o755); err != nil {
115+ t.Fatal(err)
116+ }
117+ result, err := service.Finish(context.Background(), app.CreatorFinish{Name: "alice-2", Environment: creator.Local})
118+ if err != nil || result.Problem != app.CreatorFolderExists {
119+ t.Fatalf("existing folder: %+v %v", result, err)
120+ }
121+ result, err = service.Finish(context.Background(), app.CreatorFinish{Name: "alice-3", Environment: creator.Local})
122+ if err != nil || result.Problem != "" || result.Name != "alice-3" {
123+ t.Fatalf("a free name: %+v %v", result, err)
124+ }
125+}
126+
127+func TestAnOldMMIsRefusedAndCancelRemovesTheWizardsFolder(t *testing.T) {
128+ old, _, _ := creatorFixture(t, "mm v1.0.8")
129+ var tooOld *creator.TooOldError
130+ if _, err := old.Start(context.Background()); !errors.As(err, &tooOld) || tooOld.Found != "1.0.8" {
131+ t.Fatalf("an old mm: %v", err)
132+ }
133+ service, _, folder := creatorFixture(t, "mm v1.0.9")
134+ if _, err := service.Start(context.Background()); err != nil {
135+ t.Fatal(err)
136+ }
137+ service.Cancel()
138+ if entries, _ := os.ReadDir(folder); len(entries) != 0 {
139+ t.Fatalf("the agents' folder should be left empty: %v", entries)
140+ }
141+}
modified internal/app/services.go +6 -0
@@ -112,6 +112,12 @@ func (s *ChannelService) AnswerPermission(id, optionID string) error {
112112 return s.Core.Channels().AnswerPermission(id, optionID)
113113 }
114114
115+// AnswerForm gives the user's answer to a form an agent asked (issue #95):
116+// action accept with content (values by field name), decline or cancel.
117+func (s *ChannelService) AnswerForm(id string, answer acp.FormAnswer) error {
118+ return s.Core.Channels().AnswerForm(id, answer)
119+}
120+
115121 // Conversation returns the last messages and the state of a channel.
116122 func (s *ChannelService) Conversation(id string) (channels.Conversation, error) {
117123 return s.Core.Channels().Conversation(id)
@@ -112,6 +112,12 @@ func (s *ChannelService) AnswerPermission(id, optionID string) error {
112 return s.Core.Channels().AnswerPermission(id, optionID)112 return s.Core.Channels().AnswerPermission(id, optionID)
113 }113 }
114 114
115+// AnswerForm gives the user's answer to a form an agent asked (issue #95):
116+// action accept with content (values by field name), decline or cancel.
117+func (s *ChannelService) AnswerForm(id string, answer acp.FormAnswer) error {
118+ return s.Core.Channels().AnswerForm(id, answer)
119+}
120+
115 // Conversation returns the last messages and the state of a channel.121 // Conversation returns the last messages and the state of a channel.
116 func (s *ChannelService) Conversation(id string) (channels.Conversation, error) {122 func (s *ChannelService) Conversation(id string) (channels.Conversation, error) {
117 return s.Core.Channels().Conversation(id)123 return s.Core.Channels().Conversation(id)
modified internal/channels/channels.go +33 -3
@@ -140,6 +140,16 @@ type Permission struct {
140140 Rejections int `json:"rejections"`
141141 }
142142
143+// FormRequest is a form an agent asks the user to fill in, waiting for the
144+// answer (issue #95: mini-me's ask_user).
145+type FormRequest struct {
146+ ID string `json:"id"`
147+ Channel string `json:"channel"`
148+ Agent string `json:"agent"`
149+ MessageID string `json:"messageId"`
150+ Form acp.Form `json:"form"`
151+}
152+
143153 // Channel is a channel as the interface lists it.
144154 type Channel struct {
145155 ID string `json:"id"`
@@ -166,6 +176,8 @@ type Conversation struct {
166176 // Usage is the context window use of each member, by agent name.
167177 Usage map[string]acp.Usage `json:"usage"`
168178 Permissions []Permission `json:"permissions"`
179+ // Forms are the forms waiting for an answer (issue #95).
180+ Forms []FormRequest `json:"forms"`
169181 }
170182
171183 // Event payloads, registered with Wails in main.go.
@@ -209,6 +221,12 @@ type PermissionResolvedPayload struct {
209221 Channel string `json:"channel"`
210222 }
211223
224+// FormResolvedPayload says a form no longer waits.
225+type FormResolvedPayload struct {
226+ ID string `json:"id"`
227+ Channel string `json:"channel"`
228+}
229+
212230 // UsagePayload is the context window use of an agent in a channel.
213231 type UsagePayload struct {
214232 Channel string `json:"channel"`
@@ -270,6 +288,7 @@ type Manager struct {
270288 channels map[string]*channel
271289 order []string // channel ids, oldest first
272290 permissions map[string]*pendingPermission
291+ forms map[string]*pendingForm
273292 commands map[string][]acp.Command
274293 // turns lets one agent answer one channel at a time: a local model
275294 // serving two prompts at once would only be slower, and use more memory.
@@ -324,6 +343,12 @@ type pending struct {
324343 route Route
325344 }
326345
346+type pendingForm struct {
347+ request FormRequest
348+ channel *channel
349+ answer chan acp.FormAnswer
350+}
351+
327352 type pendingPermission struct {
328353 permission Permission
329354 channel *channel
@@ -341,7 +366,7 @@ func NewManager(source AgentSource, db *store.Store, options Options) (*Manager,
341366 }
342367 m := &Manager{
343368 agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, handoffs: options.Handoffs, parallel: options.Parallel,
344- channels: map[string]*channel{}, permissions: map[string]*pendingPermission{},
369+ channels: map[string]*channel{}, permissions: map[string]*pendingPermission{}, forms: map[string]*pendingForm{},
345370 commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{},
346371 }
347372 stored, err := db.Channels()
@@ -611,7 +636,7 @@ func (m *Manager) commandsKnown(agent string) bool {
611636 }
612637
613638 // Conversation returns what the interface shows of a channel: its last
614-// messages, its state and its pending permission requests.
639+// messages, its state, its pending permission requests and forms.
615640 func (m *Manager) Conversation(id string) (Conversation, error) {
616641 m.mu.Lock()
617642 defer m.mu.Unlock()
@@ -622,7 +647,7 @@ func (m *Manager) Conversation(id string) (Conversation, error) {
622647 if err := m.load(ch); err != nil {
623648 return Conversation{}, err
624649 }
625- view := Conversation{Channel: ch.view(), Messages: []Message{}, More: ch.more, Busy: ch.busy, Queued: len(ch.queue), Usage: map[string]acp.Usage{}, Permissions: []Permission{}}
650+ view := Conversation{Channel: ch.view(), Messages: []Message{}, More: ch.more, Busy: ch.busy, Queued: len(ch.queue), Usage: map[string]acp.Usage{}, Permissions: []Permission{}, Forms: []FormRequest{}}
626651 for _, message := range ch.messages {
627652 view.Messages = append(view.Messages, copyMessage(message))
628653 }
@@ -635,6 +660,11 @@ func (m *Manager) Conversation(id string) (Conversation, error) {
635660 view.Permissions = append(view.Permissions, pending.permission)
636661 }
637662 }
663+ for _, pending := range m.forms {
664+ if pending.channel == ch {
665+ view.Forms = append(view.Forms, pending.request)
666+ }
667+ }
638668 return view, nil
639669 }
640670
@@ -140,6 +140,16 @@ type Permission struct {
140 Rejections int `json:"rejections"`140 Rejections int `json:"rejections"`
141 }141 }
142 142
143+// FormRequest is a form an agent asks the user to fill in, waiting for the
144+// answer (issue #95: mini-me's ask_user).
145+type FormRequest struct {
146+ ID string `json:"id"`
147+ Channel string `json:"channel"`
148+ Agent string `json:"agent"`
149+ MessageID string `json:"messageId"`
150+ Form acp.Form `json:"form"`
151+}
152+
143 // Channel is a channel as the interface lists it.153 // Channel is a channel as the interface lists it.
144 type Channel struct {154 type Channel struct {
145 ID string `json:"id"`155 ID string `json:"id"`
@@ -166,6 +176,8 @@ type Conversation struct {
166 // Usage is the context window use of each member, by agent name.176 // Usage is the context window use of each member, by agent name.
167 Usage map[string]acp.Usage `json:"usage"`177 Usage map[string]acp.Usage `json:"usage"`
168 Permissions []Permission `json:"permissions"`178 Permissions []Permission `json:"permissions"`
179+ // Forms are the forms waiting for an answer (issue #95).
180+ Forms []FormRequest `json:"forms"`
169 }181 }
170 182
171 // Event payloads, registered with Wails in main.go.183 // Event payloads, registered with Wails in main.go.
@@ -209,6 +221,12 @@ type PermissionResolvedPayload struct {
209 Channel string `json:"channel"`221 Channel string `json:"channel"`
210 }222 }
211 223
224+// FormResolvedPayload says a form no longer waits.
225+type FormResolvedPayload struct {
226+ ID string `json:"id"`
227+ Channel string `json:"channel"`
228+}
229+
212 // UsagePayload is the context window use of an agent in a channel.230 // UsagePayload is the context window use of an agent in a channel.
213 type UsagePayload struct {231 type UsagePayload struct {
214 Channel string `json:"channel"`232 Channel string `json:"channel"`
@@ -270,6 +288,7 @@ type Manager struct {
270 channels map[string]*channel288 channels map[string]*channel
271 order []string // channel ids, oldest first289 order []string // channel ids, oldest first
272 permissions map[string]*pendingPermission290 permissions map[string]*pendingPermission
291+ forms map[string]*pendingForm
273 commands map[string][]acp.Command292 commands map[string][]acp.Command
274 // turns lets one agent answer one channel at a time: a local model293 // turns lets one agent answer one channel at a time: a local model
275 // serving two prompts at once would only be slower, and use more memory.294 // serving two prompts at once would only be slower, and use more memory.
@@ -324,6 +343,12 @@ type pending struct {
324 route Route343 route Route
325 }344 }
326 345
346+type pendingForm struct {
347+ request FormRequest
348+ channel *channel
349+ answer chan acp.FormAnswer
350+}
351+
327 type pendingPermission struct {352 type pendingPermission struct {
328 permission Permission353 permission Permission
329 channel *channel354 channel *channel
@@ -341,7 +366,7 @@ func NewManager(source AgentSource, db *store.Store, options Options) (*Manager,
341 }366 }
342 m := &Manager{367 m := &Manager{
343 agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, handoffs: options.Handoffs, parallel: options.Parallel,368 agents: source, db: db, emitter: options.Emitter, now: options.Now, files: options.Files, handoffs: options.Handoffs, parallel: options.Parallel,
344- channels: map[string]*channel{}, permissions: map[string]*pendingPermission{},369+ channels: map[string]*channel{}, permissions: map[string]*pendingPermission{}, forms: map[string]*pendingForm{},
345 commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{},370 commands: map[string][]acp.Command{}, turns: map[string]chan struct{}{},
346 }371 }
347 stored, err := db.Channels()372 stored, err := db.Channels()
@@ -611,7 +636,7 @@ func (m *Manager) commandsKnown(agent string) bool {
611 }636 }
612 637
613 // Conversation returns what the interface shows of a channel: its last638 // Conversation returns what the interface shows of a channel: its last
614-// messages, its state and its pending permission requests.639+// messages, its state, its pending permission requests and forms.
615 func (m *Manager) Conversation(id string) (Conversation, error) {640 func (m *Manager) Conversation(id string) (Conversation, error) {
616 m.mu.Lock()641 m.mu.Lock()
617 defer m.mu.Unlock()642 defer m.mu.Unlock()
@@ -622,7 +647,7 @@ func (m *Manager) Conversation(id string) (Conversation, error) {
622 if err := m.load(ch); err != nil {647 if err := m.load(ch); err != nil {
623 return Conversation{}, err648 return Conversation{}, err
624 }649 }
625- view := Conversation{Channel: ch.view(), Messages: []Message{}, More: ch.more, Busy: ch.busy, Queued: len(ch.queue), Usage: map[string]acp.Usage{}, Permissions: []Permission{}}650+ view := Conversation{Channel: ch.view(), Messages: []Message{}, More: ch.more, Busy: ch.busy, Queued: len(ch.queue), Usage: map[string]acp.Usage{}, Permissions: []Permission{}, Forms: []FormRequest{}}
626 for _, message := range ch.messages {651 for _, message := range ch.messages {
627 view.Messages = append(view.Messages, copyMessage(message))652 view.Messages = append(view.Messages, copyMessage(message))
628 }653 }
@@ -635,6 +660,11 @@ func (m *Manager) Conversation(id string) (Conversation, error) {
635 view.Permissions = append(view.Permissions, pending.permission)660 view.Permissions = append(view.Permissions, pending.permission)
636 }661 }
637 }662 }
663+ for _, pending := range m.forms {
664+ if pending.channel == ch {
665+ view.Forms = append(view.Forms, pending.request)
666+ }
667+ }
638 return view, nil668 return view, nil
639 }669 }
640 670
added internal/channels/forms_test.go +76 -0
new file mode 100644
@@ -0,0 +1,76 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package channels_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "testing"
9+
10+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
11+ "git.rickub.com/bots-garden/sidekicks/internal/channels"
12+ "git.rickub.com/bots-garden/sidekicks/internal/events"
13+)
14+
15+// ask is mini-me's ask_user in short: one text question, then the answer
16+// written back in the agent's message.
17+func ask(ctx context.Context, h acp.SessionHandler) (acp.TurnResult, error) {
18+ asker, ok := h.(acp.FormAsker)
19+ if !ok {
20+ return acp.TurnResult{}, errors.New("the handler cannot show forms")
21+ }
22+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: "One question: "})
23+ answer := asker.RequestForm(ctx, acp.Form{Message: "ask_user", Fields: []acp.FormField{{Name: "q1", Title: "Your city?", Type: acp.FieldText, Required: true}}})
24+ switch answer.Action {
25+ case acp.FormAccept:
26+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: "you live in " + answer.Content["q1"].(string)})
27+ default:
28+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer.Action})
29+ }
30+ return acp.TurnResult{StopReason: "end_turn"}, nil
31+}
32+
33+func TestAFormIsShownInTheConversationAndAnswered(t *testing.T) {
34+ f := setup(t, map[string]script{"ask": ask})
35+ direct, _ := f.manager.Direct("alice")
36+ f.send(t, direct.ID, "ask")
37+ waitFor(t, func() bool { return len(f.recorder.Named(events.FormRequested)) == 1 })
38+ request := f.recorder.Named(events.FormRequested)[0].(channels.FormRequest)
39+ if request.Channel != direct.ID || request.Agent != "alice" || request.MessageID == "" || request.Form.Fields[0].Title != "Your city?" {
40+ t.Fatalf("request: %+v", request)
41+ }
42+ if view, _ := f.manager.Conversation(direct.ID); len(view.Forms) != 1 || view.Forms[0].ID != request.ID {
43+ t.Fatalf("the form should wait in the conversation: %+v", view.Forms)
44+ }
45+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: "maybe"}); err == nil {
46+ t.Fatal("an unknown action must be refused")
47+ }
48+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"q1": "Lyon"}}); err != nil {
49+ t.Fatal(err)
50+ }
51+ view := f.idle(t, direct.ID, 2)
52+ if text := view.Messages[1].Parts[0].Text; text != "One question: you live in Lyon" {
53+ t.Fatalf("answer: %q", text)
54+ }
55+ if len(view.Forms) != 0 || len(f.recorder.Named(events.FormResolved)) != 1 {
56+ t.Fatal("the form should be resolved")
57+ }
58+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: acp.FormAccept}); err == nil {
59+ t.Fatal("a form answered twice must be refused")
60+ }
61+}
62+
63+func TestStopCancelsAWaitingForm(t *testing.T) {
64+ f := setup(t, map[string]script{"ask": ask})
65+ direct, _ := f.manager.Direct("alice")
66+ f.send(t, direct.ID, "ask")
67+ waitFor(t, func() bool { return len(f.recorder.Named(events.FormRequested)) == 1 })
68+ f.manager.Cancel(direct.ID)
69+ view := f.idle(t, direct.ID, 2)
70+ if text := view.Messages[1].Parts[0].Text; text != "One question: cancel" {
71+ t.Fatalf("answer: %q", text)
72+ }
73+ if len(f.recorder.Named(events.FormResolved)) != 1 {
74+ t.Fatal("the form should be resolved")
75+ }
76+}
new file mode 100644
@@ -0,0 +1,76 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package channels_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "testing"
9+
10+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
11+ "git.rickub.com/bots-garden/sidekicks/internal/channels"
12+ "git.rickub.com/bots-garden/sidekicks/internal/events"
13+)
14+
15+// ask is mini-me's ask_user in short: one text question, then the answer
16+// written back in the agent's message.
17+func ask(ctx context.Context, h acp.SessionHandler) (acp.TurnResult, error) {
18+ asker, ok := h.(acp.FormAsker)
19+ if !ok {
20+ return acp.TurnResult{}, errors.New("the handler cannot show forms")
21+ }
22+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: "One question: "})
23+ answer := asker.RequestForm(ctx, acp.Form{Message: "ask_user", Fields: []acp.FormField{{Name: "q1", Title: "Your city?", Type: acp.FieldText, Required: true}}})
24+ switch answer.Action {
25+ case acp.FormAccept:
26+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: "you live in " + answer.Content["q1"].(string)})
27+ default:
28+ h.Update(acp.Update{Kind: acp.UpdateMessage, Text: answer.Action})
29+ }
30+ return acp.TurnResult{StopReason: "end_turn"}, nil
31+}
32+
33+func TestAFormIsShownInTheConversationAndAnswered(t *testing.T) {
34+ f := setup(t, map[string]script{"ask": ask})
35+ direct, _ := f.manager.Direct("alice")
36+ f.send(t, direct.ID, "ask")
37+ waitFor(t, func() bool { return len(f.recorder.Named(events.FormRequested)) == 1 })
38+ request := f.recorder.Named(events.FormRequested)[0].(channels.FormRequest)
39+ if request.Channel != direct.ID || request.Agent != "alice" || request.MessageID == "" || request.Form.Fields[0].Title != "Your city?" {
40+ t.Fatalf("request: %+v", request)
41+ }
42+ if view, _ := f.manager.Conversation(direct.ID); len(view.Forms) != 1 || view.Forms[0].ID != request.ID {
43+ t.Fatalf("the form should wait in the conversation: %+v", view.Forms)
44+ }
45+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: "maybe"}); err == nil {
46+ t.Fatal("an unknown action must be refused")
47+ }
48+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"q1": "Lyon"}}); err != nil {
49+ t.Fatal(err)
50+ }
51+ view := f.idle(t, direct.ID, 2)
52+ if text := view.Messages[1].Parts[0].Text; text != "One question: you live in Lyon" {
53+ t.Fatalf("answer: %q", text)
54+ }
55+ if len(view.Forms) != 0 || len(f.recorder.Named(events.FormResolved)) != 1 {
56+ t.Fatal("the form should be resolved")
57+ }
58+ if err := f.manager.AnswerForm(request.ID, acp.FormAnswer{Action: acp.FormAccept}); err == nil {
59+ t.Fatal("a form answered twice must be refused")
60+ }
61+}
62+
63+func TestStopCancelsAWaitingForm(t *testing.T) {
64+ f := setup(t, map[string]script{"ask": ask})
65+ direct, _ := f.manager.Direct("alice")
66+ f.send(t, direct.ID, "ask")
67+ waitFor(t, func() bool { return len(f.recorder.Named(events.FormRequested)) == 1 })
68+ f.manager.Cancel(direct.ID)
69+ view := f.idle(t, direct.ID, 2)
70+ if text := view.Messages[1].Parts[0].Text; text != "One question: cancel" {
71+ t.Fatalf("answer: %q", text)
72+ }
73+ if len(f.recorder.Named(events.FormResolved)) != 1 {
74+ t.Fatal("the form should be resolved")
75+ }
76+}
modified internal/channels/turns.go +60 -0
@@ -640,6 +640,11 @@ func (m *Manager) Cancel(id string) {
640640 m.resolve(requestID, acp.PermissionAnswer{})
641641 }
642642 }
643+ for formID, pending := range m.forms {
644+ if pending.channel == ch {
645+ m.resolveForm(formID, acp.FormAnswer{Action: acp.FormCancel})
646+ }
647+ }
643648 // An agent that streams is asked to stop (session/cancel); one that is
644649 // still waited for, or starting, is given up.
645650 var stops []func()
@@ -679,6 +684,31 @@ func (m *Manager) AnswerPermission(id, optionID string) error {
679684 return fmt.Errorf("permission request %s has no option %s", id, optionID)
680685 }
681686
687+// AnswerForm gives the user's answer to a form: action accept (with the
688+// values by field name), decline or cancel.
689+func (m *Manager) AnswerForm(id string, answer acp.FormAnswer) error {
690+ m.mu.Lock()
691+ defer m.mu.Unlock()
692+ if _, ok := m.forms[id]; !ok {
693+ return fmt.Errorf("no form %s waits", id)
694+ }
695+ switch answer.Action {
696+ case acp.FormAccept, acp.FormDecline, acp.FormCancel:
697+ default:
698+ return fmt.Errorf("unknown form action %q", answer.Action)
699+ }
700+ m.resolveForm(id, answer)
701+ return nil
702+}
703+
704+// resolveForm answers a pending form. The caller holds m.mu.
705+func (m *Manager) resolveForm(id string, answer acp.FormAnswer) {
706+ pending := m.forms[id]
707+ delete(m.forms, id)
708+ pending.answer <- answer
709+ m.emitter.Emit(events.FormResolved, FormResolvedPayload{ID: id, Channel: pending.channel.info.ID})
710+}
711+
682712 // resolve answers a pending request. The caller holds m.mu.
683713 func (m *Manager) resolve(id string, answer acp.PermissionAnswer) {
684714 pending := m.permissions[id]
@@ -805,6 +835,36 @@ func (h *handler) RequestPermission(ctx context.Context, request acp.PermissionR
805835 }
806836 }
807837
838+// RequestForm shows the form the agent asks (issue #95: mini-me's ask_user)
839+// in the channel, attached to the answer being written, and waits for the
840+// user's answer; Stop or the end of the turn cancels it.
841+func (h *handler) RequestForm(ctx context.Context, form acp.Form) acp.FormAnswer {
842+ m, ch := h.manager, h.channel
843+ m.mu.Lock()
844+ m.sequence++
845+ id := fmt.Sprintf("f-%d", m.sequence)
846+ pending := &pendingForm{channel: ch, answer: make(chan acp.FormAnswer, 1)}
847+ pending.request = FormRequest{ID: id, Channel: ch.info.ID, Agent: h.agent, Form: form}
848+ if message := ch.current[h.agent]; message != nil {
849+ pending.request.MessageID = message.ID
850+ }
851+ m.forms[id] = pending
852+ m.emitter.Emit(events.FormRequested, pending.request)
853+ m.mu.Unlock()
854+
855+ select {
856+ case answer := <-pending.answer:
857+ return answer
858+ case <-ctx.Done():
859+ m.mu.Lock()
860+ if _, waiting := m.forms[id]; waiting {
861+ m.resolveForm(id, acp.FormAnswer{Action: acp.FormCancel})
862+ }
863+ m.mu.Unlock()
864+ return acp.FormAnswer{Action: acp.FormCancel}
865+ }
866+}
867+
808868 func toolIndex(message *Message, id string) int {
809869 for i, part := range message.Parts {
810870 if part.Kind == PartTool && part.Tool.ID == id {
@@ -640,6 +640,11 @@ func (m *Manager) Cancel(id string) {
640 m.resolve(requestID, acp.PermissionAnswer{})640 m.resolve(requestID, acp.PermissionAnswer{})
641 }641 }
642 }642 }
643+ for formID, pending := range m.forms {
644+ if pending.channel == ch {
645+ m.resolveForm(formID, acp.FormAnswer{Action: acp.FormCancel})
646+ }
647+ }
643 // An agent that streams is asked to stop (session/cancel); one that is648 // An agent that streams is asked to stop (session/cancel); one that is
644 // still waited for, or starting, is given up.649 // still waited for, or starting, is given up.
645 var stops []func()650 var stops []func()
@@ -679,6 +684,31 @@ func (m *Manager) AnswerPermission(id, optionID string) error {
679 return fmt.Errorf("permission request %s has no option %s", id, optionID)684 return fmt.Errorf("permission request %s has no option %s", id, optionID)
680 }685 }
681 686
687+// AnswerForm gives the user's answer to a form: action accept (with the
688+// values by field name), decline or cancel.
689+func (m *Manager) AnswerForm(id string, answer acp.FormAnswer) error {
690+ m.mu.Lock()
691+ defer m.mu.Unlock()
692+ if _, ok := m.forms[id]; !ok {
693+ return fmt.Errorf("no form %s waits", id)
694+ }
695+ switch answer.Action {
696+ case acp.FormAccept, acp.FormDecline, acp.FormCancel:
697+ default:
698+ return fmt.Errorf("unknown form action %q", answer.Action)
699+ }
700+ m.resolveForm(id, answer)
701+ return nil
702+}
703+
704+// resolveForm answers a pending form. The caller holds m.mu.
705+func (m *Manager) resolveForm(id string, answer acp.FormAnswer) {
706+ pending := m.forms[id]
707+ delete(m.forms, id)
708+ pending.answer <- answer
709+ m.emitter.Emit(events.FormResolved, FormResolvedPayload{ID: id, Channel: pending.channel.info.ID})
710+}
711+
682 // resolve answers a pending request. The caller holds m.mu.712 // resolve answers a pending request. The caller holds m.mu.
683 func (m *Manager) resolve(id string, answer acp.PermissionAnswer) {713 func (m *Manager) resolve(id string, answer acp.PermissionAnswer) {
684 pending := m.permissions[id]714 pending := m.permissions[id]
@@ -805,6 +835,36 @@ func (h *handler) RequestPermission(ctx context.Context, request acp.PermissionR
805 }835 }
806 }836 }
807 837
838+// RequestForm shows the form the agent asks (issue #95: mini-me's ask_user)
839+// in the channel, attached to the answer being written, and waits for the
840+// user's answer; Stop or the end of the turn cancels it.
841+func (h *handler) RequestForm(ctx context.Context, form acp.Form) acp.FormAnswer {
842+ m, ch := h.manager, h.channel
843+ m.mu.Lock()
844+ m.sequence++
845+ id := fmt.Sprintf("f-%d", m.sequence)
846+ pending := &pendingForm{channel: ch, answer: make(chan acp.FormAnswer, 1)}
847+ pending.request = FormRequest{ID: id, Channel: ch.info.ID, Agent: h.agent, Form: form}
848+ if message := ch.current[h.agent]; message != nil {
849+ pending.request.MessageID = message.ID
850+ }
851+ m.forms[id] = pending
852+ m.emitter.Emit(events.FormRequested, pending.request)
853+ m.mu.Unlock()
854+
855+ select {
856+ case answer := <-pending.answer:
857+ return answer
858+ case <-ctx.Done():
859+ m.mu.Lock()
860+ if _, waiting := m.forms[id]; waiting {
861+ m.resolveForm(id, acp.FormAnswer{Action: acp.FormCancel})
862+ }
863+ m.mu.Unlock()
864+ return acp.FormAnswer{Action: acp.FormCancel}
865+ }
866+}
867+
808 func toolIndex(message *Message, id string) int {868 func toolIndex(message *Message, id string) int {
809 for i, part := range message.Parts {869 for i, part := range message.Parts {
810 if part.Kind == PartTool && part.Tool.ID == id {870 if part.Kind == PartTool && part.Tool.ID == id {
modified internal/config/config.go +11 -3
@@ -37,6 +37,9 @@ const (
3737 DefaultStopIdleAgentsAfter = 10 * time.Minute
3838 DefaultMaxAgentHandoffs = 3
3939 RuntimeLocal = "local"
40+ // DefaultAgentsFolder is where the mini-me creation assistant puts the
41+ // agents' folders (issue #94): the Documents folder of the user.
42+ DefaultAgentsFolder = "~/Documents"
4043 )
4144
4245 // Config is a loaded configuration: defaults applied and paths absolute.
@@ -48,8 +51,11 @@ type Config struct {
4851 Limits Limits
4952 // AgentTools says which tools Sidekicks offers the agents (issues #90 and #91).
5053 AgentTools AgentTools
51- Agents []Agent
52- Channels []Channel
54+ // AgentsFolder is the absolute folder where the mini-me creation
55+ // assistant creates one folder per agent (issue #94).
56+ AgentsFolder string
57+ Agents []Agent
58+ Channels []Channel
5359 // Warnings are problems that do not prevent using the configuration,
5460 // such as an agent command that cannot be found yet.
5561 Warnings []Problem
@@ -359,7 +365,8 @@ type rawConfig struct {
359365 Enabled *bool `yaml:"enabled"`
360366 Offer *[]string `yaml:"offer"`
361367 } `yaml:"agentTools"`
362- Agents []struct {
368+ AgentsFolder string `yaml:"agentsFolder"`
369+ Agents []struct {
363370 Name string `yaml:"name"`
364371 Title string `yaml:"title"`
365372 Icon string `yaml:"icon"`
@@ -400,6 +407,7 @@ func (raw *rawConfig) toConfig(baseDir string) *Config {
400407 MaxAgentHandoffs: DefaultMaxAgentHandoffs,
401408 },
402409 }
410+ cfg.AgentsFolder = resolvePath(orDefault(raw.AgentsFolder, DefaultAgentsFolder), baseDir)
403411 cfg.AgentTools.Enabled = raw.AgentTools.Enabled == nil || *raw.AgentTools.Enabled
404412 if raw.AgentTools.Offer != nil {
405413 cfg.AgentTools.Offer = append([]string{}, *raw.AgentTools.Offer...)
@@ -37,6 +37,9 @@ const (
37 DefaultStopIdleAgentsAfter = 10 * time.Minute37 DefaultStopIdleAgentsAfter = 10 * time.Minute
38 DefaultMaxAgentHandoffs = 338 DefaultMaxAgentHandoffs = 3
39 RuntimeLocal = "local"39 RuntimeLocal = "local"
40+ // DefaultAgentsFolder is where the mini-me creation assistant puts the
41+ // agents' folders (issue #94): the Documents folder of the user.
42+ DefaultAgentsFolder = "~/Documents"
40 )43 )
41 44
42 // Config is a loaded configuration: defaults applied and paths absolute.45 // Config is a loaded configuration: defaults applied and paths absolute.
@@ -48,8 +51,11 @@ type Config struct {
48 Limits Limits51 Limits Limits
49 // AgentTools says which tools Sidekicks offers the agents (issues #90 and #91).52 // AgentTools says which tools Sidekicks offers the agents (issues #90 and #91).
50 AgentTools AgentTools53 AgentTools AgentTools
51- Agents []Agent54+ // AgentsFolder is the absolute folder where the mini-me creation
52- Channels []Channel55+ // assistant creates one folder per agent (issue #94).
56+ AgentsFolder string
57+ Agents []Agent
58+ Channels []Channel
53 // Warnings are problems that do not prevent using the configuration,59 // Warnings are problems that do not prevent using the configuration,
54 // such as an agent command that cannot be found yet.60 // such as an agent command that cannot be found yet.
55 Warnings []Problem61 Warnings []Problem
@@ -359,7 +365,8 @@ type rawConfig struct {
359 Enabled *bool `yaml:"enabled"`365 Enabled *bool `yaml:"enabled"`
360 Offer *[]string `yaml:"offer"`366 Offer *[]string `yaml:"offer"`
361 } `yaml:"agentTools"`367 } `yaml:"agentTools"`
362- Agents []struct {368+ AgentsFolder string `yaml:"agentsFolder"`
369+ Agents []struct {
363 Name string `yaml:"name"`370 Name string `yaml:"name"`
364 Title string `yaml:"title"`371 Title string `yaml:"title"`
365 Icon string `yaml:"icon"`372 Icon string `yaml:"icon"`
@@ -400,6 +407,7 @@ func (raw *rawConfig) toConfig(baseDir string) *Config {
400 MaxAgentHandoffs: DefaultMaxAgentHandoffs,407 MaxAgentHandoffs: DefaultMaxAgentHandoffs,
401 },408 },
402 }409 }
410+ cfg.AgentsFolder = resolvePath(orDefault(raw.AgentsFolder, DefaultAgentsFolder), baseDir)
403 cfg.AgentTools.Enabled = raw.AgentTools.Enabled == nil || *raw.AgentTools.Enabled411 cfg.AgentTools.Enabled = raw.AgentTools.Enabled == nil || *raw.AgentTools.Enabled
404 if raw.AgentTools.Offer != nil {412 if raw.AgentTools.Offer != nil {
405 cfg.AgentTools.Offer = append([]string{}, *raw.AgentTools.Offer...)413 cfg.AgentTools.Offer = append([]string{}, *raw.AgentTools.Offer...)
modified internal/config/config_test.go +22 -0
@@ -613,3 +613,25 @@ func TestAnUnknownToolIsOnlyAWarning(t *testing.T) {
613613 t.Fatal("enabled is a boolean")
614614 }
615615 }
616+
617+func TestTheAgentsFolderIsTheDocumentsFolderByDefault(t *testing.T) {
618+ home, _ := os.UserHomeDir()
619+ cases := []struct{ yaml, want string }{
620+ {"", filepath.Join(home, "Documents")},
621+ {"agentsFolder: ~/agents\n", filepath.Join(home, "agents")},
622+ {"agentsFolder: /srv/agents\n", "/srv/agents"},
623+ {"agentsFolder: ../agents\n", "/home/me/agents"},
624+ }
625+ for _, c := range cases {
626+ cfg, err := parse(t, "version: 1\n"+c.yaml+"agents: []\n")
627+ if err != nil {
628+ t.Fatalf("%q: %v", c.yaml, err)
629+ }
630+ if cfg.AgentsFolder != c.want {
631+ t.Errorf("%q: agents folder %q, want %q", c.yaml, cfg.AgentsFolder, c.want)
632+ }
633+ }
634+ if _, err := parse(t, "version: 1\nagentsFolder: \"\"\nagents: []\n"); err == nil {
635+ t.Error("an empty agentsFolder must be refused")
636+ }
637+}
@@ -613,3 +613,25 @@ func TestAnUnknownToolIsOnlyAWarning(t *testing.T) {
613 t.Fatal("enabled is a boolean")613 t.Fatal("enabled is a boolean")
614 }614 }
615 }615 }
616+
617+func TestTheAgentsFolderIsTheDocumentsFolderByDefault(t *testing.T) {
618+ home, _ := os.UserHomeDir()
619+ cases := []struct{ yaml, want string }{
620+ {"", filepath.Join(home, "Documents")},
621+ {"agentsFolder: ~/agents\n", filepath.Join(home, "agents")},
622+ {"agentsFolder: /srv/agents\n", "/srv/agents"},
623+ {"agentsFolder: ../agents\n", "/home/me/agents"},
624+ }
625+ for _, c := range cases {
626+ cfg, err := parse(t, "version: 1\n"+c.yaml+"agents: []\n")
627+ if err != nil {
628+ t.Fatalf("%q: %v", c.yaml, err)
629+ }
630+ if cfg.AgentsFolder != c.want {
631+ t.Errorf("%q: agents folder %q, want %q", c.yaml, cfg.AgentsFolder, c.want)
632+ }
633+ }
634+ if _, err := parse(t, "version: 1\nagentsFolder: \"\"\nagents: []\n"); err == nil {
635+ t.Error("an empty agentsFolder must be refused")
636+ }
637+}
modified internal/config/default.go +4 -0
@@ -36,6 +36,10 @@ limits:
3636 agentTools:
3737 enabled: true
3838
39+# Where the "Create a mini-me agent" assistant makes one folder per agent.
40+# Default: your Documents folder.
41+# agentsFolder: ~/Documents
42+
3943 # The agents: call them in a conversation by clicking their name.
4044 # The simplest way to add one is the "Add an agent" button of Sidekicks.
4145 agents: []
@@ -36,6 +36,10 @@ limits:
36 agentTools:36 agentTools:
37 enabled: true37 enabled: true
38 38
39+# Where the "Create a mini-me agent" assistant makes one folder per agent.
40+# Default: your Documents folder.
41+# agentsFolder: ~/Documents
42+
39 # The agents: call them in a conversation by clicking their name.43 # The agents: call them in a conversation by clicking their name.
40 # The simplest way to add one is the "Add an agent" button of Sidekicks.44 # The simplest way to add one is the "Add an agent" button of Sidekicks.
41 agents: []45 agents: []
modified internal/config/problems.go +1 -1
@@ -290,7 +290,7 @@ func allowedKeys(path []string) []string {
290290 parent := path[:len(path)-1]
291291 switch {
292292 case len(parent) == 0:
293- return []string{"version", "ui", "limits", "agents", "channels"}
293+ return []string{"version", "ui", "limits", "agentTools", "agentsFolder", "agents", "channels"}
294294 case parent[0] == "ui":
295295 return []string{"theme", "language"}
296296 case parent[0] == "limits":
@@ -290,7 +290,7 @@ func allowedKeys(path []string) []string {
290 parent := path[:len(path)-1]290 parent := path[:len(path)-1]
291 switch {291 switch {
292 case len(parent) == 0:292 case len(parent) == 0:
293- return []string{"version", "ui", "limits", "agents", "channels"}293+ return []string{"version", "ui", "limits", "agentTools", "agentsFolder", "agents", "channels"}
294 case parent[0] == "ui":294 case parent[0] == "ui":
295 return []string{"theme", "language"}295 return []string{"theme", "language"}
296 case parent[0] == "limits":296 case parent[0] == "limits":
added internal/creator/creator.go +555 -0
new file mode 100644
@@ -0,0 +1,555 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// Package creator creates a mini-me agent without a terminal (issue #94):
4+// Sidekicks is the ACP client of `mm --acp-create --project yes`, the wizard
5+// of `mm init` served over ACP (mini-me 1.0.9 and later), and shows its
6+// questions as forms (ACP elicitation).
7+//
8+// An agent is a folder. Its name is only known near the end of the wizard,
9+// so the wizard works in a temporary folder of the agents' folder, renamed
10+// after the agent by Finish; Finish then asks mm for the files of a
11+// container (/dockerinit) or of a Docker Sandbox (/sbxinit) when the agent
12+// runs in one.
13+//
14+// session, err := creator.Start(ctx, creator.Options{AgentsFolder: "/Users/me/Documents"})
15+// view, err := session.Begin(ctx) // the first form
16+// view, err = session.Answer(ctx, answer) // … until view.Written
17+// result, err := session.Finish(ctx, "bob", creator.Local)
18+package creator
19+
20+import (
21+ "context"
22+ "errors"
23+ "fmt"
24+ "os"
25+ "os/exec"
26+ "path/filepath"
27+ "regexp"
28+ "strconv"
29+ "strings"
30+ "sync"
31+ "time"
32+
33+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
34+ "go.yaml.in/yaml/v3"
35+)
36+
37+// MinVersion is the first mini-me with `mm --acp-create`.
38+var MinVersion = [3]int{1, 0, 9}
39+
40+// Where the created agent runs.
41+const (
42+ Local = "local"
43+ Container = "container"
44+ Sandbox = "sbx"
45+)
46+
47+// AgentFile is where mm writes the agent in its folder: the .mm layout is
48+// imposed (--project yes).
49+var AgentFile = filepath.Join(".mm", "agent.yaml")
50+
51+// wizardArguments start mm's wizard with the .mm layout imposed and its
52+// file fixed: neither question is asked.
53+var wizardArguments = []string{"--acp-create", "--project", "yes", "--output", AgentFile}
54+
55+// tempPrefix starts the name of the temporary folder of a wizard.
56+const tempPrefix = ".sidekicks-new-agent-"
57+
58+var (
59+ // ErrMiniMeMissing is returned when mm is not installed (not found in PATH).
60+ ErrMiniMeMissing = errors.New("mini-me (mm) is not installed")
61+ // ErrFolderExists is returned when a folder already has the agent's name.
62+ ErrFolderExists = errors.New("a folder with this name already exists")
63+ // ErrBusy is returned while a question waits for its answer.
64+ ErrBusy = errors.New("the assistant is waiting for an answer")
65+ // ErrNotWritten is returned by Finish before the wizard wrote the agent.
66+ ErrNotWritten = errors.New("the agent is not written yet")
67+ // ErrInvalidName is returned for a name that cannot be both a folder and an agent name.
68+ ErrInvalidName = errors.New("invalid agent name")
69+ // ErrClosed is returned once the session is closed.
70+ ErrClosed = errors.New("the assistant is closed")
71+)
72+
73+// TooOldError is returned when the installed mm has no --acp-create.
74+type TooOldError struct {
75+ Found string
76+}
77+
78+func (e *TooOldError) Error() string {
79+ return fmt.Sprintf("mini-me (mm) %s is too old: version %d.%d.%d or later is needed", e.Found, MinVersion[0], MinVersion[1], MinVersion[2])
80+}
81+
82+// Options tunes Start.
83+type Options struct {
84+ // Command is mm's program; "" looks mm up in PATH.
85+ Command string
86+ // AgentsFolder is the folder where the agent's folder is created; it is
87+ // created when missing.
88+ AgentsFolder string
89+ // OnStderr receives what mm writes on its standard error.
90+ OnStderr func(line string)
91+ // Env is added to mm's environment (the tests' fake mm).
92+ Env map[string]string
93+}
94+
95+// View is what the interface shows after each step: the messages mm sent
96+// since the last step, the form waiting for an answer (nil when none), and
97+// the agent once it is written.
98+type View struct {
99+ Messages []string `json:"messages"`
100+ Form *acp.Form `json:"form"`
101+ // Written: .mm/agent.yaml exists; Name and Title are mm's.
102+ Written bool `json:"written"`
103+ Name string `json:"name"`
104+ Title string `json:"title"`
105+}
106+
107+// Result is a created agent, ready to be added to the configuration.
108+type Result struct {
109+ // Folder is the agent's folder, AgentFile its .mm/agent.yaml (absolute).
110+ Folder string
111+ AgentFile string
112+ Title string
113+ // Environment is Local, Container or Sandbox; the compose.yaml or the
114+ // sbxenv.yaml mm wrote for the last two is in Folder.
115+ Environment string
116+ // Messages are what mm said while writing those files.
117+ Messages []string
118+}
119+
120+// Version runs `mm --version` (options.Command, options.Env) and checks that it is MinVersion or later. A
121+// version mm cannot tell ("unknown", a development build) is accepted: only
122+// a known old version is refused.
123+func Version(ctx context.Context, options Options) (string, error) {
124+ program, err := program(options.Command)
125+ if err != nil {
126+ return "", err
127+ }
128+ ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
129+ defer cancel()
130+ command := exec.CommandContext(ctx, program, "--version")
131+ command.Env = os.Environ()
132+ for key, value := range options.Env {
133+ command.Env = append(command.Env, key+"="+value)
134+ }
135+ output, err := command.Output()
136+ if err != nil {
137+ return "", fmt.Errorf("mm --version: %w", err)
138+ }
139+ found := strings.TrimSpace(string(output))
140+ version, ok := parseVersion(found)
141+ if !ok {
142+ return found, nil
143+ }
144+ if older(version, MinVersion) {
145+ return found, &TooOldError{Found: fmt.Sprintf("%d.%d.%d", version[0], version[1], version[2])}
146+ }
147+ return found, nil
148+}
149+
150+func program(command string) (string, error) {
151+ if command == "" {
152+ command = "mm"
153+ }
154+ path, err := exec.LookPath(command)
155+ if err != nil {
156+ return "", ErrMiniMeMissing
157+ }
158+ return path, nil
159+}
160+
161+var versionPattern = regexp.MustCompile(`(\d+)\.(\d+)\.(\d+)`)
162+
163+// parseVersion reads the first x.y.z of `mm --version` ("mm v1.0.9 (go1.27…)").
164+func parseVersion(text string) ([3]int, bool) {
165+ match := versionPattern.FindStringSubmatch(text)
166+ if match == nil {
167+ return [3]int{}, false
168+ }
169+ var version [3]int
170+ for index := range version {
171+ version[index], _ = strconv.Atoi(match[index+1])
172+ }
173+ return version, true
174+}
175+
176+func older(version, than [3]int) bool {
177+ for index := range version {
178+ if version[index] != than[index] {
179+ return version[index] < than[index]
180+ }
181+ }
182+ return false
183+}
184+
185+// namePattern is the agent names of the configuration, which are folder
186+// names too.
187+var namePattern = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,31}$`)
188+
189+// NameOf turns mm's agent name into a name Sidekicks accepts: lowercase,
190+// letters, digits, '-' and '_', starting with a letter, 32 characters at
191+// most; "" when nothing is left.
192+//
193+// NameOf("Bob the Builder") // "bob-the-builder"
194+func NameOf(text string) string {
195+ var b strings.Builder
196+ dash := false
197+ for _, r := range strings.ToLower(strings.TrimSpace(text)) {
198+ switch {
199+ case r >= 'a' && r <= 'z', r >= '0' && r <= '9', r == '_':
200+ b.WriteRune(r)
201+ dash = false
202+ case b.Len() > 0 && !dash:
203+ b.WriteRune('-')
204+ dash = true
205+ }
206+ }
207+ name := strings.TrimLeft(strings.Trim(b.String(), "-"), "0123456789_-")
208+ if len(name) > 32 {
209+ name = strings.TrimRight(name[:32], "-")
210+ }
211+ return name
212+}
213+
214+// ValidName reports whether name is an agent name Sidekicks accepts.
215+func ValidName(name string) bool { return namePattern.MatchString(name) }
216+
217+// Session is one wizard: mm --acp-create running in a temporary folder.
218+type Session struct {
219+ options Options
220+ program string
221+ folder string // the agents' folder
222+ dir string // the temporary folder, then the agent's folder
223+ conn *acp.Conn
224+ id string
225+
226+ mu sync.Mutex
227+ messages []string
228+ pending *pendingForm
229+ turn chan error // the end of the turn in flight; nil when none
230+ forms chan struct{}
231+ finished bool
232+ closed bool
233+}
234+
235+type pendingForm struct {
236+ form acp.Form
237+ reply chan acp.FormAnswer
238+}
239+
240+// Start checks mm, creates the temporary folder in the agents' folder and
241+// starts mm --acp-create --project yes --output .mm/agent.yaml there, with a session open.
242+func Start(ctx context.Context, options Options) (*Session, error) {
243+ program, err := program(options.Command)
244+ if err != nil {
245+ return nil, err
246+ }
247+ if options.AgentsFolder == "" {
248+ return nil, errors.New("no agents folder")
249+ }
250+ if err := os.MkdirAll(options.AgentsFolder, 0o755); err != nil {
251+ return nil, err
252+ }
253+ removeStale(options.AgentsFolder, time.Now().Add(-24*time.Hour))
254+ dir, err := os.MkdirTemp(options.AgentsFolder, tempPrefix)
255+ if err != nil {
256+ return nil, err
257+ }
258+ s := &Session{options: options, program: program, folder: options.AgentsFolder, dir: dir, forms: make(chan struct{}, 1)}
259+ if err := s.open(ctx, wizardArguments); err != nil {
260+ _ = os.RemoveAll(dir)
261+ return nil, err
262+ }
263+ return s, nil
264+}
265+
266+// removeStale removes the temporary folders of wizards older than before:
267+// those of a Sidekicks that stopped in the middle of one.
268+func removeStale(folder string, before time.Time) {
269+ entries, _ := os.ReadDir(folder)
270+ for _, entry := range entries {
271+ if !entry.IsDir() || !strings.HasPrefix(entry.Name(), tempPrefix) {
272+ continue
273+ }
274+ if info, err := entry.Info(); err == nil && info.ModTime().Before(before) {
275+ _ = os.RemoveAll(filepath.Join(folder, entry.Name()))
276+ }
277+ }
278+}
279+
280+// open starts mm in s.dir with arguments and opens a session there.
281+func (s *Session) open(ctx context.Context, arguments []string) error {
282+ conn, err := acp.Start(ctx, acp.Spec{
283+ Name: "mm-acp-create", Command: s.program, Args: arguments, Dir: s.dir, Env: s.options.Env, OnForm: s.onForm,
284+ }, acp.Options{OnStderr: s.options.OnStderr})
285+ if err != nil {
286+ return err
287+ }
288+ id, err := conn.NewSession(ctx, s.dir, handler{s})
289+ if err != nil {
290+ _ = conn.Close(context.Background())
291+ return err
292+ }
293+ s.mu.Lock()
294+ s.conn, s.id = conn, id
295+ s.mu.Unlock()
296+ return nil
297+}
298+
299+// Begin sends /start: the wizard asks its first questions.
300+func (s *Session) Begin(ctx context.Context) (View, error) { return s.Send(ctx, "/start") }
301+
302+// Send sends text as a message (an answer when mm asks without a form, or
303+// one of its commands: /back, /restart…) and waits for the next form or
304+// for the end of mm's answer.
305+func (s *Session) Send(ctx context.Context, text string) (View, error) {
306+ s.mu.Lock()
307+ finished := s.finished
308+ s.mu.Unlock()
309+ if finished {
310+ return View{}, ErrClosed
311+ }
312+ return s.send(ctx, text)
313+}
314+
315+// send starts a turn with text and waits like Send.
316+func (s *Session) send(ctx context.Context, text string) (View, error) {
317+ s.mu.Lock()
318+ switch {
319+ case s.closed:
320+ s.mu.Unlock()
321+ return View{}, ErrClosed
322+ case s.turn != nil:
323+ s.mu.Unlock()
324+ return View{}, ErrBusy
325+ }
326+ turn := make(chan error, 1)
327+ s.turn = turn
328+ conn, id := s.conn, s.id
329+ s.mu.Unlock()
330+ go func() {
331+ _, err := conn.Prompt(context.WithoutCancel(ctx), id, text)
332+ turn <- err
333+ }()
334+ return s.wait(ctx)
335+}
336+
337+// Answer answers the form waiting (accept with values, decline or cancel)
338+// and waits for the next form or for the end of mm's answer.
339+func (s *Session) Answer(ctx context.Context, answer acp.FormAnswer) (View, error) {
340+ s.mu.Lock()
341+ pending := s.pending
342+ s.pending = nil
343+ s.mu.Unlock()
344+ if pending == nil {
345+ return s.View(), nil
346+ }
347+ pending.reply <- answer
348+ return s.wait(ctx)
349+}
350+
351+// wait returns once a form waits for an answer, the turn is over, or mm
352+// stopped.
353+func (s *Session) wait(ctx context.Context) (View, error) {
354+ s.mu.Lock()
355+ turn, conn := s.turn, s.conn
356+ s.mu.Unlock()
357+ if turn == nil {
358+ return s.View(), nil
359+ }
360+ select {
361+ case <-s.forms:
362+ return s.View(), nil
363+ case err := <-turn:
364+ s.mu.Lock()
365+ s.turn = nil
366+ s.mu.Unlock()
367+ return s.View(), err
368+ case <-conn.Done():
369+ return s.View(), conn.Err()
370+ case <-ctx.Done():
371+ return s.View(), ctx.Err()
372+ }
373+}
374+
375+// View is the state now: the messages not shown yet, the form waiting,
376+// and the agent if it is written.
377+func (s *Session) View() View {
378+ s.mu.Lock()
379+ view := View{Messages: s.messages}
380+ s.messages = nil
381+ if s.pending != nil {
382+ form := s.pending.form
383+ view.Form = &form
384+ }
385+ dir := s.dir
386+ s.mu.Unlock()
387+ if view.Messages == nil {
388+ view.Messages = []string{}
389+ }
390+ if name, title, ok := readAgent(filepath.Join(dir, AgentFile)); ok {
391+ view.Written, view.Name, view.Title = true, NameOf(name), title
392+ }
393+ return view
394+}
395+
396+// onForm is called by acp for each form mm asks: it waits for Answer.
397+func (s *Session) onForm(ctx context.Context, form acp.Form) acp.FormAnswer {
398+ pending := &pendingForm{form: form, reply: make(chan acp.FormAnswer, 1)}
399+ s.mu.Lock()
400+ if s.closed {
401+ s.mu.Unlock()
402+ return acp.FormAnswer{Action: acp.FormCancel}
403+ }
404+ s.pending = pending
405+ s.mu.Unlock()
406+ select {
407+ case s.forms <- struct{}{}:
408+ default:
409+ }
410+ select {
411+ case answer := <-pending.reply:
412+ return answer
413+ case <-ctx.Done():
414+ return acp.FormAnswer{Action: acp.FormCancel}
415+ }
416+}
417+
418+// handler keeps what mm says. Each message of mm's wizard comes whole, in
419+// one chunk.
420+type handler struct{ s *Session }
421+
422+func (h handler) Update(update acp.Update) {
423+ if update.Kind != acp.UpdateMessage || strings.TrimSpace(update.Text) == "" {
424+ return
425+ }
426+ h.s.mu.Lock()
427+ h.s.messages = append(h.s.messages, update.Text)
428+ h.s.mu.Unlock()
429+}
430+
431+func (handler) RequestPermission(context.Context, acp.PermissionRequest) acp.PermissionAnswer {
432+ return acp.PermissionAnswer{}
433+}
434+
435+// readAgent reads acp.name and acp.title of the agent file mm wrote.
436+func readAgent(path string) (name, title string, ok bool) {
437+ content, err := os.ReadFile(path)
438+ if err != nil {
439+ return "", "", false
440+ }
441+ var file struct {
442+ ACP struct {
443+ Name string `yaml:"name"`
444+ Title string `yaml:"title"`
445+ } `yaml:"acp"`
446+ }
447+ _ = yaml.Unmarshal(content, &file)
448+ return file.ACP.Name, file.ACP.Title, true
449+}
450+
451+// Finish ends the wizard: the temporary folder becomes the agent's folder,
452+// named name in the agents' folder, then, for a container or a sandbox, mm
453+// writes its compose.yaml (/dockerinit) or its sbxenv.yaml (/sbxinit) there.
454+// A folder that already has this name is never touched: ErrFolderExists,
455+// and another name can be tried.
456+func (s *Session) Finish(ctx context.Context, name, environment string) (Result, error) {
457+ if !ValidName(name) {
458+ return Result{}, ErrInvalidName
459+ }
460+ view := s.View()
461+ if !view.Written {
462+ return Result{}, ErrNotWritten
463+ }
464+ target := filepath.Join(s.folder, name)
465+ if _, err := os.Lstat(target); err == nil {
466+ return Result{}, ErrFolderExists
467+ }
468+ s.mu.Lock()
469+ if s.closed || s.finished {
470+ s.mu.Unlock()
471+ return Result{}, ErrClosed
472+ }
473+ if s.turn != nil {
474+ s.mu.Unlock()
475+ return Result{}, ErrBusy
476+ }
477+ s.finished = true
478+ conn := s.conn
479+ s.mu.Unlock()
480+ _ = conn.Close(ctx)
481+ if err := os.Rename(s.dir, target); err != nil {
482+ s.mu.Lock()
483+ s.finished = false
484+ s.mu.Unlock()
485+ _ = s.open(ctx, wizardArguments)
486+ return Result{}, err
487+ }
488+ // MkdirTemp made it private (0700): an agent's folder is an ordinary one.
489+ _ = os.Chmod(target, 0o755)
490+ s.mu.Lock()
491+ s.dir = target
492+ s.mu.Unlock()
493+ result := Result{Folder: target, AgentFile: filepath.Join(target, AgentFile), Title: view.Title, Environment: environment}
494+ switch environment {
495+ case Local:
496+ return result, nil
497+ case Container:
498+ return s.scaffold(ctx, result, "/dockerinit", "compose.yaml")
499+ case Sandbox:
500+ return s.scaffold(ctx, result, "/sbxinit", "sbxenv.yaml")
501+ }
502+ return result, fmt.Errorf("unknown environment %q", environment)
503+}
504+
505+// scaffold asks mm, started again in the agent's folder, for command, and
506+// checks that it wrote file.
507+func (s *Session) scaffold(ctx context.Context, result Result, command, file string) (Result, error) {
508+ if err := s.open(ctx, []string{"--acp-create"}); err != nil {
509+ return result, err
510+ }
511+ defer func() { _ = s.conn.Close(context.Background()) }()
512+ view, err := s.send(ctx, command)
513+ // Only the command's report: mm's welcome may come before it.
514+ if len(view.Messages) > 0 {
515+ result.Messages = view.Messages[len(view.Messages)-1:]
516+ }
517+ if err != nil {
518+ return result, err
519+ }
520+ if _, err := os.Stat(filepath.Join(result.Folder, file)); err != nil {
521+ return result, fmt.Errorf("mm did not write %s: %s", file, strings.Join(view.Messages, "\n"))
522+ }
523+ return result, nil
524+}
525+
526+// Close stops mm. Before Finish, the temporary folder is removed with what
527+// the wizard wrote in it.
528+func (s *Session) Close() {
529+ s.mu.Lock()
530+ if s.closed {
531+ s.mu.Unlock()
532+ return
533+ }
534+ s.closed = true
535+ pending, conn, finished, dir := s.pending, s.conn, s.finished, s.dir
536+ s.pending = nil
537+ s.mu.Unlock()
538+ if pending != nil {
539+ pending.reply <- acp.FormAnswer{Action: acp.FormCancel}
540+ }
541+ if conn != nil {
542+ _ = conn.Close(context.Background())
543+ }
544+ if !finished && strings.HasPrefix(filepath.Base(dir), tempPrefix) {
545+ _ = os.RemoveAll(dir)
546+ }
547+}
548+
549+// Folder is the folder the wizard writes in: the temporary one, then the
550+// agent's.
551+func (s *Session) Folder() string {
552+ s.mu.Lock()
553+ defer s.mu.Unlock()
554+ return s.dir
555+}
new file mode 100644
@@ -0,0 +1,555 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// Package creator creates a mini-me agent without a terminal (issue #94):
4+// Sidekicks is the ACP client of `mm --acp-create --project yes`, the wizard
5+// of `mm init` served over ACP (mini-me 1.0.9 and later), and shows its
6+// questions as forms (ACP elicitation).
7+//
8+// An agent is a folder. Its name is only known near the end of the wizard,
9+// so the wizard works in a temporary folder of the agents' folder, renamed
10+// after the agent by Finish; Finish then asks mm for the files of a
11+// container (/dockerinit) or of a Docker Sandbox (/sbxinit) when the agent
12+// runs in one.
13+//
14+// session, err := creator.Start(ctx, creator.Options{AgentsFolder: "/Users/me/Documents"})
15+// view, err := session.Begin(ctx) // the first form
16+// view, err = session.Answer(ctx, answer) // … until view.Written
17+// result, err := session.Finish(ctx, "bob", creator.Local)
18+package creator
19+
20+import (
21+ "context"
22+ "errors"
23+ "fmt"
24+ "os"
25+ "os/exec"
26+ "path/filepath"
27+ "regexp"
28+ "strconv"
29+ "strings"
30+ "sync"
31+ "time"
32+
33+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
34+ "go.yaml.in/yaml/v3"
35+)
36+
37+// MinVersion is the first mini-me with `mm --acp-create`.
38+var MinVersion = [3]int{1, 0, 9}
39+
40+// Where the created agent runs.
41+const (
42+ Local = "local"
43+ Container = "container"
44+ Sandbox = "sbx"
45+)
46+
47+// AgentFile is where mm writes the agent in its folder: the .mm layout is
48+// imposed (--project yes).
49+var AgentFile = filepath.Join(".mm", "agent.yaml")
50+
51+// wizardArguments start mm's wizard with the .mm layout imposed and its
52+// file fixed: neither question is asked.
53+var wizardArguments = []string{"--acp-create", "--project", "yes", "--output", AgentFile}
54+
55+// tempPrefix starts the name of the temporary folder of a wizard.
56+const tempPrefix = ".sidekicks-new-agent-"
57+
58+var (
59+ // ErrMiniMeMissing is returned when mm is not installed (not found in PATH).
60+ ErrMiniMeMissing = errors.New("mini-me (mm) is not installed")
61+ // ErrFolderExists is returned when a folder already has the agent's name.
62+ ErrFolderExists = errors.New("a folder with this name already exists")
63+ // ErrBusy is returned while a question waits for its answer.
64+ ErrBusy = errors.New("the assistant is waiting for an answer")
65+ // ErrNotWritten is returned by Finish before the wizard wrote the agent.
66+ ErrNotWritten = errors.New("the agent is not written yet")
67+ // ErrInvalidName is returned for a name that cannot be both a folder and an agent name.
68+ ErrInvalidName = errors.New("invalid agent name")
69+ // ErrClosed is returned once the session is closed.
70+ ErrClosed = errors.New("the assistant is closed")
71+)
72+
73+// TooOldError is returned when the installed mm has no --acp-create.
74+type TooOldError struct {
75+ Found string
76+}
77+
78+func (e *TooOldError) Error() string {
79+ return fmt.Sprintf("mini-me (mm) %s is too old: version %d.%d.%d or later is needed", e.Found, MinVersion[0], MinVersion[1], MinVersion[2])
80+}
81+
82+// Options tunes Start.
83+type Options struct {
84+ // Command is mm's program; "" looks mm up in PATH.
85+ Command string
86+ // AgentsFolder is the folder where the agent's folder is created; it is
87+ // created when missing.
88+ AgentsFolder string
89+ // OnStderr receives what mm writes on its standard error.
90+ OnStderr func(line string)
91+ // Env is added to mm's environment (the tests' fake mm).
92+ Env map[string]string
93+}
94+
95+// View is what the interface shows after each step: the messages mm sent
96+// since the last step, the form waiting for an answer (nil when none), and
97+// the agent once it is written.
98+type View struct {
99+ Messages []string `json:"messages"`
100+ Form *acp.Form `json:"form"`
101+ // Written: .mm/agent.yaml exists; Name and Title are mm's.
102+ Written bool `json:"written"`
103+ Name string `json:"name"`
104+ Title string `json:"title"`
105+}
106+
107+// Result is a created agent, ready to be added to the configuration.
108+type Result struct {
109+ // Folder is the agent's folder, AgentFile its .mm/agent.yaml (absolute).
110+ Folder string
111+ AgentFile string
112+ Title string
113+ // Environment is Local, Container or Sandbox; the compose.yaml or the
114+ // sbxenv.yaml mm wrote for the last two is in Folder.
115+ Environment string
116+ // Messages are what mm said while writing those files.
117+ Messages []string
118+}
119+
120+// Version runs `mm --version` (options.Command, options.Env) and checks that it is MinVersion or later. A
121+// version mm cannot tell ("unknown", a development build) is accepted: only
122+// a known old version is refused.
123+func Version(ctx context.Context, options Options) (string, error) {
124+ program, err := program(options.Command)
125+ if err != nil {
126+ return "", err
127+ }
128+ ctx, cancel := context.WithTimeout(ctx, 15*time.Second)
129+ defer cancel()
130+ command := exec.CommandContext(ctx, program, "--version")
131+ command.Env = os.Environ()
132+ for key, value := range options.Env {
133+ command.Env = append(command.Env, key+"="+value)
134+ }
135+ output, err := command.Output()
136+ if err != nil {
137+ return "", fmt.Errorf("mm --version: %w", err)
138+ }
139+ found := strings.TrimSpace(string(output))
140+ version, ok := parseVersion(found)
141+ if !ok {
142+ return found, nil
143+ }
144+ if older(version, MinVersion) {
145+ return found, &TooOldError{Found: fmt.Sprintf("%d.%d.%d", version[0], version[1], version[2])}
146+ }
147+ return found, nil
148+}
149+
150+func program(command string) (string, error) {
151+ if command == "" {
152+ command = "mm"
153+ }
154+ path, err := exec.LookPath(command)
155+ if err != nil {
156+ return "", ErrMiniMeMissing
157+ }
158+ return path, nil
159+}
160+
161+var versionPattern = regexp.MustCompile(`(\d+)\.(\d+)\.(\d+)`)
162+
163+// parseVersion reads the first x.y.z of `mm --version` ("mm v1.0.9 (go1.27…)").
164+func parseVersion(text string) ([3]int, bool) {
165+ match := versionPattern.FindStringSubmatch(text)
166+ if match == nil {
167+ return [3]int{}, false
168+ }
169+ var version [3]int
170+ for index := range version {
171+ version[index], _ = strconv.Atoi(match[index+1])
172+ }
173+ return version, true
174+}
175+
176+func older(version, than [3]int) bool {
177+ for index := range version {
178+ if version[index] != than[index] {
179+ return version[index] < than[index]
180+ }
181+ }
182+ return false
183+}
184+
185+// namePattern is the agent names of the configuration, which are folder
186+// names too.
187+var namePattern = regexp.MustCompile(`^[a-z][a-z0-9_-]{0,31}$`)
188+
189+// NameOf turns mm's agent name into a name Sidekicks accepts: lowercase,
190+// letters, digits, '-' and '_', starting with a letter, 32 characters at
191+// most; "" when nothing is left.
192+//
193+// NameOf("Bob the Builder") // "bob-the-builder"
194+func NameOf(text string) string {
195+ var b strings.Builder
196+ dash := false
197+ for _, r := range strings.ToLower(strings.TrimSpace(text)) {
198+ switch {
199+ case r >= 'a' && r <= 'z', r >= '0' && r <= '9', r == '_':
200+ b.WriteRune(r)
201+ dash = false
202+ case b.Len() > 0 && !dash:
203+ b.WriteRune('-')
204+ dash = true
205+ }
206+ }
207+ name := strings.TrimLeft(strings.Trim(b.String(), "-"), "0123456789_-")
208+ if len(name) > 32 {
209+ name = strings.TrimRight(name[:32], "-")
210+ }
211+ return name
212+}
213+
214+// ValidName reports whether name is an agent name Sidekicks accepts.
215+func ValidName(name string) bool { return namePattern.MatchString(name) }
216+
217+// Session is one wizard: mm --acp-create running in a temporary folder.
218+type Session struct {
219+ options Options
220+ program string
221+ folder string // the agents' folder
222+ dir string // the temporary folder, then the agent's folder
223+ conn *acp.Conn
224+ id string
225+
226+ mu sync.Mutex
227+ messages []string
228+ pending *pendingForm
229+ turn chan error // the end of the turn in flight; nil when none
230+ forms chan struct{}
231+ finished bool
232+ closed bool
233+}
234+
235+type pendingForm struct {
236+ form acp.Form
237+ reply chan acp.FormAnswer
238+}
239+
240+// Start checks mm, creates the temporary folder in the agents' folder and
241+// starts mm --acp-create --project yes --output .mm/agent.yaml there, with a session open.
242+func Start(ctx context.Context, options Options) (*Session, error) {
243+ program, err := program(options.Command)
244+ if err != nil {
245+ return nil, err
246+ }
247+ if options.AgentsFolder == "" {
248+ return nil, errors.New("no agents folder")
249+ }
250+ if err := os.MkdirAll(options.AgentsFolder, 0o755); err != nil {
251+ return nil, err
252+ }
253+ removeStale(options.AgentsFolder, time.Now().Add(-24*time.Hour))
254+ dir, err := os.MkdirTemp(options.AgentsFolder, tempPrefix)
255+ if err != nil {
256+ return nil, err
257+ }
258+ s := &Session{options: options, program: program, folder: options.AgentsFolder, dir: dir, forms: make(chan struct{}, 1)}
259+ if err := s.open(ctx, wizardArguments); err != nil {
260+ _ = os.RemoveAll(dir)
261+ return nil, err
262+ }
263+ return s, nil
264+}
265+
266+// removeStale removes the temporary folders of wizards older than before:
267+// those of a Sidekicks that stopped in the middle of one.
268+func removeStale(folder string, before time.Time) {
269+ entries, _ := os.ReadDir(folder)
270+ for _, entry := range entries {
271+ if !entry.IsDir() || !strings.HasPrefix(entry.Name(), tempPrefix) {
272+ continue
273+ }
274+ if info, err := entry.Info(); err == nil && info.ModTime().Before(before) {
275+ _ = os.RemoveAll(filepath.Join(folder, entry.Name()))
276+ }
277+ }
278+}
279+
280+// open starts mm in s.dir with arguments and opens a session there.
281+func (s *Session) open(ctx context.Context, arguments []string) error {
282+ conn, err := acp.Start(ctx, acp.Spec{
283+ Name: "mm-acp-create", Command: s.program, Args: arguments, Dir: s.dir, Env: s.options.Env, OnForm: s.onForm,
284+ }, acp.Options{OnStderr: s.options.OnStderr})
285+ if err != nil {
286+ return err
287+ }
288+ id, err := conn.NewSession(ctx, s.dir, handler{s})
289+ if err != nil {
290+ _ = conn.Close(context.Background())
291+ return err
292+ }
293+ s.mu.Lock()
294+ s.conn, s.id = conn, id
295+ s.mu.Unlock()
296+ return nil
297+}
298+
299+// Begin sends /start: the wizard asks its first questions.
300+func (s *Session) Begin(ctx context.Context) (View, error) { return s.Send(ctx, "/start") }
301+
302+// Send sends text as a message (an answer when mm asks without a form, or
303+// one of its commands: /back, /restart…) and waits for the next form or
304+// for the end of mm's answer.
305+func (s *Session) Send(ctx context.Context, text string) (View, error) {
306+ s.mu.Lock()
307+ finished := s.finished
308+ s.mu.Unlock()
309+ if finished {
310+ return View{}, ErrClosed
311+ }
312+ return s.send(ctx, text)
313+}
314+
315+// send starts a turn with text and waits like Send.
316+func (s *Session) send(ctx context.Context, text string) (View, error) {
317+ s.mu.Lock()
318+ switch {
319+ case s.closed:
320+ s.mu.Unlock()
321+ return View{}, ErrClosed
322+ case s.turn != nil:
323+ s.mu.Unlock()
324+ return View{}, ErrBusy
325+ }
326+ turn := make(chan error, 1)
327+ s.turn = turn
328+ conn, id := s.conn, s.id
329+ s.mu.Unlock()
330+ go func() {
331+ _, err := conn.Prompt(context.WithoutCancel(ctx), id, text)
332+ turn <- err
333+ }()
334+ return s.wait(ctx)
335+}
336+
337+// Answer answers the form waiting (accept with values, decline or cancel)
338+// and waits for the next form or for the end of mm's answer.
339+func (s *Session) Answer(ctx context.Context, answer acp.FormAnswer) (View, error) {
340+ s.mu.Lock()
341+ pending := s.pending
342+ s.pending = nil
343+ s.mu.Unlock()
344+ if pending == nil {
345+ return s.View(), nil
346+ }
347+ pending.reply <- answer
348+ return s.wait(ctx)
349+}
350+
351+// wait returns once a form waits for an answer, the turn is over, or mm
352+// stopped.
353+func (s *Session) wait(ctx context.Context) (View, error) {
354+ s.mu.Lock()
355+ turn, conn := s.turn, s.conn
356+ s.mu.Unlock()
357+ if turn == nil {
358+ return s.View(), nil
359+ }
360+ select {
361+ case <-s.forms:
362+ return s.View(), nil
363+ case err := <-turn:
364+ s.mu.Lock()
365+ s.turn = nil
366+ s.mu.Unlock()
367+ return s.View(), err
368+ case <-conn.Done():
369+ return s.View(), conn.Err()
370+ case <-ctx.Done():
371+ return s.View(), ctx.Err()
372+ }
373+}
374+
375+// View is the state now: the messages not shown yet, the form waiting,
376+// and the agent if it is written.
377+func (s *Session) View() View {
378+ s.mu.Lock()
379+ view := View{Messages: s.messages}
380+ s.messages = nil
381+ if s.pending != nil {
382+ form := s.pending.form
383+ view.Form = &form
384+ }
385+ dir := s.dir
386+ s.mu.Unlock()
387+ if view.Messages == nil {
388+ view.Messages = []string{}
389+ }
390+ if name, title, ok := readAgent(filepath.Join(dir, AgentFile)); ok {
391+ view.Written, view.Name, view.Title = true, NameOf(name), title
392+ }
393+ return view
394+}
395+
396+// onForm is called by acp for each form mm asks: it waits for Answer.
397+func (s *Session) onForm(ctx context.Context, form acp.Form) acp.FormAnswer {
398+ pending := &pendingForm{form: form, reply: make(chan acp.FormAnswer, 1)}
399+ s.mu.Lock()
400+ if s.closed {
401+ s.mu.Unlock()
402+ return acp.FormAnswer{Action: acp.FormCancel}
403+ }
404+ s.pending = pending
405+ s.mu.Unlock()
406+ select {
407+ case s.forms <- struct{}{}:
408+ default:
409+ }
410+ select {
411+ case answer := <-pending.reply:
412+ return answer
413+ case <-ctx.Done():
414+ return acp.FormAnswer{Action: acp.FormCancel}
415+ }
416+}
417+
418+// handler keeps what mm says. Each message of mm's wizard comes whole, in
419+// one chunk.
420+type handler struct{ s *Session }
421+
422+func (h handler) Update(update acp.Update) {
423+ if update.Kind != acp.UpdateMessage || strings.TrimSpace(update.Text) == "" {
424+ return
425+ }
426+ h.s.mu.Lock()
427+ h.s.messages = append(h.s.messages, update.Text)
428+ h.s.mu.Unlock()
429+}
430+
431+func (handler) RequestPermission(context.Context, acp.PermissionRequest) acp.PermissionAnswer {
432+ return acp.PermissionAnswer{}
433+}
434+
435+// readAgent reads acp.name and acp.title of the agent file mm wrote.
436+func readAgent(path string) (name, title string, ok bool) {
437+ content, err := os.ReadFile(path)
438+ if err != nil {
439+ return "", "", false
440+ }
441+ var file struct {
442+ ACP struct {
443+ Name string `yaml:"name"`
444+ Title string `yaml:"title"`
445+ } `yaml:"acp"`
446+ }
447+ _ = yaml.Unmarshal(content, &file)
448+ return file.ACP.Name, file.ACP.Title, true
449+}
450+
451+// Finish ends the wizard: the temporary folder becomes the agent's folder,
452+// named name in the agents' folder, then, for a container or a sandbox, mm
453+// writes its compose.yaml (/dockerinit) or its sbxenv.yaml (/sbxinit) there.
454+// A folder that already has this name is never touched: ErrFolderExists,
455+// and another name can be tried.
456+func (s *Session) Finish(ctx context.Context, name, environment string) (Result, error) {
457+ if !ValidName(name) {
458+ return Result{}, ErrInvalidName
459+ }
460+ view := s.View()
461+ if !view.Written {
462+ return Result{}, ErrNotWritten
463+ }
464+ target := filepath.Join(s.folder, name)
465+ if _, err := os.Lstat(target); err == nil {
466+ return Result{}, ErrFolderExists
467+ }
468+ s.mu.Lock()
469+ if s.closed || s.finished {
470+ s.mu.Unlock()
471+ return Result{}, ErrClosed
472+ }
473+ if s.turn != nil {
474+ s.mu.Unlock()
475+ return Result{}, ErrBusy
476+ }
477+ s.finished = true
478+ conn := s.conn
479+ s.mu.Unlock()
480+ _ = conn.Close(ctx)
481+ if err := os.Rename(s.dir, target); err != nil {
482+ s.mu.Lock()
483+ s.finished = false
484+ s.mu.Unlock()
485+ _ = s.open(ctx, wizardArguments)
486+ return Result{}, err
487+ }
488+ // MkdirTemp made it private (0700): an agent's folder is an ordinary one.
489+ _ = os.Chmod(target, 0o755)
490+ s.mu.Lock()
491+ s.dir = target
492+ s.mu.Unlock()
493+ result := Result{Folder: target, AgentFile: filepath.Join(target, AgentFile), Title: view.Title, Environment: environment}
494+ switch environment {
495+ case Local:
496+ return result, nil
497+ case Container:
498+ return s.scaffold(ctx, result, "/dockerinit", "compose.yaml")
499+ case Sandbox:
500+ return s.scaffold(ctx, result, "/sbxinit", "sbxenv.yaml")
501+ }
502+ return result, fmt.Errorf("unknown environment %q", environment)
503+}
504+
505+// scaffold asks mm, started again in the agent's folder, for command, and
506+// checks that it wrote file.
507+func (s *Session) scaffold(ctx context.Context, result Result, command, file string) (Result, error) {
508+ if err := s.open(ctx, []string{"--acp-create"}); err != nil {
509+ return result, err
510+ }
511+ defer func() { _ = s.conn.Close(context.Background()) }()
512+ view, err := s.send(ctx, command)
513+ // Only the command's report: mm's welcome may come before it.
514+ if len(view.Messages) > 0 {
515+ result.Messages = view.Messages[len(view.Messages)-1:]
516+ }
517+ if err != nil {
518+ return result, err
519+ }
520+ if _, err := os.Stat(filepath.Join(result.Folder, file)); err != nil {
521+ return result, fmt.Errorf("mm did not write %s: %s", file, strings.Join(view.Messages, "\n"))
522+ }
523+ return result, nil
524+}
525+
526+// Close stops mm. Before Finish, the temporary folder is removed with what
527+// the wizard wrote in it.
528+func (s *Session) Close() {
529+ s.mu.Lock()
530+ if s.closed {
531+ s.mu.Unlock()
532+ return
533+ }
534+ s.closed = true
535+ pending, conn, finished, dir := s.pending, s.conn, s.finished, s.dir
536+ s.pending = nil
537+ s.mu.Unlock()
538+ if pending != nil {
539+ pending.reply <- acp.FormAnswer{Action: acp.FormCancel}
540+ }
541+ if conn != nil {
542+ _ = conn.Close(context.Background())
543+ }
544+ if !finished && strings.HasPrefix(filepath.Base(dir), tempPrefix) {
545+ _ = os.RemoveAll(dir)
546+ }
547+}
548+
549+// Folder is the folder the wizard writes in: the temporary one, then the
550+// agent's.
551+func (s *Session) Folder() string {
552+ s.mu.Lock()
553+ defer s.mu.Unlock()
554+ return s.dir
555+}
added internal/creator/creator_realagents_test.go +87 -0
new file mode 100644
@@ -0,0 +1,87 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+//go:build realagents
4+
5+package creator_test
6+
7+import (
8+ "context"
9+ "os"
10+ "path/filepath"
11+ "strings"
12+ "testing"
13+ "time"
14+
15+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
17+)
18+
19+// The real mm (MM_BIN, else mm in PATH), 1.0.9 or later. No model server is
20+// needed: without one, mm asks the model as text and the test types one.
21+func realOptions(t *testing.T) creator.Options {
22+ t.Helper()
23+ options := creator.Options{Command: os.Getenv("MM_BIN"), AgentsFolder: filepath.Join(t.TempDir(), "Documents")}
24+ if _, err := creator.Version(context.Background(), options); err != nil {
25+ t.Skip("mm 1.0.9 or later is needed:", err)
26+ }
27+ return options
28+}
29+
30+// fillIn answers a form the way a user taking every default would; a text
31+// field without a default gets a value of its own (the model, the name).
32+func fillIn(form *acp.Form, name string) acp.FormAnswer {
33+ content := map[string]any{}
34+ for _, field := range form.Fields {
35+ switch {
36+ case field.Name == "name":
37+ content[field.Name] = name
38+ case field.Default != nil:
39+ content[field.Name] = field.Default
40+ case field.Type == acp.FieldBoolean:
41+ content[field.Name] = false
42+ case len(field.Options) > 0:
43+ content[field.Name] = field.Options[0]
44+ default:
45+ content[field.Name] = "test-model"
46+ }
47+ }
48+ return acp.FormAnswer{Action: acp.FormAccept, Content: content}
49+}
50+
51+func TestRealMMCreatesAnAgentInEachEnvironment(t *testing.T) {
52+ for _, environment := range []string{creator.Local, creator.Container, creator.Sandbox} {
53+ options := realOptions(t)
54+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
55+ session, err := creator.Start(ctx, options)
56+ if err != nil {
57+ t.Fatal(err)
58+ }
59+ view, err := session.Begin(ctx)
60+ var asked []string
61+ for err == nil && view.Form != nil {
62+ for _, field := range view.Form.Fields {
63+ asked = append(asked, field.Name)
64+ }
65+ view, err = session.Answer(ctx, fillIn(view.Form, "Scout"))
66+ }
67+ if err != nil || !view.Written {
68+ t.Fatalf("%s: not written (%v): %q", environment, err, view.Messages)
69+ }
70+ if strings.Contains(" "+strings.Join(asked, " ")+" ", " project ") || strings.Contains(" "+strings.Join(asked, " ")+" ", " file ") {
71+ t.Fatalf("the .mm and file questions must not be asked: %v", asked)
72+ }
73+ if view.Name != "scout" {
74+ t.Fatalf("name %q, title %q", view.Name, view.Title)
75+ }
76+ result, err := session.Finish(ctx, view.Name, environment)
77+ if err != nil {
78+ t.Fatalf("%s: %v %q", environment, err, result.Messages)
79+ }
80+ if _, err := os.Stat(result.AgentFile); err != nil || result.AgentFile != filepath.Join(options.AgentsFolder, "scout", ".mm", "agent.yaml") {
81+ t.Fatalf("%s: %+v", environment, result)
82+ }
83+ t.Logf("%s: asked %v, title %q, messages %q", environment, asked, result.Title, result.Messages)
84+ session.Close()
85+ cancel()
86+ }
87+}
new file mode 100644
@@ -0,0 +1,87 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+//go:build realagents
4+
5+package creator_test
6+
7+import (
8+ "context"
9+ "os"
10+ "path/filepath"
11+ "strings"
12+ "testing"
13+ "time"
14+
15+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
17+)
18+
19+// The real mm (MM_BIN, else mm in PATH), 1.0.9 or later. No model server is
20+// needed: without one, mm asks the model as text and the test types one.
21+func realOptions(t *testing.T) creator.Options {
22+ t.Helper()
23+ options := creator.Options{Command: os.Getenv("MM_BIN"), AgentsFolder: filepath.Join(t.TempDir(), "Documents")}
24+ if _, err := creator.Version(context.Background(), options); err != nil {
25+ t.Skip("mm 1.0.9 or later is needed:", err)
26+ }
27+ return options
28+}
29+
30+// fillIn answers a form the way a user taking every default would; a text
31+// field without a default gets a value of its own (the model, the name).
32+func fillIn(form *acp.Form, name string) acp.FormAnswer {
33+ content := map[string]any{}
34+ for _, field := range form.Fields {
35+ switch {
36+ case field.Name == "name":
37+ content[field.Name] = name
38+ case field.Default != nil:
39+ content[field.Name] = field.Default
40+ case field.Type == acp.FieldBoolean:
41+ content[field.Name] = false
42+ case len(field.Options) > 0:
43+ content[field.Name] = field.Options[0]
44+ default:
45+ content[field.Name] = "test-model"
46+ }
47+ }
48+ return acp.FormAnswer{Action: acp.FormAccept, Content: content}
49+}
50+
51+func TestRealMMCreatesAnAgentInEachEnvironment(t *testing.T) {
52+ for _, environment := range []string{creator.Local, creator.Container, creator.Sandbox} {
53+ options := realOptions(t)
54+ ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
55+ session, err := creator.Start(ctx, options)
56+ if err != nil {
57+ t.Fatal(err)
58+ }
59+ view, err := session.Begin(ctx)
60+ var asked []string
61+ for err == nil && view.Form != nil {
62+ for _, field := range view.Form.Fields {
63+ asked = append(asked, field.Name)
64+ }
65+ view, err = session.Answer(ctx, fillIn(view.Form, "Scout"))
66+ }
67+ if err != nil || !view.Written {
68+ t.Fatalf("%s: not written (%v): %q", environment, err, view.Messages)
69+ }
70+ if strings.Contains(" "+strings.Join(asked, " ")+" ", " project ") || strings.Contains(" "+strings.Join(asked, " ")+" ", " file ") {
71+ t.Fatalf("the .mm and file questions must not be asked: %v", asked)
72+ }
73+ if view.Name != "scout" {
74+ t.Fatalf("name %q, title %q", view.Name, view.Title)
75+ }
76+ result, err := session.Finish(ctx, view.Name, environment)
77+ if err != nil {
78+ t.Fatalf("%s: %v %q", environment, err, result.Messages)
79+ }
80+ if _, err := os.Stat(result.AgentFile); err != nil || result.AgentFile != filepath.Join(options.AgentsFolder, "scout", ".mm", "agent.yaml") {
81+ t.Fatalf("%s: %+v", environment, result)
82+ }
83+ t.Logf("%s: asked %v, title %q, messages %q", environment, asked, result.Title, result.Messages)
84+ session.Close()
85+ cancel()
86+ }
87+}
added internal/creator/creator_test.go +246 -0
new file mode 100644
@@ -0,0 +1,246 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package creator_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "os"
9+ "path/filepath"
10+ "strings"
11+ "testing"
12+ "time"
13+
14+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
15+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
17+)
18+
19+// The test binary doubles as a fake mm (creatortest).
20+func TestMain(m *testing.M) {
21+ creatortest.RunIfFake()
22+ os.Exit(m.Run())
23+}
24+
25+func fakeMM(t *testing.T, version string) creator.Options {
26+ t.Helper()
27+ command, env := creatortest.Fake(t, version)
28+ return creator.Options{Command: command, AgentsFolder: filepath.Join(t.TempDir(), "Documents"), Env: env}
29+}
30+
31+func TestTheVersionMustBe109OrLater(t *testing.T) {
32+ cases := []struct {
33+ version string
34+ tooOld bool
35+ }{
36+ {"mm v1.0.9 (go1.27.2, darwin/arm64)", false},
37+ {"mm v1.2.0 (go1.27.2, darwin/arm64)", false},
38+ {"mm v2.0.0", false},
39+ {"mm 1.0.8 (go1.27.2, darwin/arm64)", true},
40+ {"mm v0.9.12", true},
41+ {"mm unknown (go1.27.2, linux/arm64)", false},
42+ }
43+ for _, c := range cases {
44+ options := fakeMM(t, c.version)
45+ found, err := creator.Version(context.Background(), options)
46+ var tooOld *creator.TooOldError
47+ if errors.As(err, &tooOld) != c.tooOld {
48+ t.Errorf("%q: error %v", c.version, err)
49+ }
50+ if found != c.version {
51+ t.Errorf("%q: found %q", c.version, found)
52+ }
53+ }
54+}
55+
56+func TestAMissingMMIsReported(t *testing.T) {
57+ if _, err := creator.Version(context.Background(), creator.Options{Command: "mm-that-does-not-exist"}); !errors.Is(err, creator.ErrMiniMeMissing) {
58+ t.Fatalf("Version: %v", err)
59+ }
60+ if _, err := creator.Start(context.Background(), creator.Options{Command: "mm-that-does-not-exist", AgentsFolder: t.TempDir()}); !errors.Is(err, creator.ErrMiniMeMissing) {
61+ t.Fatalf("Start: %v", err)
62+ }
63+}
64+
65+func TestNameOf(t *testing.T) {
66+ cases := map[string]string{
67+ "bob": "bob", "Bob the Builder": "bob-the-builder", " Élise ": "lise", "42 robots": "robots",
68+ "a_b-c": "a_b-c", "!!!": "", strings.Repeat("x", 40): strings.Repeat("x", 32),
69+ }
70+ for text, want := range cases {
71+ if got := creator.NameOf(text); got != want {
72+ t.Errorf("NameOf(%q) = %q, want %q", text, got, want)
73+ }
74+ }
75+}
76+
77+// begin starts a wizard and answers its form with name.
78+func begin(t *testing.T, options creator.Options, name string) *creator.Session {
79+ t.Helper()
80+ session, err := creator.Start(context.Background(), options)
81+ if err != nil {
82+ t.Fatal(err)
83+ }
84+ t.Cleanup(session.Close)
85+ view, err := session.Begin(context.Background())
86+ if err != nil {
87+ t.Fatal(err)
88+ }
89+ if view.Form == nil || len(view.Form.Fields) != 2 || view.Form.Fields[0].Name != "provider" || view.Form.Fields[1].Name != "name" {
90+ t.Fatalf("first view: %+v", view)
91+ }
92+ if len(view.Messages) == 0 || !strings.Contains(strings.Join(view.Messages, "\n"), "args=--acp-create --project yes --output .mm/agent.yaml") {
93+ t.Fatalf("messages: %q", view.Messages)
94+ }
95+ view, err = session.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}})
96+ if err != nil {
97+ t.Fatal(err)
98+ }
99+ if !view.Written || view.Form != nil {
100+ t.Fatalf("after the form: %+v", view)
101+ }
102+ return session
103+}
104+
105+func TestTheWizardWritesInATemporaryFolderThenFinishRenamesIt(t *testing.T) {
106+ options := fakeMM(t, "mm v1.0.9")
107+ session := begin(t, options, "Bob")
108+ temporary := session.Folder()
109+ if filepath.Dir(temporary) != options.AgentsFolder || !strings.HasPrefix(filepath.Base(temporary), ".sidekicks-new-agent-") {
110+ t.Fatalf("temporary folder %s", temporary)
111+ }
112+ view := session.View()
113+ if view.Name != "bob" || view.Title != "Bob (developer)" {
114+ t.Fatalf("agent: %+v", view)
115+ }
116+ result, err := session.Finish(context.Background(), "bob", creator.Local)
117+ if err != nil {
118+ t.Fatal(err)
119+ }
120+ folder := filepath.Join(options.AgentsFolder, "bob")
121+ if result.Folder != folder || result.AgentFile != filepath.Join(folder, ".mm", "agent.yaml") || result.Title != "Bob (developer)" {
122+ t.Fatalf("result: %+v", result)
123+ }
124+ if _, err := os.Stat(result.AgentFile); err != nil {
125+ t.Fatal(err)
126+ }
127+ if info, err := os.Stat(folder); err != nil || info.Mode().Perm() != 0o755 {
128+ t.Fatalf("the agent's folder should be an ordinary one (0755): %v %v", info.Mode(), err)
129+ }
130+ if _, err := os.Stat(temporary); !os.IsNotExist(err) {
131+ t.Fatalf("the temporary folder is still there: %v", err)
132+ }
133+ session.Close()
134+ if _, err := os.Stat(result.AgentFile); err != nil {
135+ t.Fatal("Close after Finish must keep the agent")
136+ }
137+}
138+
139+func TestAnExistingFolderIsNeverTouched(t *testing.T) {
140+ options := fakeMM(t, "mm v1.0.9")
141+ session := begin(t, options, "bob")
142+ taken := filepath.Join(options.AgentsFolder, "bob")
143+ if err := os.MkdirAll(taken, 0o755); err != nil {
144+ t.Fatal(err)
145+ }
146+ if _, err := session.Finish(context.Background(), "bob", creator.Local); !errors.Is(err, creator.ErrFolderExists) {
147+ t.Fatalf("Finish: %v", err)
148+ }
149+ if entries, _ := os.ReadDir(taken); len(entries) != 0 {
150+ t.Fatal("the existing folder was changed")
151+ }
152+ if _, err := session.Finish(context.Background(), "Bob Two", creator.Local); !errors.Is(err, creator.ErrInvalidName) {
153+ t.Fatalf("an invalid name: %v", err)
154+ }
155+ result, err := session.Finish(context.Background(), "bob-2", creator.Local)
156+ if err != nil || result.Folder != filepath.Join(options.AgentsFolder, "bob-2") {
157+ t.Fatalf("another name: %+v %v", result, err)
158+ }
159+}
160+
161+func TestAContainerOrASandboxGetsItsFilesFromMM(t *testing.T) {
162+ for environment, file := range map[string]string{creator.Container: "compose.yaml", creator.Sandbox: "sbxenv.yaml"} {
163+ options := fakeMM(t, "mm v1.0.9")
164+ session := begin(t, options, "bob")
165+ result, err := session.Finish(context.Background(), "bob", environment)
166+ if err != nil {
167+ t.Fatalf("%s: %v", environment, err)
168+ }
169+ if _, err := os.Stat(filepath.Join(result.Folder, file)); err != nil {
170+ t.Fatalf("%s: %v", environment, err)
171+ }
172+ if result.Environment != environment || len(result.Messages) != 1 || !strings.Contains(result.Messages[0], "wrote "+file) {
173+ t.Fatalf("%s: %+v", environment, result)
174+ }
175+ }
176+}
177+
178+func TestCloseBeforeFinishRemovesTheTemporaryFolder(t *testing.T) {
179+ options := fakeMM(t, "mm v1.0.9")
180+ session, err := creator.Start(context.Background(), options)
181+ if err != nil {
182+ t.Fatal(err)
183+ }
184+ if _, err := session.Begin(context.Background()); err != nil {
185+ t.Fatal(err)
186+ }
187+ // A form is waiting: Close cancels it and stops mm.
188+ temporary := session.Folder()
189+ session.Close()
190+ if _, err := os.Stat(temporary); !os.IsNotExist(err) {
191+ t.Fatalf("the temporary folder is still there: %v", err)
192+ }
193+ if _, err := session.Send(context.Background(), "hello"); !errors.Is(err, creator.ErrClosed) {
194+ t.Fatalf("Send after Close: %v", err)
195+ }
196+}
197+
198+func TestADeclinedFormEndsTheTurnWithMMsMessage(t *testing.T) {
199+ session, err := creator.Start(context.Background(), fakeMM(t, "mm v1.0.9"))
200+ if err != nil {
201+ t.Fatal(err)
202+ }
203+ defer session.Close()
204+ if _, err := session.Begin(context.Background()); err != nil {
205+ t.Fatal(err)
206+ }
207+ if _, err := session.Send(context.Background(), "/back"); !errors.Is(err, creator.ErrBusy) {
208+ t.Fatalf("Send while a form waits: %v", err)
209+ }
210+ view, err := session.Answer(context.Background(), acp.FormAnswer{Action: acp.FormDecline})
211+ if err != nil {
212+ t.Fatal(err)
213+ }
214+ if view.Form != nil || view.Written || len(view.Messages) != 1 || !strings.HasPrefix(view.Messages[0], "Stopped") {
215+ t.Fatalf("view: %+v", view)
216+ }
217+ if _, err := session.Finish(context.Background(), "bob", creator.Local); !errors.Is(err, creator.ErrNotWritten) {
218+ t.Fatalf("Finish before the agent is written: %v", err)
219+ }
220+}
221+
222+func TestStaleTemporaryFoldersAreRemoved(t *testing.T) {
223+ options := fakeMM(t, "mm v1.0.9")
224+ stale := filepath.Join(options.AgentsFolder, ".sidekicks-new-agent-old")
225+ recent := filepath.Join(options.AgentsFolder, ".sidekicks-new-agent-recent")
226+ for _, folder := range []string{stale, recent} {
227+ if err := os.MkdirAll(folder, 0o755); err != nil {
228+ t.Fatal(err)
229+ }
230+ }
231+ old := time.Now().Add(-48 * time.Hour)
232+ if err := os.Chtimes(stale, old, old); err != nil {
233+ t.Fatal(err)
234+ }
235+ session, err := creator.Start(context.Background(), options)
236+ if err != nil {
237+ t.Fatal(err)
238+ }
239+ defer session.Close()
240+ if _, err := os.Stat(stale); !os.IsNotExist(err) {
241+ t.Fatal("a folder left two days ago should be removed")
242+ }
243+ if _, err := os.Stat(recent); err != nil {
244+ t.Fatal("a recent folder may belong to another window: it stays")
245+ }
246+}
new file mode 100644
@@ -0,0 +1,246 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+package creator_test
4+
5+import (
6+ "context"
7+ "errors"
8+ "os"
9+ "path/filepath"
10+ "strings"
11+ "testing"
12+ "time"
13+
14+ "git.rickub.com/bots-garden/sidekicks/internal/acp"
15+ "git.rickub.com/bots-garden/sidekicks/internal/creator"
16+ "git.rickub.com/bots-garden/sidekicks/internal/creator/creatortest"
17+)
18+
19+// The test binary doubles as a fake mm (creatortest).
20+func TestMain(m *testing.M) {
21+ creatortest.RunIfFake()
22+ os.Exit(m.Run())
23+}
24+
25+func fakeMM(t *testing.T, version string) creator.Options {
26+ t.Helper()
27+ command, env := creatortest.Fake(t, version)
28+ return creator.Options{Command: command, AgentsFolder: filepath.Join(t.TempDir(), "Documents"), Env: env}
29+}
30+
31+func TestTheVersionMustBe109OrLater(t *testing.T) {
32+ cases := []struct {
33+ version string
34+ tooOld bool
35+ }{
36+ {"mm v1.0.9 (go1.27.2, darwin/arm64)", false},
37+ {"mm v1.2.0 (go1.27.2, darwin/arm64)", false},
38+ {"mm v2.0.0", false},
39+ {"mm 1.0.8 (go1.27.2, darwin/arm64)", true},
40+ {"mm v0.9.12", true},
41+ {"mm unknown (go1.27.2, linux/arm64)", false},
42+ }
43+ for _, c := range cases {
44+ options := fakeMM(t, c.version)
45+ found, err := creator.Version(context.Background(), options)
46+ var tooOld *creator.TooOldError
47+ if errors.As(err, &tooOld) != c.tooOld {
48+ t.Errorf("%q: error %v", c.version, err)
49+ }
50+ if found != c.version {
51+ t.Errorf("%q: found %q", c.version, found)
52+ }
53+ }
54+}
55+
56+func TestAMissingMMIsReported(t *testing.T) {
57+ if _, err := creator.Version(context.Background(), creator.Options{Command: "mm-that-does-not-exist"}); !errors.Is(err, creator.ErrMiniMeMissing) {
58+ t.Fatalf("Version: %v", err)
59+ }
60+ if _, err := creator.Start(context.Background(), creator.Options{Command: "mm-that-does-not-exist", AgentsFolder: t.TempDir()}); !errors.Is(err, creator.ErrMiniMeMissing) {
61+ t.Fatalf("Start: %v", err)
62+ }
63+}
64+
65+func TestNameOf(t *testing.T) {
66+ cases := map[string]string{
67+ "bob": "bob", "Bob the Builder": "bob-the-builder", " Élise ": "lise", "42 robots": "robots",
68+ "a_b-c": "a_b-c", "!!!": "", strings.Repeat("x", 40): strings.Repeat("x", 32),
69+ }
70+ for text, want := range cases {
71+ if got := creator.NameOf(text); got != want {
72+ t.Errorf("NameOf(%q) = %q, want %q", text, got, want)
73+ }
74+ }
75+}
76+
77+// begin starts a wizard and answers its form with name.
78+func begin(t *testing.T, options creator.Options, name string) *creator.Session {
79+ t.Helper()
80+ session, err := creator.Start(context.Background(), options)
81+ if err != nil {
82+ t.Fatal(err)
83+ }
84+ t.Cleanup(session.Close)
85+ view, err := session.Begin(context.Background())
86+ if err != nil {
87+ t.Fatal(err)
88+ }
89+ if view.Form == nil || len(view.Form.Fields) != 2 || view.Form.Fields[0].Name != "provider" || view.Form.Fields[1].Name != "name" {
90+ t.Fatalf("first view: %+v", view)
91+ }
92+ if len(view.Messages) == 0 || !strings.Contains(strings.Join(view.Messages, "\n"), "args=--acp-create --project yes --output .mm/agent.yaml") {
93+ t.Fatalf("messages: %q", view.Messages)
94+ }
95+ view, err = session.Answer(context.Background(), acp.FormAnswer{Action: acp.FormAccept, Content: map[string]any{"provider": "llmman", "name": name}})
96+ if err != nil {
97+ t.Fatal(err)
98+ }
99+ if !view.Written || view.Form != nil {
100+ t.Fatalf("after the form: %+v", view)
101+ }
102+ return session
103+}
104+
105+func TestTheWizardWritesInATemporaryFolderThenFinishRenamesIt(t *testing.T) {
106+ options := fakeMM(t, "mm v1.0.9")
107+ session := begin(t, options, "Bob")
108+ temporary := session.Folder()
109+ if filepath.Dir(temporary) != options.AgentsFolder || !strings.HasPrefix(filepath.Base(temporary), ".sidekicks-new-agent-") {
110+ t.Fatalf("temporary folder %s", temporary)
111+ }
112+ view := session.View()
113+ if view.Name != "bob" || view.Title != "Bob (developer)" {
114+ t.Fatalf("agent: %+v", view)
115+ }
116+ result, err := session.Finish(context.Background(), "bob", creator.Local)
117+ if err != nil {
118+ t.Fatal(err)
119+ }
120+ folder := filepath.Join(options.AgentsFolder, "bob")
121+ if result.Folder != folder || result.AgentFile != filepath.Join(folder, ".mm", "agent.yaml") || result.Title != "Bob (developer)" {
122+ t.Fatalf("result: %+v", result)
123+ }
124+ if _, err := os.Stat(result.AgentFile); err != nil {
125+ t.Fatal(err)
126+ }
127+ if info, err := os.Stat(folder); err != nil || info.Mode().Perm() != 0o755 {
128+ t.Fatalf("the agent's folder should be an ordinary one (0755): %v %v", info.Mode(), err)
129+ }
130+ if _, err := os.Stat(temporary); !os.IsNotExist(err) {
131+ t.Fatalf("the temporary folder is still there: %v", err)
132+ }
133+ session.Close()
134+ if _, err := os.Stat(result.AgentFile); err != nil {
135+ t.Fatal("Close after Finish must keep the agent")
136+ }
137+}
138+
139+func TestAnExistingFolderIsNeverTouched(t *testing.T) {
140+ options := fakeMM(t, "mm v1.0.9")
141+ session := begin(t, options, "bob")
142+ taken := filepath.Join(options.AgentsFolder, "bob")
143+ if err := os.MkdirAll(taken, 0o755); err != nil {
144+ t.Fatal(err)
145+ }
146+ if _, err := session.Finish(context.Background(), "bob", creator.Local); !errors.Is(err, creator.ErrFolderExists) {
147+ t.Fatalf("Finish: %v", err)
148+ }
149+ if entries, _ := os.ReadDir(taken); len(entries) != 0 {
150+ t.Fatal("the existing folder was changed")
151+ }
152+ if _, err := session.Finish(context.Background(), "Bob Two", creator.Local); !errors.Is(err, creator.ErrInvalidName) {
153+ t.Fatalf("an invalid name: %v", err)
154+ }
155+ result, err := session.Finish(context.Background(), "bob-2", creator.Local)
156+ if err != nil || result.Folder != filepath.Join(options.AgentsFolder, "bob-2") {
157+ t.Fatalf("another name: %+v %v", result, err)
158+ }
159+}
160+
161+func TestAContainerOrASandboxGetsItsFilesFromMM(t *testing.T) {
162+ for environment, file := range map[string]string{creator.Container: "compose.yaml", creator.Sandbox: "sbxenv.yaml"} {
163+ options := fakeMM(t, "mm v1.0.9")
164+ session := begin(t, options, "bob")
165+ result, err := session.Finish(context.Background(), "bob", environment)
166+ if err != nil {
167+ t.Fatalf("%s: %v", environment, err)
168+ }
169+ if _, err := os.Stat(filepath.Join(result.Folder, file)); err != nil {
170+ t.Fatalf("%s: %v", environment, err)
171+ }
172+ if result.Environment != environment || len(result.Messages) != 1 || !strings.Contains(result.Messages[0], "wrote "+file) {
173+ t.Fatalf("%s: %+v", environment, result)
174+ }
175+ }
176+}
177+
178+func TestCloseBeforeFinishRemovesTheTemporaryFolder(t *testing.T) {
179+ options := fakeMM(t, "mm v1.0.9")
180+ session, err := creator.Start(context.Background(), options)
181+ if err != nil {
182+ t.Fatal(err)
183+ }
184+ if _, err := session.Begin(context.Background()); err != nil {
185+ t.Fatal(err)
186+ }
187+ // A form is waiting: Close cancels it and stops mm.
188+ temporary := session.Folder()
189+ session.Close()
190+ if _, err := os.Stat(temporary); !os.IsNotExist(err) {
191+ t.Fatalf("the temporary folder is still there: %v", err)
192+ }
193+ if _, err := session.Send(context.Background(), "hello"); !errors.Is(err, creator.ErrClosed) {
194+ t.Fatalf("Send after Close: %v", err)
195+ }
196+}
197+
198+func TestADeclinedFormEndsTheTurnWithMMsMessage(t *testing.T) {
199+ session, err := creator.Start(context.Background(), fakeMM(t, "mm v1.0.9"))
200+ if err != nil {
201+ t.Fatal(err)
202+ }
203+ defer session.Close()
204+ if _, err := session.Begin(context.Background()); err != nil {
205+ t.Fatal(err)
206+ }
207+ if _, err := session.Send(context.Background(), "/back"); !errors.Is(err, creator.ErrBusy) {
208+ t.Fatalf("Send while a form waits: %v", err)
209+ }
210+ view, err := session.Answer(context.Background(), acp.FormAnswer{Action: acp.FormDecline})
211+ if err != nil {
212+ t.Fatal(err)
213+ }
214+ if view.Form != nil || view.Written || len(view.Messages) != 1 || !strings.HasPrefix(view.Messages[0], "Stopped") {
215+ t.Fatalf("view: %+v", view)
216+ }
217+ if _, err := session.Finish(context.Background(), "bob", creator.Local); !errors.Is(err, creator.ErrNotWritten) {
218+ t.Fatalf("Finish before the agent is written: %v", err)
219+ }
220+}
221+
222+func TestStaleTemporaryFoldersAreRemoved(t *testing.T) {
223+ options := fakeMM(t, "mm v1.0.9")
224+ stale := filepath.Join(options.AgentsFolder, ".sidekicks-new-agent-old")
225+ recent := filepath.Join(options.AgentsFolder, ".sidekicks-new-agent-recent")
226+ for _, folder := range []string{stale, recent} {
227+ if err := os.MkdirAll(folder, 0o755); err != nil {
228+ t.Fatal(err)
229+ }
230+ }
231+ old := time.Now().Add(-48 * time.Hour)
232+ if err := os.Chtimes(stale, old, old); err != nil {
233+ t.Fatal(err)
234+ }
235+ session, err := creator.Start(context.Background(), options)
236+ if err != nil {
237+ t.Fatal(err)
238+ }
239+ defer session.Close()
240+ if _, err := os.Stat(stale); !os.IsNotExist(err) {
241+ t.Fatal("a folder left two days ago should be removed")
242+ }
243+ if _, err := os.Stat(recent); err != nil {
244+ t.Fatal("a recent folder may belong to another window: it stays")
245+ }
246+}
added internal/creator/creatortest/creatortest.go +144 -0
new file mode 100644
@@ -0,0 +1,144 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// Package creatortest is a fake mm for the tests of the mini-me creation
4+// assistant (issue #94): a test binary that calls RunIfFake in its TestMain
5+// becomes, when Fake started it, an mm that answers --version and serves a
6+// short --acp-create wizard: one form (provider, name), then
7+// .mm/agent.yaml; /dockerinit and /sbxinit write their file.
8+package creatortest
9+
10+import (
11+ "context"
12+ "fmt"
13+ "os"
14+ "path/filepath"
15+ "strings"
16+ "testing"
17+
18+ sdk "github.com/coder/acp-go-sdk"
19+)
20+
21+const variable = "SIDEKICKS_FAKE_MM"
22+
23+// RunIfFake turns the test binary into the fake mm when Fake started it,
24+// and exits; otherwise it returns at once.
25+func RunIfFake() {
26+ if version := os.Getenv(variable); version != "" {
27+ runFakeMM(version, os.Args[1:])
28+ os.Exit(0)
29+ }
30+}
31+
32+// Fake copies the test binary to a folder of its own under the name mm, so
33+// that it is found by name like the real one, and returns its path and the
34+// environment that makes it the fake mm answering version to --version.
35+func Fake(t *testing.T, version string) (string, map[string]string) {
36+ t.Helper()
37+ self, err := os.Executable()
38+ if err != nil {
39+ t.Fatal(err)
40+ }
41+ content, err := os.ReadFile(self)
42+ if err != nil {
43+ t.Fatal(err)
44+ }
45+ command := filepath.Join(t.TempDir(), "mm")
46+ if err := os.WriteFile(command, content, 0o755); err != nil {
47+ t.Fatal(err)
48+ }
49+ return command, map[string]string{variable: version}
50+}
51+
52+func runFakeMM(version string, args []string) {
53+ if len(args) > 0 && args[0] == "--version" {
54+ fmt.Println(version)
55+ return
56+ }
57+ agent := &fakeAgent{args: strings.Join(args, " ")}
58+ agent.conn = sdk.NewAgentSideConnection(agent, os.Stdout, os.Stdin)
59+ <-agent.conn.Done()
60+}
61+
62+type fakeAgent struct {
63+ args string
64+ conn *sdk.AgentSideConnection
65+ cwd string
66+}
67+
68+func (*fakeAgent) Initialize(context.Context, sdk.InitializeRequest) (sdk.InitializeResponse, error) {
69+ return sdk.InitializeResponse{ProtocolVersion: 1, AgentInfo: &sdk.Implementation{Name: "mm-acp-create", Version: "1.0.9"}, AuthMethods: []sdk.AuthMethod{}}, nil
70+}
71+
72+func (a *fakeAgent) NewSession(_ context.Context, request sdk.NewSessionRequest) (sdk.NewSessionResponse, error) {
73+ a.cwd = request.Cwd
74+ return sdk.NewSessionResponse{SessionId: "create-1"}, nil
75+}
76+
77+// Prompt plays mm acp-create in short: /start asks one form (provider and
78+// name) and writes .mm/agent.yaml; /dockerinit and /sbxinit write their file.
79+func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.PromptResponse, error) {
80+ say := func(text string) {
81+ _ = a.conn.SessionUpdate(ctx, sdk.SessionNotification{SessionId: request.SessionId, Update: sdk.UpdateAgentMessageText(text)})
82+ }
83+ done := sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}
84+ switch text := request.Prompt[0].Text.Text; text {
85+ case "/dockerinit", "/sbxinit":
86+ file := map[string]string{"/dockerinit": "compose.yaml", "/sbxinit": "sbxenv.yaml"}[text]
87+ content := map[string]string{
88+ "/dockerinit": "services:\n bob:\n container_name: bob-box\n",
89+ "/sbxinit": "schemaVersion: \"1\"\nname: bob-sbx\nagent: mini-me-kit\nworkspace: .\n",
90+ }[text]
91+ _ = os.WriteFile(filepath.Join(a.cwd, file), []byte(content), 0o644)
92+ say("✅ wrote " + file)
93+ return done, nil
94+ }
95+ say("**mm init** — args=" + a.args)
96+ req := sdk.NewUnstableCreateElicitationRequestForm(sdk.UnstableElicitationSchema{
97+ Type: sdk.UnstableElicitationSchemaTypeObject,
98+ Properties: map[string]any{
99+ "provider": map[string]any{"type": "string", "title": "Model server?", "enum": []any{"llmman", "ollama"}, "default": "llmman"},
100+ "name": map[string]any{"type": "string", "title": "Agent name?", "default": "developer"},
101+ },
102+ Required: []string{"provider", "name"},
103+ })
104+ resp, err := a.conn.UnstableCreateElicitation(ctx, req)
105+ switch {
106+ case err != nil || resp.Cancel != nil:
107+ say("The form was closed: nothing written.")
108+ case resp.Decline != nil:
109+ say("Stopped: nothing written.")
110+ default:
111+ name := fmt.Sprint(resp.Accept.Content["name"])
112+ _ = os.MkdirAll(filepath.Join(a.cwd, ".mm"), 0o755)
113+ content := fmt.Sprintf("acp:\n name: %s\n title: %q\n", strings.ToLower(name), name+" (developer)")
114+ _ = os.WriteFile(filepath.Join(a.cwd, ".mm", "agent.yaml"), []byte(content), 0o644)
115+ say("✅ wrote .mm/agent.yaml")
116+ }
117+ return done, nil
118+}
119+
120+func (*fakeAgent) Authenticate(context.Context, sdk.AuthenticateRequest) (sdk.AuthenticateResponse, error) {
121+ return sdk.AuthenticateResponse{}, nil
122+}
123+func (*fakeAgent) Logout(context.Context, sdk.LogoutRequest) (sdk.LogoutResponse, error) {
124+ return sdk.LogoutResponse{}, nil
125+}
126+func (*fakeAgent) Cancel(context.Context, sdk.CancelNotification) error { return nil }
127+func (*fakeAgent) CloseSession(context.Context, sdk.CloseSessionRequest) (sdk.CloseSessionResponse, error) {
128+ return sdk.CloseSessionResponse{}, nil
129+}
130+func (*fakeAgent) ListSessions(context.Context, sdk.ListSessionsRequest) (sdk.ListSessionsResponse, error) {
131+ return sdk.ListSessionsResponse{}, sdk.NewMethodNotFound("session/list")
132+}
133+func (*fakeAgent) LoadSession(context.Context, sdk.LoadSessionRequest) (sdk.LoadSessionResponse, error) {
134+ return sdk.LoadSessionResponse{}, sdk.NewMethodNotFound("session/load")
135+}
136+func (*fakeAgent) ResumeSession(context.Context, sdk.ResumeSessionRequest) (sdk.ResumeSessionResponse, error) {
137+ return sdk.ResumeSessionResponse{}, sdk.NewMethodNotFound("session/resume")
138+}
139+func (*fakeAgent) SetSessionConfigOption(context.Context, sdk.SetSessionConfigOptionRequest) (sdk.SetSessionConfigOptionResponse, error) {
140+ return sdk.SetSessionConfigOptionResponse{}, sdk.NewMethodNotFound("session/set_config_option")
141+}
142+func (*fakeAgent) SetSessionMode(context.Context, sdk.SetSessionModeRequest) (sdk.SetSessionModeResponse, error) {
143+ return sdk.SetSessionModeResponse{}, sdk.NewMethodNotFound("session/set_mode")
144+}
new file mode 100644
@@ -0,0 +1,144 @@
1+// Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2+
3+// Package creatortest is a fake mm for the tests of the mini-me creation
4+// assistant (issue #94): a test binary that calls RunIfFake in its TestMain
5+// becomes, when Fake started it, an mm that answers --version and serves a
6+// short --acp-create wizard: one form (provider, name), then
7+// .mm/agent.yaml; /dockerinit and /sbxinit write their file.
8+package creatortest
9+
10+import (
11+ "context"
12+ "fmt"
13+ "os"
14+ "path/filepath"
15+ "strings"
16+ "testing"
17+
18+ sdk "github.com/coder/acp-go-sdk"
19+)
20+
21+const variable = "SIDEKICKS_FAKE_MM"
22+
23+// RunIfFake turns the test binary into the fake mm when Fake started it,
24+// and exits; otherwise it returns at once.
25+func RunIfFake() {
26+ if version := os.Getenv(variable); version != "" {
27+ runFakeMM(version, os.Args[1:])
28+ os.Exit(0)
29+ }
30+}
31+
32+// Fake copies the test binary to a folder of its own under the name mm, so
33+// that it is found by name like the real one, and returns its path and the
34+// environment that makes it the fake mm answering version to --version.
35+func Fake(t *testing.T, version string) (string, map[string]string) {
36+ t.Helper()
37+ self, err := os.Executable()
38+ if err != nil {
39+ t.Fatal(err)
40+ }
41+ content, err := os.ReadFile(self)
42+ if err != nil {
43+ t.Fatal(err)
44+ }
45+ command := filepath.Join(t.TempDir(), "mm")
46+ if err := os.WriteFile(command, content, 0o755); err != nil {
47+ t.Fatal(err)
48+ }
49+ return command, map[string]string{variable: version}
50+}
51+
52+func runFakeMM(version string, args []string) {
53+ if len(args) > 0 && args[0] == "--version" {
54+ fmt.Println(version)
55+ return
56+ }
57+ agent := &fakeAgent{args: strings.Join(args, " ")}
58+ agent.conn = sdk.NewAgentSideConnection(agent, os.Stdout, os.Stdin)
59+ <-agent.conn.Done()
60+}
61+
62+type fakeAgent struct {
63+ args string
64+ conn *sdk.AgentSideConnection
65+ cwd string
66+}
67+
68+func (*fakeAgent) Initialize(context.Context, sdk.InitializeRequest) (sdk.InitializeResponse, error) {
69+ return sdk.InitializeResponse{ProtocolVersion: 1, AgentInfo: &sdk.Implementation{Name: "mm-acp-create", Version: "1.0.9"}, AuthMethods: []sdk.AuthMethod{}}, nil
70+}
71+
72+func (a *fakeAgent) NewSession(_ context.Context, request sdk.NewSessionRequest) (sdk.NewSessionResponse, error) {
73+ a.cwd = request.Cwd
74+ return sdk.NewSessionResponse{SessionId: "create-1"}, nil
75+}
76+
77+// Prompt plays mm acp-create in short: /start asks one form (provider and
78+// name) and writes .mm/agent.yaml; /dockerinit and /sbxinit write their file.
79+func (a *fakeAgent) Prompt(ctx context.Context, request sdk.PromptRequest) (sdk.PromptResponse, error) {
80+ say := func(text string) {
81+ _ = a.conn.SessionUpdate(ctx, sdk.SessionNotification{SessionId: request.SessionId, Update: sdk.UpdateAgentMessageText(text)})
82+ }
83+ done := sdk.PromptResponse{StopReason: sdk.StopReasonEndTurn}
84+ switch text := request.Prompt[0].Text.Text; text {
85+ case "/dockerinit", "/sbxinit":
86+ file := map[string]string{"/dockerinit": "compose.yaml", "/sbxinit": "sbxenv.yaml"}[text]
87+ content := map[string]string{
88+ "/dockerinit": "services:\n bob:\n container_name: bob-box\n",
89+ "/sbxinit": "schemaVersion: \"1\"\nname: bob-sbx\nagent: mini-me-kit\nworkspace: .\n",
90+ }[text]
91+ _ = os.WriteFile(filepath.Join(a.cwd, file), []byte(content), 0o644)
92+ say("✅ wrote " + file)
93+ return done, nil
94+ }
95+ say("**mm init** — args=" + a.args)
96+ req := sdk.NewUnstableCreateElicitationRequestForm(sdk.UnstableElicitationSchema{
97+ Type: sdk.UnstableElicitationSchemaTypeObject,
98+ Properties: map[string]any{
99+ "provider": map[string]any{"type": "string", "title": "Model server?", "enum": []any{"llmman", "ollama"}, "default": "llmman"},
100+ "name": map[string]any{"type": "string", "title": "Agent name?", "default": "developer"},
101+ },
102+ Required: []string{"provider", "name"},
103+ })
104+ resp, err := a.conn.UnstableCreateElicitation(ctx, req)
105+ switch {
106+ case err != nil || resp.Cancel != nil:
107+ say("The form was closed: nothing written.")
108+ case resp.Decline != nil:
109+ say("Stopped: nothing written.")
110+ default:
111+ name := fmt.Sprint(resp.Accept.Content["name"])
112+ _ = os.MkdirAll(filepath.Join(a.cwd, ".mm"), 0o755)
113+ content := fmt.Sprintf("acp:\n name: %s\n title: %q\n", strings.ToLower(name), name+" (developer)")
114+ _ = os.WriteFile(filepath.Join(a.cwd, ".mm", "agent.yaml"), []byte(content), 0o644)
115+ say("✅ wrote .mm/agent.yaml")
116+ }
117+ return done, nil
118+}
119+
120+func (*fakeAgent) Authenticate(context.Context, sdk.AuthenticateRequest) (sdk.AuthenticateResponse, error) {
121+ return sdk.AuthenticateResponse{}, nil
122+}
123+func (*fakeAgent) Logout(context.Context, sdk.LogoutRequest) (sdk.LogoutResponse, error) {
124+ return sdk.LogoutResponse{}, nil
125+}
126+func (*fakeAgent) Cancel(context.Context, sdk.CancelNotification) error { return nil }
127+func (*fakeAgent) CloseSession(context.Context, sdk.CloseSessionRequest) (sdk.CloseSessionResponse, error) {
128+ return sdk.CloseSessionResponse{}, nil
129+}
130+func (*fakeAgent) ListSessions(context.Context, sdk.ListSessionsRequest) (sdk.ListSessionsResponse, error) {
131+ return sdk.ListSessionsResponse{}, sdk.NewMethodNotFound("session/list")
132+}
133+func (*fakeAgent) LoadSession(context.Context, sdk.LoadSessionRequest) (sdk.LoadSessionResponse, error) {
134+ return sdk.LoadSessionResponse{}, sdk.NewMethodNotFound("session/load")
135+}
136+func (*fakeAgent) ResumeSession(context.Context, sdk.ResumeSessionRequest) (sdk.ResumeSessionResponse, error) {
137+ return sdk.ResumeSessionResponse{}, sdk.NewMethodNotFound("session/resume")
138+}
139+func (*fakeAgent) SetSessionConfigOption(context.Context, sdk.SetSessionConfigOptionRequest) (sdk.SetSessionConfigOptionResponse, error) {
140+ return sdk.SetSessionConfigOptionResponse{}, sdk.NewMethodNotFound("session/set_config_option")
141+}
142+func (*fakeAgent) SetSessionMode(context.Context, sdk.SetSessionModeRequest) (sdk.SetSessionModeResponse, error) {
143+ return sdk.SetSessionModeResponse{}, sdk.NewMethodNotFound("session/set_mode")
144+}
modified internal/events/events.go +4 -0
@@ -37,6 +37,10 @@ const (
3737 PermissionRequested = "permission:requested"
3838 // PermissionResolved: a permission request was answered or cancelled. Payload: channels.PermissionResolvedPayload.
3939 PermissionResolved = "permission:resolved"
40+ // FormRequested: an agent asks the user to fill in a form (issue #95). Payload: channels.FormRequest.
41+ FormRequested = "form:requested"
42+ // FormResolved: a form was answered or cancelled. Payload: channels.FormResolvedPayload.
43+ FormResolved = "form:resolved"
4044 // UsageChanged: the context window use of an agent in a channel changed. Payload: channels.UsagePayload.
4145 UsageChanged = "usage:changed"
4246 // CommandsChanged: an agent announced its slash commands. Payload: channels.CommandsPayload.
@@ -37,6 +37,10 @@ const (
37 PermissionRequested = "permission:requested"37 PermissionRequested = "permission:requested"
38 // PermissionResolved: a permission request was answered or cancelled. Payload: channels.PermissionResolvedPayload.38 // PermissionResolved: a permission request was answered or cancelled. Payload: channels.PermissionResolvedPayload.
39 PermissionResolved = "permission:resolved"39 PermissionResolved = "permission:resolved"
40+ // FormRequested: an agent asks the user to fill in a form (issue #95). Payload: channels.FormRequest.
41+ FormRequested = "form:requested"
42+ // FormResolved: a form was answered or cancelled. Payload: channels.FormResolvedPayload.
43+ FormResolved = "form:resolved"
40 // UsageChanged: the context window use of an agent in a channel changed. Payload: channels.UsagePayload.44 // UsageChanged: the context window use of an agent in a channel changed. Payload: channels.UsagePayload.
41 UsageChanged = "usage:changed"45 UsageChanged = "usage:changed"
42 // CommandsChanged: an agent announced its slash commands. Payload: channels.CommandsPayload.46 // CommandsChanged: an agent announced its slash commands. Payload: channels.CommandsPayload.
modified internal/lifecycle/lifecycle.go +6 -0
@@ -219,6 +219,12 @@ func (r Runner) command(ctx context.Context, agent config.Agent, command []strin
219219 process := exec.CommandContext(ctx, program, command[1:]...)
220220 process.Dir = agent.Runtime.Lifecycle.Folder
221221 process.Env = os.Environ()
222+ if process.Dir != "" {
223+ // PWD is the folder, as in a terminal: the compose.yaml of mm
224+ // dockerinit mounts ${PWD}, and Sidekicks' own PWD is wherever it
225+ // was started from ("/" from the Finder).
226+ process.Env = append(process.Env, "PWD="+process.Dir)
227+ }
222228 for key, value := range agent.Env {
223229 process.Env = append(process.Env, key+"="+value)
224230 }
@@ -219,6 +219,12 @@ func (r Runner) command(ctx context.Context, agent config.Agent, command []strin
219 process := exec.CommandContext(ctx, program, command[1:]...)219 process := exec.CommandContext(ctx, program, command[1:]...)
220 process.Dir = agent.Runtime.Lifecycle.Folder220 process.Dir = agent.Runtime.Lifecycle.Folder
221 process.Env = os.Environ()221 process.Env = os.Environ()
222+ if process.Dir != "" {
223+ // PWD is the folder, as in a terminal: the compose.yaml of mm
224+ // dockerinit mounts ${PWD}, and Sidekicks' own PWD is wherever it
225+ // was started from ("/" from the Finder).
226+ process.Env = append(process.Env, "PWD="+process.Dir)
227+ }
222 for key, value := range agent.Env {228 for key, value := range agent.Env {
223 process.Env = append(process.Env, key+"="+value)229 process.Env = append(process.Env, key+"="+value)
224 }230 }
modified internal/lifecycle/lifecycle_test.go +15 -0
@@ -170,3 +170,18 @@ func TestRunReportsAFailingCommand(t *testing.T) {
170170 t.Fatalf("want the command error, got %v", err)
171171 }
172172 }
173+
174+// A command sees PWD set to its folder, like in a terminal (issue #94: the
175+// compose.yaml of mm dockerinit mounts ${PWD}).
176+func TestACommandRunsWithPWDSetToItsFolder(t *testing.T) {
177+ f := setup(t)
178+ folder := t.TempDir()
179+ agent := milo(folder)
180+ agent.Runtime.Lifecycle.Stop = []string{"env"}
181+ if err := f.runner.Run(ctx, agent, lifecycle.Stop, f.log); err != nil {
182+ t.Fatal(err)
183+ }
184+ if !slices.Contains(f.logs, "PWD="+folder) {
185+ t.Fatalf("PWD should be %s: %q", folder, f.logs)
186+ }
187+}
@@ -170,3 +170,18 @@ func TestRunReportsAFailingCommand(t *testing.T) {
170 t.Fatalf("want the command error, got %v", err)170 t.Fatalf("want the command error, got %v", err)
171 }171 }
172 }172 }
173+
174+// A command sees PWD set to its folder, like in a terminal (issue #94: the
175+// compose.yaml of mm dockerinit mounts ${PWD}).
176+func TestACommandRunsWithPWDSetToItsFolder(t *testing.T) {
177+ f := setup(t)
178+ folder := t.TempDir()
179+ agent := milo(folder)
180+ agent.Runtime.Lifecycle.Stop = []string{"env"}
181+ if err := f.runner.Run(ctx, agent, lifecycle.Stop, f.log); err != nil {
182+ t.Fatal(err)
183+ }
184+ if !slices.Contains(f.logs, "PWD="+folder) {
185+ t.Fatalf("PWD should be %s: %q", folder, f.logs)
186+ }
187+}
modified main.go +3 -0
@@ -51,6 +51,8 @@ func init() {
5151 application.RegisterEvent[channels.TurnPayload](events.TurnChanged)
5252 application.RegisterEvent[channels.Permission](events.PermissionRequested)
5353 application.RegisterEvent[channels.PermissionResolvedPayload](events.PermissionResolved)
54+ application.RegisterEvent[channels.FormRequest](events.FormRequested)
55+ application.RegisterEvent[channels.FormResolvedPayload](events.FormResolved)
5456 application.RegisterEvent[channels.UsagePayload](events.UsageChanged)
5557 application.RegisterEvent[channels.CommandsPayload](events.CommandsChanged)
5658 application.RegisterEvent[events.WorkspaceChangedPayload](events.WorkspaceChanged)
@@ -139,6 +141,7 @@ func main() {
139141 application.NewService(&app.ChannelService{Core: core}),
140142 application.NewService(&app.WorkspaceService{Core: core}),
141143 application.NewService(&app.TerminalService{Core: core}),
144+ application.NewService(&app.CreatorService{Core: core}),
142145 application.NewService(&app.SystemService{}),
143146 },
144147 Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)},
@@ -51,6 +51,8 @@ func init() {
51 application.RegisterEvent[channels.TurnPayload](events.TurnChanged)51 application.RegisterEvent[channels.TurnPayload](events.TurnChanged)
52 application.RegisterEvent[channels.Permission](events.PermissionRequested)52 application.RegisterEvent[channels.Permission](events.PermissionRequested)
53 application.RegisterEvent[channels.PermissionResolvedPayload](events.PermissionResolved)53 application.RegisterEvent[channels.PermissionResolvedPayload](events.PermissionResolved)
54+ application.RegisterEvent[channels.FormRequest](events.FormRequested)
55+ application.RegisterEvent[channels.FormResolvedPayload](events.FormResolved)
54 application.RegisterEvent[channels.UsagePayload](events.UsageChanged)56 application.RegisterEvent[channels.UsagePayload](events.UsageChanged)
55 application.RegisterEvent[channels.CommandsPayload](events.CommandsChanged)57 application.RegisterEvent[channels.CommandsPayload](events.CommandsChanged)
56 application.RegisterEvent[events.WorkspaceChangedPayload](events.WorkspaceChanged)58 application.RegisterEvent[events.WorkspaceChangedPayload](events.WorkspaceChanged)
@@ -139,6 +141,7 @@ func main() {
139 application.NewService(&app.ChannelService{Core: core}),141 application.NewService(&app.ChannelService{Core: core}),
140 application.NewService(&app.WorkspaceService{Core: core}),142 application.NewService(&app.WorkspaceService{Core: core}),
141 application.NewService(&app.TerminalService{Core: core}),143 application.NewService(&app.TerminalService{Core: core}),
144+ application.NewService(&app.CreatorService{Core: core}),
142 application.NewService(&app.SystemService{}),145 application.NewService(&app.SystemService{}),
143 },146 },
144 Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)},147 Assets: application.AssetOptions{Handler: application.AssetFileServerFS(assets)},
modified schema/config.schema.json +6 -0
@@ -23,6 +23,12 @@
2323 "agentTools": {
2424 "$ref": "#/$defs/agentTools"
2525 },
26+ "agentsFolder": {
27+ "description": "Where the assistant that creates mini-me agents makes one folder per agent: an absolute path, ~/… (your home folder) or a path relative to this file. Default: your Documents folder.",
28+ "type": "string",
29+ "minLength": 1,
30+ "default": "~/Documents"
31+ },
2632 "agents": {
2733 "description": "The agents available with @name. Names must be unique.",
2834 "type": "array",
@@ -23,6 +23,12 @@
23 "agentTools": {23 "agentTools": {
24 "$ref": "#/$defs/agentTools"24 "$ref": "#/$defs/agentTools"
25 },25 },
26+ "agentsFolder": {
27+ "description": "Where the assistant that creates mini-me agents makes one folder per agent: an absolute path, ~/… (your home folder) or a path relative to this file. Default: your Documents folder.",
28+ "type": "string",
29+ "minLength": 1,
30+ "default": "~/Documents"
31+ },
26 "agents": {32 "agents": {
27 "description": "The agents available with @name. Names must be unique.",33 "description": "The agents available with @name. Names must be unique.",
28 "type": "array",34 "type": "array",