@zhushanwen/pi-goal 0.6.2-dev.0 → 0.6.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhushanwen/pi-goal",
3
- "version": "0.6.2-dev.0",
3
+ "version": "0.6.3",
4
4
  "description": "Codex-style /goal command for Pi — persistent goal-driven autonomous loop with evidence-based completion, token/time budgets, blocked detection, and steering templates.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -28,7 +28,7 @@
28
28
  "typebox": "*"
29
29
  },
30
30
  "dependencies": {
31
- "@xyz-agent/extension-protocol": "^0.3.1-dev.0"
31
+ "@xyz-agent/extension-protocol": "^0.3.1"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "@earendil-works/pi-tui": {
@@ -61,6 +61,22 @@ describe("goal_control description — 含参数结构反例(Don't 段)", ()
61
61
  });
62
62
  });
63
63
 
64
+ describe("goal_control promptGuidelines — complete/report_blocked 主动触发引导(防不主动收尾)", () => {
65
+ // promptGuidelines 进 system prompt guidelines 段(强信号),是修复 complete/report_blocked
66
+ // 「该主动调但不调」的核心载体。用源码断言锁定两条正向触发引导,防止后续重构删掉。
67
+ it("源码含 promptGuidelines 字段", () => {
68
+ expect(ADAPTER_SRC).toMatch(/promptGuidelines:\s*\[/);
69
+ });
70
+
71
+ it("promptGuidelines 含 complete 主动触发信号(proactively + objective is actually achieved)", () => {
72
+ expect(ADAPTER_SRC).toMatch(/complete:.*proactively call.*objective is actually achieved/s);
73
+ });
74
+
75
+ it("promptGuidelines 含 report_blocked 主动触发信号(proactively + ≥3 approaches)", () => {
76
+ expect(ADAPTER_SRC).toMatch(/report_blocked:.*proactively call.*≥3 distinct alternative approaches/s);
77
+ });
78
+ });
79
+
64
80
  describe("goal_control runtime 错误文案 — 含 'Correct:' 纠正正例(≥4 处)", () => {
65
81
  it("源码含 ≥4 处 'Correct:' 纠错文案(4 条 required throw 各一带正例)", () => {
66
82
  // objective/slug/evidence/reason 四条必填 throw 各应带完整 JSON 正例,
@@ -376,6 +376,18 @@ Don't:
376
376
  - complete when no goal is active — create or resume one first (fails with 'Goal mode not active').`,
377
377
  promptSnippet:
378
378
  "Use goal_control to manage the thread goal: create (with slug + objective, only when user asks) or complete (with evidence) or report_blocked (with reason, after trying alternatives).",
379
+ // promptGuidelines:进 system prompt guidelines 段(强信号位)。
380
+ // 聚焦 complete/report_blocked 的正向触发引导——这两个 action 是「该主动调但实际不调」
381
+ // 的核心症结(contextInjectionPrompt 规则 3/4 虽引导,但属 goal 活跃时才注入的 steering,
382
+ // 措辞被动;此处给 system prompt 层的常驻强信号)。
383
+ // create 不列:其劝退已在 description + promptSnippet 双重覆盖,此处第三重冗余反而稀释
384
+ // complete/report_blocked 的注意力权重(P14 约束衰减)。
385
+ promptGuidelines: [
386
+ // 全解耦下 todo 非硬前置——objective 实际达成才算(与 handleComplete「todo 由 AI 自判」一致)
387
+ "complete: proactively call when the active goal's objective is actually achieved, not merely in progress. Evidence must be concrete artifacts (files changed, tests green, commands run). Finishing all todos (incl. verification todos) is the usual readiness signal, but the real bar is the objective being met — you decide.",
388
+ // P3 数字阈值 ≥3,与 params.reason description 的 "at least 3 approaches" 双重冗余
389
+ "report_blocked: proactively call when genuinely blocked after ≥3 distinct alternative approaches — not for hard/slow work or uncertainty. State the blocker and what you tried. Do NOT silently stop or leave the goal hanging.",
390
+ ],
379
391
  executionMode: "sequential",
380
392
  parameters: GoalControlParams,
381
393
 
@@ -212,12 +212,11 @@ describe("contextInjectionPrompt", () => {
212
212
  expect(out).toContain("test objective");
213
213
  });
214
214
 
215
- it("要求建 todo(含 verification todo,FR-6/#10)", () => {
215
+ it("要求建 todo(含 verification todo)", () => {
216
216
  const state = makeState();
217
217
  const out = contextInjectionPrompt(state, 0);
218
218
  expect(out).toContain("todo tool");
219
- expect(out).toContain("verification todos");
220
- expect(out).toContain("isVerification intent");
219
+ expect(out).toContain("separate todo for verification checks");
221
220
  });
222
221
 
223
222
  it("无 goal_manager 引用(#1 清理后)", () => {
@@ -239,7 +239,7 @@ export function contextInjectionPrompt(
239
239
  `Track work with todos:\n` +
240
240
  `Before working, create todos for the task breakdown using the todo tool:\n` +
241
241
  `- Each concrete step becomes a todo item\n` +
242
- `- Include verification todos (e.g., 'run tests', 'typecheck') with isVerification intent\n` +
242
+ `- Add a separate todo for verification checks (e.g., 'run tests', 'typecheck')\n` +
243
243
  `- Track progress by updating todo status as you complete items\n` +
244
244
  planSection +
245
245
  `\n` +