gsd-pi 2.78.0 → 2.78.1-dev.9d08d820b
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 +59 -23
- package/dist/bundled-resource-path.d.ts +7 -0
- package/dist/bundled-resource-path.js +34 -2
- package/dist/claude-cli-check.js +104 -33
- package/dist/cli-policy.d.ts +13 -0
- package/dist/cli-policy.js +17 -0
- package/dist/cli.js +95 -55
- package/dist/headless-query.d.ts +22 -0
- package/dist/headless-query.js +43 -8
- package/dist/headless.d.ts +10 -0
- package/dist/headless.js +16 -1
- package/dist/loader.js +9 -13
- package/dist/onboarding.d.ts +10 -0
- package/dist/onboarding.js +2 -2
- package/dist/provider-migrations.d.ts +2 -2
- package/dist/provider-migrations.js +5 -2
- package/dist/resource-loader.d.ts +5 -2
- package/dist/resource-loader.js +30 -13
- package/dist/resources/.managed-resources-content-hash +1 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +128 -32
- package/dist/resources/extensions/gsd/auto/loop.js +23 -0
- package/dist/resources/extensions/gsd/auto/phases.js +5 -13
- package/dist/resources/extensions/gsd/auto/run-unit.js +3 -1
- package/dist/resources/extensions/gsd/auto/session.js +5 -6
- package/dist/resources/extensions/gsd/auto-dashboard.js +3 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +18 -6
- package/dist/resources/extensions/gsd/auto-prompts.js +63 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +43 -4
- package/dist/resources/extensions/gsd/auto-runtime-state.js +31 -0
- package/dist/resources/extensions/gsd/auto-start.js +1 -1
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +2 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +60 -13
- package/dist/resources/extensions/gsd/auto.js +14 -5
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +14 -2
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +7 -5
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +5 -4
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +100 -31
- package/dist/resources/extensions/gsd/bootstrap/register-shortcuts.js +11 -6
- package/dist/resources/extensions/gsd/bootstrap/subagent-input.js +22 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +34 -8
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +121 -3
- package/dist/resources/extensions/gsd/commands/catalog.js +69 -5
- package/dist/resources/extensions/gsd/commands/handlers/core.js +22 -1
- package/dist/resources/extensions/gsd/commands-config.js +3 -2
- package/dist/resources/extensions/gsd/commands-extensions.js +46 -3
- package/dist/resources/extensions/gsd/commands-handlers.js +3 -2
- package/dist/resources/extensions/gsd/commands-mcp-status.js +3 -1
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +10 -1
- package/dist/resources/extensions/gsd/dashboard-overlay.js +1 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/dist/resources/extensions/gsd/doctor-providers.js +2 -1
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +39 -1
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/forensics.js +10 -8
- package/dist/resources/extensions/gsd/git-service.js +12 -5
- package/dist/resources/extensions/gsd/gsd-db.js +11 -2
- package/dist/resources/extensions/gsd/guided-flow.js +25 -24
- package/dist/resources/extensions/gsd/home-dir.js +16 -0
- package/dist/resources/extensions/gsd/key-manager.js +2 -1
- package/dist/resources/extensions/gsd/memory-store.js +66 -31
- package/dist/resources/extensions/gsd/migrate/command.js +3 -2
- package/dist/resources/extensions/gsd/milestone-id-reservation.js +36 -0
- package/dist/resources/extensions/gsd/model-router.js +114 -9
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -1
- package/dist/resources/extensions/gsd/preferences-models.js +91 -15
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +32 -0
- package/dist/resources/extensions/gsd/preferences.js +5 -3
- package/dist/resources/extensions/gsd/prompt-loader.js +23 -12
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +9 -3
- package/dist/resources/extensions/gsd/state.js +42 -0
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +18 -1
- package/dist/resources/extensions/gsd/unit-context-manifest.js +29 -4
- package/dist/resources/extensions/gsd/visualizer-overlay.js +1 -1
- package/dist/resources/extensions/gsd/watch/header-renderer.js +3 -1
- package/dist/resources/extensions/gsd/worktree-command.js +26 -46
- package/dist/resources/extensions/gsd/worktree-manager.js +20 -1
- package/dist/resources/extensions/gsd/worktree-resolver.js +4 -13
- package/dist/resources/extensions/gsd/worktree-root.js +124 -0
- package/dist/resources/extensions/gsd/worktree-session-state.js +33 -0
- package/dist/resources/extensions/gsd/worktree.js +4 -115
- package/dist/resources/extensions/mcp-client/index.js +6 -3
- package/dist/resources/extensions/ollama/index.js +15 -2
- package/dist/resources/extensions/ollama/model-capabilities.js +31 -0
- package/dist/resources/extensions/ollama/ollama-client.js +40 -4
- package/dist/resources/extensions/slash-commands/create-extension.js +36 -22
- package/dist/resources/extensions/subagent/index.js +324 -178
- package/dist/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/dist/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/dist/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/dist/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/dist/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/dist/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/dist/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/rtk-shared.d.ts +3 -0
- package/dist/rtk-shared.js +17 -0
- package/dist/rtk.d.ts +2 -5
- package/dist/rtk.js +3 -20
- package/dist/runtime-checks.d.ts +27 -0
- package/dist/runtime-checks.js +38 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- package/dist/web/standalone/.next/build-manifest.json +4 -4
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +44 -4
- package/dist/web/standalone/.next/required-server-files.json +3 -3
- package/dist/web/standalone/.next/server/app/_global-error/page.js +3 -3
- 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.js +2 -2
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
- 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 +3 -3
- 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/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/browse-directories/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/dev-mode/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/experimental/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/experimental/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/notifications/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/preferences/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/remote-questions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/remote-questions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +4 -2
- package/dist/web/standalone/.next/server/app/api/session/events/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/input/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/input/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/resize/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +2 -2
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +4 -4
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/upload/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/update/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +4 -4
- 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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/page.js +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 +11 -11
- package/dist/web/standalone/.next/server/chunks/63.js +3 -3
- 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/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +2 -2
- package/dist/web/standalone/.next/server/next-font-manifest.js +1 -1
- package/dist/web/standalone/.next/server/next-font-manifest.json +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/server/webpack-runtime.js +1 -1
- package/dist/web/standalone/.next/static/chunks/2556.0527fea66e123b7f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/2824.08296bc2f9654698.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3026.3af53b279375f082.js +1 -0
- package/dist/web/standalone/.next/static/chunks/315.6f68ae79b67d25cf.js +1 -0
- package/dist/web/standalone/.next/static/chunks/3497.4bfc60a3b3dea717.js +1 -0
- package/dist/web/standalone/.next/static/chunks/5516.4a07c872b5c3a663.js +1 -0
- package/dist/web/standalone/.next/static/chunks/8336.31b019697882acfb.js +10 -0
- package/dist/web/standalone/.next/static/chunks/8845.c9702695e8c5a9c5.js +2 -0
- package/dist/web/standalone/.next/static/chunks/9058.01ef3a463bda88f1.js +20 -0
- package/dist/web/standalone/.next/static/chunks/9441.1081da1125d1764f.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/{page-2f24283c162b6ab3.js → page-f2a7482d42a5614b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/{layout-9ecfd95f343793f0.js → layout-a16c7a7ecdf0c2cf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-9bf2e0c50fb2ca05.js +1 -0
- package/dist/web/standalone/.next/static/chunks/main-app-fdab67f7802d7832.js +1 -0
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-459824ffb8c323dd.js +1 -0
- package/dist/web/standalone/.next/static/chunks/webpack-f9f0dc45e4f3ac10.js +1 -0
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +2 -2
- package/dist/web/standalone/node_modules/node-pty/build/Release/pty.node +0 -0
- package/dist/web/standalone/node_modules/node-pty/build/pty.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_except.target.mk +14 -14
- package/dist/web/standalone/node_modules/node-pty/node-addon-api/node_addon_api_maybe.target.mk +14 -14
- package/dist/web/standalone/package.json +2 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/worktree-cli.d.ts +1 -0
- package/dist/worktree-cli.js +9 -3
- package/dist/worktree-status-banner.d.ts +1 -0
- package/dist/worktree-status-banner.js +132 -0
- package/package.json +1 -3
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/alias-telemetry.d.ts +8 -0
- package/packages/mcp-server/dist/alias-telemetry.d.ts.map +1 -0
- package/packages/mcp-server/dist/alias-telemetry.js +30 -0
- package/packages/mcp-server/dist/alias-telemetry.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +74 -46
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/alias-telemetry.test.ts +78 -0
- package/packages/mcp-server/src/alias-telemetry.ts +30 -0
- package/packages/mcp-server/src/workflow-tools.test.ts +78 -0
- package/packages/mcp-server/src/workflow-tools.ts +93 -58
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js +231 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.cache-breakpoint.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +48 -19
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/types.d.ts +13 -0
- package/packages/pi-ai/dist/types.d.ts.map +1 -1
- package/packages/pi-ai/dist/types.js.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/repair-tool-json.js +24 -3
- package/packages/pi-ai/dist/utils/repair-tool-json.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js +26 -0
- package/packages/pi-ai/dist/utils/tests/repair-tool-json.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.cache-breakpoint.test.ts +289 -0
- package/packages/pi-ai/src/providers/anthropic-shared.ts +52 -20
- package/packages/pi-ai/src/types.ts +13 -0
- package/packages/pi-ai/src/utils/repair-tool-json.ts +24 -3
- package/packages/pi-ai/src/utils/tests/repair-tool-json.test.ts +32 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +6 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/messages.js +4 -0
- package/packages/pi-coding-agent/dist/core/messages.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +19 -2
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts +10 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +18 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.d.ts +13 -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 +20 -16
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts +37 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js +49 -0
- package/packages/pi-coding-agent/dist/core/token-telemetry.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js +133 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.js +1 -1
- 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 +14 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js +78 -0
- package/packages/pi-coding-agent/dist/tests/system-prompt-cache-stability.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js +181 -0
- package/packages/pi-coding-agent/dist/tests/token-telemetry.test.js.map +1 -0
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/agent-session.ts +7 -0
- package/packages/pi-coding-agent/src/core/messages.ts +4 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +32 -2
- package/packages/pi-coding-agent/src/core/model-registry.ts +21 -0
- package/packages/pi-coding-agent/src/core/system-prompt.ts +33 -15
- package/packages/pi-coding-agent/src/core/token-telemetry.ts +77 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/tool-card-cleanup-and-success-runtime.test.ts +212 -0
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +17 -1
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.ts +1 -1
- package/packages/pi-coding-agent/src/tests/system-prompt-cache-stability.test.ts +102 -0
- package/packages/pi-coding-agent/src/tests/token-telemetry.test.ts +200 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +17 -3
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts +2 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.d.ts.map +1 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js +161 -0
- package/packages/pi-tui/dist/components/__tests__/leak-fixes-runtime.test.js.map +1 -0
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +20 -3
- package/packages/pi-tui/src/components/__tests__/leak-fixes-runtime.test.ts +219 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/readiness.ts +130 -30
- package/src/resources/extensions/gsd/auto/loop.ts +24 -2
- package/src/resources/extensions/gsd/auto/phases.ts +6 -14
- package/src/resources/extensions/gsd/auto/run-unit.ts +3 -1
- package/src/resources/extensions/gsd/auto/session.ts +5 -6
- package/src/resources/extensions/gsd/auto/types.ts +1 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +3 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +18 -6
- package/src/resources/extensions/gsd/auto-prompts.ts +60 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +46 -8
- package/src/resources/extensions/gsd/auto-runtime-state.ts +51 -0
- package/src/resources/extensions/gsd/auto-start.ts +1 -1
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +2 -4
- package/src/resources/extensions/gsd/auto-worktree.ts +82 -12
- package/src/resources/extensions/gsd/auto.ts +14 -4
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +15 -13
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +8 -7
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +10 -9
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +108 -31
- package/src/resources/extensions/gsd/bootstrap/register-shortcuts.ts +12 -6
- package/src/resources/extensions/gsd/bootstrap/subagent-input.ts +20 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +39 -8
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +141 -11
- package/src/resources/extensions/gsd/commands/catalog.ts +75 -5
- package/src/resources/extensions/gsd/commands/handlers/core.ts +22 -1
- package/src/resources/extensions/gsd/commands-config.ts +3 -2
- package/src/resources/extensions/gsd/commands-extensions.ts +43 -3
- package/src/resources/extensions/gsd/commands-handlers.ts +3 -2
- package/src/resources/extensions/gsd/commands-mcp-status.ts +3 -1
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +15 -1
- package/src/resources/extensions/gsd/dashboard-overlay.ts +1 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +10 -0
- package/src/resources/extensions/gsd/doctor-providers.ts +2 -1
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +39 -1
- package/src/resources/extensions/gsd/doctor-types.ts +3 -1
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/forensics.ts +12 -7
- package/src/resources/extensions/gsd/git-service.ts +13 -5
- package/src/resources/extensions/gsd/gsd-db.ts +12 -2
- package/src/resources/extensions/gsd/guided-flow.ts +27 -26
- package/src/resources/extensions/gsd/home-dir.ts +19 -0
- package/src/resources/extensions/gsd/journal.ts +4 -1
- package/src/resources/extensions/gsd/key-manager.ts +2 -1
- package/src/resources/extensions/gsd/memory-store.ts +81 -28
- package/src/resources/extensions/gsd/migrate/command.ts +3 -2
- package/src/resources/extensions/gsd/milestone-id-reservation.ts +47 -0
- package/src/resources/extensions/gsd/model-router.ts +172 -9
- package/src/resources/extensions/gsd/native-git-bridge.ts +7 -1
- package/src/resources/extensions/gsd/preferences-models.ts +101 -15
- package/src/resources/extensions/gsd/preferences-types.ts +6 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +35 -0
- package/src/resources/extensions/gsd/preferences.ts +16 -2
- package/src/resources/extensions/gsd/prompt-loader.ts +26 -12
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +10 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +10 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +10 -0
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +9 -3
- package/src/resources/extensions/gsd/state.ts +42 -0
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +1 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +178 -1
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/auto-session-encapsulation.test.ts +24 -5
- package/src/resources/extensions/gsd/tests/auto-supervisor.test.mjs +21 -4
- package/src/resources/extensions/gsd/tests/bootstrap-derive-state-db-open.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/budget-prediction.test.ts +138 -211
- package/src/resources/extensions/gsd/tests/commands-extensions-version-compare.test.ts +58 -0
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +142 -59
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +7 -4
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +89 -32
- package/src/resources/extensions/gsd/tests/custom-engine-loop-integration.test.ts +41 -23
- package/src/resources/extensions/gsd/tests/db-path-worktree-symlink.test.ts +3 -43
- package/src/resources/extensions/gsd/tests/debug-logger.test.ts +5 -3
- package/src/resources/extensions/gsd/tests/deferred-milestone-dir-4996.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/discuss-empty-db-fallback.test.ts +22 -87
- package/src/resources/extensions/gsd/tests/discuss-queued-milestones.test.ts +7 -118
- package/src/resources/extensions/gsd/tests/discuss-tool-scope-leak.test.ts +18 -60
- package/src/resources/extensions/gsd/tests/doctor-orphan-milestone-4996.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +14 -76
- package/src/resources/extensions/gsd/tests/ensure-preconditions-guard-4996.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/false-degraded-mode-warning.test.ts +22 -83
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +1 -63
- package/src/resources/extensions/gsd/tests/find-missing-summaries-closed-runtime.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/forensics-stuck-loops.test.ts +26 -1
- package/src/resources/extensions/gsd/tests/gitignore-bg-shell-runtime.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/gsd-no-project-error-runtime.test.ts +81 -0
- package/src/resources/extensions/gsd/tests/headless-answers.test.ts +14 -4
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +22 -12
- package/src/resources/extensions/gsd/tests/help-menu-coverage.test.ts +57 -0
- package/src/resources/extensions/gsd/tests/home-dir.test.ts +52 -0
- package/src/resources/extensions/gsd/tests/import-done-milestones-runtime.test.ts +145 -0
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +64 -1
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +72 -1
- package/src/resources/extensions/gsd/tests/integration/token-savings.test.ts +0 -23
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +128 -0
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +33 -1
- package/src/resources/extensions/gsd/tests/merge-self-branch-guard.test.ts +124 -0
- package/src/resources/extensions/gsd/tests/milestone-id-gap-reuse-4996.test.ts +152 -0
- package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +18 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +169 -8
- package/src/resources/extensions/gsd/tests/native-git-infra-errors.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/orphaned-worktree-audit.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/parallel-crash-recovery.test.ts +32 -43
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +4 -10
- package/src/resources/extensions/gsd/tests/preferences.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/prompt-step-ordering.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/quick-turn-end-cleanup.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/register-hooks-compaction-checkpoint.test.ts +93 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +168 -19
- package/src/resources/extensions/gsd/tests/slice-parallel-orchestrator.test.ts +7 -1
- package/src/resources/extensions/gsd/tests/smart-entry-complete.test.ts +23 -1
- package/src/resources/extensions/gsd/tests/steer-worktree-path.test.ts +17 -1
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +51 -4
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +7 -16
- package/src/resources/extensions/gsd/tests/unit-context-manifest.test.ts +38 -3
- package/src/resources/extensions/gsd/tests/unstructured-continue-context-injection.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +15 -1
- package/src/resources/extensions/gsd/tests/visualizer-overlay.test.ts +6 -6
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +34 -33
- package/src/resources/extensions/gsd/tests/worktree.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +131 -1
- package/src/resources/extensions/gsd/tools/memory-tools.ts +17 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +44 -12
- package/src/resources/extensions/gsd/visualizer-overlay.ts +1 -1
- package/src/resources/extensions/gsd/watch/header-renderer.ts +3 -1
- package/src/resources/extensions/gsd/workflow-logger.ts +1 -0
- package/src/resources/extensions/gsd/worktree-command.ts +31 -44
- package/src/resources/extensions/gsd/worktree-manager.ts +40 -1
- package/src/resources/extensions/gsd/worktree-resolver.ts +4 -14
- package/src/resources/extensions/gsd/worktree-root.ts +144 -0
- package/src/resources/extensions/gsd/worktree-session-state.ts +35 -0
- package/src/resources/extensions/gsd/worktree.ts +8 -119
- package/src/resources/extensions/mcp-client/index.ts +6 -3
- package/src/resources/extensions/mcp-client/tests/global-config.test.ts +91 -0
- package/src/resources/extensions/ollama/index.ts +16 -2
- package/src/resources/extensions/ollama/model-capabilities.ts +34 -0
- package/src/resources/extensions/ollama/ollama-client.ts +41 -4
- package/src/resources/extensions/ollama/tests/model-capabilities.test.ts +96 -0
- package/src/resources/extensions/ollama/tests/ollama-client-timeout-env.test.ts +147 -0
- package/src/resources/extensions/slash-commands/create-extension.ts +38 -24
- package/src/resources/extensions/subagent/index.ts +165 -7
- package/src/resources/skills/create-gsd-extension/SKILL.md +9 -5
- package/src/resources/skills/create-gsd-extension/references/custom-commands.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/custom-rendering.md +5 -5
- package/src/resources/skills/create-gsd-extension/references/custom-tools.md +4 -4
- package/src/resources/skills/create-gsd-extension/references/custom-ui.md +6 -6
- package/src/resources/skills/create-gsd-extension/references/events-reference.md +3 -3
- package/src/resources/skills/create-gsd-extension/references/packaging-distribution.md +1 -1
- package/src/resources/skills/create-gsd-extension/references/remote-execution-overrides.md +3 -3
- package/src/resources/skills/create-gsd-extension/templates/extension-skeleton.ts +2 -2
- package/src/resources/skills/create-gsd-extension/templates/stateful-tool-skeleton.ts +3 -3
- package/src/resources/skills/create-gsd-extension/templates/templates.test.ts +58 -0
- package/src/resources/skills/create-gsd-extension/workflows/create-extension.md +32 -12
- package/dist/resources/extensions/browser-tools/tests/browser-tools-integration.test.mjs +0 -601
- package/dist/resources/extensions/browser-tools/tests/browser-tools-unit.test.cjs +0 -651
- package/dist/resources/extensions/browser-tools/tests/capture-sharp-optional.test.cjs +0 -91
- package/dist/resources/extensions/gsd/tests/auto-supervisor.test.mjs +0 -53
- package/dist/resources/extensions/gsd/tests/dist-redirect.mjs +0 -112
- package/dist/resources/extensions/gsd/tests/resolve-ts-hooks.mjs +0 -23
- package/dist/resources/extensions/gsd/tests/resolve-ts.mjs +0 -5
- package/dist/resources/skills/github-workflows/references/gh/tests/__init__.py +0 -0
- package/dist/resources/skills/github-workflows/references/gh/tests/test_github_project_setup.py +0 -608
- package/dist/web/standalone/.next/static/chunks/2826.e9f5195e91f9cad2.js +0 -11
- package/dist/web/standalone/.next/static/chunks/3621.fc7480022c972438.js +0 -20
- package/dist/web/standalone/.next/static/chunks/app/page-151349214571e2b6.js +0 -1
- package/dist/web/standalone/.next/static/chunks/main-app-d3d4c336195465f9.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ab5a8926e07ec673.js +0 -1
- package/dist/web/standalone/.next/static/chunks/webpack-2e68521d7c82f7c2.js +0 -1
- package/src/resources/extensions/gsd/tests/copy-planning-artifacts-samepath.test.ts +0 -22
- package/src/resources/extensions/gsd/tests/discuss-slice-structured-questions.test.ts +0 -47
- package/src/resources/extensions/gsd/tests/empty-content-abort-loop.test.ts +0 -75
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → -Ukk6_YxRd4GY4iUOnRUE}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{C1zT2kEfoLhDdbWPWKrXd → -Ukk6_YxRd4GY4iUOnRUE}/_ssgManifest.js +0 -0
|
@@ -7,14 +7,13 @@
|
|
|
7
7
|
* Templates live at prompts/ relative to this module's directory.
|
|
8
8
|
* They use {{variableName}} syntax for substitution.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* This
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* set A) can read a newer
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* that aren't read until the end of a long auto-mode run.
|
|
10
|
+
* Templates are snapshotted shortly after module init via warmCache().
|
|
11
|
+
* This keeps import/extension-registration fast while still preventing a
|
|
12
|
+
* running session from being invalidated when another `gsd` launch overwrites
|
|
13
|
+
* ~/.gsd/agent/ with newer templates via initResources(). Without caching, the
|
|
14
|
+
* in-memory extension code (which knows variable set A) can read a newer
|
|
15
|
+
* template from disk (which expects variable set B), causing a
|
|
16
|
+
* "template declares {{X}} but no value was provided" crash mid-session.
|
|
18
17
|
*/
|
|
19
18
|
|
|
20
19
|
import { readFileSync, readdirSync, existsSync } from "node:fs";
|
|
@@ -82,8 +81,8 @@ export function getTemplatesDir(): string {
|
|
|
82
81
|
return templatesDir;
|
|
83
82
|
}
|
|
84
83
|
|
|
85
|
-
// Cache all templates
|
|
86
|
-
// template versions that were on disk
|
|
84
|
+
// Cache all templates from a startup snapshot — a running session uses the
|
|
85
|
+
// template versions that were on disk near startup, immune to later overwrites.
|
|
87
86
|
const templateCache = new Map<string, string>();
|
|
88
87
|
|
|
89
88
|
/**
|
|
@@ -124,8 +123,23 @@ function warmCache(): void {
|
|
|
124
123
|
}
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
let warmCacheScheduled = false;
|
|
127
|
+
|
|
128
|
+
function scheduleWarmCache(): void {
|
|
129
|
+
if (warmCacheScheduled) return;
|
|
130
|
+
warmCacheScheduled = true;
|
|
131
|
+
|
|
132
|
+
const run = () => {
|
|
133
|
+
warmCache();
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const timer = setTimeout(run, 1000);
|
|
137
|
+
timer.unref?.();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Snapshot the full prompt/template tree after import so extension startup only
|
|
141
|
+
// pays for prompts that are actually needed immediately.
|
|
142
|
+
scheduleWarmCache();
|
|
129
143
|
|
|
130
144
|
/**
|
|
131
145
|
* Load a prompt template and substitute variables.
|
|
@@ -16,6 +16,16 @@ Start with what the excerpts give you. Read full files when the section heads si
|
|
|
16
16
|
|
|
17
17
|
**On-demand Read ordering:** Complete all slice SUMMARY Reads you need for cross-slice synthesis, the Decision Re-evaluation table, and LEARNINGS **before** calling `gsd_complete_milestone` (step 10). Once that tool runs, the milestone is marked complete in the DB — running out of tool budget between step 10 and the LEARNINGS write (step 12) leaves the milestone committed without its LEARNINGS artifact.
|
|
18
18
|
|
|
19
|
+
### Delegate Review Work
|
|
20
|
+
|
|
21
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate review work that benefits from a fresh context window. For non-trivial milestones, delegate before drafting LEARNINGS:
|
|
22
|
+
|
|
23
|
+
- **Cross-slice integrations or new public APIs** → dispatch the **reviewer** agent with the milestone diff and roadmap; treat its findings as input to your Decision Re-evaluation and LEARNINGS sections.
|
|
24
|
+
- **Touched auth, network, parsing, file IO, shell exec, or crypto** → dispatch the **security** agent for an OWASP-style audit across the merged slices.
|
|
25
|
+
- **Significant test surface added or changed** → dispatch the **tester** agent to assess coverage gaps relative to the milestone success criteria.
|
|
26
|
+
|
|
27
|
+
Subagents read the diff and report findings — they do **not** write user source. Apply their feedback into the milestone summary and any captured decisions before calling `gsd_complete_milestone`.
|
|
28
|
+
|
|
19
29
|
{{inlinedContext}}
|
|
20
30
|
|
|
21
31
|
Then:
|
|
@@ -20,6 +20,16 @@ All relevant context has been preloaded below — the slice plan, all task summa
|
|
|
20
20
|
|
|
21
21
|
**Match effort to complexity.** A simple slice with 1-2 tasks needs a brief summary and lightweight verification. A complex slice with 5 tasks across multiple subsystems needs thorough verification and a detailed summary. Scale the work below accordingly.
|
|
22
22
|
|
|
23
|
+
### Delegate Review Work
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate review work that benefits from a fresh context window. Strongly consider delegating when the slice is non-trivial:
|
|
26
|
+
|
|
27
|
+
- **Cross-cutting code or new abstractions** → dispatch the **reviewer** agent with the slice diff and plan; apply High/Critical findings before completing.
|
|
28
|
+
- **Touched auth, network, parsing, file IO, shell exec, or crypto** → dispatch the **security** agent for an OWASP-style audit.
|
|
29
|
+
- **Added or modified tests** → dispatch the **tester** agent to assess coverage gaps relative to the slice plan.
|
|
30
|
+
|
|
31
|
+
Subagents read the diff and report findings — they do **not** write user source. You remain responsible for acting on their feedback before calling `gsd_complete_slice` with `milestoneId` and `sliceId`.
|
|
32
|
+
|
|
23
33
|
Then:
|
|
24
34
|
1. Use the **Slice Summary** and **UAT** output templates from the inlined context above
|
|
25
35
|
2. {{skillActivation}}
|
|
@@ -20,6 +20,16 @@ Pay particular attention to **Forward Intelligence** sections — they contain h
|
|
|
20
20
|
|
|
21
21
|
You have full tool access. Before decomposing, explore the relevant code to ground your plan in reality.
|
|
22
22
|
|
|
23
|
+
### Delegate Recon and Sub-Decomposition When Useful
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate work that benefits from an isolated context window. Prefer delegation over inline work when:
|
|
26
|
+
|
|
27
|
+
- You'd otherwise read more than ~3 files to understand a subsystem → dispatch the **scout** agent for codebase recon and work from its compressed report.
|
|
28
|
+
- The slice spans multiple subsystems and the decomposition isn't obvious → dispatch the **planner** agent or use the **decompose-into-slices** skill on a focused sub-area, then integrate.
|
|
29
|
+
- You need current external information (library docs, API behavior, recent changes) → dispatch the **researcher** agent.
|
|
30
|
+
|
|
31
|
+
**Do not** dispatch implementation-tier agents (`worker`, `refactorer`, `tester`) from this unit — they would write user source and bypass this unit's write isolation. Implementation belongs in `execute-task`.
|
|
32
|
+
|
|
23
33
|
### Verify Roadmap Assumptions (JIT Reassessment — ADR-003 §4)
|
|
24
34
|
|
|
25
35
|
Before planning this slice, verify that the roadmap's assumptions still hold given prior slice summaries. Check inlined dependency summaries (below) for discovered constraints, changed approaches, or flagged fragility.
|
|
@@ -20,6 +20,16 @@ Pay particular attention to **Forward Intelligence** sections — they contain h
|
|
|
20
20
|
|
|
21
21
|
## Your Role in the Pipeline
|
|
22
22
|
|
|
23
|
+
### Delegate Recon When Useful
|
|
24
|
+
|
|
25
|
+
This unit runs under the `planning-dispatch` tools-policy: you may use the `subagent` tool to delegate recon and sub-decomposition. Prefer delegation over inline work when:
|
|
26
|
+
|
|
27
|
+
- You'd otherwise read more than ~3 files to understand a subsystem touched by the sketch → dispatch the **scout** agent and work from its compressed report.
|
|
28
|
+
- A specific area of the refinement needs deeper architectural analysis → dispatch the **planner** agent for a focused sub-plan, then integrate.
|
|
29
|
+
- You need current external information (library docs, API behavior) → dispatch the **researcher** agent.
|
|
30
|
+
|
|
31
|
+
**Do not** dispatch implementation-tier agents (`worker`, `refactorer`, `tester`) — they would write user source and bypass write isolation. Implementation belongs in `execute-task`.
|
|
32
|
+
|
|
23
33
|
### Respect the Sketch Scope
|
|
24
34
|
|
|
25
35
|
The sketch scope inlined above is a **hard constraint**. Plan within it. If, after exploring the codebase, the scope is too narrow to deliver the goal, surface this as a deviation in the plan's narrative and still produce the plan — do not silently expand the scope.
|
|
@@ -82,6 +82,7 @@ let sliceState: SliceOrchestratorState | null = null;
|
|
|
82
82
|
|
|
83
83
|
const SLICE_ORCHESTRATOR_STATE_FILE = "slice-orchestrator.json";
|
|
84
84
|
const TMP_SUFFIX = ".tmp";
|
|
85
|
+
export const SLICE_WORKER_AUTO_ARGS = ["headless", "--json", "auto"] as const;
|
|
85
86
|
|
|
86
87
|
interface PersistedSliceWorker {
|
|
87
88
|
milestoneId: string;
|
|
@@ -356,7 +357,7 @@ export function getSliceOrchestratorState(): SliceOrchestratorState | null {
|
|
|
356
357
|
/**
|
|
357
358
|
* Start parallel execution for eligible slices within a milestone.
|
|
358
359
|
*
|
|
359
|
-
* For each eligible slice: create a worktree, spawn `gsd --
|
|
360
|
+
* For each eligible slice: create a worktree, spawn `gsd headless --json auto`
|
|
360
361
|
* with env GSD_SLICE_LOCK=<SID> + GSD_MILESTONE_LOCK=<MID> + GSD_PARALLEL_WORKER=1.
|
|
361
362
|
*/
|
|
362
363
|
export async function startSliceParallel(
|
|
@@ -598,8 +599,13 @@ function resolveGsdBin(): string | null {
|
|
|
598
599
|
|
|
599
600
|
/**
|
|
600
601
|
* Spawn a worker process for a slice.
|
|
601
|
-
* The worker runs `gsd --
|
|
602
|
+
* The worker runs `gsd headless --json auto` in the slice's worktree
|
|
602
603
|
* with GSD_SLICE_LOCK, GSD_MILESTONE_LOCK, and GSD_PARALLEL_WORKER set.
|
|
604
|
+
*
|
|
605
|
+
* Print-mode slash commands return after the command handler schedules
|
|
606
|
+
* auto-mode, so the worker process can exit before doing any LLM work. The
|
|
607
|
+
* headless auto entrypoint keeps the process alive until auto-mode reaches a
|
|
608
|
+
* terminal notification, matching milestone-level parallel workers.
|
|
603
609
|
*/
|
|
604
610
|
function spawnSliceWorker(
|
|
605
611
|
basePath: string,
|
|
@@ -616,7 +622,7 @@ function spawnSliceWorker(
|
|
|
616
622
|
|
|
617
623
|
let child: ChildProcess;
|
|
618
624
|
try {
|
|
619
|
-
child = spawn(process.execPath, [binPath,
|
|
625
|
+
child = spawn(process.execPath, [binPath, ...SLICE_WORKER_AUTO_ARGS], {
|
|
620
626
|
cwd: worker.worktreePath,
|
|
621
627
|
env: {
|
|
622
628
|
...process.env,
|
|
@@ -114,6 +114,48 @@ export function isGhostMilestone(basePath: string, mid: string): boolean {
|
|
|
114
114
|
return !context && !draft && !roadmap && !summary;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/**
|
|
118
|
+
* A "reusable ghost" milestone is an orphaned filesystem stub that is safe
|
|
119
|
+
* to reclaim as the next milestone ID.
|
|
120
|
+
*
|
|
121
|
+
* Stricter than `isGhostMilestone`: returns true ONLY when ALL of the
|
|
122
|
+
* following hold:
|
|
123
|
+
* 1. No DB row exists for `mid` (any status, including "queued") — a DB row
|
|
124
|
+
* means the milestone was intentionally registered by
|
|
125
|
+
* `gsd_milestone_generate_id` and may have an in-flight discuss flow.
|
|
126
|
+
* Reusing it would collide with that flow. (#4996 race window)
|
|
127
|
+
* 2. No worktree directory exists at `gsdRoot/worktrees/{mid}` — a worktree
|
|
128
|
+
* means the milestone is legitimately in-flight.
|
|
129
|
+
* 3. No content files exist (CONTEXT, CONTEXT-DRAFT, ROADMAP, SUMMARY) —
|
|
130
|
+
* any content means the discuss flow already ran.
|
|
131
|
+
*
|
|
132
|
+
* The looser `isGhostMilestone` also classifies queued-row-without-content as
|
|
133
|
+
* a ghost to help state queries filter phantoms. `isReusableGhostMilestone`
|
|
134
|
+
* intentionally does NOT reclaim those — a queued row is sufficient proof of
|
|
135
|
+
* a live in-flight ID reservation.
|
|
136
|
+
*
|
|
137
|
+
* Used by `nextMilestoneIdReserved` and both MCP ID-generator tools to fill
|
|
138
|
+
* gaps left by phantom directories before resorting to max+1.
|
|
139
|
+
*/
|
|
140
|
+
export function isReusableGhostMilestone(basePath: string, mid: string): boolean {
|
|
141
|
+
// Condition 1: no DB row (any status).
|
|
142
|
+
if (!isDbAvailable()) return false;
|
|
143
|
+
const dbRow = getMilestone(mid);
|
|
144
|
+
if (dbRow != null) return false;
|
|
145
|
+
|
|
146
|
+
// Condition 2: no worktree.
|
|
147
|
+
const root = gsdRoot(basePath);
|
|
148
|
+
const wtPath = join(root, 'worktrees', mid);
|
|
149
|
+
if (existsSync(wtPath)) return false;
|
|
150
|
+
|
|
151
|
+
// Condition 3: no content files.
|
|
152
|
+
const context = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
153
|
+
const draft = resolveMilestoneFile(basePath, mid, "CONTEXT-DRAFT");
|
|
154
|
+
const roadmap = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
|
155
|
+
const summary = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
156
|
+
return !context && !draft && !roadmap && !summary;
|
|
157
|
+
}
|
|
158
|
+
|
|
117
159
|
// ─── Query Functions ───────────────────────────────────────────────────────
|
|
118
160
|
|
|
119
161
|
/**
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import test, { mock } from "node:test";
|
|
2
2
|
import assert from "node:assert/strict";
|
|
3
|
+
import { mkdtempSync } from "node:fs";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import { join } from "node:path";
|
|
3
6
|
|
|
4
7
|
import {
|
|
5
8
|
resolveAgentEnd,
|
|
@@ -26,6 +29,24 @@ function makeEvent(
|
|
|
26
29
|
return { messages };
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
async function drainMicrotasks(turns = 20): Promise<void> {
|
|
33
|
+
for (let i = 0; i < turns; i++) {
|
|
34
|
+
await Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function waitForMicrotasks(
|
|
39
|
+
condition: () => boolean,
|
|
40
|
+
label: string,
|
|
41
|
+
turns = 500,
|
|
42
|
+
): Promise<void> {
|
|
43
|
+
for (let i = 0; i < turns; i++) {
|
|
44
|
+
if (condition()) return;
|
|
45
|
+
await Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
assert.fail(`Timed out waiting for ${label}`);
|
|
48
|
+
}
|
|
49
|
+
|
|
29
50
|
/**
|
|
30
51
|
* Build a minimal mock AutoSession with controllable newSession behavior.
|
|
31
52
|
*/
|
|
@@ -716,7 +737,7 @@ function makeLoopSession(overrides?: Partial<Record<string, unknown>>) {
|
|
|
716
737
|
verbose: false,
|
|
717
738
|
stepMode: false,
|
|
718
739
|
paused: false,
|
|
719
|
-
basePath: "
|
|
740
|
+
basePath: mkdtempSync(join(tmpdir(), "gsd-auto-loop-")),
|
|
720
741
|
originalBasePath: "",
|
|
721
742
|
currentMilestoneId: "M001",
|
|
722
743
|
currentUnit: null,
|
|
@@ -736,6 +757,7 @@ function makeLoopSession(overrides?: Partial<Record<string, unknown>>) {
|
|
|
736
757
|
unitRecoveryCount: new Map<string, number>(),
|
|
737
758
|
verificationRetryCount: new Map<string, number>(),
|
|
738
759
|
gitService: null,
|
|
760
|
+
lastRequestTimestamp: 0,
|
|
739
761
|
autoStartTime: Date.now(),
|
|
740
762
|
cmdCtx: {
|
|
741
763
|
newSession: () => Promise.resolve({ cancelled: false }),
|
|
@@ -2361,6 +2383,161 @@ test("autoLoop warns but proceeds for greenfield project (no project files) (#18
|
|
|
2361
2383
|
);
|
|
2362
2384
|
});
|
|
2363
2385
|
|
|
2386
|
+
// ── Proactive rate limiting (#2996) ──────────────────────────────────────────
|
|
2387
|
+
|
|
2388
|
+
test("autoLoop enforces min_request_interval_ms delay between LLM dispatches (#2996)", async () => {
|
|
2389
|
+
_resetPendingResolve();
|
|
2390
|
+
mock.timers.enable({ apis: ["Date", "setTimeout"], now: 1_000 });
|
|
2391
|
+
|
|
2392
|
+
try {
|
|
2393
|
+
const ctx = makeMockCtx();
|
|
2394
|
+
ctx.ui.setStatus = () => {};
|
|
2395
|
+
ctx.sessionManager = { getSessionFile: () => "/tmp/session.json" };
|
|
2396
|
+
const pi = makeMockPi();
|
|
2397
|
+
const originalSendMessage = pi.sendMessage;
|
|
2398
|
+
const dispatchTimestamps: number[] = [];
|
|
2399
|
+
pi.sendMessage = (...args: unknown[]) => {
|
|
2400
|
+
dispatchTimestamps.push(Date.now());
|
|
2401
|
+
return originalSendMessage(...args);
|
|
2402
|
+
};
|
|
2403
|
+
|
|
2404
|
+
let iterCount = 0;
|
|
2405
|
+
|
|
2406
|
+
const s = makeLoopSession();
|
|
2407
|
+
|
|
2408
|
+
const deps = makeMockDeps({
|
|
2409
|
+
loadEffectiveGSDPreferences: () => ({
|
|
2410
|
+
preferences: { min_request_interval_ms: 300 },
|
|
2411
|
+
}),
|
|
2412
|
+
deriveState: async () => {
|
|
2413
|
+
iterCount++;
|
|
2414
|
+
deps.callLog.push("deriveState");
|
|
2415
|
+
return {
|
|
2416
|
+
phase: "executing",
|
|
2417
|
+
activeMilestone: { id: "M001", title: "Test", status: "active" },
|
|
2418
|
+
activeSlice: { id: "S01", title: "Slice" },
|
|
2419
|
+
activeTask: { id: "T01" },
|
|
2420
|
+
registry: [{ id: "M001", status: "active" }],
|
|
2421
|
+
blockers: [],
|
|
2422
|
+
} as any;
|
|
2423
|
+
},
|
|
2424
|
+
postUnitPostVerification: async () => {
|
|
2425
|
+
deps.callLog.push("postUnitPostVerification");
|
|
2426
|
+
if (iterCount >= 2) {
|
|
2427
|
+
s.active = false;
|
|
2428
|
+
}
|
|
2429
|
+
return "continue" as const;
|
|
2430
|
+
},
|
|
2431
|
+
});
|
|
2432
|
+
|
|
2433
|
+
const loopPromise = autoLoop(ctx, pi, s, deps);
|
|
2434
|
+
|
|
2435
|
+
await waitForMicrotasks(() => dispatchTimestamps.length === 1, "first dispatch");
|
|
2436
|
+
resolveAgentEnd(makeEvent());
|
|
2437
|
+
await waitForMicrotasks(
|
|
2438
|
+
() => deps.callLog.filter((entry) => entry === "resolveDispatch").length >= 2,
|
|
2439
|
+
"second dispatch planning",
|
|
2440
|
+
);
|
|
2441
|
+
|
|
2442
|
+
await drainMicrotasks(100);
|
|
2443
|
+
mock.timers.tick(299);
|
|
2444
|
+
await drainMicrotasks(100);
|
|
2445
|
+
assert.equal(dispatchTimestamps.length, 1, "second dispatch should wait for the configured interval");
|
|
2446
|
+
|
|
2447
|
+
mock.timers.tick(1);
|
|
2448
|
+
await waitForMicrotasks(() => dispatchTimestamps.length === 2, "second dispatch");
|
|
2449
|
+
resolveAgentEnd(makeEvent());
|
|
2450
|
+
|
|
2451
|
+
await loopPromise;
|
|
2452
|
+
|
|
2453
|
+
assert.ok(iterCount >= 2, `expected at least 2 iterations, got ${iterCount}`);
|
|
2454
|
+
assert.ok(dispatchTimestamps.length >= 2, `expected at least 2 dispatches, got ${dispatchTimestamps.length}`);
|
|
2455
|
+
|
|
2456
|
+
assert.equal(
|
|
2457
|
+
(s as any).lastRequestTimestamp,
|
|
2458
|
+
dispatchTimestamps[1],
|
|
2459
|
+
"lastRequestTimestamp should record the actual dispatch time",
|
|
2460
|
+
);
|
|
2461
|
+
|
|
2462
|
+
const gap = dispatchTimestamps[1]! - dispatchTimestamps[0]!;
|
|
2463
|
+
assert.equal(
|
|
2464
|
+
gap,
|
|
2465
|
+
300,
|
|
2466
|
+
`gap between dispatches should match min_request_interval_ms=300 (got ${gap}ms)`,
|
|
2467
|
+
);
|
|
2468
|
+
} finally {
|
|
2469
|
+
mock.timers.reset();
|
|
2470
|
+
}
|
|
2471
|
+
});
|
|
2472
|
+
|
|
2473
|
+
test("autoLoop skips rate-limit delay when min_request_interval_ms is 0 (default)", async () => {
|
|
2474
|
+
_resetPendingResolve();
|
|
2475
|
+
mock.timers.enable({ apis: ["Date", "setTimeout"], now: 2_000 });
|
|
2476
|
+
|
|
2477
|
+
try {
|
|
2478
|
+
const ctx = makeMockCtx();
|
|
2479
|
+
ctx.ui.setStatus = () => {};
|
|
2480
|
+
ctx.sessionManager = { getSessionFile: () => "/tmp/session.json" };
|
|
2481
|
+
const pi = makeMockPi();
|
|
2482
|
+
const originalSendMessage = pi.sendMessage;
|
|
2483
|
+
const dispatchTimestamps: number[] = [];
|
|
2484
|
+
pi.sendMessage = (...args: unknown[]) => {
|
|
2485
|
+
dispatchTimestamps.push(Date.now());
|
|
2486
|
+
return originalSendMessage(...args);
|
|
2487
|
+
};
|
|
2488
|
+
|
|
2489
|
+
let iterCount = 0;
|
|
2490
|
+
|
|
2491
|
+
const s = makeLoopSession();
|
|
2492
|
+
|
|
2493
|
+
const deps = makeMockDeps({
|
|
2494
|
+
loadEffectiveGSDPreferences: () => ({
|
|
2495
|
+
preferences: {},
|
|
2496
|
+
}),
|
|
2497
|
+
deriveState: async () => {
|
|
2498
|
+
iterCount++;
|
|
2499
|
+
deps.callLog.push("deriveState");
|
|
2500
|
+
return {
|
|
2501
|
+
phase: "executing",
|
|
2502
|
+
activeMilestone: { id: "M001", title: "Test", status: "active" },
|
|
2503
|
+
activeSlice: { id: "S01", title: "Slice" },
|
|
2504
|
+
activeTask: { id: "T01" },
|
|
2505
|
+
registry: [{ id: "M001", status: "active" }],
|
|
2506
|
+
blockers: [],
|
|
2507
|
+
} as any;
|
|
2508
|
+
},
|
|
2509
|
+
postUnitPostVerification: async () => {
|
|
2510
|
+
deps.callLog.push("postUnitPostVerification");
|
|
2511
|
+
if (iterCount >= 3) {
|
|
2512
|
+
s.active = false;
|
|
2513
|
+
}
|
|
2514
|
+
return "continue" as const;
|
|
2515
|
+
},
|
|
2516
|
+
});
|
|
2517
|
+
|
|
2518
|
+
const loopPromise = autoLoop(ctx, pi, s, deps);
|
|
2519
|
+
|
|
2520
|
+
for (let i = 1; i <= 3; i++) {
|
|
2521
|
+
await waitForMicrotasks(() => dispatchTimestamps.length === i, `dispatch ${i}`);
|
|
2522
|
+
resolveAgentEnd(makeEvent());
|
|
2523
|
+
}
|
|
2524
|
+
|
|
2525
|
+
await loopPromise;
|
|
2526
|
+
|
|
2527
|
+
assert.ok(iterCount >= 3, `expected at least 3 iterations, got ${iterCount}`);
|
|
2528
|
+
assert.ok(dispatchTimestamps.length >= 3, `expected at least 3 dispatches, got ${dispatchTimestamps.length}`);
|
|
2529
|
+
|
|
2530
|
+
const gap = dispatchTimestamps[2]! - dispatchTimestamps[1]!;
|
|
2531
|
+
assert.equal(
|
|
2532
|
+
gap,
|
|
2533
|
+
0,
|
|
2534
|
+
`gap should be 0ms under mocked time without rate limiting (got ${gap}ms)`,
|
|
2535
|
+
);
|
|
2536
|
+
} finally {
|
|
2537
|
+
mock.timers.reset();
|
|
2538
|
+
}
|
|
2539
|
+
});
|
|
2540
|
+
|
|
2364
2541
|
// ─── #4850: pre-send model-policy block is non-retryable ────────────────────
|
|
2365
2542
|
test("autoLoop classifies ModelPolicyDispatchBlockedError as blocked, not a retryable error", async () => {
|
|
2366
2543
|
_resetPendingResolve();
|
|
@@ -731,6 +731,64 @@ test("hasImplementationArtifacts uses milestone path history instead of rolling
|
|
|
731
731
|
}
|
|
732
732
|
});
|
|
733
733
|
|
|
734
|
+
test("hasImplementationArtifacts finds implementation commits when .gsd/ is gitignored (#5033)", () => {
|
|
735
|
+
const base = makeGitBase();
|
|
736
|
+
try {
|
|
737
|
+
// Simulate external/untracked .gsd/ via .git/info/exclude — milestone
|
|
738
|
+
// planning artifacts never enter git, but real implementation files do.
|
|
739
|
+
writeFileSync(join(base, ".git", "info", "exclude"), ".gsd/\n");
|
|
740
|
+
mkdirSync(join(base, ".gsd", "milestones", "M001", "slices", "S01", "tasks"), { recursive: true });
|
|
741
|
+
writeFileSync(
|
|
742
|
+
join(base, ".gsd", "milestones", "M001", "slices", "S01", "tasks", "T01-SUMMARY.md"),
|
|
743
|
+
"# Summary",
|
|
744
|
+
);
|
|
745
|
+
|
|
746
|
+
mkdirSync(join(base, "benchmarks", "M001"), { recursive: true });
|
|
747
|
+
writeFileSync(join(base, "benchmarks", "M001", "manifest.yaml"), "cases: []\n");
|
|
748
|
+
|
|
749
|
+
execFileSync("git", ["add", "."], { cwd: base, stdio: "ignore" });
|
|
750
|
+
execFileSync(
|
|
751
|
+
"git",
|
|
752
|
+
["commit", "-m", "feat: materialize M001 evidence\n\nGSD-Task: S01/T01"],
|
|
753
|
+
{ cwd: base, stdio: "ignore" },
|
|
754
|
+
);
|
|
755
|
+
|
|
756
|
+
const result = hasImplementationArtifacts(base, "M001");
|
|
757
|
+
assert.equal(
|
|
758
|
+
result,
|
|
759
|
+
"present",
|
|
760
|
+
"milestone-tagged commit binding must work when .gsd/ is gitignored",
|
|
761
|
+
);
|
|
762
|
+
} finally {
|
|
763
|
+
cleanup(base);
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
test("hasImplementationArtifacts ignores malformed milestone IDs in commit-message fallback", () => {
|
|
768
|
+
const base = makeGitBase();
|
|
769
|
+
try {
|
|
770
|
+
writeFileSync(join(base, ".git", "info", "exclude"), ".gsd/\n");
|
|
771
|
+
mkdirSync(join(base, "src"), { recursive: true });
|
|
772
|
+
writeFileSync(join(base, "src", "feature.ts"), "export function feature() {}\n");
|
|
773
|
+
|
|
774
|
+
execFileSync("git", ["add", "."], { cwd: base, stdio: "ignore" });
|
|
775
|
+
execFileSync(
|
|
776
|
+
"git",
|
|
777
|
+
["commit", "-m", "feat: materialize M001(foo evidence\n\nGSD-Task: S01/T01"],
|
|
778
|
+
{ cwd: base, stdio: "ignore" },
|
|
779
|
+
);
|
|
780
|
+
|
|
781
|
+
const result = hasImplementationArtifacts(base, "M001(");
|
|
782
|
+
assert.equal(
|
|
783
|
+
result,
|
|
784
|
+
"absent",
|
|
785
|
+
"malformed milestone IDs must not bind implementation commits through message scanning",
|
|
786
|
+
);
|
|
787
|
+
} finally {
|
|
788
|
+
cleanup(base);
|
|
789
|
+
}
|
|
790
|
+
});
|
|
791
|
+
|
|
734
792
|
test("hasImplementationArtifacts returns true on non-git directory (fail-open)", () => {
|
|
735
793
|
const base = join(tmpdir(), `gsd-test-nogit-${randomUUID()}`);
|
|
736
794
|
mkdirSync(base, { recursive: true });
|
|
@@ -14,10 +14,12 @@ import assert from "node:assert/strict";
|
|
|
14
14
|
import { readFileSync } from "node:fs";
|
|
15
15
|
import { join, dirname } from "node:path";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { AutoSession } from "../auto/session.ts";
|
|
17
18
|
|
|
18
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
20
|
const AUTO_TS_PATH = join(__dirname, "..", "auto.ts");
|
|
20
21
|
const SESSION_TS_PATH = join(__dirname, "..", "auto", "session.ts");
|
|
22
|
+
const RUNTIME_STATE_TS_PATH = join(__dirname, "..", "auto-runtime-state.ts");
|
|
21
23
|
|
|
22
24
|
function getAutoTsSource(): string {
|
|
23
25
|
return readFileSync(AUTO_TS_PATH, "utf-8");
|
|
@@ -27,6 +29,24 @@ function getSessionTsSource(): string {
|
|
|
27
29
|
return readFileSync(SESSION_TS_PATH, "utf-8");
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
function getRuntimeStateTsSource(): string {
|
|
33
|
+
return readFileSync(RUNTIME_STATE_TS_PATH, "utf-8");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
test("AutoSession.lockBasePath uses GSD_PROJECT_ROOT for symlink-resolved worktrees", () => {
|
|
37
|
+
const savedProjectRoot = process.env.GSD_PROJECT_ROOT;
|
|
38
|
+
process.env.GSD_PROJECT_ROOT = "/real/project";
|
|
39
|
+
try {
|
|
40
|
+
const session = new AutoSession();
|
|
41
|
+
session.basePath = "/Users/dev/.gsd/projects/abc123/worktrees/M001/slices/S01";
|
|
42
|
+
|
|
43
|
+
assert.equal(session.lockBasePath, "/real/project");
|
|
44
|
+
} finally {
|
|
45
|
+
if (savedProjectRoot === undefined) delete process.env.GSD_PROJECT_ROOT;
|
|
46
|
+
else process.env.GSD_PROJECT_ROOT = savedProjectRoot;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
30
50
|
// ── Invariant 1: No module-level mutable variables in auto.ts ────────────────
|
|
31
51
|
|
|
32
52
|
test("auto.ts has no module-level let declarations", () => {
|
|
@@ -75,18 +95,18 @@ test("auto.ts has no module-level var declarations", () => {
|
|
|
75
95
|
|
|
76
96
|
// ── Invariant 2: AutoSession singleton is the only mutable module-level binding ──
|
|
77
97
|
|
|
78
|
-
test("auto.ts has exactly one module-level const for AutoSession", () => {
|
|
79
|
-
const source =
|
|
98
|
+
test("auto-runtime-state.ts has exactly one module-level const for AutoSession", () => {
|
|
99
|
+
const source = getRuntimeStateTsSource();
|
|
80
100
|
const lines = source.split("\n");
|
|
81
101
|
|
|
82
102
|
const sessionConsts = lines.filter(line =>
|
|
83
|
-
/^const\s+\w+\s*=\s*new\s+AutoSession/.test(line),
|
|
103
|
+
/^(export\s+)?const\s+\w+\s*=\s*new\s+AutoSession/.test(line),
|
|
84
104
|
);
|
|
85
105
|
|
|
86
106
|
assert.equal(
|
|
87
107
|
sessionConsts.length,
|
|
88
108
|
1,
|
|
89
|
-
`auto.ts should have exactly one \`const
|
|
109
|
+
`auto-runtime-state.ts should have exactly one \`const autoSession = new AutoSession()\`. ` +
|
|
90
110
|
`Found ${sessionConsts.length}: ${sessionConsts.join(", ")}`,
|
|
91
111
|
);
|
|
92
112
|
});
|
|
@@ -201,7 +221,6 @@ test("auto.ts module-level consts are only AutoSession instance, true constants,
|
|
|
201
221
|
|
|
202
222
|
// Patterns that are acceptable at module level
|
|
203
223
|
const allowedPatterns = [
|
|
204
|
-
/^const s = new AutoSession/, // The session singleton
|
|
205
224
|
/^const [A-Z_]+\s*=/, // UPPER_CASE constants
|
|
206
225
|
/^const \w+StateAccessors/, // Static accessor objects
|
|
207
226
|
/^const \w+:\s*\w+\s*=/, // Typed constants
|
|
@@ -7,10 +7,27 @@ import { writeUnitRuntimeRecord, readUnitRuntimeRecord } from '../unit-runtime.t
|
|
|
7
7
|
import { resolveAutoSupervisorConfig } from '../preferences.ts';
|
|
8
8
|
|
|
9
9
|
test('resolveAutoSupervisorConfig provides safe timeout defaults', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
// Isolate from any developer ~/.gsd/PREFERENCES.md that overrides these
|
|
11
|
+
// defaults — the test pins what resolveAutoSupervisorConfig() returns when
|
|
12
|
+
// no preferences file exists, so it must not pick up the runner's home dir.
|
|
13
|
+
const previousGsdHome = process.env.GSD_HOME;
|
|
14
|
+
const previousCwd = process.cwd();
|
|
15
|
+
const isolated = mkdtempSync(join(tmpdir(), 'gsd-supervisor-defaults-'));
|
|
16
|
+
process.env.GSD_HOME = isolated;
|
|
17
|
+
process.chdir(isolated);
|
|
18
|
+
try {
|
|
19
|
+
const supervisor = resolveAutoSupervisorConfig();
|
|
20
|
+
assert.equal(supervisor.soft_timeout_minutes, 20);
|
|
21
|
+
assert.equal(supervisor.idle_timeout_minutes, 10);
|
|
22
|
+
assert.equal(supervisor.hard_timeout_minutes, 30);
|
|
23
|
+
} finally {
|
|
24
|
+
if (previousGsdHome === undefined) {
|
|
25
|
+
delete process.env.GSD_HOME;
|
|
26
|
+
} else {
|
|
27
|
+
process.env.GSD_HOME = previousGsdHome;
|
|
28
|
+
}
|
|
29
|
+
process.chdir(previousCwd);
|
|
30
|
+
}
|
|
14
31
|
});
|
|
15
32
|
|
|
16
33
|
test('writeUnitRuntimeRecord persists progress and recovery metadata defaults', () => {
|
|
@@ -32,7 +32,7 @@ describe("bootstrap deriveState DB guards (#3844)", () => {
|
|
|
32
32
|
assert.ok(compactIdx > -1, "register-hooks should define session_before_compact");
|
|
33
33
|
const compactSection = extractSourceRegion(registerHooksSrc, 'pi.on("session_before_compact"');
|
|
34
34
|
const ensureIdx = compactSection.indexOf("ensureDbOpen()");
|
|
35
|
-
const deriveIdx = compactSection.indexOf("
|
|
35
|
+
const deriveIdx = compactSection.indexOf("deriveGsdState(basePath)");
|
|
36
36
|
assert.ok(ensureIdx > -1, "session_before_compact should call ensureDbOpen()");
|
|
37
37
|
assert.ok(deriveIdx > -1, "session_before_compact should derive state");
|
|
38
38
|
assert.ok(ensureIdx < deriveIdx, "session_before_compact should open DB before deriveState");
|