@opengsd/gsd-pi 1.1.1-dev.74e8dd1 → 1.1.1-dev.9bb7453
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/dist/cli.js +3 -2
- package/dist/help-text.js +10 -6
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +495 -0
- package/dist/resources/extensions/browser-tools/engine/selection.js +16 -0
- package/dist/resources/extensions/browser-tools/extension-manifest.json +2 -2
- package/dist/resources/extensions/browser-tools/index.js +57 -9
- package/dist/resources/extensions/browser-tools/package.json +5 -1
- package/dist/resources/extensions/gsd/auto/orchestrator.js +0 -1
- package/dist/resources/extensions/gsd/auto-dashboard.js +77 -13
- package/dist/resources/extensions/gsd/auto-dispatch.js +5 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +21 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +59 -22
- package/dist/resources/extensions/gsd/auto-runtime-state.js +3 -0
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +1 -1
- package/dist/resources/extensions/gsd/auto.js +9 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +4 -4
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +9 -5
- package/dist/resources/extensions/gsd/browser-evidence.js +29 -2
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +2 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +76 -11
- package/dist/resources/extensions/gsd/commands-mcp-status.js +2 -1
- package/dist/resources/extensions/gsd/dashboard-overlay.js +21 -7
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +2 -2
- package/dist/resources/extensions/gsd/escalation.js +4 -4
- package/dist/resources/extensions/gsd/forensics.js +74 -2
- package/dist/resources/extensions/gsd/gsd-db.js +5 -2
- package/dist/resources/extensions/gsd/guided-flow.js +29 -68
- package/dist/resources/extensions/gsd/mcp-project-config.js +9 -76
- package/dist/resources/extensions/gsd/memory-store.js +4 -1
- package/dist/resources/extensions/gsd/post-unit-hooks.js +9 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +39 -0
- package/dist/resources/extensions/gsd/prompt-loader.js +7 -0
- package/dist/resources/extensions/gsd/prompts/forensics.md +61 -1
- package/dist/resources/extensions/gsd/prompts/gate-evaluate.md +3 -1
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +3 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reactive-execute.md +3 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +40 -22
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
- package/dist/resources/extensions/gsd/rule-registry.js +428 -52
- package/dist/resources/extensions/gsd/state.js +2 -2
- package/dist/resources/extensions/gsd/templates/plan.md +3 -1
- package/dist/resources/extensions/gsd/tools/complete-slice.js +15 -1
- package/dist/resources/extensions/gsd/tools/complete-task.js +11 -1
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +46 -16
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +51 -14
- package/dist/resources/extensions/gsd/verdict-parser.js +59 -15
- package/dist/resources/extensions/gsd/verification-gate.js +72 -1
- package/dist/resources/extensions/shared/gsd-browser-cli.js +145 -0
- package/dist/rtk.d.ts +7 -1
- package/dist/rtk.js +27 -11
- package/dist/update-check.d.ts +15 -1
- package/dist/update-check.js +87 -12
- package/dist/update-cmd.d.ts +1 -0
- package/dist/update-cmd.js +53 -2
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +7 -7
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +7 -7
- package/dist/web/standalone/.next/server/chunks/8357.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/package.json +4 -2
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/agent-session.d.ts +9 -0
- package/packages/gsd-agent-core/dist/agent-session.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/agent-session.js +32 -0
- package/packages/gsd-agent-core/dist/agent-session.js.map +1 -1
- package/packages/gsd-agent-core/dist/index.d.ts +1 -0
- package/packages/gsd-agent-core/dist/index.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/index.js +1 -0
- package/packages/gsd-agent-core/dist/index.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-compaction.d.ts +2 -0
- package/packages/gsd-agent-core/dist/session/agent-session-compaction.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-compaction.js +8 -2
- package/packages/gsd-agent-core/dist/session/agent-session-compaction.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts +7 -0
- package/packages/gsd-agent-core/dist/session/agent-session-host.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-host.js.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js +69 -1
- package/packages/gsd-agent-core/dist/session/agent-session-prompt.js.map +1 -1
- package/packages/gsd-agent-core/dist/turn-latency.d.ts +47 -0
- package/packages/gsd-agent-core/dist/turn-latency.d.ts.map +1 -0
- package/packages/gsd-agent-core/dist/turn-latency.js +123 -0
- package/packages/gsd-agent-core/dist/turn-latency.js.map +1 -0
- package/packages/gsd-agent-core/package.json +6 -6
- package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.d.ts +21 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.d.ts.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.js +213 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/__prototype__/gsd-widget-prototype.js.map +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +20 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +7 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.js +6 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-command-handlers.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -1
- package/packages/mcp-server/dist/remote-questions.js +23 -9
- package/packages/mcp-server/dist/remote-questions.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +2 -2
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +3 -3
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +38 -0
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +5 -1
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +2 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +3 -0
- package/packages/pi-agent-core/dist/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/types.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/api-registry.d.ts +2 -0
- package/packages/pi-ai/dist/api-registry.d.ts.map +1 -1
- package/packages/pi-ai/dist/api-registry.js +23 -0
- package/packages/pi-ai/dist/api-registry.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +68 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +72 -4
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/stream.js +6 -6
- package/packages/pi-ai/dist/stream.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +2 -2
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +1 -1
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +579 -0
- package/src/resources/extensions/browser-tools/engine/selection.ts +19 -0
- package/src/resources/extensions/browser-tools/extension-manifest.json +2 -2
- package/src/resources/extensions/browser-tools/index.ts +60 -9
- package/src/resources/extensions/browser-tools/package.json +5 -1
- package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +35 -0
- package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +33 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +0 -1
- package/src/resources/extensions/gsd/auto-dashboard.ts +82 -14
- package/src/resources/extensions/gsd/auto-dispatch.ts +5 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +28 -2
- package/src/resources/extensions/gsd/auto-prompts.ts +93 -15
- package/src/resources/extensions/gsd/auto-runtime-state.ts +4 -0
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +1 -1
- package/src/resources/extensions/gsd/auto.ts +12 -2
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +4 -4
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +9 -5
- package/src/resources/extensions/gsd/browser-evidence.ts +26 -2
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +2 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +76 -11
- package/src/resources/extensions/gsd/commands-mcp-status.ts +2 -1
- package/src/resources/extensions/gsd/dashboard-overlay.ts +28 -7
- package/src/resources/extensions/gsd/docs/preferences-reference.md +8 -0
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +2 -2
- package/src/resources/extensions/gsd/escalation.ts +4 -4
- package/src/resources/extensions/gsd/forensics.ts +99 -5
- package/src/resources/extensions/gsd/gsd-db.ts +5 -2
- package/src/resources/extensions/gsd/guided-flow.ts +90 -82
- package/src/resources/extensions/gsd/mcp-project-config.ts +13 -78
- package/src/resources/extensions/gsd/memory-store.ts +4 -1
- package/src/resources/extensions/gsd/post-unit-hooks.ts +14 -1
- package/src/resources/extensions/gsd/preferences-validation.ts +36 -0
- package/src/resources/extensions/gsd/prompt-loader.ts +8 -0
- package/src/resources/extensions/gsd/prompts/forensics.md +61 -1
- package/src/resources/extensions/gsd/prompts/gate-evaluate.md +3 -1
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +3 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/reactive-execute.md +3 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +40 -22
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
- package/src/resources/extensions/gsd/rule-registry.ts +558 -58
- package/src/resources/extensions/gsd/rule-types.ts +2 -0
- package/src/resources/extensions/gsd/state.ts +2 -2
- package/src/resources/extensions/gsd/templates/plan.md +3 -1
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +105 -4
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/browser-evidence.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/dashboard-overlay.test.ts +45 -0
- package/src/resources/extensions/gsd/tests/deep-planning-mode-dispatch.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/doctor-runtime-checks.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/escalation.test.ts +16 -27
- package/src/resources/extensions/gsd/tests/forensics-issue-routing.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/forensics-prompt-rendering.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/forensics-tool-scope.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts +40 -1
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +86 -0
- package/src/resources/extensions/gsd/tests/guided-flow.test.ts +12 -9
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +66 -10
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +39 -8
- package/src/resources/extensions/gsd/tests/new-milestone-discuss-routing.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/post-unit-hooks.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/post-unit-retry-on-orchestrator-bridge.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +43 -1
- package/src/resources/extensions/gsd/tests/prompt-loader-extension-dir.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +7 -8
- package/src/resources/extensions/gsd/tests/rule-registry.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/tool-param-optionality.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/validate-milestone-prompt-verification-classes.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +133 -0
- package/src/resources/extensions/gsd/tests/verification-gate.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +130 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +14 -1
- package/src/resources/extensions/gsd/tools/complete-task.ts +20 -2
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +46 -15
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +63 -15
- package/src/resources/extensions/gsd/types.ts +69 -5
- package/src/resources/extensions/gsd/verdict-parser.ts +54 -13
- package/src/resources/extensions/gsd/verification-gate.ts +87 -1
- package/src/resources/extensions/shared/gsd-browser-cli.ts +172 -0
- /package/dist/web/standalone/.next/static/{eRWf-RI9bzbrwEurm_3uI → jBtwT9v1u2lUA3UEOy_ZH}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{eRWf-RI9bzbrwEurm_3uI → jBtwT9v1u2lUA3UEOy_ZH}/_ssgManifest.js +0 -0
|
@@ -44,14 +44,26 @@ function setGsdHeadless(t: { after: (fn: () => void) => void }): void {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
function unsetGsdHeadless(t: { after: (fn: () => void) => void }): void {
|
|
48
|
+
const previous = process.env.GSD_HEADLESS;
|
|
49
|
+
delete process.env.GSD_HEADLESS;
|
|
50
|
+
t.after(() => {
|
|
51
|
+
if (previous === undefined) delete process.env.GSD_HEADLESS;
|
|
52
|
+
else process.env.GSD_HEADLESS = previous;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
47
56
|
test("auto-dispatch passes structuredQuestionsAvailable=true into discuss-milestone prompt", async (t) => {
|
|
48
57
|
const tmp = mkdtempSync(join(tmpdir(), "gsd-discuss-milestone-structured-"));
|
|
49
58
|
t.after(() => rmSync(tmp, { recursive: true, force: true }));
|
|
50
59
|
|
|
60
|
+
unsetGsdHeadless(t);
|
|
61
|
+
|
|
51
62
|
const result = await resolveDispatch(makeContext(tmp, "needs-discussion", "true"));
|
|
52
63
|
|
|
53
64
|
assert.equal(result.action, "dispatch");
|
|
54
65
|
assert.equal(result.unitType, "discuss-milestone");
|
|
66
|
+
assert.equal(result.pauseAfterDispatch, true);
|
|
55
67
|
assert.match(
|
|
56
68
|
result.prompt,
|
|
57
69
|
/\*\*Structured questions available: true\*\*/,
|
|
@@ -62,10 +74,13 @@ test("auto-dispatch preserves structuredQuestionsAvailable=false for discuss-mil
|
|
|
62
74
|
const tmp = mkdtempSync(join(tmpdir(), "gsd-discuss-milestone-plain-"));
|
|
63
75
|
t.after(() => rmSync(tmp, { recursive: true, force: true }));
|
|
64
76
|
|
|
77
|
+
unsetGsdHeadless(t);
|
|
78
|
+
|
|
65
79
|
const result = await resolveDispatch(makeContext(tmp, "pre-planning", "false"));
|
|
66
80
|
|
|
67
81
|
assert.equal(result.action, "dispatch");
|
|
68
82
|
assert.equal(result.unitType, "discuss-milestone");
|
|
83
|
+
assert.equal(result.pauseAfterDispatch, true);
|
|
69
84
|
assert.match(
|
|
70
85
|
result.prompt,
|
|
71
86
|
/\*\*Structured questions available: false\*\*/,
|
|
@@ -82,6 +97,7 @@ test("auto-dispatch uses discuss-headless prompt when GSD_HEADLESS is set", asyn
|
|
|
82
97
|
|
|
83
98
|
assert.equal(result.action, "dispatch");
|
|
84
99
|
assert.equal(result.unitType, "discuss-milestone");
|
|
100
|
+
assert.equal(result.pauseAfterDispatch, false);
|
|
85
101
|
assert.match(result.prompt, /This is a \*\*headless\*\* flow/);
|
|
86
102
|
assert.doesNotMatch(result.prompt, /\*\*Structured questions available: true\*\*/);
|
|
87
103
|
});
|
|
@@ -96,10 +112,24 @@ test("auto-dispatch uses discuss-headless prompt for needs-discussion when GSD_H
|
|
|
96
112
|
|
|
97
113
|
assert.equal(result.action, "dispatch");
|
|
98
114
|
assert.equal(result.unitType, "discuss-milestone");
|
|
115
|
+
assert.equal(result.pauseAfterDispatch, false);
|
|
99
116
|
assert.match(result.prompt, /This is a \*\*headless\*\* flow/);
|
|
100
117
|
assert.doesNotMatch(result.prompt, /\*\*Structured questions available: true\*\*/);
|
|
101
118
|
});
|
|
102
119
|
|
|
120
|
+
test("auto-dispatch pauses after execution-entry discuss-milestone recovery", async (t) => {
|
|
121
|
+
const tmp = mkdtempSync(join(tmpdir(), "gsd-discuss-milestone-executing-"));
|
|
122
|
+
t.after(() => rmSync(tmp, { recursive: true, force: true }));
|
|
123
|
+
|
|
124
|
+
unsetGsdHeadless(t);
|
|
125
|
+
|
|
126
|
+
const result = await resolveDispatch(makeContext(tmp, "executing", "true"));
|
|
127
|
+
|
|
128
|
+
assert.equal(result.action, "dispatch");
|
|
129
|
+
assert.equal(result.unitType, "discuss-milestone");
|
|
130
|
+
assert.equal(result.pauseAfterDispatch, true);
|
|
131
|
+
});
|
|
132
|
+
|
|
103
133
|
test("auto-dispatch uses discuss-headless prompt for executing when GSD_HEADLESS is set", async (t) => {
|
|
104
134
|
const tmp = mkdtempSync(join(tmpdir(), "gsd-discuss-milestone-headless-"));
|
|
105
135
|
t.after(() => rmSync(tmp, { recursive: true, force: true }));
|
|
@@ -110,6 +140,7 @@ test("auto-dispatch uses discuss-headless prompt for executing when GSD_HEADLESS
|
|
|
110
140
|
|
|
111
141
|
assert.equal(result.action, "dispatch");
|
|
112
142
|
assert.equal(result.unitType, "discuss-milestone");
|
|
143
|
+
assert.equal(result.pauseAfterDispatch, false);
|
|
113
144
|
assert.match(result.prompt, /This is a \*\*headless\*\* flow/);
|
|
114
145
|
assert.doesNotMatch(result.prompt, /\*\*Structured questions available: true\*\*/);
|
|
115
146
|
});
|
|
@@ -45,3 +45,30 @@ test("doctor fix respects git.manage_gitignore false (#4161)", async (t) => {
|
|
|
45
45
|
assert.equal(readFileSync(join(dir, ".gitignore"), "utf-8"), "node_modules/\n");
|
|
46
46
|
assert.equal(existsSync(join(dir, ".gsd", "PREFERENCES.md")), true);
|
|
47
47
|
});
|
|
48
|
+
|
|
49
|
+
test("doctor fix resets run-uat counters at the dispatch cap", async (t) => {
|
|
50
|
+
const dir = createGitProject();
|
|
51
|
+
t.after(() => rmSync(dir, { recursive: true, force: true }));
|
|
52
|
+
|
|
53
|
+
const runtimeDir = join(dir, ".gsd", "runtime");
|
|
54
|
+
mkdirSync(runtimeDir, { recursive: true });
|
|
55
|
+
const counterPath = join(runtimeDir, "uat-count-M002-S01.json");
|
|
56
|
+
writeFileSync(
|
|
57
|
+
counterPath,
|
|
58
|
+
JSON.stringify({ count: 3, updatedAt: "2026-06-02T19:40:23.289Z" }) + "\n",
|
|
59
|
+
"utf-8",
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const detect = await runGSDDoctor(dir);
|
|
63
|
+
const issue = detect.issues.find((candidate) => candidate.code === "uat_retry_exhausted");
|
|
64
|
+
assert.ok(issue, "doctor reports the exhausted UAT retry counter at the dispatch cap");
|
|
65
|
+
assert.equal(issue.unitId, "M002/S01");
|
|
66
|
+
assert.match(issue.message, /3 attempt\(s\)/);
|
|
67
|
+
|
|
68
|
+
const fixed = await runGSDDoctor(dir, { fix: true, scope: "M002/S02" });
|
|
69
|
+
assert.ok(
|
|
70
|
+
fixed.fixesApplied.some((fix) => fix.includes("reset exhausted run-uat retry counter for M002/S01")),
|
|
71
|
+
"doctor --fix resets the blocked counter even when the current displayed scope has advanced",
|
|
72
|
+
);
|
|
73
|
+
assert.equal(existsSync(counterPath), false);
|
|
74
|
+
});
|
|
@@ -106,7 +106,7 @@ test("ADR-011 P2: writeEscalationArtifact persists canonical JSON at tasks/T##-E
|
|
|
106
106
|
assert.equal(row?.escalation_artifact_path, path);
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
test("ADR-011 P2: continueWithDefault=true sets awaiting_review (NOT pending)
|
|
109
|
+
test("ADR-011 P2: continueWithDefault=true sets awaiting_review (NOT pending)", (t) => {
|
|
110
110
|
const base = makeBase();
|
|
111
111
|
t.after(() => cleanup(base));
|
|
112
112
|
seedCompletedTask(base, "T04");
|
|
@@ -126,7 +126,7 @@ test("ADR-011 P2: continueWithDefault=true sets awaiting_review (NOT pending)
|
|
|
126
126
|
assert.equal(row?.escalation_awaiting_review, 1);
|
|
127
127
|
});
|
|
128
128
|
|
|
129
|
-
test("ADR-011 P2: detectPendingEscalation
|
|
129
|
+
test("ADR-011 P2: detectPendingEscalation pauses on unresolved awaiting_review escalations", (t) => {
|
|
130
130
|
const base = makeBase();
|
|
131
131
|
t.after(() => cleanup(base));
|
|
132
132
|
seedCompletedTask(base, "T01");
|
|
@@ -147,7 +147,7 @@ test("ADR-011 P2: detectPendingEscalation returns only pause-scoped escalations"
|
|
|
147
147
|
|
|
148
148
|
const tasks = [getTask("M001", "S01", "T01")!, getTask("M001", "S01", "T02")!];
|
|
149
149
|
const id = detectPendingEscalation(tasks, base);
|
|
150
|
-
assert.equal(id, "
|
|
150
|
+
assert.equal(id, "T01", "unresolved awaiting_review escalations must pause before later tasks");
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
test("ADR-011 P2: resolveEscalation(accept) marks artifact + clears flags", (t) => {
|
|
@@ -677,26 +677,19 @@ test("ADR-011 P3 #23: concurrent escalations across parallel slices — only the
|
|
|
677
677
|
assert.equal(detectPendingEscalation([getTask("M001", "S02", "T70")!], base), null);
|
|
678
678
|
});
|
|
679
679
|
|
|
680
|
-
test("ADR-011 P3 #24: continueWithDefault
|
|
681
|
-
// Timeline this test pins
|
|
682
|
-
// elapsed wall-clock where the loop keeps running after T80's
|
|
683
|
-
// continueWithDefault=true write):
|
|
680
|
+
test("ADR-011 P3 #24: continueWithDefault requires explicit response before override injection", (t) => {
|
|
681
|
+
// Timeline this test pins:
|
|
684
682
|
//
|
|
685
|
-
// 1. T80 writes continueWithDefault=true → awaiting_review=1
|
|
686
|
-
//
|
|
687
|
-
//
|
|
688
|
-
//
|
|
689
|
-
// 3. The very next prompt build (for T83) claims the override exactly
|
|
690
|
-
// once. T81/T82 are in the past — they must not retroactively
|
|
691
|
-
// receive the injection even though they ran during the window.
|
|
683
|
+
// 1. T80 writes continueWithDefault=true → awaiting_review=1.
|
|
684
|
+
// 2. Scheduler detection pauses on T80 instead of treating silence as
|
|
685
|
+
// consent. Prompt injection still waits until the user responds.
|
|
686
|
+
// 3. After the response, the next prompt build claims the override once.
|
|
692
687
|
const base = makeBase();
|
|
693
688
|
t.after(() => cleanup(base));
|
|
694
689
|
seedCompletedTask(base, "T80");
|
|
695
|
-
seedCompletedTask(base, "T81");
|
|
696
|
-
seedCompletedTask(base, "T82");
|
|
697
690
|
seedCompletedTask(base, "T83");
|
|
698
691
|
|
|
699
|
-
// Phase 1 — T80 escalates with continueWithDefault=true
|
|
692
|
+
// Phase 1 — T80 escalates with continueWithDefault=true.
|
|
700
693
|
writeEscalationArtifact(base, buildEscalationArtifact({
|
|
701
694
|
taskId: "T80", sliceId: "S01", milestoneId: "M001",
|
|
702
695
|
question: "Which cache strategy?", options: sampleOptions,
|
|
@@ -704,21 +697,17 @@ test("ADR-011 P3 #24: continueWithDefault timeout — late user response injects
|
|
|
704
697
|
continueWithDefault: true,
|
|
705
698
|
}));
|
|
706
699
|
|
|
707
|
-
// T80 is awaiting_review (not pending)
|
|
700
|
+
// T80 is awaiting_review (not pending), but scheduler detection still
|
|
701
|
+
// pauses until the user explicitly responds.
|
|
708
702
|
assert.equal(getTask("M001", "S01", "T80")?.escalation_awaiting_review, 1);
|
|
709
703
|
assert.equal(getTask("M001", "S01", "T80")?.escalation_pending, 0);
|
|
710
|
-
assert.equal(detectPendingEscalation([getTask("M001", "S01", "T80")!], base),
|
|
704
|
+
assert.equal(detectPendingEscalation([getTask("M001", "S01", "T80")!], base), "T80");
|
|
711
705
|
|
|
712
|
-
//
|
|
706
|
+
// Prompt injection must still wait for a response.
|
|
713
707
|
assert.equal(
|
|
714
708
|
claimOverrideForInjection(base, "M001", "S01"),
|
|
715
709
|
null,
|
|
716
|
-
"
|
|
717
|
-
);
|
|
718
|
-
assert.equal(
|
|
719
|
-
claimOverrideForInjection(base, "M001", "S01"),
|
|
720
|
-
null,
|
|
721
|
-
"T82's prompt build must also not claim the unresolved awaiting_review",
|
|
710
|
+
"unresolved awaiting_review must not be claimed as a default response",
|
|
722
711
|
);
|
|
723
712
|
|
|
724
713
|
// The response window remains open across N tasks — still no override applied.
|
|
@@ -728,7 +717,7 @@ test("ADR-011 P3 #24: continueWithDefault timeout — late user response injects
|
|
|
728
717
|
"applied_at must stay null throughout the response window",
|
|
729
718
|
);
|
|
730
719
|
|
|
731
|
-
// Phase 2 — user responds
|
|
720
|
+
// Phase 2 — user responds with a different option than the recommendation.
|
|
732
721
|
const resolveResult = resolveEscalation(
|
|
733
722
|
base, "M001", "S01", "T80", "B", "after reviewing, B is the call",
|
|
734
723
|
);
|
|
@@ -41,3 +41,23 @@ test("forensics prompt routes issue creation through bash tool, not github_issue
|
|
|
41
41
|
"Prompt must instruct use of the bash tool for issue creation",
|
|
42
42
|
);
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
test("forensics prompt provides paste-once fallback when bash is unavailable", () => {
|
|
46
|
+
const prompt = readPrompt("forensics");
|
|
47
|
+
|
|
48
|
+
assert.match(
|
|
49
|
+
prompt,
|
|
50
|
+
/If `bash` is unavailable/i,
|
|
51
|
+
"Prompt must branch when bash cannot be activated",
|
|
52
|
+
);
|
|
53
|
+
assert.match(
|
|
54
|
+
prompt,
|
|
55
|
+
/paste-once shell script/i,
|
|
56
|
+
"Prompt must provide a user-runnable fallback instead of an impossible tool call",
|
|
57
|
+
);
|
|
58
|
+
assert.match(
|
|
59
|
+
prompt,
|
|
60
|
+
/Searching closed issues for possible duplicates/i,
|
|
61
|
+
"Fallback script must preserve the duplicate-search step for the user",
|
|
62
|
+
);
|
|
63
|
+
});
|
|
@@ -24,13 +24,16 @@ test("forensics prompt renders compact investigation and issue routing guidance"
|
|
|
24
24
|
forensicData: "stuck-detected event for execute-task/M001/S01/T01",
|
|
25
25
|
gsdSourceDir: process.env.GSD_TEST_WORKSPACE_ROOT ?? process.cwd(),
|
|
26
26
|
dedupSection: "No duplicate issue found.",
|
|
27
|
+
toolingSection: "## Filing Tool Availability\n\n- `bash`: available\n- `write`: available",
|
|
27
28
|
});
|
|
28
29
|
|
|
29
30
|
assert.match(prompt, /Investigation Protocol/);
|
|
31
|
+
assert.match(prompt, /Filing Tool Availability/);
|
|
30
32
|
assert.match(prompt, /gsd_milestone_status/);
|
|
31
33
|
assert.match(prompt, /sqlite3 .gsd\/gsd.db/);
|
|
32
34
|
assert.match(prompt, /gh issue create --repo open-gsd\/gsd-pi/);
|
|
33
35
|
assert.match(prompt, /Do NOT use the `github_issues` tool/);
|
|
36
|
+
assert.match(prompt, /paste-once shell script/);
|
|
34
37
|
assert.match(prompt, /Redaction Rules/);
|
|
35
38
|
assert.doesNotMatch(prompt, /\{\{[a-zA-Z][a-zA-Z0-9_]*\}\}/);
|
|
36
39
|
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Project/App: gsd-pi
|
|
2
|
+
// File Purpose: Verifies /gsd forensics scopes issue-filing tools for its queued turn.
|
|
3
|
+
|
|
4
|
+
import test from "node:test";
|
|
5
|
+
import assert from "node:assert/strict";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
applyForensicsToolScope,
|
|
9
|
+
buildForensicsToolingSection,
|
|
10
|
+
createForensicsToolScope,
|
|
11
|
+
restoreForensicsToolScope,
|
|
12
|
+
} from "../forensics.ts";
|
|
13
|
+
|
|
14
|
+
function tool(name: string): { name: string } {
|
|
15
|
+
return { name };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
test("forensics adds registered filing tools for the queued turn and restores the prior tools", () => {
|
|
19
|
+
const originalTools = ["read"];
|
|
20
|
+
let activeTools = [...originalTools];
|
|
21
|
+
const pi = {
|
|
22
|
+
getActiveTools: () => [...activeTools],
|
|
23
|
+
getAllTools: () => ["read", "bash", "write"].map(tool),
|
|
24
|
+
setActiveTools: (tools: string[]) => {
|
|
25
|
+
activeTools = [...tools];
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const scope = createForensicsToolScope(pi as any);
|
|
30
|
+
|
|
31
|
+
assert.deepEqual(scope.savedTools, originalTools);
|
|
32
|
+
assert.deepEqual(scope.activeToolsForTurn, ["read", "bash", "write"]);
|
|
33
|
+
assert.deepEqual(scope.availableFilingTools, ["bash", "write"]);
|
|
34
|
+
assert.deepEqual(scope.missingFilingTools, []);
|
|
35
|
+
assert.equal(scope.toolsChanged, true);
|
|
36
|
+
assert.deepEqual(activeTools, originalTools, "scope creation must not mutate active tools");
|
|
37
|
+
|
|
38
|
+
applyForensicsToolScope(pi as any, scope);
|
|
39
|
+
assert.deepEqual(activeTools, ["read", "bash", "write"]);
|
|
40
|
+
|
|
41
|
+
const toolingSection = buildForensicsToolingSection(scope);
|
|
42
|
+
assert.match(toolingSection, /`bash`: available/);
|
|
43
|
+
assert.match(toolingSection, /`write`: available/);
|
|
44
|
+
assert.match(toolingSection, /GitHub duplicate-check and issue-creation protocols/);
|
|
45
|
+
|
|
46
|
+
restoreForensicsToolScope(pi as any, scope);
|
|
47
|
+
assert.deepEqual(activeTools, originalTools);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("forensics tooling guidance falls back when bash is not registered", () => {
|
|
51
|
+
let activeTools = ["read"];
|
|
52
|
+
const pi = {
|
|
53
|
+
getActiveTools: () => [...activeTools],
|
|
54
|
+
getAllTools: () => ["read", "write"].map(tool),
|
|
55
|
+
setActiveTools: (tools: string[]) => {
|
|
56
|
+
activeTools = [...tools];
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const scope = createForensicsToolScope(pi as any);
|
|
61
|
+
|
|
62
|
+
assert.deepEqual(scope.availableFilingTools, ["write"]);
|
|
63
|
+
assert.deepEqual(scope.missingFilingTools, ["bash"]);
|
|
64
|
+
assert.deepEqual(scope.activeToolsForTurn, ["read", "write"]);
|
|
65
|
+
|
|
66
|
+
const toolingSection = buildForensicsToolingSection(scope);
|
|
67
|
+
assert.match(toolingSection, /`bash`: unavailable/);
|
|
68
|
+
assert.match(toolingSection, /paste-once shell script fallback/);
|
|
69
|
+
});
|
package/src/resources/extensions/gsd/tests/guided-discuss-milestone-prompt-rendering.test.ts
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
import test from "node:test";
|
|
5
5
|
import assert from "node:assert/strict";
|
|
6
|
-
import { mkdtempSync, rmSync } from "node:fs";
|
|
6
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
7
7
|
import { tmpdir } from "node:os";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import { VISION_ASK_VARIANTS } from "../vision-ask.ts";
|
|
10
|
+
import { buildDiscussMilestonePrompt } from "../auto-prompts.ts";
|
|
10
11
|
|
|
11
12
|
test("guided milestone prompt renders compact interview and context guidance", async (t) => {
|
|
12
13
|
const previousGsdHome = process.env.GSD_HOME;
|
|
@@ -47,3 +48,41 @@ test("guided milestone prompt renders compact interview and context guidance", a
|
|
|
47
48
|
assert.match(prompt, /milestone_id: M001/);
|
|
48
49
|
assert.doesNotMatch(prompt, /\{\{[a-zA-Z][a-zA-Z0-9_]*\}\}/);
|
|
49
50
|
});
|
|
51
|
+
|
|
52
|
+
test("guided milestone prompt builder preloads milestone planning context", async () => {
|
|
53
|
+
const base = mkdtempSync(join(tmpdir(), "gsd-guided-milestone-context-"));
|
|
54
|
+
try {
|
|
55
|
+
const milestonesRoot = join(base, ".gsd", "milestones");
|
|
56
|
+
const priorDir = join(milestonesRoot, "M001");
|
|
57
|
+
const currentDir = join(milestonesRoot, "M002");
|
|
58
|
+
const futureDir = join(milestonesRoot, "M003");
|
|
59
|
+
mkdirSync(priorDir, { recursive: true });
|
|
60
|
+
mkdirSync(currentDir, { recursive: true });
|
|
61
|
+
mkdirSync(futureDir, { recursive: true });
|
|
62
|
+
|
|
63
|
+
writeFileSync(join(base, ".gsd", "DECISIONS.md"), "# Decisions\n\nDECISION-SIGNAL", "utf-8");
|
|
64
|
+
writeFileSync(join(priorDir, "M001-SUMMARY.md"), "# M001 Summary\n\nPRIOR-SUMMARY-SIGNAL", "utf-8");
|
|
65
|
+
writeFileSync(join(currentDir, "M002-ROADMAP.md"), "# M002 Roadmap\n\nROADMAP-SIGNAL", "utf-8");
|
|
66
|
+
writeFileSync(join(currentDir, "M002-CONTEXT.md"), "# M002 Context\n\nCONTEXT-SIGNAL", "utf-8");
|
|
67
|
+
writeFileSync(join(currentDir, "M002-RESEARCH.md"), "# M002 Research\n\nRESEARCH-SIGNAL", "utf-8");
|
|
68
|
+
writeFileSync(join(futureDir, "M003-SUMMARY.md"), "# M003 Summary\n\nFUTURE-SUMMARY-SIGNAL", "utf-8");
|
|
69
|
+
|
|
70
|
+
const prompt = await buildDiscussMilestonePrompt("M002", "Checkout Polish", base, "true");
|
|
71
|
+
|
|
72
|
+
assert.match(prompt, /## Inlined Context \(preloaded — do not re-read these files\)/);
|
|
73
|
+
assert.match(prompt, /### Milestone Roadmap/);
|
|
74
|
+
assert.match(prompt, /ROADMAP-SIGNAL/);
|
|
75
|
+
assert.match(prompt, /### Milestone Context/);
|
|
76
|
+
assert.match(prompt, /CONTEXT-SIGNAL/);
|
|
77
|
+
assert.match(prompt, /### Milestone Research/);
|
|
78
|
+
assert.match(prompt, /RESEARCH-SIGNAL/);
|
|
79
|
+
assert.match(prompt, /### Decisions Register/);
|
|
80
|
+
assert.match(prompt, /DECISION-SIGNAL/);
|
|
81
|
+
assert.match(prompt, /### M001 Prior Milestone Summary/);
|
|
82
|
+
assert.match(prompt, /PRIOR-SUMMARY-SIGNAL/);
|
|
83
|
+
assert.doesNotMatch(prompt, /FUTURE-SUMMARY-SIGNAL/);
|
|
84
|
+
assert.match(prompt, /### Output Template: Context/);
|
|
85
|
+
} finally {
|
|
86
|
+
rmSync(base, { recursive: true, force: true });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
@@ -104,3 +104,89 @@ test("guided dispatch passes the explicit project root through model and compati
|
|
|
104
104
|
rmSync(otherRoot, { recursive: true, force: true });
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
+
|
|
108
|
+
test("guided dispatch accepts workflow MCP tools absent from parent active tool surface", async () => {
|
|
109
|
+
const explicitRoot = mkdtempSync(join(tmpdir(), "gsd-guided-mcp-surface-"));
|
|
110
|
+
const workflowPath = join(explicitRoot, "GSD-WORKFLOW.md");
|
|
111
|
+
const originalWorkflowPath = process.env.GSD_WORKFLOW_PATH;
|
|
112
|
+
const originalMcpCommand = process.env.GSD_WORKFLOW_MCP_COMMAND;
|
|
113
|
+
const notifications: string[] = [];
|
|
114
|
+
let sent = false;
|
|
115
|
+
|
|
116
|
+
const ctx = {
|
|
117
|
+
model: { provider: "claude-code", baseUrl: "local://claude-code" },
|
|
118
|
+
modelRegistry: {
|
|
119
|
+
getProviderAuthMode: () => "externalCli",
|
|
120
|
+
},
|
|
121
|
+
ui: {
|
|
122
|
+
notify: (message: string) => {
|
|
123
|
+
notifications.push(message);
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
let activeTools = [
|
|
129
|
+
"ScheduleWakeup",
|
|
130
|
+
"ToolSearch",
|
|
131
|
+
"ask_user_questions",
|
|
132
|
+
"bash",
|
|
133
|
+
"read",
|
|
134
|
+
"write",
|
|
135
|
+
];
|
|
136
|
+
|
|
137
|
+
const pi = {
|
|
138
|
+
getActiveTools: () => [...activeTools],
|
|
139
|
+
setActiveTools: (tools: string[]) => {
|
|
140
|
+
activeTools = [...tools];
|
|
141
|
+
},
|
|
142
|
+
sendMessage: () => {
|
|
143
|
+
sent = true;
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
writeFileSync(workflowPath, "# Workflow\n", "utf-8");
|
|
149
|
+
process.env.GSD_WORKFLOW_PATH = workflowPath;
|
|
150
|
+
process.env.GSD_WORKFLOW_MCP_COMMAND = "node";
|
|
151
|
+
|
|
152
|
+
await _dispatchWorkflowForTest(
|
|
153
|
+
pi as any,
|
|
154
|
+
"Discuss the milestone.",
|
|
155
|
+
"gsd-discuss",
|
|
156
|
+
ctx as any,
|
|
157
|
+
"discuss-milestone",
|
|
158
|
+
{
|
|
159
|
+
basePath: explicitRoot,
|
|
160
|
+
deps: {
|
|
161
|
+
loadPreferences: () => ({ preferences: {} }) as any,
|
|
162
|
+
selectModel: (async () => ({
|
|
163
|
+
routing: null,
|
|
164
|
+
appliedModel: {
|
|
165
|
+
provider: "claude-code",
|
|
166
|
+
id: "claude-opus-4-8",
|
|
167
|
+
baseUrl: "local://claude-code",
|
|
168
|
+
},
|
|
169
|
+
})) as any,
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
assert.equal(sent, true);
|
|
175
|
+
assert.equal(
|
|
176
|
+
notifications.some((message) => message.includes("cannot run guided flow")),
|
|
177
|
+
false,
|
|
178
|
+
);
|
|
179
|
+
} finally {
|
|
180
|
+
if (originalWorkflowPath === undefined) {
|
|
181
|
+
delete process.env.GSD_WORKFLOW_PATH;
|
|
182
|
+
} else {
|
|
183
|
+
process.env.GSD_WORKFLOW_PATH = originalWorkflowPath;
|
|
184
|
+
}
|
|
185
|
+
if (originalMcpCommand === undefined) {
|
|
186
|
+
delete process.env.GSD_WORKFLOW_MCP_COMMAND;
|
|
187
|
+
} else {
|
|
188
|
+
process.env.GSD_WORKFLOW_MCP_COMMAND = originalMcpCommand;
|
|
189
|
+
}
|
|
190
|
+
rmSync(explicitRoot, { recursive: true, force: true });
|
|
191
|
+
}
|
|
192
|
+
});
|
|
@@ -8,14 +8,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
8
8
|
|
|
9
9
|
test("guided milestone discussion callsites pass workingDirectory to loadPrompt", () => {
|
|
10
10
|
const source = readFileSync(join(__dirname, "..", "guided-flow.ts"), "utf-8");
|
|
11
|
-
const calls = [...source.matchAll(/loadPrompt\("guided-discuss-milestone",\s*\{([\s\S]*?)\}\)/g)];
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
// All guided-discuss-milestone dispatches now go through buildDiscussMilestonePrompt,
|
|
13
|
+
// which centralises the loadPrompt call and always passes workingDirectory.
|
|
14
|
+
// Verify no callsite bypasses the builder by calling loadPrompt directly.
|
|
15
|
+
const directCalls = [...source.matchAll(/loadPrompt\("guided-discuss-milestone"/g)];
|
|
16
|
+
assert.equal(
|
|
17
|
+
directCalls.length,
|
|
18
|
+
0,
|
|
19
|
+
'guided-flow.ts must not call loadPrompt("guided-discuss-milestone") directly — use buildDiscussMilestonePrompt',
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
const calls = [...source.matchAll(/\bawait buildDiscussMilestonePrompt\(/g)];
|
|
23
|
+
assert.equal(calls.length, 9, "all guided-flow guided-discuss-milestone callsites should be covered");
|
|
21
24
|
});
|
|
@@ -119,8 +119,8 @@ test("resolveExpectedArtifactPath returns correct path for all slice-level types
|
|
|
119
119
|
// ─── run-uat artifact path contract (#2873) ──────────────────────────────
|
|
120
120
|
|
|
121
121
|
test("resolveExpectedArtifactPath for run-uat returns ASSESSMENT path, not UAT (#2873)", (t) => {
|
|
122
|
-
// The run-uat prompt instructs the agent to call
|
|
123
|
-
//
|
|
122
|
+
// The run-uat prompt instructs the agent to call gsd_uat_result_save, which
|
|
123
|
+
// writes S##-ASSESSMENT.md through the workflow persistence path. The artifact
|
|
124
124
|
// verification path must match — otherwise verification fails and auto-mode
|
|
125
125
|
// retries the unit in an infinite loop.
|
|
126
126
|
const base = makeTmpBase();
|
|
@@ -147,12 +147,12 @@ test("diagnoseExpectedArtifact for run-uat references ASSESSMENT (#2873)", (t) =
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
test("verifyExpectedArtifact passes for run-uat when ASSESSMENT file exists (#2873)", (t) => {
|
|
150
|
-
// Regression test: run-uat writes S##-ASSESSMENT.md via
|
|
150
|
+
// Regression test: run-uat writes S##-ASSESSMENT.md via gsd_uat_result_save,
|
|
151
151
|
// but verification looked for S##-UAT.md, causing false stuck retries.
|
|
152
152
|
const base = makeTmpBase();
|
|
153
153
|
t.after(() => cleanup(base));
|
|
154
154
|
|
|
155
|
-
// Write the ASSESSMENT file (what
|
|
155
|
+
// Write the ASSESSMENT file (what gsd_uat_result_save actually produces)
|
|
156
156
|
const assessPath = join(base, ".gsd", "milestones", "M001", "slices", "S01", "S01-ASSESSMENT.md");
|
|
157
157
|
writeFileSync(assessPath, "---\nverdict: PASS\n---\n# UAT Assessment\n");
|
|
158
158
|
|
|
@@ -72,6 +72,38 @@ function makeBrowserObservableUatContent(mode = 'artifact-driven'): string {
|
|
|
72
72
|
].join('\n');
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
function makeDeferredBrowserUatContent(): string {
|
|
76
|
+
return [
|
|
77
|
+
'# UAT File',
|
|
78
|
+
'',
|
|
79
|
+
'## UAT Type',
|
|
80
|
+
'',
|
|
81
|
+
'- UAT mode: artifact-driven',
|
|
82
|
+
'- Why this mode is sufficient: Node interaction tests exercise the real app.js render/event/localStorage loop through a DOM harness. Live browser, keyboard, responsive, and visual-polish UAT remain intentionally deferred to S02.',
|
|
83
|
+
'',
|
|
84
|
+
'## Smoke Test',
|
|
85
|
+
'',
|
|
86
|
+
'Run `node --test tests/s01-static-interactions.test.js` and confirm all tests pass.',
|
|
87
|
+
'',
|
|
88
|
+
'## Test Cases',
|
|
89
|
+
'',
|
|
90
|
+
'1. Click the todo row edit control in the DOM harness.',
|
|
91
|
+
'2. Save changed text and reload/recreate the app from persisted localStorage.',
|
|
92
|
+
'3. Expected: the stored record shape remains unchanged.',
|
|
93
|
+
'',
|
|
94
|
+
'## Not Proven By This UAT',
|
|
95
|
+
'',
|
|
96
|
+
'- Final visual polish of edit controls.',
|
|
97
|
+
'- Keyboard usability through a real browser.',
|
|
98
|
+
'- Browser console and local network cleanliness.',
|
|
99
|
+
'',
|
|
100
|
+
'## Notes for Tester',
|
|
101
|
+
'',
|
|
102
|
+
'S02 should capture browser evidence for the full loop rather than changing this persisted model.',
|
|
103
|
+
'',
|
|
104
|
+
].join('\n');
|
|
105
|
+
}
|
|
106
|
+
|
|
75
107
|
describe('run-uat', () => {
|
|
76
108
|
test('(a) artifact-driven', () => {
|
|
77
109
|
assert.deepStrictEqual(
|
|
@@ -232,8 +264,8 @@ test('(k) run-uat prompt template', () => {
|
|
|
232
264
|
`prompt contains detected dynamic uatType value "${uatType}" after substitution`,
|
|
233
265
|
);
|
|
234
266
|
assert.ok(
|
|
235
|
-
promptResult?.includes(`uatType: ${uatType}`) ?? false,
|
|
236
|
-
`prompt contains dynamic uatType
|
|
267
|
+
promptResult?.includes(`uatType: "${uatType}"`) ?? false,
|
|
268
|
+
`prompt contains dynamic uatType field "${uatType}" after substitution`,
|
|
237
269
|
);
|
|
238
270
|
assert.ok(
|
|
239
271
|
!/\{\{[^}]+\}\}/.test(promptResult ?? ''),
|
|
@@ -249,7 +281,7 @@ test('(k) run-uat prompt template', () => {
|
|
|
249
281
|
);
|
|
250
282
|
});
|
|
251
283
|
|
|
252
|
-
test('(k2) run-uat prompt references
|
|
284
|
+
test('(k2) run-uat prompt references gsd_uat_result_save, not direct write', () => {
|
|
253
285
|
const promptResult = loadPromptFromWorktree('run-uat', {
|
|
254
286
|
workingDirectory: '/tmp/test-project',
|
|
255
287
|
milestoneId: 'M001',
|
|
@@ -261,17 +293,25 @@ test('(k2) run-uat prompt references gsd_summary_save, not direct write', () =>
|
|
|
261
293
|
});
|
|
262
294
|
|
|
263
295
|
assert.ok(
|
|
264
|
-
promptResult.includes('
|
|
265
|
-
'run-uat prompt should reference
|
|
296
|
+
promptResult.includes('gsd_uat_result_save'),
|
|
297
|
+
'run-uat prompt should reference gsd_uat_result_save tool',
|
|
298
|
+
);
|
|
299
|
+
assert.ok(
|
|
300
|
+
promptResult.includes('presentedTools') && promptResult.includes('blockedTools'),
|
|
301
|
+
'run-uat prompt should specify the tool presentation contract',
|
|
266
302
|
);
|
|
267
303
|
assert.ok(
|
|
268
|
-
promptResult.includes('
|
|
269
|
-
'run-uat prompt should
|
|
304
|
+
!promptResult.includes('Call `gsd_summary_save`'),
|
|
305
|
+
'run-uat prompt should not instruct direct summary-save UAT persistence',
|
|
270
306
|
);
|
|
271
307
|
assert.ok(
|
|
272
308
|
!promptResult.includes('MUST write'),
|
|
273
309
|
'run-uat prompt should not instruct direct file write in footer',
|
|
274
310
|
);
|
|
311
|
+
assert.ok(
|
|
312
|
+
!promptResult.includes('Call `gsd_summary_save` with `artifact_type: "ASSESSMENT"`'),
|
|
313
|
+
'run-uat prompt should not instruct the legacy summary-save UAT path',
|
|
314
|
+
);
|
|
275
315
|
});
|
|
276
316
|
|
|
277
317
|
test('(l) dispatch preconditions via resolveSliceFile', () => {
|
|
@@ -482,8 +522,8 @@ test('(n) stale replay guard', async () => {
|
|
|
482
522
|
});
|
|
483
523
|
|
|
484
524
|
test('(q) verdict in ASSESSMENT file skips UAT dispatch (file-based path)', async () => {
|
|
485
|
-
// Regression test for #2644: run-uat
|
|
486
|
-
// S{sid}-ASSESSMENT.md
|
|
525
|
+
// Regression test for #2644: run-uat writes the verdict to
|
|
526
|
+
// S{sid}-ASSESSMENT.md through the structured UAT save path,
|
|
487
527
|
// but checkNeedsRunUat only checked S{sid}-UAT.md — causing a stuck loop.
|
|
488
528
|
const base = createFixtureBase();
|
|
489
529
|
try {
|
|
@@ -679,11 +719,27 @@ test('(u) run-uat prompt promotes artifact-driven browser specs to browser-execu
|
|
|
679
719
|
const prompt = await buildRunUatPrompt('M001', 'S01', uatRel, uatContent, base);
|
|
680
720
|
|
|
681
721
|
assert.match(prompt, /\*\*Detected UAT mode:\*\*\s*`browser-executable`/);
|
|
682
|
-
assert.match(prompt, /uatType: browser-executable/);
|
|
722
|
+
assert.match(prompt, /uatType: "browser-executable"/);
|
|
683
723
|
assert.match(prompt, /use gsd-browser tools/i);
|
|
684
724
|
} finally {
|
|
685
725
|
cleanup(base);
|
|
686
726
|
}
|
|
687
727
|
});
|
|
688
728
|
|
|
729
|
+
test('(v) run-uat prompt keeps deferred browser work artifact-driven', async () => {
|
|
730
|
+
const base = createFixtureBase();
|
|
731
|
+
try {
|
|
732
|
+
const uatRel = '.gsd/milestones/M001/slices/S01/S01-UAT.md';
|
|
733
|
+
const uatContent = makeDeferredBrowserUatContent();
|
|
734
|
+
writeSliceFile(base, 'M001', 'S01', 'UAT', uatContent);
|
|
735
|
+
|
|
736
|
+
const prompt = await buildRunUatPrompt('M001', 'S01', uatRel, uatContent, base);
|
|
737
|
+
|
|
738
|
+
assert.match(prompt, /\*\*Detected UAT mode:\*\*\s*`artifact-driven`/);
|
|
739
|
+
assert.match(prompt, /uatType: "artifact-driven"/);
|
|
740
|
+
assert.doesNotMatch(prompt, /uatType: "browser-executable"/);
|
|
741
|
+
} finally {
|
|
742
|
+
cleanup(base);
|
|
743
|
+
}
|
|
744
|
+
});
|
|
689
745
|
});
|