@opengsd/gsd-pi 1.7.0 → 1.8.1-dev.897b3c90
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 +8 -6
- 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 +16 -47
- 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/auto-artifact-paths.js +2 -2
- 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 +35 -1
- package/dist/resources/extensions/gsd/auto.js +5 -1
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +78 -4
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +84 -26
- 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/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 +4 -4
- package/dist/resources/extensions/gsd/doctor-history.js +65 -0
- package/dist/resources/extensions/gsd/doctor-state-checks.js +509 -0
- package/dist/resources/extensions/gsd/doctor-workspace-checks.js +91 -0
- package/dist/resources/extensions/gsd/doctor.js +14 -653
- package/dist/resources/extensions/gsd/flat-phase-migration.js +156 -21
- package/dist/resources/extensions/gsd/gsd-db.js +187 -45
- package/dist/resources/extensions/gsd/guided-flow.js +29 -10
- package/dist/resources/extensions/gsd/markdown-renderer.js +16 -2
- package/dist/resources/extensions/gsd/md-importer.js +109 -16
- 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 +20 -19
- package/dist/resources/extensions/gsd/migrate/presentation.js +64 -0
- package/dist/resources/extensions/gsd/migration-auto-check.js +4 -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 +4 -1
- package/dist/resources/extensions/gsd/phase-anchor.js +7 -2
- package/dist/resources/extensions/gsd/post-execution-checks.js +4 -4
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- 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/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/state-reconciliation/drift/project-md.js +54 -14
- package/dist/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.js +48 -5
- 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/tools/complete-task.js +82 -1
- 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/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-registry.js +4 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +19 -3
- 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 +9 -9
- 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 +9 -9
- 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 +30 -8
- package/packages/daemon/dist/cloud-config.js.map +1 -1
- package/packages/daemon/dist/cloud-config.test.js +69 -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/package.json +5 -5
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/gsd-cloud/README.md +18 -4
- package/packages/gsd-cloud/bin/gsd-cloud.js +6 -5
- 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 +7 -5
- package/packages/mcp-server/README.md +8 -0
- 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/package.json +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +60 -0
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +54 -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 +19 -0
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/package.json +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 +16 -47
- 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/auto-artifact-paths.ts +2 -2
- 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 +38 -1
- package/src/resources/extensions/gsd/auto.ts +5 -1
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +91 -4
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +80 -24
- 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/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 +4 -4
- package/src/resources/extensions/gsd/doctor-history.ts +81 -0
- package/src/resources/extensions/gsd/doctor-state-checks.ts +527 -0
- package/src/resources/extensions/gsd/doctor-workspace-checks.ts +97 -0
- package/src/resources/extensions/gsd/doctor.ts +14 -673
- package/src/resources/extensions/gsd/flat-phase-migration.ts +160 -19
- package/src/resources/extensions/gsd/gsd-db.ts +255 -52
- package/src/resources/extensions/gsd/guided-flow.ts +39 -10
- package/src/resources/extensions/gsd/markdown-renderer.ts +23 -7
- package/src/resources/extensions/gsd/md-importer.ts +116 -13
- 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 +21 -23
- package/src/resources/extensions/gsd/migrate/presentation.ts +83 -0
- package/src/resources/extensions/gsd/migration-auto-check.ts +3 -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 +4 -1
- package/src/resources/extensions/gsd/phase-anchor.ts +8 -2
- package/src/resources/extensions/gsd/post-execution-checks.ts +4 -4
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- 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/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/drift/project-md.ts +67 -20
- package/src/resources/extensions/gsd/state-reconciliation/drift/sketch-flag.ts +47 -5
- 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/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 +286 -0
- package/src/resources/extensions/gsd/tests/db-authority-regression.test.ts +76 -1
- package/src/resources/extensions/gsd/tests/db-engine-migrate-guards.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +29 -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/doctor-history-public-api.test.ts +25 -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/migrate-hierarchy.test.ts +53 -0
- 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/migration-auto-check.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/milestone-leases.test.ts +55 -0
- 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/parsers-legacy-importers.test.ts +4 -0
- 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 +47 -1
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +22 -0
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +18 -3
- 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/skip-slice-cascades-tasks.test.ts +21 -0
- package/src/resources/extensions/gsd/tests/state-reconciliation-drift.test.ts +177 -25
- 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/unit-context-composer.test.ts +34 -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/worktree-state-projection.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/write-gate-seam.test.ts +52 -0
- package/src/resources/extensions/gsd/tools/complete-task.ts +120 -0
- 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/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-registry.ts +4 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +20 -3
- 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/{enWQFRY-aLTUq3wmxG2Qz → TezjdjSHBVRRr54XjAvte}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{enWQFRY-aLTUq3wmxG2Qz → TezjdjSHBVRRr54XjAvte}/_ssgManifest.js +0 -0
package/README.md
CHANGED
|
@@ -28,12 +28,14 @@ See [CHANGELOG.md](./CHANGELOG.md) for release-by-release fixes and [Legacy Rele
|
|
|
28
28
|
## Latest Release Highlights
|
|
29
29
|
|
|
30
30
|
<!-- release-highlights:start -->
|
|
31
|
-
Latest release: **v1.
|
|
32
|
-
|
|
33
|
-
- **
|
|
34
|
-
- **
|
|
35
|
-
- **issue:**
|
|
36
|
-
- **issue:** [
|
|
31
|
+
Latest release: **v1.8.1**
|
|
32
|
+
|
|
33
|
+
- **doctor:** Extract state checks.
|
|
34
|
+
- **doctor:** Extract history and workspace checks.
|
|
35
|
+
- **issue:** Unregistered-milestone false positive: flat-phase ID extractor derives bare M### from descriptive slug, missing suffixed DB row (M###-abcdef) (#1282).
|
|
36
|
+
- **issue:** [Bug] reconcile triggers mass re-projection of all historical PLAN.md files, resetting completed task checkboxes to unchecked (#1279).
|
|
37
|
+
- **issue:** [Bug]: `migrateHierarchyToDb` imports a `[sketch]` slice's stub PLAN tasks as real DB rows, flipping planning→executing.
|
|
38
|
+
- **issue:** [Bug]: `sketchFlagHandler` clears `is_sketch` on mere PLAN-file existence, including a stub or leftover PLAN.
|
|
37
39
|
|
|
38
40
|
<!-- release-highlights:end -->
|
|
39
41
|
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ import chalk from 'chalk';
|
|
|
10
10
|
import { checkForGsdBrowserUpdates, checkForUpdates } from './update-check.js';
|
|
11
11
|
import { shouldBypassManagedResourceMismatchGate } from './cli-policy.js';
|
|
12
12
|
import { shouldRedirectAutoToHeadless } from './cli-auto-routing.js';
|
|
13
|
+
import { resolvePrintModeExitCode } from './print-mode-exit.js';
|
|
13
14
|
import { printHelp, printSubcommandHelp } from './help-text.js';
|
|
14
15
|
import { applySecurityOverrides } from './security-overrides.js';
|
|
15
16
|
import { validateConfiguredModel } from './startup-model-validation.js';
|
|
@@ -691,7 +692,10 @@ if (isPrintMode) {
|
|
|
691
692
|
mode: mode,
|
|
692
693
|
messages: cliFlags.messages,
|
|
693
694
|
});
|
|
694
|
-
|
|
695
|
+
// Honor any exit code a slash command or extension handler set during the
|
|
696
|
+
// turn (e.g. a machine-readable verdict for headless orchestrators); default
|
|
697
|
+
// to 0 when none was set.
|
|
698
|
+
process.exit(resolvePrintModeExitCode(process.exitCode));
|
|
695
699
|
}
|
|
696
700
|
// ---------------------------------------------------------------------------
|
|
697
701
|
// Worktree flag (-w) — create/resume a worktree for the interactive session
|
|
@@ -38,7 +38,8 @@ export declare function mapStatusToExitCode(status: string): number;
|
|
|
38
38
|
* "Auto-mode paused..."
|
|
39
39
|
* "Step-mode paused..."
|
|
40
40
|
* plus bootstrap-time manual-resolution failures that return before auto-mode
|
|
41
|
-
* can emit a formal pause/stop notification
|
|
41
|
+
* can emit a formal pause/stop notification, plus interactive menus that could
|
|
42
|
+
* not render headlessly (a dead-end that returns without dispatching). (#1294)
|
|
42
43
|
*
|
|
43
44
|
* Does NOT match progress notifications that happen to contain words like
|
|
44
45
|
* "complete" or "stopped" (e.g., "Override resolved — rewrite-docs completed",
|
package/dist/headless-events.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* lives in the Stop Notice module — the same module the emitters format with,
|
|
11
11
|
* so wording stays in lockstep with detection.
|
|
12
12
|
*/
|
|
13
|
-
import { isBlockedNoticeMessage, isManualResolutionNotice, isPauseNotice, isTerminalNotice, } from './resources/extensions/gsd/stop-notice.js';
|
|
13
|
+
import { isBlockedNoticeMessage, isInteractiveMenuUnavailableNotice, isManualResolutionNotice, isPauseNotice, isTerminalNotice, } from './resources/extensions/gsd/stop-notice.js';
|
|
14
14
|
import { canonicalToolName } from './resources/extensions/gsd/engine-hook-contract.js';
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
16
16
|
// Exit Code Constants
|
|
@@ -63,7 +63,8 @@ export function mapStatusToExitCode(status) {
|
|
|
63
63
|
* "Auto-mode paused..."
|
|
64
64
|
* "Step-mode paused..."
|
|
65
65
|
* plus bootstrap-time manual-resolution failures that return before auto-mode
|
|
66
|
-
* can emit a formal pause/stop notification
|
|
66
|
+
* can emit a formal pause/stop notification, plus interactive menus that could
|
|
67
|
+
* not render headlessly (a dead-end that returns without dispatching). (#1294)
|
|
67
68
|
*
|
|
68
69
|
* Does NOT match progress notifications that happen to contain words like
|
|
69
70
|
* "complete" or "stopped" (e.g., "Override resolved — rewrite-docs completed",
|
|
@@ -107,7 +108,14 @@ export function isTerminalNotification(event) {
|
|
|
107
108
|
if (event.type !== 'extension_ui_request' || event.method !== 'notify')
|
|
108
109
|
return false;
|
|
109
110
|
const message = String(event.message ?? '').toLowerCase();
|
|
110
|
-
|
|
111
|
+
// A menu that could not render headlessly is a terminal dead-end: the
|
|
112
|
+
// extension already returned without dispatching, so nothing else will fire.
|
|
113
|
+
// Resolve the run (as blocked, via isBlockedNotification) instead of idling
|
|
114
|
+
// forever waiting for a completion signal. (#1294)
|
|
115
|
+
return (isTerminalNotice(message) ||
|
|
116
|
+
isPauseNotice(message) ||
|
|
117
|
+
isManualResolutionNotice(message) ||
|
|
118
|
+
isInteractiveMenuUnavailableNotice(message));
|
|
111
119
|
}
|
|
112
120
|
export function isBlockedNotification(event) {
|
|
113
121
|
if (isBlockingCommandBlock(event))
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface MilestoneExecutionSnapshot {
|
|
2
|
+
milestones: Record<string, {
|
|
3
|
+
status: string;
|
|
4
|
+
sliceCount: number;
|
|
5
|
+
dependsOn: string[];
|
|
6
|
+
}>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Capture the milestone execution state before a `new-milestone --auto` run.
|
|
10
|
+
* Missing DBs are treated as an empty pre-run snapshot; unreadable DBs return
|
|
11
|
+
* null so callers can conservatively skip the DB fallback.
|
|
12
|
+
*/
|
|
13
|
+
export declare function captureMilestoneExecutionSnapshot(basePath: string): MilestoneExecutionSnapshot | null;
|
|
14
|
+
export declare function findExecutableMilestoneInDb(basePath: string, options?: {
|
|
15
|
+
changedSince?: MilestoneExecutionSnapshot;
|
|
16
|
+
}): string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Return true when the workflow DB for `basePath` holds an executable milestone —
|
|
19
|
+
* an active (non-terminal) milestone with at least one slice — meaning auto-mode
|
|
20
|
+
* has real work to pick up.
|
|
21
|
+
* When `changedSince` is supplied, the executable milestone must also be newly
|
|
22
|
+
* created or materially changed since that snapshot.
|
|
23
|
+
*
|
|
24
|
+
* Never throws: returns false when the DB is missing or cannot be opened/queried,
|
|
25
|
+
* so the caller can fall back to the notify-text signal.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isMilestoneExecutableInDb(basePath: string, options?: {
|
|
28
|
+
changedSince?: MilestoneExecutionSnapshot;
|
|
29
|
+
}): boolean;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// Project/App Name: gsd-pi + DB-authoritative milestone readiness for `--auto` chaining
|
|
2
|
+
// Copyright (c) 2026 Jeremy McSpadden <jeremy@fluxlabs.net>
|
|
3
|
+
//
|
|
4
|
+
// The `new-milestone --auto` chain decision historically hinged on regex-matching
|
|
5
|
+
// a specific notify string ("Milestone <id> ready."), which is only emitted on one
|
|
6
|
+
// of several planning success paths. Any run that finishes planning through a
|
|
7
|
+
// different branch — or takes an early-return handoff path — completes successfully
|
|
8
|
+
// yet never chains into execution (issue #1295).
|
|
9
|
+
//
|
|
10
|
+
// This module makes the decision authoritative by querying the workflow DB directly:
|
|
11
|
+
// a milestone is executable when the derived active (non-terminal) milestone has at
|
|
12
|
+
// least one slice. For `new-milestone --auto`, callers can pass a pre-run snapshot
|
|
13
|
+
// so the fallback only trusts readiness produced by the current planning command.
|
|
14
|
+
// The notify-text signal remains a fast path; this is the deciding fallback.
|
|
15
|
+
import { existsSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { closeWorkflowDatabase, openExistingWorkflowDatabase, } from './resources/extensions/gsd/db-workspace.js';
|
|
18
|
+
import { getAllMilestones, getMilestoneSlices, getSlicesByMilestoneIds, } from './resources/extensions/gsd/gsd-db.js';
|
|
19
|
+
import { classifyMilestoneReadiness } from './resources/extensions/gsd/milestone-readiness.js';
|
|
20
|
+
import { buildMilestoneFileName, resolveFile, resolveMilestonePath, } from './resources/extensions/gsd/paths.js';
|
|
21
|
+
import { isClosedStatus } from './resources/extensions/gsd/status-guards.js';
|
|
22
|
+
function milestoneArtifactExistsInResolvedDir(milestoneDir, milestoneId, suffix) {
|
|
23
|
+
if (!milestoneDir)
|
|
24
|
+
return false;
|
|
25
|
+
const flatPath = join(milestoneDir, buildMilestoneFileName(milestoneId, suffix));
|
|
26
|
+
return existsSync(flatPath) || resolveFile(milestoneDir, milestoneId, suffix) !== null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Mirror `buildRegistryAndFindActive` active-milestone selection: defer queued-shell
|
|
30
|
+
* milestones (queued, no context, zero slices) so a later planned milestone is
|
|
31
|
+
* treated as active instead of an older orphan shell (#1295).
|
|
32
|
+
*/
|
|
33
|
+
function findDerivedActiveMilestone(basePath) {
|
|
34
|
+
const milestones = getAllMilestones();
|
|
35
|
+
const completeMilestoneIds = new Set();
|
|
36
|
+
const parkedMilestoneIds = new Set();
|
|
37
|
+
for (const m of milestones) {
|
|
38
|
+
if (m.status === 'parked') {
|
|
39
|
+
parkedMilestoneIds.add(m.id);
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (isClosedStatus(m.status)) {
|
|
43
|
+
completeMilestoneIds.add(m.id);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const activeMilestoneIds = milestones
|
|
47
|
+
.filter((m) => !parkedMilestoneIds.has(m.id))
|
|
48
|
+
.map((m) => m.id);
|
|
49
|
+
const slicesByMilestone = getSlicesByMilestoneIds(activeMilestoneIds);
|
|
50
|
+
let firstDeferredQueuedShell = null;
|
|
51
|
+
let activeMilestoneFound = false;
|
|
52
|
+
for (const m of milestones) {
|
|
53
|
+
if (parkedMilestoneIds.has(m.id))
|
|
54
|
+
continue;
|
|
55
|
+
if (completeMilestoneIds.has(m.id))
|
|
56
|
+
continue;
|
|
57
|
+
const slices = slicesByMilestone.get(m.id) ?? [];
|
|
58
|
+
const milestoneDir = resolveMilestonePath(basePath, m.id);
|
|
59
|
+
const hasContext = milestoneArtifactExistsInResolvedDir(milestoneDir, m.id, 'CONTEXT');
|
|
60
|
+
const hasDraftContext = !hasContext && milestoneArtifactExistsInResolvedDir(milestoneDir, m.id, 'CONTEXT-DRAFT');
|
|
61
|
+
const readiness = classifyMilestoneReadiness({
|
|
62
|
+
status: m.status,
|
|
63
|
+
hasContext,
|
|
64
|
+
hasDraftContext,
|
|
65
|
+
sliceCount: slices.length,
|
|
66
|
+
});
|
|
67
|
+
if (!activeMilestoneFound) {
|
|
68
|
+
const depsUnmet = m.depends_on.some((dep) => !completeMilestoneIds.has(dep));
|
|
69
|
+
if (depsUnmet)
|
|
70
|
+
continue;
|
|
71
|
+
if (readiness.kind === 'queued-shell') {
|
|
72
|
+
if (!firstDeferredQueuedShell)
|
|
73
|
+
firstDeferredQueuedShell = m;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
activeMilestoneFound = true;
|
|
77
|
+
return m;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return firstDeferredQueuedShell;
|
|
81
|
+
}
|
|
82
|
+
function buildMilestoneExecutionSnapshot() {
|
|
83
|
+
const milestones = getAllMilestones();
|
|
84
|
+
const slicesByMilestone = getSlicesByMilestoneIds(milestones.map((m) => m.id));
|
|
85
|
+
const snapshot = { milestones: {} };
|
|
86
|
+
for (const milestone of milestones) {
|
|
87
|
+
snapshot.milestones[milestone.id] = {
|
|
88
|
+
status: milestone.status,
|
|
89
|
+
sliceCount: (slicesByMilestone.get(milestone.id) ?? []).length,
|
|
90
|
+
dependsOn: milestone.depends_on,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return snapshot;
|
|
94
|
+
}
|
|
95
|
+
function milestoneSnapshotEntryChanged(before, after) {
|
|
96
|
+
if (!after)
|
|
97
|
+
return false;
|
|
98
|
+
if (!before)
|
|
99
|
+
return true;
|
|
100
|
+
return (before.status !== after.status ||
|
|
101
|
+
before.sliceCount !== after.sliceCount ||
|
|
102
|
+
before.dependsOn.join('\0') !== after.dependsOn.join('\0'));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Capture the milestone execution state before a `new-milestone --auto` run.
|
|
106
|
+
* Missing DBs are treated as an empty pre-run snapshot; unreadable DBs return
|
|
107
|
+
* null so callers can conservatively skip the DB fallback.
|
|
108
|
+
*/
|
|
109
|
+
export function captureMilestoneExecutionSnapshot(basePath) {
|
|
110
|
+
const opened = openExistingWorkflowDatabase(basePath);
|
|
111
|
+
if (!opened.ok) {
|
|
112
|
+
return opened.reason === 'missing-database' || opened.reason === 'missing-gsd-dir'
|
|
113
|
+
? { milestones: {} }
|
|
114
|
+
: null;
|
|
115
|
+
}
|
|
116
|
+
try {
|
|
117
|
+
return buildMilestoneExecutionSnapshot();
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
closeWorkflowDatabase();
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export function findExecutableMilestoneInDb(basePath, options = {}) {
|
|
127
|
+
const opened = openExistingWorkflowDatabase(basePath);
|
|
128
|
+
if (!opened.ok)
|
|
129
|
+
return null;
|
|
130
|
+
try {
|
|
131
|
+
const active = findDerivedActiveMilestone(basePath);
|
|
132
|
+
if (active == null || getMilestoneSlices(active.id).length === 0)
|
|
133
|
+
return null;
|
|
134
|
+
if (options.changedSince) {
|
|
135
|
+
const after = buildMilestoneExecutionSnapshot();
|
|
136
|
+
if (!milestoneSnapshotEntryChanged(options.changedSince.milestones[active.id], after.milestones[active.id])) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return active.id;
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
closeWorkflowDatabase();
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Return true when the workflow DB for `basePath` holds an executable milestone —
|
|
151
|
+
* an active (non-terminal) milestone with at least one slice — meaning auto-mode
|
|
152
|
+
* has real work to pick up.
|
|
153
|
+
* When `changedSince` is supplied, the executable milestone must also be newly
|
|
154
|
+
* created or materially changed since that snapshot.
|
|
155
|
+
*
|
|
156
|
+
* Never throws: returns false when the DB is missing or cannot be opened/queried,
|
|
157
|
+
* so the caller can fall back to the notify-text signal.
|
|
158
|
+
*/
|
|
159
|
+
export function isMilestoneExecutableInDb(basePath, options = {}) {
|
|
160
|
+
return findExecutableMilestoneInDb(basePath, options) != null;
|
|
161
|
+
}
|
package/dist/headless.js
CHANGED
|
@@ -22,6 +22,7 @@ import { isTerminalNotification, isBlockedNotification, isMilestoneReadyNotifica
|
|
|
22
22
|
import { VALID_OUTPUT_FORMATS } from './headless-types.js';
|
|
23
23
|
import { handleExtensionUIRequest, formatProgress, formatThinkingLine, formatTextStart, formatTextEnd, formatThinkingStart, formatThinkingEnd, startSupervisedStdinReader, } from './headless-ui.js';
|
|
24
24
|
import { loadContext, bootstrapGsdProject, } from './headless-context.js';
|
|
25
|
+
import { captureMilestoneExecutionSnapshot, isMilestoneExecutableInDb, } from './headless-milestone-readiness.js';
|
|
25
26
|
const HEADLESS_CHAIN_AUTO_FLAG = '--headless-chain-auto';
|
|
26
27
|
export function buildHeadlessSlashCommand(options) {
|
|
27
28
|
const commandArgs = [...options.commandArgs];
|
|
@@ -159,6 +160,13 @@ export function parseHeadlessArgs(argv) {
|
|
|
159
160
|
else if (arg === '--bare') {
|
|
160
161
|
options.bare = true;
|
|
161
162
|
}
|
|
163
|
+
else {
|
|
164
|
+
// Unrecognized flag: pass it through to the slash command verbatim
|
|
165
|
+
// instead of silently dropping it. This lets subcommand flags such as
|
|
166
|
+
// `verdict pass --rationale "..."` reach the assembled slash command
|
|
167
|
+
// (#1297). Known headless flags above still win regardless of position.
|
|
168
|
+
options.commandArgs.push(arg);
|
|
169
|
+
}
|
|
162
170
|
}
|
|
163
171
|
else if (options.command === 'auto') {
|
|
164
172
|
options.command = arg;
|
|
@@ -852,6 +860,9 @@ async function runHeadlessOnce(options, restartCount) {
|
|
|
852
860
|
}
|
|
853
861
|
});
|
|
854
862
|
}
|
|
863
|
+
const preRunMilestoneSnapshot = isNewMilestone && options.auto
|
|
864
|
+
? captureMilestoneExecutionSnapshot(process.cwd())
|
|
865
|
+
: null;
|
|
855
866
|
// Send the command
|
|
856
867
|
const command = buildHeadlessSlashCommand(options);
|
|
857
868
|
if (!options.json) {
|
|
@@ -868,8 +879,20 @@ async function runHeadlessOnce(options, restartCount) {
|
|
|
868
879
|
if (exitCode === EXIT_SUCCESS || exitCode === EXIT_BLOCKED) {
|
|
869
880
|
await completionPromise;
|
|
870
881
|
}
|
|
871
|
-
// Auto-mode chaining: if --auto and milestone creation succeeded, send /gsd auto
|
|
872
|
-
|
|
882
|
+
// Auto-mode chaining: if --auto and milestone creation succeeded, send /gsd auto.
|
|
883
|
+
//
|
|
884
|
+
// The chain decision is DB-authoritative. `milestoneReady` (regex on a notify
|
|
885
|
+
// string) is only a fast path — it fires on just one of several planning
|
|
886
|
+
// success branches, so "planning succeeded" frequently does not imply the
|
|
887
|
+
// "ready" text was emitted. When the fast path misses, fall back to querying
|
|
888
|
+
// the milestone readiness changed by this command and chain if it is executable
|
|
889
|
+
// (issue #1295).
|
|
890
|
+
const dbMilestoneReady = preRunMilestoneSnapshot
|
|
891
|
+
? isMilestoneExecutableInDb(process.cwd(), { changedSince: preRunMilestoneSnapshot })
|
|
892
|
+
: false;
|
|
893
|
+
const shouldChainAuto = isNewMilestone && options.auto && !blocked && exitCode === EXIT_SUCCESS &&
|
|
894
|
+
(milestoneReady || dbMilestoneReady);
|
|
895
|
+
if (shouldChainAuto) {
|
|
873
896
|
if (!options.json) {
|
|
874
897
|
process.stderr.write('[headless] Milestone ready — chaining into auto-mode...\n');
|
|
875
898
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the process exit code the CLI should use after `runPrintMode`
|
|
3
|
+
* completes.
|
|
4
|
+
*
|
|
5
|
+
* Print mode previously always exited 0, discarding any `process.exitCode` a
|
|
6
|
+
* slash command or extension handler set during the turn (e.g. a machine
|
|
7
|
+
* readable verdict for a headless orchestrator). Honor a code that was set;
|
|
8
|
+
* default to 0 when none was.
|
|
9
|
+
*
|
|
10
|
+
* Regression: #1293
|
|
11
|
+
*/
|
|
12
|
+
export declare function resolvePrintModeExitCode(exitCode: NodeJS.Process['exitCode']): string | number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the process exit code the CLI should use after `runPrintMode`
|
|
3
|
+
* completes.
|
|
4
|
+
*
|
|
5
|
+
* Print mode previously always exited 0, discarding any `process.exitCode` a
|
|
6
|
+
* slash command or extension handler set during the turn (e.g. a machine
|
|
7
|
+
* readable verdict for a headless orchestrator). Honor a code that was set;
|
|
8
|
+
* default to 0 when none was.
|
|
9
|
+
*
|
|
10
|
+
* Regression: #1293
|
|
11
|
+
*/
|
|
12
|
+
export function resolvePrintModeExitCode(exitCode) {
|
|
13
|
+
return exitCode ?? 0;
|
|
14
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
4c3ea176cf8f5545
|
|
@@ -121,7 +121,7 @@ The boundary map is a **planning artifact** — not runnable code. It:
|
|
|
121
121
|
- Enables deterministic verification that slices actually connect
|
|
122
122
|
- Gets updated during slice planning if new interfaces emerge
|
|
123
123
|
|
|
124
|
-
###
|
|
124
|
+
### `<NN>-<MM>-PLAN.md` (slice-level, with embedded task planning)
|
|
125
125
|
|
|
126
126
|
```markdown
|
|
127
127
|
# S01: Slice Title
|
|
@@ -136,53 +136,22 @@ The boundary map is a **planning artifact** — not runnable code. It:
|
|
|
136
136
|
## Tasks
|
|
137
137
|
|
|
138
138
|
- [ ] **T01: Task Title**
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
Why this task matters, what to change, and what "done" means.
|
|
140
|
+
- Files: `src/path/to/file.ts`
|
|
141
|
+
- Verify: `npm test`
|
|
142
|
+
- Must-haves:
|
|
143
|
+
- Observable behavior that must be true when this task is done
|
|
144
|
+
- Files or wiring that must exist with real implementation
|
|
145
|
+
|
|
141
146
|
- [ ] **T02: Another Task**
|
|
142
|
-
|
|
147
|
+
Why / Do / Done-when detail for the next task.
|
|
143
148
|
|
|
144
149
|
## Files Likely Touched
|
|
145
150
|
- path/to/file.ts
|
|
146
151
|
- path/to/another.ts
|
|
147
152
|
```
|
|
148
153
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
```markdown
|
|
152
|
-
# T01: Task Title
|
|
153
|
-
|
|
154
|
-
**Slice:** S01
|
|
155
|
-
**Milestone:** M001
|
|
156
|
-
|
|
157
|
-
## Goal
|
|
158
|
-
What this task accomplishes in one sentence.
|
|
159
|
-
|
|
160
|
-
## Must-Haves
|
|
161
|
-
|
|
162
|
-
### Truths
|
|
163
|
-
Observable behaviors that must be true when this task is done:
|
|
164
|
-
- "User can sign up with email and password"
|
|
165
|
-
- "Login returns a JWT token"
|
|
166
|
-
|
|
167
|
-
### Artifacts
|
|
168
|
-
Files that must exist with real implementation (not stubs):
|
|
169
|
-
- `src/lib/auth.ts` — JWT helpers (min 30 lines, exports: generateToken, verifyToken)
|
|
170
|
-
- `src/app/api/auth/login/route.ts` — Login endpoint (exports: POST)
|
|
171
|
-
|
|
172
|
-
### Key Links
|
|
173
|
-
Critical wiring between artifacts:
|
|
174
|
-
- `login/route.ts` → `auth.ts` via import of `generateToken`
|
|
175
|
-
- `middleware.ts` → `auth.ts` via import of `verifyToken`
|
|
176
|
-
|
|
177
|
-
## Steps
|
|
178
|
-
1. First thing to do
|
|
179
|
-
2. Second thing to do
|
|
180
|
-
3. Third thing to do
|
|
181
|
-
|
|
182
|
-
## Context
|
|
183
|
-
- Relevant prior decisions or patterns to follow
|
|
184
|
-
- Key files to read before starting
|
|
185
|
-
```
|
|
154
|
+
Task plan content lives inside the slice plan. There is no standalone task-level PLAN file in the flat-phase layout; layout-aware task PLAN paths resolve to the owning `<NN>-<MM>-PLAN.md`.
|
|
186
155
|
|
|
187
156
|
**Must-haves are what make verification mechanically checkable.** Truths are checked by running commands or reading output. Artifacts are checked by confirming files exist with real content. Key links are checked by confirming imports/references actually connect the pieces.
|
|
188
157
|
|
|
@@ -322,7 +291,7 @@ The **Don't Hand-Roll** and **Common Pitfalls** sections prevent the most expens
|
|
|
322
291
|
### Phase 3: Plan
|
|
323
292
|
|
|
324
293
|
**Purpose:** Decompose work into context-window-sized tasks with must-haves.
|
|
325
|
-
**Produces:**
|
|
294
|
+
**Produces:** `<NN>-<MM>-PLAN.md` with task planning embedded in the slice plan.
|
|
326
295
|
|
|
327
296
|
**For a milestone (roadmap):**
|
|
328
297
|
1. Read `CONTEXT.md`, `M###-RESEARCH.md`, and `.gsd/DECISIONS.md` if they exist.
|
|
@@ -339,7 +308,7 @@ The **Don't Hand-Roll** and **Common Pitfalls** sections prevent the most expens
|
|
|
339
308
|
5. Decompose into 1-7 tasks, each fitting one context window.
|
|
340
309
|
6. Each task needs: title, description, steps (3-10), must-haves (observable verification criteria).
|
|
341
310
|
7. Must-haves should reference boundary map contracts — e.g. "exports `generateToken()` as specified in boundary map S01→S02".
|
|
342
|
-
8. Write
|
|
311
|
+
8. Write `<NN>-<MM>-PLAN.md` with the slice contract and embedded task planning. Do not write standalone task plan files.
|
|
343
312
|
|
|
344
313
|
### Phase 4: Execute
|
|
345
314
|
|
|
@@ -347,7 +316,7 @@ The **Don't Hand-Roll** and **Common Pitfalls** sections prevent the most expens
|
|
|
347
316
|
**Produces:** Code changes + `[DONE:n]` markers.
|
|
348
317
|
|
|
349
318
|
**How to do it manually:**
|
|
350
|
-
1. Read the
|
|
319
|
+
1. Read the active slice's `<NN>-<MM>-PLAN.md` and use the selected task entry as the task plan.
|
|
351
320
|
2. Read relevant summaries from prior tasks (for context on what's already built).
|
|
352
321
|
3. Execute each step. Mark progress with `[DONE:n]` in responses.
|
|
353
322
|
4. If you made an architectural, pattern, or library decision, append it to `.gsd/DECISIONS.md`.
|
|
@@ -459,7 +428,7 @@ key_decisions: []
|
|
|
459
428
|
**Purpose:** Mark work done and move to the next thing.
|
|
460
429
|
|
|
461
430
|
**After a task completes:**
|
|
462
|
-
1. Mark the task done in
|
|
431
|
+
1. Mark the task done in `<NN>-<MM>-PLAN.md` (checkbox).
|
|
463
432
|
2. Check if there's a next task in the slice → execute it.
|
|
464
433
|
3. If slice is complete → write slice summary, mark slice done in `ROADMAP.md`.
|
|
465
434
|
|
|
@@ -524,7 +493,7 @@ It is NOT the source of truth. It's a convenience dashboard.
|
|
|
524
493
|
|
|
525
494
|
**Sources of truth:**
|
|
526
495
|
- `ROADMAP.md` → which slices exist and which are done
|
|
527
|
-
-
|
|
496
|
+
- `<NN>-<MM>-PLAN.md` → which tasks exist within a slice and what each task must do
|
|
528
497
|
- `T##-SUMMARY.md` → what happened during a task
|
|
529
498
|
- `S##-SUMMARY.md` and `M###-SUMMARY.md` → compressed slice and milestone outcomes
|
|
530
499
|
|
|
@@ -642,7 +611,7 @@ This methodology doc is generic. Project-specific guidance belongs in the milest
|
|
|
642
611
|
1. Read `.gsd/STATE.md` — what's the next action?
|
|
643
612
|
2. Check for `continue.md` in the active slice — is there interrupted work?
|
|
644
613
|
3. If resuming: read `continue.md`, delete it, pick up from "Next Action".
|
|
645
|
-
4. If starting fresh: read the active slice's
|
|
614
|
+
4. If starting fresh: read the active slice's `<NN>-<MM>-PLAN.md`, find the next incomplete task.
|
|
646
615
|
5. If in a planning or research phase, read `.gsd/DECISIONS.md` — respect existing decisions.
|
|
647
616
|
6. Read relevant summaries from prior tasks/slices for context.
|
|
648
617
|
7. Do the work.
|
|
@@ -4,55 +4,12 @@
|
|
|
4
4
|
* Functions for capturing compact page state, screenshots, and summaries.
|
|
5
5
|
* Used by tool implementations for post-action feedback.
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// Raspberry Pi). constrainScreenshot falls back to returning the raw buffer
|
|
10
|
-
// when sharp is not installed, which means screenshots won't be resized but
|
|
11
|
-
// the tool remains functional.
|
|
12
|
-
let _sharp;
|
|
13
|
-
async function getSharp() {
|
|
14
|
-
if (_sharp !== undefined)
|
|
15
|
-
return _sharp;
|
|
16
|
-
try {
|
|
17
|
-
_sharp = (await import("sharp")).default;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
_sharp = null;
|
|
21
|
-
}
|
|
22
|
-
return _sharp;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Test-only seam: override the cached sharp module. Pass `null` to simulate
|
|
26
|
-
* an environment where the sharp native dep is unavailable; pass `undefined`
|
|
27
|
-
* to clear the cache and let the next getSharp() call re-import. See
|
|
28
|
-
* tests/capture-sharp-optional.test.cjs.
|
|
29
|
-
*/
|
|
30
|
-
export function __setSharpForTesting(value) {
|
|
31
|
-
_sharp = value;
|
|
32
|
-
}
|
|
7
|
+
import { constrainScreenshot } from "./screenshot-constraints.js";
|
|
8
|
+
export { constrainScreenshot, __setSharpForTesting } from "./screenshot-constraints.js";
|
|
33
9
|
import { formatCompactStateSummary } from "./utils.js";
|
|
34
|
-
// Anthropic vision: 1568px is the recommended optimal width. Height is capped
|
|
35
|
-
// generously at 8000px so tall full-page screenshots remain readable rather
|
|
36
|
-
// than being squished into a square constraint.
|
|
37
|
-
//
|
|
38
10
|
// Override via environment variables:
|
|
39
|
-
// SCREENSHOT_MAX_WIDTH=0 → uncap width (use raw resolution)
|
|
40
|
-
// SCREENSHOT_MAX_HEIGHT=0 → uncap height
|
|
41
11
|
// SCREENSHOT_FORMAT=png → lossless PNG for all viewport/fullpage screenshots
|
|
42
12
|
// SCREENSHOT_QUALITY=100 → max JPEG quality (1-100, default 80)
|
|
43
|
-
const MAX_SCREENSHOT_WIDTH = parseScreenshotDimension(process.env.SCREENSHOT_MAX_WIDTH, 1568);
|
|
44
|
-
const MAX_SCREENSHOT_HEIGHT = parseScreenshotDimension(process.env.SCREENSHOT_MAX_HEIGHT, 8000);
|
|
45
|
-
/** Parse a dimension env var: positive int = that value, 0 = Infinity (uncapped), absent/invalid = default. */
|
|
46
|
-
function parseScreenshotDimension(value, fallback) {
|
|
47
|
-
if (value === undefined || value === "")
|
|
48
|
-
return fallback;
|
|
49
|
-
const n = parseInt(value, 10);
|
|
50
|
-
if (isNaN(n) || n < 0)
|
|
51
|
-
return fallback;
|
|
52
|
-
if (n === 0)
|
|
53
|
-
return Infinity;
|
|
54
|
-
return n;
|
|
55
|
-
}
|
|
56
13
|
/** Return the user-configured screenshot format override, or null for default behavior. */
|
|
57
14
|
export function getScreenshotFormatOverride() {
|
|
58
15
|
const fmt = process.env.SCREENSHOT_FORMAT?.toLowerCase();
|
|
@@ -160,38 +117,6 @@ export async function postActionSummary(p, target) {
|
|
|
160
117
|
return "[summary unavailable]";
|
|
161
118
|
}
|
|
162
119
|
}
|
|
163
|
-
// ---------------------------------------------------------------------------
|
|
164
|
-
// Screenshot helpers
|
|
165
|
-
// ---------------------------------------------------------------------------
|
|
166
|
-
/**
|
|
167
|
-
* Constrain screenshot dimensions for the Anthropic vision API.
|
|
168
|
-
* Width is capped at 1568px (optimal) and height at 8000px, each
|
|
169
|
-
* independently, using `fit: "inside"` so aspect ratio is preserved.
|
|
170
|
-
* Small images are never upscaled.
|
|
171
|
-
*
|
|
172
|
-
* `page` parameter is retained for ToolDeps signature stability (D008)
|
|
173
|
-
* but is no longer used — all processing is server-side via sharp.
|
|
174
|
-
*/
|
|
175
|
-
export async function constrainScreenshot(_page, buffer, mimeType, quality) {
|
|
176
|
-
const sharp = await getSharp();
|
|
177
|
-
if (!sharp)
|
|
178
|
-
return buffer;
|
|
179
|
-
const meta = await sharp(buffer).metadata();
|
|
180
|
-
const width = meta.width;
|
|
181
|
-
const height = meta.height;
|
|
182
|
-
if (width === undefined || height === undefined)
|
|
183
|
-
return buffer;
|
|
184
|
-
if (width <= MAX_SCREENSHOT_WIDTH && height <= MAX_SCREENSHOT_HEIGHT)
|
|
185
|
-
return buffer;
|
|
186
|
-
const resizer = sharp(buffer).resize(MAX_SCREENSHOT_WIDTH, MAX_SCREENSHOT_HEIGHT, {
|
|
187
|
-
fit: "inside",
|
|
188
|
-
withoutEnlargement: true,
|
|
189
|
-
});
|
|
190
|
-
if (mimeType === "image/png") {
|
|
191
|
-
return Buffer.from(await resizer.png().toBuffer());
|
|
192
|
-
}
|
|
193
|
-
return Buffer.from(await resizer.jpeg({ quality }).toBuffer());
|
|
194
|
-
}
|
|
195
120
|
/** Capture a JPEG screenshot for error debugging. Returns base64 or null. */
|
|
196
121
|
export async function captureErrorScreenshot(p) {
|
|
197
122
|
if (!p)
|