@opengsd/gsd-pi 1.1.1-dev.74e8dd1 → 1.1.1-dev.a5a2de8
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 +16 -0
- package/dist/resources/extensions/gsd/auto-post-unit.js +21 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +63 -22
- package/dist/resources/extensions/gsd/auto-recovery.js +3 -4
- 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-unit-tool-scope.js +18 -66
- package/dist/resources/extensions/gsd/auto-worktree.js +18 -5
- package/dist/resources/extensions/gsd/auto.js +9 -2
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +20 -14
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +28 -13
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +18 -29
- package/dist/resources/extensions/gsd/browser-evidence.js +29 -2
- package/dist/resources/extensions/gsd/closeout-consistency-gate.js +61 -0
- 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 +118 -175
- 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/milestone-closeout.js +3 -1
- package/dist/resources/extensions/gsd/pending-auto-start.js +0 -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 +25 -21
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
- package/dist/resources/extensions/gsd/recovery-classification.js +20 -0
- 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/tool-contract.js +5 -0
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +17 -7
- 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 +132 -18
- package/dist/resources/extensions/gsd/unit-tool-contracts.js +169 -0
- package/dist/resources/extensions/gsd/verdict-parser.js +59 -15
- package/dist/resources/extensions/gsd/verification-gate.js +72 -1
- package/dist/resources/extensions/gsd/workflow-mcp.js +3 -75
- 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/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +5 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- 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 +42 -3
- 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/harness/agent-harness.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/harness/agent-harness.js +3 -1
- package/packages/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
- package/packages/pi-agent-core/dist/harness/types.d.ts +1 -0
- package/packages/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/harness/types.js.map +1 -1
- package/packages/pi-agent-core/dist/types.d.ts +6 -1
- 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 +74 -6
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +78 -10
- 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/extensions/extension-upstream-types.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-upstream-types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/extension-upstream-types.js.map +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/dist/core/tools/bash.js +2 -2
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/edit.js +3 -2
- package/packages/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/render-utils.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/render-utils.js +6 -0
- package/packages/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/write.js +3 -2
- package/packages/pi-coding-agent/dist/core/tools/write.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 +19 -0
- package/src/resources/extensions/gsd/auto-post-unit.ts +28 -2
- package/src/resources/extensions/gsd/auto-prompts.ts +97 -15
- package/src/resources/extensions/gsd/auto-recovery.ts +3 -3
- 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-unit-tool-scope.ts +43 -74
- package/src/resources/extensions/gsd/auto-worktree.ts +23 -5
- package/src/resources/extensions/gsd/auto.ts +12 -2
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +20 -14
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +32 -13
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +50 -54
- package/src/resources/extensions/gsd/browser-evidence.ts +26 -2
- package/src/resources/extensions/gsd/closeout-consistency-gate.ts +137 -0
- 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 +214 -216
- 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/milestone-closeout.ts +3 -1
- package/src/resources/extensions/gsd/pending-auto-start.ts +0 -2
- 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 +25 -21
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +3 -3
- package/src/resources/extensions/gsd/recovery-classification.ts +20 -0
- 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/auto-recovery.test.ts +10 -2
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +12 -2
- package/src/resources/extensions/gsd/tests/browser-evidence.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/check-auto-start-pending-gate.test.ts +9 -15
- package/src/resources/extensions/gsd/tests/check-auto-start-ready-guard.test.ts +26 -16
- package/src/resources/extensions/gsd/tests/commands-dispatcher-unmerged-milestone.test.ts +21 -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/dispatch-complete-milestone-guard.test.ts +40 -1
- 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/gate-1b-orphan-discrimination.test.ts +31 -79
- 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-session-isolation.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/guided-flow-state-rebuild.test.ts +40 -4
- 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/auto-worktree-milestone-merge.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/integration/parallel-merge.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +69 -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/merge-closeout-consistency-gate.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/merge-db-cycle.test.ts +10 -1
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +9 -1
- 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 +61 -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/register-hooks-depth-verification.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/rule-registry.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/run-uat-composer.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +36 -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/token-tool-gating.test.ts +4 -4
- 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 +351 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +15 -0
- package/src/resources/extensions/gsd/tool-contract.ts +6 -0
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +38 -8
- 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 +163 -20
- package/src/resources/extensions/gsd/types.ts +69 -5
- package/src/resources/extensions/gsd/unit-tool-contracts.ts +186 -0
- package/src/resources/extensions/gsd/verdict-parser.ts +54 -13
- package/src/resources/extensions/gsd/verification-gate.ts +87 -1
- package/src/resources/extensions/gsd/workflow-mcp.ts +3 -75
- package/src/resources/extensions/shared/gsd-browser-cli.ts +172 -0
- package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound-corrections.test.ts +0 -246
- package/src/resources/extensions/gsd/tests/gate-1b-recovery-bound.test.ts +0 -218
- /package/dist/web/standalone/.next/static/{eRWf-RI9bzbrwEurm_3uI → 9y3LeeR2uGr2yRj9RjY3D}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{eRWf-RI9bzbrwEurm_3uI → 9y3LeeR2uGr2yRj9RjY3D}/_ssgManifest.js +0 -0
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
// gsd-pi + Gate 1b recovery bound corrections — regression tests for the two bugs
|
|
2
|
-
// found in peer review of the H1 fix (commit f0e1d42a2):
|
|
3
|
-
// 1. Escalation message must describe /gsd (counter reset) AND /gsd-debug (diagnose).
|
|
4
|
-
// 2. planBlockedRecoveryCount must NOT increment when pi.sendMessage throws.
|
|
5
|
-
|
|
6
|
-
import { describe, test, beforeEach, afterEach } from "node:test";
|
|
7
|
-
import assert from "node:assert/strict";
|
|
8
|
-
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
9
|
-
import { join } from "node:path";
|
|
10
|
-
import { tmpdir } from "node:os";
|
|
11
|
-
|
|
12
|
-
import {
|
|
13
|
-
checkAutoStartAfterDiscuss,
|
|
14
|
-
setPendingAutoStart,
|
|
15
|
-
clearPendingAutoStart,
|
|
16
|
-
_getPendingAutoStart,
|
|
17
|
-
} from "../guided-flow.ts";
|
|
18
|
-
import { drainLogs } from "../workflow-logger.ts";
|
|
19
|
-
import {
|
|
20
|
-
openDatabase,
|
|
21
|
-
closeDatabase,
|
|
22
|
-
insertMilestone,
|
|
23
|
-
} from "../gsd-db.ts";
|
|
24
|
-
|
|
25
|
-
// ─── Harness ───────────────────────────────────────────────────────────────
|
|
26
|
-
|
|
27
|
-
interface MockCapture {
|
|
28
|
-
notifies: Array<{ msg: string; level: string }>;
|
|
29
|
-
messages: Array<{ payload: any; options: any }>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function mkCapture(): MockCapture {
|
|
33
|
-
return { notifies: [], messages: [] };
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function mkCtx(cap: MockCapture): any {
|
|
37
|
-
return {
|
|
38
|
-
ui: {
|
|
39
|
-
notify: (msg: string, level: string) => {
|
|
40
|
-
cap.notifies.push({ msg, level });
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/** Returns a pi stub whose sendMessage throws on the first call, succeeds after. */
|
|
47
|
-
function mkPiThrowOnce(cap: MockCapture): any {
|
|
48
|
-
let callCount = 0;
|
|
49
|
-
return {
|
|
50
|
-
sendMessage: (payload: any, options: any) => {
|
|
51
|
-
callCount += 1;
|
|
52
|
-
if (callCount === 1) {
|
|
53
|
-
throw new Error("transient network error");
|
|
54
|
-
}
|
|
55
|
-
cap.messages.push({ payload, options });
|
|
56
|
-
},
|
|
57
|
-
setActiveTools: () => undefined,
|
|
58
|
-
getActiveTools: () => [],
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function mkPi(cap: MockCapture): any {
|
|
63
|
-
return {
|
|
64
|
-
sendMessage: (payload: any, options: any) => {
|
|
65
|
-
cap.messages.push({ payload, options });
|
|
66
|
-
},
|
|
67
|
-
setActiveTools: () => undefined,
|
|
68
|
-
getActiveTools: () => [],
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function mkBase(): string {
|
|
73
|
-
const base = mkdtempSync(join(tmpdir(), "gsd-gate1b-corrections-"));
|
|
74
|
-
mkdirSync(join(base, ".gsd", "milestones", "M001"), { recursive: true });
|
|
75
|
-
writeFileSync(
|
|
76
|
-
join(base, ".gsd", "milestones", "M001", "M001-CONTEXT.md"),
|
|
77
|
-
"# M001: Corrections Test\n\nContext written by discuss phase.\n",
|
|
78
|
-
);
|
|
79
|
-
return base;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ─── Tests ─────────────────────────────────────────────────────────────────
|
|
83
|
-
|
|
84
|
-
describe("Gate 1b recovery bound corrections", () => {
|
|
85
|
-
let base: string;
|
|
86
|
-
let cap: MockCapture;
|
|
87
|
-
|
|
88
|
-
beforeEach(() => {
|
|
89
|
-
clearPendingAutoStart();
|
|
90
|
-
drainLogs();
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
afterEach(() => {
|
|
94
|
-
closeDatabase();
|
|
95
|
-
clearPendingAutoStart();
|
|
96
|
-
if (base) {
|
|
97
|
-
rmSync(base, { recursive: true, force: true });
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
// ── Fix 1: escalation message ──────────────────────────────────────────
|
|
102
|
-
|
|
103
|
-
test("escalation message describes /gsd for reset AND /gsd-debug for diagnosis", () => {
|
|
104
|
-
base = mkBase();
|
|
105
|
-
openDatabase(":memory:");
|
|
106
|
-
insertMilestone({ id: "M001", title: "Corrections Test", status: "queued" });
|
|
107
|
-
|
|
108
|
-
cap = mkCapture();
|
|
109
|
-
setPendingAutoStart(base, {
|
|
110
|
-
basePath: base,
|
|
111
|
-
milestoneId: "M001",
|
|
112
|
-
ctx: mkCtx(cap),
|
|
113
|
-
pi: mkPi(cap),
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
// Exhaust the recovery budget (MAX = 3)
|
|
117
|
-
checkAutoStartAfterDiscuss(); // count → 1
|
|
118
|
-
checkAutoStartAfterDiscuss(); // count → 2
|
|
119
|
-
checkAutoStartAfterDiscuss(); // count → 3
|
|
120
|
-
|
|
121
|
-
cap.notifies = [];
|
|
122
|
-
drainLogs();
|
|
123
|
-
|
|
124
|
-
// This call hits the cap and must escalate
|
|
125
|
-
const result = checkAutoStartAfterDiscuss();
|
|
126
|
-
assert.equal(result, false, "escalation call must return false");
|
|
127
|
-
|
|
128
|
-
const errorNotify = cap.notifies.find((n) => n.level === "error");
|
|
129
|
-
assert.ok(errorNotify, "escalation must emit a notify with level 'error'");
|
|
130
|
-
|
|
131
|
-
// Must mention /gsd with reset semantics
|
|
132
|
-
assert.match(
|
|
133
|
-
errorNotify.msg,
|
|
134
|
-
/\/gsd\b/,
|
|
135
|
-
"escalation message must reference /gsd (the command that resets the counter)",
|
|
136
|
-
);
|
|
137
|
-
assert.match(
|
|
138
|
-
errorNotify.msg,
|
|
139
|
-
/reset/i,
|
|
140
|
-
"escalation message must use the word 'reset' so users know /gsd resets the counter",
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
// Must also mention /gsd-debug
|
|
144
|
-
assert.match(
|
|
145
|
-
errorNotify.msg,
|
|
146
|
-
/\/gsd-debug/i,
|
|
147
|
-
"escalation message must also reference /gsd-debug for diagnosis",
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
// Must NOT suggest /gsd-debug alone as the sole remediation
|
|
151
|
-
assert.doesNotMatch(
|
|
152
|
-
errorNotify.msg,
|
|
153
|
-
/^[^/]*\/gsd-debug[^/]*$/,
|
|
154
|
-
"escalation message must not mention /gsd-debug as the only option",
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// ── Fix 2: counter ordering ────────────────────────────────────────────
|
|
159
|
-
|
|
160
|
-
test("counter stays at 0 when sendMessage throws on the first call", () => {
|
|
161
|
-
base = mkBase();
|
|
162
|
-
openDatabase(":memory:");
|
|
163
|
-
insertMilestone({ id: "M001", title: "Corrections Test", status: "queued" });
|
|
164
|
-
|
|
165
|
-
cap = mkCapture();
|
|
166
|
-
setPendingAutoStart(base, {
|
|
167
|
-
basePath: base,
|
|
168
|
-
milestoneId: "M001",
|
|
169
|
-
ctx: mkCtx(cap),
|
|
170
|
-
pi: mkPiThrowOnce(cap),
|
|
171
|
-
});
|
|
172
|
-
|
|
173
|
-
// First call: sendMessage throws — counter must NOT increment
|
|
174
|
-
const result = checkAutoStartAfterDiscuss();
|
|
175
|
-
assert.equal(result, false, "must return false even when sendMessage throws");
|
|
176
|
-
|
|
177
|
-
const entry = _getPendingAutoStart(base);
|
|
178
|
-
assert.ok(entry, "entry must still exist after a failed sendMessage");
|
|
179
|
-
assert.equal(
|
|
180
|
-
entry.planBlockedRecoveryCount,
|
|
181
|
-
0,
|
|
182
|
-
"counter must remain 0 when sendMessage throws — no budget burned by transient failure",
|
|
183
|
-
);
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
test("counter increments to 1 on the second call when first sendMessage threw", () => {
|
|
187
|
-
base = mkBase();
|
|
188
|
-
openDatabase(":memory:");
|
|
189
|
-
insertMilestone({ id: "M001", title: "Corrections Test", status: "queued" });
|
|
190
|
-
|
|
191
|
-
cap = mkCapture();
|
|
192
|
-
setPendingAutoStart(base, {
|
|
193
|
-
basePath: base,
|
|
194
|
-
milestoneId: "M001",
|
|
195
|
-
ctx: mkCtx(cap),
|
|
196
|
-
pi: mkPiThrowOnce(cap),
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
checkAutoStartAfterDiscuss(); // sendMessage throws → count stays 0
|
|
200
|
-
|
|
201
|
-
const entryAfterThrow = _getPendingAutoStart(base);
|
|
202
|
-
assert.equal(entryAfterThrow!.planBlockedRecoveryCount, 0, "count is 0 after throw");
|
|
203
|
-
|
|
204
|
-
checkAutoStartAfterDiscuss(); // sendMessage succeeds → count becomes 1
|
|
205
|
-
assert.equal(cap.messages.length, 1, "second call must produce one successful sendMessage");
|
|
206
|
-
|
|
207
|
-
const entryAfterSuccess = _getPendingAutoStart(base);
|
|
208
|
-
assert.equal(
|
|
209
|
-
entryAfterSuccess!.planBlockedRecoveryCount,
|
|
210
|
-
1,
|
|
211
|
-
"counter must be 1 after first successful dispatch",
|
|
212
|
-
);
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
test("3 successful sendMessage calls exhaust the budget; 4th emits escalation notify", () => {
|
|
216
|
-
base = mkBase();
|
|
217
|
-
openDatabase(":memory:");
|
|
218
|
-
insertMilestone({ id: "M001", title: "Corrections Test", status: "queued" });
|
|
219
|
-
|
|
220
|
-
cap = mkCapture();
|
|
221
|
-
setPendingAutoStart(base, {
|
|
222
|
-
basePath: base,
|
|
223
|
-
milestoneId: "M001",
|
|
224
|
-
ctx: mkCtx(cap),
|
|
225
|
-
pi: mkPi(cap),
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
// Three successful recoveries
|
|
229
|
-
checkAutoStartAfterDiscuss(); // count → 1
|
|
230
|
-
checkAutoStartAfterDiscuss(); // count → 2
|
|
231
|
-
checkAutoStartAfterDiscuss(); // count → 3
|
|
232
|
-
|
|
233
|
-
const entry = _getPendingAutoStart(base);
|
|
234
|
-
assert.equal(entry!.planBlockedRecoveryCount, 3, "counter must be 3 after three successes");
|
|
235
|
-
assert.equal(cap.messages.length, 3, "three sendMessage calls must have occurred");
|
|
236
|
-
|
|
237
|
-
// Fourth call hits the cap
|
|
238
|
-
cap.notifies = [];
|
|
239
|
-
cap.messages = [];
|
|
240
|
-
const resultAtCap = checkAutoStartAfterDiscuss();
|
|
241
|
-
assert.equal(resultAtCap, false, "4th call must return false");
|
|
242
|
-
assert.equal(cap.messages.length, 0, "4th call must NOT call sendMessage");
|
|
243
|
-
const errorNotify = cap.notifies.find((n) => n.level === "error");
|
|
244
|
-
assert.ok(errorNotify, "4th call must emit escalation notify with level 'error'");
|
|
245
|
-
});
|
|
246
|
-
});
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
// gsd-pi + Gate 1b recovery counter bound — regression tests for H1 fix (#5012)
|
|
2
|
-
//
|
|
3
|
-
// Verifies that checkAutoStartAfterDiscuss stops emitting plan-blocked recovery
|
|
4
|
-
// hints (with triggerTurn:true) after MAX_PLAN_BLOCKED_RECOVERIES attempts and
|
|
5
|
-
// instead escalates to the user via ctx.ui.notify("error"), breaking the loop.
|
|
6
|
-
|
|
7
|
-
import { describe, test, beforeEach, afterEach } from "node:test";
|
|
8
|
-
import assert from "node:assert/strict";
|
|
9
|
-
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
10
|
-
import { join } from "node:path";
|
|
11
|
-
import { tmpdir } from "node:os";
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
checkAutoStartAfterDiscuss,
|
|
15
|
-
setPendingAutoStart,
|
|
16
|
-
clearPendingAutoStart,
|
|
17
|
-
_getPendingAutoStart,
|
|
18
|
-
} from "../guided-flow.ts";
|
|
19
|
-
import { drainLogs } from "../workflow-logger.ts";
|
|
20
|
-
import {
|
|
21
|
-
openDatabase,
|
|
22
|
-
closeDatabase,
|
|
23
|
-
insertMilestone,
|
|
24
|
-
} from "../gsd-db.ts";
|
|
25
|
-
|
|
26
|
-
// ─── Harness ───────────────────────────────────────────────────────────────
|
|
27
|
-
|
|
28
|
-
interface MockCapture {
|
|
29
|
-
notifies: Array<{ msg: string; level: string }>;
|
|
30
|
-
messages: Array<{ payload: any; options: any }>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function mkCapture(): MockCapture {
|
|
34
|
-
return { notifies: [], messages: [] };
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function mkCtx(cap: MockCapture): any {
|
|
38
|
-
return {
|
|
39
|
-
ui: {
|
|
40
|
-
notify: (msg: string, level: string) => {
|
|
41
|
-
cap.notifies.push({ msg, level });
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function mkPi(cap: MockCapture): any {
|
|
48
|
-
return {
|
|
49
|
-
sendMessage: (payload: any, options: any) => {
|
|
50
|
-
cap.messages.push({ payload, options });
|
|
51
|
-
},
|
|
52
|
-
setActiveTools: () => undefined,
|
|
53
|
-
getActiveTools: () => [],
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function mkBase(): string {
|
|
58
|
-
const base = mkdtempSync(join(tmpdir(), "gsd-gate1b-bound-"));
|
|
59
|
-
mkdirSync(join(base, ".gsd", "milestones", "M001"), { recursive: true });
|
|
60
|
-
writeFileSync(
|
|
61
|
-
join(base, ".gsd", "milestones", "M001", "M001-CONTEXT.md"),
|
|
62
|
-
"# M001: Bound Test\n\nContext written by discuss phase.\n",
|
|
63
|
-
);
|
|
64
|
-
return base;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// ─── Tests ─────────────────────────────────────────────────────────────────
|
|
68
|
-
|
|
69
|
-
describe("Gate 1b recovery bound (H1)", () => {
|
|
70
|
-
let base: string;
|
|
71
|
-
let cap: MockCapture;
|
|
72
|
-
|
|
73
|
-
beforeEach(() => {
|
|
74
|
-
clearPendingAutoStart();
|
|
75
|
-
drainLogs();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
afterEach(() => {
|
|
79
|
-
closeDatabase();
|
|
80
|
-
clearPendingAutoStart();
|
|
81
|
-
if (base) {
|
|
82
|
-
rmSync(base, { recursive: true, force: true });
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test("first N-1 invocations increment counter and emit recovery with triggerTurn:true", () => {
|
|
87
|
-
base = mkBase();
|
|
88
|
-
openDatabase(":memory:");
|
|
89
|
-
insertMilestone({ id: "M001", title: "Bound Test", status: "queued" });
|
|
90
|
-
|
|
91
|
-
cap = mkCapture();
|
|
92
|
-
setPendingAutoStart(base, {
|
|
93
|
-
basePath: base,
|
|
94
|
-
milestoneId: "M001",
|
|
95
|
-
ctx: mkCtx(cap),
|
|
96
|
-
pi: mkPi(cap),
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// MAX_PLAN_BLOCKED_RECOVERIES = 3; first two calls should emit recovery
|
|
100
|
-
const resultOne = checkAutoStartAfterDiscuss();
|
|
101
|
-
assert.equal(resultOne, false, "call 1: must return false");
|
|
102
|
-
assert.equal(cap.messages.length, 1, "call 1: exactly one sendMessage");
|
|
103
|
-
assert.equal(cap.messages[0].options.triggerTurn, true, "call 1: triggerTurn must be true");
|
|
104
|
-
assert.equal(cap.messages[0].payload.customType, "gsd-plan-milestone-blocked-recovery");
|
|
105
|
-
|
|
106
|
-
const entryAfterOne = _getPendingAutoStart(base);
|
|
107
|
-
assert.ok(entryAfterOne, "entry must still exist after call 1");
|
|
108
|
-
assert.equal(entryAfterOne.planBlockedRecoveryCount, 1, "counter must be 1 after call 1");
|
|
109
|
-
|
|
110
|
-
const resultTwo = checkAutoStartAfterDiscuss();
|
|
111
|
-
assert.equal(resultTwo, false, "call 2: must return false");
|
|
112
|
-
assert.equal(cap.messages.length, 2, "call 2: second sendMessage emitted");
|
|
113
|
-
assert.equal(cap.messages[1].options.triggerTurn, true, "call 2: triggerTurn must be true");
|
|
114
|
-
|
|
115
|
-
const entryAfterTwo = _getPendingAutoStart(base);
|
|
116
|
-
assert.ok(entryAfterTwo, "entry must still exist after call 2");
|
|
117
|
-
assert.equal(entryAfterTwo.planBlockedRecoveryCount, 2, "counter must be 2 after call 2");
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test("Nth invocation (at MAX_PLAN_BLOCKED_RECOVERIES) escalates via notify(error) without sendMessage(triggerTurn)", () => {
|
|
121
|
-
base = mkBase();
|
|
122
|
-
openDatabase(":memory:");
|
|
123
|
-
insertMilestone({ id: "M001", title: "Bound Test", status: "queued" });
|
|
124
|
-
|
|
125
|
-
cap = mkCapture();
|
|
126
|
-
setPendingAutoStart(base, {
|
|
127
|
-
basePath: base,
|
|
128
|
-
milestoneId: "M001",
|
|
129
|
-
ctx: mkCtx(cap),
|
|
130
|
-
pi: mkPi(cap),
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
// Exhaust the recovery budget (MAX = 3): call 3 times to reach the limit
|
|
134
|
-
checkAutoStartAfterDiscuss(); // count → 1
|
|
135
|
-
checkAutoStartAfterDiscuss(); // count → 2
|
|
136
|
-
checkAutoStartAfterDiscuss(); // count → 3
|
|
137
|
-
|
|
138
|
-
// At count = 3 the counter equals MAX so the next call must escalate
|
|
139
|
-
cap.messages = [];
|
|
140
|
-
cap.notifies = [];
|
|
141
|
-
drainLogs();
|
|
142
|
-
|
|
143
|
-
const resultAtLimit = checkAutoStartAfterDiscuss();
|
|
144
|
-
assert.equal(resultAtLimit, false, "at-limit call: must return false");
|
|
145
|
-
|
|
146
|
-
// Must NOT trigger a new LLM turn
|
|
147
|
-
assert.equal(
|
|
148
|
-
cap.messages.length,
|
|
149
|
-
0,
|
|
150
|
-
"at-limit call: sendMessage must NOT be called (loop must stop)",
|
|
151
|
-
);
|
|
152
|
-
const triggerMessages = cap.messages.filter((m) => m.options?.triggerTurn);
|
|
153
|
-
assert.equal(triggerMessages.length, 0, "no triggerTurn message after limit");
|
|
154
|
-
|
|
155
|
-
// Must escalate to user via notify("error")
|
|
156
|
-
const errorNotify = cap.notifies.find((n) => n.level === "error");
|
|
157
|
-
assert.ok(errorNotify, "at-limit call: ctx.ui.notify('error') must be called");
|
|
158
|
-
assert.match(
|
|
159
|
-
errorNotify.msg,
|
|
160
|
-
/gsd-debug/i,
|
|
161
|
-
"error notification must direct user to run /gsd-debug",
|
|
162
|
-
);
|
|
163
|
-
assert.match(
|
|
164
|
-
errorNotify.msg,
|
|
165
|
-
/M001/,
|
|
166
|
-
"error notification must include the milestone ID",
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
// Confirm the log records the escalation
|
|
170
|
-
const logs = drainLogs();
|
|
171
|
-
const escalationLog = logs.find(
|
|
172
|
-
(e) => e.component === "guided" && /Gate 1b/.test(e.message) && /escalat/.test(e.message),
|
|
173
|
-
);
|
|
174
|
-
assert.ok(escalationLog, "escalation must be logged via logWarning");
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test("after clearPendingAutoStart + setPendingAutoStart the counter is reset to 0", () => {
|
|
178
|
-
base = mkBase();
|
|
179
|
-
openDatabase(":memory:");
|
|
180
|
-
insertMilestone({ id: "M001", title: "Bound Test", status: "queued" });
|
|
181
|
-
|
|
182
|
-
cap = mkCapture();
|
|
183
|
-
setPendingAutoStart(base, {
|
|
184
|
-
basePath: base,
|
|
185
|
-
milestoneId: "M001",
|
|
186
|
-
ctx: mkCtx(cap),
|
|
187
|
-
pi: mkPi(cap),
|
|
188
|
-
});
|
|
189
|
-
|
|
190
|
-
// Advance counter to 2
|
|
191
|
-
checkAutoStartAfterDiscuss();
|
|
192
|
-
checkAutoStartAfterDiscuss();
|
|
193
|
-
|
|
194
|
-
const entryBefore = _getPendingAutoStart(base);
|
|
195
|
-
assert.ok(entryBefore, "entry must exist");
|
|
196
|
-
assert.equal(entryBefore.planBlockedRecoveryCount, 2, "counter must be 2 before reset");
|
|
197
|
-
|
|
198
|
-
// Simulate user retry: clear then re-set
|
|
199
|
-
clearPendingAutoStart(base);
|
|
200
|
-
cap = mkCapture();
|
|
201
|
-
setPendingAutoStart(base, {
|
|
202
|
-
basePath: base,
|
|
203
|
-
milestoneId: "M001",
|
|
204
|
-
ctx: mkCtx(cap),
|
|
205
|
-
pi: mkPi(cap),
|
|
206
|
-
});
|
|
207
|
-
|
|
208
|
-
const entryAfter = _getPendingAutoStart(base);
|
|
209
|
-
assert.ok(entryAfter, "entry must exist after re-set");
|
|
210
|
-
assert.equal(entryAfter.planBlockedRecoveryCount, 0, "counter must be 0 after re-set (fresh entry)");
|
|
211
|
-
|
|
212
|
-
// Verify first call after reset emits recovery, not escalation
|
|
213
|
-
const result = checkAutoStartAfterDiscuss();
|
|
214
|
-
assert.equal(result, false, "first call after reset must return false");
|
|
215
|
-
assert.equal(cap.messages.length, 1, "recovery hint must be emitted after reset");
|
|
216
|
-
assert.equal(cap.messages[0].options.triggerTurn, true, "triggerTurn must be true after reset");
|
|
217
|
-
});
|
|
218
|
-
});
|
|
File without changes
|
|
File without changes
|