feat(web): seat the plan control on conversation.input.plan over the projection

Rewrite ui-plan as a pure browser surface plugin. The control occupies the
composer's named plan seat (declared empty by ui-conversation); reads render
the host-computed plan projection through the standard-kit useProjection
(absent key = capability absence, hides the control), writes execute /plan
or /plan off through command.execute. The node half becomes the empty
roster apply: plan behavior (command, policy, projection unit) is owned by
dsh-plan-mode, already composed on the web roster with its policy in
cordis.yml. The superseded RPC-backed setPlanMode face, the WEB_PLAN_SECTION
duplicate, and the node-plugin spec are removed; the roster row moves from
the retired CLIENT_PACKAGES table to the cordis.yml dshClient roster.
This commit is contained in:
imccyu
2026-07-28 20:57:46 +08:00
parent f0f1966c97
commit 8dab7d2f92
12 changed files with 166 additions and 207 deletions

View File

@@ -1,30 +1,11 @@
/**
* Web plan plugin, node half: selecting this UI feature also mounts the
* logged plan-mode service with the Web product's planning policy.
* Plan control plugin, node half. Pure UI plugin: the empty apply exists so
* the plugin appears in the host cordis.yml / Loader; the browser half ships
* via exports["./client"], discovered through the package.json dshClient
* declaration. Plan behavior itself (the /plan command, the plan projection
* unit, the policy section) is owned by `@deepseek-ai/dsh-plan-mode`,
* composed independently on the host roster.
*/
import type { Context } from 'cordis'
import PlanModeService from '@deepseek-ai/dsh-plan-mode'
/** Host services required by plan mode. */
export const inject = ['tools', 'systemPrompt']
/** Web product-owned policy rendered while plan mode is active. */
export const WEB_PLAN_SECTION = `You are in plan mode. Stay in plan mode until exit_plan_mode succeeds or the user switches the session mode. Imperative language to implement changes means plan the implementation, not execute it. A user's conversational agreement — including an answer confirming something you asked — approves nothing and does not end plan mode; fold the confirmed decision into the plan and submit it through exit_plan_mode.
Explore first. Use non-mutating reads, searches, static analysis, and checks to ground the plan in the actual repository. Do not edit or write files, change configuration, run formatters or code generation that rewrites tracked files, commit, or otherwise carry out the plan. Prefer existing functions and patterns over new machinery.
The tool catalog stays the same across modes for request-cache stability. These plan-mode rules override any later tool description or guidance that suggests using mutation tools; those tools remain listed only to keep the request shape stable. Do not use todo_write to track this planning phase: it tracks implementation after an approved plan, while the plan itself belongs in exit_plan_mode.
Resolve discoverable facts by inspection. Use ask_user_question only for user-owned choices or material ambiguity that inspection cannot answer. Do not ask the user where code lives or how current behavior works when you can find out.
Make the plan decision-complete: state the goal and success criteria; group implementation changes by subsystem; identify public API, schema, and data-flow changes; cover edge cases, failure modes, tests, acceptance criteria, and explicit assumptions. Keep it concise enough to review but detailed enough that another engineer can implement it without making design decisions.
When ready, call exit_plan_mode with the complete plan markdown, starting with a # title. Make exit_plan_mode the only and final tool call in that assistant response: it presents the plan for approval, and implementation begins only in a later step after approval. Do not paste the final plan as a plain reply or ask "should I proceed?" through prose or ask_user_question. If review rejects it, incorporate the feedback and present again. If the review channel is unavailable or aborted, stay in plan mode and ask the user to switch modes manually; do not proceed with implementation.`
/**
* Mount plan mode for hosts that selected the Web plan plugin.
* @param ctx - Host context carrying tools and systemPrompt.
*/
export function apply(ctx: Context): void {
ctx.plugin(PlanModeService, { section: WEB_PLAN_SECTION })
}
/** Host plugin body — no host-side behavior for this surface plugin. */
export function apply(): void {}