gsd-pi 2.75.0-dev.063e5a3 → 2.75.0-dev.fd2382b9f
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 +186 -149
- package/dist/claude-cli-check.d.ts +10 -0
- package/dist/claude-cli-check.js +13 -3
- package/dist/headless-events.d.ts +1 -1
- package/dist/headless-events.js +5 -2
- package/dist/headless.js +5 -6
- package/dist/loader.js +0 -0
- package/dist/onboarding.js +39 -14
- package/dist/resources/extensions/ask-user-questions.js +17 -5
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +12 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +76 -4
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +9 -0
- package/dist/resources/extensions/gsd/auto/loop.js +67 -4
- package/dist/resources/extensions/gsd/auto/phases.js +70 -47
- package/dist/resources/extensions/gsd/auto/resolve.js +1 -1
- package/dist/resources/extensions/gsd/auto/run-unit.js +10 -1
- package/dist/resources/extensions/gsd/auto/session.js +5 -0
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +20 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +15 -7
- package/dist/resources/extensions/gsd/auto-dispatch.js +112 -6
- package/dist/resources/extensions/gsd/auto-loop.js +1 -1
- package/dist/resources/extensions/gsd/auto-model-selection.js +10 -2
- package/dist/resources/extensions/gsd/auto-post-unit.js +9 -7
- package/dist/resources/extensions/gsd/auto-prompts.js +151 -37
- package/dist/resources/extensions/gsd/auto-recovery.js +57 -0
- package/dist/resources/extensions/gsd/auto-start.js +5 -3
- package/dist/resources/extensions/gsd/auto-verification.js +3 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +55 -1
- package/dist/resources/extensions/gsd/auto.js +50 -25
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +8 -21
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +22 -4
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +29 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -0
- package/dist/resources/extensions/gsd/commands/catalog.js +67 -3
- package/dist/resources/extensions/gsd/commands/handlers/core.js +6 -0
- package/dist/resources/extensions/gsd/commands/handlers/escalate.js +171 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +16 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +228 -29
- package/dist/resources/extensions/gsd/commands-cmux.js +5 -2
- package/dist/resources/extensions/gsd/commands-debug.js +388 -0
- package/dist/resources/extensions/gsd/commands-do.js +1 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +21 -2
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands-scan.js +94 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +101 -2
- package/dist/resources/extensions/gsd/custom-workflow-engine.js +74 -54
- package/dist/resources/extensions/gsd/db-writer.js +1 -0
- package/dist/resources/extensions/gsd/debug-session-store.js +238 -0
- package/dist/resources/extensions/gsd/definition-loader.js +7 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +9 -9
- package/dist/resources/extensions/gsd/doctor-git-checks.js +5 -1
- package/dist/resources/extensions/gsd/doctor-proactive.js +4 -1
- package/dist/resources/extensions/gsd/doctor-providers.js +48 -20
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +22 -4
- package/dist/resources/extensions/gsd/doctor.js +7 -1
- package/dist/resources/extensions/gsd/error-classifier.js +6 -3
- package/dist/resources/extensions/gsd/escalation.js +321 -0
- package/dist/resources/extensions/gsd/forensics.js +26 -29
- package/dist/resources/extensions/gsd/git-service.js +0 -1
- package/dist/resources/extensions/gsd/graph.js +26 -2
- package/dist/resources/extensions/gsd/gsd-db.js +254 -29
- package/dist/resources/extensions/gsd/health-widget-core.js +42 -14
- package/dist/resources/extensions/gsd/health-widget.js +7 -4
- package/dist/resources/extensions/gsd/metrics.js +1 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +3 -1
- package/dist/resources/extensions/gsd/model-router.js +7 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +137 -5
- package/dist/resources/extensions/gsd/notification-widget.js +24 -39
- package/dist/resources/extensions/gsd/notifications.js +4 -0
- package/dist/resources/extensions/gsd/post-execution-checks.js +27 -11
- package/dist/resources/extensions/gsd/pre-execution-checks.js +97 -4
- package/dist/resources/extensions/gsd/preferences-models.js +1 -0
- package/dist/resources/extensions/gsd/preferences-types.js +2 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +42 -8
- package/dist/resources/extensions/gsd/preferences.js +10 -10
- package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
- package/dist/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
- package/dist/resources/extensions/gsd/prompts/execute-task.md +12 -0
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +69 -0
- package/dist/resources/extensions/gsd/prompts/scan.md +79 -0
- package/dist/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
- package/dist/resources/extensions/gsd/run-manager.js +37 -17
- package/dist/resources/extensions/gsd/state.js +47 -3
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
- package/dist/resources/extensions/gsd/tools/complete-task.js +80 -0
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -12
- package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -2
- package/dist/resources/extensions/gsd/uok/flags.js +7 -7
- package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
- package/dist/resources/extensions/gsd/workflow-dispatch.js +64 -0
- package/dist/resources/extensions/gsd/workflow-install.js +327 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +8 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +1 -6
- package/dist/resources/extensions/gsd/workflow-plugins.js +346 -0
- package/dist/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
- package/dist/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
- package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
- package/dist/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
- package/dist/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
- package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
- package/dist/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
- package/dist/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
- package/dist/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
- package/dist/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
- package/dist/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
- package/dist/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
- package/dist/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
- package/dist/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/registry.json +184 -0
- package/dist/resources/extensions/gsd/workflow-templates/release.md +118 -0
- package/dist/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
- package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/spike.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +42 -1
- package/dist/resources/extensions/remote-questions/commands.js +380 -0
- package/dist/resources/extensions/remote-questions/manager.js +39 -5
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +79 -4
- package/dist/resources/extensions/shared/interview-ui.js +189 -1
- package/dist/resources/extensions/shared/layout-utils.js +17 -0
- package/dist/resources/extensions/shared/rtk-shared.js +47 -0
- package/dist/resources/extensions/shared/rtk.js +3 -46
- package/dist/resources/skills/create-workflow/SKILL.md +33 -6
- package/dist/rtk-shared.d.ts +10 -0
- package/dist/rtk-shared.js +47 -0
- package/dist/rtk.d.ts +2 -6
- package/dist/rtk.js +3 -48
- package/dist/shared/workspace-types.d.ts +52 -0
- package/dist/shared/workspace-types.js +1 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-check.d.ts +10 -0
- package/dist/update-check.js +24 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +6 -6
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- 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/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +2 -2
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +6 -6
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- 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/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/2826.02df9631042cc18e.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-b868033a5834586d.js → webpack-6c7cda3e318eedb6.js} +1 -1
- package/dist/web/standalone/.next/static/css/3e9cdadb4d23b8a4.css +1 -0
- package/dist/welcome-screen.js +48 -24
- package/dist/wizard.js +2 -2
- package/dist/worktree-cli.d.ts +6 -5
- package/dist/worktree-cli.js +23 -7
- package/package.json +3 -3
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- 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 +3 -2
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +68 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +68 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/anthropic.js +17 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/google-antigravity.js +17 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/groq.d.ts +0 -153
- package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/groq.js +0 -153
- package/packages/pi-ai/dist/models/generated/groq.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/index.d.ts +136 -153
- 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/openrouter.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openrouter.js +17 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +17 -0
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +22 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +40 -6
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.js +106 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +42 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +20 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +32 -2
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js +12 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts +11 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +18 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js +12 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +50 -0
- package/packages/pi-ai/src/models/capability-patches.ts +5 -2
- package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +68 -0
- package/packages/pi-ai/src/models/generated/anthropic.ts +17 -0
- package/packages/pi-ai/src/models/generated/google-antigravity.ts +17 -0
- package/packages/pi-ai/src/models/generated/groq.ts +0 -153
- package/packages/pi-ai/src/models/generated/openai-codex.ts +17 -0
- package/packages/pi-ai/src/models/generated/openrouter.ts +17 -0
- package/packages/pi-ai/src/models.generated.test.ts +17 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +41 -7
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +47 -1
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +15 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +36 -3
- package/packages/pi-ai/src/providers/anthropic.ts +19 -1
- package/packages/pi-ai/src/utils/oauth/openai-codex.ts +15 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +38 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +14 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +34 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js +74 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +4 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +32 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +32 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +2 -2
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +17 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +48 -34
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +83 -33
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +77 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +1 -66
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -75
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +192 -24
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +56 -0
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +83 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +35 -0
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +4 -1
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +37 -1
- package/packages/pi-coding-agent/src/core/sdk.ts +41 -0
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +19 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +53 -31
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +88 -36
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +83 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +2 -83
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +208 -27
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js +77 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -66
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +1 -75
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.js +192 -24
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/src/resources/extensions/ask-user-questions.ts +24 -6
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/readiness.ts +13 -2
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +94 -4
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +84 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +10 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
- package/src/resources/extensions/gsd/auto/loop.ts +109 -3
- package/src/resources/extensions/gsd/auto/phases.ts +94 -60
- package/src/resources/extensions/gsd/auto/resolve.ts +1 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +11 -1
- package/src/resources/extensions/gsd/auto/session.ts +7 -0
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +20 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +21 -4
- package/src/resources/extensions/gsd/auto-dispatch.ts +123 -5
- package/src/resources/extensions/gsd/auto-loop.ts +1 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +13 -2
- package/src/resources/extensions/gsd/auto-post-unit.ts +9 -7
- package/src/resources/extensions/gsd/auto-prompts.ts +178 -38
- package/src/resources/extensions/gsd/auto-recovery.ts +63 -1
- package/src/resources/extensions/gsd/auto-start.ts +8 -6
- package/src/resources/extensions/gsd/auto-verification.ts +3 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +65 -0
- package/src/resources/extensions/gsd/auto.ts +53 -28
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +8 -21
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +22 -4
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +31 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +60 -3
- package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -0
- package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +16 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +279 -29
- package/src/resources/extensions/gsd/commands-cmux.ts +6 -2
- package/src/resources/extensions/gsd/commands-debug.ts +484 -0
- package/src/resources/extensions/gsd/commands-do.ts +1 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands-scan.ts +125 -0
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +129 -2
- package/src/resources/extensions/gsd/custom-workflow-engine.ts +85 -60
- package/src/resources/extensions/gsd/db-writer.ts +3 -0
- package/src/resources/extensions/gsd/debug-session-store.ts +377 -0
- package/src/resources/extensions/gsd/definition-loader.ts +7 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +9 -9
- package/src/resources/extensions/gsd/doctor-git-checks.ts +5 -1
- package/src/resources/extensions/gsd/doctor-proactive.ts +4 -1
- package/src/resources/extensions/gsd/doctor-providers.ts +52 -22
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +23 -4
- package/src/resources/extensions/gsd/doctor-types.ts +1 -0
- package/src/resources/extensions/gsd/doctor.ts +7 -1
- package/src/resources/extensions/gsd/error-classifier.ts +6 -3
- package/src/resources/extensions/gsd/escalation.ts +367 -0
- package/src/resources/extensions/gsd/forensics.ts +25 -29
- package/src/resources/extensions/gsd/git-service.ts +0 -1
- package/src/resources/extensions/gsd/graph.ts +33 -3
- package/src/resources/extensions/gsd/gsd-db.ts +306 -29
- package/src/resources/extensions/gsd/health-widget-core.ts +43 -14
- package/src/resources/extensions/gsd/health-widget.ts +7 -3
- package/src/resources/extensions/gsd/metrics.ts +1 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +3 -1
- package/src/resources/extensions/gsd/model-router.ts +15 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +134 -6
- package/src/resources/extensions/gsd/notification-widget.ts +25 -43
- package/src/resources/extensions/gsd/notifications.ts +6 -0
- package/src/resources/extensions/gsd/post-execution-checks.ts +37 -14
- package/src/resources/extensions/gsd/pre-execution-checks.ts +98 -8
- package/src/resources/extensions/gsd/preferences-models.ts +1 -0
- package/src/resources/extensions/gsd/preferences-types.ts +10 -2
- package/src/resources/extensions/gsd/preferences-validation.ts +33 -7
- package/src/resources/extensions/gsd/preferences.ts +10 -10
- package/src/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
- package/src/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
- package/src/resources/extensions/gsd/prompts/execute-task.md +12 -0
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +69 -0
- package/src/resources/extensions/gsd/prompts/scan.md +79 -0
- package/src/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
- package/src/resources/extensions/gsd/run-manager.ts +53 -19
- package/src/resources/extensions/gsd/state.ts +50 -2
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +1 -34
- package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +45 -31
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +123 -1
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/commands-scan.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +8 -6
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/debug-command-handler.test.ts +905 -0
- package/src/resources/extensions/gsd/tests/debug-command-lifecycle.integration.test.ts +1229 -0
- package/src/resources/extensions/gsd/tests/debug-session-store.test.ts +565 -0
- package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +62 -18
- package/src/resources/extensions/gsd/tests/enhanced-verification-integration.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/escalation.test.ts +818 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +29 -12
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +106 -0
- package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +74 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +0 -4
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +8 -2
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +109 -11
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +171 -1
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +275 -6
- package/src/resources/extensions/gsd/tests/preferences.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +539 -0
- package/src/resources/extensions/gsd/tests/projection-regression.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/requirements.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +16 -4
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/uok-flags.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/workflow-install.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +15 -6
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/workflow-plugins.test.ts +310 -0
- package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +8 -2
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +77 -2
- package/src/resources/extensions/gsd/tools/complete-task.ts +87 -0
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +42 -8
- package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -1
- package/src/resources/extensions/gsd/types.ts +62 -0
- package/src/resources/extensions/gsd/unit-runtime.ts +1 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +2 -1
- package/src/resources/extensions/gsd/uok/flags.ts +7 -7
- package/src/resources/extensions/gsd/uok/kernel.ts +16 -4
- package/src/resources/extensions/gsd/workflow-dispatch.ts +106 -0
- package/src/resources/extensions/gsd/workflow-install.ts +423 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +8 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +1 -6
- package/src/resources/extensions/gsd/workflow-plugins.ts +403 -0
- package/src/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
- package/src/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
- package/src/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
- package/src/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
- package/src/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
- package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
- package/src/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
- package/src/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
- package/src/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
- package/src/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
- package/src/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
- package/src/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/registry.json +184 -0
- package/src/resources/extensions/gsd/workflow-templates/release.md +118 -0
- package/src/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
- package/src/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +7 -0
- package/src/resources/extensions/gsd/workspace-index.ts +9 -4
- package/src/resources/extensions/gsd/worktree-resolver.ts +47 -1
- package/src/resources/extensions/remote-questions/commands.ts +480 -0
- package/src/resources/extensions/remote-questions/manager.ts +49 -4
- package/src/resources/extensions/remote-questions/telegram-adapter.ts +86 -4
- package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +246 -0
- package/src/resources/extensions/remote-questions/tests/remote-answer-normalization.test.ts +92 -0
- package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
- package/src/resources/extensions/shared/interview-ui.ts +195 -1
- package/src/resources/extensions/shared/layout-utils.ts +26 -0
- package/src/resources/extensions/shared/rtk-shared.ts +58 -0
- package/src/resources/extensions/shared/rtk.ts +12 -52
- package/src/resources/extensions/shared/tests/interview-preview.test.ts +177 -0
- package/src/resources/extensions/shared/tests/preview-layout.test.ts +120 -0
- package/src/resources/skills/create-workflow/SKILL.md +33 -6
- package/dist/web/standalone/.next/static/chunks/2826.dd3dc8bbd3025fa5.js +0 -9
- package/dist/web/standalone/.next/static/css/f6e8833d46e738d8.css +0 -1
- package/packages/native/dist/ps/types.d.ts +0 -5
- package/packages/native/dist/ps/types.js +0 -2
- package/packages/native/src/ps/types.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +0 -201
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +0 -9
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +0 -762
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +0 -19
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +0 -1
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +0 -9
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +0 -230
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +0 -87
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +0 -32
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +0 -169
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +0 -36
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +0 -22
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +0 -23
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +0 -10
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +0 -46
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +0 -24
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +0 -10
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +0 -46
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +0 -24
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +0 -68
- package/packages/pi-ai/oauth.d.ts +0 -1
- package/packages/pi-ai/oauth.js +0 -1
- /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → jaWw1Jh0TYayjbfOrFe8D}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → jaWw1Jh0TYayjbfOrFe8D}/_ssgManifest.js +0 -0
|
@@ -135,7 +135,7 @@ function openRawDb(path) {
|
|
|
135
135
|
const Database = providerModule;
|
|
136
136
|
return new Database(path);
|
|
137
137
|
}
|
|
138
|
-
const SCHEMA_VERSION =
|
|
138
|
+
const SCHEMA_VERSION = 17;
|
|
139
139
|
function indexExists(db, name) {
|
|
140
140
|
return !!db.prepare("SELECT 1 as present FROM sqlite_master WHERE type = 'index' AND name = ?").get(name);
|
|
141
141
|
}
|
|
@@ -189,6 +189,7 @@ function initSchema(db, fileBacked) {
|
|
|
189
189
|
rationale TEXT NOT NULL DEFAULT '',
|
|
190
190
|
revisable TEXT NOT NULL DEFAULT '',
|
|
191
191
|
made_by TEXT NOT NULL DEFAULT 'agent',
|
|
192
|
+
source TEXT NOT NULL DEFAULT 'discussion', -- ADR-011 P2: 'discussion' | 'planning' | 'escalation'
|
|
192
193
|
superseded_by TEXT DEFAULT NULL
|
|
193
194
|
)
|
|
194
195
|
`);
|
|
@@ -282,6 +283,8 @@ function initSchema(db, fileBacked) {
|
|
|
282
283
|
observability_impact TEXT NOT NULL DEFAULT '',
|
|
283
284
|
sequence INTEGER DEFAULT 0, -- Ordering hint: tools may set this to control execution order
|
|
284
285
|
replan_triggered_at TEXT DEFAULT NULL,
|
|
286
|
+
is_sketch INTEGER NOT NULL DEFAULT 0, -- ADR-011: 1 = slice is a sketch awaiting refinement
|
|
287
|
+
sketch_scope TEXT NOT NULL DEFAULT '', -- ADR-011: 2-3 sentence rough scope from plan-milestone
|
|
285
288
|
PRIMARY KEY (milestone_id, id),
|
|
286
289
|
FOREIGN KEY (milestone_id) REFERENCES milestones(id)
|
|
287
290
|
)
|
|
@@ -299,6 +302,11 @@ function initSchema(db, fileBacked) {
|
|
|
299
302
|
duration TEXT NOT NULL DEFAULT '',
|
|
300
303
|
completed_at TEXT DEFAULT NULL,
|
|
301
304
|
blocker_discovered INTEGER DEFAULT 0,
|
|
305
|
+
blocker_source TEXT NOT NULL DEFAULT '', -- ADR-011 P2: provenance for blocker_discovered (e.g. 'reject-escalation')
|
|
306
|
+
escalation_pending INTEGER NOT NULL DEFAULT 0, -- ADR-011 P2: pause-on-escalation flag
|
|
307
|
+
escalation_awaiting_review INTEGER NOT NULL DEFAULT 0, -- ADR-011 P2: artifact exists but continueWithDefault=true (no pause)
|
|
308
|
+
escalation_artifact_path TEXT DEFAULT NULL, -- ADR-011 P2: path to T##-ESCALATION.json
|
|
309
|
+
escalation_override_applied_at TEXT DEFAULT NULL, -- ADR-011 P2: DB claim lock for idempotent override injection
|
|
302
310
|
deviations TEXT NOT NULL DEFAULT '',
|
|
303
311
|
known_issues TEXT NOT NULL DEFAULT '',
|
|
304
312
|
key_files TEXT NOT NULL DEFAULT '[]',
|
|
@@ -460,6 +468,9 @@ function initSchema(db, fileBacked) {
|
|
|
460
468
|
db.exec("CREATE INDEX IF NOT EXISTS idx_turn_git_tx_turn ON turn_git_transactions(trace_id, turn_id)");
|
|
461
469
|
db.exec("CREATE INDEX IF NOT EXISTS idx_audit_events_trace ON audit_events(trace_id, ts)");
|
|
462
470
|
db.exec("CREATE INDEX IF NOT EXISTS idx_audit_events_turn ON audit_events(trace_id, turn_id, ts)");
|
|
471
|
+
// ADR-011 Phase 2 — also created by the v17 migration; fresh installs
|
|
472
|
+
// skip migrations so the index must be created here too.
|
|
473
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_tasks_escalation_pending ON tasks(milestone_id, slice_id, escalation_pending)");
|
|
463
474
|
db.exec(`CREATE VIEW IF NOT EXISTS active_decisions AS SELECT * FROM decisions WHERE superseded_by IS NULL`);
|
|
464
475
|
db.exec(`CREATE VIEW IF NOT EXISTS active_requirements AS SELECT * FROM requirements WHERE superseded_by IS NULL`);
|
|
465
476
|
db.exec(`CREATE VIEW IF NOT EXISTS active_memories AS SELECT * FROM memories WHERE superseded_by IS NULL`);
|
|
@@ -861,6 +872,30 @@ function migrateSchema(db) {
|
|
|
861
872
|
":applied_at": new Date().toISOString(),
|
|
862
873
|
});
|
|
863
874
|
}
|
|
875
|
+
if (currentVersion < 16) {
|
|
876
|
+
// ADR-011 Phase 1: sketch-then-refine progressive planning — sketch columns on slices.
|
|
877
|
+
ensureColumn(db, "slices", "is_sketch", `ALTER TABLE slices ADD COLUMN is_sketch INTEGER NOT NULL DEFAULT 0`);
|
|
878
|
+
ensureColumn(db, "slices", "sketch_scope", `ALTER TABLE slices ADD COLUMN sketch_scope TEXT NOT NULL DEFAULT ''`);
|
|
879
|
+
// ADR-011 Phase 2: decisions can now be sourced from escalation resolutions.
|
|
880
|
+
ensureColumn(db, "decisions", "source", `ALTER TABLE decisions ADD COLUMN source TEXT NOT NULL DEFAULT 'discussion'`);
|
|
881
|
+
db.prepare("INSERT INTO schema_version (version, applied_at) VALUES (:version, :applied_at)").run({
|
|
882
|
+
":version": 16,
|
|
883
|
+
":applied_at": new Date().toISOString(),
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
if (currentVersion < 17) {
|
|
887
|
+
// ADR-011 Phase 2: mid-execution escalation — columns on the tasks table.
|
|
888
|
+
ensureColumn(db, "tasks", "blocker_source", `ALTER TABLE tasks ADD COLUMN blocker_source TEXT NOT NULL DEFAULT ''`);
|
|
889
|
+
ensureColumn(db, "tasks", "escalation_pending", `ALTER TABLE tasks ADD COLUMN escalation_pending INTEGER NOT NULL DEFAULT 0`);
|
|
890
|
+
ensureColumn(db, "tasks", "escalation_awaiting_review", `ALTER TABLE tasks ADD COLUMN escalation_awaiting_review INTEGER NOT NULL DEFAULT 0`);
|
|
891
|
+
ensureColumn(db, "tasks", "escalation_artifact_path", `ALTER TABLE tasks ADD COLUMN escalation_artifact_path TEXT DEFAULT NULL`);
|
|
892
|
+
ensureColumn(db, "tasks", "escalation_override_applied_at", `ALTER TABLE tasks ADD COLUMN escalation_override_applied_at TEXT DEFAULT NULL`);
|
|
893
|
+
db.exec("CREATE INDEX IF NOT EXISTS idx_tasks_escalation_pending ON tasks(milestone_id, slice_id, escalation_pending)");
|
|
894
|
+
db.prepare("INSERT INTO schema_version (version, applied_at) VALUES (:version, :applied_at)").run({
|
|
895
|
+
":version": 17,
|
|
896
|
+
":applied_at": new Date().toISOString(),
|
|
897
|
+
});
|
|
898
|
+
}
|
|
864
899
|
db.exec("COMMIT");
|
|
865
900
|
}
|
|
866
901
|
catch (err) {
|
|
@@ -984,6 +1019,17 @@ export function vacuumDatabase() {
|
|
|
984
1019
|
logWarning("db", `VACUUM failed: ${e.message}`);
|
|
985
1020
|
}
|
|
986
1021
|
}
|
|
1022
|
+
/** Flush WAL into gsd.db so `git add .gsd/gsd.db` stages current state — safe while DB is open. */
|
|
1023
|
+
export function checkpointDatabase() {
|
|
1024
|
+
if (!currentDb)
|
|
1025
|
+
return;
|
|
1026
|
+
try {
|
|
1027
|
+
currentDb.exec('PRAGMA wal_checkpoint(TRUNCATE)');
|
|
1028
|
+
}
|
|
1029
|
+
catch (e) {
|
|
1030
|
+
logWarning("db", `WAL checkpoint failed: ${e.message}`);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
987
1033
|
let _txDepth = 0;
|
|
988
1034
|
export function transaction(fn) {
|
|
989
1035
|
if (!currentDb)
|
|
@@ -1061,8 +1107,8 @@ export function readTransaction(fn) {
|
|
|
1061
1107
|
export function insertDecision(d) {
|
|
1062
1108
|
if (!currentDb)
|
|
1063
1109
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1064
|
-
currentDb.prepare(`INSERT INTO decisions (id, when_context, scope, decision, choice, rationale, revisable, made_by, superseded_by)
|
|
1065
|
-
VALUES (:id, :when_context, :scope, :decision, :choice, :rationale, :revisable, :made_by, :superseded_by)`).run({
|
|
1110
|
+
currentDb.prepare(`INSERT INTO decisions (id, when_context, scope, decision, choice, rationale, revisable, made_by, source, superseded_by)
|
|
1111
|
+
VALUES (:id, :when_context, :scope, :decision, :choice, :rationale, :revisable, :made_by, :source, :superseded_by)`).run({
|
|
1066
1112
|
":id": d.id,
|
|
1067
1113
|
":when_context": d.when_context,
|
|
1068
1114
|
":scope": d.scope,
|
|
@@ -1071,6 +1117,7 @@ export function insertDecision(d) {
|
|
|
1071
1117
|
":rationale": d.rationale,
|
|
1072
1118
|
":revisable": d.revisable,
|
|
1073
1119
|
":made_by": d.made_by ?? "agent",
|
|
1120
|
+
":source": d.source ?? "discussion",
|
|
1074
1121
|
":superseded_by": d.superseded_by,
|
|
1075
1122
|
});
|
|
1076
1123
|
}
|
|
@@ -1090,6 +1137,7 @@ export function getDecisionById(id) {
|
|
|
1090
1137
|
rationale: row["rationale"],
|
|
1091
1138
|
revisable: row["revisable"],
|
|
1092
1139
|
made_by: row["made_by"] ?? "agent",
|
|
1140
|
+
source: row["source"] ?? "discussion",
|
|
1093
1141
|
superseded_by: row["superseded_by"] ?? null,
|
|
1094
1142
|
};
|
|
1095
1143
|
}
|
|
@@ -1107,6 +1155,7 @@ export function getActiveDecisions() {
|
|
|
1107
1155
|
rationale: row["rationale"],
|
|
1108
1156
|
revisable: row["revisable"],
|
|
1109
1157
|
made_by: row["made_by"] ?? "agent",
|
|
1158
|
+
source: row["source"] ?? "discussion",
|
|
1110
1159
|
superseded_by: null,
|
|
1111
1160
|
}));
|
|
1112
1161
|
}
|
|
@@ -1189,8 +1238,8 @@ export function upsertDecision(d) {
|
|
|
1189
1238
|
// Use ON CONFLICT DO UPDATE instead of INSERT OR REPLACE to preserve the
|
|
1190
1239
|
// seq column. INSERT OR REPLACE deletes then reinserts, resetting seq and
|
|
1191
1240
|
// corrupting decision ordering in DECISIONS.md after reconcile replay.
|
|
1192
|
-
currentDb.prepare(`INSERT INTO decisions (id, when_context, scope, decision, choice, rationale, revisable, made_by, superseded_by)
|
|
1193
|
-
VALUES (:id, :when_context, :scope, :decision, :choice, :rationale, :revisable, :made_by, :superseded_by)
|
|
1241
|
+
currentDb.prepare(`INSERT INTO decisions (id, when_context, scope, decision, choice, rationale, revisable, made_by, source, superseded_by)
|
|
1242
|
+
VALUES (:id, :when_context, :scope, :decision, :choice, :rationale, :revisable, :made_by, :source, :superseded_by)
|
|
1194
1243
|
ON CONFLICT(id) DO UPDATE SET
|
|
1195
1244
|
when_context = excluded.when_context,
|
|
1196
1245
|
scope = excluded.scope,
|
|
@@ -1199,6 +1248,7 @@ export function upsertDecision(d) {
|
|
|
1199
1248
|
rationale = excluded.rationale,
|
|
1200
1249
|
revisable = excluded.revisable,
|
|
1201
1250
|
made_by = excluded.made_by,
|
|
1251
|
+
source = excluded.source,
|
|
1202
1252
|
superseded_by = excluded.superseded_by`).run({
|
|
1203
1253
|
":id": d.id,
|
|
1204
1254
|
":when_context": d.when_context,
|
|
@@ -1208,6 +1258,7 @@ export function upsertDecision(d) {
|
|
|
1208
1258
|
":rationale": d.rationale,
|
|
1209
1259
|
":revisable": d.revisable,
|
|
1210
1260
|
":made_by": d.made_by ?? "agent",
|
|
1261
|
+
":source": d.source ?? "discussion",
|
|
1211
1262
|
":superseded_by": d.superseded_by ?? null,
|
|
1212
1263
|
});
|
|
1213
1264
|
}
|
|
@@ -1327,10 +1378,12 @@ export function insertSlice(s) {
|
|
|
1327
1378
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1328
1379
|
currentDb.prepare(`INSERT INTO slices (
|
|
1329
1380
|
milestone_id, id, title, status, risk, depends, demo, created_at,
|
|
1330
|
-
goal, success_criteria, proof_level, integration_closure, observability_impact, sequence
|
|
1381
|
+
goal, success_criteria, proof_level, integration_closure, observability_impact, sequence,
|
|
1382
|
+
is_sketch, sketch_scope
|
|
1331
1383
|
) VALUES (
|
|
1332
1384
|
:milestone_id, :id, :title, :status, :risk, :depends, :demo, :created_at,
|
|
1333
|
-
:goal, :success_criteria, :proof_level, :integration_closure, :observability_impact, :sequence
|
|
1385
|
+
:goal, :success_criteria, :proof_level, :integration_closure, :observability_impact, :sequence,
|
|
1386
|
+
:is_sketch, :sketch_scope
|
|
1334
1387
|
)
|
|
1335
1388
|
ON CONFLICT (milestone_id, id) DO UPDATE SET
|
|
1336
1389
|
title = CASE WHEN :raw_title IS NOT NULL THEN excluded.title ELSE slices.title END,
|
|
@@ -1343,7 +1396,9 @@ export function insertSlice(s) {
|
|
|
1343
1396
|
proof_level = CASE WHEN :raw_proof_level IS NOT NULL THEN excluded.proof_level ELSE slices.proof_level END,
|
|
1344
1397
|
integration_closure = CASE WHEN :raw_integration_closure IS NOT NULL THEN excluded.integration_closure ELSE slices.integration_closure END,
|
|
1345
1398
|
observability_impact = CASE WHEN :raw_observability_impact IS NOT NULL THEN excluded.observability_impact ELSE slices.observability_impact END,
|
|
1346
|
-
sequence = CASE WHEN :raw_sequence IS NOT NULL THEN excluded.sequence ELSE slices.sequence END
|
|
1399
|
+
sequence = CASE WHEN :raw_sequence IS NOT NULL THEN excluded.sequence ELSE slices.sequence END,
|
|
1400
|
+
is_sketch = CASE WHEN :raw_is_sketch IS NOT NULL THEN excluded.is_sketch ELSE slices.is_sketch END,
|
|
1401
|
+
sketch_scope = CASE WHEN :raw_sketch_scope IS NOT NULL THEN excluded.sketch_scope ELSE slices.sketch_scope END`).run({
|
|
1347
1402
|
":milestone_id": s.milestoneId,
|
|
1348
1403
|
":id": s.id,
|
|
1349
1404
|
":title": s.title ?? "",
|
|
@@ -1358,6 +1413,8 @@ export function insertSlice(s) {
|
|
|
1358
1413
|
":integration_closure": s.planning?.integrationClosure ?? "",
|
|
1359
1414
|
":observability_impact": s.planning?.observabilityImpact ?? "",
|
|
1360
1415
|
":sequence": s.sequence ?? 0,
|
|
1416
|
+
":is_sketch": s.isSketch ? 1 : 0,
|
|
1417
|
+
":sketch_scope": s.sketchScope ?? "",
|
|
1361
1418
|
// Raw sentinel params: NULL when caller omitted the field, used in ON CONFLICT guards
|
|
1362
1419
|
":raw_title": s.title ?? null,
|
|
1363
1420
|
":raw_risk": s.risk ?? null,
|
|
@@ -1368,8 +1425,47 @@ export function insertSlice(s) {
|
|
|
1368
1425
|
":raw_integration_closure": s.planning?.integrationClosure ?? null,
|
|
1369
1426
|
":raw_observability_impact": s.planning?.observabilityImpact ?? null,
|
|
1370
1427
|
":raw_sequence": s.sequence ?? null,
|
|
1428
|
+
":raw_is_sketch": s.isSketch === undefined ? null : (s.isSketch ? 1 : 0),
|
|
1429
|
+
// NOTE: use !== undefined (not ??) so an explicit empty string "" is treated
|
|
1430
|
+
// as a present value and correctly clears the existing sketch_scope on
|
|
1431
|
+
// CONFLICT. ?? would incorrectly preserve the stale value.
|
|
1432
|
+
":raw_sketch_scope": s.sketchScope !== undefined ? s.sketchScope : null,
|
|
1371
1433
|
});
|
|
1372
1434
|
}
|
|
1435
|
+
// ADR-011: sketch-then-refine helpers
|
|
1436
|
+
export function setSliceSketchFlag(milestoneId, sliceId, isSketch) {
|
|
1437
|
+
if (!currentDb)
|
|
1438
|
+
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1439
|
+
currentDb.prepare(`UPDATE slices SET is_sketch = :is_sketch WHERE milestone_id = :mid AND id = :sid`).run({ ":is_sketch": isSketch ? 1 : 0, ":mid": milestoneId, ":sid": sliceId });
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* ADR-011 auto-heal: reconcile stale is_sketch=1 rows whose PLAN already exists.
|
|
1443
|
+
*
|
|
1444
|
+
* Callers pass a predicate that resolves whether a plan file exists for a slice.
|
|
1445
|
+
* The predicate MUST use the canonical path resolver (`resolveSliceFile`, etc.)
|
|
1446
|
+
* to keep path logic in one place — do not hand-roll the path inside the callback.
|
|
1447
|
+
*
|
|
1448
|
+
* Recovers from two scenarios:
|
|
1449
|
+
* 1. Crash between `gsd_plan_slice` write and the sketch flag flip.
|
|
1450
|
+
* 2. Flag-OFF downgrade path: when `progressive_planning` is off, the dispatch
|
|
1451
|
+
* rule routes sketch slices to plan-slice, which writes PLAN.md but leaves
|
|
1452
|
+
* `is_sketch=1` — the next state derivation auto-heals it to 0 here.
|
|
1453
|
+
*
|
|
1454
|
+
* Not aggressive in practice: PLAN.md is only written via the DB-backed
|
|
1455
|
+
* `gsd_plan_slice` tool (which also inserts tasks), so a "stale PLAN.md with
|
|
1456
|
+
* is_sketch=1" is extremely unlikely to indicate anything other than the two
|
|
1457
|
+
* recovery scenarios above.
|
|
1458
|
+
*/
|
|
1459
|
+
export function autoHealSketchFlags(milestoneId, hasPlanFile) {
|
|
1460
|
+
if (!currentDb)
|
|
1461
|
+
return;
|
|
1462
|
+
const rows = currentDb.prepare(`SELECT id FROM slices WHERE milestone_id = :mid AND is_sketch = 1`).all({ ":mid": milestoneId });
|
|
1463
|
+
for (const row of rows) {
|
|
1464
|
+
if (hasPlanFile(row.id)) {
|
|
1465
|
+
setSliceSketchFlag(milestoneId, row.id, false);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1373
1469
|
export function upsertSlicePlanning(milestoneId, sliceId, planning) {
|
|
1374
1470
|
if (!currentDb)
|
|
1375
1471
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
@@ -1516,6 +1612,8 @@ function rowToSlice(row) {
|
|
|
1516
1612
|
observability_impact: row["observability_impact"] ?? "",
|
|
1517
1613
|
sequence: row["sequence"] ?? 0,
|
|
1518
1614
|
replan_triggered_at: row["replan_triggered_at"] ?? null,
|
|
1615
|
+
is_sketch: row["is_sketch"] ?? 0,
|
|
1616
|
+
sketch_scope: row["sketch_scope"] ?? "",
|
|
1519
1617
|
};
|
|
1520
1618
|
}
|
|
1521
1619
|
export function getSlice(milestoneId, sliceId) {
|
|
@@ -1616,6 +1714,11 @@ function rowToTask(row) {
|
|
|
1616
1714
|
observability_impact: row["observability_impact"] ?? "",
|
|
1617
1715
|
full_plan_md: row["full_plan_md"] ?? "",
|
|
1618
1716
|
sequence: row["sequence"] ?? 0,
|
|
1717
|
+
blocker_source: row["blocker_source"] ?? "",
|
|
1718
|
+
escalation_pending: row["escalation_pending"] ?? 0,
|
|
1719
|
+
escalation_awaiting_review: row["escalation_awaiting_review"] ?? 0,
|
|
1720
|
+
escalation_artifact_path: row["escalation_artifact_path"] ?? null,
|
|
1721
|
+
escalation_override_applied_at: row["escalation_override_applied_at"] ?? null,
|
|
1619
1722
|
};
|
|
1620
1723
|
}
|
|
1621
1724
|
export function getTask(milestoneId, sliceId, taskId) {
|
|
@@ -1632,6 +1735,95 @@ export function getSliceTasks(milestoneId, sliceId) {
|
|
|
1632
1735
|
const rows = currentDb.prepare("SELECT * FROM tasks WHERE milestone_id = :mid AND slice_id = :sid ORDER BY sequence, id").all({ ":mid": milestoneId, ":sid": sliceId });
|
|
1633
1736
|
return rows.map(rowToTask);
|
|
1634
1737
|
}
|
|
1738
|
+
// ─── ADR-011 Phase 2 escalation helpers ──────────────────────────────────
|
|
1739
|
+
/** Set pause-on-escalation state on a completed task. Mutually exclusive with awaiting_review. */
|
|
1740
|
+
export function setTaskEscalationPending(milestoneId, sliceId, taskId, artifactPath) {
|
|
1741
|
+
if (!currentDb)
|
|
1742
|
+
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1743
|
+
currentDb.prepare(`UPDATE tasks
|
|
1744
|
+
SET escalation_pending = 1,
|
|
1745
|
+
escalation_awaiting_review = 0,
|
|
1746
|
+
escalation_artifact_path = :path
|
|
1747
|
+
WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid`).run({ ":path": artifactPath, ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
|
|
1748
|
+
}
|
|
1749
|
+
/** Set awaiting-review state (artifact exists but continueWithDefault=true, no pause). Mutually exclusive with pending. */
|
|
1750
|
+
export function setTaskEscalationAwaitingReview(milestoneId, sliceId, taskId, artifactPath) {
|
|
1751
|
+
if (!currentDb)
|
|
1752
|
+
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1753
|
+
currentDb.prepare(`UPDATE tasks
|
|
1754
|
+
SET escalation_awaiting_review = 1,
|
|
1755
|
+
escalation_pending = 0,
|
|
1756
|
+
escalation_artifact_path = :path
|
|
1757
|
+
WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid`).run({ ":path": artifactPath, ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
|
|
1758
|
+
}
|
|
1759
|
+
/** Clear escalation-pending and awaiting-review flags once the user has resolved it. */
|
|
1760
|
+
export function clearTaskEscalationFlags(milestoneId, sliceId, taskId) {
|
|
1761
|
+
if (!currentDb)
|
|
1762
|
+
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1763
|
+
currentDb.prepare(`UPDATE tasks
|
|
1764
|
+
SET escalation_pending = 0,
|
|
1765
|
+
escalation_awaiting_review = 0
|
|
1766
|
+
WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid`).run({ ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
|
|
1767
|
+
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Atomically claim a resolved escalation override for injection into a downstream
|
|
1770
|
+
* task's prompt. Returns true if this caller claimed it (must inject), false if
|
|
1771
|
+
* another caller already claimed it (must skip).
|
|
1772
|
+
*/
|
|
1773
|
+
export function claimEscalationOverride(milestoneId, sliceId, sourceTaskId) {
|
|
1774
|
+
if (!currentDb)
|
|
1775
|
+
return false;
|
|
1776
|
+
const now = new Date().toISOString();
|
|
1777
|
+
const result = currentDb.prepare(`UPDATE tasks
|
|
1778
|
+
SET escalation_override_applied_at = :now
|
|
1779
|
+
WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid
|
|
1780
|
+
AND escalation_override_applied_at IS NULL
|
|
1781
|
+
AND escalation_artifact_path IS NOT NULL`).run({ ":now": now, ":mid": milestoneId, ":sid": sliceId, ":tid": sourceTaskId });
|
|
1782
|
+
// node:sqlite + better-sqlite3 both surface `changes` on the run result.
|
|
1783
|
+
const changes = result.changes ?? 0;
|
|
1784
|
+
return changes > 0;
|
|
1785
|
+
}
|
|
1786
|
+
/** Find the most recent resolved-but-unapplied escalation override in a slice. */
|
|
1787
|
+
export function findUnappliedEscalationOverride(milestoneId, sliceId) {
|
|
1788
|
+
if (!currentDb)
|
|
1789
|
+
return null;
|
|
1790
|
+
// Filter BOTH flags: escalation_pending=0 AND escalation_awaiting_review=0
|
|
1791
|
+
// ensures we only claim overrides the user has explicitly resolved.
|
|
1792
|
+
// Without the awaiting_review filter, continueWithDefault=true artifacts
|
|
1793
|
+
// (not yet responded to) would be prematurely claimed, causing the override
|
|
1794
|
+
// to be lost when the user later resolves (#ADR-011 Phase 2 peer-review Bug 2).
|
|
1795
|
+
const row = currentDb.prepare(`SELECT id, escalation_artifact_path AS path
|
|
1796
|
+
FROM tasks
|
|
1797
|
+
WHERE milestone_id = :mid AND slice_id = :sid
|
|
1798
|
+
AND escalation_artifact_path IS NOT NULL
|
|
1799
|
+
AND escalation_override_applied_at IS NULL
|
|
1800
|
+
AND escalation_pending = 0
|
|
1801
|
+
AND escalation_awaiting_review = 0
|
|
1802
|
+
ORDER BY sequence DESC, id DESC
|
|
1803
|
+
LIMIT 1`).get({ ":mid": milestoneId, ":sid": sliceId });
|
|
1804
|
+
if (!row || !row.path)
|
|
1805
|
+
return null;
|
|
1806
|
+
return { taskId: row.id, artifactPath: row.path };
|
|
1807
|
+
}
|
|
1808
|
+
/** Set the blocker_source provenance field (used when rejecting an escalation). */
|
|
1809
|
+
export function setTaskBlockerSource(milestoneId, sliceId, taskId, source) {
|
|
1810
|
+
if (!currentDb)
|
|
1811
|
+
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
1812
|
+
currentDb.prepare(`UPDATE tasks
|
|
1813
|
+
SET blocker_discovered = 1,
|
|
1814
|
+
blocker_source = :src
|
|
1815
|
+
WHERE milestone_id = :mid AND slice_id = :sid AND id = :tid`).run({ ":src": source, ":mid": milestoneId, ":sid": sliceId, ":tid": taskId });
|
|
1816
|
+
}
|
|
1817
|
+
/** List tasks with active escalation artifacts across a milestone (for /gsd escalate list). */
|
|
1818
|
+
export function listEscalationArtifacts(milestoneId, includeResolved = false) {
|
|
1819
|
+
if (!currentDb)
|
|
1820
|
+
return [];
|
|
1821
|
+
const filter = includeResolved
|
|
1822
|
+
? "escalation_artifact_path IS NOT NULL"
|
|
1823
|
+
: "(escalation_pending = 1 OR escalation_awaiting_review = 1) AND escalation_artifact_path IS NOT NULL";
|
|
1824
|
+
const rows = currentDb.prepare(`SELECT * FROM tasks WHERE milestone_id = :mid AND ${filter} ORDER BY slice_id, sequence, id`).all({ ":mid": milestoneId });
|
|
1825
|
+
return rows.map(rowToTask);
|
|
1826
|
+
}
|
|
1635
1827
|
export function insertVerificationEvidence(e) {
|
|
1636
1828
|
if (!currentDb)
|
|
1637
1829
|
throw new GSDError(GSD_STALE_STATE, "gsd-db: No database open");
|
|
@@ -1862,6 +2054,19 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1862
2054
|
try {
|
|
1863
2055
|
const wtInfo = adapter.prepare("PRAGMA wt.table_info('decisions')").all();
|
|
1864
2056
|
const hasMadeBy = wtInfo.some((col) => col["name"] === "made_by");
|
|
2057
|
+
// ADR-011: worktree may predate schema v16/v17. For missing columns we
|
|
2058
|
+
// fall through to the main DB's existing value (not a literal default)
|
|
2059
|
+
// so reconcile never silently clears state the main tree has recorded.
|
|
2060
|
+
const hasDecisionSource = wtInfo.some((col) => col["name"] === "source");
|
|
2061
|
+
const wtSliceInfo = adapter.prepare("PRAGMA wt.table_info('slices')").all();
|
|
2062
|
+
const hasIsSketch = wtSliceInfo.some((col) => col["name"] === "is_sketch");
|
|
2063
|
+
const hasSketchScope = wtSliceInfo.some((col) => col["name"] === "sketch_scope");
|
|
2064
|
+
const wtTaskInfo = adapter.prepare("PRAGMA wt.table_info('tasks')").all();
|
|
2065
|
+
const hasBlockerSource = wtTaskInfo.some((col) => col["name"] === "blocker_source");
|
|
2066
|
+
const hasEscalationPending = wtTaskInfo.some((col) => col["name"] === "escalation_pending");
|
|
2067
|
+
const hasEscalationAwaiting = wtTaskInfo.some((col) => col["name"] === "escalation_awaiting_review");
|
|
2068
|
+
const hasEscalationArtifact = wtTaskInfo.some((col) => col["name"] === "escalation_artifact_path");
|
|
2069
|
+
const hasEscalationOverride = wtTaskInfo.some((col) => col["name"] === "escalation_override_applied_at");
|
|
1865
2070
|
const decConf = adapter.prepare(`SELECT m.id FROM decisions m INNER JOIN wt.decisions w ON m.id = w.id WHERE m.decision != w.decision OR m.choice != w.choice OR m.rationale != w.rationale OR ${hasMadeBy ? "m.made_by != w.made_by" : "'agent' != 'agent'"} OR m.superseded_by IS NOT w.superseded_by`).all();
|
|
1866
2071
|
for (const row of decConf)
|
|
1867
2072
|
conflicts.push(`decision ${row["id"]}: modified in both`);
|
|
@@ -1874,11 +2079,16 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1874
2079
|
}
|
|
1875
2080
|
adapter.exec("BEGIN");
|
|
1876
2081
|
try {
|
|
2082
|
+
// Join the target decisions so we can prefer an existing main.source
|
|
2083
|
+
// when the worktree predates v16 — otherwise a write-through reconcile
|
|
2084
|
+
// would clobber 'escalation'-sourced decisions with the literal default.
|
|
1877
2085
|
merged.decisions = countChanges(adapter.prepare(`
|
|
1878
2086
|
INSERT OR REPLACE INTO decisions (
|
|
1879
|
-
id, when_context, scope, decision, choice, rationale, revisable, made_by, superseded_by
|
|
2087
|
+
id, when_context, scope, decision, choice, rationale, revisable, made_by, source, superseded_by
|
|
1880
2088
|
)
|
|
1881
|
-
SELECT id, when_context, scope, decision, choice, rationale, revisable, ${hasMadeBy ? "made_by" : "'agent'"},
|
|
2089
|
+
SELECT w.id, w.when_context, w.scope, w.decision, w.choice, w.rationale, w.revisable, ${hasMadeBy ? "w.made_by" : "COALESCE(m.made_by, 'agent')"}, ${hasDecisionSource ? "w.source" : "COALESCE(m.source, 'discussion')"}, w.superseded_by
|
|
2090
|
+
FROM wt.decisions w
|
|
2091
|
+
LEFT JOIN decisions m ON m.id = w.id
|
|
1882
2092
|
`).run());
|
|
1883
2093
|
merged.requirements = countChanges(adapter.prepare(`
|
|
1884
2094
|
INSERT OR REPLACE INTO requirements (
|
|
@@ -1911,13 +2121,15 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1911
2121
|
FROM wt.milestones
|
|
1912
2122
|
`).run());
|
|
1913
2123
|
// Merge slices — preserve worktree progress but never downgrade completed status (#2558).
|
|
1914
|
-
//
|
|
1915
|
-
//
|
|
2124
|
+
// ADR-011 Phase 1: carry is_sketch + sketch_scope so reconcile doesn't
|
|
2125
|
+
// silently clear sketch metadata. When the worktree predates v16,
|
|
2126
|
+
// fall back to the main DB's existing value rather than a literal 0/''.
|
|
1916
2127
|
merged.slices = countChanges(adapter.prepare(`
|
|
1917
2128
|
INSERT OR REPLACE INTO slices (
|
|
1918
2129
|
milestone_id, id, title, status, risk, depends, demo, created_at, completed_at,
|
|
1919
2130
|
full_summary_md, full_uat_md, goal, success_criteria, proof_level,
|
|
1920
|
-
integration_closure, observability_impact, sequence, replan_triggered_at
|
|
2131
|
+
integration_closure, observability_impact, sequence, replan_triggered_at,
|
|
2132
|
+
is_sketch, sketch_scope
|
|
1921
2133
|
)
|
|
1922
2134
|
SELECT w.milestone_id, w.id, w.title,
|
|
1923
2135
|
CASE
|
|
@@ -1930,18 +2142,24 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1930
2142
|
THEN m.completed_at ELSE w.completed_at
|
|
1931
2143
|
END,
|
|
1932
2144
|
w.full_summary_md, w.full_uat_md, w.goal, w.success_criteria, w.proof_level,
|
|
1933
|
-
w.integration_closure, w.observability_impact, w.sequence, w.replan_triggered_at
|
|
2145
|
+
w.integration_closure, w.observability_impact, w.sequence, w.replan_triggered_at,
|
|
2146
|
+
${hasIsSketch ? "w.is_sketch" : "COALESCE(m.is_sketch, 0)"},
|
|
2147
|
+
${hasSketchScope ? "w.sketch_scope" : "COALESCE(m.sketch_scope, '')"}
|
|
1934
2148
|
FROM wt.slices w
|
|
1935
2149
|
LEFT JOIN slices m ON m.milestone_id = w.milestone_id AND m.id = w.id
|
|
1936
2150
|
`).run());
|
|
1937
|
-
// Merge tasks — preserve execution results, never downgrade completed status (#2558)
|
|
2151
|
+
// Merge tasks — preserve execution results, never downgrade completed status (#2558).
|
|
2152
|
+
// ADR-011 P2: carry blocker_source + escalation_* columns so worktree reconcile
|
|
2153
|
+
// doesn't silently clear escalation state back to defaults.
|
|
1938
2154
|
merged.tasks = countChanges(adapter.prepare(`
|
|
1939
2155
|
INSERT OR REPLACE INTO tasks (
|
|
1940
2156
|
milestone_id, slice_id, id, title, status, one_liner, narrative,
|
|
1941
2157
|
verification_result, duration, completed_at, blocker_discovered,
|
|
1942
2158
|
deviations, known_issues, key_files, key_decisions, full_summary_md,
|
|
1943
2159
|
description, estimate, files, verify, inputs, expected_output,
|
|
1944
|
-
observability_impact, full_plan_md, sequence
|
|
2160
|
+
observability_impact, full_plan_md, sequence,
|
|
2161
|
+
blocker_source, escalation_pending, escalation_awaiting_review,
|
|
2162
|
+
escalation_artifact_path, escalation_override_applied_at
|
|
1945
2163
|
)
|
|
1946
2164
|
SELECT w.milestone_id, w.slice_id, w.id, w.title,
|
|
1947
2165
|
CASE
|
|
@@ -1957,7 +2175,12 @@ export function reconcileWorktreeDb(mainDbPath, worktreeDbPath) {
|
|
|
1957
2175
|
w.blocker_discovered,
|
|
1958
2176
|
w.deviations, w.known_issues, w.key_files, w.key_decisions, w.full_summary_md,
|
|
1959
2177
|
w.description, w.estimate, w.files, w.verify, w.inputs, w.expected_output,
|
|
1960
|
-
w.observability_impact, w.full_plan_md, w.sequence
|
|
2178
|
+
w.observability_impact, w.full_plan_md, w.sequence,
|
|
2179
|
+
${hasBlockerSource ? "w.blocker_source" : "COALESCE(m.blocker_source, '')"},
|
|
2180
|
+
${hasEscalationPending ? "w.escalation_pending" : "COALESCE(m.escalation_pending, 0)"},
|
|
2181
|
+
${hasEscalationAwaiting ? "w.escalation_awaiting_review" : "COALESCE(m.escalation_awaiting_review, 0)"},
|
|
2182
|
+
${hasEscalationArtifact ? "w.escalation_artifact_path" : "m.escalation_artifact_path"},
|
|
2183
|
+
${hasEscalationOverride ? "w.escalation_override_applied_at" : "m.escalation_override_applied_at"}
|
|
1961
2184
|
FROM wt.tasks w
|
|
1962
2185
|
LEFT JOIN tasks m ON m.milestone_id = w.milestone_id AND m.slice_id = w.slice_id AND m.id = w.id
|
|
1963
2186
|
`).run());
|
|
@@ -2489,30 +2712,32 @@ export function restoreManifest(manifest) {
|
|
|
2489
2712
|
for (const m of manifest.milestones) {
|
|
2490
2713
|
msStmt.run(m.id, m.title, m.status, JSON.stringify(m.depends_on), m.created_at, m.completed_at, m.vision, JSON.stringify(m.success_criteria), JSON.stringify(m.key_risks), JSON.stringify(m.proof_strategy), m.verification_contract, m.verification_integration, m.verification_operational, m.verification_uat, JSON.stringify(m.definition_of_done), m.requirement_coverage, m.boundary_map_markdown);
|
|
2491
2714
|
}
|
|
2492
|
-
// Restore slices
|
|
2715
|
+
// Restore slices (ADR-011 Phase 1: includes is_sketch + sketch_scope)
|
|
2493
2716
|
const slStmt = db.prepare(`INSERT INTO slices (milestone_id, id, title, status, risk, depends, demo,
|
|
2494
2717
|
created_at, completed_at, full_summary_md, full_uat_md,
|
|
2495
2718
|
goal, success_criteria, proof_level, integration_closure, observability_impact,
|
|
2496
|
-
sequence, replan_triggered_at)
|
|
2497
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2719
|
+
sequence, replan_triggered_at, is_sketch, sketch_scope)
|
|
2720
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2498
2721
|
for (const s of manifest.slices) {
|
|
2499
|
-
slStmt.run(s.milestone_id, s.id, s.title, s.status, s.risk, JSON.stringify(s.depends), s.demo, s.created_at, s.completed_at, s.full_summary_md, s.full_uat_md, s.goal, s.success_criteria, s.proof_level, s.integration_closure, s.observability_impact, s.sequence, s.replan_triggered_at);
|
|
2722
|
+
slStmt.run(s.milestone_id, s.id, s.title, s.status, s.risk, JSON.stringify(s.depends), s.demo, s.created_at, s.completed_at, s.full_summary_md, s.full_uat_md, s.goal, s.success_criteria, s.proof_level, s.integration_closure, s.observability_impact, s.sequence, s.replan_triggered_at, s.is_sketch ?? 0, s.sketch_scope ?? "");
|
|
2500
2723
|
}
|
|
2501
|
-
// Restore tasks
|
|
2724
|
+
// Restore tasks (ADR-011 P2: includes blocker_source + escalation_* columns)
|
|
2502
2725
|
const tkStmt = db.prepare(`INSERT INTO tasks (milestone_id, slice_id, id, title, status,
|
|
2503
2726
|
one_liner, narrative, verification_result, duration, completed_at,
|
|
2504
2727
|
blocker_discovered, deviations, known_issues, key_files, key_decisions,
|
|
2505
2728
|
full_summary_md, description, estimate, files, verify,
|
|
2506
|
-
inputs, expected_output, observability_impact, sequence
|
|
2507
|
-
|
|
2729
|
+
inputs, expected_output, observability_impact, sequence,
|
|
2730
|
+
blocker_source, escalation_pending, escalation_awaiting_review,
|
|
2731
|
+
escalation_artifact_path, escalation_override_applied_at)
|
|
2732
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2508
2733
|
for (const t of manifest.tasks) {
|
|
2509
|
-
tkStmt.run(t.milestone_id, t.slice_id, t.id, t.title, t.status, t.one_liner, t.narrative, t.verification_result, t.duration, t.completed_at, t.blocker_discovered ? 1 : 0, t.deviations, t.known_issues, JSON.stringify(t.key_files), JSON.stringify(t.key_decisions), t.full_summary_md, t.description, t.estimate, JSON.stringify(t.files), t.verify, JSON.stringify(t.inputs), JSON.stringify(t.expected_output), t.observability_impact, t.sequence);
|
|
2734
|
+
tkStmt.run(t.milestone_id, t.slice_id, t.id, t.title, t.status, t.one_liner, t.narrative, t.verification_result, t.duration, t.completed_at, t.blocker_discovered ? 1 : 0, t.deviations, t.known_issues, JSON.stringify(t.key_files), JSON.stringify(t.key_decisions), t.full_summary_md, t.description, t.estimate, JSON.stringify(t.files), t.verify, JSON.stringify(t.inputs), JSON.stringify(t.expected_output), t.observability_impact, t.sequence, t.blocker_source ?? "", t.escalation_pending ?? 0, t.escalation_awaiting_review ?? 0, t.escalation_artifact_path ?? null, t.escalation_override_applied_at ?? null);
|
|
2510
2735
|
}
|
|
2511
|
-
// Restore decisions
|
|
2512
|
-
const dcStmt = db.prepare(`INSERT INTO decisions (seq, id, when_context, scope, decision, choice, rationale, revisable, made_by, superseded_by)
|
|
2513
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2736
|
+
// Restore decisions (ADR-011 P2: include source so escalation decisions survive)
|
|
2737
|
+
const dcStmt = db.prepare(`INSERT INTO decisions (seq, id, when_context, scope, decision, choice, rationale, revisable, made_by, source, superseded_by)
|
|
2738
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
2514
2739
|
for (const d of manifest.decisions) {
|
|
2515
|
-
dcStmt.run(d.seq, d.id, d.when_context, d.scope, d.decision, d.choice, d.rationale, d.revisable, d.made_by, d.superseded_by);
|
|
2740
|
+
dcStmt.run(d.seq, d.id, d.when_context, d.scope, d.decision, d.choice, d.rationale, d.revisable, d.made_by, d.source ?? "discussion", d.superseded_by);
|
|
2516
2741
|
}
|
|
2517
2742
|
// Restore verification evidence
|
|
2518
2743
|
const evStmt = db.prepare(`INSERT INTO verification_evidence (task_id, slice_id, milestone_id, command, exit_code, verdict, duration_ms, created_at)
|
|
@@ -43,47 +43,75 @@ function truncateMessage(msg, maxLen) {
|
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Build compact health lines for the widget.
|
|
46
|
-
*
|
|
46
|
+
* When `width` is provided, system + budget render left and last-commit
|
|
47
|
+
* right-aligned. Without width, all parts are joined inline (RPC fallback).
|
|
47
48
|
*/
|
|
48
|
-
export function buildHealthLines(data) {
|
|
49
|
+
export function buildHealthLines(data, width) {
|
|
49
50
|
if (data.projectState === "none") {
|
|
50
51
|
return [" GSD No project loaded — run /gsd to start"];
|
|
51
52
|
}
|
|
52
53
|
if (data.projectState === "initialized") {
|
|
53
54
|
return [" GSD Project initialized — run /gsd to continue setup"];
|
|
54
55
|
}
|
|
55
|
-
const
|
|
56
|
+
const leftParts = [];
|
|
56
57
|
const totalIssues = data.environmentErrorCount + data.environmentWarningCount + (data.providerIssue ? 1 : 0);
|
|
57
58
|
if (totalIssues === 0) {
|
|
58
|
-
|
|
59
|
+
leftParts.push("● System OK");
|
|
59
60
|
}
|
|
60
61
|
else if (data.environmentErrorCount > 0 || data.providerIssue?.includes("✗")) {
|
|
61
|
-
|
|
62
|
+
leftParts.push(`✗ ${totalIssues} issue${totalIssues > 1 ? "s" : ""}`);
|
|
62
63
|
}
|
|
63
64
|
else {
|
|
64
|
-
|
|
65
|
+
leftParts.push(`⚠ ${totalIssues} warning${totalIssues > 1 ? "s" : ""}`);
|
|
65
66
|
}
|
|
66
67
|
if (data.budgetCeiling !== undefined && data.budgetCeiling > 0) {
|
|
67
68
|
const pct = Math.min(100, (data.budgetSpent / data.budgetCeiling) * 100);
|
|
68
|
-
|
|
69
|
+
leftParts.push(`Budget: ${formatCost(data.budgetSpent)}/${formatCost(data.budgetCeiling)} (${pct.toFixed(0)}%)`);
|
|
69
70
|
}
|
|
70
71
|
else if (data.budgetSpent > 0) {
|
|
71
|
-
|
|
72
|
+
leftParts.push(`Spent: ${formatCost(data.budgetSpent)}`);
|
|
72
73
|
}
|
|
73
74
|
if (data.providerIssue) {
|
|
74
|
-
|
|
75
|
+
leftParts.push(data.providerIssue);
|
|
75
76
|
}
|
|
76
77
|
if (data.environmentErrorCount > 0) {
|
|
77
|
-
|
|
78
|
+
leftParts.push(`Env: ${data.environmentErrorCount} error${data.environmentErrorCount > 1 ? "s" : ""}`);
|
|
78
79
|
}
|
|
79
80
|
else if (data.environmentWarningCount > 0) {
|
|
80
|
-
|
|
81
|
+
leftParts.push(`Env: ${data.environmentWarningCount} warning${data.environmentWarningCount > 1 ? "s" : ""}`);
|
|
81
82
|
}
|
|
82
|
-
//
|
|
83
|
+
// Last commit goes on the right-hand side when width is known.
|
|
84
|
+
let rightText = "";
|
|
83
85
|
if (data.lastCommitEpoch !== null && data.lastCommitEpoch > 0) {
|
|
84
86
|
const relTime = formatRelativeTime(data.lastCommitEpoch);
|
|
85
87
|
const msg = data.lastCommitMessage ? ` — ${truncateMessage(data.lastCommitMessage, 50)}` : "";
|
|
86
|
-
|
|
88
|
+
rightText = `Last commit: ${relTime}${msg}`;
|
|
87
89
|
}
|
|
88
|
-
|
|
90
|
+
const leftText = leftParts.join(" │ ");
|
|
91
|
+
if (width === undefined) {
|
|
92
|
+
const inline = rightText ? `${leftText} │ ${rightText}` : leftText;
|
|
93
|
+
return [` ${inline}`];
|
|
94
|
+
}
|
|
95
|
+
const prefix = " ";
|
|
96
|
+
const innerWidth = Math.max(0, width - prefix.length);
|
|
97
|
+
const leftVis = leftText.length;
|
|
98
|
+
const rightVis = rightText.length;
|
|
99
|
+
if (!rightText)
|
|
100
|
+
return [`${prefix}${truncateMessage(leftText, innerWidth)}`];
|
|
101
|
+
const MIN_GAP = 2;
|
|
102
|
+
if (leftVis + MIN_GAP + rightVis > innerWidth) {
|
|
103
|
+
// Preserve the left (status + budget) and truncate the right side
|
|
104
|
+
// (last commit) with an ellipsis so the combined line never exceeds
|
|
105
|
+
// innerWidth. If even the left alone overflows, clamp it too.
|
|
106
|
+
const leftRoom = Math.max(1, Math.min(leftVis, innerWidth - MIN_GAP - 1));
|
|
107
|
+
const clampedLeft = truncateMessage(leftText, leftRoom);
|
|
108
|
+
const rightRoom = Math.max(0, innerWidth - clampedLeft.length - MIN_GAP);
|
|
109
|
+
const clampedRight = rightRoom > 0 ? truncateMessage(rightText, rightRoom) : "";
|
|
110
|
+
if (!clampedRight)
|
|
111
|
+
return [`${prefix}${clampedLeft}`];
|
|
112
|
+
const pad = " ".repeat(Math.max(MIN_GAP, innerWidth - clampedLeft.length - clampedRight.length));
|
|
113
|
+
return [`${prefix}${clampedLeft}${pad}${clampedRight}`];
|
|
114
|
+
}
|
|
115
|
+
const padding = " ".repeat(innerWidth - leftVis - rightVis);
|
|
116
|
+
return [`${prefix}${leftText}${padding}${rightText}`];
|
|
89
117
|
}
|
|
@@ -111,13 +111,16 @@ export function initHealthWidget(ctx) {
|
|
|
111
111
|
const refreshTimer = setInterval(() => {
|
|
112
112
|
void refresh();
|
|
113
113
|
}, REFRESH_INTERVAL_MS);
|
|
114
|
+
let cachedWidth;
|
|
114
115
|
return {
|
|
115
|
-
render(
|
|
116
|
-
if (!cachedLines)
|
|
117
|
-
cachedLines = buildHealthLines(data);
|
|
116
|
+
render(width) {
|
|
117
|
+
if (!cachedLines || cachedWidth !== width) {
|
|
118
|
+
cachedLines = buildHealthLines(data, width);
|
|
119
|
+
cachedWidth = width;
|
|
120
|
+
}
|
|
118
121
|
return cachedLines;
|
|
119
122
|
},
|
|
120
|
-
invalidate() { cachedLines = undefined; },
|
|
123
|
+
invalidate() { cachedLines = undefined; cachedWidth = undefined; },
|
|
121
124
|
dispose() {
|
|
122
125
|
clearInterval(refreshTimer);
|
|
123
126
|
},
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export const BUNDLED_COST_TABLE = [
|
|
12
12
|
// Anthropic
|
|
13
|
-
{ id: "claude-opus-4-6", inputPer1k: 0.
|
|
13
|
+
{ id: "claude-opus-4-6", inputPer1k: 0.005, outputPer1k: 0.025, updatedAt: "2026-04-16" },
|
|
14
|
+
{ id: "claude-opus-4-7", inputPer1k: 0.005, outputPer1k: 0.025, updatedAt: "2026-04-16" },
|
|
14
15
|
{ id: "claude-sonnet-4-6", inputPer1k: 0.003, outputPer1k: 0.015, updatedAt: "2025-03-15" },
|
|
15
16
|
{ id: "claude-haiku-4-5", inputPer1k: 0.0008, outputPer1k: 0.004, updatedAt: "2025-03-15" },
|
|
16
17
|
{ id: "claude-sonnet-4-5-20250514", inputPer1k: 0.003, outputPer1k: 0.015, updatedAt: "2025-03-15" },
|
|
@@ -41,6 +42,7 @@ export const BUNDLED_COST_TABLE = [
|
|
|
41
42
|
{ id: "gpt-5.3-codex", inputPer1k: 0.005, outputPer1k: 0.02, updatedAt: "2026-03-29" },
|
|
42
43
|
{ id: "gpt-5.3-codex-spark", inputPer1k: 0.0003, outputPer1k: 0.0012, updatedAt: "2026-03-29" },
|
|
43
44
|
{ id: "gpt-5.4", inputPer1k: 0.005, outputPer1k: 0.02, updatedAt: "2026-03-29" },
|
|
45
|
+
{ id: "gpt-5.4-mini", inputPer1k: 0.00075, outputPer1k: 0.0045, updatedAt: "2026-04-18" },
|
|
44
46
|
// Google
|
|
45
47
|
{ id: "gemini-2.0-flash", inputPer1k: 0.0001, outputPer1k: 0.0004, updatedAt: "2025-03-15" },
|
|
46
48
|
{ id: "gemini-flash-2.0", inputPer1k: 0.0001, outputPer1k: 0.0004, updatedAt: "2025-03-15" },
|