Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(composer): complete namespaced Skill coverage
vastsa03564683aadf
diff --git a/apps/desktop/test/composer-mcp.test.mjs b/apps/desktop/test/composer-mcp.test.mjsindex 1b67a12c9..235a9c223 100644--- a/apps/desktop/test/composer-mcp.test.mjs+++ b/apps/desktop/test/composer-mcp.test.mjs@@ -28,7 +28,7 @@ test("slash source lists only ready MCP servers in the current project without cconst { expandMcpInvocation } = await import("../electron/main/composer-mcp.ts");const { registerAgentIpc } = await import("../electron/main/ipc/agent-ipc.ts");-const { IPC } = await import("@pi-desktop/shared");+const { findSkillMentions, formatCommandInsert, IPC } = await import("@pi-desktop/shared");test("selection uses stable encoded IDs even when labels match", async () => {const records = [record("docs one"), record("docs/two")];@@ -106,6 +106,44 @@ test("menu selection reaches runtime with MCP instructions and preserves the visassert.equal(fixture.released(), true);});+test("Skill commands use an explicit namespace and resolve original ids at send time", async () => {+ const catalog = createComposerCommandService({+ plugins: {+ listLoaded: () => [],+ getSkills: () => [{ id: "plugin/review", name: "Plugin review", pluginId: "review-plugin" }],+ getCommands: () => [],+ },+ agentExtensions: { allCommands: () => [] },+ activeUserSkills: async () => [{ id: "review", name: "User review" }],+ pluginActiveInProject: () => true,+ loadComposerTemplatesCached: async () => [{ name: "review" }],+ });+ const commands = await catalog.buildComposerCommands("/repo");+ const skills = commands.filter((command) => command.kind === "skill");+ const builtinSkill = skills.find((command) => command.skillId === "pi-desktop/imagegen");+ const pluginSkill = skills.find((command) => command.skillId === "plugin/review");+ const userSkill = skills.find((command) => command.skillId === "review");++ assert.equal(builtinSkill?.name, "skill:pi-desktop/imagegen");+ assert.equal(pluginSkill?.name, "skill:plugin/review");+ assert.equal(userSkill?.name, "skill:review");+ assert.equal(commands.find((command) => command.name === "review")?.kind, "template");++ const activeSkills = new Map(skills.map(({ name, skillId }) => [name, skillId]));+ assert.deepEqual(findSkillMentions("/review please", activeSkills), []);+ const input = `${formatCommandInsert(pluginSkill.name)}review the plugin ${formatCommandInsert(userSkill.name)}also review this`;+ const expectedMentions = findSkillMentions(input, activeSkills);+ assert.deepEqual(expectedMentions.map((mention) => mention.id), ["plugin/review", "review"]);++ const fixture = promptFixture(catalog);+ await fixture.prompt(input);+ const row = fixture.calls.find((call) => call.method === "session.appendMessage").params.message;+ assert.equal(row.command, input);+ assert.deepEqual(row.skillMentions, expectedMentions);+ assert.match(row.content, /"plugin\/review", "review"/);+ assert.match(row.content, /review the plugin.*also review this/s);+});+test("an attachment alone supplies request context for an MCP selection", async () => {const projectPath = process.cwd();const fixture = promptFixture(service([record("docs")], [ready("docs")]), projectPath);diff --git a/apps/desktop/test/slash-command-source.test.mjs b/apps/desktop/test/slash-command-source.test.mjsindex 26ca2ce6c..3a8db46fa 100644--- a/apps/desktop/test/slash-command-source.test.mjs+++ b/apps/desktop/test/slash-command-source.test.mjs@@ -96,11 +96,19 @@ test("an unknown alias and a template still travel as prompt text", async () =>await withCommandSource(async () => ({commands: [- { name: "review", kind: "skill", title: "Review", id: "skill.review" },+ { name: "skill:review", kind: "skill", title: "Review", skillId: "review" },{ name: "plan", kind: "template", title: "Plan" },],}),async () => {+ const skill = await resolveComposerCommand("skill:review");+ assert.equal(skill.status, "resolved");+ assert.equal(skill.command.skillId, "review");+ assert.equal(resolveSlashDispatch(parseSlashSubmission("/skill:review inspect"), skill).action, "prompt");++ const legacy = await resolveComposerCommand("review");+ assert.equal(legacy.status, "unknown");+const unknown = await resolveComposerCommand("not-a-command");assert.equal(unknown.status, "unknown");assert.equal(diff --git a/docs/adr/0219-user-invoked-skills-in-composer.md b/docs/adr/0219-user-invoked-skills-in-composer.mdindex bdb74734f..4e4de9d83 100644--- a/docs/adr/0219-user-invoked-skills-in-composer.md+++ b/docs/adr/0219-user-invoked-skills-in-composer.md@@ -21,10 +21,11 @@ the renderer, prompt, or host protocol.1. Active built-in, plugin, and user Skills contribute entries to the composerslash menu. They appear in a separate `Skills` group after extension- commands; the group is always last. The exact skill id is the slash name.- Existing command names win collisions, so a Skill cannot shadow a template,- builtin, plugin, or extension command.-2. Selecting a Skill inserts `/<skill-id> `. Later slash tokens can select+ commands; the group is always last. Skill command names use the explicit+ `skill:<id>` prefix while `skillId` retains the original id for send-time+ resolution. This namespace prevents collisions with commands and templates+ that keep their existing unprefixed names.+2. Selecting a Skill inserts `/skill:<skill-id> `. Later slash tokens can selectfurther Skills without opening app commands. Sending follows the ordinaryprompt path. Electron main resolves the command against the current sessionproject, revalidates its active scope and permissions at send time, anddiff --git a/docs/adr/0230-skill-ships-with-the-agent-core-tool-set.md b/docs/adr/0230-skill-ships-with-the-agent-core-tool-set.mdindex e3c7fccbb..c154f3470 100644--- a/docs/adr/0230-skill-ships-with-the-agent-core-tool-set.md+++ b/docs/adr/0230-skill-ships-with-the-agent-core-tool-set.md@@ -18,7 +18,7 @@ Two later decisions assume a `Skill` tool the model can call immediately:- D174 makes the skill catalog the model-invoked way to load a document, andadvertises it in the `# Skills` system-prompt section with an instruction toload a matching skill first.-- ADR 0219 answers a user-typed `/skill-id` by persisting an instruction to+- ADR 0219 answers a user-typed `/skill:<skill-id>` by persisting an instruction tocall the local `Skill` tool with the validated id on that turn.Neither can be satisfied when the tool is absent from the first request's tool@@ -43,7 +43,7 @@ for a skill pays one or two extra round trips before the body is ever loaded.## Consequences- A matching task loads its skill on the first turn instead of discovering the- tool first, and a `/skill-id` invocation works as ADR 0219 describes.+ tool first, and a `/skill:<skill-id>` invocation works as ADR 0219 describes.- Every Agent-mode request carries one more tool schema. The catalog is alreadybounded per session, and the delegation lifecycle was admitted to the core setfor the same reason: a capability the model has to go looking for is one itdiff --git a/docs/spec/03-runtime/02-agent-runtime.md b/docs/spec/03-runtime/02-agent-runtime.mdindex 871c2656e..7c3c07fc6 100644--- a/docs/spec/03-runtime/02-agent-runtime.md+++ b/docs/spec/03-runtime/02-agent-runtime.md@@ -1437,7 +1437,7 @@ execution activation rules:- Agent: `Read`, `Bash`, `Edit`, and `Write` (matching pi's coding-agent core)- Agent: `Skill` whenever the skill catalog is non-empty (D404, ADR 0230) — the- `# Skills` section and a user-typed `/skill-id` both ask the model to call+ `# Skills` section and a user-typed `/skill:<skill-id>` both ask the model to callit, and a tool that is missing from the schema cannot be called at all- Agent: `Task`, `TaskWait`, `TaskList`, and `TaskStop` as well, whenever thesubagent catalog is non-empty (§5f) — a capability the model has to godiff --git a/docs/spec/03-runtime/03-tools-and-permissions.md b/docs/spec/03-runtime/03-tools-and-permissions.mdindex 9bdca3b16..00306e26a 100644--- a/docs/spec/03-runtime/03-tools-and-permissions.md+++ b/docs/spec/03-runtime/03-tools-and-permissions.md@@ -50,7 +50,7 @@ The first Agent request includes `Read`, `Bash`, `Edit`, `Write`, `Glob`, and`Grep`. Keeping workspace listing and content search in the initial schemaavoids a discovery round trip for routine project exploration (the amendmentto ADR 0048 records this change). Plan and Goal keep their read/inspection core.-`Skill` is deliberately not deferred: a `/skill-id` invocation instructs the+`Skill` is deliberately not deferred: a `/skill:<skill-id>` invocation instructs themodel to call it, and a tool absent from the schema cannot be called at all, soit ships with the first request whenever the skill catalog is non-empty (D404,ADR 0230). The runtime still registers optional capabilities without sendingdiff --git a/docs/spec/04-ux/04-builtin-commands.md b/docs/spec/04-ux/04-builtin-commands.mdindex 751a14e2c..e672a869f 100644--- a/docs/spec/04-ux/04-builtin-commands.md+++ b/docs/spec/04-ux/04-builtin-commands.md@@ -107,19 +107,21 @@ still clears on success; failed dispatch preserves the draft.## 8. Composer skill entriesActive built-in, plugin, and user-owned Skills also surface in the composer `/`-menu. They use the exact Skill id as the slash name, show the Skill's display-name and description, and form a separate **Skills** group after extension-commands. This group is always last; a Skill never shadows a command or-template with the same name.+menu. Their slash names use the explicit `skill:<id>` prefix while retaining+the original Skill id for send-time resolution. The menu shows each Skill's+display name and description in a separate **Skills** group after extension+commands. This group is always last; a Skill with the same unprefixed name as a+command or template remains independently addressable.-Selecting a Skill inserts `/<skill-id> `. After the first token, typing `/`+Selecting a Skill inserts `/skill:<skill-id> `. After the first token, typing `/`offers Skills only; app commands and templates remain first-token actions.Multiple Skills may be selected in one message. Sending keeps each validatedSkill as its own transcript chip, with ordinary prompt text between chips, andasks the model to call the existing `Skill` tool for each id before answering.Only Skills active for the current project are listed or accepted, so projectscope and plugin activation remain enforced at send time. If the Skill is no-longer active, its token remains literal prompt text.+longer active, its token remains literal prompt text. Unprefixed names are not+Skill aliases; existing app commands and prompt templates keep their names.## 9. Ideographic comma opens the slash menu (D405)diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex c3955ef85..0f9b353dd 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -14852,16 +14852,19 @@ plugin-form fixtures in an isolated temporary directory at runtime.2. Inspect the first provider request and its tool list.3. Confirm the model calls `Skill` with the exact id without calling`ToolSearch` first, and that the returned document is the skill body.- 4. Send `/<skill-id>` from the composer and inspect the following turn.+ 4. Select a Skill and send `/skill:<skill-id>` from the composer; inspect the+ following turn and confirm the original Skill id reaches the tool.4a. Add a second active Skill with `/` after the first token, submit theprompt, switch away from the session, and reopen it.5. Switch the session to Plan mode and inspect the tool list again.6. Disable or remove every Skill and start another Agent turn.- **Expected**: Whenever the skill catalog is non-empty, `Skill` ships with thefirst request and never appears under `# On-demand tools`, so both a matching- task and a `/skill-id` invocation load the body without a discovery round+ task and a `/skill:<skill-id>` invocation load the body without a discovery roundtrip. Both explicit Skills load in their selected order; after reopening,each remains a separate transcript chip beside the user's prompt text.+ An unprefixed name that matches a Skill remains an ordinary command or+ template, not a Skill alias.`ToolSearch` still exists for the other on-demand capabilities andnever returns `Skill`. Plan mode omits the tool and the `# Skills` section,and an empty catalog registers no `Skill` tool at all.diff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 01c6aa5ed..a778c08f9 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -86,7 +86,7 @@ This log freezes previously open questions into concrete decisions.| D390 | Host-owned regenerate truncate | **Amend D199 / D258 / D307: `agent/prompt` truncates through `session.truncateFrom` under the host lock (identity-first cut, abort leftover running turn, archive discarded tail, rewrite prefix). The kept transcript does not cross JSON-RPC. An NDJSON request line over 64 MiB is `LIMIT_EXCEEDED` and does not end the stdin reader. Protocol version stays at 11. See ADR 0216 and E2E-246.** | Retrying a multi-thousand-message session timed out at 130 s on `session.replaceMessages` and could kill host stdin at 64 MiB (issue #211). || D391 | Host stdout sender must not outlive serve | **Amend D390 / ADR 0216: the Windows Alt+Space hook retains only a weak clone of the stdout sender. After stdin EOF, dropping serve's sender closes the writer channel and host-core exits. Electron rejects an NDJSON request over 64 MiB before writing, with `LIMIT_EXCEEDED`. A host-side oversize reply peeks the JSON-RPC id from the truncated prefix so the client does not wait 130 s. Serve waits at most 5 s for the stdout writer after stdin ends. Protocol version stays at 11. See ADR 0217 and E2E-247.** | On Windows v0.14.6 a 64 MiB stdin cap ended the reader, but a strong keyboard sender kept the writer thread alive, so host-core became a zombie and Electron reported `host RPC timeout: session.replaceMessages` (issue #211). || D392 | Effective image-input overrides across Composer and transport | **Amend D243 / ADR 0101: image capability starts with the published model record, then an exact binding's `supportsImages` value wins when it is `true` or `false`; absent or `null` follows the published value. Composer badges, attachment status, and main-process image transport use the same effective result. Unknown/custom models remain conservative without an explicit override. See ADR 0218 and E2E-163.** | A configured endpoint could already transport an image through its binding override while the Composer row still hid the vision badge, or could show a published badge after image input was disabled for that endpoint. |-| D393 | User-invoked Skills in the composer | **Amend D123 / D174 / ADR 0024 / ADR 0039: active built-in, plugin, and user Skills appear in a separate `Skills` group at the end of the composer slash menu. Selecting one inserts its exact id; Electron main revalidates the active project scope at send time and asks the model to call the local `Skill` tool, preserving on-demand body loading and existing permissions. Existing command names win collisions; inactive Skills remain literal slash text. See ADR 0219 and E2E-088b.** | D174's model-invoked catalog remains the body-loading and security contract, while a final explicit entry makes known workflows discoverable without moving Skill bodies into the renderer, prompt, or host protocol. |+| D393 | User-invoked Skills in the composer | **Amend D123 / D174 / ADR 0024 / ADR 0039: active built-in, plugin, and user Skills appear in a separate `Skills` group at the end of the composer slash menu. Their names use `/skill:<id>` while the original id remains the send-time Skill identity; Electron main revalidates the active project scope and asks the model to call the local `Skill` tool, preserving on-demand body loading and existing permissions. Unprefixed command and template names remain unchanged; inactive Skills remain literal slash text. See ADR 0219 and E2E-088b.** | D174's model-invoked catalog remains the body-loading and security contract, while a final explicit entry makes known workflows discoverable without moving Skill bodies into the renderer, prompt, or host protocol. || D394 | Windows work-panel chrome keeps one resource action cluster | **Amend D154 / D357 / ADR 0195: the open work-panel header keeps one compact resource switcher; resource close is owned by the existing keyboard-operable context-menu rows, the viewport-fixed toggle remains the only panel collapse control, and subagent detail returns with a back chevron. Windows/Linux native controls remain fixed at the window edge. Renderer-only; no panel state, window geometry, IPC, protocol, or storage change. See ADR 0220 and E2E-067.** | The header resource `X`, viewport-fixed toggle, and Windows native close cluster read as duplicate close actions and became cramped at narrow panel widths. || D396 | Renderer and plugin-panel scrollbars share one compact contract | **Amend D300: every renderer scroll container uses one 6px, trackless, transparent-at-rest scrollbar with the same hover, focus-within, scroll-reveal, and dragged-thumb states. Remove the sidebar-specific width and opacity override. The plugin-panel preload applies the same contract and 300ms reveal mark to docked and detached plugin documents, including the bundled Files view. External pages loaded inside the Browser guest remain page-owned. Presentation-only; no protocol, storage, host runtime, or external-page behavior change. See E2E-157.** | Windows' classic scrollbar made the right-side work-panel Files view visibly heavier than the conversation, while the sidebar retained a second scrollbar treatment. || D-LOCAL-message-quotes | Message quotes and renderer-owned side chats | *(retired by ADR 0268 on 2026-09-16)* **Amend D209 / D301: every user message and assistant turn gains a Quote action that inserts a `> `-prefixed Markdown blockquote plus a `chat.quoteSource` attribution into the active session's composer draft and focuses it, using the live selection inside that message row when one exists and the message's own text otherwise; it never sends and adds no chip kind, with a 2000-character cap. Open side chat forks the anchored message through `session.fork` without activating the child, registers the child as a renderer-owned side chat of the parent, and opens one `sidechat:<childSessionId>` tab in the existing docked panel that streams from the same event stream through the background-transcript reducer, with Add to main chat, Open as a conversation, a compact Send/Stop input, and the existing permission card. Closing the tab or activating the child removes the registration; the durable child stays an ordinary session. No protocol, schema, IPC, or permission change. See ADR message-quotes-and-side-chats and E2E-CHAT-quote-prefill through E2E-CHAT-side-chat-close.** | Users needed to reuse an exact earlier message or answer and to ask a side question without replacing the visible main conversation, and the existing fork path always activated its child. *(Amended by D-LOCAL-selection-overlay: the excerpt is recovered from the rendered DOM as Markdown, and a selection inside a transcript row offers Add to chat, Ask in side chat, and Copy from a selection-following overlay.)* |@@ -96,7 +96,7 @@ This log freezes previously open questions into concrete decisions.| D400 | Restore deferred tools from effective session context | **Amend D185 / ADR 0048: before each new prompt and after a mode switch, clear the in-memory deferred activation set, then restore names from successful `ToolSearch` results (`addedToolNames`) and successful deferred-tool results in the effective `buildSessionContext` projection. Keep only names still in the current deferred catalog and mode; ignore errors, interrupted or missing-result placeholders, and assistant/user prose. No host permission or workspace boundary changes.** | Clearing activations while retaining their successful transcript markers left the model able to see a capability that was absent from the next provider schema. Reconstructing only from effective successful evidence keeps the provider request coherent without parsing prose or reviving stale or disallowed tools. See ADR 0225 and E2E-008a. || D402 | Long-press project title to reorder | *(amended by D403)* **Amend D399 / D093 / ADR 0227: retained project groups have no visible reorder grip. A 400ms still press on the project title arms a pointer reorder; movement beyond 8px before that delay cancels it so a click still selects and toggles collapse. ArrowUp/ArrowDown on the focused title is the keyboard path; Escape cancels. Persistence, pin/archive buckets, host workspace identity, session ordering, and on-disk directories are unchanged. See ADR 0228 and E2E-253.** | The dedicated grip consumed a leading column and made reorder a second control beside the title that already selects and collapses the group. || D403 | Press-and-move project title reorder | **Amend D402 / D093 / ADR 0228: mouse and pen reorder by pressing the project title and moving 8px; a click with no qualifying movement still selects and toggles collapse. Touch does not start a reorder. An accent insertion line shows before/after placement. ArrowUp/ArrowDown and Escape are unchanged. See ADR 0229 and E2E-253.** | A 400ms still press is a mobile long-press pattern and is slower than ChatGPT-style desktop sidebar lists. |-| D404 | Skill ships with the Agent core tool set | **Amend D174 / D185 / ADR 0048 / ADR 0219: `Skill` joins the Agent-mode core tool set, so its schema is present on the first provider request whenever the skill catalog is non-empty. It is removed from the deferred catalog and never appears under `# On-demand tools`; the other on-demand capabilities and `ToolSearch` are unchanged, and Plan and Goal still omit the tool entirely. No protocol, storage, permission, or skill-body change. See ADR 0230 and E2E-254.** | A user-typed `/skill-id` and the `# Skills` section both ask the model to call `Skill`, and a tool that is absent from the schema cannot be called at all: the deferred entry added a discovery round trip before any skill body could load (issue #204). |+| D404 | Skill ships with the Agent core tool set | **Amend D174 / D185 / ADR 0048 / ADR 0219: `Skill` joins the Agent-mode core tool set, so its schema is present on the first provider request whenever the skill catalog is non-empty. It is removed from the deferred catalog and never appears under `# On-demand tools`; the other on-demand capabilities and `ToolSearch` are unchanged, and Plan and Goal still omit the tool entirely. No protocol, storage, permission, or skill-body change. See ADR 0230 and E2E-254.** | A user-typed `/skill:<skill-id>` and the `# Skills` section both ask the model to call `Skill`, and a tool that is absent from the schema cannot be called at all: the deferred entry added a discovery round trip before any skill body could load (issue #204). || D405 | Ideographic comma opens the slash menu | **Amend D123 / D139 / ADR 0024: a `、` (U+3001) committed as the first character of an empty composer draft is rewritten to `/` before trigger detection, so a Chinese IME reaches the ordinary slash menu without switching input methods. Only that position is rewritten; a `、` anywhere else stays ordinary punctuation, and the `@` file menu is unaffected. Shared grammar and renderer only; no IPC, storage, or autocomplete-source change. See ADR 0231 and E2E-255.** | Reaching `/new`, `/compact`, a mode alias, or a Skill forced a Chinese IME user to switch to ASCII input mid-sentence and then switch back (issue #65). || D406 | Keep macOS DMG opening guidance text-only | *(amended by D457 and D634)* **Amend D371 / ADR 0204: macOS DMGs no longer expose the opening-help note or executable helper, and macOS ZIP packages no longer retain them. The narrow Terminal fallback was for trusted unsigned builds; signed and notarized builds do not need it. See ADR 0232, ADR 0296, ADR 0309, and E2E-196b.** | The DMG should keep the normal app-to-Applications flow focused while still giving users a visible, actionable answer when an unsigned app does not open. || D407 | Restore archived projects after session import | **Additive renderer behavior for issue #250: when a core or plugin import adds a new project-bound session, the import-triggered session refresh normalizes its project path and clears the renderer's archived presentation state for that project. Pathless sessions, skipped imports, historical plugin paths without an active binding, and ordinary refreshes leave archive state unchanged. Host project rows, IPC channels, plugin methods, storage schema, and data formats do not change. See ADR 0236 and E2E-257.** | The host can successfully materialize an imported session under a project while the renderer still hides that project's sidebar row as archived. Restoring only the newly imported binding makes the result discoverable without weakening deliberate archive choices during ordinary refreshes (issue #250). |@@ -961,7 +961,8 @@ section mirrors only marketplace/catalog items still blocking nothing.contract, but its rejection of a user-facing slash entry made active Skillsdifficult to discover for users who already knew the workflow they wanted.- D393 / ADR 0219 adds active built-in, plugin, and user Skills as the final- group in the composer `/` menu. Selection inserts the exact id; Electron+ group in the composer `/` menu. Selection inserts `/skill:<id>` while keeping+ the original id for send-time resolution; Electronmain revalidates the current project scope and asks the model to call thelocal `Skill` tool. The typed command remains the transcript chip, and nohost protocol or durable schema changes.diff --git a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md b/docs/zh-CN/spec/03-runtime/02-agent-runtime.mdindex 606dd218c..a0bab4cff 100644--- a/docs/zh-CN/spec/03-runtime/02-agent-runtime.md+++ b/docs/zh-CN/spec/03-runtime/02-agent-runtime.md@@ -970,7 +970,7 @@ sidecar 构建了一个完整的工具注册表,但它不会序列化每个工- Agent:`Read`、`Bash`、`Edit` 和 `Write`(匹配 pi 的编码代理核心)- Agent:只要技能目录非空,`Skill` 也在核心集中(D404、ADR 0230)——`# Skills`- 段落与用户输入的 `/skill-id` 都要求模型调用它,而模式中缺失的工具根本无法被调用+ 段落与用户输入的 `/skill:<skill-id>` 都要求模型调用它,而模式中缺失的工具根本无法被调用- Agent:当子代理目录非空时,`Task`、`TaskWait`、`TaskList` 和`TaskStop` 也是如此 (§5f) — 模型必须寻找的能力是它不会使用的能力,委托生命周期值得每个请求的额外模式diff --git a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.mdindex 5fe4bbb15..ede9a531c 100644--- a/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md+++ b/docs/zh-CN/spec/03-runtime/03-tools-and-permissions.md@@ -51,7 +51,7 @@按照 pi 的编码代理默认值,第一个 Agent 请求仅激活`Read`、`Bash`、`Edit` 和 `Write`; `Glob` 和 `Grep` 按需加载。-Plan 和 Goal 保留其 read/inspection 核心。`Skill` 有意不作延迟:`/skill-id`+Plan 和 Goal 保留其 read/inspection 核心。`Skill` 有意不作延迟:`/skill:<skill-id>`调用会指示模型调用它,而模式中不存在的工具根本无法被调用,因此只要技能目录非空,它就会随第一个请求一起发送(D404、ADR 0230)。运行时还注册功能无需预先发送其完整模式:diff --git a/docs/zh-CN/spec/04-ux/04-builtin-commands.md b/docs/zh-CN/spec/04-ux/04-builtin-commands.mdindex 4c9d6e1aa..331ee02c8 100644--- a/docs/zh-CN/spec/04-ux/04-builtin-commands.md+++ b/docs/zh-CN/spec/04-ux/04-builtin-commands.md@@ -91,9 +91,10 @@ type CommandExecutionResult =当前激活的内置、插件和用户 Skill 也会显示在输入框的 `/` 菜单中。它们使用精确的Skill ID 作为斜杠名称,显示 Skill 名称和描述,并单独归入 **技能** 分组,排在扩展-命令之后。该分组始终位于最后;Skill 不会覆盖同名命令或模板。+命令之后。该分组始终位于最后;Skill 命令使用 `skill:<id>` 前缀,发送时仍解析回原始+Skill ID。同名的未加前缀命令或模板继续保留原名称。-选择 Skill 会插入 `/<skill-id> `。发送 `/<skill-id>`(可附带提示正文)时,输入的命令+选择 Skill 会插入 `/skill:<skill-id> `。发送 `/skill:<skill-id>`(可附带提示正文)时,输入的命令会以可见的消息芯片保留,同时要求模型先用经过校验的 ID 调用现有的 `Skill` 工具,再回答请求。只有当前项目已激活的 Skill 会被列出或接受,因此项目范围和插件激活状态仍会在发送时强制校验。如果 Skill 已不再激活,文本会按普通未知斜杠提示处理。diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.mdindex 10a1e5641..0fa04c966 100644--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md@@ -8124,10 +8124,10 @@ runner 会在运行时的隔离临时目录中生成六个插件形态 fixture1. 打开新的 Agent 会话,发送一条匹配该 Skill 描述的提示。2. 检查第一个 provider 请求及其工具列表。3. 确认模型直接用精确 id 调用 `Skill`,且没有先调用 `ToolSearch`,返回内容就是技能正文。- 4. 在输入框发送 `/<skill-id>`,检查随后的回合。+ 4. 选择 Skill 并在输入框发送 `/skill:<skill-id>`,检查随后的回合以及工具收到的原始 Skill ID。5. 把会话切换到 Plan 模式,再次检查工具列表。6. 禁用或移除全部 Skill,再发起一个 Agent 回合。-- **预期**:只要技能目录非空,`Skill` 就随第一个请求下发,且绝不出现在 `# On-demand tools` 中,因此匹配任务与 `/skill-id` 调用都能直接加载正文,不再多一次发现往返。`ToolSearch` 仍服务于其他按需能力,且永远不会返回 `Skill`。Plan 模式不提供该工具与 `# Skills` 段落;目录为空时不注册任何 `Skill` 工具。+- **预期**:只要技能目录非空,`Skill` 就随第一个请求下发,且绝不出现在 `# On-demand tools` 中,因此匹配任务与 `/skill:<skill-id>` 调用都能直接加载正文,不再多一次发现往返。未加前缀的同名命令或模板保持原行为,不作为 Skill 别名。`ToolSearch` 仍服务于其他按需能力,且永远不会返回 `Skill`。Plan 模式不提供该工具与 `# Skills` 段落;目录为空时不注册任何 `Skill` 工具。- **链接规格**:`03-runtime/02-agent-runtime.md`(§7.1)、`03-runtime/03-tools-and-permissions.md`(§2.1)、`04-ux/04-builtin-commands.md`(§8)、`08-meta/decisions-log.md`(D404)、ADR 0048、ADR 0219、ADR 0230- **验收**:C(对话与流)、E(工具与权限)、品质- **里程碑**:M5diff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex b6e965e6a..435114f0a 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -89,7 +89,7 @@| D390 | 主机拥有的重新生成截断 | **修订 D199 / D258 / D307:`agent/prompt` 在主机锁内通过 `session.truncateFrom` 截断(先按身份定位、中止残留 running 回合、归档被丢弃的尾部、重写前缀)。保留的 transcript 不会经过 JSON-RPC。超过 64 MiB 的 NDJSON 请求行返回 `LIMIT_EXCEEDED`,不会结束 stdin 读取器。协议版本仍为 11。见 ADR 0216 与 E2E-246。** | 在多千条消息的会话上重试时,`session.replaceMessages` 曾在 130 秒时超时,并可能在 64 MiB stdin 上限处失败(issue #211)。 || D391 | 主机 stdout 发送端不得比 serve 更长寿 | **修订 D390 / ADR 0216:Windows Alt+Space 钩子只保留 stdout 发送端的弱克隆。stdin EOF 后,丢弃 serve 的发送端会关闭写入器通道,host-core 随之退出。Electron 在写入前拒绝超过 64 MiB 的 NDJSON 请求,并返回 `LIMIT_EXCEEDED`。主机侧超大回复从截断前缀中窥取 JSON-RPC id,避免客户端等待 130 秒。stdin 结束后 serve 最多等待 stdout 写入器 5 秒。协议版本仍为 11。见 ADR 0217 与 E2E-247。** | Windows v0.14.6 的 64 MiB stdin 上限会结束读取器,但强引用的键盘发送端让写线程继续运行,因此 host-core 变成僵尸进程,Electron 报告 `host RPC timeout: session.replaceMessages`(issue #211)。 || D392 | Composer 与传输使用生效的图像输入覆盖 | **修订 D243 / ADR 0101:图像能力先取已发布模型记录;精确 binding 的 `supportsImages` 为 `true` 或 `false` 时覆盖该记录,缺失或 `null` 则跟随已发布值。Composer 徽章、附件状态和主进程图像传输使用同一个生效结果。没有显式覆盖时,未知/自定义模型仍保持保守行为。见 ADR 0218 与 E2E-163。** | 已配置的端点可能已经通过 binding 覆盖传输图像,但 Composer 行仍隐藏视觉徽章;或者端点已禁用图像输入,行却仍显示已发布徽章。 |-| D393 | Composer 中用户调用的 Skills | **修订 D123 / D174 / ADR 0024 / ADR 0039:激活的内置、插件和用户 Skills 出现在 composer slash 菜单末尾独立的 `Skills` 分组中。选择后插入其精确 id;Electron main 在发送时重新验证当前项目范围,并要求模型调用本地 `Skill` 工具,同时保留按需加载正文和现有权限。现有命令名优先解决冲突;未激活的 Skills 保持为字面 slash 文本。见 ADR 0219 和 E2E-088b。** | D174 的模型调用目录仍是 Skill 正文加载和安全契约,但拒绝面向用户的 slash 条目使已经知道工作流的用户难以发现活跃 Skills。 |+| D393 | Composer 中用户调用的 Skills | **修订 D123 / D174 / ADR 0024 / ADR 0039:激活的内置、插件和用户 Skills 出现在 composer slash 菜单末尾独立的 `Skills` 分组中。命令名采用 `/skill:<id>`,发送时仍使用原始 ID;Electron main 重新验证当前项目范围,并要求模型调用本地 `Skill` 工具,同时保留按需加载正文和现有权限。未加前缀的命令和模板保留原名称;未激活的 Skills 保持为字面 slash 文本。见 ADR 0219 和 E2E-088b。** | D174 的模型调用目录仍是 Skill 正文加载和安全契约,但拒绝面向用户的 slash 条目使已经知道工作流的用户难以发现活跃 Skills。 || D394 | Windows 工作面板 chrome 保持单一资源操作组 | **修订 D154 / D357 / ADR 0195:打开的工作面板标题栏只保留一个紧凑资源切换器;资源关闭由现有可键盘操作的上下文菜单行负责,视口固定开关仍是唯一的面板折叠控件,子代理详情使用返回箭头。Windows/Linux 原生控件仍固定在窗口边缘。仅渲染器变更;不改面板状态、窗口几何、IPC、协议或存储。见 ADR 0220 与 E2E-067。** | 标题栏资源 `X`、视口固定开关和 Windows 原生关闭按钮在窄面板中看起来像重复的关闭操作,并且过于拥挤。 || D396 | 渲染器与插件面板滚动条统一为紧凑规则 | **修订 D300:渲染器中的每个滚动容器统一使用 6px、无轨道、静止时透明的滚动条,以及相同的悬停、focus-within、滚动显示和拖动状态。移除侧边栏专用的宽度和透明度覆盖。插件面板 preload 给停靠和独立插件文档(包括内置 Files 视图)注入同一规则和 300ms 的滚动显示标记。Browser 内部加载的外部网页仍由网页自己管理。仅表现层变更;不改变协议、存储、主机运行时或外部网页行为。见 E2E-157。** | Windows 的经典滚动条让右侧工作面板的 Files 视图明显比对话区更粗,而侧边栏还保留了第二套滚动条样式。 || D-LOCAL-message-quotes | 消息引用与渲染器拥有的侧边聊天 | *(已由 ADR 0268 于 2026-09-16 退役)* **修订 D209 / D301:每条用户消息和每个助手回合的悬停操作行新增 Quote 操作,与 Copy、Edit、Delete、Fork、Retry 并列。它把以 `> ` 开头的 Markdown 引用块加一行 `chat.quoteSource` 归属写入当前会话的 composer 草稿并聚焦输入框;选区位于被点击消息行内时使用该选区,否则使用消息自身文本;摘录上限 2000 字符并带省略号;绝不发送,也不新增任何芯片类型。Open side chat 通过 `session.fork` 以锚点消息分叉且不激活子会话,把子会话注册为父会话的渲染器侧边聊天,并在现有停靠面板中打开一个 `sidechat:<childSessionId>` 标签,用同一条事件流经后台转录 reducer 实时流式渲染,提供 Add to main chat、Open as a conversation、紧凑 Send/Stop 输入和现有权限卡。关闭标签或以会话方式打开子会话会移除注册;持久子会话仍是普通会话。不改协议、schema、IPC 或权限。见 ADR message-quotes-and-side-chats 与 E2E-CHAT-quote-prefill 至 E2E-CHAT-side-chat-close。** | 用户需要复用之前某条消息或答案的原文,并在不替换当前可见主对话的前提下追问一个旁支问题,而现有 fork 路径总会激活子会话。 *(由 D-LOCAL-selection-overlay 修订:摘录改为从渲染后的 DOM 还原为 Markdown,且消息行内的选区可在跟随选区的浮层中选择「添加到对话」「在侧边聊天中提问」或复制。)* |@@ -99,7 +99,7 @@| D400 | 从有效会话上下文恢复延迟工具 | **修订 D185 / ADR 0048:每个新提示和模式切换前,清除内存中的延迟激活集,然后从有效 `buildSessionContext` 投影中的成功 `ToolSearch` 结果(`addedToolNames`)和成功的延迟工具结果恢复名称。仅保留当前延迟目录和模式仍允许的名称;忽略错误、已中断或缺少结果的占位行,以及助手/用户文本。不改变主机权限或工作区边界。** | 清除激活却保留成功的转录标记,会让模型看到能力证据而下一次 provider schema 中没有对应工具。只从有效的成功证据恢复,既保持 provider 请求一致,也不解析文本或复活过时、被禁止的工具。见 ADR 0225 与 E2E-008a。 || D402 | 长按项目标题重排 | *(由 D403 修订)* **修订 D399 / D093 / ADR 0227:保留的项目组不再显示重排手柄。在项目标题上静止按住 400ms 后开始指针重排;该延迟前移动超过 8px 会取消按住,因此单击仍会选中并折叠/展开。聚焦标题后按 `ArrowUp`/`ArrowDown` 是键盘路径;Escape 取消。持久化、置顶/归档分桶、主机工作区身份、会话顺序和磁盘目录保持不变。见 ADR 0228 与 E2E-253。** | 专用手柄占用一列,并把重排做成标题旁边的第二个控件,而标题本身已经负责选中和折叠。 || D403 | 按住标题移动即可重排 | **修订 D402 / D093 / ADR 0228:鼠标和触控笔按住项目标题并移动 8px 开始重排;没有足够移动的单击仍会选中并折叠/展开。触摸不会开始重排。强调色插入线标出前/后放置位置。`ArrowUp`/`ArrowDown` 与 Escape 不变。见 ADR 0229 与 E2E-253。** | 静止按住 400ms 是移动端长按模式,比 ChatGPT 一类桌面侧边栏列表更慢。 |-| D404 | Skill 随 Agent 核心工具集下发 | **修订 D174 / D185 / ADR 0048 / ADR 0219:`Skill` 加入 Agent 模式核心工具集,因此只要技能目录非空,第一个 provider 请求就带有它的 schema。它从延迟目录中移除,不再出现在 `# On-demand tools`;其他按需能力与 `ToolSearch` 不变,Plan 与 Goal 仍然完全不提供该工具。不改协议、存储、权限或技能正文。见 ADR 0230 与 E2E-254。** | 用户输入的 `/skill-id` 与 `# Skills` 段落都要求模型调用 `Skill`,而 schema 中不存在的工具根本无法被调用;延迟注册让任何技能正文加载前都多一次发现往返(issue #204)。 |+| D404 | Skill 随 Agent 核心工具集下发 | **修订 D174 / D185 / ADR 0048 / ADR 0219:`Skill` 加入 Agent 模式核心工具集,因此只要技能目录非空,第一个 provider 请求就带有它的 schema。它从延迟目录中移除,不再出现在 `# On-demand tools`;其他按需能力与 `ToolSearch` 不变,Plan 与 Goal 仍然完全不提供该工具。不改协议、存储、权限或技能正文。见 ADR 0230 与 E2E-254。** | 用户输入的 `/skill:<skill-id>` 与 `# Skills` 段落都要求模型调用 `Skill`,而 schema 中不存在的工具根本无法被调用;延迟注册让任何技能正文加载前都多一次发现往返(issue #204)。 || D405 | 顿号打开斜杠菜单 | **修订 D123 / D139 / ADR 0024:当输入框为空时,第 1 个字符提交的「、」(U+3001)会在触发检测前改写为 `/`,中文输入法因此无需切换输入方式即可打开普通斜杠菜单。只改写该位置;其他位置的「、」仍是普通标点,`@` 文件菜单不受影响。仅共享语法与渲染器改动;不改 IPC、存储或补全数据源。见 ADR 0231 与 E2E-255。** | 要唤出 `/new`、`/compact`、模式别名或某个 Skill,中文输入法用户必须在书写中途切到 ASCII 输入再切回(issue #65)。 || D406 | macOS DMG 只保留打开说明 | *(由 D457 和 D634 修订)* **修订 D371 / ADR 0204:macOS DMG 不再展示打开说明或可执行助手,macOS ZIP 也不再附带它们。原有终端备用方法仅供可信未签名构建使用;已签名和公证版本无需执行。见 ADR 0232、ADR 0296、ADR 0309 与 E2E-196b。** | DMG 应保持应用拖入 Applications 的正常安装路径简洁,同时为未签名应用打不开的问题提供可见且可执行的处理指引。 || D407 | 导入会话后恢复已归档项目 | **针对 issue #250 的渲染器增量行为:核心或插件导入新增项目绑定会话时,导入触发的会话刷新会规范化项目路径,并清除该项目的渲染器归档状态。无路径会话、跳过的导入、没有活动绑定的插件历史路径和普通刷新保持归档状态不变。host 项目行、IPC 通道、插件方法、存储 schema 和数据格式不变。见 ADR 0236 与 E2E-257。** | host 可以在项目下成功生成导入会话,而渲染器仍将该项目侧边栏行隐藏为已归档。只恢复新导入绑定对应的项目,可以让结果可发现,同时不会在普通刷新时削弱用户的归档选择(issue #250)。 |@@ -3906,7 +3906,7 @@ D193 和 D194。- D174 的模型调用目录仍负责 Skill 正文加载和安全契约,但不提供面向用户的 slash 条目,使已经知道所需工作流的用户难以发现活跃 Skills。- D393 / ADR 0219 将激活的内置、插件和用户 Skills 作为 composer `/` 菜单末尾的独立分组。- 选择后插入精确 id;Electron main 重新验证当前项目范围,并要求模型调用本地 `Skill` 工具。+ 选择后插入 `/skill:<id>`,发送时解析为原始 id;Electron main 重新验证当前项目范围,并要求模型调用本地 `Skill` 工具。输入的命令仍作为 transcript chip 保留,不新增主机协议或持久化 schema。## 2026-09-11 —— Windows 工作面板 chrome 保持单一资源操作组(D394)diff --git a/packages/agent-runtime/src/runtime.ts b/packages/agent-runtime/src/runtime.tsindex 98e7aa95e..4286d505a 100644--- a/packages/agent-runtime/src/runtime.ts+++ b/packages/agent-runtime/src/runtime.ts@@ -754,7 +754,7 @@ const AGENT_CORE_TOOL_NAMES = new Set(["Edit","Bash",ASK_TOOL_NAME,- // The slash menu answers a user-invoked `/skill-id` with an instruction to+ // The slash menu answers a user-invoked `/skill:<skill-id>` with an instruction to// call `Skill { id }` on the first turn (ADR 0219), and a capability the// model has to go looking for is one it will not use. Registration keeps its// own gate: the tool only exists when the catalog is non-empty.diff --git a/scripts/e2e/composer-autocomplete-layout.tsx b/scripts/e2e/composer-autocomplete-layout.tsxindex 5b9563fa4..6ed7e6100 100644--- a/scripts/e2e/composer-autocomplete-layout.tsx+++ b/scripts/e2e/composer-autocomplete-layout.tsx@@ -24,7 +24,7 @@ const items: AutocompleteItem[] = [command("qa-agent", "审查代码并验证功能。".repeat(80)),command("short", "Brief description"),command("bare"),- command("review", longDescription, { title: "Code review", argumentHint: "<path>" }),+ command("skill:review", longDescription, { title: "Code review", argumentHint: "<path>" }),command("template", longDescription, { kind: "template", argumentHint: "<file>" }),command("very-long-command-".repeat(20), longDescription),];