gsd-pi 2.77.0-dev.58d3d4d6c → 2.77.0-dev.cfd69e714
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 +1 -1
- package/dist/claude-cli-check.js +5 -1
- 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 +5 -1
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +481 -17
- package/dist/resources/extensions/gsd/auto/loop.js +43 -0
- package/dist/resources/extensions/gsd/auto/phases.js +15 -21
- package/dist/resources/extensions/gsd/auto/session.js +0 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +102 -24
- package/dist/resources/extensions/gsd/auto-model-selection.js +124 -4
- package/dist/resources/extensions/gsd/auto-post-unit.js +71 -64
- package/dist/resources/extensions/gsd/auto-prompts.js +329 -102
- package/dist/resources/extensions/gsd/auto-recovery.js +195 -23
- package/dist/resources/extensions/gsd/auto-start.js +34 -24
- 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 +31 -20
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +9 -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/detection.js +49 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +1 -1
- 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 +17 -5
- 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/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/prompts/complete-milestone.md +6 -2
- 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-parallel-orchestrator.js +278 -8
- package/dist/resources/extensions/gsd/state.js +44 -33
- package/dist/resources/extensions/gsd/sync-lock.js +98 -42
- 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/gate-runner.js +53 -5
- package/dist/resources/extensions/gsd/workflow-mcp.js +6 -0
- package/dist/resources/extensions/gsd/worktree-manager.js +34 -8
- 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 +5 -5
- 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 +5 -5
- 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/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/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 +80 -39
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- 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/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/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/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/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/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/dynamic-border.test.ts +26 -20
- 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 +36 -12
- 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/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 +41 -12
- 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/src/rpc-client.test.ts +109 -52
- package/packages/rpc-client/tsconfig.tsbuildinfo +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 +5 -1
- 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/tests/cli.test.ts +76 -7
- package/src/resources/extensions/github-sync/tests/templates.test.ts +33 -1
- package/src/resources/extensions/gsd/auto/loop.ts +47 -0
- package/src/resources/extensions/gsd/auto/phases.ts +16 -20
- package/src/resources/extensions/gsd/auto/session.ts +0 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +113 -24
- package/src/resources/extensions/gsd/auto-model-selection.ts +131 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +82 -73
- package/src/resources/extensions/gsd/auto-prompts.ts +330 -90
- package/src/resources/extensions/gsd/auto-recovery.ts +225 -24
- package/src/resources/extensions/gsd/auto-start.ts +54 -6
- 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 +43 -22
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +9 -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/detection.ts +58 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +1 -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 +133 -2
- package/src/resources/extensions/gsd/gsd-db.ts +6 -3
- package/src/resources/extensions/gsd/guided-flow.ts +20 -5
- 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/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/prompts/complete-milestone.md +6 -2
- 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-parallel-orchestrator.ts +309 -8
- package/src/resources/extensions/gsd/state.ts +49 -44
- 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/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 +94 -289
- 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-retry-mcp-churn-fixes.test.ts +8 -197
- package/src/resources/extensions/gsd/tests/auto-start-needs-discussion.test.ts +15 -58
- package/src/resources/extensions/gsd/tests/cache-staleness-regression.test.ts +17 -21
- 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-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/crash-recovery.test.ts +50 -1
- 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 -3
- package/src/resources/extensions/gsd/tests/dispatcher-stuck-planning.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +139 -129
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +9 -105
- 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/hook-key-parsing.test.ts +4 -55
- package/src/resources/extensions/gsd/tests/integration/all-milestones-complete-merge.test.ts +7 -57
- 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/interrupted-session-ui.test.ts +6 -9
- 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 -62
- package/src/resources/extensions/gsd/tests/milestone-scope-classifier.test.ts +187 -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 -49
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +6 -3
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +273 -133
- 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/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/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/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/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-parallel-orchestrator.test.ts +164 -1
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +5 -5
- package/src/resources/extensions/gsd/tests/structured-data-formatter.test.ts +11 -92
- 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/test-helpers.test.ts +12 -61
- package/src/resources/extensions/gsd/tests/test-helpers.ts +21 -8
- 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-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/validate-milestone.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/verify-artifact-tightened.test.ts +144 -81
- 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/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/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/gate-runner.ts +65 -5
- package/src/resources/extensions/gsd/workflow-mcp.ts +6 -0
- package/src/resources/extensions/gsd/worktree-manager.ts +55 -7
- 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 -144
- 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 -75
- package/src/resources/extensions/gsd/tests/forensics-journal.test.ts +0 -162
- package/src/resources/extensions/gsd/tests/forensics-worktree-telemetry.test.ts +0 -145
- 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 -130
- package/src/resources/extensions/gsd/tests/import-done-milestones.test.ts +0 -43
- /package/dist/web/standalone/.next/static/{Cev5xrAYA3ZGTRLyjR2fX → SvCJDZPQW104bR1KnBQg1}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{Cev5xrAYA3ZGTRLyjR2fX → SvCJDZPQW104bR1KnBQg1}/_ssgManifest.js +0 -0
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* paths, commit type inference, and the runGit shell helper.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { execFileSync
|
|
11
|
+
import { execFileSync } from "node:child_process";
|
|
12
12
|
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
14
14
|
import { gsdRoot } from "./paths.js";
|
|
@@ -409,6 +409,111 @@ export function resolveMilestoneIntegrationBranch(
|
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
411
|
|
|
412
|
+
// ─── Pre-Merge Command Tokenizer ──────────────────────────────────────────
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Tokenize a user-supplied pre-merge command string into argv form, with
|
|
416
|
+
* minimal support for double- and single-quoted strings. Designed to be
|
|
417
|
+
* sufficient for typical commands ("npm test", `npm run lint:ci`,
|
|
418
|
+
* `pnpm run tsc --noEmit`) without spawning a shell.
|
|
419
|
+
*
|
|
420
|
+
* Returns [] when the input is empty or whitespace-only.
|
|
421
|
+
* Throws when quoting is malformed.
|
|
422
|
+
*
|
|
423
|
+
* Used by GitServiceImpl.runPreMergeCheck to eliminate the shell-injection
|
|
424
|
+
* surface that running an arbitrary user string through a shell would create.
|
|
425
|
+
* (Issue #4980 HIGH-2)
|
|
426
|
+
*/
|
|
427
|
+
export function tokenizePreMergeCommand(input: string): string[] {
|
|
428
|
+
const tokens: string[] = [];
|
|
429
|
+
let current = "";
|
|
430
|
+
let i = 0;
|
|
431
|
+
let quote: "" | "'" | '"' = "";
|
|
432
|
+
let hasContent = false;
|
|
433
|
+
|
|
434
|
+
while (i < input.length) {
|
|
435
|
+
const ch = input[i]!;
|
|
436
|
+
if (quote) {
|
|
437
|
+
if (ch === quote) {
|
|
438
|
+
quote = "";
|
|
439
|
+
} else if (ch === "\\" && quote === '"' && i + 1 < input.length) {
|
|
440
|
+
current += input[i + 1];
|
|
441
|
+
i += 2;
|
|
442
|
+
continue;
|
|
443
|
+
} else {
|
|
444
|
+
current += ch;
|
|
445
|
+
}
|
|
446
|
+
i++;
|
|
447
|
+
continue;
|
|
448
|
+
}
|
|
449
|
+
if (ch === '"' || ch === "'") {
|
|
450
|
+
quote = ch;
|
|
451
|
+
hasContent = true;
|
|
452
|
+
i++;
|
|
453
|
+
continue;
|
|
454
|
+
}
|
|
455
|
+
if (ch === " " || ch === "\t") {
|
|
456
|
+
if (hasContent) {
|
|
457
|
+
tokens.push(current);
|
|
458
|
+
current = "";
|
|
459
|
+
hasContent = false;
|
|
460
|
+
}
|
|
461
|
+
i++;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
if (ch === "\\" && i + 1 < input.length) {
|
|
465
|
+
current += input[i + 1];
|
|
466
|
+
i += 2;
|
|
467
|
+
hasContent = true;
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
current += ch;
|
|
471
|
+
hasContent = true;
|
|
472
|
+
i++;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
if (quote) {
|
|
476
|
+
throw new Error(`Unterminated ${quote === '"' ? "double" : "single"} quote in pre-merge command`);
|
|
477
|
+
}
|
|
478
|
+
if (hasContent) tokens.push(current);
|
|
479
|
+
return tokens;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function containsUnquotedShellControl(input: string): boolean {
|
|
483
|
+
let i = 0;
|
|
484
|
+
let quote: "" | "'" | '"' = "";
|
|
485
|
+
|
|
486
|
+
while (i < input.length) {
|
|
487
|
+
const ch = input[i]!;
|
|
488
|
+
if (quote) {
|
|
489
|
+
if (ch === quote) {
|
|
490
|
+
quote = "";
|
|
491
|
+
} else if (ch === "\\" && quote === '"' && i + 1 < input.length) {
|
|
492
|
+
i += 2;
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
i++;
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
if (ch === '"' || ch === "'") {
|
|
500
|
+
quote = ch;
|
|
501
|
+
i++;
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
504
|
+
if (ch === "\\" && i + 1 < input.length) {
|
|
505
|
+
i += 2;
|
|
506
|
+
continue;
|
|
507
|
+
}
|
|
508
|
+
if (ch === ";" || ch === "&" || ch === "|" || ch === "`" || ch === "$" || ch === "<" || ch === ">") {
|
|
509
|
+
return true;
|
|
510
|
+
}
|
|
511
|
+
i++;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
|
|
412
517
|
// ─── Git Helper ────────────────────────────────────────────────────────────
|
|
413
518
|
|
|
414
519
|
|
|
@@ -802,8 +907,34 @@ export class GitServiceImpl {
|
|
|
802
907
|
}
|
|
803
908
|
}
|
|
804
909
|
|
|
910
|
+
// Tokenize and run via execFileSync (no shell). Shell metacharacters in
|
|
911
|
+
// user-supplied prefs.pre_merge_check would otherwise be interpreted as
|
|
912
|
+
// chaining/redirection (e.g. `;`, `&&`, `|`, backticks) — a privesc
|
|
913
|
+
// surface in repos with a checked-in `.gsd/PREFERENCES.md`.
|
|
914
|
+
// (Issue #4980 HIGH-2)
|
|
915
|
+
if (containsUnquotedShellControl(command)) {
|
|
916
|
+
return {
|
|
917
|
+
passed: false,
|
|
918
|
+
skipped: false,
|
|
919
|
+
command,
|
|
920
|
+
error:
|
|
921
|
+
"pre_merge_check contains shell metacharacters (;, &&, |, $, backticks, redirects). " +
|
|
922
|
+
"Put complex commands in a script file (e.g. './scripts/pre-merge.sh') and reference the script path instead.",
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
const tokens = tokenizePreMergeCommand(command);
|
|
927
|
+
if (tokens.length === 0) {
|
|
928
|
+
return { passed: true, skipped: true };
|
|
929
|
+
}
|
|
930
|
+
|
|
805
931
|
try {
|
|
806
|
-
|
|
932
|
+
execFileSync(tokens[0]!, tokens.slice(1), {
|
|
933
|
+
cwd: this.basePath,
|
|
934
|
+
stdio: "pipe",
|
|
935
|
+
encoding: "utf-8",
|
|
936
|
+
env: GIT_NO_PROMPT_ENV,
|
|
937
|
+
});
|
|
807
938
|
return { passed: true, skipped: false, command };
|
|
808
939
|
} catch (err) {
|
|
809
940
|
const msg = getErrorMessage(err);
|
|
@@ -180,7 +180,7 @@ function openRawDb(path: string): unknown {
|
|
|
180
180
|
return new Database(path);
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
const SCHEMA_VERSION = 22;
|
|
183
|
+
export const SCHEMA_VERSION = 22;
|
|
184
184
|
|
|
185
185
|
function indexExists(db: DbAdapter, name: string): boolean {
|
|
186
186
|
return !!db.prepare(
|
|
@@ -2946,6 +2946,9 @@ export function insertAssessment(entry: {
|
|
|
2946
2946
|
fullContent: string;
|
|
2947
2947
|
}): void {
|
|
2948
2948
|
if (!currentDb) throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
2949
|
+
// Idempotent: PRIMARY KEY is `path`, which is deterministic given (milestone_id, scope) per
|
|
2950
|
+
// the artifact-path resolver. Retrying the same reassess-roadmap silently overwrites the row
|
|
2951
|
+
// instead of accumulating duplicates.
|
|
2949
2952
|
currentDb.prepare(
|
|
2950
2953
|
`INSERT OR REPLACE INTO assessments (path, milestone_id, slice_id, task_id, status, scope, full_content, created_at)
|
|
2951
2954
|
VALUES (:path, :milestone_id, :slice_id, :task_id, :status, :scope, :full_content, :created_at)`,
|
|
@@ -3100,7 +3103,7 @@ function rowToGate(row: Record<string, unknown>): GateRow {
|
|
|
3100
3103
|
scope: row["scope"] as GateScope,
|
|
3101
3104
|
task_id: (row["task_id"] as string) ?? "",
|
|
3102
3105
|
status: row["status"] as GateStatus,
|
|
3103
|
-
verdict: (row["verdict"] as GateVerdict)
|
|
3106
|
+
verdict: row["status"] === "pending" ? null : (row["verdict"] as GateVerdict),
|
|
3104
3107
|
rationale: (row["rationale"] as string) || "",
|
|
3105
3108
|
findings: (row["findings"] as string) || "",
|
|
3106
3109
|
evaluated_at: (row["evaluated_at"] as string) ?? null,
|
|
@@ -3204,7 +3207,7 @@ export function getGateResults(milestoneId: string, sliceId: string, scope?: Gat
|
|
|
3204
3207
|
export function markAllGatesOmitted(milestoneId: string, sliceId: string): void {
|
|
3205
3208
|
if (!currentDb) return;
|
|
3206
3209
|
currentDb.prepare(
|
|
3207
|
-
`UPDATE quality_gates SET status = '
|
|
3210
|
+
`UPDATE quality_gates SET status = 'complete', verdict = 'omitted', evaluated_at = :now
|
|
3208
3211
|
WHERE milestone_id = :mid AND slice_id = :sid AND status = 'pending'`,
|
|
3209
3212
|
).run({
|
|
3210
3213
|
":mid": milestoneId,
|
|
@@ -39,7 +39,7 @@ import { ensureGitignore, ensurePreferences, untrackRuntimeFiles } from "./gitig
|
|
|
39
39
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
40
40
|
import { resolveUokFlags } from "./uok/flags.js";
|
|
41
41
|
import { ensurePlanV2Graph, isMissingFinalizedContextResult } from "./uok/plan-v2.js";
|
|
42
|
-
import { detectProjectState } from "./detection.js";
|
|
42
|
+
import { detectProjectState, hasGsdBootstrapArtifacts } from "./detection.js";
|
|
43
43
|
import { showProjectInit, offerMigration } from "./init-wizard.js";
|
|
44
44
|
import { validateDirectory } from "./validate-directory.js";
|
|
45
45
|
import { showConfirm } from "../shared/tui.js";
|
|
@@ -315,12 +315,29 @@ function extractAssistantText(msg: any): string {
|
|
|
315
315
|
|
|
316
316
|
/**
|
|
317
317
|
* Return true if the assistant message contains any tool-use block.
|
|
318
|
+
*
|
|
319
|
+
* The canonical pi-ai `AssistantMessage.content` (see packages/pi-ai/src/types.ts)
|
|
320
|
+
* uses `type: "toolCall"` and `type: "serverToolUse"` for tool invocations —
|
|
321
|
+
* every provider (anthropic-direct, claude-code-cli, openai, etc.) normalizes
|
|
322
|
+
* incoming tool blocks into these two shapes before they reach guided-flow.
|
|
323
|
+
*
|
|
324
|
+
* The Anthropic API wire shape `"tool_use"` / `"server_tool_use"` does NOT appear
|
|
325
|
+
* in the internal AssistantMessage — those literals are only used when sending
|
|
326
|
+
* messages back out to the Anthropic API. Matching them here was a latent bug:
|
|
327
|
+
* `hasToolUse` returned `false` for every real tool call, which let the
|
|
328
|
+
* empty-turn nudge fire and pre-empt MCP tools that block on the user
|
|
329
|
+
* (e.g. `ask_user_questions`). See investigation in PR for #4658.
|
|
318
330
|
*/
|
|
319
331
|
function hasToolUse(msg: any): boolean {
|
|
320
332
|
if (!msg) return false;
|
|
321
333
|
const content = msg.content;
|
|
322
334
|
if (!Array.isArray(content)) return false;
|
|
323
|
-
return content.some(
|
|
335
|
+
return content.some(
|
|
336
|
+
(b: any) =>
|
|
337
|
+
b &&
|
|
338
|
+
typeof b === "object" &&
|
|
339
|
+
(b.type === "toolCall" || b.type === "serverToolUse"),
|
|
340
|
+
);
|
|
324
341
|
}
|
|
325
342
|
|
|
326
343
|
/**
|
|
@@ -1491,9 +1508,7 @@ export async function showSmartEntry(
|
|
|
1491
1508
|
// A zombie .gsd/ state (symlink exists but missing PREFERENCES.md and
|
|
1492
1509
|
// milestones/) must trigger the init wizard, not skip it (#2942).
|
|
1493
1510
|
const gsdPath = gsdRoot(basePath);
|
|
1494
|
-
const hasBootstrapArtifacts =
|
|
1495
|
-
&& (existsSync(join(gsdPath, "PREFERENCES.md"))
|
|
1496
|
-
|| existsSync(join(gsdPath, "milestones")));
|
|
1511
|
+
const hasBootstrapArtifacts = hasGsdBootstrapArtifacts(gsdPath);
|
|
1497
1512
|
|
|
1498
1513
|
if (!hasBootstrapArtifacts) {
|
|
1499
1514
|
const detection = detectProjectState(basePath);
|
|
@@ -18,7 +18,10 @@ import type { MemoryAction } from './memory-store.js';
|
|
|
18
18
|
|
|
19
19
|
// ─── Types ──────────────────────────────────────────────────────────────────
|
|
20
20
|
|
|
21
|
-
export type LLMCallFn = (system: string, user: string) => Promise<string
|
|
21
|
+
export type LLMCallFn = ((system: string, user: string) => Promise<string>) & {
|
|
22
|
+
/** Promise resolving once the provider API key has been fetched (for tests). */
|
|
23
|
+
apiKeyReady?: Promise<string | undefined>;
|
|
24
|
+
};
|
|
22
25
|
|
|
23
26
|
// ─── Concurrency Guard ──────────────────────────────────────────────────────
|
|
24
27
|
|
|
@@ -92,8 +95,9 @@ export function buildMemoryLLMCall(ctx: ExtensionContext): LLMCallFn | null {
|
|
|
92
95
|
// which returns undefined for OAuth users (Claude Max / Claude Pro).
|
|
93
96
|
// See: https://github.com/gsd-build/gsd-2/issues/2959
|
|
94
97
|
const resolvedKeyPromise = ctx.modelRegistry.getApiKey(selectedModel).catch(() => undefined);
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
// Expose on the returned fn so tests can await resolution deterministically
|
|
99
|
+
// (avoids arbitrary setTimeout polling for an internal microtask).
|
|
100
|
+
const llmCall = async (system: string, user: string): Promise<string> => {
|
|
97
101
|
const { completeSimple } = await import('@gsd/pi-ai');
|
|
98
102
|
const resolvedApiKey = await resolvedKeyPromise;
|
|
99
103
|
const result: AssistantMessage = await completeSimple(selectedModel, {
|
|
@@ -111,6 +115,10 @@ export function buildMemoryLLMCall(ctx: ExtensionContext): LLMCallFn | null {
|
|
|
111
115
|
.map(c => c.text);
|
|
112
116
|
return textParts.join('');
|
|
113
117
|
};
|
|
118
|
+
// Attach the in-flight API-key resolution so tests (and callers) can
|
|
119
|
+
// `await llmCall.apiKeyReady` rather than relying on setTimeout polling.
|
|
120
|
+
(llmCall as LLMCallFn & { apiKeyReady?: Promise<string | undefined> }).apiKeyReady = resolvedKeyPromise;
|
|
121
|
+
return llmCall;
|
|
114
122
|
} catch {
|
|
115
123
|
return null;
|
|
116
124
|
}
|
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
// GSD-2 — Milestone scope classifier (#4781 / ADR-003 companion).
|
|
2
|
+
//
|
|
3
|
+
// Pure heuristics over milestone planning fields. Produces a PipelineVariant
|
|
4
|
+
// that downstream dispatch logic can use to shape the auto-mode sequence.
|
|
5
|
+
// No LLM calls, no file I/O, sub-millisecond.
|
|
6
|
+
//
|
|
7
|
+
// Distinct from `complexity-classifier.ts`, which decides *model tier*
|
|
8
|
+
// (light/standard/heavy) for an individual unit. This module decides
|
|
9
|
+
// *pipeline topology* for an entire milestone at plan-milestone time.
|
|
10
|
+
//
|
|
11
|
+
// This file ships the classifier in isolation. Dispatch-side wiring
|
|
12
|
+
// lands in follow-up PRs so the classification contract can be reviewed
|
|
13
|
+
// and tested before any behavior change reaches users.
|
|
14
|
+
|
|
15
|
+
export type PipelineVariant = "trivial" | "standard" | "complex";
|
|
16
|
+
|
|
17
|
+
export interface MilestoneScopeInput {
|
|
18
|
+
/** Milestone vision / elevator pitch. Free-form prose. */
|
|
19
|
+
vision?: string;
|
|
20
|
+
/** Success criteria, one per array entry. */
|
|
21
|
+
successCriteria?: string[];
|
|
22
|
+
/** Milestone title. */
|
|
23
|
+
title?: string;
|
|
24
|
+
/** Slice risks declared at plan-milestone time. */
|
|
25
|
+
keyRisks?: Array<{ risk?: string; whyItMatters?: string }>;
|
|
26
|
+
/** Definition-of-done lines. */
|
|
27
|
+
definitionOfDone?: string[];
|
|
28
|
+
/** Freeform "requirement coverage" marker. */
|
|
29
|
+
requirementCoverage?: string;
|
|
30
|
+
/** Verification hints (contract/integration/operational/uat). */
|
|
31
|
+
verificationContract?: string;
|
|
32
|
+
verificationIntegration?: string;
|
|
33
|
+
verificationOperational?: string;
|
|
34
|
+
verificationUat?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface ScopeClassificationResult {
|
|
38
|
+
variant: PipelineVariant;
|
|
39
|
+
/** Short human-readable reasons, one per triggered signal. */
|
|
40
|
+
reasons: string[];
|
|
41
|
+
/** Sub-signals for telemetry / debugging. Stable across releases. */
|
|
42
|
+
signals: {
|
|
43
|
+
triggeredOverride: boolean;
|
|
44
|
+
complexCount: number;
|
|
45
|
+
trivialCount: number;
|
|
46
|
+
fileCountHint: number | null;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ─── Keyword sets ─────────────────────────────────────────────────────────
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Override keywords that force `standard` (at minimum) regardless of
|
|
54
|
+
* apparent triviality. Presence of any of these signals work that is
|
|
55
|
+
* either security-sensitive, irreversible, or requires runtime verification
|
|
56
|
+
* a "trivial" pipeline would skip.
|
|
57
|
+
*
|
|
58
|
+
* Matched as case-insensitive word-boundary substrings. Conservative — err
|
|
59
|
+
* on the side of including a keyword; over-classifying to `standard` costs
|
|
60
|
+
* units, under-classifying could ship broken auth/security/migration work.
|
|
61
|
+
*/
|
|
62
|
+
const OVERRIDE_KEYWORDS: ReadonlyArray<string> = [
|
|
63
|
+
// Security-sensitive
|
|
64
|
+
"security", "auth", "authn", "authz", "authentication", "authorization",
|
|
65
|
+
"credential", "secret", "password", "token", "oauth", "encrypt", "decrypt",
|
|
66
|
+
"vulnerability", "exploit", "permission", "rbac", "acl",
|
|
67
|
+
// Data-migration / irreversible
|
|
68
|
+
"migration", "migrate", "schema change", "data migration",
|
|
69
|
+
"backfill", "drop column", "drop table",
|
|
70
|
+
// Compliance / regulatory
|
|
71
|
+
"compliance", "gdpr", "hipaa", "soc2", "pci",
|
|
72
|
+
// Infra / deploy — runtime verification needed
|
|
73
|
+
"deploy", "rollout", "canary", "production database",
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Keywords that contribute to `complex` classification on their own.
|
|
78
|
+
* Different from OVERRIDE_KEYWORDS in that a single match bumps to
|
|
79
|
+
* complex, not just to standard.
|
|
80
|
+
*/
|
|
81
|
+
const COMPLEX_KEYWORDS: ReadonlyArray<string> = [
|
|
82
|
+
"multi-service", "distributed", "consensus", "saga", "eventual consistency",
|
|
83
|
+
"breaking change", "api contract change", "schema redesign",
|
|
84
|
+
"architect", "architecture", "refactor core",
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Trivial-signal keywords: presence strongly suggests a simple, contained
|
|
89
|
+
* deliverable. Only effective when combined with low file count / no tests
|
|
90
|
+
* / no override keywords.
|
|
91
|
+
*/
|
|
92
|
+
const TRIVIAL_KEYWORDS: ReadonlyArray<string> = [
|
|
93
|
+
"single file", "one file", "static html", "static page",
|
|
94
|
+
"one-page", "landing page", "readme", "docs only", "typo", "rename",
|
|
95
|
+
"spelling", "comment", "changelog",
|
|
96
|
+
// Browser-only / no-build deliverable shapes (b23 forensic case).
|
|
97
|
+
"pure html", "browser-based", "no build step", "no build tooling",
|
|
98
|
+
"localstorage", "client-only", "no backend", "no server", "no backend.",
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
// ─── Heuristics ───────────────────────────────────────────────────────────
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Estimate how many distinct files the milestone will touch, based on
|
|
105
|
+
* explicit mentions in the input text. Returns `null` when no hint is
|
|
106
|
+
* discoverable — callers should treat that as "unknown, no signal."
|
|
107
|
+
*/
|
|
108
|
+
function extractFileCountHint(text: string): number | null {
|
|
109
|
+
// Explicit phrasing: "a single file", "two files", "3 files"
|
|
110
|
+
const singleFileMatch = /\b(a|one|single)\s+(file|page)\b/i.test(text);
|
|
111
|
+
if (singleFileMatch) return 1;
|
|
112
|
+
|
|
113
|
+
const digitMatch = text.match(/\b(\d+)\s+files?\b/i);
|
|
114
|
+
if (digitMatch) {
|
|
115
|
+
const n = parseInt(digitMatch[1], 10);
|
|
116
|
+
if (!Number.isNaN(n)) return n;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const wordMatch = text.match(/\b(two|three|four|five|six|seven|eight|nine|ten)\s+files?\b/i);
|
|
120
|
+
if (wordMatch) {
|
|
121
|
+
const wordMap: Record<string, number> = {
|
|
122
|
+
two: 2, three: 3, four: 4, five: 5,
|
|
123
|
+
six: 6, seven: 7, eight: 8, nine: 9, ten: 10,
|
|
124
|
+
};
|
|
125
|
+
return wordMap[wordMatch[1].toLowerCase()] ?? null;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function escapeRegExp(value: string): string {
|
|
132
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function containsAnyKeyword(haystack: string, keywords: ReadonlyArray<string>): string[] {
|
|
136
|
+
const lower = haystack.toLowerCase();
|
|
137
|
+
const hits: string[] = [];
|
|
138
|
+
for (const kw of keywords) {
|
|
139
|
+
// Word-boundary match to prevent substring collisions (e.g. "auth"
|
|
140
|
+
// must not match "author", "api" must not match "capital"). Phrases
|
|
141
|
+
// containing non-word characters (hyphens, slashes) still work because
|
|
142
|
+
// `\b` sits at the word-char / non-word-char transition, so
|
|
143
|
+
// `\bbrowser-based\b` matches "browser-based" bounded by whitespace
|
|
144
|
+
// or punctuation on either side.
|
|
145
|
+
const pattern = new RegExp(String.raw`\b${escapeRegExp(kw)}\b`, "i");
|
|
146
|
+
if (pattern.test(lower)) hits.push(kw);
|
|
147
|
+
}
|
|
148
|
+
return hits;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* True when `term` appears in the text without an immediately preceding
|
|
153
|
+
* negator (no / without / not / zero / skip) in the same clause. Used to
|
|
154
|
+
* keep phrases like "no backend" or "no tests" from flipping a trivial-
|
|
155
|
+
* class milestone to standard. Best-effort; imperfect English parsing,
|
|
156
|
+
* biased toward false negatives (if unsure, treats term as present —
|
|
157
|
+
* which routes to standard, the safe pipeline).
|
|
158
|
+
*/
|
|
159
|
+
function mentionsWithoutNegation(text: string, term: string): boolean {
|
|
160
|
+
const lower = text.toLowerCase();
|
|
161
|
+
const termPattern = new RegExp(String.raw`\b${term}\b`, "gi");
|
|
162
|
+
const matches = Array.from(lower.matchAll(termPattern));
|
|
163
|
+
for (const m of matches) {
|
|
164
|
+
const start = m.index ?? 0;
|
|
165
|
+
const windowStart = Math.max(0, start - 30);
|
|
166
|
+
const window = lower.slice(windowStart, start);
|
|
167
|
+
// Negator anywhere in the 30-char lookback window counts as negation —
|
|
168
|
+
// covers "no backend", "without a server", "not using api", "zero
|
|
169
|
+
// dependencies on an api". If a sentence break intervenes between the
|
|
170
|
+
// negator and the term, treat as a different clause (positive mention).
|
|
171
|
+
const hasNegator = /(^|[^a-z0-9])(no|without|not|zero|skip(s|ping)?|drops?)\b/i.test(window);
|
|
172
|
+
const hasSentenceBreak = /[.;!?]/.test(window);
|
|
173
|
+
if (hasNegator && !hasSentenceBreak) continue;
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function mentionsTests(haystack: string): boolean {
|
|
180
|
+
return mentionsWithoutNegation(haystack, "test")
|
|
181
|
+
|| mentionsWithoutNegation(haystack, "tests")
|
|
182
|
+
|| mentionsWithoutNegation(haystack, "testing")
|
|
183
|
+
|| mentionsWithoutNegation(haystack, "spec")
|
|
184
|
+
|| mentionsWithoutNegation(haystack, "unit test")
|
|
185
|
+
|| mentionsWithoutNegation(haystack, "integration test");
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function mentionsBackend(haystack: string): boolean {
|
|
189
|
+
return mentionsWithoutNegation(haystack, "api")
|
|
190
|
+
|| mentionsWithoutNegation(haystack, "backend")
|
|
191
|
+
|| mentionsWithoutNegation(haystack, "server")
|
|
192
|
+
|| mentionsWithoutNegation(haystack, "database")
|
|
193
|
+
|| mentionsWithoutNegation(haystack, "endpoint");
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ─── DB adapter ───────────────────────────────────────────────────────────
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Shape adapter: convert a milestone DB row into the classifier input
|
|
200
|
+
* object. Keeps `milestone-scope-classifier.ts` free of DB types at the
|
|
201
|
+
* module boundary — callers can either use this helper or hand-build the
|
|
202
|
+
* input themselves (e.g. from plan-milestone tool params before insert).
|
|
203
|
+
*/
|
|
204
|
+
export function milestoneRowToScopeInput(row: {
|
|
205
|
+
title?: string;
|
|
206
|
+
vision?: string;
|
|
207
|
+
success_criteria?: string[];
|
|
208
|
+
key_risks?: Array<{ risk?: string; whyItMatters?: string }>;
|
|
209
|
+
definition_of_done?: string[];
|
|
210
|
+
requirement_coverage?: string;
|
|
211
|
+
verification_contract?: string;
|
|
212
|
+
verification_integration?: string;
|
|
213
|
+
verification_operational?: string;
|
|
214
|
+
verification_uat?: string;
|
|
215
|
+
}): MilestoneScopeInput {
|
|
216
|
+
return {
|
|
217
|
+
title: row.title,
|
|
218
|
+
vision: row.vision,
|
|
219
|
+
successCriteria: row.success_criteria,
|
|
220
|
+
keyRisks: row.key_risks,
|
|
221
|
+
definitionOfDone: row.definition_of_done,
|
|
222
|
+
requirementCoverage: row.requirement_coverage,
|
|
223
|
+
verificationContract: row.verification_contract,
|
|
224
|
+
verificationIntegration: row.verification_integration,
|
|
225
|
+
verificationOperational: row.verification_operational,
|
|
226
|
+
verificationUat: row.verification_uat,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Compute the pipeline variant for a milestone by reading its planning
|
|
232
|
+
* fields from the DB and running the classifier. Returns `null` when
|
|
233
|
+
* classification is unavailable (DB closed, milestone missing, unexpected
|
|
234
|
+
* error) — callers MUST treat null as "run the full pipeline" so a
|
|
235
|
+
* classification failure never silently downshifts dispatch.
|
|
236
|
+
*/
|
|
237
|
+
export async function getMilestonePipelineVariant(mid: string): Promise<PipelineVariant | null> {
|
|
238
|
+
try {
|
|
239
|
+
const { isDbAvailable, getMilestone } = await import("./gsd-db.js");
|
|
240
|
+
if (!isDbAvailable()) return null;
|
|
241
|
+
const row = getMilestone(mid);
|
|
242
|
+
if (!row) return null;
|
|
243
|
+
return classifyMilestoneScope(milestoneRowToScopeInput(row)).variant;
|
|
244
|
+
} catch {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// ─── Public API ───────────────────────────────────────────────────────────
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Classify a milestone's pipeline variant based on its planning inputs.
|
|
253
|
+
*
|
|
254
|
+
* Precedence (matches implementation order — complex-first so that
|
|
255
|
+
* security-sensitive architecture refactors correctly route to complex
|
|
256
|
+
* rather than standard; the override hit is still recorded in
|
|
257
|
+
* `signals.triggeredOverride` for telemetry):
|
|
258
|
+
* 1. Complex-signal keyword OR ≥ 8 file hint OR architecture/refactor-core
|
|
259
|
+
* language → `complex`.
|
|
260
|
+
* 2. Override keyword → `standard` (at minimum). Prevents trivial
|
|
261
|
+
* misclassification of security / auth / migration work.
|
|
262
|
+
* 3. Trivial-signal keyword AND ≤ 2 file hint AND no tests mentioned AND
|
|
263
|
+
* no backend mentioned → `trivial`.
|
|
264
|
+
* 4. Otherwise → `standard`.
|
|
265
|
+
*
|
|
266
|
+
* Ambiguity → `standard` (today's default). Safe to run the full pipeline.
|
|
267
|
+
*/
|
|
268
|
+
export function classifyMilestoneScope(input: MilestoneScopeInput): ScopeClassificationResult {
|
|
269
|
+
const haystack = [
|
|
270
|
+
input.title ?? "",
|
|
271
|
+
input.vision ?? "",
|
|
272
|
+
(input.successCriteria ?? []).join("\n"),
|
|
273
|
+
(input.keyRisks ?? []).map(r => `${r.risk ?? ""} ${r.whyItMatters ?? ""}`).join("\n"),
|
|
274
|
+
(input.definitionOfDone ?? []).join("\n"),
|
|
275
|
+
input.requirementCoverage ?? "",
|
|
276
|
+
input.verificationContract ?? "",
|
|
277
|
+
input.verificationIntegration ?? "",
|
|
278
|
+
input.verificationOperational ?? "",
|
|
279
|
+
input.verificationUat ?? "",
|
|
280
|
+
].join("\n");
|
|
281
|
+
|
|
282
|
+
const overrideHits = containsAnyKeyword(haystack, OVERRIDE_KEYWORDS);
|
|
283
|
+
const complexHits = containsAnyKeyword(haystack, COMPLEX_KEYWORDS);
|
|
284
|
+
const trivialHits = containsAnyKeyword(haystack, TRIVIAL_KEYWORDS);
|
|
285
|
+
const fileCountHint = extractFileCountHint(haystack);
|
|
286
|
+
const hasTests = mentionsTests(haystack);
|
|
287
|
+
const hasBackend = mentionsBackend(haystack);
|
|
288
|
+
|
|
289
|
+
const reasons: string[] = [];
|
|
290
|
+
|
|
291
|
+
// Rule 2: complex-class signals. Evaluated before override because a
|
|
292
|
+
// complex + override input should land in complex, not standard.
|
|
293
|
+
if (complexHits.length > 0) {
|
|
294
|
+
reasons.push(`complex keywords: ${complexHits.slice(0, 3).join(", ")}`);
|
|
295
|
+
}
|
|
296
|
+
if (fileCountHint !== null && fileCountHint >= 8) {
|
|
297
|
+
reasons.push(`file count hint: ${fileCountHint}`);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const isComplex = complexHits.length > 0 || (fileCountHint !== null && fileCountHint >= 8);
|
|
301
|
+
|
|
302
|
+
if (isComplex) {
|
|
303
|
+
return {
|
|
304
|
+
variant: "complex",
|
|
305
|
+
reasons,
|
|
306
|
+
signals: {
|
|
307
|
+
triggeredOverride: overrideHits.length > 0,
|
|
308
|
+
complexCount: complexHits.length,
|
|
309
|
+
trivialCount: trivialHits.length,
|
|
310
|
+
fileCountHint,
|
|
311
|
+
},
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Rule 1: override keywords force standard.
|
|
316
|
+
if (overrideHits.length > 0) {
|
|
317
|
+
return {
|
|
318
|
+
variant: "standard",
|
|
319
|
+
reasons: [`override keywords: ${overrideHits.slice(0, 3).join(", ")}`],
|
|
320
|
+
signals: {
|
|
321
|
+
triggeredOverride: true,
|
|
322
|
+
complexCount: complexHits.length,
|
|
323
|
+
trivialCount: trivialHits.length,
|
|
324
|
+
fileCountHint,
|
|
325
|
+
},
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Rule 3: trivial signals — require ALL of: trivial-keyword, low file
|
|
330
|
+
// hint (or nothing suggesting high count), no test mention, no backend
|
|
331
|
+
// mention.
|
|
332
|
+
const fileCountOk = fileCountHint === null || fileCountHint <= 2;
|
|
333
|
+
const trivial =
|
|
334
|
+
trivialHits.length > 0 &&
|
|
335
|
+
fileCountOk &&
|
|
336
|
+
!hasTests &&
|
|
337
|
+
!hasBackend;
|
|
338
|
+
|
|
339
|
+
if (trivial) {
|
|
340
|
+
reasons.push(`trivial keywords: ${trivialHits.slice(0, 3).join(", ")}`);
|
|
341
|
+
if (fileCountHint !== null) reasons.push(`file count hint: ${fileCountHint}`);
|
|
342
|
+
reasons.push("no tests mentioned", "no backend mentioned");
|
|
343
|
+
return {
|
|
344
|
+
variant: "trivial",
|
|
345
|
+
reasons,
|
|
346
|
+
signals: {
|
|
347
|
+
triggeredOverride: false,
|
|
348
|
+
complexCount: complexHits.length,
|
|
349
|
+
trivialCount: trivialHits.length,
|
|
350
|
+
fileCountHint,
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// Rule 4: fallback.
|
|
356
|
+
return {
|
|
357
|
+
variant: "standard",
|
|
358
|
+
reasons: reasons.length > 0 ? reasons : ["no strong signals — default"],
|
|
359
|
+
signals: {
|
|
360
|
+
triggeredOverride: overrideHits.length > 0,
|
|
361
|
+
complexCount: complexHits.length,
|
|
362
|
+
trivialCount: trivialHits.length,
|
|
363
|
+
fileCountHint,
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
@@ -57,6 +57,9 @@ export const BUNDLED_COST_TABLE: ModelCostEntry[] = [
|
|
|
57
57
|
{ id: "gpt-5.3-codex-spark", inputPer1k: 0.0003, outputPer1k: 0.0012, updatedAt: "2026-03-29" },
|
|
58
58
|
{ id: "gpt-5.4", inputPer1k: 0.005, outputPer1k: 0.02, updatedAt: "2026-03-29" },
|
|
59
59
|
{ id: "gpt-5.4-mini", inputPer1k: 0.00075, outputPer1k: 0.0045, updatedAt: "2026-04-18" },
|
|
60
|
+
// GPT-5.5 API list price, also used for live Codex OAuth routing.
|
|
61
|
+
// Source: https://openai.com/api/pricing/
|
|
62
|
+
{ id: "gpt-5.5", inputPer1k: 0.005, outputPer1k: 0.03, updatedAt: "2026-04-23" },
|
|
60
63
|
|
|
61
64
|
// Google
|
|
62
65
|
{ id: "gemini-2.0-flash", inputPer1k: 0.0001, outputPer1k: 0.0004, updatedAt: "2025-03-15" },
|
|
@@ -109,6 +109,7 @@ export const MODEL_CAPABILITY_TIER: Record<string, ComplexityTier> = {
|
|
|
109
109
|
"gpt-5.2-codex": "heavy",
|
|
110
110
|
"gpt-5.3-codex": "heavy",
|
|
111
111
|
"gpt-5.4": "heavy",
|
|
112
|
+
"gpt-5.5": "heavy",
|
|
112
113
|
"o1": "heavy",
|
|
113
114
|
"o3": "heavy",
|
|
114
115
|
"o4-mini": "heavy",
|
|
@@ -144,6 +145,7 @@ const MODEL_COST_PER_1K_INPUT: Record<string, number> = {
|
|
|
144
145
|
"gpt-5.3-codex": 0.005,
|
|
145
146
|
"gpt-5.3-codex-spark": 0.0003,
|
|
146
147
|
"gpt-5.4": 0.005,
|
|
148
|
+
"gpt-5.5": 0.005,
|
|
147
149
|
"o4-mini": 0.005,
|
|
148
150
|
"o4-mini-deep-research": 0.005,
|
|
149
151
|
"gemini-2.0-flash": 0.0001,
|
|
@@ -187,6 +189,10 @@ export const MODEL_CAPABILITY_PROFILES: Record<string, ModelCapabilities> = {
|
|
|
187
189
|
"gpt-5.3-codex": { coding: 94, debugging: 91, research: 74, reasoning: 89, speed: 50, longContext: 80, instruction: 89 },
|
|
188
190
|
"gpt-5.3-codex-spark": { coding: 68, debugging: 58, research: 42, reasoning: 52, speed: 90, longContext: 50, instruction: 74 },
|
|
189
191
|
"gpt-5.4": { coding: 95, debugging: 92, research: 88, reasoning: 94, speed: 42, longContext: 88, instruction: 92 },
|
|
192
|
+
// GPT-5.5 scores are relative to the existing gpt-5.4 profile and backed by
|
|
193
|
+
// OpenAI's 2026-04-23 published eval deltas across coding, tool use, and long context.
|
|
194
|
+
// Source: https://openai.com/index/introducing-gpt-5-5/
|
|
195
|
+
"gpt-5.5": { coding: 96, debugging: 93, research: 89, reasoning: 95, speed: 42, longContext: 90, instruction: 93 },
|
|
190
196
|
|
|
191
197
|
// ── OpenAI o-series (reasoning-first) ──────────────────────────────────────
|
|
192
198
|
"o1": { coding: 78, debugging: 82, research: 78, reasoning: 90, speed: 20, longContext: 65, instruction: 82 },
|