pi-web-ui 0.99.0 → 0.101.0

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +90 -1
  2. package/README.md +48 -45
  3. package/README.zh-CN.md +43 -40
  4. package/bin/pi-web-ui.mjs +172 -40
  5. package/dist/server/agent-formatters.js +191 -0
  6. package/dist/server/agent-service-daemon.js +1266 -0
  7. package/dist/server/agent-service.js +9851 -11892
  8. package/dist/server/approval-default-rules.js +158 -0
  9. package/dist/server/approval-rules.js +130 -184
  10. package/dist/server/ask-user-question-tool.js +94 -0
  11. package/dist/server/attachment-store.js +38 -1
  12. package/dist/server/attachments.js +55 -0
  13. package/dist/server/bash-tool.js +83 -0
  14. package/dist/server/bg-servers.js +82 -2
  15. package/dist/server/browser-page-tool.js +207 -0
  16. package/dist/server/claim-files-tool.js +4 -4
  17. package/dist/server/client-id-utils.js +51 -0
  18. package/dist/server/client-state.js +63 -1
  19. package/dist/server/compact-context-tool.js +10 -9
  20. package/dist/server/compaction-markers.js +34 -1
  21. package/dist/server/context-budget-runner.js +43 -0
  22. package/dist/server/conversation-read-tool.js +7 -8
  23. package/dist/server/conversation-touches.js +19 -0
  24. package/dist/server/dangling-tools.js +18 -5
  25. package/dist/server/delegate-mode.js +1 -0
  26. package/dist/server/delegate-task.js +10 -14
  27. package/dist/server/dispatch-domain-handlers.js +631 -0
  28. package/dist/server/dispatch-plugin-handlers.js +300 -0
  29. package/dist/server/dsh/dsh-agent-service.js +125 -13
  30. package/dist/server/edit-soft-tool.js +10 -12
  31. package/dist/server/eval-tool.js +4 -5
  32. package/dist/server/goal-evidence.js +180 -0
  33. package/dist/server/goal-service.js +49 -9
  34. package/dist/server/hashline-engine.js +199 -32
  35. package/dist/server/index.js +212 -944
  36. package/dist/server/left-panel-running.js +115 -0
  37. package/dist/server/load-tools-tool.js +100 -0
  38. package/dist/server/lsp-tool.js +50 -28
  39. package/dist/server/marker-service.js +53 -12
  40. package/dist/server/markers/builtins/action.js +108 -0
  41. package/dist/server/markers/index.js +4 -1
  42. package/dist/server/markers-list-tool.js +34 -0
  43. package/dist/server/market-service.js +277 -0
  44. package/dist/server/mcp-bridge.js +137 -30
  45. package/dist/server/mcp-hot-reload.js +84 -27
  46. package/dist/server/mcp-manager.js +215 -0
  47. package/dist/server/message-entry-resolver.js +32 -0
  48. package/dist/server/orphan-manager.js +44 -0
  49. package/dist/server/patch-remote-catalog.js +28 -10
  50. package/dist/server/patch-tool.js +9 -8
  51. package/dist/server/persona-chain.js +63 -0
  52. package/dist/server/plan-mode.js +9 -6
  53. package/dist/server/plan-update-tool.js +96 -0
  54. package/dist/server/plugin-api-catalog.js +30 -3
  55. package/dist/server/plugin-conversation-view.js +47 -0
  56. package/dist/server/plugin-facilities.js +13 -3
  57. package/dist/server/plugin-ui-slots.js +39 -0
  58. package/dist/server/plugins.js +183 -63
  59. package/dist/server/present-files-tool.js +10 -11
  60. package/dist/server/preset-fields.js +700 -0
  61. package/dist/server/preset-share.js +1179 -0
  62. package/dist/server/process-utils.js +30 -0
  63. package/dist/server/prompt-assembler.js +80 -0
  64. package/dist/server/prompt-composer.js +23 -9
  65. package/dist/server/protocol-version.js +1 -1
  66. package/dist/server/read-tool.js +8 -10
  67. package/dist/server/resolve-global-sdk.js +80 -18
  68. package/dist/server/schedule-agent-tool.js +147 -146
  69. package/dist/server/scm-commitmsg.js +74 -0
  70. package/dist/server/sdk-origin.js +125 -37
  71. package/dist/server/serialize.js +97 -7
  72. package/dist/server/session-branch.js +367 -0
  73. package/dist/server/session-parser.js +235 -0
  74. package/dist/server/session-search.js +158 -0
  75. package/dist/server/settings-service.js +115 -84
  76. package/dist/server/skill-content-filler.js +33 -0
  77. package/dist/server/skill-tool.js +3 -4
  78. package/dist/server/subagent-handoff.js +18 -0
  79. package/dist/server/subagent-helpers.js +88 -0
  80. package/dist/server/subagents.js +15 -22
  81. package/dist/server/terminals.js +171 -91
  82. package/dist/server/tool-approval.js +3 -1
  83. package/dist/server/tool-guards.js +527 -0
  84. package/dist/server/tool-host-factories.js +217 -0
  85. package/dist/server/tool-manager.js +84 -23
  86. package/dist/server/tool-prompt-overrides.js +158 -0
  87. package/dist/server/tool-prompts.js +42 -0
  88. package/dist/server/tool-signature.js +104 -0
  89. package/dist/server/wait-subscription-scan.js +46 -1
  90. package/dist/server/workspace-snapshot.js +60 -11
  91. package/extensions/webui.ts +90 -24
  92. package/package.json +5 -3
  93. package/plugin-sdk/README.md +25 -4
  94. package/plugin-sdk/import-check.mjs +210 -0
  95. package/plugin-sdk/index.d.ts +21 -1
  96. package/plugin-sdk/index.mjs +6 -0
  97. package/plugins/catalog.json +53 -2
  98. package/themes/aetheris.css +3 -1
  99. package/themes/translucent.css +8 -1
  100. package/themes/transparent.css +9 -1
  101. package/themes/zhupi-dark.css +1 -1
  102. package/themes/zhupi.css +1 -1
  103. package/web/dist/assets/{TerminalPanel-NerrJlTS.js → TerminalPanel-DD7I5_aC.js} +2 -2
  104. package/web/dist/assets/index-CpjA1YdT.css +1 -0
  105. package/web/dist/assets/index-nKn87VuM.js +678 -0
  106. package/web/dist/index.html +2 -2
  107. package/web/dist/sw.js +1 -1
  108. package/web/dist/assets/index-BdMaGCcs.css +0 -1
  109. package/web/dist/assets/index-ByCBN4Kt.js +0 -368
@@ -497,12 +497,11 @@ export function makeEvalTool(opts) {
497
497
  name: EVAL_TOOL_NAME,
498
498
  label: "Execute code in persistent sandbox",
499
499
  description: "Execute Python or JavaScript/TypeScript code in an isolated evaluation sandbox. " +
500
- "Variables and imported modules persist across calls within the conversation. " +
501
- "Ideal for quick calculations, data transformations, algorithm verification, and inspecting outputs without creating temporary script files.",
502
- promptSnippet: "evaluate Python or JS/TS code with persistent state (default-off sandbox)",
500
+ "Variables and imported modules persist across calls within the conversation.",
501
+ promptSnippet: "run a code snippet without creating a script file",
503
502
  parameters: Type.Object({
504
503
  code: Type.String({
505
- description: "The code snippet to evaluate. Top-level variables and functions are preserved across calls.",
504
+ description: "The code snippet to evaluate. Top-level variables and functions persist across calls.",
506
505
  }),
507
506
  language: Type.Optional(Type.Unsafe({
508
507
  type: "string",
@@ -510,7 +509,7 @@ export function makeEvalTool(opts) {
510
509
  description: 'Target language: "py" for Python (default), "js" or "ts" for Node.js sandbox.',
511
510
  })),
512
511
  title: Type.Optional(Type.String({
513
- description: 'Optional short label for this step (e.g. "Calculate metrics", "Parse payload").',
512
+ description: "Optional short label for this step.",
514
513
  })),
515
514
  timeout: Type.Optional(Type.Integer({
516
515
  minimum: 1,
@@ -0,0 +1,180 @@
1
+ /**
2
+ * 目标审查的「执行证据」摘要(issue #543 §1,纯函数,无宿主/会话依赖)。
3
+ *
4
+ * 委托执行下「执行者」与「审查者」是两条会话:审查者(主对话)的输入原本只有目标、
5
+ * 轮次、执行者本轮自述和计划看板 —— 执行者实际跑过哪些命令、输出的尾部是什么,一概
6
+ * 不在输入里。远程部署类目标于是只能靠猜,或者让审查者自己重跑一遍。
7
+ *
8
+ * 这里把执行者会话里最近的工具事件(`bashExecution` 的命令与输出 / `toolResult` 的
9
+ * 工具名、参数提示与结果尾部)压成一段可直接进审查提示词的文本。只读消息数组、
10
+ * 只看尾部、全程封顶,避免把审查回合的上下文撑爆。
11
+ *
12
+ * 消息形状与 `lastToolNameOfSession` / `extractErrorSnippetFromSession` 同源:
13
+ * - `{role:"bashExecution", command, output, exitCode}`(`!` 命令与持久 shell 的转录)
14
+ * - `{role:"toolResult", toolName, toolCallId, isError, content:[{type:"text", text}]}`
15
+ * - `{role:"assistant", content:[{type:"toolCall", toolCallId, name, args}]}`(取参数提示用)
16
+ */
17
+ import { checkBashCommandDanger } from "./approval-rules.js";
18
+ const DEFAULT_MAX_ENTRIES = 8;
19
+ const DEFAULT_MAX_TAIL_CHARS = 400;
20
+ const DEFAULT_MAX_TOTAL_CHARS = 6000;
21
+ const DEFAULT_WINDOW = 200;
22
+ /** 参数提示里优先取用的字段(顺序即优先级:命令 > 路径 > 查询)。 */
23
+ const HINT_KEYS = ["command", "path", "file_path", "filePath", "pattern", "query", "url", "name"];
24
+ function isRecord(v) {
25
+ return typeof v === "object" && v !== null;
26
+ }
27
+ /** 压成一行并封顶(提示是给人/模型扫的,不做换行)。 */
28
+ /** 高危命中前缀:同一命令里的多处命中逐条列出(去重标签,#578)。 */
29
+ function dangerPrefix(hits) {
30
+ if (hits.length === 0)
31
+ return "";
32
+ const labels = [...new Set(hits.map((h) => h.label))];
33
+ return `⚠️ [${labels.join(" / ")}] `;
34
+ }
35
+ function oneLine(v, max = 120) {
36
+ if (typeof v !== "string")
37
+ return "";
38
+ const s = v.trim().replace(/\s+/g, " ");
39
+ if (!s)
40
+ return "";
41
+ return s.length > max ? `${s.slice(0, max)}…` : s;
42
+ }
43
+ /** 输出尾部(尾部才是错误所在);超出预算时留一个省略号标记。 */
44
+ function tailOf(v, max) {
45
+ if (typeof v !== "string")
46
+ return "";
47
+ const s = v.trim();
48
+ if (!s)
49
+ return "";
50
+ return s.length > max ? `…${s.slice(-max)}` : s;
51
+ }
52
+ /** toolResult 的正文(content 文本块拼接;兼容纯字符串的简化形态)。 */
53
+ function resultText(content) {
54
+ if (typeof content === "string")
55
+ return content;
56
+ if (!Array.isArray(content))
57
+ return "";
58
+ return content
59
+ .map((c) => (isRecord(c) && typeof c.text === "string" ? c.text : ""))
60
+ .filter(Boolean)
61
+ .join("\n");
62
+ }
63
+ /**
64
+ * 执行者会话消息 → 证据条目(从最新往前取,返回时按时间正序)。
65
+ * 非数组 / 形状不认识 → 空数组(旧 host / 空会话照常工作)。
66
+ */
67
+ export function collectToolEvidence(messages, opts = {}) {
68
+ if (!Array.isArray(messages) || messages.length === 0)
69
+ return [];
70
+ const maxEntries = Math.max(1, opts.maxEntries ?? DEFAULT_MAX_ENTRIES);
71
+ const maxTail = Math.max(40, opts.maxTailChars ?? DEFAULT_MAX_TAIL_CHARS);
72
+ const window = Math.max(1, opts.window ?? DEFAULT_WINDOW);
73
+ const recent = messages.slice(-window);
74
+ // toolResult 不带参数:先按 toolCallId 建索引,才能给出「跑了什么」的提示。
75
+ const calls = new Map();
76
+ for (const m of recent) {
77
+ if (!isRecord(m) || m.role !== "assistant" || !Array.isArray(m.content))
78
+ continue;
79
+ for (const b of m.content) {
80
+ if (!isRecord(b) || b.type !== "toolCall")
81
+ continue;
82
+ const id = typeof b.toolCallId === "string" ? b.toolCallId : typeof b.id === "string" ? b.id : "";
83
+ if (!id)
84
+ continue;
85
+ const args = isRecord(b.args) ? b.args : undefined;
86
+ let hint = "";
87
+ if (args) {
88
+ for (const k of HINT_KEYS) {
89
+ hint = oneLine(args[k]);
90
+ if (hint)
91
+ break;
92
+ }
93
+ }
94
+ calls.set(id, { name: typeof b.name === "string" ? b.name : "", hint });
95
+ }
96
+ }
97
+ const out = [];
98
+ for (let i = recent.length - 1; i >= 0 && out.length < maxEntries; i--) {
99
+ const m = recent[i];
100
+ if (!isRecord(m))
101
+ continue;
102
+ if (m.role === "bashExecution") {
103
+ const cmd = typeof m.command === "string" ? m.command : "";
104
+ const dangerHits = checkBashCommandDanger(cmd);
105
+ const prefix = dangerPrefix(dangerHits);
106
+ out.push({
107
+ tool: "bash",
108
+ hint: `${prefix}${oneLine(m.command)}`,
109
+ tail: tailOf(m.output, maxTail),
110
+ error: typeof m.exitCode === "number" && m.exitCode !== 0,
111
+ });
112
+ continue;
113
+ }
114
+ if (m.role !== "toolResult")
115
+ continue;
116
+ const id = typeof m.toolCallId === "string" ? m.toolCallId : "";
117
+ const call = id ? calls.get(id) : undefined;
118
+ const toolName = typeof m.toolName === "string" ? m.toolName.trim() : "";
119
+ const effectiveTool = toolName || call?.name || "tool";
120
+ let hint = call?.hint ?? "";
121
+ if (effectiveTool === "bash" && hint) {
122
+ const dangerHits = checkBashCommandDanger(hint);
123
+ if (dangerHits.length > 0) {
124
+ hint = `${dangerPrefix(dangerHits)}${hint}`;
125
+ }
126
+ }
127
+ out.push({
128
+ tool: effectiveTool,
129
+ hint,
130
+ tail: tailOf(resultText(m.content), maxTail),
131
+ error: m.isError === true,
132
+ });
133
+ }
134
+ out.reverse();
135
+ return out;
136
+ }
137
+ /**
138
+ * 证据条目 → 可直接注入审查提示词的文本块(纯文本,不带标题:标题由提示词模板按语言给)。
139
+ * 空条目返回空串(调用方据此跳过整段,不注入空标题)。
140
+ */
141
+ export function formatEvidenceDigest(entries, opts = {}) {
142
+ if (entries.length === 0)
143
+ return "";
144
+ const maxTotal = Math.max(200, opts.maxTotalChars ?? DEFAULT_MAX_TOTAL_CHARS);
145
+ const bodies = [];
146
+ let used = 0;
147
+ let omitted = 0;
148
+ // 从最新往前堆,预算用完即止 —— 丢的永远是最早的(审查关心「刚才跑了什么」)。
149
+ // 编号留到最终顺序确定后再加(否则反向堆出来的编号与显示顺序相反)。
150
+ for (let i = entries.length - 1; i >= 0; i--) {
151
+ const e = entries[i];
152
+ const head = `${e.tool}${e.error ? " (failed)" : ""}${e.hint ? `: ${e.hint}` : ""}`;
153
+ const body = e.tail ? `${head}\n out: ${e.tail}` : head;
154
+ if (used + body.length + 4 > maxTotal) {
155
+ omitted = i + 1;
156
+ break;
157
+ }
158
+ bodies.push(body);
159
+ used += body.length + 4; // +4 = 「N. 」编号占位
160
+ }
161
+ bodies.reverse();
162
+ const blocks = bodies.map((b, idx) => `${idx + 1}. ${b}`);
163
+ const head = omitted > 0 ? `(${omitted} earlier event(s) omitted for brevity)\n` : "";
164
+ return head + blocks.join("\n");
165
+ }
166
+ /** 会话 → 原始消息数组(与 `lastToolNameOfSession` 同口径;读不到即空数组)。 */
167
+ export function sessionMessagesOf(session) {
168
+ try {
169
+ const s = session;
170
+ const msgs = s?.messages ?? s?.agent?.state?.messages;
171
+ return Array.isArray(msgs) ? msgs : [];
172
+ }
173
+ catch {
174
+ return [];
175
+ }
176
+ }
177
+ /** 一步到位:会话消息 → 证据文本(空会话/空证据返回空串)。 */
178
+ export function buildEvidenceDigest(messages, opts = {}) {
179
+ return formatEvidenceDigest(collectToolEvidence(messages, opts), opts);
180
+ }
@@ -1163,7 +1163,7 @@ export class GoalService {
1163
1163
  async stopAllGoals() {
1164
1164
  let stopped = 0;
1165
1165
  // 快照迭代:await stopDelegated 期间,循环退出的回调可能增删这张表。
1166
- for (const convId of [...this.delegatedLoops.keys()]) {
1166
+ for (const convId of Array.from(this.delegatedLoops.keys())) {
1167
1167
  const conv = this.host.getConv(convId);
1168
1168
  if (!conv)
1169
1169
  continue;
@@ -1577,16 +1577,19 @@ export class GoalService {
1577
1577
  g.status = `审查中(第 ${round}${this.roundsLabel(budget)} 轮)…`;
1578
1578
  g.statusEn = `Reviewing (round ${round}${this.roundsLabel(budget)})…`;
1579
1579
  this.emitGoalStatus();
1580
- const verdict = await this.askDelegatedReview(conv, goalGeneration, round, budget, sample.output);
1580
+ const verdict = await this.askDelegatedReview(conv, goalGeneration, round, budget, sample.output, execId);
1581
1581
  if (!this.isCurrentDelegated(conv, goalGeneration))
1582
1582
  return;
1583
1583
  if (verdict === "invalid" || verdict === "timeout" || verdict === "gone") {
1584
1584
  await this.finishDelegated(conv, goalGeneration, "blocked", round, this.roleFailureText(`review-${verdict}`), goalText);
1585
1585
  return;
1586
1586
  }
1587
+ // #543 §2:空 feedback 兜底 —— verdict JSON 允许 `{"verdict":"fail","feedback":""}`,
1588
+ // 照原样传下去,下一轮执行者只会收到「上一轮审查意见:」+ 空行,白烧一轮。
1589
+ const verdictFeedback = this.ensureReviewerFeedback(verdict.verdict, verdict.feedback, feedback);
1587
1590
  // 审查结论卡:把 verdict JSON 翻译成人话框住(裸 JSON 留在流里,但不再是唯一载体)。
1588
1591
  if (this.isCurrentDelegated(conv, goalGeneration)) {
1589
- await this.pushReviewCard(conv, this.reviewCardText(verdict.verdict, round, budget, verdict.feedback), {
1592
+ await this.pushReviewCard(conv, this.reviewCardText(verdict.verdict, round, budget, verdictFeedback), {
1590
1593
  phase: "result",
1591
1594
  round,
1592
1595
  verdict: verdict.verdict,
@@ -1595,10 +1598,10 @@ export class GoalService {
1595
1598
  if (!this.isCurrentDelegated(conv, goalGeneration))
1596
1599
  return;
1597
1600
  if (verdict.verdict === "pass") {
1598
- await this.finishDelegated(conv, goalGeneration, "pass", round, verdict.feedback, goalText);
1601
+ await this.finishDelegated(conv, goalGeneration, "pass", round, verdictFeedback, goalText);
1599
1602
  return;
1600
1603
  }
1601
- feedback = verdict.feedback;
1604
+ feedback = verdictFeedback;
1602
1605
  // fail:回到循环顶部(预算检查在那里兜底)。
1603
1606
  }
1604
1607
  }
@@ -1744,7 +1747,7 @@ export class GoalService {
1744
1747
  return { output, errorSnippet: currentError };
1745
1748
  }
1746
1749
  /** 审查:把审查指令交给主对话,等 verdict;无 JSON 允许重试一次。 */
1747
- async askDelegatedReview(conv, goalGeneration, round, budget, execOutput) {
1750
+ async askDelegatedReview(conv, goalGeneration, round, budget, execOutput, execId) {
1748
1751
  for (let attempt = 0; attempt < 2; attempt++) {
1749
1752
  // 委托执行下用户仍可自由聊天:先等主对话空闲,否则审查指令会被当成
1750
1753
  // steer 插进用户自己的回合里(语义冲突)。
@@ -1755,7 +1758,7 @@ export class GoalService {
1755
1758
  return "timeout";
1756
1759
  const planDesc = this.host.describePlan?.(conv.id) ?? "";
1757
1760
  const text = attempt === 0
1758
- ? this.reviewerRoundPrompt(conv.goal.goal ?? "", round, budget, execOutput, planDesc)
1761
+ ? this.reviewerRoundPrompt(conv.goal.goal ?? "", round, budget, execOutput, planDesc, this.readExecutorEvidence(execId))
1759
1762
  : this.verdictRetryPrompt();
1760
1763
  const verdict = await this.deliverAndWait(conv, round, text);
1761
1764
  if (verdict !== "invalid")
@@ -1763,6 +1766,34 @@ export class GoalService {
1763
1766
  }
1764
1767
  return "invalid";
1765
1768
  }
1769
+ /** 执行者会话最近的工具/命令证据(#543 §1)。宿主未接线 / 读失败 / 空会话 → 空串,
1770
+ * 提示词据此跳过整段(不注入空标题、不改变老行为)。 */
1771
+ readExecutorEvidence(execId) {
1772
+ try {
1773
+ return this.host.readRoleEvidence?.(execId)?.trim() ?? "";
1774
+ }
1775
+ catch {
1776
+ return "";
1777
+ }
1778
+ }
1779
+ /** 审查结论 feedback 为空时的兜底(#543 §2;调用点见 runDelegatedLoop)。
1780
+ * - 有内容 → 原样返回(不动审查者的措辞);
1781
+ * - pass 且无说明 → 不编造通过理由,只补一句中性标注;
1782
+ * - fail 且上一轮有意见 → 沿用上一轮(标注是沿用的,避免执行者以为拿到了新指令);
1783
+ * - fail 且两轮都空 → 给一条可执行的失败说明(复核目标 + 补证据),别让执行者空转。 */
1784
+ ensureReviewerFeedback(verdict, feedback, prevFeedback) {
1785
+ const fb = feedback.trim();
1786
+ if (fb)
1787
+ return fb;
1788
+ if (verdict === "pass") {
1789
+ return pick(this.lang(), "(审查者未附说明)", "(the reviewer gave no note)", "goal.role.review.feedback.pass");
1790
+ }
1791
+ const prev = prevFeedback.trim();
1792
+ if (prev) {
1793
+ return pick(this.lang(), `(审查者本轮未给出新意见,沿用上一轮意见)\n${prev}`, `(the reviewer gave no new feedback this round — carrying the previous round's over)\n${prev}`, "goal.role.review.feedback.prev");
1794
+ }
1795
+ return pick(this.lang(), "审查者判 fail 但未给出说明。请复核目标的每一条要求,补齐尚未完成或尚未验证的部分,并在自述里给出可核验的证据(跑过的命令与输出)。", "The reviewer returned fail without a note. Re-check every requirement in the goal, finish what is unfinished or unverified, and back it up with verifiable evidence (the commands you ran and their output).", "goal.role.review.feedback.empty");
1796
+ }
1766
1797
  /** 等主对话空闲(事件驱动,不轮询);超上限返回 false。 */
1767
1798
  async waitMainIdle(conv) {
1768
1799
  const end = Date.now() + this.roleDeadline();
@@ -2056,7 +2087,7 @@ export class GoalService {
2056
2087
  ? `✅ Review round ${round}${rounds} passed${fb ? `: ${fb}` : ""}`
2057
2088
  : `❌ Review round ${round}${rounds} failed${fb ? `: ${fb}` : ""}`, "goal.role.card.result");
2058
2089
  }
2059
- reviewerRoundPrompt(goalText, round, budget, execOutput, planDesc = "") {
2090
+ reviewerRoundPrompt(goalText, round, budget, execOutput, planDesc = "", evidence = "") {
2060
2091
  const rounds = this.roundsLabel(budget);
2061
2092
  const out = execOutput.trim().slice(0, 4000);
2062
2093
  const planBlockZh = planDesc && planDesc !== "No active plan."
@@ -2065,7 +2096,16 @@ export class GoalService {
2065
2096
  const planBlockEn = planDesc && planDesc !== "No active plan."
2066
2097
  ? `\n\n# Task Plan Board\n${planDesc}\nWhen verifying, also check whether the above plan steps have been legitimately advanced or completed.`
2067
2098
  : "";
2068
- return pick(this.lang(), `你是严格、独立的验收者。只判断目标是否被完全满足:不要相信描述,去看工作区的实际状态。\n\n【目标】\n${goalText}\n\n【这是第 ${round}${rounds} 轮】${planBlockZh}\n\n【执行者本轮自述】\n${out || "(执行者本轮没有给出自述)"}\n\n你可以用只读手段核实:read / grep / scm(只读 git)/ 只读 bash(跑测试)。\n\n只输出一个 JSON 对象,不要有任何其他文本、不要代码围栏、不要复述下面的形状示例。本回合写类与派发类工具会被服务端直接拒绝(不要试)。字段:verdict 只能填 pass(目标已完全满足,一句话说明满足了什么)或 fail(未满足,给出可以直接动手改的具体待改项);feedback 是一句话说明。形状示例(不要照抄尖括号里的占位符):\n{"verdict":"<pass|fail>","feedback":"<一句话说明>"}\n[goal-review]`, `You are a strict, independent acceptor. Judge only whether the goal is fully satisfied: do not trust the summary — inspect the actual workspace state.\n\n# Goal\n${goalText}\n\n# This is round ${round}${rounds}${planBlockEn}\n\n# Executor's summary this round\n${out || "(the executor produced no summary)"}\n\nYou may verify with read-only means: read / grep / scm (read-only git) / read-only bash (run tests).\n\nReply with ONLY one JSON object — no other text, no code fences, do not echo the shape example below. Write and dispatch tools are blocked by the server during this round — do not try them. Fields: verdict must be pass (goal fully satisfied, say what in one sentence) or fail (not satisfied, give concrete items the executor must fix); feedback is one short sentence. Shape example (do not copy the placeholders in angle brackets):\n{"verdict":"<pass|fail>","feedback":"<one sentence>"}\n[goal-review]`, "goal.role.review");
2099
+ // #543 §1:执行者的工具/命令证据(服务端自动采集)。只保留输出尾部、可能被截断 ——
2100
+ // 契约里写明这一点,免得审查者把「没看到」读成「没发生」。
2101
+ const ev = evidence.trim();
2102
+ const evidenceBlockZh = ev
2103
+ ? `\n\n【执行者最近的工具与命令证据(服务端自动采集,只保留输出尾部,可能被截断)】\n${ev}`
2104
+ : "";
2105
+ const evidenceBlockEn = ev
2106
+ ? `\n\n# Executor's recent tool & command evidence (auto-collected, output tails only, may be truncated)\n${ev}`
2107
+ : "";
2108
+ return pick(this.lang(), `你是严格、独立的验收者。只判断目标是否被完全满足:不要相信描述,去看工作区的实际状态。\n\n【目标】\n${goalText}\n\n【这是第 ${round}${rounds} 轮】${planBlockZh}\n\n【执行者本轮自述】\n${out || "(执行者本轮没有给出自述)"}${evidenceBlockZh}\n\n你可以用只读手段核实:read / grep / scm(只读 git)/ 只读 bash(跑测试)。\n\n判定口径:\n- 只判【执行者本轮自述】里**声称已完成**的条目;本轮没声称完成的后续阶段不构成 fail 理由(目标写成「完成阶段 3 并收尾后续」也不代表这一轮要做完所有阶段)。\n- 忽略与目标无关的本地改动(其它项目的补丁、工具/模型配置、临时文件)。\n- 声称完成但自述与证据里都没有对应命令输出或文件证据的,必须 fail,并点名缺哪条命令的输出。\n- feedback 不得为空:fail 时必须给出可以直接动手改的具体待改项。\n\n只输出一个 JSON 对象,不要有任何其他文本、不要代码围栏、不要复述下面的形状示例。本回合写类与派发类工具会被服务端直接拒绝(不要试)。字段:verdict 只能填 pass(目标已完全满足,一句话说明满足了什么)或 fail(未满足,给出可以直接动手改的具体待改项);feedback 是一句话说明。形状示例(不要照抄尖括号里的占位符):\n{"verdict":"<pass|fail>","feedback":"<一句话说明>"}\n[goal-review]`, `You are a strict, independent acceptor. Judge only whether the goal is fully satisfied: do not trust the summary — inspect the actual workspace state.\n\n# Goal\n${goalText}\n\n# This is round ${round}${rounds}${planBlockEn}\n\n# Executor's summary this round\n${out || "(the executor produced no summary)"}${evidenceBlockEn}\n\nYou may verify with read-only means: read / grep / scm (read-only git) / read-only bash (run tests).\n\nJudging rules:\n- Judge only the items the executor's summary **claims to have completed this round**; later phases it did not claim this round are NOT grounds for fail (a goal phrased as "finish phase 3 and wrap up the rest" does not mean all phases must land this round).\n- Ignore local changes unrelated to the goal (other projects' patches, tool/model settings, scratch files).\n- If a claimed item has no matching command output or file evidence in the summary or the evidence above, you MUST fail and name which command's output is missing.\n- feedback must not be empty: on fail, give concrete items the executor can act on directly.\n\nReply with ONLY one JSON object — no other text, no code fences, do not echo the shape example below. Write and dispatch tools are blocked by the server during this round — do not try them. Fields: verdict must be pass (goal fully satisfied, say what in one sentence) or fail (not satisfied, give concrete items the executor must fix); feedback is one short sentence. Shape example (do not copy the placeholders in angle brackets):\n{"verdict":"<pass|fail>","feedback":"<one sentence>"}\n[goal-review]`, "goal.role.review");
2069
2109
  }
2070
2110
  verdictRetryPrompt() {
2071
2111
  return pick(this.lang(), `你上一条回复没有给出约定的 JSON。现在只回一个 JSON 对象,不要有任何其他文本或代码围栏:\n{"verdict":"pass|fail","feedback":"…"}\n[goal-review]`, `Your last reply did not contain the required JSON. Reply with ONLY one JSON object now — no other text, no code fences:\n{"verdict":"pass|fail","feedback":"..."}\n[goal-review]`, "goal.role.review.retry");