@wbline/pi-plan-build 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/README.md +24 -21
- package/package.json +1 -1
- package/src/context.ts +13 -2
- package/src/core/archive.ts +87 -0
- package/src/core/guard.ts +146 -58
- package/src/core/prompts.ts +13 -8
- package/src/core/schema.ts +2 -1
- package/src/core/state.ts +28 -23
- package/src/engine.ts +46 -1
- package/src/lifecycle.ts +49 -17
- package/src/tools/descriptions.ts +118 -0
- package/src/tools/index.ts +1 -1
- package/src/tools/plan-exit.ts +27 -13
- package/src/tools/plan-outcome.ts +25 -30
- package/src/tools/plan-question.ts +21 -17
- package/src/tools/plan-steps.ts +50 -35
- package/src/tools/plan-task.ts +182 -32
package/src/core/prompts.ts
CHANGED
|
@@ -14,39 +14,44 @@ export interface PromptPack {
|
|
|
14
14
|
readonly completionRouting: string;
|
|
15
15
|
readonly verificationPolicy: string;
|
|
16
16
|
readonly stepActive: (n: number, total: number, text: string) => string;
|
|
17
|
+
readonly stepAuto: (n: number, total: number, text: string) => string;
|
|
17
18
|
readonly stepReady: (n: number, total: number, text: string) => string;
|
|
18
19
|
readonly stepPaused: string;
|
|
19
20
|
readonly awaitingValidation: string;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
const ZH: PromptPack = {
|
|
23
|
-
planReadonly: `plan
|
|
24
|
-
taskSelection:
|
|
24
|
+
planReadonly: `plan 模式激活:只观察、分析、讨论和规划,不要改动系统/配置/提交。终端/构建/SQL 等执行命令仅限只读调研(如 git log、类型检查);会写项目、环境或数据库的操作(构建产物、跑测试、安装依赖、UPDATE/DDL)留到 build 模式。唯一允许的写操作是把完整计划写入当前计划文件(仅为定稿或用户明确要求的修订)。研究或讨论期间正常回答,不要写文件、不要调用 plan_exit。`,
|
|
25
|
+
taskSelection: `模式切换不产生任务。没有当前计划且用户要求规划交付物或接受了具体修改方案时,才调用 plan_task new(expectedAttached 传 null;planningRequested 仅在用户明确要求规划时传 true)。用户未明确要求规划时,工具会先弹窗让用户选「创建计划 / 直接执行」:返回说已切到 build 就放弃建计划、直接实现;用户取消就等待指示,不要自行规划。用"动作+对象"式单一标题(标题内不用冒号)和详细 scope;先等返回的 canonical 路径再写文件。已有未完成计划时绝不另开新任务;完成或放弃都只能由用户明确指示。未获回答的提问不构成同意。`,
|
|
25
26
|
taskBoundary: `任务身份一次建立:用户批准的追加用 plan_task include(给完整合并后的 scope);update 仅用于改名、身份纠错或对现有交付物的实质修正;exclude 记录明确排除的话题。相关问题、岔题、调研视为延续;对独立交付物,先问是否并入或结束当前计划。生命周期转移必须先于依赖它的写入/命令单独完成。计划文件是指令,不是进度记录。`,
|
|
26
27
|
planWorkflow: `在 plan 模式完成只读调研并收敛方案:推荐一个方案、列出关键文件、写完整计划文件(含 ## 验证 小节和文末 "## 实现步骤" 编号列表),然后调用 plan_exit 展示审阅。用户接受范围 ≠ 授权实现;不要在讨论未收敛或文件未写盘时调用 plan_exit。`,
|
|
27
|
-
buildWorkflow: `build
|
|
28
|
+
buildWorkflow: `build 模式:在已批准授权范围内讨论与实现。计划文件受保护不要改写;需要修订计划时调用 plan_task revise(用户确认后切回 plan,改完再 plan_exit 重新提请审批)。没有当前计划时是普通模式,小改动无需走计划流程;需要新计划时调用 plan_task new(会弹窗确认切到 plan)。`,
|
|
28
29
|
completionRouting: `完成路由:用户明确说整计划完成 → plan_complete;明确指认某一步完成 → plan_step_control acknowledge;语义含糊的"完成"先澄清。工作与必需检查全部通过前不要调用 plan_complete;仍有未竟事项用 plan_set_outcome(awaiting_validation / blocked / waiting_for_input / still_working),绝不因空闲推断成功。`,
|
|
29
30
|
verificationPolicy: `验证策略:按计划 ## 验证 小节用最小充分检查,然后停止。优先一个聚焦的行为验证(有可观察结果);构建/类型检查不能单独证明运行时行为。只为具体风险或明确要求增加检查。如实报告通过/受阻/未执行的检查,绝不弱化或谎报。只能由用户执行的必要验证:用 plan_set_outcome awaiting_validation 记录精确操作步骤,保持计划开放等用户回报;可选反馈不阻塞完成。`,
|
|
30
31
|
stepActive: (n, total, text) =>
|
|
31
32
|
`分步执行中:只实现第 ${n}/${total} 步 —— ${text}\n完成本步及其适用检查后调用 plan_step_complete(摘要必填);不要开始后续步骤,不要改计划文件。依赖后续步骤的检查要显式说明推迟,不得谎报通过。`,
|
|
32
33
|
stepReady: (n, total, text) =>
|
|
33
|
-
`第 ${n}/${total} 步已就绪等待批准:${text}\n用户说"继续/proceed"之类时调用 plan_step_control start
|
|
34
|
+
`第 ${n}/${total} 步已就绪等待批准:${text}\n用户说"继续/proceed"之类时调用 plan_step_control start 开始本步;用户明确要求连续执行(如"剩下的都做完""全部继续")时传 advance: "all" 一次授权连跑。在批准前不要做项目改动。`,
|
|
35
|
+
stepAuto: (n, total, text) =>
|
|
36
|
+
`连跑授权中:只实现第 ${n}/${total} 步 —— ${text}\n完成本步及适用检查后调用 plan_step_complete,然后直接开始下一步的实现,无需等待用户批准;遇到只有用户能解决的阻塞用 plan_set_outcome 记录并停下,不要绕过。`,
|
|
34
37
|
stepPaused: `分步执行已暂停:保留进度但没有任何实现授权。用户明确要求恢复后再继续(plan_step_control resume 由其自然语言指令触发)。`,
|
|
35
38
|
awaitingValidation: `计划处于"待验证":实现已完成,正在等待用户执行必要验证。不要继续改动;用户回报通过后(或明确说标记完成)才调用 plan_complete。`,
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
const EN: PromptPack = {
|
|
39
|
-
planReadonly: `plan mode active: observe, analyze, discuss, and plan only. The only permitted write is saving the complete plan to the current plan file (finalization or explicitly requested revision). Answer normally during research; do not write files or call plan_exit mid-discussion.`,
|
|
40
|
-
taskSelection: `Mode changes do not create tasks. With no current plan, call plan_task new (expectedAttached: null) only when the user requests a planning deliverable or accepts a concrete proposed change,
|
|
42
|
+
planReadonly: `plan mode active: observe, analyze, discuss, and plan only; do not modify the system, configuration, or commits. Terminal/build/SQL commands are for read-only investigation only (git log, type checks); anything that writes the project, environment, or database (build artifacts, test runs, dependency installs, UPDATE/DDL) waits for build mode. The only permitted write is saving the complete plan to the current plan file (finalization or explicitly requested revision). Answer normally during research; do not write files or call plan_exit mid-discussion.`,
|
|
43
|
+
taskSelection: `Mode changes do not create tasks. With no current plan, call plan_task new (expectedAttached: null; pass planningRequested: true only when the user explicitly asked to plan) only when the user requests a planning deliverable or accepts a concrete proposed change. Otherwise the tool first asks the user to choose "create plan / execute directly": if the result says build mode is active, drop plan creation and implement directly; if the user cancels, wait for instructions instead of planning on your own. One action-led title (no colons) and detailed scope; wait for the returned canonical path before writing. Never start another task while one is unfinished. Unanswered questions grant no consent.`,
|
|
41
44
|
taskBoundary: `Establish identity once: plan_task include for user-approved additions (complete merged scope); update only for renames, identity corrections, or material constraints; exclude for explicit exclusions. Questions, tangents, and research assume continuity. Lifecycle transitions finish before dependent writes or shell calls. The plan Markdown is instructions, not progress.`,
|
|
42
45
|
planWorkflow: `In plan mode, finish read-only investigation, recommend one approach with key files, write the complete plan file (including a "## Verification" section and a numbered "## Implementation Steps" list), then call plan_exit for review. Accepting scope does not authorize implementation. Never call plan_exit before the file is saved or while discussion should continue.`,
|
|
43
|
-
buildWorkflow: `build mode: discuss and implement within approved authorization. The plan file is protected;
|
|
46
|
+
buildWorkflow: `build mode: discuss and implement within approved authorization. The plan file is protected; to revise the plan call plan_task revise (the user confirms switching back to plan mode; call plan_exit again after revising). Without a current plan this is ordinary mode — small fixes need no plan; for a new plan call plan_task new (a dialog confirms switching to plan mode).`,
|
|
44
47
|
completionRouting: `Completion routing: explicit whole-plan completion → plan_complete; an identified step → plan_step_control acknowledge; clarify ambiguous bare completion. Never call plan_complete before all approved work and required checks pass; otherwise use plan_set_outcome (awaiting_validation / blocked / waiting_for_input / still_working). Never infer success from idleness.`,
|
|
45
48
|
verificationPolicy: `Verification: follow the plan's ## Verification section with the smallest sufficient check, then stop. Prefer one focused behavioral check with an observable result; build/type-check alone does not prove runtime behavior. Add checks only for concrete risks or explicit requirements. Report passed, blocked, and unperformed checks truthfully. For essential user-only checks use plan_set_outcome awaiting_validation with the exact action and keep the plan open until the user reports back; optional feedback never blocks completion.`,
|
|
46
49
|
stepActive: (n, total, text) =>
|
|
47
50
|
`Step-by-step execution: implement only step ${n}/${total} — ${text}\nWhen this step and its applicable checks finish, call plan_step_complete with a summary. Do not start later steps or edit the plan file. Defer checks that depend on later steps and say so; never claim a deferred check passed.`,
|
|
48
51
|
stepReady: (n, total, text) =>
|
|
49
|
-
`Step ${n}/${total} is ready and awaiting approval: ${text}\nWhen the user says "proceed", call plan_step_control start. No project mutations before approval.`,
|
|
52
|
+
`Step ${n}/${total} is ready and awaiting approval: ${text}\nWhen the user says "proceed", call plan_step_control start; when the user explicitly asks for continuous execution (e.g. "do the rest", "continue all"), pass advance: "all" to authorize auto-run. No project mutations before approval.`,
|
|
53
|
+
stepAuto: (n, total, text) =>
|
|
54
|
+
`Auto-run authorized: implement only step ${n}/${total} — ${text}\nWhen this step and its applicable checks finish, call plan_step_complete, then immediately start the next step without waiting for approval; if blocked by something only the user can resolve, record it with plan_set_outcome and stop.`,
|
|
50
55
|
stepPaused: `Step execution is paused: progress is retained but there is no implementation authority. Resume only on the user's explicit instruction.`,
|
|
51
56
|
awaitingValidation: `The plan is awaiting the user's required validation. Implementation is done; do not make further changes. Call plan_complete only after the user reports success or explicitly asks to mark it complete.`,
|
|
52
57
|
};
|
package/src/core/schema.ts
CHANGED
|
@@ -114,6 +114,7 @@ function decodeExecution(v: unknown): Execution | null | undefined {
|
|
|
114
114
|
if (v === null) return null;
|
|
115
115
|
if (!isRecord(v) || !Array.isArray(v.steps) || typeof v.paused !== "boolean")
|
|
116
116
|
return undefined;
|
|
117
|
+
if (v.auto !== undefined && typeof v.auto !== "boolean") return undefined;
|
|
117
118
|
const steps: Step[] = [];
|
|
118
119
|
for (const raw of v.steps) {
|
|
119
120
|
if (!isRecord(raw)) return undefined;
|
|
@@ -129,7 +130,7 @@ function decodeExecution(v: unknown): Execution | null | undefined {
|
|
|
129
130
|
});
|
|
130
131
|
}
|
|
131
132
|
if (steps.length === 0) return undefined;
|
|
132
|
-
return { steps, paused: v.paused };
|
|
133
|
+
return { steps, paused: v.paused, auto: v.auto === true };
|
|
133
134
|
}
|
|
134
135
|
|
|
135
136
|
/** 恢复:扫描分支条目取最新有效状态。 */
|
package/src/core/state.ts
CHANGED
|
@@ -46,6 +46,8 @@ export interface Step {
|
|
|
46
46
|
export interface Execution {
|
|
47
47
|
steps: Step[];
|
|
48
48
|
paused: boolean;
|
|
49
|
+
/** 连跑授权:plan_step_control start advance="all" 时置位,complete 后自动推进下一步。 */
|
|
50
|
+
auto: boolean;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
export interface State {
|
|
@@ -74,7 +76,7 @@ export type Transition =
|
|
|
74
76
|
| { t: "plan.finish"; outcome: PlanOutcome }
|
|
75
77
|
| { t: "plan.abandon"; reason: string }
|
|
76
78
|
| { t: "exec.start"; steps: string[] }
|
|
77
|
-
| { t: "exec.step.start" }
|
|
79
|
+
| { t: "exec.step.start"; advance?: "one" | "all" }
|
|
78
80
|
| { t: "exec.step.complete"; summary?: string }
|
|
79
81
|
| { t: "exec.step.ack"; summary?: string }
|
|
80
82
|
| { t: "exec.step.skip" }
|
|
@@ -134,10 +136,12 @@ function finishStep(
|
|
|
134
136
|
cur.summary = summary;
|
|
135
137
|
const next = nextPending(ex.steps);
|
|
136
138
|
if (next) {
|
|
137
|
-
next.status = "ready";
|
|
139
|
+
next.status = ex.auto ? "active" : "ready";
|
|
138
140
|
return {
|
|
139
141
|
state: s,
|
|
140
|
-
note:
|
|
142
|
+
note: ex.auto
|
|
143
|
+
? `第 ${cur.n} 步完成;第 ${next.n} 步自动继续(已授权连跑)`
|
|
144
|
+
: `第 ${cur.n} 步完成;第 ${next.n} 步就绪(等待批准)`,
|
|
141
145
|
};
|
|
142
146
|
}
|
|
143
147
|
const done = ex.steps
|
|
@@ -159,13 +163,9 @@ export function transition(prev: State, ev: Transition): TransitionResult {
|
|
|
159
163
|
"分步执行进行中:先 plan_step_control cancel(或完成/标记完成)再切回 plan 模式。",
|
|
160
164
|
);
|
|
161
165
|
s.mode = ev.mode;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
ev.mode === "plan"
|
|
166
|
-
? "已切换到 plan 模式(只读规划)"
|
|
167
|
-
: "已切换到 build 模式",
|
|
168
|
-
};
|
|
166
|
+
// 不发 note:模式反馈由状态栏徽标实时承载;notify 在 IDE/ACP 桥接下
|
|
167
|
+
// 会渲染成对话消息,用户主动切换(/plan /build Alt+M)不该刷屏
|
|
168
|
+
return { state: s };
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
case "plan.create": {
|
|
@@ -255,7 +255,7 @@ export function transition(prev: State, ev: Transition): TransitionResult {
|
|
|
255
255
|
status: i === 0 ? "ready" : "pending",
|
|
256
256
|
}));
|
|
257
257
|
if (steps.length === 0) throw new TransitionError("未解析出任何步骤。");
|
|
258
|
-
s.execution = { steps, paused: false };
|
|
258
|
+
s.execution = { steps, paused: false, auto: false };
|
|
259
259
|
p.outcome = undefined; // 重新进入实现:旧的未完成结局(blocked 等)失效
|
|
260
260
|
return { state: s, note: `分步执行开始:共 ${steps.length} 步` };
|
|
261
261
|
}
|
|
@@ -270,7 +270,13 @@ export function transition(prev: State, ev: Transition): TransitionResult {
|
|
|
270
270
|
if (!cur) throw new TransitionError("没有就绪的步骤。");
|
|
271
271
|
if (cur.status === "active") return { state: prev };
|
|
272
272
|
cur.status = "active";
|
|
273
|
-
|
|
273
|
+
if (ev.advance === "all") ex.auto = true;
|
|
274
|
+
return {
|
|
275
|
+
state: s,
|
|
276
|
+
note: `第 ${cur.n}/${ex.steps.length} 步开始${
|
|
277
|
+
ev.advance === "all" ? "(已授权连跑,后续步自动推进)" : ""
|
|
278
|
+
}`,
|
|
279
|
+
};
|
|
274
280
|
}
|
|
275
281
|
|
|
276
282
|
case "exec.step.complete": {
|
|
@@ -373,8 +379,8 @@ export function statusLine(s: State): string {
|
|
|
373
379
|
const done = s.execution.steps.filter(
|
|
374
380
|
(x) => x.status === "completed" || x.status === "skipped",
|
|
375
381
|
).length;
|
|
376
|
-
const
|
|
377
|
-
return `${mode} ${
|
|
382
|
+
const paused = s.execution.paused ? "(暂停)" : "";
|
|
383
|
+
return `${mode} ${done}/${s.execution.steps.length} ${s.plan.title}${paused}`;
|
|
378
384
|
}
|
|
379
385
|
const suffix = s.plan.outcome
|
|
380
386
|
? `(${outcomeLabel(s.plan.outcome)})`
|
|
@@ -400,19 +406,18 @@ export function outcomeLabel(o: PlanOutcome): string {
|
|
|
400
406
|
/** 侧栏 widget 行(原生 setWidget)。 */
|
|
401
407
|
export function widgetLines(s: State): string[] | undefined {
|
|
402
408
|
if (!s.plan || !s.execution) return undefined;
|
|
409
|
+
// 等宽中文标签:几何圆圈(○◉◐●)在 CJK 环境是歧义宽度字符、箭头(↷)风格不搭,
|
|
410
|
+
// 统一为 [标签] 前缀,每行前缀定宽对齐
|
|
403
411
|
const marks: Record<StepStatus, string> = {
|
|
404
|
-
pending: "
|
|
405
|
-
ready: "
|
|
406
|
-
active: "
|
|
407
|
-
completed: "
|
|
408
|
-
skipped: "
|
|
412
|
+
pending: "[待办]",
|
|
413
|
+
ready: "[就绪]",
|
|
414
|
+
active: "[进行]",
|
|
415
|
+
completed: "[完成]",
|
|
416
|
+
skipped: "[跳过]",
|
|
409
417
|
};
|
|
410
418
|
const head = s.execution.paused ? "分步执行(暂停)" : "分步执行";
|
|
411
419
|
return [
|
|
412
420
|
`${head} · ${s.plan.title}`,
|
|
413
|
-
...s.execution.steps.map(
|
|
414
|
-
(x) =>
|
|
415
|
-
`${marks[x.status]} ${x.n}. ${x.text}${x.status === "skipped" ? "(跳过)" : ""}`,
|
|
416
|
-
),
|
|
421
|
+
...s.execution.steps.map((x) => `${marks[x.status]} ${x.n}. ${x.text}`),
|
|
417
422
|
];
|
|
418
423
|
}
|
package/src/engine.ts
CHANGED
|
@@ -11,6 +11,7 @@ import type {
|
|
|
11
11
|
ExtensionContext,
|
|
12
12
|
} from "@earendil-works/pi-coding-agent";
|
|
13
13
|
import type { Config } from "./config.ts";
|
|
14
|
+
import { archivePlanFile } from "./core/archive.ts";
|
|
14
15
|
import { type PromptPack, prompts } from "./core/prompts.ts";
|
|
15
16
|
import { decodeState, STATE_ENTRY_TYPE } from "./core/schema.ts";
|
|
16
17
|
import {
|
|
@@ -29,12 +30,16 @@ export class PlanEngine {
|
|
|
29
30
|
readonly pi: ExtensionAPI;
|
|
30
31
|
private ctx: ExtensionContext | undefined;
|
|
31
32
|
config: Config;
|
|
32
|
-
/** awaiting_validation
|
|
33
|
+
/** awaiting_validation 的确认是否已问过:用户下一次发消息时问一次,重新结算时重置。 */
|
|
33
34
|
validationAsked = false;
|
|
34
35
|
/** 状态损坏只读保护。 */
|
|
35
36
|
corrupt = false;
|
|
36
37
|
/** 事后对账:不可验证变更工具放行前记录的计划文件基线(首次武装为准)。 */
|
|
37
38
|
reconciliation: { tool: string; baseline: string } | undefined;
|
|
39
|
+
/** 最近一次收尾的归档结果(每次 apply 重置,仅收尾转移置值;工具结果透出用)。 */
|
|
40
|
+
lastArchive?: { path: string; ok: boolean };
|
|
41
|
+
/** 本回合用户已拒绝"拦截即切 build"的确认门:之后只拦不再问(agent_settled 重置)。 */
|
|
42
|
+
gateDeclined = false;
|
|
38
43
|
|
|
39
44
|
constructor(pi: ExtensionAPI, config: Config) {
|
|
40
45
|
this.pi = pi;
|
|
@@ -109,9 +114,49 @@ export class PlanEngine {
|
|
|
109
114
|
this.state = result.state;
|
|
110
115
|
if (result.state !== prev) this.persist(); // 幂等转移不写重复条目
|
|
111
116
|
this.refreshUI(c, result.note);
|
|
117
|
+
this.lastArchive = undefined;
|
|
118
|
+
this.archiveOnFinish(ev, prev);
|
|
112
119
|
return result;
|
|
113
120
|
}
|
|
114
121
|
|
|
122
|
+
/** 终态归档:计划被清空(完成/放弃/分步收尾)时,在计划文件文末追加状态块。 */
|
|
123
|
+
private archiveOnFinish(ev: Transition, prev: State): void {
|
|
124
|
+
const plan = prev.plan;
|
|
125
|
+
if (!plan || this.state.plan) return; // 仅"存在 → 清空"的收尾转移
|
|
126
|
+
if (ev.t === "plan.abandon") {
|
|
127
|
+
this.lastArchive = {
|
|
128
|
+
path: plan.path,
|
|
129
|
+
ok: archivePlanFile(plan.path, "已放弃", `原因:${ev.reason}`),
|
|
130
|
+
};
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (ev.t === "plan.complete") {
|
|
134
|
+
this.lastArchive = {
|
|
135
|
+
path: plan.path,
|
|
136
|
+
ok: archivePlanFile(
|
|
137
|
+
plan.path,
|
|
138
|
+
"已完成",
|
|
139
|
+
ev.summary ? `摘要:${ev.summary}` : undefined,
|
|
140
|
+
),
|
|
141
|
+
};
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (ev.t === "exec.step.complete" || ev.t === "exec.step.ack") {
|
|
145
|
+
// finishStep 收尾:被完成的步是转移前的 active 步
|
|
146
|
+
const cur = prev.execution?.steps.find((x) => x.status === "active");
|
|
147
|
+
this.lastArchive = {
|
|
148
|
+
path: plan.path,
|
|
149
|
+
ok: archivePlanFile(
|
|
150
|
+
plan.path,
|
|
151
|
+
"已完成",
|
|
152
|
+
cur
|
|
153
|
+
? `最后完成:第 ${cur.n} 步${ev.summary ? `:${ev.summary}` : ""}`
|
|
154
|
+
: undefined,
|
|
155
|
+
),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
115
160
|
tryApply(
|
|
116
161
|
ev: Transition,
|
|
117
162
|
ctx?: ExtensionContext,
|
package/src/lifecycle.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 事件接线:session 恢复、tool_call 权限守卫、context
|
|
2
|
+
* 事件接线:session 恢复、tool_call 权限守卫、context 注入、回合结算
|
|
3
|
+
* (agent_settled)与验证问询(input:awaiting_validation 后用户下一次
|
|
4
|
+
* 空闲发消息时确认一次)。
|
|
3
5
|
* 每个 handler 都保持简短,逻辑下沉到 core 纯函数。
|
|
4
6
|
*/
|
|
5
7
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
@@ -11,7 +13,6 @@ import {
|
|
|
11
13
|
LIFECYCLE_TOOLS,
|
|
12
14
|
planTaskPendingInLastAssistant,
|
|
13
15
|
realpathLike,
|
|
14
|
-
SHELL_TOOLS,
|
|
15
16
|
type ToolAnnotationsLike,
|
|
16
17
|
} from "./core/guard.ts";
|
|
17
18
|
import type { PlanEngine } from "./engine.ts";
|
|
@@ -51,7 +52,7 @@ export function wireLifecycle(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
51
52
|
pi.on("session_info_changed", (_event, ctx) => engine.attachContext(ctx));
|
|
52
53
|
|
|
53
54
|
// --- 权限守卫(tool_call 可拦截)---
|
|
54
|
-
pi.on("tool_call", (event, ctx) => {
|
|
55
|
+
pi.on("tool_call", async (event, ctx) => {
|
|
55
56
|
const s = engine.state;
|
|
56
57
|
const kind = classifyToolCall(
|
|
57
58
|
event.toolName,
|
|
@@ -70,23 +71,21 @@ export function wireLifecycle(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
70
71
|
};
|
|
71
72
|
}
|
|
72
73
|
if (kind !== "mutation") {
|
|
73
|
-
// shell
|
|
74
|
+
// shell 与执行面通道不硬拦(诚实标注),但纳入事后对账:改动计划文件可被发现
|
|
74
75
|
if (
|
|
75
76
|
s.mode === "build" &&
|
|
76
77
|
engine.config.protectPlanFile &&
|
|
77
78
|
s.plan?.saved &&
|
|
78
|
-
|
|
79
|
+
kind === "execution"
|
|
79
80
|
)
|
|
80
81
|
engine.armReconciliation(event.toolName);
|
|
81
82
|
return;
|
|
82
83
|
}
|
|
83
84
|
if (s.mode === "build" && !engine.config.protectPlanFile) return; // 用户关闭保护
|
|
84
85
|
const planPath = s.plan?.path ? realpathLike(s.plan.path) : null;
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
ctx.cwd,
|
|
89
|
-
);
|
|
86
|
+
const raw = extractMutationTargets(event.toolName, event.input, ctx.cwd);
|
|
87
|
+
// targets 与计划路径同过 symlink 解析,避免链接路径被误判为非计划文件
|
|
88
|
+
const targets = raw?.map(realpathLike);
|
|
90
89
|
const decision = decideFileMutation(
|
|
91
90
|
event.toolName,
|
|
92
91
|
s.mode,
|
|
@@ -94,8 +93,31 @@ export function wireLifecycle(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
94
93
|
s.plan?.saved ?? false,
|
|
95
94
|
targets,
|
|
96
95
|
);
|
|
97
|
-
if (decision.action === "block")
|
|
96
|
+
if (decision.action === "block") {
|
|
97
|
+
// plan 模式只读拦截 → 轻量确认门:用户确认即切 build 并放行本次修改(死墙变门)
|
|
98
|
+
if (
|
|
99
|
+
s.mode === "plan" &&
|
|
100
|
+
!engine.corrupt &&
|
|
101
|
+
!engine.gateDeclined &&
|
|
102
|
+
ctx.hasUI
|
|
103
|
+
) {
|
|
104
|
+
const okSwitch = await ctx.ui.confirm(
|
|
105
|
+
"plan 模式只读拦截",
|
|
106
|
+
`${decision.summary}\n是否切换到 build 模式并放行本次修改?`,
|
|
107
|
+
);
|
|
108
|
+
if (okSwitch) {
|
|
109
|
+
const sw = engine.tryApply({ t: "mode.set", mode: "build" }, ctx);
|
|
110
|
+
if (!("error" in sw)) return undefined; // 已切 build:放行本次调用
|
|
111
|
+
return { block: true, reason: sw.error };
|
|
112
|
+
}
|
|
113
|
+
engine.gateDeclined = true; // 本回合只拦不再问,防重复弹窗
|
|
114
|
+
return {
|
|
115
|
+
block: true,
|
|
116
|
+
reason: `用户拒绝切换,保持 plan 模式只读。${decision.reason} 不要再次尝试写项目文件;继续讨论或建议用户手动 /build。`,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
98
119
|
return { block: true, reason: decision.reason };
|
|
120
|
+
}
|
|
99
121
|
// 事后对账:build 放行波及面无法验证的变更工具前记录计划文件基线
|
|
100
122
|
if (
|
|
101
123
|
s.mode === "build" &&
|
|
@@ -113,18 +135,28 @@ export function wireLifecycle(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
113
135
|
return { messages: injectContext(event.messages, block) };
|
|
114
136
|
});
|
|
115
137
|
|
|
116
|
-
// ---
|
|
138
|
+
// --- 回合结算:确认门拒绝记忆重置 + 事后对账(验证问询在下方 input) ---
|
|
117
139
|
pi.on("agent_settled", async (_event, ctx) => {
|
|
140
|
+
engine.gateDeclined = false; // 新回合重置确认门的拒绝记忆
|
|
118
141
|
// 事后对账先行:不可验证工具改动了计划文件要立即提示
|
|
119
142
|
const reconciled = engine.settleReconciliation();
|
|
120
143
|
if (reconciled) ctx.ui.notify(reconciled, "warning");
|
|
121
|
-
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// --- 验证问询:awaiting_validation 后,用户下一次空闲发消息时确认一次 ---
|
|
147
|
+
pi.on("input", async (event, ctx) => {
|
|
148
|
+
// 只在用户空闲提交(非流式插话)时询问;斜杠命令与扩展触发不问
|
|
149
|
+
if (event.streamingBehavior !== undefined || event.source === "extension")
|
|
150
|
+
return;
|
|
151
|
+
if (event.text.trim().startsWith("/")) return;
|
|
152
|
+
const plan = engine.state.plan;
|
|
153
|
+
const outcome = plan?.outcome;
|
|
122
154
|
if (outcome?.kind !== "awaiting_validation" || engine.validationAsked)
|
|
123
155
|
return;
|
|
124
|
-
if (!ctx.hasUI
|
|
125
|
-
engine.validationAsked = true;
|
|
156
|
+
if (!ctx.hasUI) return;
|
|
157
|
+
engine.validationAsked = true; // 只问一次;重新结算(plan_set_outcome/plan_complete)会重置
|
|
126
158
|
const passed = await ctx.ui.confirm(
|
|
127
|
-
"
|
|
159
|
+
"上一轮计划的必需验证通过了吗?",
|
|
128
160
|
outcome.userAction,
|
|
129
161
|
);
|
|
130
162
|
if (passed && engine.state.plan?.outcome?.kind === "awaiting_validation") {
|
|
@@ -134,7 +166,7 @@ export function wireLifecycle(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
134
166
|
"error" in r ? "error" : "info",
|
|
135
167
|
);
|
|
136
168
|
}
|
|
137
|
-
//
|
|
169
|
+
// 未通过/取消:计划保持开放,等用户在对话里说明;不再自动重问。
|
|
138
170
|
});
|
|
139
171
|
|
|
140
172
|
// --- 卸载清理(widget/status 由 reload 重建)---
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 工具描述与参数描述集中层:zh/en 双语,注册时按 config.lang 选用。
|
|
3
|
+
* 压缩原则:工作流规则交给 context 注入(prompts.ts),这里只保留工具自身的
|
|
4
|
+
* 动作语义与硬约束(模式边界 / expectedAttached / 绝不事项)。
|
|
5
|
+
*/
|
|
6
|
+
import type { Lang } from "../core/prompts.ts";
|
|
7
|
+
|
|
8
|
+
export interface ToolTexts {
|
|
9
|
+
planTask: string;
|
|
10
|
+
taskTitle: string;
|
|
11
|
+
taskScope: string;
|
|
12
|
+
taskExpected: string;
|
|
13
|
+
taskFromFile: string;
|
|
14
|
+
taskPlanningRequested: string;
|
|
15
|
+
planExit: string;
|
|
16
|
+
stepControl: string;
|
|
17
|
+
stepAckSummary: string;
|
|
18
|
+
stepAdvance: string;
|
|
19
|
+
stepReviseStep: string;
|
|
20
|
+
stepReviseText: string;
|
|
21
|
+
stepComplete: string;
|
|
22
|
+
stepSummary: string;
|
|
23
|
+
planComplete: string;
|
|
24
|
+
completeSummary: string;
|
|
25
|
+
planOutcome: string;
|
|
26
|
+
outcomeUserAction: string;
|
|
27
|
+
outcomeReason: string;
|
|
28
|
+
question: string;
|
|
29
|
+
questionPrompt: string;
|
|
30
|
+
questionHeader: string;
|
|
31
|
+
questionLabel: string;
|
|
32
|
+
questionDescription: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const ZH: ToolTexts = {
|
|
36
|
+
planTask:
|
|
37
|
+
"任务生命周期。new:建计划,仅 plan 模式(build 下调用先弹窗确认切 plan;用户未明确要求规划时先弹窗选「创建计划 / 直接执行」,选直接执行即切 build 不建计划;fromFile 恢复既有计划文件接着干)。revise:请求切回 plan 模式修订当前计划(弹窗确认)。update 改名;include 追加用户批准的范围(传完整合并后的 scope);exclude 记录排除话题;abandon 显式放弃(须用户指示);list/show 查看状态与历史计划(含归档结局)。除 list/show 外必须带 expectedAttached 做乐观并发(new 传 null,其余传当前 seq);生命周期转移必须先于依赖它的写入/命令单独完成。",
|
|
38
|
+
taskTitle:
|
|
39
|
+
"new 的标题(动作+对象式,不含冒号);update 的新标题;abandon 的原因",
|
|
40
|
+
taskScope: "new 的详细范围;include 的完整合并后范围;exclude 的排除话题",
|
|
41
|
+
taskExpected: "乐观并发:当前计划 seq;new 传 null,其余动作传当前 seq",
|
|
42
|
+
taskFromFile:
|
|
43
|
+
"new 专用:恢复既有计划文件(绝对或 cwd 相对路径),以其一级标题为默认标题;文件已在 plans 目录内则原地接管,否则复制并在原文件标记「已接管」",
|
|
44
|
+
taskPlanningRequested:
|
|
45
|
+
'仅当用户明确要求规划(如"帮我规划""出个方案")时传 true,跳过「创建计划 / 直接执行」入口询问',
|
|
46
|
+
planExit:
|
|
47
|
+
"plan 模式终点:完整计划写盘且讨论收敛后调用。展示计划并请求实现授权(本会话连续 / 分步 / 留在 plan);无交互 UI 时跳过审批门自动选本会话连续实现。文件未写盘或讨论未收敛时不要调用。",
|
|
48
|
+
stepControl:
|
|
49
|
+
'分步执行控制,一次一个转移:start 批准就绪步(advance: "all" 一次授权连跑剩余步骤,遇阻塞才停);acknowledge 指认用户声明的已完成步(无需先 start);skip 跳过;revise 修订未完成步文本(同步计划文件);pause/resume 暂停恢复;cancel 取消分步(计划保留)。',
|
|
50
|
+
stepAckSummary: "acknowledge 的完成摘要",
|
|
51
|
+
stepAdvance:
|
|
52
|
+
'start 专用:默认只开始当前步;用户明确要求连续执行(如"剩下的都做完""全部继续")时传 "all",一次授权连跑剩余步骤,遇到 plan_set_outcome 记录的阻塞才停。',
|
|
53
|
+
stepReviseStep: "revise 的步骤号(默认当前就绪步)",
|
|
54
|
+
stepReviseText: "revise 的新步骤文本",
|
|
55
|
+
stepComplete:
|
|
56
|
+
"完成当前进行中的分步(仅在本步实现与适用检查完成后调用)。完成立即生效、不等待验收,绝不开始下一步。",
|
|
57
|
+
stepSummary: "本步实现与验证的简明摘要",
|
|
58
|
+
planComplete:
|
|
59
|
+
"标记整个计划完成:仅在全部批准工作与必需检查通过、或用户明确指示时调用(分步执行进行中也允许,会如实收尾)。绝不虚构未执行的检查。",
|
|
60
|
+
completeSummary: "事实性完成摘要(可选),随历史记录保留",
|
|
61
|
+
planOutcome:
|
|
62
|
+
"记录未完成结局并保持计划开放:awaiting_validation(userAction 必填:用户要执行的精确验证步骤)、blocked / waiting_for_input / still_working(reason 必填)。绝不因空闲推断成功。",
|
|
63
|
+
outcomeUserAction:
|
|
64
|
+
"awaiting_validation 必填:用户要执行的精确验证步骤(多项检查每项一个简短要点)",
|
|
65
|
+
outcomeReason: "blocked/waiting_for_input/still_working 必填:原因",
|
|
66
|
+
question:
|
|
67
|
+
"向用户提出结构化选择题,收集决策/澄清歧义;推荐选项放第一个并在 label 尾部加「(推荐)」。无交互 UI 时自动降级为文本提问。",
|
|
68
|
+
questionPrompt: "问题",
|
|
69
|
+
questionHeader: "短标题(≤12 字符)",
|
|
70
|
+
questionLabel: "选项显示文本",
|
|
71
|
+
questionDescription: "选项说明",
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const EN: ToolTexts = {
|
|
75
|
+
planTask:
|
|
76
|
+
'Plan task lifecycle. new: create a plan, plan mode only (in build mode a dialog first asks to switch; when the user has not explicitly asked for planning, it first offers "create plan / execute directly" — direct switches to build without creating a plan; fromFile resumes an existing plan file). revise: ask to switch back to plan mode to revise the current plan (confirm dialog). update renames; include appends user-approved scope (pass the full merged scope); exclude records excluded topics; abandon gives up (explicit user instruction required); list/show show status and history (with archived outcomes). Except list/show, every action requires expectedAttached for optimistic concurrency (null for new, current seq otherwise); lifecycle transitions finish before dependent writes or commands.',
|
|
77
|
+
taskTitle:
|
|
78
|
+
"title for new (action-led, no colons); new title for update; reason for abandon",
|
|
79
|
+
taskScope:
|
|
80
|
+
"detailed scope for new; full merged scope for include; excluded topic for exclude",
|
|
81
|
+
taskExpected:
|
|
82
|
+
"optimistic concurrency: current plan seq; null for new, current seq for other actions",
|
|
83
|
+
taskFromFile:
|
|
84
|
+
"new only: existing plan file (absolute or cwd-relative) to resume; title defaults to its first heading; adopted in place when already inside the plans directory, otherwise copied and the source marked superseded",
|
|
85
|
+
taskPlanningRequested:
|
|
86
|
+
'true only when the user explicitly asked to plan (e.g. "plan this for me"); skips the create/execute question',
|
|
87
|
+
planExit:
|
|
88
|
+
"plan-mode endpoint: call once the full plan is saved and the discussion has converged. Presents the plan and asks for implementation authorization (this session / step-by-step / stay in plan); without interactive UI the gate is skipped and this-session implementation is auto-approved. Never call with an unsaved file or an unsettled discussion.",
|
|
89
|
+
stepControl:
|
|
90
|
+
'Step execution control, one transition at a time: start approves the ready step (advance: "all" authorizes auto-run of the remaining steps, stopping only on blockers); acknowledge records a step the user declared done (no start needed); skip; revise rewrites an unfinished step (syncs the plan file); pause/resume; cancel (plan retained).',
|
|
91
|
+
stepAckSummary: "completion summary for acknowledge",
|
|
92
|
+
stepAdvance:
|
|
93
|
+
'start only: defaults to starting just the current step; pass "all" only when the user explicitly asked for continuous execution (e.g. "do the rest"), authorizing the remaining steps in one go; stops only on blockers recorded via plan_set_outcome.',
|
|
94
|
+
stepReviseStep: "step number for revise (defaults to the current ready step)",
|
|
95
|
+
stepReviseText: "new step text for revise",
|
|
96
|
+
stepComplete:
|
|
97
|
+
"Complete the in-progress step (only after implementing it and running its applicable checks). Takes effect immediately without waiting for acceptance; never starts the next step.",
|
|
98
|
+
stepSummary: "concise summary of this step's implementation and verification",
|
|
99
|
+
planComplete:
|
|
100
|
+
"Mark the whole plan complete: only after all approved work and required checks pass, or on explicit user instruction (also allowed during step execution; closes out truthfully). Never invent unperformed checks.",
|
|
101
|
+
completeSummary: "factual completion summary (optional), kept in history",
|
|
102
|
+
planOutcome:
|
|
103
|
+
"Record an unfinished outcome and keep the plan open: awaiting_validation (userAction required: the exact validation the user must run), blocked / waiting_for_input / still_working (reason required). Never infer success from idleness.",
|
|
104
|
+
outcomeUserAction:
|
|
105
|
+
"required for awaiting_validation: the exact validation steps the user must run (one short bullet per check)",
|
|
106
|
+
outcomeReason:
|
|
107
|
+
"required for blocked/waiting_for_input/still_working: the reason",
|
|
108
|
+
question:
|
|
109
|
+
'Ask the user structured multiple-choice questions to settle decisions or clarify ambiguity; put the recommended option first and append "(recommended)" to its label. Falls back to a text question without interactive UI.',
|
|
110
|
+
questionPrompt: "The question",
|
|
111
|
+
questionHeader: "Short header (≤12 chars)",
|
|
112
|
+
questionLabel: "Option display text",
|
|
113
|
+
questionDescription: "Option description",
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export function toolTexts(lang: Lang): ToolTexts {
|
|
117
|
+
return lang === "en" ? EN : ZH;
|
|
118
|
+
}
|
package/src/tools/index.ts
CHANGED
package/src/tools/plan-exit.ts
CHANGED
|
@@ -7,19 +7,19 @@ import type {
|
|
|
7
7
|
import { Type } from "typebox";
|
|
8
8
|
import { parseSteps } from "../core/steps.ts";
|
|
9
9
|
import type { PlanEngine } from "../engine.ts";
|
|
10
|
+
import { toolTexts } from "./descriptions.ts";
|
|
10
11
|
|
|
11
12
|
const Params = Type.Object({});
|
|
12
13
|
|
|
13
|
-
const HERE = "
|
|
14
|
-
const STEPWISE = "
|
|
15
|
-
const STAY = "留在 plan
|
|
14
|
+
const HERE = "本会话连续实现,完成后验证";
|
|
15
|
+
const STEPWISE = "分步实现,每步等待批准";
|
|
16
|
+
const STAY = "留在 plan 模式,暂不实现";
|
|
16
17
|
|
|
17
18
|
export function registerPlanExit(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
18
19
|
pi.registerTool({
|
|
19
20
|
name: "plan_exit",
|
|
20
21
|
label: "plan exit",
|
|
21
|
-
description:
|
|
22
|
-
"plan 模式专用:完整计划写盘且讨论收敛后调用。展示计划并请求实现授权(本会话/分步/留下)。接受范围不等于开始实现之外的授权;不要在文件未保存或讨论未完成时调用。",
|
|
22
|
+
description: toolTexts(engine.config.lang).planExit,
|
|
23
23
|
parameters: Params,
|
|
24
24
|
async execute(_id, _params, _signal, _onUpdate, ctx: ExtensionToolContext) {
|
|
25
25
|
const s = engine.state;
|
|
@@ -30,7 +30,7 @@ export function registerPlanExit(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
30
30
|
if (!plan) return fail("没有当前计划。先 plan_task new。");
|
|
31
31
|
if (!fs.existsSync(plan.path)) {
|
|
32
32
|
return fail(
|
|
33
|
-
`计划文件尚未写盘:${plan.path}
|
|
33
|
+
`计划文件尚未写盘:${plan.path}。请先用文件写入工具把完整计划写入该文件,成功后调用 plan_exit。`,
|
|
34
34
|
);
|
|
35
35
|
}
|
|
36
36
|
const markdown = fs.readFileSync(plan.path, "utf8");
|
|
@@ -46,17 +46,31 @@ export function registerPlanExit(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
46
46
|
// 审阅渲染:把计划全文作为工具结果回显,模型轮结束后用户在对话里看到(无自定义 entry,减少 UI 接管)。
|
|
47
47
|
const review = `# 计划审阅:${plan.title}\n\n${markdown}`;
|
|
48
48
|
|
|
49
|
+
// 无交互 UI(print/json):与 plan_task new 入口询问一致跳过审批门,
|
|
50
|
+
// 自动批准本会话连续实现(留 plan 会让无 UI 场景永远拿不到实现授权)。
|
|
51
|
+
const headless = !ctx.hasUI;
|
|
52
|
+
const headlessNote =
|
|
53
|
+
"(无交互 UI:审批门已跳过,自动选择本会话连续实现)\n";
|
|
49
54
|
let choice: string | undefined;
|
|
50
|
-
if (
|
|
51
|
-
choice =
|
|
55
|
+
if (headless) {
|
|
56
|
+
choice = HERE;
|
|
57
|
+
} else {
|
|
58
|
+
choice = await ctx.ui.select(`请选择计划的实现方式:${plan.title}`, [
|
|
52
59
|
HERE,
|
|
53
60
|
STEPWISE,
|
|
54
61
|
STAY,
|
|
55
62
|
]);
|
|
63
|
+
if (choice === undefined) {
|
|
64
|
+
// 用户关闭/取消审批 ≠ 主动选择「留在 plan」:交回用户,让模型询问意图
|
|
65
|
+
return ok(
|
|
66
|
+
`${review}\n\n---\n审批对话框被取消:未作任何选择,仍处于 plan 模式。请询问用户想如何继续,不要自行开始实现。`,
|
|
67
|
+
);
|
|
68
|
+
}
|
|
56
69
|
}
|
|
57
|
-
|
|
70
|
+
|
|
71
|
+
if (choice === STAY) {
|
|
58
72
|
return ok(
|
|
59
|
-
`${review}\n\n---\n
|
|
73
|
+
`${review}\n\n---\n用户选择留在 plan 模式。等待用户进一步指示;不要开始实现。`,
|
|
60
74
|
);
|
|
61
75
|
}
|
|
62
76
|
|
|
@@ -71,14 +85,14 @@ export function registerPlanExit(pi: ExtensionAPI, engine: PlanEngine): void {
|
|
|
71
85
|
const r = engine.apply({ t: "exec.start", steps: parsed.steps }, ctx);
|
|
72
86
|
const n = r.state.execution?.steps.length ?? parsed.steps.length;
|
|
73
87
|
return ok(
|
|
74
|
-
`${review}\n\n---\n用户批准分步实现(共 ${n} 步),已切换到 build 模式。第 1 步就绪但未开始:向用户简述第 1 步并等待其明确批准(如"继续"),批准后调用 plan_step_control start。`,
|
|
88
|
+
`${review}\n\n---\n${headless ? headlessNote : ""}用户批准分步实现(共 ${n} 步),已切换到 build 模式。第 1 步就绪但未开始:向用户简述第 1 步并等待其明确批准(如"继续"),批准后调用 plan_step_control start。`,
|
|
75
89
|
);
|
|
76
90
|
}
|
|
77
91
|
|
|
78
|
-
//
|
|
92
|
+
// 本会话连续实现(含无 UI 自动批准)
|
|
79
93
|
engine.apply({ t: "mode.set", mode: "build" }, ctx);
|
|
80
94
|
return ok(
|
|
81
|
-
`${review}\n\n---\n用户批准在本会话实现,已切换到 build 模式。请在批准的范围内实现全部工作,按计划 ## 验证 小节执行必需检查,完成后调用 plan_complete(或 plan_set_outcome 记录未竟事项)。`,
|
|
95
|
+
`${review}\n\n---\n${headless ? headlessNote : ""}用户批准在本会话实现,已切换到 build 模式。请在批准的范围内实现全部工作,按计划 ## 验证 小节执行必需检查,完成后调用 plan_complete(或 plan_set_outcome 记录未竟事项)。`,
|
|
82
96
|
);
|
|
83
97
|
},
|
|
84
98
|
});
|