@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
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { clearParseCache } from "../files.js";
|
|
2
|
+
import {
|
|
3
|
+
getSlice,
|
|
4
|
+
getTask,
|
|
5
|
+
insertReplanHistory,
|
|
6
|
+
transaction,
|
|
7
|
+
upsertTaskPlanning,
|
|
8
|
+
} from "../gsd-db.js";
|
|
9
|
+
import { invalidateStateCache } from "../state.js";
|
|
10
|
+
import { isClosedStatus } from "../status-guards.js";
|
|
11
|
+
import { isNonEmptyString, validateStringArray } from "../validation.js";
|
|
12
|
+
import { renderPlanFromDb, renderTaskPlanFromDb } from "../markdown-renderer.js";
|
|
13
|
+
import { resolveMilestonePath, resolveSlicePath } from "../paths.js";
|
|
14
|
+
import { flushWorkflowProjections } from "../projection-flush.js";
|
|
15
|
+
import { writeManifest } from "../workflow-manifest.js";
|
|
16
|
+
import { appendEvent } from "../workflow-events.js";
|
|
17
|
+
import { logWarning } from "../workflow-logger.js";
|
|
18
|
+
|
|
19
|
+
export interface ReplanTaskParams {
|
|
20
|
+
milestoneId: string;
|
|
21
|
+
sliceId: string;
|
|
22
|
+
taskId: string;
|
|
23
|
+
title: string;
|
|
24
|
+
description: string;
|
|
25
|
+
estimate: string;
|
|
26
|
+
files: string[];
|
|
27
|
+
verify: string;
|
|
28
|
+
inputs: string[];
|
|
29
|
+
expectedOutput: string[];
|
|
30
|
+
reworkBriefRef?: string;
|
|
31
|
+
fullPlanMd?: string;
|
|
32
|
+
actorName?: string;
|
|
33
|
+
triggerReason?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ReplanTaskResult {
|
|
37
|
+
milestoneId: string;
|
|
38
|
+
sliceId: string;
|
|
39
|
+
taskId: string;
|
|
40
|
+
taskPlanPath: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function validateParams(params: ReplanTaskParams): ReplanTaskParams {
|
|
44
|
+
if (!isNonEmptyString(params?.milestoneId)) throw new Error("milestoneId is required");
|
|
45
|
+
if (!isNonEmptyString(params?.sliceId)) throw new Error("sliceId is required");
|
|
46
|
+
if (!isNonEmptyString(params?.taskId)) throw new Error("taskId is required");
|
|
47
|
+
if (!isNonEmptyString(params?.title)) throw new Error("title is required");
|
|
48
|
+
if (!isNonEmptyString(params?.description)) throw new Error("description is required");
|
|
49
|
+
if (!isNonEmptyString(params?.estimate)) throw new Error("estimate is required");
|
|
50
|
+
if (!isNonEmptyString(params?.verify)) throw new Error("verify is required");
|
|
51
|
+
return {
|
|
52
|
+
...params,
|
|
53
|
+
files: validateStringArray(params.files, "files"),
|
|
54
|
+
inputs: validateStringArray(params.inputs, "inputs"),
|
|
55
|
+
expectedOutput: validateStringArray(params.expectedOutput, "expectedOutput"),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function replanSummary(params: ReplanTaskParams): string {
|
|
60
|
+
const ref = params.reworkBriefRef?.trim();
|
|
61
|
+
return ref
|
|
62
|
+
? `Task ${params.taskId} replanned from rework brief ${ref}`
|
|
63
|
+
: `Task ${params.taskId} replanned`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export async function handleReplanTask(
|
|
67
|
+
rawParams: ReplanTaskParams,
|
|
68
|
+
basePath: string,
|
|
69
|
+
): Promise<ReplanTaskResult | { error: string }> {
|
|
70
|
+
let params: ReplanTaskParams;
|
|
71
|
+
try {
|
|
72
|
+
params = validateParams(rawParams);
|
|
73
|
+
} catch (err) {
|
|
74
|
+
return { error: `validation failed: ${(err as Error).message}` };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
let guardError: string | null = null;
|
|
78
|
+
try {
|
|
79
|
+
transaction(() => {
|
|
80
|
+
const parentSlice = getSlice(params.milestoneId, params.sliceId);
|
|
81
|
+
if (!parentSlice) {
|
|
82
|
+
guardError = `missing parent slice: ${params.milestoneId}/${params.sliceId}`;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (isClosedStatus(parentSlice.status)) {
|
|
86
|
+
guardError = `cannot replan a task in a closed slice: ${params.sliceId} (status: ${parentSlice.status})`;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const task = getTask(params.milestoneId, params.sliceId, params.taskId);
|
|
91
|
+
if (!task) {
|
|
92
|
+
guardError = `task not found: ${params.milestoneId}/${params.sliceId}/${params.taskId}`;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (isClosedStatus(task.status)) {
|
|
96
|
+
guardError = `cannot replan completed task ${params.taskId} — use gsd_task_reopen first`;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
upsertTaskPlanning(params.milestoneId, params.sliceId, params.taskId, {
|
|
101
|
+
title: params.title,
|
|
102
|
+
description: params.description,
|
|
103
|
+
estimate: params.estimate,
|
|
104
|
+
files: params.files,
|
|
105
|
+
verify: params.verify,
|
|
106
|
+
inputs: params.inputs,
|
|
107
|
+
expectedOutput: params.expectedOutput,
|
|
108
|
+
fullPlanMd: params.fullPlanMd,
|
|
109
|
+
});
|
|
110
|
+
insertReplanHistory({
|
|
111
|
+
milestoneId: params.milestoneId,
|
|
112
|
+
sliceId: params.sliceId,
|
|
113
|
+
taskId: params.taskId,
|
|
114
|
+
summary: replanSummary(params),
|
|
115
|
+
previousArtifactPath: params.reworkBriefRef ?? null,
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
} catch (err) {
|
|
119
|
+
return { error: `db write failed: ${(err as Error).message}` };
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (guardError) return { error: guardError };
|
|
123
|
+
|
|
124
|
+
try {
|
|
125
|
+
const milestonePath = resolveMilestonePath(basePath, params.milestoneId);
|
|
126
|
+
const slicePath = resolveSlicePath(basePath, params.milestoneId, params.sliceId);
|
|
127
|
+
const isLegacySliceLayout = Boolean(milestonePath && slicePath && slicePath !== milestonePath);
|
|
128
|
+
const renderResult = isLegacySliceLayout
|
|
129
|
+
? await renderTaskPlanFromDb(basePath, params.milestoneId, params.sliceId, params.taskId)
|
|
130
|
+
: await renderPlanFromDb(basePath, params.milestoneId, params.sliceId);
|
|
131
|
+
const taskPlanPath = "taskPlanPath" in renderResult ? renderResult.taskPlanPath : renderResult.planPath;
|
|
132
|
+
|
|
133
|
+
invalidateStateCache();
|
|
134
|
+
clearParseCache();
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
await flushWorkflowProjections(basePath, { milestoneId: params.milestoneId });
|
|
138
|
+
writeManifest(basePath);
|
|
139
|
+
appendEvent(basePath, {
|
|
140
|
+
cmd: "replan-task",
|
|
141
|
+
params: { milestoneId: params.milestoneId, sliceId: params.sliceId, taskId: params.taskId },
|
|
142
|
+
ts: new Date().toISOString(),
|
|
143
|
+
actor: "agent",
|
|
144
|
+
actor_name: params.actorName,
|
|
145
|
+
trigger_reason: params.triggerReason,
|
|
146
|
+
});
|
|
147
|
+
} catch (hookErr) {
|
|
148
|
+
logWarning("tool", `replan-task post-mutation hook warning: ${(hookErr as Error).message}`);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
milestoneId: params.milestoneId,
|
|
153
|
+
sliceId: params.sliceId,
|
|
154
|
+
taskId: params.taskId,
|
|
155
|
+
taskPlanPath,
|
|
156
|
+
};
|
|
157
|
+
} catch (err) {
|
|
158
|
+
return { error: `render failed: ${(err as Error).message}` };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { saveReworkBrief, type ReworkBriefFindingInput } from "../gsd-db.js";
|
|
2
|
+
import { isNonEmptyString, validateStringArray } from "../validation.js";
|
|
3
|
+
|
|
4
|
+
export interface ReworkBriefSaveParams {
|
|
5
|
+
briefId?: string;
|
|
6
|
+
milestoneId: string;
|
|
7
|
+
sliceId: string;
|
|
8
|
+
taskId: string;
|
|
9
|
+
findings: ReworkBriefFindingInput[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ReworkBriefSaveResult {
|
|
13
|
+
briefId: string;
|
|
14
|
+
milestoneId: string;
|
|
15
|
+
sliceId: string;
|
|
16
|
+
taskId: string;
|
|
17
|
+
findingCount: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function validateFinding(finding: ReworkBriefFindingInput, index: number): ReworkBriefFindingInput {
|
|
21
|
+
if (!isNonEmptyString(finding?.findingId)) throw new Error(`findings[${index}].findingId is required`);
|
|
22
|
+
if (finding.severity !== "blocking" && finding.severity !== "advisory") {
|
|
23
|
+
throw new Error(`findings[${index}].severity must be blocking or advisory`);
|
|
24
|
+
}
|
|
25
|
+
if (!isNonEmptyString(finding.description)) throw new Error(`findings[${index}].description is required`);
|
|
26
|
+
if (!isNonEmptyString(finding.requiredFix)) throw new Error(`findings[${index}].requiredFix is required`);
|
|
27
|
+
|
|
28
|
+
const status = finding.status ?? "pending";
|
|
29
|
+
if (status !== "pending" && status !== "resolved" && status !== "deferred-with-override") {
|
|
30
|
+
throw new Error(`findings[${index}].status must be pending, resolved, or deferred-with-override`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// A blocking finding is only enforced by gsd_task_complete while it is
|
|
34
|
+
// `pending` (getUnresolvedBlockingReworkFindingsForTask returns pending rows
|
|
35
|
+
// only). Persisting a blocking finding as resolved/deferred-with-override
|
|
36
|
+
// at save time therefore bypasses the completion gate entirely, so require
|
|
37
|
+
// the same justification a reworkResolution would (evidence for `resolved`,
|
|
38
|
+
// evidence + decisionRef for `deferred-with-override`). Advisory findings do
|
|
39
|
+
// not gate completion, so their status is left as-is.
|
|
40
|
+
if (finding.severity === "blocking" && status !== "pending") {
|
|
41
|
+
if (!isNonEmptyString(finding.evidence)) {
|
|
42
|
+
throw new Error(`findings[${index}].evidence is required when a blocking finding is saved as ${status}`);
|
|
43
|
+
}
|
|
44
|
+
if (status === "deferred-with-override" && !isNonEmptyString(finding.decisionRef)) {
|
|
45
|
+
throw new Error(`findings[${index}].decisionRef is required when a blocking finding is saved as deferred-with-override`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
...finding,
|
|
51
|
+
verificationCommands: validateStringArray(finding.verificationCommands, `findings[${index}].verificationCommands`),
|
|
52
|
+
status,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function validateParams(params: ReworkBriefSaveParams): ReworkBriefSaveParams {
|
|
57
|
+
if (!isNonEmptyString(params?.milestoneId)) throw new Error("milestoneId is required");
|
|
58
|
+
if (!isNonEmptyString(params?.sliceId)) throw new Error("sliceId is required");
|
|
59
|
+
if (!isNonEmptyString(params?.taskId)) throw new Error("taskId is required");
|
|
60
|
+
if (!Array.isArray(params.findings) || params.findings.length === 0) {
|
|
61
|
+
throw new Error("findings must be a non-empty array");
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
...params,
|
|
65
|
+
findings: params.findings.map(validateFinding),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export async function handleReworkBriefSave(
|
|
70
|
+
rawParams: ReworkBriefSaveParams,
|
|
71
|
+
): Promise<ReworkBriefSaveResult | { error: string }> {
|
|
72
|
+
let params: ReworkBriefSaveParams;
|
|
73
|
+
try {
|
|
74
|
+
params = validateParams(rawParams);
|
|
75
|
+
} catch (err) {
|
|
76
|
+
return { error: `validation failed: ${(err as Error).message}` };
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const { briefId } = saveReworkBrief(params);
|
|
81
|
+
return {
|
|
82
|
+
briefId,
|
|
83
|
+
milestoneId: params.milestoneId,
|
|
84
|
+
sliceId: params.sliceId,
|
|
85
|
+
taskId: params.taskId,
|
|
86
|
+
findingCount: params.findings.length,
|
|
87
|
+
};
|
|
88
|
+
} catch (err) {
|
|
89
|
+
return { error: `db write failed: ${(err as Error).message}` };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -37,6 +37,10 @@ import type { PlanSliceParams } from "./plan-slice.js";
|
|
|
37
37
|
import { handlePlanSlice } from "./plan-slice.js";
|
|
38
38
|
import type { ReplanSliceParams } from "./replan-slice.js";
|
|
39
39
|
import { handleReplanSlice } from "./replan-slice.js";
|
|
40
|
+
import type { ReplanTaskParams } from "./replan-task.js";
|
|
41
|
+
import { handleReplanTask } from "./replan-task.js";
|
|
42
|
+
import type { ReworkBriefSaveParams } from "./rework-brief.js";
|
|
43
|
+
import { handleReworkBriefSave } from "./rework-brief.js";
|
|
40
44
|
import type { ReopenMilestoneParams } from "./reopen-milestone.js";
|
|
41
45
|
import { handleReopenMilestone } from "./reopen-milestone.js";
|
|
42
46
|
import type { ReopenSliceParams } from "./reopen-slice.js";
|
|
@@ -696,6 +700,8 @@ export type SliceCompleteExecutorParams = CompleteSliceParams;
|
|
|
696
700
|
export type PlanMilestoneExecutorParams = PlanMilestoneParams;
|
|
697
701
|
export type PlanSliceExecutorParams = PlanSliceParams;
|
|
698
702
|
export type ReplanSliceExecutorParams = ReplanSliceParams;
|
|
703
|
+
export type ReplanTaskExecutorParams = ReplanTaskParams;
|
|
704
|
+
export type ReworkBriefSaveExecutorParams = ReworkBriefSaveParams;
|
|
699
705
|
export type ReopenTaskExecutorParams = ReopenTaskParams;
|
|
700
706
|
export type ReopenSliceExecutorParams = ReopenSliceParams;
|
|
701
707
|
export type ReopenMilestoneExecutorParams = ReopenMilestoneParams;
|
|
@@ -1490,6 +1496,92 @@ export async function executePlanSlice(
|
|
|
1490
1496
|
}
|
|
1491
1497
|
}
|
|
1492
1498
|
|
|
1499
|
+
|
|
1500
|
+
export async function executeReplanTask(
|
|
1501
|
+
params: ReplanTaskExecutorParams,
|
|
1502
|
+
basePath: string = process.cwd(),
|
|
1503
|
+
): Promise<ToolExecutionResult> {
|
|
1504
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1505
|
+
if (!dbAvailable) {
|
|
1506
|
+
return {
|
|
1507
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot replan task." }],
|
|
1508
|
+
details: { operation: "replan_task", error: "db_unavailable" },
|
|
1509
|
+
isError: true,
|
|
1510
|
+
};
|
|
1511
|
+
}
|
|
1512
|
+
try {
|
|
1513
|
+
const result = await handleReplanTask(params, basePath);
|
|
1514
|
+
if ("error" in result) {
|
|
1515
|
+
return {
|
|
1516
|
+
content: [{ type: "text", text: `Error replanning task: ${result.error}` }],
|
|
1517
|
+
details: { operation: "replan_task", error: result.error },
|
|
1518
|
+
isError: true,
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
return {
|
|
1522
|
+
content: [{ type: "text", text: `Replanned task ${result.taskId} (${result.sliceId}/${result.milestoneId})` }],
|
|
1523
|
+
details: {
|
|
1524
|
+
operation: "replan_task",
|
|
1525
|
+
milestoneId: result.milestoneId,
|
|
1526
|
+
sliceId: result.sliceId,
|
|
1527
|
+
taskId: result.taskId,
|
|
1528
|
+
taskPlanPath: result.taskPlanPath,
|
|
1529
|
+
},
|
|
1530
|
+
};
|
|
1531
|
+
} catch (err) {
|
|
1532
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1533
|
+
logError("tool", `replan_task tool failed: ${msg}`, { tool: "gsd_replan_task", error: String(err) });
|
|
1534
|
+
return {
|
|
1535
|
+
content: [{ type: "text", text: `Error replanning task: ${msg}` }],
|
|
1536
|
+
details: { operation: "replan_task", error: msg },
|
|
1537
|
+
isError: true,
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
export async function executeReworkBriefSave(
|
|
1543
|
+
params: ReworkBriefSaveExecutorParams,
|
|
1544
|
+
basePath: string = process.cwd(),
|
|
1545
|
+
): Promise<ToolExecutionResult> {
|
|
1546
|
+
const dbAvailable = await ensureDbOpen(basePath);
|
|
1547
|
+
if (!dbAvailable) {
|
|
1548
|
+
return {
|
|
1549
|
+
content: [{ type: "text", text: "Error: GSD database is not available. Cannot save rework brief." }],
|
|
1550
|
+
details: { operation: "rework_brief_save", error: "db_unavailable" },
|
|
1551
|
+
isError: true,
|
|
1552
|
+
};
|
|
1553
|
+
}
|
|
1554
|
+
try {
|
|
1555
|
+
const result = await handleReworkBriefSave(params);
|
|
1556
|
+
if ("error" in result) {
|
|
1557
|
+
return {
|
|
1558
|
+
content: [{ type: "text", text: `Error saving rework brief: ${result.error}` }],
|
|
1559
|
+
details: { operation: "rework_brief_save", error: result.error },
|
|
1560
|
+
isError: true,
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
return {
|
|
1564
|
+
content: [{ type: "text", text: `Saved rework brief ${result.briefId} with ${result.findingCount} finding(s)` }],
|
|
1565
|
+
details: {
|
|
1566
|
+
operation: "rework_brief_save",
|
|
1567
|
+
briefId: result.briefId,
|
|
1568
|
+
milestoneId: result.milestoneId,
|
|
1569
|
+
sliceId: result.sliceId,
|
|
1570
|
+
taskId: result.taskId,
|
|
1571
|
+
findingCount: result.findingCount,
|
|
1572
|
+
},
|
|
1573
|
+
};
|
|
1574
|
+
} catch (err) {
|
|
1575
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
1576
|
+
logError("tool", `rework_brief_save tool failed: ${msg}`, { tool: "gsd_rework_brief_save", error: String(err) });
|
|
1577
|
+
return {
|
|
1578
|
+
content: [{ type: "text", text: `Error saving rework brief: ${msg}` }],
|
|
1579
|
+
details: { operation: "rework_brief_save", error: msg },
|
|
1580
|
+
isError: true,
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1493
1585
|
export async function executeReplanSlice(
|
|
1494
1586
|
params: ReplanSliceExecutorParams,
|
|
1495
1587
|
basePath: string = process.cwd(),
|
|
@@ -695,6 +695,17 @@ export interface CompleteTaskParams {
|
|
|
695
695
|
verdict: string;
|
|
696
696
|
durationMs: number;
|
|
697
697
|
}>;
|
|
698
|
+
/**
|
|
699
|
+
* Resolution evidence for structured rework findings linked to this task.
|
|
700
|
+
* All blocking findings must be resolved before completion is accepted.
|
|
701
|
+
* @optional
|
|
702
|
+
*/
|
|
703
|
+
reworkResolution?: Array<{
|
|
704
|
+
findingId: string;
|
|
705
|
+
status: "resolved" | "deferred-with-override";
|
|
706
|
+
evidence: string;
|
|
707
|
+
decisionRef?: string;
|
|
708
|
+
}>;
|
|
698
709
|
/**
|
|
699
710
|
* Q5 failure-modes section content (what breaks when dependencies fail).
|
|
700
711
|
* Populated → `pass`; omitted/empty → `omitted`.
|
|
@@ -46,6 +46,7 @@ import {
|
|
|
46
46
|
type ToolsPolicy,
|
|
47
47
|
type UnitContextManifest,
|
|
48
48
|
} from "./unit-context-manifest.js";
|
|
49
|
+
import { resolveEffectivePlanningToolsPolicy } from "./planning-subagent-policy.js";
|
|
49
50
|
import { getUnitToolSurfaceContract } from "./unit-tool-contracts.js";
|
|
50
51
|
import type { UnitPromptContextContract } from "./tool-contract.js";
|
|
51
52
|
|
|
@@ -207,6 +208,7 @@ export function composeContextModeInstructions(
|
|
|
207
208
|
|
|
208
209
|
export interface ComposeToolSurfaceInstructionOptions {
|
|
209
210
|
readonly renderMode: ContextModeRenderMode;
|
|
211
|
+
readonly basePath?: string;
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
const TOOL_SURFACE_GUIDANCE_BY_UNIT: Record<string, string> = {
|
|
@@ -226,16 +228,39 @@ const TOOL_SURFACE_GUIDANCE_BY_UNIT: Record<string, string> = {
|
|
|
226
228
|
"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`.",
|
|
227
229
|
"replan-slice":
|
|
228
230
|
"Persist replans through `gsd_replan_slice` only. Do not edit `PLAN.md` or task plans directly.",
|
|
229
|
-
"plan-slice":
|
|
230
|
-
"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/**`.",
|
|
231
|
-
"refine-slice":
|
|
232
|
-
"Persist refinements through `gsd_plan_slice` only. Dispatch subagents only to **scout** or **planner**. Do not edit user source files outside `.gsd/**`.",
|
|
233
|
-
"plan-milestone":
|
|
234
|
-
"Persist milestone planning through `gsd_plan_milestone` / `gsd_plan_slice`. Do not edit user source files outside `.gsd/**`.",
|
|
235
231
|
"research-slice":
|
|
236
232
|
"Dispatch subagents only to **scout** or **planner** for reconnaissance. Do not edit user source files outside `.gsd/**`.",
|
|
237
233
|
};
|
|
238
234
|
|
|
235
|
+
function formatAllowedAgents(agents: readonly string[]): string {
|
|
236
|
+
return agents.map((agent) => `**${agent}**`).join(", ");
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function guidanceForUnitToolsPolicy(unitType: string, policy: ToolsPolicy): string | undefined {
|
|
240
|
+
if (unitType === "plan-slice") {
|
|
241
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
242
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)} for reconnaissance — not implementation agents.`
|
|
243
|
+
: " Do not dispatch subagents.";
|
|
244
|
+
return `Persist planning through \`gsd_plan_slice\` only.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (unitType === "refine-slice") {
|
|
248
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
249
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)}.`
|
|
250
|
+
: " Do not dispatch subagents.";
|
|
251
|
+
return `Persist refinements through \`gsd_plan_slice\` only.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (unitType === "plan-milestone") {
|
|
255
|
+
const dispatch = policy.mode === "planning-dispatch"
|
|
256
|
+
? ` Dispatch subagents only to ${formatAllowedAgents(policy.allowedSubagents)}.`
|
|
257
|
+
: "";
|
|
258
|
+
return `Persist milestone planning through \`gsd_plan_milestone\` / \`gsd_plan_slice\`.${dispatch} Do not edit user source files outside \`.gsd/**\`.`;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
|
|
239
264
|
function guidanceForToolsPolicy(policy: ToolsPolicy): string | null {
|
|
240
265
|
switch (policy.mode) {
|
|
241
266
|
case "planning":
|
|
@@ -280,8 +305,9 @@ export function composeToolSurfaceInstructions(
|
|
|
280
305
|
const manifest = resolveManifest(unitType);
|
|
281
306
|
if (!manifest) return "";
|
|
282
307
|
|
|
283
|
-
const
|
|
284
|
-
const
|
|
308
|
+
const effectiveTools = resolveEffectivePlanningToolsPolicy(unitType, manifest.tools, opts.basePath) ?? manifest.tools;
|
|
309
|
+
const unitGuidance = guidanceForUnitToolsPolicy(unitType, effectiveTools) ?? TOOL_SURFACE_GUIDANCE_BY_UNIT[unitType];
|
|
310
|
+
const policyGuidance = unitGuidance ? null : guidanceForToolsPolicy(effectiveTools);
|
|
285
311
|
const forbiddenLine = formatForbiddenWorkflowToolsLine(unitType, unitGuidance);
|
|
286
312
|
const parts = [unitGuidance, policyGuidance, forbiddenLine].filter(
|
|
287
313
|
(part): part is string => typeof part === "string" && part.length > 0,
|
|
@@ -290,6 +290,8 @@ export const UNIT_REGISTRY = {
|
|
|
290
290
|
"gsd_slice_complete",
|
|
291
291
|
"gsd_task_reopen",
|
|
292
292
|
"gsd_replan_slice",
|
|
293
|
+
"gsd_replan_task",
|
|
294
|
+
"gsd_rework_brief_save",
|
|
293
295
|
"gsd_decision_save",
|
|
294
296
|
"gsd_capture_thought",
|
|
295
297
|
"gsd_requirement_update",
|
|
@@ -303,6 +305,8 @@ export const UNIT_REGISTRY = {
|
|
|
303
305
|
"gsd_slice_complete",
|
|
304
306
|
"gsd_task_reopen",
|
|
305
307
|
"gsd_replan_slice",
|
|
308
|
+
"gsd_replan_task",
|
|
309
|
+
"gsd_rework_brief_save",
|
|
306
310
|
"gsd_requirement_update",
|
|
307
311
|
"gsd_summary_save",
|
|
308
312
|
],
|
|
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
|
|
6
6
|
|
|
7
7
|
import type { GSDState, Phase } from "../types.js";
|
|
8
8
|
import { gsdRoot, resolveMilestoneFile, resolveSliceFile } from "../paths.js";
|
|
9
|
-
import { isDbAvailable, getMilestoneSlices,
|
|
9
|
+
import { isDbAvailable, getMilestoneSlices, getTasksBySliceIds } from "../gsd-db.js";
|
|
10
10
|
import type { SliceRow } from "../db-task-slice-rows.js";
|
|
11
11
|
import type { UokGraphNode } from "./contracts.js";
|
|
12
12
|
|
|
@@ -39,6 +39,19 @@ function graphOutputPath(basePath: string): string {
|
|
|
39
39
|
return join(gsdRoot(basePath), "runtime", "uok-plan-v2-graph.json");
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
// True when the on-disk graph matches `output` ignoring the volatile `compiledAt`
|
|
43
|
+
// stamp, so redundant recompiles on the dispatch hot path skip the disk write.
|
|
44
|
+
function graphBodyUnchanged(outPath: string, output: Record<string, unknown>): boolean {
|
|
45
|
+
try {
|
|
46
|
+
const existing = JSON.parse(readFileSync(outPath, "utf-8")) as Record<string, unknown>;
|
|
47
|
+
const { compiledAt: _existingStamp, ...existingBody } = existing;
|
|
48
|
+
const { compiledAt: _outputStamp, ...outputBody } = output;
|
|
49
|
+
return JSON.stringify(existingBody) === JSON.stringify(outputBody);
|
|
50
|
+
} catch {
|
|
51
|
+
return false; // Missing, unreadable, or corrupt — write.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
function hasFileContent(path: string | null): boolean {
|
|
43
56
|
if (!path || !existsSync(path)) return false;
|
|
44
57
|
try {
|
|
@@ -120,9 +133,11 @@ export function compileUnitGraphFromState(basePath: string, state: GSDState): Pl
|
|
|
120
133
|
};
|
|
121
134
|
}
|
|
122
135
|
|
|
136
|
+
const tasksBySlice = getTasksBySliceIds(slices.map((slice) => ({ milestoneId: mid, sliceId: slice.id })));
|
|
137
|
+
|
|
123
138
|
for (const slice of slices) {
|
|
124
139
|
const sid = slice.id;
|
|
125
|
-
const tasks =
|
|
140
|
+
const tasks = (tasksBySlice.get(`${mid}\0${sid}`) ?? [])
|
|
126
141
|
.sort((a, b) => Number(a.sequence ?? 0) - Number(b.sequence ?? 0));
|
|
127
142
|
|
|
128
143
|
let previousTaskNodeId: string | null = null;
|
|
@@ -174,7 +189,9 @@ export function compileUnitGraphFromState(basePath: string, state: GSDState): Pl
|
|
|
174
189
|
|
|
175
190
|
const outPath = graphOutputPath(basePath);
|
|
176
191
|
mkdirSync(join(gsdRoot(basePath), "runtime"), { recursive: true });
|
|
177
|
-
|
|
192
|
+
if (!graphBodyUnchanged(outPath, output)) {
|
|
193
|
+
writeFileSync(outPath, JSON.stringify(output, null, 2) + "\n", "utf-8");
|
|
194
|
+
}
|
|
178
195
|
|
|
179
196
|
return {
|
|
180
197
|
ok: true,
|
|
@@ -26,7 +26,7 @@ import { deriveState } from "./state.js";
|
|
|
26
26
|
import type { GSDState } from "./types.js";
|
|
27
27
|
import { renderPlanFromDb, renderRoadmapFromDb } from "./markdown-renderer.js";
|
|
28
28
|
import { readManifest } from "./workflow-manifest.js";
|
|
29
|
-
import { gsdRoot, resolveMilestoneFile, resolveSliceFile, resolveTaskFile,
|
|
29
|
+
import { gsdRoot, resolveMilestoneFile, resolveSliceFile, resolveTaskFile, targetTaskFile } from "./paths.js";
|
|
30
30
|
|
|
31
31
|
// ─── Helpers ─────────────────────────────────────────────────────────────
|
|
32
32
|
|
|
@@ -329,8 +329,7 @@ export function renderSummaryProjection(basePath: string, milestoneId: string, s
|
|
|
329
329
|
const evidenceRows = getVerificationEvidence(milestoneId, sliceId, taskId);
|
|
330
330
|
const content = renderSummaryContent(taskRow, sliceId, milestoneId, evidenceRows);
|
|
331
331
|
|
|
332
|
-
const summaryPath =
|
|
333
|
-
?? join(basePath, relTaskFile(basePath, milestoneId, sliceId, taskId, "SUMMARY", getMilestone(milestoneId)?.title));
|
|
332
|
+
const summaryPath = targetTaskFile(basePath, milestoneId, sliceId, taskId, "SUMMARY", getMilestone(milestoneId)?.title);
|
|
334
333
|
mkdirSync(dirname(summaryPath), { recursive: true });
|
|
335
334
|
atomicWriteSync(summaryPath, content);
|
|
336
335
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
normalizeRealPath,
|
|
11
11
|
} from "./paths.js";
|
|
12
12
|
import { isGsdWorktreePath, resolveWorktreeProjectRoot } from "./worktree-root.js";
|
|
13
|
+
import { milestoneMetaPath } from "./git-service.js";
|
|
13
14
|
|
|
14
15
|
export type GsdWorkspaceMode = "project" | "worktree";
|
|
15
16
|
|
|
@@ -107,7 +108,7 @@ export function scopeMilestone(workspace: GsdWorkspace, milestoneId: string): Mi
|
|
|
107
108
|
stateFile: () => join(gsd, "STATE.md"),
|
|
108
109
|
dbPath: () => contract.projectDb,
|
|
109
110
|
milestoneDir: () => scopeMilestoneDir(basePath, milestoneId),
|
|
110
|
-
metaJson: () =>
|
|
111
|
+
metaJson: () => milestoneMetaPath(basePath, milestoneId),
|
|
111
112
|
});
|
|
112
113
|
|
|
113
114
|
return scope;
|
|
@@ -179,6 +179,14 @@ function syncOtherMilestoneArtifacts(
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
function syncFlatPhaseArtifacts(prGsd: string, wtGsd: string): void {
|
|
183
|
+
safeCopyRecursive(
|
|
184
|
+
join(prGsd, "phases"),
|
|
185
|
+
join(wtGsd, "phases"),
|
|
186
|
+
{ force: false },
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
/**
|
|
183
191
|
* Root-level .gsd/ files copied from worktree back to project root for
|
|
184
192
|
* post-merge diagnostics. Markdown projections are NOT in this list — DB
|
|
@@ -254,6 +262,10 @@ export function _projectRootToWorktreeImpl(
|
|
|
254
262
|
// worktree-bound unit; the project root remains authoritative.
|
|
255
263
|
syncRootProjectionFilesToWorktree(prGsd, wtGsd);
|
|
256
264
|
|
|
265
|
+
// Flat-phase artifacts (phases/NN-slug/NN-CONTEXT.md, NN-DISCUSSION.md,
|
|
266
|
+
// ROADMAP, etc.) must be available before the first worktree dispatch.
|
|
267
|
+
syncFlatPhaseArtifacts(prGsd, wtGsd);
|
|
268
|
+
|
|
257
269
|
// Copy milestone directory from project root to worktree — additive only.
|
|
258
270
|
// force:false prevents cpSync from overwriting existing worktree files.
|
|
259
271
|
// Without this, worktree-local files (e.g. VALIDATION.md written
|
|
@@ -17,6 +17,10 @@ import { StringEnum, Type } from "@gsd/pi-ai";
|
|
|
17
17
|
import { execFileSync } from "node:child_process";
|
|
18
18
|
import { statSync, readdirSync } from "node:fs";
|
|
19
19
|
import path from "node:path";
|
|
20
|
+
import {
|
|
21
|
+
constrainScreenshot,
|
|
22
|
+
getScreenshotBufferDimensions,
|
|
23
|
+
} from "../browser-tools/screenshot-constraints.js";
|
|
20
24
|
|
|
21
25
|
// ---------------------------------------------------------------------------
|
|
22
26
|
// Paths
|
|
@@ -96,6 +100,45 @@ interface MacAgentResponse {
|
|
|
96
100
|
error?: string;
|
|
97
101
|
}
|
|
98
102
|
|
|
103
|
+
interface MacScreenshotPayload {
|
|
104
|
+
imageData: string;
|
|
105
|
+
width: number;
|
|
106
|
+
height: number;
|
|
107
|
+
format: string;
|
|
108
|
+
mimeType: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function macScreenshotQualityToPercent(quality: number | undefined): number {
|
|
112
|
+
if (quality === undefined || !Number.isFinite(quality)) return 80;
|
|
113
|
+
return Math.min(100, Math.max(1, Math.round(quality * 100)));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export async function prepareMacScreenshotPayload(
|
|
117
|
+
data: Record<string, any>,
|
|
118
|
+
quality: number | undefined,
|
|
119
|
+
): Promise<MacScreenshotPayload> {
|
|
120
|
+
const format = data.format as string;
|
|
121
|
+
const mimeType = format === "png" ? "image/png" : "image/jpeg";
|
|
122
|
+
const rawBuffer = Buffer.from(data.imageData as string, "base64");
|
|
123
|
+
const constrainedBuffer = await constrainScreenshot(
|
|
124
|
+
null as any,
|
|
125
|
+
rawBuffer,
|
|
126
|
+
mimeType,
|
|
127
|
+
macScreenshotQualityToPercent(quality),
|
|
128
|
+
);
|
|
129
|
+
const dimensions = constrainedBuffer === rawBuffer
|
|
130
|
+
? null
|
|
131
|
+
: await getScreenshotBufferDimensions(constrainedBuffer);
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
imageData: constrainedBuffer.toString("base64"),
|
|
135
|
+
width: dimensions?.width ?? (data.width as number),
|
|
136
|
+
height: dimensions?.height ?? (data.height as number),
|
|
137
|
+
format,
|
|
138
|
+
mimeType,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
99
142
|
/**
|
|
100
143
|
* Invoke the mac-agent CLI with a command and optional params.
|
|
101
144
|
* Handles compilation caching, stdin/stdout JSON protocol, and error surfacing.
|
|
@@ -718,19 +761,19 @@ export default function (pi: ExtensionAPI) {
|
|
|
718
761
|
throw new Error("mac_screenshot: " + result.error);
|
|
719
762
|
}
|
|
720
763
|
|
|
721
|
-
const
|
|
722
|
-
const imageData = data.imageData as string;
|
|
723
|
-
const format = data.format as string;
|
|
724
|
-
const width = data.width as number;
|
|
725
|
-
const height = data.height as number;
|
|
726
|
-
const mimeType = format === "png" ? "image/png" : "image/jpeg";
|
|
764
|
+
const screenshot = await prepareMacScreenshotPayload(result.data!, args.quality);
|
|
727
765
|
|
|
728
766
|
return {
|
|
729
767
|
content: [
|
|
730
|
-
{ type: "text" as const, text: `Screenshot: ${width}x${height} ${format}` },
|
|
731
|
-
{ type: "image" as const, data: imageData, mimeType },
|
|
768
|
+
{ type: "text" as const, text: `Screenshot: ${screenshot.width}x${screenshot.height} ${screenshot.format}` },
|
|
769
|
+
{ type: "image" as const, data: screenshot.imageData, mimeType: screenshot.mimeType },
|
|
732
770
|
],
|
|
733
|
-
details: {
|
|
771
|
+
details: {
|
|
772
|
+
width: screenshot.width,
|
|
773
|
+
height: screenshot.height,
|
|
774
|
+
format: screenshot.format,
|
|
775
|
+
mimeType: screenshot.mimeType,
|
|
776
|
+
},
|
|
734
777
|
};
|
|
735
778
|
},
|
|
736
779
|
});
|