gsd-pi 2.77.0-dev.eaa4973bc → 2.78.0-dev.aeeb2ca00
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/README.md +53 -17
- package/dist/claude-cli-check.js +46 -10
- package/dist/headless.js +49 -4
- package/dist/resource-loader.d.ts +40 -0
- package/dist/resource-loader.js +32 -13
- package/dist/resources/extensions/browser-tools/capture.js +9 -0
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +8 -59
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +36 -24
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +69 -71
- package/dist/resources/extensions/browser-tools/tools/forms.js +5 -1
- package/dist/resources/extensions/browser-tools/tools/intent.js +5 -1
- package/dist/resources/extensions/claude-code-cli/readiness.js +72 -16
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +481 -17
- package/dist/resources/extensions/github-sync/templates.js +103 -0
- package/dist/resources/extensions/google-search/index.js +3 -2
- package/dist/resources/extensions/gsd/auto/loop.js +124 -2
- package/dist/resources/extensions/gsd/auto/phases.js +57 -39
- package/dist/resources/extensions/gsd/auto/session.js +6 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +142 -29
- package/dist/resources/extensions/gsd/auto-model-selection.js +124 -4
- package/dist/resources/extensions/gsd/auto-post-unit.js +150 -64
- package/dist/resources/extensions/gsd/auto-prompts.js +372 -104
- package/dist/resources/extensions/gsd/auto-recovery.js +197 -48
- package/dist/resources/extensions/gsd/auto-start.js +107 -29
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +47 -7
- package/dist/resources/extensions/gsd/auto-worktree.js +122 -26
- package/dist/resources/extensions/gsd/auto.js +76 -21
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +19 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +209 -0
- package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +3 -6
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +7 -3
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +127 -9
- package/dist/resources/extensions/gsd/component-loader.js +447 -0
- package/dist/resources/extensions/gsd/component-types.js +69 -0
- package/dist/resources/extensions/gsd/context-store.js +23 -7
- package/dist/resources/extensions/gsd/detection.js +49 -1
- package/dist/resources/extensions/gsd/dispatch-guard.js +2 -17
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/dist/resources/extensions/gsd/forensics.js +106 -0
- package/dist/resources/extensions/gsd/gate-registry.js +2 -2
- package/dist/resources/extensions/gsd/git-constants.js +28 -1
- package/dist/resources/extensions/gsd/git-self-heal.js +27 -0
- package/dist/resources/extensions/gsd/git-service.js +126 -2
- package/dist/resources/extensions/gsd/gsd-db.js +6 -3
- package/dist/resources/extensions/gsd/guided-flow.js +39 -13
- package/dist/resources/extensions/gsd/memory-extractor.js +7 -1
- package/dist/resources/extensions/gsd/milestone-scope-classifier.js +299 -0
- package/dist/resources/extensions/gsd/milestone-summary-classifier.js +37 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +3 -0
- package/dist/resources/extensions/gsd/model-router.js +6 -0
- package/dist/resources/extensions/gsd/native-git-bridge.js +34 -4
- package/dist/resources/extensions/gsd/preferences-validation.js +23 -0
- package/dist/resources/extensions/gsd/prompt-cache-optimizer.js +4 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +6 -2
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +23 -4
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +15 -2
- package/dist/resources/extensions/gsd/safety/git-checkpoint.js +11 -0
- package/dist/resources/extensions/gsd/service-tier.js +5 -2
- package/dist/resources/extensions/gsd/session-lock.js +19 -10
- package/dist/resources/extensions/gsd/skill-manifest.js +168 -0
- package/dist/resources/extensions/gsd/slice-cadence.js +238 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +278 -8
- package/dist/resources/extensions/gsd/state-transition-matrix.js +118 -0
- package/dist/resources/extensions/gsd/state.js +69 -58
- package/dist/resources/extensions/gsd/sync-lock.js +98 -42
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +7 -2
- package/dist/resources/extensions/gsd/unit-context-composer.js +147 -0
- package/dist/resources/extensions/gsd/unit-context-manifest.js +370 -0
- package/dist/resources/extensions/gsd/uok/dispatch-envelope.js +33 -0
- package/dist/resources/extensions/gsd/uok/execution-graph.js +10 -0
- package/dist/resources/extensions/gsd/uok/gate-runner.js +53 -5
- package/dist/resources/extensions/gsd/uok/gitops.js +2 -1
- package/dist/resources/extensions/gsd/uok/loop-adapter.js +37 -10
- package/dist/resources/extensions/gsd/uok/parity-report.js +58 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +10 -4
- package/dist/resources/extensions/gsd/uok/writer.js +82 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +6 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +85 -8
- package/dist/resources/extensions/gsd/worktree-resolver.js +86 -7
- package/dist/resources/extensions/gsd/worktree-telemetry.js +198 -0
- package/dist/resources/extensions/mcp-client/index.js +3 -1
- package/dist/resources/extensions/ollama/index.js +5 -1
- package/dist/resources/extensions/remote-questions/manager.js +11 -5
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- 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/git/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 +11 -11
- package/dist/web/standalone/.next/server/chunks/1926.js +1 -1
- package/dist/web/standalone/.next/server/chunks/6897.js +1 -1
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- 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 +2 -3
- package/packages/daemon/package.json +2 -2
- package/packages/daemon/src/logger.ts +4 -3
- package/packages/mcp-server/dist/server.d.ts +24 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +88 -87
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +15 -6
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/mcp-server.test.ts +25 -3
- package/packages/mcp-server/src/readers/graph.test.ts +87 -15
- package/packages/mcp-server/src/secure-env-collect.test.ts +232 -237
- package/packages/mcp-server/src/server.ts +131 -105
- package/packages/mcp-server/src/workflow-tools.test.ts +85 -0
- package/packages/mcp-server/src/workflow-tools.ts +19 -6
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +2 -2
- package/packages/native/src/__tests__/_test-coverage-guard.test.mjs +98 -0
- package/packages/native/src/__tests__/module-compat.test.mjs +59 -27
- package/packages/native/src/__tests__/ps.test.mjs +14 -8
- package/packages/native/src/__tests__/stream-process.test.mjs +23 -2
- package/packages/native/src/__tests__/truncate.test.mjs +17 -2
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +5 -15
- package/packages/pi-agent-core/src/agent.test.ts +96 -102
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/capability-patches.js +9 -2
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/index.d.ts +34 -0
- package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openai.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai.js +17 -0
- package/packages/pi-ai/dist/models/generated/openai.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +43 -70
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/models.test.js +36 -11
- package/packages/pi-ai/dist/models.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +44 -0
- package/packages/pi-ai/src/models/capability-patches.ts +10 -2
- package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
- package/packages/pi-ai/src/models/generated/openai.ts +17 -0
- package/packages/pi-ai/src/models.generated.test.ts +46 -73
- package/packages/pi-ai/src/models.test.ts +48 -11
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +96 -32
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-model-switch.test.js +75 -12
- package/packages/pi-coding-agent/dist/core/agent-session-model-switch.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js +99 -31
- package/packages/pi-coding-agent/dist/core/agent-session-tool-refresh.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +5 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +61 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js +30 -4
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +17 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js +76 -18
- package/packages/pi-coding-agent/dist/core/resource-loader-cache-reset.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +2 -6
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js +5 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.d.ts +18 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.js +18 -0
- package/packages/pi-coding-agent/dist/core/retryable-error-regex.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +20 -0
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +16 -2
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -0
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -0
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js +36 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/tool-execution.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +20 -13
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js +30 -12
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +18 -3
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +125 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode-state.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +105 -13
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.js +130 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-skill-filter.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +113 -37
- package/packages/pi-coding-agent/src/core/agent-session-model-switch.test.ts +89 -17
- package/packages/pi-coding-agent/src/core/agent-session-tool-refresh.test.ts +112 -43
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +58 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp-integration.test.ts +35 -4
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +20 -0
- package/packages/pi-coding-agent/src/core/resource-loader-cache-reset.test.ts +93 -28
- package/packages/pi-coding-agent/src/core/retry-handler.test.ts +5 -1
- package/packages/pi-coding-agent/src/core/retry-handler.ts +2 -8
- package/packages/pi-coding-agent/src/core/retryable-error-regex.ts +18 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +35 -1
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/tool-execution.test.ts +49 -3
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +26 -20
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-execution.ts +48 -9
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +146 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +20 -3
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode-state.ts +2 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +119 -13
- package/packages/pi-coding-agent/src/tests/system-prompt-skill-filter.test.ts +157 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +18 -8
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js +128 -17
- package/packages/pi-tui/dist/__tests__/overlay-layout.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +37 -11
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/tui.test.js +18 -30
- package/packages/pi-tui/dist/__tests__/tui.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/input.test.js +10 -3
- package/packages/pi-tui/dist/components/__tests__/input.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/loader.test.js +53 -9
- package/packages/pi-tui/dist/components/__tests__/loader.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js +6 -2
- package/packages/pi-tui/dist/components/__tests__/markdown-maxlines.test.js.map +1 -1
- package/packages/pi-tui/dist/components/editor.d.ts +14 -0
- package/packages/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/packages/pi-tui/dist/components/editor.js +19 -0
- package/packages/pi-tui/dist/components/editor.js.map +1 -1
- package/packages/pi-tui/dist/components/image.test.js +6 -5
- package/packages/pi-tui/dist/components/image.test.js.map +1 -1
- package/packages/pi-tui/dist/editor-component.d.ts +2 -0
- package/packages/pi-tui/dist/editor-component.d.ts.map +1 -1
- package/packages/pi-tui/dist/editor-component.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +24 -8
- package/packages/pi-tui/src/__tests__/overlay-layout.test.ts +140 -17
- package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +42 -11
- package/packages/pi-tui/src/__tests__/tui.test.ts +18 -37
- package/packages/pi-tui/src/components/__tests__/input.test.ts +19 -3
- package/packages/pi-tui/src/components/__tests__/loader.test.ts +112 -35
- package/packages/pi-tui/src/components/__tests__/markdown-maxlines.test.ts +9 -2
- package/packages/pi-tui/src/components/editor.ts +22 -0
- package/packages/pi-tui/src/components/image.test.ts +10 -5
- package/packages/pi-tui/src/editor-component.ts +3 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/dist/rpc-client.test.js +101 -51
- package/packages/rpc-client/dist/rpc-client.test.js.map +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/src/rpc-client.test.ts +109 -52
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/package.json +1 -1
- package/scripts/install.js +15 -1
- package/src/resources/extensions/browser-tools/capture.ts +12 -0
- package/src/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +8 -59
- package/src/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +36 -24
- package/src/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +69 -71
- package/src/resources/extensions/browser-tools/tools/forms.ts +5 -1
- package/src/resources/extensions/browser-tools/tools/intent.ts +5 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +75 -16
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +518 -19
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +919 -75
- package/src/resources/extensions/github-sync/templates.ts +151 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +76 -7
- package/src/resources/extensions/github-sync/tests/templates.test.ts +92 -1
- package/src/resources/extensions/google-search/index.ts +3 -2
- package/src/resources/extensions/gsd/auto/loop.ts +142 -2
- package/src/resources/extensions/gsd/auto/phases.ts +62 -38
- package/src/resources/extensions/gsd/auto/session.ts +7 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +156 -29
- package/src/resources/extensions/gsd/auto-model-selection.ts +131 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +163 -73
- package/src/resources/extensions/gsd/auto-prompts.ts +385 -93
- package/src/resources/extensions/gsd/auto-recovery.ts +230 -51
- package/src/resources/extensions/gsd/auto-start.ts +127 -9
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +51 -7
- package/src/resources/extensions/gsd/auto-worktree.ts +130 -26
- package/src/resources/extensions/gsd/auto.ts +90 -23
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +20 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +221 -0
- package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +3 -7
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +7 -3
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +158 -9
- package/src/resources/extensions/gsd/component-loader.ts +598 -0
- package/src/resources/extensions/gsd/component-types.ts +362 -0
- package/src/resources/extensions/gsd/context-store.ts +25 -8
- package/src/resources/extensions/gsd/detection.ts +58 -1
- package/src/resources/extensions/gsd/dispatch-guard.ts +2 -20
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- package/src/resources/extensions/gsd/forensics.ts +118 -1
- package/src/resources/extensions/gsd/gate-registry.ts +2 -2
- package/src/resources/extensions/gsd/git-constants.ts +30 -1
- package/src/resources/extensions/gsd/git-self-heal.ts +31 -0
- package/src/resources/extensions/gsd/git-service.ts +149 -2
- package/src/resources/extensions/gsd/gsd-db.ts +6 -3
- package/src/resources/extensions/gsd/guided-flow.ts +57 -14
- package/src/resources/extensions/gsd/journal.ts +11 -1
- package/src/resources/extensions/gsd/memory-extractor.ts +11 -3
- package/src/resources/extensions/gsd/milestone-scope-classifier.ts +366 -0
- package/src/resources/extensions/gsd/milestone-summary-classifier.ts +42 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +3 -0
- package/src/resources/extensions/gsd/model-router.ts +6 -0
- package/src/resources/extensions/gsd/native-git-bridge.ts +34 -4
- package/src/resources/extensions/gsd/preferences-validation.ts +21 -0
- package/src/resources/extensions/gsd/prompt-cache-optimizer.ts +4 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +6 -2
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +23 -4
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/src/resources/extensions/gsd/prompts/plan-slice.md +15 -2
- package/src/resources/extensions/gsd/safety/git-checkpoint.ts +15 -0
- package/src/resources/extensions/gsd/service-tier.ts +5 -2
- package/src/resources/extensions/gsd/session-lock.ts +20 -10
- package/src/resources/extensions/gsd/skill-manifest.ts +175 -0
- package/src/resources/extensions/gsd/slice-cadence.ts +299 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +309 -8
- package/src/resources/extensions/gsd/state-transition-matrix.ts +152 -0
- package/src/resources/extensions/gsd/state.ts +76 -66
- package/src/resources/extensions/gsd/sync-lock.ts +97 -39
- package/src/resources/extensions/gsd/tests/artifact-retry-cap.test.ts +270 -0
- package/src/resources/extensions/gsd/tests/artifacts-table-preserved-on-cache-invalidate.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/auto-deterministic-error-classification-4973.test.ts +341 -0
- package/src/resources/extensions/gsd/tests/auto-discuss-milestone-deadlock-4973.test.ts +264 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +133 -292
- package/src/resources/extensions/gsd/tests/auto-model-selection-tool-poisoning.test.ts +742 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +78 -0
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +61 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/auto-remediate-slice-status.test.ts +4 -1
- package/src/resources/extensions/gsd/tests/auto-retry-mcp-churn-fixes.test.ts +8 -194
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/auto-start-cold-db-bootstrap.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-start-needs-discussion.test.ts +15 -58
- package/src/resources/extensions/gsd/tests/auto-start-worktree-db-path.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-thinking-restore.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/auto-warning-noise-regression.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +17 -21
- package/src/resources/extensions/gsd/tests/canonical-milestone-root.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-excerpt.test.ts +263 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/complete-slice-composer.test.ts +192 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +16 -8
- package/src/resources/extensions/gsd/tests/component-loader.test.ts +589 -0
- package/src/resources/extensions/gsd/tests/component-types.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/context-store.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/crash-recovery.test.ts +50 -1
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +159 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/derive-state-db-disk-reconcile.test.ts +40 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +91 -3
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +173 -0
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +139 -129
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +8 -104
- package/src/resources/extensions/gsd/tests/gate-state-canonicalization.test.ts +102 -0
- package/src/resources/extensions/gsd/tests/gate-storage.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/hook-key-parsing.test.ts +4 -55
- package/src/resources/extensions/gsd/tests/integration/all-milestones-complete-merge.test.ts +7 -56
- package/src/resources/extensions/gsd/tests/integration/auto-recovery.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +18 -2
- package/src/resources/extensions/gsd/tests/integration/queue-completed-milestone-perf.test.ts +10 -4
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +144 -7
- package/src/resources/extensions/gsd/tests/integration/state-machine-live-validation.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/integration/state-machine-runtime-failures.test.ts +2 -16
- package/src/resources/extensions/gsd/tests/interactive-routing-bypass.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/interrupted-session-ui.test.ts +6 -9
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/knowledge.test.ts +93 -1
- package/src/resources/extensions/gsd/tests/mcp-client-security.test.ts +8 -37
- package/src/resources/extensions/gsd/tests/memory-extractor.test.ts +5 -15
- package/src/resources/extensions/gsd/tests/merge-conflict-stops-loop.test.ts +227 -55
- package/src/resources/extensions/gsd/tests/milestone-scope-classifier.test.ts +187 -0
- package/src/resources/extensions/gsd/tests/milestone-summary-classifier.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +9 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +6 -48
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +59 -2
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +273 -130
- package/src/resources/extensions/gsd/tests/pipeline-variant-dispatch.test.ts +301 -0
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/preferences-worktree-sync.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/prompt-cache-optimizer.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +15 -4
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +23 -24
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/queue-draft-detection.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/queued-discuss-fast-path.test.ts +4 -5
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +75 -2
- package/src/resources/extensions/gsd/tests/reassess-default-optin.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/recovery-attempts-reset.test.ts +8 -40
- package/src/resources/extensions/gsd/tests/regex-hardening.test.ts +136 -256
- package/src/resources/extensions/gsd/tests/research-milestone-composer.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/run-uat-composer.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/session-lock-regression.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/sidecar-queue.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/silent-catch-diagnostics.test.ts +55 -95
- package/src/resources/extensions/gsd/tests/single-writer-v3-tool-surface.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +120 -1
- package/src/resources/extensions/gsd/tests/skill-manifest.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/slice-cadence.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +164 -1
- package/src/resources/extensions/gsd/tests/smart-entry-draft.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +29 -5
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +11 -92
- package/src/resources/extensions/gsd/tests/subagent-model-dispatch.test.ts +7 -6
- package/src/resources/extensions/gsd/tests/survivor-branch-complete.test.ts +102 -101
- package/src/resources/extensions/gsd/tests/sync-lock.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/sync-worktree-skip-current.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/test-helpers.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/test-helpers.ts +153 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +61 -1
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +8 -1
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +355 -0
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +258 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +49 -26
- package/src/resources/extensions/gsd/tests/uok-loop-adapter-writer.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/uok-parity-report.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +19 -2
- package/src/resources/extensions/gsd/tests/uok-writer.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +144 -80
- package/src/resources/extensions/gsd/tests/visualizer-critical-path.test.ts +20 -54
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +342 -277
- package/src/resources/extensions/gsd/tests/worker-model-override.test.ts +37 -29
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +226 -266
- package/src/resources/extensions/gsd/tests/worktree-health-monorepo.test.ts +103 -67
- package/src/resources/extensions/gsd/tests/worktree-nested-git-safety.test.ts +92 -90
- package/src/resources/extensions/gsd/tests/worktree-submodule-safety.test.ts +238 -59
- package/src/resources/extensions/gsd/tests/worktree-sync-overwrite-loop.test.ts +113 -161
- package/src/resources/extensions/gsd/tests/worktree-telemetry.test.ts +210 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +262 -0
- package/src/resources/extensions/gsd/tests/write-gate-predicates.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +7 -5
- package/src/resources/extensions/gsd/tests/zombie-gsd-state.test.ts +80 -96
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +8 -2
- package/src/resources/extensions/gsd/types.ts +3 -3
- package/src/resources/extensions/gsd/unit-context-composer.ts +218 -0
- package/src/resources/extensions/gsd/unit-context-manifest.ts +574 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +65 -0
- package/src/resources/extensions/gsd/uok/dispatch-envelope.ts +56 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +22 -0
- package/src/resources/extensions/gsd/uok/gate-runner.ts +65 -5
- package/src/resources/extensions/gsd/uok/gitops.ts +6 -1
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +45 -10
- package/src/resources/extensions/gsd/uok/parity-report.ts +84 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +13 -5
- package/src/resources/extensions/gsd/uok/writer.ts +113 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +6 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +108 -7
- package/src/resources/extensions/gsd/worktree-resolver.ts +96 -9
- package/src/resources/extensions/gsd/worktree-telemetry.ts +322 -0
- package/src/resources/extensions/mcp-client/index.ts +3 -1
- package/src/resources/extensions/mcp-client/tests/server-name-spaces.test.ts +70 -36
- package/src/resources/extensions/ollama/index.ts +5 -1
- package/src/resources/extensions/ollama/ollama-auth-mode.test.ts +123 -15
- package/src/resources/extensions/ollama/ollama-status-indicator.test.ts +206 -19
- package/src/resources/extensions/remote-questions/manager.ts +36 -4
- package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +200 -190
- package/src/resources/extensions/shared/tests/interview-preview.test.ts +11 -3
- package/src/resources/extensions/voice/tests/linux-ready.test.ts +129 -113
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts +0 -2
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.d.ts.map +0 -1
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js +0 -289
- package/packages/pi-ai/dist/utils/oauth/oauth-providers.test.js.map +0 -1
- package/packages/pi-ai/src/utils/oauth/oauth-providers.test.ts +0 -363
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +0 -143
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +0 -157
- package/src/resources/extensions/gsd/tests/dashboard-model-label-ordering.test.ts +0 -107
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed.test.ts +0 -48
- package/src/resources/extensions/gsd/tests/forensics-context-persist.test.ts +0 -159
- package/src/resources/extensions/gsd/tests/forensics-db-completion.test.ts +0 -96
- package/src/resources/extensions/gsd/tests/forensics-dedup.test.ts +0 -79
- package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +0 -74
- package/src/resources/extensions/gsd/tests/forensics-journal.test.ts +0 -162
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell.test.ts +0 -38
- package/src/resources/extensions/gsd/tests/gsd-no-project-error.test.ts +0 -73
- package/src/resources/extensions/gsd/tests/idle-watchdog-stall-override.test.ts +0 -125
- package/src/resources/extensions/gsd/tests/import-done-milestones.test.ts +0 -42
- /package/dist/web/standalone/.next/static/{5wbu35_C2_MQ3Jj1lEVDx → cAJH99yNS1UPbeSEiNRrV}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{5wbu35_C2_MQ3Jj1lEVDx → cAJH99yNS1UPbeSEiNRrV}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
// GSD-2 — UnitContextManifest (#4782 phase 1).
|
|
2
|
+
//
|
|
3
|
+
// Declarative description of what context each auto-mode unit type needs
|
|
4
|
+
// in its system prompt. Establishes the contract that later phases will
|
|
5
|
+
// use to drive a single composeSystemPromptForUnit() — replacing the
|
|
6
|
+
// per-unit-type branching currently spread across `auto-prompts.ts`.
|
|
7
|
+
//
|
|
8
|
+
// **Phase 1 ships the type + the data + a CI coverage guard.** It adds
|
|
9
|
+
// zero wiring — no caller reads a manifest yet. Every unit type gets a
|
|
10
|
+
// manifest that describes today's behavior as faithfully as possible, so
|
|
11
|
+
// when the composer lands in phase 2 the migration can proceed manifest-
|
|
12
|
+
// by-manifest without behavior change.
|
|
13
|
+
//
|
|
14
|
+
// Phased rollout tracking:
|
|
15
|
+
// - Phase 1 (this PR): schema + manifests + coverage test.
|
|
16
|
+
// - Phase 2: add composeSystemPromptForUnit(); migrate one low-risk
|
|
17
|
+
// unit type (e.g. reassess-roadmap) as the pilot.
|
|
18
|
+
// - Phase 3: migrate remaining unit types, tighten manifests per
|
|
19
|
+
// empirical usage, introduce skipWhen predicates absorbing the
|
|
20
|
+
// reassess opt-in gate from #4778.
|
|
21
|
+
// - Phase 4: introduce pipeline variants as declared sequences,
|
|
22
|
+
// absorbing the scope-classifier gates from #4781.
|
|
23
|
+
//
|
|
24
|
+
// Naming:
|
|
25
|
+
// - Artifact keys are STABLE strings (not paths). Path resolution is
|
|
26
|
+
// the composer's job; manifests describe intent, not disk layout.
|
|
27
|
+
// - Char budgets are nominal — blown budgets log a telemetry event,
|
|
28
|
+
// they do not truncate or error (the composer decides fallback).
|
|
29
|
+
// ─── Artifact registry ────────────────────────────────────────────────────
|
|
30
|
+
/**
|
|
31
|
+
* Stable identifiers for every artifact class a unit might inline, excerpt,
|
|
32
|
+
* or reference on-demand. Adding a new artifact class requires (a) a key
|
|
33
|
+
* here, (b) path/body resolution in the composer, and (c) updates to any
|
|
34
|
+
* manifest that should surface it.
|
|
35
|
+
*/
|
|
36
|
+
export const ARTIFACT_KEYS = [
|
|
37
|
+
// Milestone-scoped
|
|
38
|
+
"roadmap",
|
|
39
|
+
"milestone-context",
|
|
40
|
+
"milestone-summary",
|
|
41
|
+
"milestone-validation",
|
|
42
|
+
"milestone-research",
|
|
43
|
+
"milestone-plan",
|
|
44
|
+
// Slice-scoped
|
|
45
|
+
"slice-context",
|
|
46
|
+
"slice-research",
|
|
47
|
+
"slice-plan",
|
|
48
|
+
"slice-summary",
|
|
49
|
+
"slice-uat",
|
|
50
|
+
"slice-assessment",
|
|
51
|
+
// Task-scoped
|
|
52
|
+
"task-plan",
|
|
53
|
+
"task-summary",
|
|
54
|
+
"prior-task-summaries",
|
|
55
|
+
"dependency-summaries",
|
|
56
|
+
// Project-scoped
|
|
57
|
+
"requirements",
|
|
58
|
+
"decisions",
|
|
59
|
+
"project",
|
|
60
|
+
"templates",
|
|
61
|
+
];
|
|
62
|
+
// ─── Manifests ────────────────────────────────────────────────────────────
|
|
63
|
+
// Phase 1 policy: every manifest encodes today's behavior. Skills = "all"
|
|
64
|
+
// unless the unit type was already narrowed via the existing skill-manifest
|
|
65
|
+
// resolver (#4779). Memory/knowledge policies reflect the defaults in
|
|
66
|
+
// `bootstrap/system-context.ts`. Artifact classifications follow what
|
|
67
|
+
// `auto-prompts.ts` inlines today for each unit type.
|
|
68
|
+
const COMMON_BUDGET_LARGE = 1_500_000; // ~400K tokens
|
|
69
|
+
const COMMON_BUDGET_MEDIUM = 750_000; // ~200K tokens
|
|
70
|
+
const COMMON_BUDGET_SMALL = 250_000; // ~65K tokens
|
|
71
|
+
// ─── Tool policy constants (#4934) ────────────────────────────────────────
|
|
72
|
+
// Reused across manifests so per-unit assignment stays declarative and the
|
|
73
|
+
// allowed-path set for the docs policy lives in one reviewable place.
|
|
74
|
+
const TOOLS_ALL = { mode: "all" };
|
|
75
|
+
const TOOLS_PLANNING = { mode: "planning" };
|
|
76
|
+
const TOOLS_DOCS = {
|
|
77
|
+
mode: "docs",
|
|
78
|
+
// Globs are resolved relative to project basePath. The set is intentionally
|
|
79
|
+
// narrow: top-level docs/, README, CHANGELOG, and any markdown at the
|
|
80
|
+
// project root. Projects with non-standard layouts (e.g. mintlify-docs/)
|
|
81
|
+
// will need this list extended in a follow-up; landed conservative now,
|
|
82
|
+
// expand on demand.
|
|
83
|
+
allowedPathGlobs: [
|
|
84
|
+
"docs/**",
|
|
85
|
+
"README.md",
|
|
86
|
+
"README.*.md",
|
|
87
|
+
"CHANGELOG.md",
|
|
88
|
+
"*.md",
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Canonical unit types handled by auto-mode dispatch. The coverage test
|
|
93
|
+
* enumerates these against `UNIT_MANIFESTS` to catch manifest drift when
|
|
94
|
+
* a new unit type lands.
|
|
95
|
+
*/
|
|
96
|
+
export const KNOWN_UNIT_TYPES = [
|
|
97
|
+
"research-milestone",
|
|
98
|
+
"plan-milestone",
|
|
99
|
+
"discuss-milestone",
|
|
100
|
+
"validate-milestone",
|
|
101
|
+
"complete-milestone",
|
|
102
|
+
"research-slice",
|
|
103
|
+
"plan-slice",
|
|
104
|
+
"refine-slice",
|
|
105
|
+
"replan-slice",
|
|
106
|
+
"complete-slice",
|
|
107
|
+
"reassess-roadmap",
|
|
108
|
+
"execute-task",
|
|
109
|
+
"reactive-execute",
|
|
110
|
+
"run-uat",
|
|
111
|
+
"gate-evaluate",
|
|
112
|
+
"rewrite-docs",
|
|
113
|
+
];
|
|
114
|
+
export const UNIT_MANIFESTS = {
|
|
115
|
+
// ─── Milestone-scoped ────────────────────────────────────────────────
|
|
116
|
+
"research-milestone": {
|
|
117
|
+
skills: { mode: "all" },
|
|
118
|
+
knowledge: "full",
|
|
119
|
+
memory: "prompt-relevant",
|
|
120
|
+
codebaseMap: true,
|
|
121
|
+
preferences: "active-only",
|
|
122
|
+
tools: TOOLS_PLANNING,
|
|
123
|
+
artifacts: {
|
|
124
|
+
// Phase 3 migration (#4782): matches today's actual
|
|
125
|
+
// buildResearchMilestonePrompt inlining order.
|
|
126
|
+
inline: ["milestone-context", "project", "requirements", "decisions", "templates"],
|
|
127
|
+
excerpt: [],
|
|
128
|
+
onDemand: [],
|
|
129
|
+
},
|
|
130
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
131
|
+
},
|
|
132
|
+
"plan-milestone": {
|
|
133
|
+
skills: { mode: "all" },
|
|
134
|
+
knowledge: "full",
|
|
135
|
+
memory: "prompt-relevant",
|
|
136
|
+
codebaseMap: true,
|
|
137
|
+
preferences: "active-only",
|
|
138
|
+
tools: TOOLS_PLANNING,
|
|
139
|
+
artifacts: {
|
|
140
|
+
inline: ["project", "requirements", "decisions", "milestone-research", "templates"],
|
|
141
|
+
excerpt: [],
|
|
142
|
+
onDemand: [],
|
|
143
|
+
},
|
|
144
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
145
|
+
},
|
|
146
|
+
"discuss-milestone": {
|
|
147
|
+
skills: { mode: "all" },
|
|
148
|
+
knowledge: "full",
|
|
149
|
+
memory: "prompt-relevant",
|
|
150
|
+
codebaseMap: true,
|
|
151
|
+
preferences: "active-only",
|
|
152
|
+
tools: TOOLS_PLANNING,
|
|
153
|
+
artifacts: {
|
|
154
|
+
inline: ["project", "requirements", "decisions", "milestone-context", "templates"],
|
|
155
|
+
excerpt: [],
|
|
156
|
+
onDemand: [],
|
|
157
|
+
},
|
|
158
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
159
|
+
},
|
|
160
|
+
"validate-milestone": {
|
|
161
|
+
skills: { mode: "all" },
|
|
162
|
+
knowledge: "scoped",
|
|
163
|
+
memory: "prompt-relevant",
|
|
164
|
+
codebaseMap: false,
|
|
165
|
+
preferences: "active-only",
|
|
166
|
+
tools: TOOLS_PLANNING,
|
|
167
|
+
artifacts: {
|
|
168
|
+
inline: ["roadmap", "slice-summary", "slice-uat", "requirements", "decisions", "templates"],
|
|
169
|
+
excerpt: [],
|
|
170
|
+
onDemand: [],
|
|
171
|
+
},
|
|
172
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
173
|
+
},
|
|
174
|
+
"complete-milestone": {
|
|
175
|
+
skills: { mode: "all" },
|
|
176
|
+
knowledge: "scoped",
|
|
177
|
+
memory: "prompt-relevant",
|
|
178
|
+
codebaseMap: false,
|
|
179
|
+
preferences: "active-only",
|
|
180
|
+
tools: TOOLS_PLANNING,
|
|
181
|
+
artifacts: {
|
|
182
|
+
// #4780 landed slice-summary as excerpt for this unit; phase 2 of
|
|
183
|
+
// the architecture will read this manifest as the source of truth
|
|
184
|
+
// and retire the special-case wiring in auto-prompts.ts.
|
|
185
|
+
inline: ["roadmap", "milestone-context", "requirements", "decisions", "project", "templates"],
|
|
186
|
+
excerpt: ["slice-summary"],
|
|
187
|
+
onDemand: ["slice-summary"],
|
|
188
|
+
},
|
|
189
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
190
|
+
},
|
|
191
|
+
// ─── Slice-scoped ────────────────────────────────────────────────────
|
|
192
|
+
"research-slice": {
|
|
193
|
+
skills: { mode: "all" },
|
|
194
|
+
knowledge: "full",
|
|
195
|
+
memory: "prompt-relevant",
|
|
196
|
+
codebaseMap: true,
|
|
197
|
+
preferences: "active-only",
|
|
198
|
+
tools: TOOLS_PLANNING,
|
|
199
|
+
artifacts: {
|
|
200
|
+
inline: ["roadmap", "milestone-research", "dependency-summaries", "templates"],
|
|
201
|
+
excerpt: [],
|
|
202
|
+
onDemand: [],
|
|
203
|
+
},
|
|
204
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
205
|
+
},
|
|
206
|
+
"plan-slice": {
|
|
207
|
+
skills: { mode: "all" },
|
|
208
|
+
knowledge: "full",
|
|
209
|
+
memory: "prompt-relevant",
|
|
210
|
+
codebaseMap: true,
|
|
211
|
+
preferences: "active-only",
|
|
212
|
+
tools: TOOLS_PLANNING,
|
|
213
|
+
artifacts: {
|
|
214
|
+
inline: ["roadmap", "slice-research", "dependency-summaries", "requirements", "decisions", "templates"],
|
|
215
|
+
excerpt: [],
|
|
216
|
+
onDemand: [],
|
|
217
|
+
},
|
|
218
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
219
|
+
},
|
|
220
|
+
"refine-slice": {
|
|
221
|
+
skills: { mode: "all" },
|
|
222
|
+
knowledge: "scoped",
|
|
223
|
+
memory: "prompt-relevant",
|
|
224
|
+
codebaseMap: true,
|
|
225
|
+
preferences: "active-only",
|
|
226
|
+
tools: TOOLS_PLANNING,
|
|
227
|
+
artifacts: {
|
|
228
|
+
inline: ["slice-plan", "slice-research", "dependency-summaries", "templates"],
|
|
229
|
+
excerpt: [],
|
|
230
|
+
onDemand: [],
|
|
231
|
+
},
|
|
232
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
233
|
+
},
|
|
234
|
+
"replan-slice": {
|
|
235
|
+
skills: { mode: "all" },
|
|
236
|
+
knowledge: "scoped",
|
|
237
|
+
memory: "prompt-relevant",
|
|
238
|
+
codebaseMap: true,
|
|
239
|
+
preferences: "active-only",
|
|
240
|
+
tools: TOOLS_PLANNING,
|
|
241
|
+
artifacts: {
|
|
242
|
+
inline: ["slice-plan", "slice-research", "dependency-summaries", "prior-task-summaries", "templates"],
|
|
243
|
+
excerpt: [],
|
|
244
|
+
onDemand: [],
|
|
245
|
+
},
|
|
246
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
247
|
+
},
|
|
248
|
+
"complete-slice": {
|
|
249
|
+
skills: { mode: "all" },
|
|
250
|
+
knowledge: "scoped",
|
|
251
|
+
memory: "prompt-relevant",
|
|
252
|
+
codebaseMap: false,
|
|
253
|
+
preferences: "active-only",
|
|
254
|
+
tools: TOOLS_PLANNING,
|
|
255
|
+
artifacts: {
|
|
256
|
+
// Phase 3 migration (#4782): matches today's actual
|
|
257
|
+
// buildCompleteSlicePrompt inlining order. Overrides prepend +
|
|
258
|
+
// knowledge splice stay in the builder imperatively (see RFC
|
|
259
|
+
// #4924 — computed/prepend blocks are phase-4 composer work).
|
|
260
|
+
inline: ["roadmap", "slice-context", "slice-plan", "requirements", "prior-task-summaries", "templates"],
|
|
261
|
+
excerpt: [],
|
|
262
|
+
onDemand: [],
|
|
263
|
+
},
|
|
264
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
265
|
+
},
|
|
266
|
+
"reassess-roadmap": {
|
|
267
|
+
skills: { mode: "all" },
|
|
268
|
+
knowledge: "scoped",
|
|
269
|
+
memory: "critical-only",
|
|
270
|
+
codebaseMap: false,
|
|
271
|
+
preferences: "none",
|
|
272
|
+
tools: TOOLS_PLANNING,
|
|
273
|
+
artifacts: {
|
|
274
|
+
// Phase 2 pilot (#4782): manifest now matches today's actual
|
|
275
|
+
// buildReassessRoadmapPrompt behavior for equivalence. Phase 3
|
|
276
|
+
// will tighten this list once the composer reports real telemetry.
|
|
277
|
+
inline: ["roadmap", "slice-context", "slice-summary", "project", "requirements", "decisions"],
|
|
278
|
+
excerpt: [],
|
|
279
|
+
onDemand: [],
|
|
280
|
+
},
|
|
281
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
282
|
+
},
|
|
283
|
+
// ─── Task-scoped ─────────────────────────────────────────────────────
|
|
284
|
+
"execute-task": {
|
|
285
|
+
skills: { mode: "all" },
|
|
286
|
+
knowledge: "scoped",
|
|
287
|
+
memory: "prompt-relevant",
|
|
288
|
+
codebaseMap: true,
|
|
289
|
+
preferences: "active-only",
|
|
290
|
+
tools: TOOLS_ALL,
|
|
291
|
+
artifacts: {
|
|
292
|
+
inline: ["task-plan", "slice-plan", "prior-task-summaries", "templates"],
|
|
293
|
+
excerpt: [],
|
|
294
|
+
onDemand: ["slice-research"],
|
|
295
|
+
},
|
|
296
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
297
|
+
},
|
|
298
|
+
"reactive-execute": {
|
|
299
|
+
skills: { mode: "all" },
|
|
300
|
+
knowledge: "scoped",
|
|
301
|
+
memory: "prompt-relevant",
|
|
302
|
+
codebaseMap: true,
|
|
303
|
+
preferences: "active-only",
|
|
304
|
+
tools: TOOLS_ALL,
|
|
305
|
+
artifacts: {
|
|
306
|
+
inline: ["slice-plan", "prior-task-summaries", "templates"],
|
|
307
|
+
excerpt: [],
|
|
308
|
+
onDemand: ["slice-research"],
|
|
309
|
+
},
|
|
310
|
+
maxSystemPromptChars: COMMON_BUDGET_LARGE,
|
|
311
|
+
},
|
|
312
|
+
// ─── Ancillary units ─────────────────────────────────────────────────
|
|
313
|
+
"run-uat": {
|
|
314
|
+
skills: { mode: "all" },
|
|
315
|
+
knowledge: "critical-only",
|
|
316
|
+
memory: "critical-only",
|
|
317
|
+
codebaseMap: false,
|
|
318
|
+
preferences: "active-only",
|
|
319
|
+
tools: TOOLS_PLANNING,
|
|
320
|
+
artifacts: {
|
|
321
|
+
// Phase 3 migration (#4782): manifest matches today's actual
|
|
322
|
+
// buildRunUatPrompt inlining. Prior phase-1 entry listed
|
|
323
|
+
// `slice-plan` aspirationally — the real builder inlines the UAT
|
|
324
|
+
// file, the slice SUMMARY (optional), and the project row.
|
|
325
|
+
inline: ["slice-uat", "slice-summary", "project"],
|
|
326
|
+
excerpt: [],
|
|
327
|
+
onDemand: [],
|
|
328
|
+
},
|
|
329
|
+
maxSystemPromptChars: COMMON_BUDGET_SMALL,
|
|
330
|
+
},
|
|
331
|
+
"gate-evaluate": {
|
|
332
|
+
skills: { mode: "all" },
|
|
333
|
+
knowledge: "critical-only",
|
|
334
|
+
memory: "critical-only",
|
|
335
|
+
codebaseMap: false,
|
|
336
|
+
preferences: "active-only",
|
|
337
|
+
tools: TOOLS_PLANNING,
|
|
338
|
+
artifacts: {
|
|
339
|
+
inline: ["slice-plan", "prior-task-summaries"],
|
|
340
|
+
excerpt: [],
|
|
341
|
+
onDemand: [],
|
|
342
|
+
},
|
|
343
|
+
maxSystemPromptChars: COMMON_BUDGET_SMALL,
|
|
344
|
+
},
|
|
345
|
+
"rewrite-docs": {
|
|
346
|
+
skills: { mode: "all" },
|
|
347
|
+
knowledge: "scoped",
|
|
348
|
+
memory: "prompt-relevant",
|
|
349
|
+
codebaseMap: true,
|
|
350
|
+
preferences: "active-only",
|
|
351
|
+
tools: TOOLS_DOCS,
|
|
352
|
+
artifacts: {
|
|
353
|
+
inline: ["project", "requirements", "decisions", "templates"],
|
|
354
|
+
excerpt: [],
|
|
355
|
+
onDemand: [],
|
|
356
|
+
},
|
|
357
|
+
maxSystemPromptChars: COMMON_BUDGET_MEDIUM,
|
|
358
|
+
},
|
|
359
|
+
};
|
|
360
|
+
// ─── Lookup helper ────────────────────────────────────────────────────────
|
|
361
|
+
/**
|
|
362
|
+
* Return the manifest for a unit type, or null when the type is unknown.
|
|
363
|
+
*
|
|
364
|
+
* Callers MUST treat null as "fall through to today's default behavior"
|
|
365
|
+
* rather than erroring — unknown unit types may be experimental and
|
|
366
|
+
* should not crash the composer.
|
|
367
|
+
*/
|
|
368
|
+
export function resolveManifest(unitType) {
|
|
369
|
+
return UNIT_MANIFESTS[unitType] ?? null;
|
|
370
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export function buildDispatchEnvelope(input) {
|
|
2
|
+
return {
|
|
3
|
+
action: input.action,
|
|
4
|
+
nodeKind: input.node?.kind,
|
|
5
|
+
unitType: input.unitType,
|
|
6
|
+
unitId: input.unitId,
|
|
7
|
+
prompt: input.prompt,
|
|
8
|
+
reason: {
|
|
9
|
+
reasonCode: input.reasonCode,
|
|
10
|
+
summary: input.summary,
|
|
11
|
+
evidence: input.evidence,
|
|
12
|
+
blockedBy: input.blockedBy,
|
|
13
|
+
},
|
|
14
|
+
gateVerdict: input.gateVerdict,
|
|
15
|
+
constraints: input.node
|
|
16
|
+
? {
|
|
17
|
+
reads: input.node.reads,
|
|
18
|
+
writes: input.node.writes,
|
|
19
|
+
dependsOn: input.node.dependsOn,
|
|
20
|
+
}
|
|
21
|
+
: undefined,
|
|
22
|
+
trace: input.trace,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export function explainDispatch(envelope) {
|
|
26
|
+
const subject = envelope.unitType && envelope.unitId
|
|
27
|
+
? `${envelope.unitType} ${envelope.unitId}`
|
|
28
|
+
: envelope.nodeKind ?? envelope.action;
|
|
29
|
+
const blocked = envelope.reason.blockedBy && envelope.reason.blockedBy.length > 0
|
|
30
|
+
? ` Blocked by: ${envelope.reason.blockedBy.map((b) => `${b.kind}:${b.id}`).join(", ")}.`
|
|
31
|
+
: "";
|
|
32
|
+
return `[${envelope.reason.reasonCode}] ${subject}: ${envelope.reason.summary}.${blocked}`;
|
|
33
|
+
}
|
|
@@ -68,6 +68,16 @@ export function buildSidecarQueueNodes(queue) {
|
|
|
68
68
|
metadata: { index },
|
|
69
69
|
}));
|
|
70
70
|
}
|
|
71
|
+
export function buildExecutionGraphSnapshot(nodes, phase) {
|
|
72
|
+
const sorted = topologicalSort(nodes);
|
|
73
|
+
return {
|
|
74
|
+
capturedAt: new Date().toISOString(),
|
|
75
|
+
phase,
|
|
76
|
+
nodes: sorted,
|
|
77
|
+
order: sorted.map((node) => node.id),
|
|
78
|
+
conflicts: detectFileConflicts(nodes),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
71
81
|
export async function scheduleSidecarQueue(queue) {
|
|
72
82
|
if (queue.length <= 1)
|
|
73
83
|
return [...queue];
|
|
@@ -24,7 +24,8 @@ export class UokGateRunner {
|
|
|
24
24
|
async run(id, ctx) {
|
|
25
25
|
const gate = this.registry.get(id);
|
|
26
26
|
if (!gate) {
|
|
27
|
-
|
|
27
|
+
const now = new Date().toISOString();
|
|
28
|
+
const unknownResult = {
|
|
28
29
|
gateId: id,
|
|
29
30
|
gateType: "unknown",
|
|
30
31
|
outcome: "manual-attention",
|
|
@@ -33,16 +34,63 @@ export class UokGateRunner {
|
|
|
33
34
|
attempt: 1,
|
|
34
35
|
maxAttempts: 1,
|
|
35
36
|
retryable: false,
|
|
36
|
-
evaluatedAt:
|
|
37
|
+
evaluatedAt: now,
|
|
37
38
|
};
|
|
39
|
+
insertGateRun({
|
|
40
|
+
traceId: ctx.traceId,
|
|
41
|
+
turnId: ctx.turnId,
|
|
42
|
+
gateId: unknownResult.gateId,
|
|
43
|
+
gateType: unknownResult.gateType,
|
|
44
|
+
unitType: ctx.unitType,
|
|
45
|
+
unitId: ctx.unitId,
|
|
46
|
+
milestoneId: ctx.milestoneId,
|
|
47
|
+
sliceId: ctx.sliceId,
|
|
48
|
+
taskId: ctx.taskId,
|
|
49
|
+
outcome: unknownResult.outcome,
|
|
50
|
+
failureClass: unknownResult.failureClass,
|
|
51
|
+
rationale: unknownResult.rationale,
|
|
52
|
+
findings: unknownResult.findings,
|
|
53
|
+
attempt: unknownResult.attempt,
|
|
54
|
+
maxAttempts: unknownResult.maxAttempts,
|
|
55
|
+
retryable: unknownResult.retryable,
|
|
56
|
+
evaluatedAt: unknownResult.evaluatedAt,
|
|
57
|
+
});
|
|
58
|
+
emitUokAuditEvent(ctx.basePath, buildAuditEnvelope({
|
|
59
|
+
traceId: ctx.traceId,
|
|
60
|
+
turnId: ctx.turnId,
|
|
61
|
+
category: "gate",
|
|
62
|
+
type: "gate-run",
|
|
63
|
+
payload: {
|
|
64
|
+
gateId: unknownResult.gateId,
|
|
65
|
+
gateType: unknownResult.gateType,
|
|
66
|
+
outcome: unknownResult.outcome,
|
|
67
|
+
failureClass: unknownResult.failureClass,
|
|
68
|
+
attempt: unknownResult.attempt,
|
|
69
|
+
maxAttempts: unknownResult.maxAttempts,
|
|
70
|
+
retryable: unknownResult.retryable,
|
|
71
|
+
},
|
|
72
|
+
}));
|
|
73
|
+
return unknownResult;
|
|
38
74
|
}
|
|
39
75
|
let attempt = 0;
|
|
40
76
|
let final = null;
|
|
41
77
|
const maxAttemptsByFailureClass = RETRY_MATRIX;
|
|
42
|
-
|
|
78
|
+
const maxAttemptsCeiling = Math.max(...Object.values(RETRY_MATRIX)) + 1;
|
|
79
|
+
while (attempt < maxAttemptsCeiling) {
|
|
43
80
|
attempt += 1;
|
|
44
81
|
const now = new Date().toISOString();
|
|
45
|
-
|
|
82
|
+
let result;
|
|
83
|
+
try {
|
|
84
|
+
result = await gate.execute(ctx, attempt);
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
88
|
+
result = {
|
|
89
|
+
outcome: "fail",
|
|
90
|
+
failureClass: "unknown",
|
|
91
|
+
rationale: message,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
46
94
|
const failureClass = result.failureClass ?? (result.outcome === "pass" ? "none" : "unknown");
|
|
47
95
|
const retryBudget = maxAttemptsByFailureClass[failureClass] ?? 0;
|
|
48
96
|
const retryable = result.outcome !== "pass" && attempt <= retryBudget;
|
|
@@ -54,7 +102,7 @@ export class UokGateRunner {
|
|
|
54
102
|
rationale: result.rationale,
|
|
55
103
|
findings: result.findings,
|
|
56
104
|
attempt,
|
|
57
|
-
maxAttempts:
|
|
105
|
+
maxAttempts: retryBudget + 1,
|
|
58
106
|
retryable,
|
|
59
107
|
evaluatedAt: now,
|
|
60
108
|
};
|
|
@@ -32,7 +32,7 @@ export function writeTurnGitTransaction(args) {
|
|
|
32
32
|
},
|
|
33
33
|
}));
|
|
34
34
|
}
|
|
35
|
-
export function writeTurnCloseoutGitRecord(basePath, record) {
|
|
35
|
+
export function writeTurnCloseoutGitRecord(basePath, record, metadata) {
|
|
36
36
|
writeTurnGitTransaction({
|
|
37
37
|
basePath,
|
|
38
38
|
traceId: record.traceId,
|
|
@@ -45,6 +45,7 @@ export function writeTurnCloseoutGitRecord(basePath, record) {
|
|
|
45
45
|
status: record.failureClass === "git" ? "failed" : "ok",
|
|
46
46
|
error: record.failureClass === "git" ? "git closeout failure" : undefined,
|
|
47
47
|
metadata: {
|
|
48
|
+
...(metadata ?? {}),
|
|
48
49
|
turnStatus: record.status,
|
|
49
50
|
finishedAt: record.finishedAt,
|
|
50
51
|
activityFile: record.activityFile,
|
|
@@ -1,12 +1,35 @@
|
|
|
1
1
|
import { buildAuditEnvelope, emitUokAuditEvent } from "./audit.js";
|
|
2
2
|
import { writeTurnCloseoutGitRecord, writeTurnGitTransaction } from "./gitops.js";
|
|
3
|
+
import { acquireWriterToken, nextWriteRecord, releaseWriterToken } from "./writer.js";
|
|
3
4
|
export function createTurnObserver(options) {
|
|
4
5
|
let current = null;
|
|
6
|
+
let writerToken = null;
|
|
5
7
|
const phaseResults = [];
|
|
8
|
+
function nextSequenceMetadata(category, operation, metadata) {
|
|
9
|
+
if (!writerToken)
|
|
10
|
+
return metadata ?? {};
|
|
11
|
+
const record = nextWriteRecord({
|
|
12
|
+
basePath: options.basePath,
|
|
13
|
+
token: writerToken,
|
|
14
|
+
category,
|
|
15
|
+
operation,
|
|
16
|
+
metadata,
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
...(metadata ?? {}),
|
|
20
|
+
writeSequence: record.sequence.sequence,
|
|
21
|
+
writerTokenId: record.writerToken.tokenId,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
6
24
|
return {
|
|
7
25
|
onTurnStart(contract) {
|
|
8
26
|
current = contract;
|
|
9
27
|
phaseResults.length = 0;
|
|
28
|
+
writerToken = acquireWriterToken({
|
|
29
|
+
basePath: options.basePath,
|
|
30
|
+
traceId: contract.traceId,
|
|
31
|
+
turnId: contract.turnId,
|
|
32
|
+
});
|
|
10
33
|
if (options.enableGitops) {
|
|
11
34
|
writeTurnGitTransaction({
|
|
12
35
|
basePath: options.basePath,
|
|
@@ -18,10 +41,10 @@ export function createTurnObserver(options) {
|
|
|
18
41
|
action: options.gitAction,
|
|
19
42
|
push: options.gitPush,
|
|
20
43
|
status: "ok",
|
|
21
|
-
metadata: {
|
|
44
|
+
metadata: nextSequenceMetadata("gitops", "insert", {
|
|
22
45
|
iteration: contract.iteration,
|
|
23
46
|
sidecarKind: contract.sidecarKind,
|
|
24
|
-
},
|
|
47
|
+
}),
|
|
25
48
|
});
|
|
26
49
|
}
|
|
27
50
|
if (options.enableAudit) {
|
|
@@ -30,12 +53,12 @@ export function createTurnObserver(options) {
|
|
|
30
53
|
turnId: contract.turnId,
|
|
31
54
|
category: "orchestration",
|
|
32
55
|
type: "turn-start",
|
|
33
|
-
payload: {
|
|
56
|
+
payload: nextSequenceMetadata("audit", "append", {
|
|
34
57
|
iteration: contract.iteration,
|
|
35
58
|
unitType: contract.unitType,
|
|
36
59
|
unitId: contract.unitId,
|
|
37
60
|
sidecarKind: contract.sidecarKind,
|
|
38
|
-
},
|
|
61
|
+
}),
|
|
39
62
|
}));
|
|
40
63
|
}
|
|
41
64
|
},
|
|
@@ -59,7 +82,7 @@ export function createTurnObserver(options) {
|
|
|
59
82
|
action: options.gitAction,
|
|
60
83
|
push: options.gitPush,
|
|
61
84
|
status: "ok",
|
|
62
|
-
metadata: { action },
|
|
85
|
+
metadata: nextSequenceMetadata("gitops", "update", { action }),
|
|
63
86
|
});
|
|
64
87
|
}
|
|
65
88
|
if (phase === "unit") {
|
|
@@ -73,7 +96,7 @@ export function createTurnObserver(options) {
|
|
|
73
96
|
action: options.gitAction,
|
|
74
97
|
push: options.gitPush,
|
|
75
98
|
status: "ok",
|
|
76
|
-
metadata: { action },
|
|
99
|
+
metadata: nextSequenceMetadata("gitops", "update", { action }),
|
|
77
100
|
});
|
|
78
101
|
}
|
|
79
102
|
if (phase === "finalize") {
|
|
@@ -87,7 +110,7 @@ export function createTurnObserver(options) {
|
|
|
87
110
|
action: options.gitAction,
|
|
88
111
|
push: options.gitPush,
|
|
89
112
|
status: "ok",
|
|
90
|
-
metadata: { action },
|
|
113
|
+
metadata: nextSequenceMetadata("gitops", "update", { action }),
|
|
91
114
|
});
|
|
92
115
|
}
|
|
93
116
|
},
|
|
@@ -102,14 +125,14 @@ export function createTurnObserver(options) {
|
|
|
102
125
|
turnId: merged.turnId,
|
|
103
126
|
category: "orchestration",
|
|
104
127
|
type: "turn-result",
|
|
105
|
-
payload: {
|
|
128
|
+
payload: nextSequenceMetadata("audit", "append", {
|
|
106
129
|
unitType: merged.unitType,
|
|
107
130
|
unitId: merged.unitId,
|
|
108
131
|
status: merged.status,
|
|
109
132
|
failureClass: merged.failureClass,
|
|
110
133
|
error: merged.error,
|
|
111
134
|
phaseCount: merged.phaseResults.length,
|
|
112
|
-
},
|
|
135
|
+
}),
|
|
113
136
|
}));
|
|
114
137
|
}
|
|
115
138
|
if (options.enableGitops) {
|
|
@@ -124,8 +147,12 @@ export function createTurnObserver(options) {
|
|
|
124
147
|
gitPushed: options.gitPush,
|
|
125
148
|
finishedAt: merged.finishedAt,
|
|
126
149
|
};
|
|
127
|
-
writeTurnCloseoutGitRecord(options.basePath, closeout);
|
|
150
|
+
writeTurnCloseoutGitRecord(options.basePath, closeout, nextSequenceMetadata("gitops", "update", { action: "record" }));
|
|
151
|
+
}
|
|
152
|
+
if (writerToken) {
|
|
153
|
+
releaseWriterToken(options.basePath, writerToken);
|
|
128
154
|
}
|
|
155
|
+
writerToken = null;
|
|
129
156
|
current = null;
|
|
130
157
|
phaseResults.length = 0;
|
|
131
158
|
},
|