@opengsd/gsd-pi 1.8.1 → 1.9.0-dev.5c1a3ff2
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 +10 -8
- package/dist/cli.js +5 -1
- package/dist/headless-events.d.ts +2 -1
- package/dist/headless-events.js +11 -3
- package/dist/headless-milestone-readiness.d.ts +29 -0
- package/dist/headless-milestone-readiness.js +161 -0
- package/dist/headless.js +25 -2
- package/dist/print-mode-exit.d.ts +12 -0
- package/dist/print-mode-exit.js +14 -0
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +18 -49
- package/dist/resources/extensions/browser-tools/capture.js +2 -77
- package/dist/resources/extensions/browser-tools/screenshot-constraints.js +83 -0
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +17 -2
- package/dist/resources/extensions/claude-code-cli/turn-assembler.js +30 -2
- package/dist/resources/extensions/gsd/artifact-verification.js +3 -4
- package/dist/resources/extensions/gsd/auto-artifact-paths.js +16 -10
- package/dist/resources/extensions/gsd/auto-dispatch.js +74 -19
- package/dist/resources/extensions/gsd/auto-post-unit.js +4 -0
- package/dist/resources/extensions/gsd/auto-prompts.js +125 -18
- package/dist/resources/extensions/gsd/auto-recovery.js +10 -5
- package/dist/resources/extensions/gsd/auto-worktree-cleanup.js +4 -0
- package/dist/resources/extensions/gsd/auto-worktree-teardown.js +1 -1
- package/dist/resources/extensions/gsd/auto.js +5 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +80 -4
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +31 -5
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +10 -3
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +88 -50
- package/dist/resources/extensions/gsd/command-feedback.js +16 -12
- package/dist/resources/extensions/gsd/compat/compat-marker.js +19 -2
- package/dist/resources/extensions/gsd/constants.js +12 -13
- package/dist/resources/extensions/gsd/context-masker.js +97 -21
- package/dist/resources/extensions/gsd/db/command-queue.js +7 -2
- package/dist/resources/extensions/gsd/db/engine.js +51 -16
- package/dist/resources/extensions/gsd/db/writers/cascades.js +5 -1
- package/dist/resources/extensions/gsd/db/writers/status.js +13 -3
- package/dist/resources/extensions/gsd/db-base-schema.js +28 -0
- package/dist/resources/extensions/gsd/db-migration-steps.js +30 -0
- package/dist/resources/extensions/gsd/db-schema-metadata.js +4 -1
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +26 -4
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +3 -6
- package/dist/resources/extensions/gsd/flat-phase-migration.js +156 -21
- package/dist/resources/extensions/gsd/git-service.js +19 -7
- package/dist/resources/extensions/gsd/gsd-db.js +187 -45
- package/dist/resources/extensions/gsd/guided-flow.js +38 -13
- package/dist/resources/extensions/gsd/markdown-renderer.js +17 -13
- package/dist/resources/extensions/gsd/md-importer.js +107 -20
- package/dist/resources/extensions/gsd/migrate/command.js +19 -162
- package/dist/resources/extensions/gsd/migrate/execution.js +98 -0
- package/dist/resources/extensions/gsd/migrate/plan.js +49 -0
- package/dist/resources/extensions/gsd/migrate/planning-writer.js +12 -17
- package/dist/resources/extensions/gsd/migrate/presentation.js +64 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +2 -0
- package/dist/resources/extensions/gsd/model-router.js +11 -0
- package/dist/resources/extensions/gsd/parallel-eligibility.js +5 -4
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +28 -43
- package/dist/resources/extensions/gsd/paths.js +55 -11
- package/dist/resources/extensions/gsd/phase-anchor.js +7 -2
- package/dist/resources/extensions/gsd/planning-subagent-policy.js +37 -0
- package/dist/resources/extensions/gsd/planning-subagent-registry.js +25 -0
- package/dist/resources/extensions/gsd/post-execution-checks.js +4 -4
- package/dist/resources/extensions/gsd/preferences-types.js +5 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +48 -1
- package/dist/resources/extensions/gsd/preferences.js +17 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/provider-payload-policy.js +16 -5
- package/dist/resources/extensions/gsd/safety/destructive-guard.js +1 -1
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +26 -1
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +30 -5
- package/dist/resources/extensions/gsd/skill-activation.js +17 -3
- package/dist/resources/extensions/gsd/state-reconciliation/drift/external-markdown-edit.js +27 -13
- package/dist/resources/extensions/gsd/state-reconciliation/drift/external-planning-edit.js +13 -3
- package/dist/resources/extensions/gsd/stop-notice.js +15 -1
- package/dist/resources/extensions/gsd/sync-lock.js +13 -7
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +5 -0
- package/dist/resources/extensions/gsd/tools/complete-task.js +94 -6
- package/dist/resources/extensions/gsd/tools/plan-task.js +13 -15
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +18 -15
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +14 -5
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +15 -5
- package/dist/resources/extensions/gsd/tools/reopen-task.js +16 -10
- package/dist/resources/extensions/gsd/tools/replan-task.js +128 -0
- package/dist/resources/extensions/gsd/tools/rework-brief.js +74 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +81 -0
- package/dist/resources/extensions/gsd/unit-context-composer.js +28 -5
- package/dist/resources/extensions/gsd/unit-registry.js +4 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +19 -3
- package/dist/resources/extensions/gsd/workflow-projections.js +2 -3
- package/dist/resources/extensions/gsd/workspace.js +2 -1
- package/dist/resources/extensions/gsd/worktree-state-projection.js +6 -0
- package/dist/resources/extensions/mac-tools/index.js +31 -9
- 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 +8 -8
- 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/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 +4 -4
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +4 -4
- 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 +4 -4
- 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/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/mcp-connections/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/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 +2 -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 +1 -1
- 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 +1 -1
- 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 +5 -5
- 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 +5 -5
- 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 +4 -4
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- 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 +8 -8
- package/dist/web/standalone/.next/server/chunks/2842.js +4 -4
- package/dist/web/standalone/.next/server/chunks/8357.js +3 -3
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware.js +3 -3
- 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/app/_not-found/page-a6fb1847f67f167c.js +1 -0
- package/dist/web/standalone/.next/static/chunks/app/{layout-b35cbfff38aaf4cf.js → layout-4ae2d68984392bbf.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/app/page-72a856634ad14c10.js +1 -0
- package/dist/web/standalone/.next/static/chunks/{main-app-590a74400e35f685.js → main-app-90d1d8d5e5d2dc6b.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-1115d46ac61b9823.js +1 -0
- package/dist/web/standalone/.next/static/css/3b1ceb7abfb9a230.css +1 -0
- package/dist/web/standalone/node_modules/@gsd/native/package.json +1 -1
- 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/package.json +0 -1
- package/dist/web/standalone/server.js +1 -1
- package/dist/web-mode.js +31 -3
- package/integrations/hermes/open_gsd_hermes/gsd_client.py +1 -1
- package/integrations/hermes/pyproject.toml +1 -1
- package/package.json +12 -10
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/workflow.d.ts +14 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js +16 -0
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/dist/cloud-config.d.ts +1 -1
- package/packages/daemon/dist/cloud-config.d.ts.map +1 -1
- package/packages/daemon/dist/cloud-config.js +5 -1
- package/packages/daemon/dist/cloud-config.js.map +1 -1
- package/packages/daemon/dist/cloud-config.test.js +51 -1
- package/packages/daemon/dist/cloud-config.test.js.map +1 -1
- package/packages/daemon/dist/local-tool-executor.d.ts.map +1 -1
- package/packages/daemon/dist/local-tool-executor.js +2 -0
- package/packages/daemon/dist/local-tool-executor.js.map +1 -1
- package/packages/daemon/package.json +6 -6
- package/packages/gsd-agent-core/dist/compaction/compaction.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/compaction/compaction.js +36 -4
- package/packages/gsd-agent-core/dist/compaction/compaction.js.map +1 -1
- package/packages/gsd-agent-core/dist/sdk.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/sdk.js +1 -0
- package/packages/gsd-agent-core/dist/sdk.js.map +1 -1
- package/packages/gsd-agent-core/package.json +5 -5
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/gsd-cloud/dist/cli.d.ts +5 -0
- package/packages/gsd-cloud/dist/cli.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cli.js +160 -0
- package/packages/gsd-cloud/dist/cli.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-config.d.ts +19 -0
- package/packages/gsd-cloud/dist/cloud-config.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-config.js +231 -0
- package/packages/gsd-cloud/dist/cloud-config.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-config.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/cloud-config.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-config.test.js +118 -0
- package/packages/gsd-cloud/dist/cloud-config.test.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.js +37 -0
- package/packages/gsd-cloud/dist/cloud-gateway-lookup.test.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-runtime.d.ts +35 -0
- package/packages/gsd-cloud/dist/cloud-runtime.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-runtime.js +258 -0
- package/packages/gsd-cloud/dist/cloud-runtime.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-runtime.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/cloud-runtime.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-runtime.test.js +88 -0
- package/packages/gsd-cloud/dist/cloud-runtime.test.js.map +1 -0
- package/packages/gsd-cloud/dist/cloud-token.d.ts +3 -0
- package/packages/gsd-cloud/dist/cloud-token.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/cloud-token.js +37 -0
- package/packages/gsd-cloud/dist/cloud-token.js.map +1 -0
- package/packages/gsd-cloud/dist/config.d.ts +17 -0
- package/packages/gsd-cloud/dist/config.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/config.js +146 -0
- package/packages/gsd-cloud/dist/config.js.map +1 -0
- package/packages/gsd-cloud/dist/device-flow.d.ts +24 -0
- package/packages/gsd-cloud/dist/device-flow.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/device-flow.js +128 -0
- package/packages/gsd-cloud/dist/device-flow.js.map +1 -0
- package/packages/gsd-cloud/dist/device-flow.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/device-flow.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/device-flow.test.js +155 -0
- package/packages/gsd-cloud/dist/device-flow.test.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/claude-executor.d.ts +6 -0
- package/packages/gsd-cloud/dist/executors/claude-executor.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/claude-executor.js +15 -0
- package/packages/gsd-cloud/dist/executors/claude-executor.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/codex-executor.d.ts +6 -0
- package/packages/gsd-cloud/dist/executors/codex-executor.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/codex-executor.js +15 -0
- package/packages/gsd-cloud/dist/executors/codex-executor.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/executor.d.ts +28 -0
- package/packages/gsd-cloud/dist/executors/executor.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/executor.js +11 -0
- package/packages/gsd-cloud/dist/executors/executor.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.d.ts +34 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.js +179 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.js +44 -0
- package/packages/gsd-cloud/dist/executors/gsd-pi-executor.test.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/index.d.ts +17 -0
- package/packages/gsd-cloud/dist/executors/index.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/index.js +29 -0
- package/packages/gsd-cloud/dist/executors/index.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.d.ts +36 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.js +176 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.js.map +1 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.js +34 -0
- package/packages/gsd-cloud/dist/executors/mcp-stdio-client.test.js.map +1 -0
- package/packages/gsd-cloud/dist/index.d.ts +7 -0
- package/packages/gsd-cloud/dist/index.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/index.js +8 -0
- package/packages/gsd-cloud/dist/index.js.map +1 -0
- package/packages/gsd-cloud/dist/inject-gateway.d.ts +16 -0
- package/packages/gsd-cloud/dist/inject-gateway.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/inject-gateway.js +29 -0
- package/packages/gsd-cloud/dist/inject-gateway.js.map +1 -0
- package/packages/gsd-cloud/dist/inject-gateway.test.d.ts +2 -0
- package/packages/gsd-cloud/dist/inject-gateway.test.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/inject-gateway.test.js +41 -0
- package/packages/gsd-cloud/dist/inject-gateway.test.js.map +1 -0
- package/packages/gsd-cloud/dist/logger.d.ts +25 -0
- package/packages/gsd-cloud/dist/logger.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/logger.js +72 -0
- package/packages/gsd-cloud/dist/logger.js.map +1 -0
- package/packages/gsd-cloud/dist/types.d.ts +51 -0
- package/packages/gsd-cloud/dist/types.d.ts.map +1 -0
- package/packages/gsd-cloud/dist/types.js +9 -0
- package/packages/gsd-cloud/dist/types.js.map +1 -0
- package/packages/gsd-cloud/package.json +3 -3
- package/packages/mcp-server/README.md +15 -2
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +5 -5
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +4 -3
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +64 -2
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +4 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent.d.ts +5 -1
- package/packages/pi-agent-core/dist/agent.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/agent.js +2 -0
- package/packages/pi-agent-core/dist/agent.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +119 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +107 -0
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +25 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js +1 -1
- package/packages/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js +1 -1
- package/packages/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js +1 -1
- package/packages/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +11 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +8 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +18 -49
- package/src/resources/extensions/browser-tools/capture.ts +2 -86
- package/src/resources/extensions/browser-tools/screenshot-constraints.ts +94 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +18 -1
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +108 -0
- package/src/resources/extensions/claude-code-cli/turn-assembler.ts +30 -2
- package/src/resources/extensions/gsd/artifact-verification.ts +3 -8
- package/src/resources/extensions/gsd/auto-artifact-paths.ts +16 -9
- package/src/resources/extensions/gsd/auto-dispatch.ts +86 -19
- package/src/resources/extensions/gsd/auto-post-unit.ts +4 -0
- package/src/resources/extensions/gsd/auto-prompts.ts +142 -16
- package/src/resources/extensions/gsd/auto-recovery.ts +10 -8
- package/src/resources/extensions/gsd/auto-worktree-cleanup.ts +4 -0
- package/src/resources/extensions/gsd/auto-worktree-teardown.ts +1 -1
- package/src/resources/extensions/gsd/auto.ts +5 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +92 -4
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +39 -10
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +11 -3
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +87 -53
- package/src/resources/extensions/gsd/command-feedback.ts +19 -12
- package/src/resources/extensions/gsd/compat/compat-marker.ts +21 -4
- package/src/resources/extensions/gsd/constants.ts +14 -13
- package/src/resources/extensions/gsd/context-masker.ts +98 -2
- package/src/resources/extensions/gsd/db/command-queue.ts +7 -1
- package/src/resources/extensions/gsd/db/engine.ts +53 -17
- package/src/resources/extensions/gsd/db/writers/cascades.ts +5 -1
- package/src/resources/extensions/gsd/db/writers/status.ts +25 -8
- package/src/resources/extensions/gsd/db-base-schema.ts +30 -0
- package/src/resources/extensions/gsd/db-migration-steps.ts +32 -0
- package/src/resources/extensions/gsd/db-schema-metadata.ts +4 -1
- package/src/resources/extensions/gsd/docs/preferences-reference.md +26 -4
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +3 -5
- package/src/resources/extensions/gsd/flat-phase-migration.ts +160 -19
- package/src/resources/extensions/gsd/git-service.ts +19 -6
- package/src/resources/extensions/gsd/gsd-db.ts +255 -52
- package/src/resources/extensions/gsd/guided-flow.ts +48 -12
- package/src/resources/extensions/gsd/markdown-renderer.ts +25 -21
- package/src/resources/extensions/gsd/md-importer.ts +114 -16
- package/src/resources/extensions/gsd/migrate/command.ts +21 -227
- package/src/resources/extensions/gsd/migrate/execution.ts +136 -0
- package/src/resources/extensions/gsd/migrate/plan.ts +101 -0
- package/src/resources/extensions/gsd/migrate/planning-writer.ts +12 -20
- package/src/resources/extensions/gsd/migrate/presentation.ts +83 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +2 -0
- package/src/resources/extensions/gsd/model-router.ts +12 -0
- package/src/resources/extensions/gsd/parallel-eligibility.ts +5 -4
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +37 -40
- package/src/resources/extensions/gsd/paths.ts +62 -11
- package/src/resources/extensions/gsd/phase-anchor.ts +8 -2
- package/src/resources/extensions/gsd/planning-subagent-policy.ts +58 -0
- package/src/resources/extensions/gsd/planning-subagent-registry.ts +31 -0
- package/src/resources/extensions/gsd/post-execution-checks.ts +4 -4
- package/src/resources/extensions/gsd/preferences-types.ts +16 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +62 -0
- package/src/resources/extensions/gsd/preferences.ts +25 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/provider-payload-policy.ts +18 -4
- package/src/resources/extensions/gsd/safety/destructive-guard.ts +1 -1
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +28 -1
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +31 -5
- package/src/resources/extensions/gsd/skill-activation.ts +17 -3
- package/src/resources/extensions/gsd/state-reconciliation/drift/external-markdown-edit.ts +30 -13
- package/src/resources/extensions/gsd/state-reconciliation/drift/external-planning-edit.ts +16 -3
- package/src/resources/extensions/gsd/state-reconciliation/types.ts +2 -2
- package/src/resources/extensions/gsd/stop-notice.ts +18 -1
- package/src/resources/extensions/gsd/sync-lock.ts +14 -6
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +5 -0
- package/src/resources/extensions/gsd/tests/auto-artifact-paths.test.ts +7 -7
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/before-provider-context-management.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/closeout-git-deferral.test.ts +96 -1
- package/src/resources/extensions/gsd/tests/command-feedback.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/compat-marker.test.ts +104 -0
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +362 -1
- package/src/resources/extensions/gsd/tests/context-masker.test.ts +204 -8
- package/src/resources/extensions/gsd/tests/db-engine-migrate-guards.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/db-tools-alias-suppression.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/destructive-confirmation.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/destructive-guard.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/discuss-routing-fixes.test.ts +123 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/dispatch-rule-coverage.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/evidence-cross-ref.test.ts +81 -0
- package/src/resources/extensions/gsd/tests/evidence-xref-gsd-exec.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/external-edit-scoped-import.test.ts +262 -0
- package/src/resources/extensions/gsd/tests/flat-phase-migration.test.ts +202 -0
- package/src/resources/extensions/gsd/tests/gate-storage.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/import-slice-milestone-completion-preserve.test.ts +116 -0
- package/src/resources/extensions/gsd/tests/integration/paths.test.ts +22 -4
- package/src/resources/extensions/gsd/tests/integration-branch-meta-location.test.ts +62 -0
- package/src/resources/extensions/gsd/tests/markdown-renderer.test.ts +5 -5
- package/src/resources/extensions/gsd/tests/migrate-plan.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/migrate-presentation.test.ts +98 -0
- package/src/resources/extensions/gsd/tests/migrate-safety-audit.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/milestone-leases.test.ts +55 -0
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +9 -1
- package/src/resources/extensions/gsd/tests/model-router.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/parallel-eligibility-file-overlap.test.ts +146 -0
- package/src/resources/extensions/gsd/tests/parallel-monitor-overlay.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +7 -5
- package/src/resources/extensions/gsd/tests/phase-anchor.test.ts +32 -4
- package/src/resources/extensions/gsd/tests/plan-task.test.ts +26 -23
- package/src/resources/extensions/gsd/tests/planning-writer.test.ts +29 -0
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/preferences.test.ts +84 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/reactive-executor.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/reassess-handler.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/replan-task-handler.test.ts +103 -0
- package/src/resources/extensions/gsd/tests/rework-brief.test.ts +197 -0
- package/src/resources/extensions/gsd/tests/service-tier.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/single-writer-v3-tool-surface.test.ts +33 -7
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +20 -16
- package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/stop-notice.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/sync-lock.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/system-context-message-routing.test.ts +13 -7
- package/src/resources/extensions/gsd/tests/tool-naming.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +93 -1
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/workflow-migration-gates.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/workflow-projections.test.ts +4 -4
- package/src/resources/extensions/gsd/tests/worktree-state-projection.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/write-gate-planning-unit.test.ts +34 -0
- package/src/resources/extensions/gsd/tests/write-gate-seam.test.ts +52 -0
- package/src/resources/extensions/gsd/tools/complete-task.ts +140 -5
- package/src/resources/extensions/gsd/tools/plan-task.ts +14 -16
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +18 -17
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +24 -5
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +25 -5
- package/src/resources/extensions/gsd/tools/reopen-task.ts +23 -9
- package/src/resources/extensions/gsd/tools/replan-task.ts +160 -0
- package/src/resources/extensions/gsd/tools/rework-brief.ts +91 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +92 -0
- package/src/resources/extensions/gsd/types.ts +11 -0
- package/src/resources/extensions/gsd/unit-context-composer.ts +34 -8
- package/src/resources/extensions/gsd/unit-registry.ts +4 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +20 -3
- package/src/resources/extensions/gsd/workflow-projections.ts +2 -3
- package/src/resources/extensions/gsd/workspace.ts +2 -1
- package/src/resources/extensions/gsd/worktree-state-projection.ts +12 -0
- package/src/resources/extensions/mac-tools/index.ts +52 -9
- package/src/resources/extensions/mac-tools/tests/mac-screenshot-payload.test.cjs +70 -0
- package/dist/web/standalone/.next/static/chunks/app/_not-found/page-49f565245e1e4afe.js +0 -1
- package/dist/web/standalone/.next/static/chunks/app/page-bc4c723c6a19c6f0.js +0 -1
- package/dist/web/standalone/.next/static/chunks/next/dist/client/components/builtin/global-error-ec3eaffc9785ba48.js +0 -1
- package/dist/web/standalone/.next/static/css/18c2fdf261bfc1b7.css +0 -1
- /package/dist/web/standalone/.next/static/{UaXRrOYxBpG9QBINKhZkg → 6YWV7VAPg-jqjfPswrKZb}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{UaXRrOYxBpG9QBINKhZkg → 6YWV7VAPg-jqjfPswrKZb}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { existsSync, unlinkSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import {
|
|
2
|
+
import { join, relative } from "node:path";
|
|
3
|
+
import { gsdProjectionRoot, gsdRoot, resolveMilestoneFile, resolveMilestonePath, targetMilestoneFile } from "../paths.js";
|
|
4
4
|
import { clearParseCache } from "../files.js";
|
|
5
5
|
import { isClosedStatus } from "../status-guards.js";
|
|
6
6
|
import { isNonEmptyString } from "../validation.js";
|
|
@@ -11,6 +11,14 @@ import { flushWorkflowProjections } from "../projection-flush.js";
|
|
|
11
11
|
import { writeManifest } from "../workflow-manifest.js";
|
|
12
12
|
import { appendEvent } from "../workflow-events.js";
|
|
13
13
|
import { logWarning } from "../workflow-logger.js";
|
|
14
|
+
function assessmentDbPathForRenderedFile(basePath, absPath) {
|
|
15
|
+
const projectionRoot = gsdProjectionRoot(basePath);
|
|
16
|
+
const projectionRel = relative(projectionRoot, absPath);
|
|
17
|
+
const root = projectionRel && !projectionRel.startsWith("..") && !projectionRel.startsWith("/")
|
|
18
|
+
? projectionRoot
|
|
19
|
+
: gsdRoot(basePath);
|
|
20
|
+
return `.gsd/${relative(root, absPath).replace(/\\/g, "/")}`;
|
|
21
|
+
}
|
|
14
22
|
function validateParams(params) {
|
|
15
23
|
if (!isNonEmptyString(params?.milestoneId))
|
|
16
24
|
throw new Error("milestoneId is required");
|
|
@@ -74,10 +82,6 @@ export async function handleReassessRoadmap(rawParams, basePath) {
|
|
|
74
82
|
catch (err) {
|
|
75
83
|
return { error: `validation failed: ${err.message}` };
|
|
76
84
|
}
|
|
77
|
-
// ── Compute assessment artifact path ──────────────────────────────
|
|
78
|
-
// Assessment lives in the completed slice's directory.
|
|
79
|
-
// Use relSliceFile so the path is layout-aware (flat-phase or legacy).
|
|
80
|
-
const assessmentRelPath = relSliceFile(basePath, params.milestoneId, params.completedSliceId, "ASSESSMENT");
|
|
81
85
|
// ── Guards + DB writes inside a single transaction (prevents TOCTOU) ───
|
|
82
86
|
// Guards must be inside the transaction so the state they check cannot
|
|
83
87
|
// change between the read and the write (#2723).
|
|
@@ -152,15 +156,6 @@ export async function handleReassessRoadmap(rawParams, basePath) {
|
|
|
152
156
|
}
|
|
153
157
|
}
|
|
154
158
|
}
|
|
155
|
-
// Record assessment
|
|
156
|
-
insertAssessment({
|
|
157
|
-
path: assessmentRelPath,
|
|
158
|
-
milestoneId: params.milestoneId,
|
|
159
|
-
sliceId: params.completedSliceId,
|
|
160
|
-
status: params.verdict,
|
|
161
|
-
scope: "roadmap",
|
|
162
|
-
fullContent: params.assessment,
|
|
163
|
-
});
|
|
164
159
|
// Apply slice modifications
|
|
165
160
|
for (const mod of params.sliceChanges.modified) {
|
|
166
161
|
updateSliceFields(params.milestoneId, mod.sliceId, {
|
|
@@ -220,6 +215,14 @@ export async function handleReassessRoadmap(rawParams, basePath) {
|
|
|
220
215
|
assessment: params.assessment,
|
|
221
216
|
completedSliceId: params.completedSliceId,
|
|
222
217
|
});
|
|
218
|
+
insertAssessment({
|
|
219
|
+
path: assessmentDbPathForRenderedFile(basePath, assessmentResult.assessmentPath),
|
|
220
|
+
milestoneId: params.milestoneId,
|
|
221
|
+
sliceId: params.completedSliceId,
|
|
222
|
+
status: params.verdict,
|
|
223
|
+
scope: "roadmap",
|
|
224
|
+
fullContent: params.assessment,
|
|
225
|
+
});
|
|
223
226
|
// ── Remove stale VALIDATION file from disk (#2957) ────────────
|
|
224
227
|
const hasStructuralChanges = params.sliceChanges.added.length > 0 ||
|
|
225
228
|
params.sliceChanges.modified.length > 0 ||
|
|
@@ -16,7 +16,7 @@ import { logWarning } from "../workflow-logger.js";
|
|
|
16
16
|
import { debugLog } from "../debug-logger.js";
|
|
17
17
|
import { existsSync, unlinkSync } from "node:fs";
|
|
18
18
|
import { join } from "node:path";
|
|
19
|
-
import { resolveMilestonePath, resolveSlicePath, resolveTasksDir, clearPathCache } from "../paths.js";
|
|
19
|
+
import { buildFlatTaskFileName, buildTaskFileName, legacyMilestonesDir, resolveMilestonePath, resolveSlicePath, resolveTasksDir, clearPathCache, } from "../paths.js";
|
|
20
20
|
export async function handleReopenMilestone(params, basePath) {
|
|
21
21
|
// ── Validate required fields ────────────────────────────────────────────
|
|
22
22
|
if (!params.milestoneId || typeof params.milestoneId !== "string" || params.milestoneId.trim() === "") {
|
|
@@ -41,6 +41,8 @@ export async function handleReopenMilestone(params, basePath) {
|
|
|
41
41
|
// auto-corrects entities back to "complete", making reopen a no-op (#3161).
|
|
42
42
|
try {
|
|
43
43
|
const milestoneDir = resolveMilestonePath(basePath, params.milestoneId);
|
|
44
|
+
const legacyBase = legacyMilestonesDir(basePath);
|
|
45
|
+
const isLegacy = !!milestoneDir && (milestoneDir.startsWith(legacyBase + "/") || milestoneDir.startsWith(legacyBase + "\\"));
|
|
44
46
|
if (milestoneDir) {
|
|
45
47
|
const milestoneSummary = join(milestoneDir, `${params.milestoneId}-SUMMARY.md`);
|
|
46
48
|
if (existsSync(milestoneSummary))
|
|
@@ -58,10 +60,17 @@ export async function handleReopenMilestone(params, basePath) {
|
|
|
58
60
|
unlinkSync(sliceUat);
|
|
59
61
|
}
|
|
60
62
|
const tasksDir = resolveTasksDir(basePath, params.milestoneId, slice.id);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
const tasks = getSliceTasks(params.milestoneId, slice.id);
|
|
64
|
+
for (const task of tasks) {
|
|
65
|
+
const taskSummaries = isLegacy
|
|
66
|
+
? (tasksDir ? [join(tasksDir, buildTaskFileName(task.id, "SUMMARY"))] : [])
|
|
67
|
+
: milestoneDir
|
|
68
|
+
? [
|
|
69
|
+
join(milestoneDir, buildFlatTaskFileName(slice.id, task.id, "SUMMARY")),
|
|
70
|
+
join(milestoneDir, buildTaskFileName(task.id, "SUMMARY")),
|
|
71
|
+
]
|
|
72
|
+
: [];
|
|
73
|
+
for (const taskSummary of taskSummaries) {
|
|
65
74
|
if (existsSync(taskSummary))
|
|
66
75
|
unlinkSync(taskSummary);
|
|
67
76
|
}
|
|
@@ -22,7 +22,7 @@ import { appendEvent } from "../workflow-events.js";
|
|
|
22
22
|
import { logWarning } from "../workflow-logger.js";
|
|
23
23
|
import { existsSync, unlinkSync } from "node:fs";
|
|
24
24
|
import { join } from "node:path";
|
|
25
|
-
import { resolveTasksDir, resolveSlicePath, clearPathCache } from "../paths.js";
|
|
25
|
+
import { buildFlatTaskFileName, buildTaskFileName, legacyMilestonesDir, resolveMilestonePath, resolveTasksDir, resolveSlicePath, clearPathCache, } from "../paths.js";
|
|
26
26
|
export async function handleReopenSlice(params, basePath) {
|
|
27
27
|
// ── Validate required fields ────────────────────────────────────────────
|
|
28
28
|
if (!params.sliceId || typeof params.sliceId !== "string" || params.sliceId.trim() === "") {
|
|
@@ -52,11 +52,21 @@ export async function handleReopenSlice(params, basePath) {
|
|
|
52
52
|
// Without this, the DB-filesystem reconciler sees SUMMARY.md files and
|
|
53
53
|
// auto-corrects tasks back to "complete", making reopen a no-op (#3161).
|
|
54
54
|
try {
|
|
55
|
+
const milestoneDir = resolveMilestonePath(basePath, params.milestoneId);
|
|
56
|
+
const legacyBase = legacyMilestonesDir(basePath);
|
|
57
|
+
const isLegacy = !!milestoneDir && (milestoneDir.startsWith(legacyBase + "/") || milestoneDir.startsWith(legacyBase + "\\"));
|
|
55
58
|
const tasksDir = resolveTasksDir(basePath, params.milestoneId, params.sliceId);
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const tasks = getSliceTasks(params.milestoneId, params.sliceId);
|
|
60
|
+
for (const task of tasks) {
|
|
61
|
+
const summaryPaths = isLegacy
|
|
62
|
+
? (tasksDir ? [join(tasksDir, buildTaskFileName(task.id, "SUMMARY"))] : [])
|
|
63
|
+
: milestoneDir
|
|
64
|
+
? [
|
|
65
|
+
join(milestoneDir, buildFlatTaskFileName(params.sliceId, task.id, "SUMMARY")),
|
|
66
|
+
join(milestoneDir, buildTaskFileName(task.id, "SUMMARY")),
|
|
67
|
+
]
|
|
68
|
+
: [];
|
|
69
|
+
for (const summaryPath of summaryPaths) {
|
|
60
70
|
if (existsSync(summaryPath))
|
|
61
71
|
unlinkSync(summaryPath);
|
|
62
72
|
}
|
|
@@ -17,8 +17,8 @@ import { appendEvent } from "../workflow-events.js";
|
|
|
17
17
|
import { logWarning } from "../workflow-logger.js";
|
|
18
18
|
import { writeReopenReason } from "../reopen-reason.js";
|
|
19
19
|
import { existsSync, unlinkSync } from "node:fs";
|
|
20
|
-
import { join
|
|
21
|
-
import { resolveTasksDir, resolveSlicePath, clearPathCache } from "../paths.js";
|
|
20
|
+
import { join } from "node:path";
|
|
21
|
+
import { buildFlatTaskFileName, buildTaskFileName, legacyMilestonesDir, resolveMilestonePath, resolveTasksDir, resolveSlicePath, clearPathCache, } from "../paths.js";
|
|
22
22
|
export async function handleReopenTask(params, basePath) {
|
|
23
23
|
// ── Validate required fields ────────────────────────────────────────────
|
|
24
24
|
if (!params.taskId || typeof params.taskId !== "string" || params.taskId.trim() === "") {
|
|
@@ -76,14 +76,20 @@ export async function handleReopenTask(params, basePath) {
|
|
|
76
76
|
// summary cleanup into tasks/ (#1208).
|
|
77
77
|
try {
|
|
78
78
|
const slicePath = resolveSlicePath(basePath, params.milestoneId, params.sliceId);
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
const milestonePath = resolveMilestonePath(basePath, params.milestoneId);
|
|
80
|
+
if (milestonePath) {
|
|
81
|
+
const legacyBase = legacyMilestonesDir(basePath);
|
|
82
|
+
const isLegacy = milestonePath.startsWith(legacyBase + "/") || milestonePath.startsWith(legacyBase + "\\");
|
|
83
|
+
const summaryPaths = isLegacy
|
|
84
|
+
? [join(resolveTasksDir(basePath, params.milestoneId, params.sliceId) ?? slicePath ?? join(milestonePath, "slices", params.sliceId, "tasks"), buildTaskFileName(params.taskId, "SUMMARY"))]
|
|
85
|
+
: [
|
|
86
|
+
join(milestonePath, buildFlatTaskFileName(params.sliceId, params.taskId, "SUMMARY")),
|
|
87
|
+
join(milestonePath, buildTaskFileName(params.taskId, "SUMMARY")),
|
|
88
|
+
];
|
|
89
|
+
for (const summaryPath of summaryPaths) {
|
|
90
|
+
if (existsSync(summaryPath))
|
|
91
|
+
unlinkSync(summaryPath);
|
|
92
|
+
}
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
catch (cleanupErr) {
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { clearParseCache } from "../files.js";
|
|
2
|
+
import { getSlice, getTask, insertReplanHistory, transaction, upsertTaskPlanning, } from "../gsd-db.js";
|
|
3
|
+
import { invalidateStateCache } from "../state.js";
|
|
4
|
+
import { isClosedStatus } from "../status-guards.js";
|
|
5
|
+
import { isNonEmptyString, validateStringArray } from "../validation.js";
|
|
6
|
+
import { renderPlanFromDb, renderTaskPlanFromDb } from "../markdown-renderer.js";
|
|
7
|
+
import { resolveMilestonePath, resolveSlicePath } from "../paths.js";
|
|
8
|
+
import { flushWorkflowProjections } from "../projection-flush.js";
|
|
9
|
+
import { writeManifest } from "../workflow-manifest.js";
|
|
10
|
+
import { appendEvent } from "../workflow-events.js";
|
|
11
|
+
import { logWarning } from "../workflow-logger.js";
|
|
12
|
+
function validateParams(params) {
|
|
13
|
+
if (!isNonEmptyString(params?.milestoneId))
|
|
14
|
+
throw new Error("milestoneId is required");
|
|
15
|
+
if (!isNonEmptyString(params?.sliceId))
|
|
16
|
+
throw new Error("sliceId is required");
|
|
17
|
+
if (!isNonEmptyString(params?.taskId))
|
|
18
|
+
throw new Error("taskId is required");
|
|
19
|
+
if (!isNonEmptyString(params?.title))
|
|
20
|
+
throw new Error("title is required");
|
|
21
|
+
if (!isNonEmptyString(params?.description))
|
|
22
|
+
throw new Error("description is required");
|
|
23
|
+
if (!isNonEmptyString(params?.estimate))
|
|
24
|
+
throw new Error("estimate is required");
|
|
25
|
+
if (!isNonEmptyString(params?.verify))
|
|
26
|
+
throw new Error("verify is required");
|
|
27
|
+
return {
|
|
28
|
+
...params,
|
|
29
|
+
files: validateStringArray(params.files, "files"),
|
|
30
|
+
inputs: validateStringArray(params.inputs, "inputs"),
|
|
31
|
+
expectedOutput: validateStringArray(params.expectedOutput, "expectedOutput"),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function replanSummary(params) {
|
|
35
|
+
const ref = params.reworkBriefRef?.trim();
|
|
36
|
+
return ref
|
|
37
|
+
? `Task ${params.taskId} replanned from rework brief ${ref}`
|
|
38
|
+
: `Task ${params.taskId} replanned`;
|
|
39
|
+
}
|
|
40
|
+
export async function handleReplanTask(rawParams, basePath) {
|
|
41
|
+
let params;
|
|
42
|
+
try {
|
|
43
|
+
params = validateParams(rawParams);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
return { error: `validation failed: ${err.message}` };
|
|
47
|
+
}
|
|
48
|
+
let guardError = null;
|
|
49
|
+
try {
|
|
50
|
+
transaction(() => {
|
|
51
|
+
const parentSlice = getSlice(params.milestoneId, params.sliceId);
|
|
52
|
+
if (!parentSlice) {
|
|
53
|
+
guardError = `missing parent slice: ${params.milestoneId}/${params.sliceId}`;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (isClosedStatus(parentSlice.status)) {
|
|
57
|
+
guardError = `cannot replan a task in a closed slice: ${params.sliceId} (status: ${parentSlice.status})`;
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
const task = getTask(params.milestoneId, params.sliceId, params.taskId);
|
|
61
|
+
if (!task) {
|
|
62
|
+
guardError = `task not found: ${params.milestoneId}/${params.sliceId}/${params.taskId}`;
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (isClosedStatus(task.status)) {
|
|
66
|
+
guardError = `cannot replan completed task ${params.taskId} — use gsd_task_reopen first`;
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
upsertTaskPlanning(params.milestoneId, params.sliceId, params.taskId, {
|
|
70
|
+
title: params.title,
|
|
71
|
+
description: params.description,
|
|
72
|
+
estimate: params.estimate,
|
|
73
|
+
files: params.files,
|
|
74
|
+
verify: params.verify,
|
|
75
|
+
inputs: params.inputs,
|
|
76
|
+
expectedOutput: params.expectedOutput,
|
|
77
|
+
fullPlanMd: params.fullPlanMd,
|
|
78
|
+
});
|
|
79
|
+
insertReplanHistory({
|
|
80
|
+
milestoneId: params.milestoneId,
|
|
81
|
+
sliceId: params.sliceId,
|
|
82
|
+
taskId: params.taskId,
|
|
83
|
+
summary: replanSummary(params),
|
|
84
|
+
previousArtifactPath: params.reworkBriefRef ?? null,
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
return { error: `db write failed: ${err.message}` };
|
|
90
|
+
}
|
|
91
|
+
if (guardError)
|
|
92
|
+
return { error: guardError };
|
|
93
|
+
try {
|
|
94
|
+
const milestonePath = resolveMilestonePath(basePath, params.milestoneId);
|
|
95
|
+
const slicePath = resolveSlicePath(basePath, params.milestoneId, params.sliceId);
|
|
96
|
+
const isLegacySliceLayout = Boolean(milestonePath && slicePath && slicePath !== milestonePath);
|
|
97
|
+
const renderResult = isLegacySliceLayout
|
|
98
|
+
? await renderTaskPlanFromDb(basePath, params.milestoneId, params.sliceId, params.taskId)
|
|
99
|
+
: await renderPlanFromDb(basePath, params.milestoneId, params.sliceId);
|
|
100
|
+
const taskPlanPath = "taskPlanPath" in renderResult ? renderResult.taskPlanPath : renderResult.planPath;
|
|
101
|
+
invalidateStateCache();
|
|
102
|
+
clearParseCache();
|
|
103
|
+
try {
|
|
104
|
+
await flushWorkflowProjections(basePath, { milestoneId: params.milestoneId });
|
|
105
|
+
writeManifest(basePath);
|
|
106
|
+
appendEvent(basePath, {
|
|
107
|
+
cmd: "replan-task",
|
|
108
|
+
params: { milestoneId: params.milestoneId, sliceId: params.sliceId, taskId: params.taskId },
|
|
109
|
+
ts: new Date().toISOString(),
|
|
110
|
+
actor: "agent",
|
|
111
|
+
actor_name: params.actorName,
|
|
112
|
+
trigger_reason: params.triggerReason,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
catch (hookErr) {
|
|
116
|
+
logWarning("tool", `replan-task post-mutation hook warning: ${hookErr.message}`);
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
milestoneId: params.milestoneId,
|
|
120
|
+
sliceId: params.sliceId,
|
|
121
|
+
taskId: params.taskId,
|
|
122
|
+
taskPlanPath,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
return { error: `render failed: ${err.message}` };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { saveReworkBrief } from "../gsd-db.js";
|
|
2
|
+
import { isNonEmptyString, validateStringArray } from "../validation.js";
|
|
3
|
+
function validateFinding(finding, index) {
|
|
4
|
+
if (!isNonEmptyString(finding?.findingId))
|
|
5
|
+
throw new Error(`findings[${index}].findingId is required`);
|
|
6
|
+
if (finding.severity !== "blocking" && finding.severity !== "advisory") {
|
|
7
|
+
throw new Error(`findings[${index}].severity must be blocking or advisory`);
|
|
8
|
+
}
|
|
9
|
+
if (!isNonEmptyString(finding.description))
|
|
10
|
+
throw new Error(`findings[${index}].description is required`);
|
|
11
|
+
if (!isNonEmptyString(finding.requiredFix))
|
|
12
|
+
throw new Error(`findings[${index}].requiredFix is required`);
|
|
13
|
+
const status = finding.status ?? "pending";
|
|
14
|
+
if (status !== "pending" && status !== "resolved" && status !== "deferred-with-override") {
|
|
15
|
+
throw new Error(`findings[${index}].status must be pending, resolved, or deferred-with-override`);
|
|
16
|
+
}
|
|
17
|
+
// A blocking finding is only enforced by gsd_task_complete while it is
|
|
18
|
+
// `pending` (getUnresolvedBlockingReworkFindingsForTask returns pending rows
|
|
19
|
+
// only). Persisting a blocking finding as resolved/deferred-with-override
|
|
20
|
+
// at save time therefore bypasses the completion gate entirely, so require
|
|
21
|
+
// the same justification a reworkResolution would (evidence for `resolved`,
|
|
22
|
+
// evidence + decisionRef for `deferred-with-override`). Advisory findings do
|
|
23
|
+
// not gate completion, so their status is left as-is.
|
|
24
|
+
if (finding.severity === "blocking" && status !== "pending") {
|
|
25
|
+
if (!isNonEmptyString(finding.evidence)) {
|
|
26
|
+
throw new Error(`findings[${index}].evidence is required when a blocking finding is saved as ${status}`);
|
|
27
|
+
}
|
|
28
|
+
if (status === "deferred-with-override" && !isNonEmptyString(finding.decisionRef)) {
|
|
29
|
+
throw new Error(`findings[${index}].decisionRef is required when a blocking finding is saved as deferred-with-override`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
...finding,
|
|
34
|
+
verificationCommands: validateStringArray(finding.verificationCommands, `findings[${index}].verificationCommands`),
|
|
35
|
+
status,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function validateParams(params) {
|
|
39
|
+
if (!isNonEmptyString(params?.milestoneId))
|
|
40
|
+
throw new Error("milestoneId is required");
|
|
41
|
+
if (!isNonEmptyString(params?.sliceId))
|
|
42
|
+
throw new Error("sliceId is required");
|
|
43
|
+
if (!isNonEmptyString(params?.taskId))
|
|
44
|
+
throw new Error("taskId is required");
|
|
45
|
+
if (!Array.isArray(params.findings) || params.findings.length === 0) {
|
|
46
|
+
throw new Error("findings must be a non-empty array");
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
...params,
|
|
50
|
+
findings: params.findings.map(validateFinding),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export async function handleReworkBriefSave(rawParams) {
|
|
54
|
+
let params;
|
|
55
|
+
try {
|
|
56
|
+
params = validateParams(rawParams);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
return { error: `validation failed: ${err.message}` };
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const { briefId } = saveReworkBrief(params);
|
|
63
|
+
return {
|
|
64
|
+
briefId,
|
|
65
|
+
milestoneId: params.milestoneId,
|
|
66
|
+
sliceId: params.sliceId,
|
|
67
|
+
taskId: params.taskId,
|
|
68
|
+
findingCount: params.findings.length,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return { error: `db write failed: ${err.message}` };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -18,6 +18,8 @@ import { handleCompleteSlice } from "./complete-slice.js";
|
|
|
18
18
|
import { handlePlanMilestone } from "./plan-milestone.js";
|
|
19
19
|
import { handlePlanSlice } from "./plan-slice.js";
|
|
20
20
|
import { handleReplanSlice } from "./replan-slice.js";
|
|
21
|
+
import { handleReplanTask } from "./replan-task.js";
|
|
22
|
+
import { handleReworkBriefSave } from "./rework-brief.js";
|
|
21
23
|
import { handleReopenMilestone } from "./reopen-milestone.js";
|
|
22
24
|
import { handleReopenSlice } from "./reopen-slice.js";
|
|
23
25
|
import { handleReopenTask } from "./reopen-task.js";
|
|
@@ -1277,6 +1279,85 @@ export async function executePlanSlice(params, basePath = process.cwd()) {
|
|
|
1277
1279
|
};
|
|
1278
1280
|
}
|
|
1279
1281
|
}
|
|
1282
|
+
export async function executeReplanTask(params, basePath = process.cwd()) {
|
|
1283
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1284
|
+
if (!dbAvailable) {
|
|
1285
|
+
return {
|
|
1286
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot replan task." }],
|
|
1287
|
+
details: { operation: "replan_task", error: "db_unavailable" },
|
|
1288
|
+
isError: true,
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
try {
|
|
1292
|
+
const result = await handleReplanTask(params, basePath);
|
|
1293
|
+
if ("error" in result) {
|
|
1294
|
+
return {
|
|
1295
|
+
content: [{ type: "text", text: `Error replanning task: ${result.error}` }],
|
|
1296
|
+
details: { operation: "replan_task", error: result.error },
|
|
1297
|
+
isError: true,
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
return {
|
|
1301
|
+
content: [{ type: "text", text: `Replanned task ${result.taskId} (${result.sliceId}/${result.milestoneId})` }],
|
|
1302
|
+
details: {
|
|
1303
|
+
operation: "replan_task",
|
|
1304
|
+
milestoneId: result.milestoneId,
|
|
1305
|
+
sliceId: result.sliceId,
|
|
1306
|
+
taskId: result.taskId,
|
|
1307
|
+
taskPlanPath: result.taskPlanPath,
|
|
1308
|
+
},
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1311
|
+
catch (err) {
|
|
1312
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1313
|
+
logError("tool", `replan_task tool failed: ${msg}`, { tool: "gsd_replan_task", error: String(err) });
|
|
1314
|
+
return {
|
|
1315
|
+
content: [{ type: "text", text: `Error replanning task: ${msg}` }],
|
|
1316
|
+
details: { operation: "replan_task", error: msg },
|
|
1317
|
+
isError: true,
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
export async function executeReworkBriefSave(params, basePath = process.cwd()) {
|
|
1322
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1323
|
+
if (!dbAvailable) {
|
|
1324
|
+
return {
|
|
1325
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save rework brief." }],
|
|
1326
|
+
details: { operation: "rework_brief_save", error: "db_unavailable" },
|
|
1327
|
+
isError: true,
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
try {
|
|
1331
|
+
const result = await handleReworkBriefSave(params);
|
|
1332
|
+
if ("error" in result) {
|
|
1333
|
+
return {
|
|
1334
|
+
content: [{ type: "text", text: `Error saving rework brief: ${result.error}` }],
|
|
1335
|
+
details: { operation: "rework_brief_save", error: result.error },
|
|
1336
|
+
isError: true,
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
return {
|
|
1340
|
+
content: [{ type: "text", text: `Saved rework brief ${result.briefId} with ${result.findingCount} finding(s)` }],
|
|
1341
|
+
details: {
|
|
1342
|
+
operation: "rework_brief_save",
|
|
1343
|
+
briefId: result.briefId,
|
|
1344
|
+
milestoneId: result.milestoneId,
|
|
1345
|
+
sliceId: result.sliceId,
|
|
1346
|
+
taskId: result.taskId,
|
|
1347
|
+
findingCount: result.findingCount,
|
|
1348
|
+
},
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
catch (err) {
|
|
1352
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1353
|
+
logError("tool", `rework_brief_save tool failed: ${msg}`, { tool: "gsd_rework_brief_save", error: String(err) });
|
|
1354
|
+
return {
|
|
1355
|
+
content: [{ type: "text", text: `Error saving rework brief: ${msg}` }],
|
|
1356
|
+
details: { operation: "rework_brief_save", error: msg },
|
|
1357
|
+
isError: true,
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1280
1361
|
export async function executeReplanSlice(params, basePath = process.cwd()) {
|
|
1281
1362
|
const dbAvailable = await ensureDbOpen(basePath);
|
|
1282
1363
|
if (!dbAvailable) {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
// owned by the unit, not in the composer. Reviews must enforce this — it
|
|
37
37
|
// is the difference between an orchestrator and a runaway DSL.
|
|
38
38
|
import { resolveManifest, } from "./unit-context-manifest.js";
|
|
39
|
+
import { resolveEffectivePlanningToolsPolicy } from "./planning-subagent-policy.js";
|
|
39
40
|
import { getUnitToolSurfaceContract } from "./unit-tool-contracts.js";
|
|
40
41
|
/**
|
|
41
42
|
* Produce the inlined-context portion of a unit's system prompt by
|
|
@@ -148,11 +149,32 @@ const TOOL_SURFACE_GUIDANCE_BY_UNIT = {
|
|
|
148
149
|
"validate-milestone": "Dispatch reviewer subagents in parallel, then persist the verdict via `gsd_validate_milestone`. Do not query `.gsd/gsd.db` directly — use `gsd_milestone_status` and inlined context.",
|
|
149
150
|
"complete-milestone": "Persist completion only through `gsd_complete_milestone` after verification passes. Do not query `.gsd/gsd.db` directly. Do not write `.gsd/PROJECT.md` or `.gsd/REQUIREMENTS.md` by hand — use `gsd_summary_save` and `gsd_requirement_update`.",
|
|
150
151
|
"replan-slice": "Persist replans through `gsd_replan_slice` only. Do not edit `PLAN.md` or task plans directly.",
|
|
151
|
-
"plan-slice": "Persist planning through `gsd_plan_slice` only. Dispatch subagents only to **scout** or **planner** for reconnaissance — not implementation agents. Do not edit user source files outside `.gsd/**`.",
|
|
152
|
-
"refine-slice": "Persist refinements through `gsd_plan_slice` only. Dispatch subagents only to **scout** or **planner**. Do not edit user source files outside `.gsd/**`.",
|
|
153
|
-
"plan-milestone": "Persist milestone planning through `gsd_plan_milestone` / `gsd_plan_slice`. Do not edit user source files outside `.gsd/**`.",
|
|
154
152
|
"research-slice": "Dispatch subagents only to **scout** or **planner** for reconnaissance. Do not edit user source files outside `.gsd/**`.",
|
|
155
153
|
};
|
|
154
|
+
function formatAllowedAgents(agents) {
|
|
155
|
+
return agents.map((agent) => `**${agent}**`).join(", ");
|
|
156
|
+
}
|
|
157
|
+
function guidanceForUnitToolsPolicy(unitType, policy) {
|
|
158
|
+
if (unitType === "plan-slice") {
|
|
159
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
160
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)} for reconnaissance — not implementation agents.`
|
|
161
|
+
: " Do not dispatch subagents.";
|
|
162
|
+
return `Persist planning through \`gsd_plan_slice\` only.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
163
|
+
}
|
|
164
|
+
if (unitType === "refine-slice") {
|
|
165
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
166
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)}.`
|
|
167
|
+
: " Do not dispatch subagents.";
|
|
168
|
+
return `Persist refinements through \`gsd_plan_slice\` only.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
169
|
+
}
|
|
170
|
+
if (unitType === "plan-milestone") {
|
|
171
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
172
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)}.`
|
|
173
|
+
: "";
|
|
174
|
+
return `Persist milestone planning through \`gsd_plan_milestone\` / \`gsd_plan_slice\`.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
175
|
+
}
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
156
178
|
function guidanceForToolsPolicy(policy) {
|
|
157
179
|
switch (policy.mode) {
|
|
158
180
|
case "planning":
|
|
@@ -191,8 +213,9 @@ export function composeToolSurfaceInstructions(unitType, opts) {
|
|
|
191
213
|
const manifest = resolveManifest(unitType);
|
|
192
214
|
if (!manifest)
|
|
193
215
|
return "";
|
|
194
|
-
const
|
|
195
|
-
const
|
|
216
|
+
const effectiveTools = resolveEffectivePlanningToolsPolicy(unitType, manifest.tools, opts.basePath) ?? manifest.tools;
|
|
217
|
+
const unitGuidance = guidanceForUnitToolsPolicy(unitType, effectiveTools) ?? TOOL_SURFACE_GUIDANCE_BY_UNIT[unitType];
|
|
218
|
+
const policyGuidance = unitGuidance ? null : guidanceForToolsPolicy(effectiveTools);
|
|
196
219
|
const forbiddenLine = formatForbiddenWorkflowToolsLine(unitType, unitGuidance);
|
|
197
220
|
const parts = [unitGuidance, policyGuidance, forbiddenLine].filter((part) => typeof part === "string" && part.length > 0);
|
|
198
221
|
if (parts.length === 0)
|
|
@@ -232,6 +232,8 @@ export const UNIT_REGISTRY = {
|
|
|
232
232
|
"gsd_slice_complete",
|
|
233
233
|
"gsd_task_reopen",
|
|
234
234
|
"gsd_replan_slice",
|
|
235
|
+
"gsd_replan_task",
|
|
236
|
+
"gsd_rework_brief_save",
|
|
235
237
|
"gsd_decision_save",
|
|
236
238
|
"gsd_capture_thought",
|
|
237
239
|
"gsd_requirement_update",
|
|
@@ -245,6 +247,8 @@ export const UNIT_REGISTRY = {
|
|
|
245
247
|
"gsd_slice_complete",
|
|
246
248
|
"gsd_task_reopen",
|
|
247
249
|
"gsd_replan_slice",
|
|
250
|
+
"gsd_replan_task",
|
|
251
|
+
"gsd_rework_brief_save",
|
|
248
252
|
"gsd_requirement_update",
|
|
249
253
|
"gsd_summary_save",
|
|
250
254
|
],
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { gsdRoot, resolveMilestoneFile, resolveSliceFile } from "../paths.js";
|
|
6
|
-
import { isDbAvailable, getMilestoneSlices,
|
|
6
|
+
import { isDbAvailable, getMilestoneSlices, getTasksBySliceIds } from "../gsd-db.js";
|
|
7
7
|
const PLAN_V2_CLARIFY_ROUND_LIMIT = 3;
|
|
8
8
|
export const EXECUTION_ENTRY_PHASES = new Set([
|
|
9
9
|
"executing",
|
|
@@ -17,6 +17,19 @@ export function isExecutionEntryPhase(phase) {
|
|
|
17
17
|
function graphOutputPath(basePath) {
|
|
18
18
|
return join(gsdRoot(basePath), "runtime", "uok-plan-v2-graph.json");
|
|
19
19
|
}
|
|
20
|
+
// True when the on-disk graph matches `output` ignoring the volatile `compiledAt`
|
|
21
|
+
// stamp, so redundant recompiles on the dispatch hot path skip the disk write.
|
|
22
|
+
function graphBodyUnchanged(outPath, output) {
|
|
23
|
+
try {
|
|
24
|
+
const existing = JSON.parse(readFileSync(outPath, "utf-8"));
|
|
25
|
+
const { compiledAt: _existingStamp, ...existingBody } = existing;
|
|
26
|
+
const { compiledAt: _outputStamp, ...outputBody } = output;
|
|
27
|
+
return JSON.stringify(existingBody) === JSON.stringify(outputBody);
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false; // Missing, unreadable, or corrupt — write.
|
|
31
|
+
}
|
|
32
|
+
}
|
|
20
33
|
function hasFileContent(path) {
|
|
21
34
|
if (!path || !existsSync(path))
|
|
22
35
|
return false;
|
|
@@ -88,9 +101,10 @@ export function compileUnitGraphFromState(basePath, state) {
|
|
|
88
101
|
finalizedContextIncluded,
|
|
89
102
|
};
|
|
90
103
|
}
|
|
104
|
+
const tasksBySlice = getTasksBySliceIds(slices.map((slice) => ({ milestoneId: mid, sliceId: slice.id })));
|
|
91
105
|
for (const slice of slices) {
|
|
92
106
|
const sid = slice.id;
|
|
93
|
-
const tasks =
|
|
107
|
+
const tasks = (tasksBySlice.get(`${mid}\0${sid}`) ?? [])
|
|
94
108
|
.sort((a, b) => Number(a.sequence ?? 0) - Number(b.sequence ?? 0));
|
|
95
109
|
let previousTaskNodeId = null;
|
|
96
110
|
for (const task of tasks) {
|
|
@@ -138,7 +152,9 @@ export function compileUnitGraphFromState(basePath, state) {
|
|
|
138
152
|
};
|
|
139
153
|
const outPath = graphOutputPath(basePath);
|
|
140
154
|
mkdirSync(join(gsdRoot(basePath), "runtime"), { recursive: true });
|
|
141
|
-
|
|
155
|
+
if (!graphBodyUnchanged(outPath, output)) {
|
|
156
|
+
writeFileSync(outPath, JSON.stringify(output, null, 2) + "\n", "utf-8");
|
|
157
|
+
}
|
|
142
158
|
return {
|
|
143
159
|
ok: true,
|
|
144
160
|
graphPath: outPath,
|
|
@@ -13,7 +13,7 @@ import { isClosedStatus } from "./status-guards.js";
|
|
|
13
13
|
import { deriveState } from "./state.js";
|
|
14
14
|
import { renderPlanFromDb, renderRoadmapFromDb } from "./markdown-renderer.js";
|
|
15
15
|
import { readManifest } from "./workflow-manifest.js";
|
|
16
|
-
import { gsdRoot, resolveMilestoneFile, resolveSliceFile, resolveTaskFile,
|
|
16
|
+
import { gsdRoot, resolveMilestoneFile, resolveSliceFile, resolveTaskFile, targetTaskFile } from "./paths.js";
|
|
17
17
|
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
18
18
|
/**
|
|
19
19
|
* Strip a leading ID prefix (e.g. "M001: " or "S04: ") from a title
|
|
@@ -276,8 +276,7 @@ export function renderSummaryProjection(basePath, milestoneId, sliceId, taskId)
|
|
|
276
276
|
return;
|
|
277
277
|
const evidenceRows = getVerificationEvidence(milestoneId, sliceId, taskId);
|
|
278
278
|
const content = renderSummaryContent(taskRow, sliceId, milestoneId, evidenceRows);
|
|
279
|
-
const summaryPath =
|
|
280
|
-
?? join(basePath, relTaskFile(basePath, milestoneId, sliceId, taskId, "SUMMARY", getMilestone(milestoneId)?.title));
|
|
279
|
+
const summaryPath = targetTaskFile(basePath, milestoneId, sliceId, taskId, "SUMMARY", getMilestone(milestoneId)?.title);
|
|
281
280
|
mkdirSync(dirname(summaryPath), { recursive: true });
|
|
282
281
|
atomicWriteSync(summaryPath, content);
|
|
283
282
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { dirname, join, resolve } from "node:path";
|
|
3
3
|
import { resolveGsdPathContract, resolveMilestoneFile, resolveMilestonePath, targetMilestoneFile, normalizeRealPath, } from "./paths.js";
|
|
4
4
|
import { isGsdWorktreePath, resolveWorktreeProjectRoot } from "./worktree-root.js";
|
|
5
|
+
import { milestoneMetaPath } from "./git-service.js";
|
|
5
6
|
function tryRealpath(p) {
|
|
6
7
|
return normalizeRealPath(p);
|
|
7
8
|
}
|
|
@@ -63,7 +64,7 @@ export function scopeMilestone(workspace, milestoneId) {
|
|
|
63
64
|
stateFile: () => join(gsd, "STATE.md"),
|
|
64
65
|
dbPath: () => contract.projectDb,
|
|
65
66
|
milestoneDir: () => scopeMilestoneDir(basePath, milestoneId),
|
|
66
|
-
metaJson: () =>
|
|
67
|
+
metaJson: () => milestoneMetaPath(basePath, milestoneId),
|
|
67
68
|
});
|
|
68
69
|
return scope;
|
|
69
70
|
}
|