@opengsd/gsd-pi 1.2.0-dev.4c756166 → 1.2.0-dev.6ccd27b3
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/dist/cli-model-override.d.ts +15 -0
- package/dist/cli-model-override.js +21 -0
- package/dist/cli-style.d.ts +17 -0
- package/dist/cli-style.js +28 -0
- package/dist/cli.js +2 -19
- package/dist/headless-events.d.ts +4 -2
- package/dist/headless-events.js +14 -34
- package/dist/loader.js +6 -4
- package/dist/mcp-server.js +2 -1
- package/dist/models-resolver.d.ts +3 -13
- package/dist/models-resolver.js +3 -22
- package/dist/register-agent-bundles.d.ts +11 -2
- package/dist/register-agent-bundles.js +18 -4
- package/dist/resource-loader.d.ts +10 -5
- package/dist/resource-loader.js +123 -20
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/GSD-WORKFLOW.md +5 -4
- package/dist/resources/extensions/ask-user-questions.js +3 -2
- package/dist/resources/extensions/async-jobs/async-bash-tool.js +30 -64
- package/dist/resources/extensions/async-jobs/await-tool.js +80 -12
- package/dist/resources/extensions/async-jobs/index.js +65 -0
- package/dist/resources/extensions/async-jobs/job-manager.js +12 -1
- package/dist/resources/extensions/bg-shell/bg-shell-command.js +6 -6
- package/dist/resources/extensions/bg-shell/bg-shell-tool.js +10 -7
- package/dist/resources/extensions/bg-shell/overlay.js +9 -6
- package/dist/resources/extensions/bg-shell/process-manager.js +54 -25
- package/dist/resources/extensions/bg-shell/readiness-detector.js +11 -0
- package/dist/resources/extensions/bg-shell/utilities.js +5 -2
- package/dist/resources/extensions/browser-tools/engine/managed-gsd-browser.js +209 -88
- package/dist/resources/extensions/browser-tools/engine/selection.js +73 -5
- package/dist/resources/extensions/browser-tools/index.js +69 -12
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +464 -200
- package/dist/resources/extensions/claude-code-cli/turn-assembler.js +33 -1
- package/dist/resources/extensions/gsd/auto/closeout.js +215 -0
- package/dist/resources/extensions/gsd/auto/custom-verify-retry-store.js +17 -2
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +33 -13
- package/dist/resources/extensions/gsd/auto/dispatch-history.js +120 -0
- package/dist/resources/extensions/gsd/auto/dispatch-key.js +37 -0
- package/dist/resources/extensions/gsd/auto/dispatch.js +365 -0
- package/dist/resources/extensions/gsd/auto/finalize.js +347 -0
- package/dist/resources/extensions/gsd/auto/loop.js +7 -1
- package/dist/resources/extensions/gsd/auto/milestone-lease-reclaim.js +56 -0
- package/dist/resources/extensions/gsd/auto/orchestrator.js +207 -73
- package/dist/resources/extensions/gsd/auto/phase-helpers.js +146 -0
- package/dist/resources/extensions/gsd/auto/phases.js +17 -2324
- package/dist/resources/extensions/gsd/auto/pre-dispatch.js +534 -0
- package/dist/resources/extensions/gsd/auto/session.js +3 -0
- package/dist/resources/extensions/gsd/auto/unit-phase.js +694 -0
- package/dist/resources/extensions/gsd/auto/workflow-unit-dispatch.js +1 -1
- package/dist/resources/extensions/gsd/auto/worktree-safety-phase.js +125 -0
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +11 -34
- package/dist/resources/extensions/gsd/auto-dispatch.js +50 -58
- package/dist/resources/extensions/gsd/auto-model-selection.js +36 -13
- package/dist/resources/extensions/gsd/auto-post-unit.js +43 -14
- package/dist/resources/extensions/gsd/auto-prompts.js +81 -19
- package/dist/resources/extensions/gsd/auto-start.js +47 -29
- package/dist/resources/extensions/gsd/auto-tool-tracking.js +18 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +45 -21
- package/dist/resources/extensions/gsd/auto-unit-tool-scope.js +12 -20
- package/dist/resources/extensions/gsd/auto-verification.js +23 -30
- package/dist/resources/extensions/gsd/auto-worktree-repair.js +10 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +50 -354
- package/dist/resources/extensions/gsd/auto.js +49 -22
- package/dist/resources/extensions/gsd/blocked-models.js +28 -0
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +29 -8
- package/dist/resources/extensions/gsd/bootstrap/dynamic-tools.js +69 -19
- package/dist/resources/extensions/gsd/bootstrap/exec-tools.js +2 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +19 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +229 -36
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +319 -71
- package/dist/resources/extensions/gsd/branch-patterns.js +2 -0
- package/dist/resources/extensions/gsd/browser-daemon-auto-prep.js +83 -0
- package/dist/resources/extensions/gsd/browser-evidence.js +8 -2
- package/dist/resources/extensions/gsd/captures.js +5 -15
- package/dist/resources/extensions/gsd/closeout-recovery.js +3 -2
- package/dist/resources/extensions/gsd/closeout-wizard.js +92 -0
- package/dist/resources/extensions/gsd/commands/catalog.js +6 -62
- package/dist/resources/extensions/gsd/commands/context.js +16 -2
- package/dist/resources/extensions/gsd/commands-handlers.js +46 -3
- package/dist/resources/extensions/gsd/commands-mcp-status.js +2 -2
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +9 -2
- package/dist/resources/extensions/gsd/consent-question.js +353 -0
- package/dist/resources/extensions/gsd/consent-verdict.js +63 -0
- package/dist/resources/extensions/gsd/constants.js +0 -2
- package/dist/resources/extensions/gsd/crash-recovery.js +12 -15
- package/dist/resources/extensions/gsd/db/engine.js +755 -0
- package/dist/resources/extensions/gsd/db/queries.js +428 -0
- package/dist/resources/extensions/gsd/db/sql-constants.js +11 -0
- package/dist/resources/extensions/gsd/db/writers/cascades.js +194 -0
- package/dist/resources/extensions/gsd/db/writers/import-restore.js +182 -0
- package/dist/resources/extensions/gsd/db/writers/memory.js +149 -0
- package/dist/resources/extensions/gsd/db/writers/reconcile.js +458 -0
- package/dist/resources/extensions/gsd/db/writers/status.js +70 -0
- package/dist/resources/extensions/gsd/db-writer.js +8 -17
- package/dist/resources/extensions/gsd/dispatch-guard.js +10 -35
- package/dist/resources/extensions/gsd/doctor-engine-checks.js +5 -5
- package/dist/resources/extensions/gsd/doctor-environment.js +261 -136
- package/dist/resources/extensions/gsd/doctor-format.js +9 -6
- package/dist/resources/extensions/gsd/doctor-git-checks.js +6 -21
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +21 -16
- package/dist/resources/extensions/gsd/engine-hook-contract.js +70 -0
- package/dist/resources/extensions/gsd/error-classifier.js +9 -0
- package/dist/resources/extensions/gsd/exec-sandbox.js +30 -10
- package/dist/resources/extensions/gsd/files.js +33 -19
- package/dist/resources/extensions/gsd/git-service.js +1 -0
- package/dist/resources/extensions/gsd/gitignore.js +3 -0
- package/dist/resources/extensions/gsd/gsd-command-home.js +22 -12
- package/dist/resources/extensions/gsd/gsd-db.js +172 -2048
- package/dist/resources/extensions/gsd/guidance.js +158 -0
- package/dist/resources/extensions/gsd/guided-flow.js +144 -9
- package/dist/resources/extensions/gsd/health-widget.js +87 -28
- package/dist/resources/extensions/gsd/markdown-renderer.js +10 -0
- package/dist/resources/extensions/gsd/mcp-bridge.js +10 -0
- package/dist/resources/extensions/gsd/mcp-filter.js +2 -19
- package/dist/resources/extensions/gsd/mcp-tool-name.js +5 -13
- package/dist/resources/extensions/gsd/memory-consolidation-scanner.js +1 -1
- package/dist/resources/extensions/gsd/migrate/safety.js +20 -9
- package/dist/resources/extensions/gsd/migration-auto-check.js +24 -3
- package/dist/resources/extensions/gsd/milestone-closeout.js +85 -24
- package/dist/resources/extensions/gsd/milestone-planning-persistence.js +2 -2
- package/dist/resources/extensions/gsd/milestone-reopen-events.js +3 -5
- package/dist/resources/extensions/gsd/milestone-settlement.js +2 -2
- package/dist/resources/extensions/gsd/model-cost-table.js +1 -0
- package/dist/resources/extensions/gsd/model-router.js +3 -0
- package/dist/resources/extensions/gsd/notification-store.js +11 -4
- package/dist/resources/extensions/gsd/notifications.js +12 -7
- package/dist/resources/extensions/gsd/parallel-merge.js +14 -11
- package/dist/resources/extensions/gsd/parallel-monitor-overlay.js +11 -7
- package/dist/resources/extensions/gsd/parsers-legacy.js +16 -4
- package/dist/resources/extensions/gsd/paths.js +37 -24
- package/dist/resources/extensions/gsd/pre-execution-checks.js +91 -3
- package/dist/resources/extensions/gsd/preferences-models.js +14 -48
- package/dist/resources/extensions/gsd/preferences.js +14 -0
- package/dist/resources/extensions/gsd/projection-flush.js +7 -0
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +4 -4
- package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +9 -5
- package/dist/resources/extensions/gsd/prompts/system.md +5 -2
- package/dist/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/dist/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/workflow-start.md +2 -1
- package/dist/resources/extensions/gsd/provider-error-guidance.js +1 -5
- package/dist/resources/extensions/gsd/provider-switch-observer.js +1 -1
- package/dist/resources/extensions/gsd/publication.js +87 -0
- package/dist/resources/extensions/gsd/reactive-graph.js +8 -1
- package/dist/resources/extensions/gsd/recovery-classification.js +41 -87
- package/dist/resources/extensions/gsd/roadmap-slices.js +25 -3
- package/dist/resources/extensions/gsd/safety/destructive-confirmation.js +108 -0
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +37 -4
- package/dist/resources/extensions/gsd/safety/evidence-cross-ref.js +7 -2
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +10 -0
- package/dist/resources/extensions/gsd/session-lock.js +1 -1
- package/dist/resources/extensions/gsd/skill-activation.js +3 -6
- package/dist/resources/extensions/gsd/state-transition-matrix.js +38 -0
- package/dist/resources/extensions/gsd/state.js +12 -22
- package/dist/resources/extensions/gsd/status-guards.js +56 -8
- package/dist/resources/extensions/gsd/stop-notice.js +57 -0
- package/dist/resources/extensions/gsd/tool-contract.js +14 -3
- package/dist/resources/extensions/gsd/tool-presentation-plan.js +4 -4
- package/dist/resources/extensions/gsd/tool-surface-readiness.js +108 -0
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +3 -2
- package/dist/resources/extensions/gsd/tools/complete-slice.js +46 -55
- package/dist/resources/extensions/gsd/tools/complete-task.js +65 -2
- package/dist/resources/extensions/gsd/tools/exec-tool.js +10 -8
- package/dist/resources/extensions/gsd/tools/plan-slice.js +14 -8
- package/dist/resources/extensions/gsd/tools/plan-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/reassess-roadmap.js +2 -2
- package/dist/resources/extensions/gsd/tools/reopen-milestone.js +13 -31
- package/dist/resources/extensions/gsd/tools/reopen-slice.js +16 -35
- package/dist/resources/extensions/gsd/tools/reopen-task.js +2 -2
- package/dist/resources/extensions/gsd/tools/replan-slice.js +2 -2
- package/dist/resources/extensions/gsd/tools/skip-slice.js +18 -36
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +67 -2
- package/dist/resources/extensions/gsd/uat-policy.js +42 -16
- package/dist/resources/extensions/gsd/undo.js +8 -7
- package/dist/resources/extensions/gsd/unit-closeout.js +138 -0
- package/dist/resources/extensions/gsd/unit-context-composer.js +74 -1
- package/dist/resources/extensions/gsd/unit-context-manifest.js +4 -27
- package/dist/resources/extensions/gsd/unit-registry.js +367 -0
- package/dist/resources/extensions/gsd/unit-tool-contracts.js +9 -182
- package/dist/resources/extensions/gsd/verdict-parser.js +1 -1
- package/dist/resources/extensions/gsd/verification-verdict.js +2 -1
- package/dist/resources/extensions/gsd/web-app-uat.js +45 -8
- package/dist/resources/extensions/gsd/workflow-event-ledger.js +91 -0
- package/dist/resources/extensions/gsd/workflow-event-vocabulary.js +46 -0
- package/dist/resources/extensions/gsd/workflow-events.js +6 -18
- package/dist/resources/extensions/gsd/workflow-mcp-auto-prep.js +2 -0
- package/dist/resources/extensions/gsd/workflow-mcp-readiness-cache.js +105 -0
- package/dist/resources/extensions/gsd/workflow-reconcile.js +21 -56
- package/dist/resources/extensions/gsd/workflow-tool-surface.js +1 -1
- package/dist/resources/extensions/gsd/worktree-git-recovery.js +293 -0
- package/dist/resources/extensions/gsd/worktree-lifecycle.js +12 -3
- package/dist/resources/extensions/gsd/worktree-manager.js +52 -29
- package/dist/resources/extensions/gsd/worktree-placement.js +59 -0
- package/dist/resources/extensions/gsd/worktree-reentry.js +12 -8
- package/dist/resources/extensions/gsd/worktree-root.js +28 -6
- package/dist/resources/extensions/gsd/worktree-safety.js +36 -31
- package/dist/resources/extensions/gsd/worktree-session-state.js +12 -11
- package/dist/resources/extensions/gsd/worktree.js +8 -1
- package/dist/resources/extensions/mcp-client/manager.js +6 -1
- package/dist/resources/extensions/search-the-web/native-search.js +5 -3
- package/dist/resources/extensions/shared/browser-contract.js +59 -0
- package/dist/resources/extensions/shared/gsd-browser-cli.js +116 -6
- package/dist/resources/shared/gsd-browser-path-sync.js +214 -0
- package/dist/resources/shared/package-manager-detection.js +1 -1
- package/dist/resources/shared/package.json +3 -0
- package/dist/resources/skills/create-skill/SKILL.md +3 -0
- package/dist/resources/skills/create-skill/references/executable-code.md +1 -1
- package/dist/resources/skills/create-skill/references/skill-structure.md +1 -0
- package/dist/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/dist/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/dist/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/dist/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/dist/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/dist/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/dist/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/runtime-checks.d.ts +10 -0
- package/dist/runtime-checks.js +27 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-check.d.ts +2 -0
- package/dist/update-check.js +24 -1
- package/dist/update-cmd.js +20 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +10 -10
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.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.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/mcp-connections/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/shutdown/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +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.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- 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 +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +10 -10
- package/dist/web/standalone/.next/server/chunks/5124.js +1 -1
- package/dist/web/standalone/.next/server/chunks/{5047.js → 5942.js} +2 -2
- package/dist/web/standalone/.next/server/chunks/8357.js +2 -2
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/server/server-reference-manifest.json +1 -1
- package/dist/web/standalone/.next/static/chunks/{796.cf859a427a2cb2ac.js → 796.e0bdc932325d7e03.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-fbea77b5f9953368.js → webpack-f0285ce91d4ec9ef.js} +1 -1
- package/dist/web/standalone/node_modules/node-pty/build/Makefile +1 -1
- package/dist/web/standalone/package.json +1 -1
- package/dist/worktree-cli.js +3 -6
- package/dist/worktree-status-banner.js +7 -11
- package/package.json +3 -3
- package/packages/cloud-mcp-gateway/package.json +2 -2
- package/packages/contracts/dist/rpc.d.ts +1 -0
- package/packages/contracts/dist/rpc.d.ts.map +1 -1
- package/packages/contracts/dist/rpc.js.map +1 -1
- package/packages/contracts/dist/workflow.d.ts +4 -0
- package/packages/contracts/dist/workflow.d.ts.map +1 -1
- package/packages/contracts/dist/workflow.js.map +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +4 -4
- package/packages/gsd-agent-core/dist/sdk.d.ts.map +1 -1
- package/packages/gsd-agent-core/dist/sdk.js +6 -4
- 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/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js +10 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts +13 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js +55 -6
- package/packages/gsd-agent-modes/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.d.ts +2 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js +34 -5
- package/packages/gsd-agent-modes/dist/modes/interactive/components/transcript-design.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js +7 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js +8 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/controllers/input-controller.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js +11 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-chat-render.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js +12 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js +4 -4
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-auth.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js +4 -0
- package/packages/gsd-agent-modes/dist/modes/interactive/interactive-selectors-settings.js.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js +3 -1
- package/packages/gsd-agent-modes/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/packages/gsd-agent-modes/package.json +7 -7
- package/packages/mcp-server/README.md +12 -3
- package/packages/mcp-server/dist/cli-runner.d.ts +40 -0
- package/packages/mcp-server/dist/cli-runner.d.ts.map +1 -0
- package/packages/mcp-server/dist/cli-runner.js +137 -0
- package/packages/mcp-server/dist/cli-runner.js.map +1 -0
- package/packages/mcp-server/dist/cli.js +2 -50
- package/packages/mcp-server/dist/cli.js.map +1 -1
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts +29 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js +50 -0
- package/packages/mcp-server/dist/moonshot-tool-schema.js.map +1 -0
- package/packages/mcp-server/dist/pid-registry.d.ts +46 -0
- package/packages/mcp-server/dist/pid-registry.d.ts.map +1 -0
- package/packages/mcp-server/dist/pid-registry.js +452 -0
- package/packages/mcp-server/dist/pid-registry.js.map +1 -0
- package/packages/mcp-server/dist/probe-mode.d.ts +4 -0
- package/packages/mcp-server/dist/probe-mode.d.ts.map +1 -0
- package/packages/mcp-server/dist/probe-mode.js +10 -0
- package/packages/mcp-server/dist/probe-mode.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +4 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/stdio-watchdog.d.ts +8 -0
- package/packages/mcp-server/dist/stdio-watchdog.d.ts.map +1 -0
- package/packages/mcp-server/dist/stdio-watchdog.js +40 -0
- package/packages/mcp-server/dist/stdio-watchdog.js.map +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts +26 -18
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +207 -102
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +5 -4
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/dist/agent-loop.js +43 -2
- package/packages/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts +1 -0
- package/packages/pi-agent-core/dist/harness/env/nodejs.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/harness/env/nodejs.js +34 -3
- package/packages/pi-agent-core/dist/harness/env/nodejs.js.map +1 -1
- package/packages/pi-agent-core/dist/index.d.ts +1 -0
- package/packages/pi-agent-core/dist/index.d.ts.map +1 -1
- package/packages/pi-agent-core/dist/index.js +3 -0
- package/packages/pi-agent-core/dist/index.js.map +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/README.md +1 -0
- package/packages/pi-ai/dist/image-models.generated.d.ts +2 -2
- package/packages/pi-ai/dist/image-models.generated.js +6 -6
- package/packages/pi-ai/dist/image-models.generated.js.map +1 -1
- package/packages/pi-ai/dist/index.d.ts +2 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +2 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.d.ts +158 -17
- package/packages/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/packages/pi-ai/dist/models.generated.js +132 -17
- package/packages/pi-ai/dist/models.generated.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +12 -7
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.d.ts +5 -0
- package/packages/pi-ai/dist/providers/google-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/google-shared.js +12 -3
- package/packages/pi-ai/dist/providers/google-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/openai-completions.js +7 -3
- package/packages/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts +9 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js +34 -0
- package/packages/pi-ai/dist/utils/moonshot-tool-schema.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js +6 -2
- package/packages/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/packages/pi-ai/package.json +3 -2
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +2 -2
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +19 -13
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js +3 -1
- package/packages/pi-coding-agent/dist/core/capability-patches.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/provider-readiness.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/provider-readiness.js +13 -6
- package/packages/pi-coding-agent/dist/core/provider-readiness.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +3 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +11 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts +11 -0
- package/packages/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/bash.js +53 -11
- package/packages/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/theme/theme.js +45 -17
- package/packages/pi-coding-agent/dist/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/utils/shell.d.ts +28 -2
- package/packages/pi-coding-agent/dist/utils/shell.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/utils/shell.js +56 -10
- package/packages/pi-coding-agent/dist/utils/shell.js.map +1 -1
- package/packages/pi-coding-agent/package.json +7 -7
- package/packages/pi-tui/dist/index.d.ts +1 -1
- package/packages/pi-tui/dist/index.d.ts.map +1 -1
- package/packages/pi-tui/dist/index.js +1 -1
- package/packages/pi-tui/dist/index.js.map +1 -1
- package/packages/pi-tui/dist/terminal-image.d.ts +33 -0
- package/packages/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/packages/pi-tui/dist/terminal-image.js +54 -2
- package/packages/pi-tui/dist/terminal-image.js.map +1 -1
- package/packages/pi-tui/dist/tui.d.ts +8 -0
- package/packages/pi-tui/dist/tui.d.ts.map +1 -1
- package/packages/pi-tui/dist/tui.js +72 -18
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/dist/utils.d.ts.map +1 -1
- package/packages/pi-tui/dist/utils.js +110 -36
- package/packages/pi-tui/dist/utils.js.map +1 -1
- package/packages/pi-tui/package.json +2 -2
- package/packages/rpc-client/package.json +2 -2
- package/pkg/dist/theme/theme.d.ts.map +1 -1
- package/pkg/dist/theme/theme.js +45 -17
- package/pkg/dist/theme/theme.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/GSD-WORKFLOW.md +5 -4
- package/src/resources/extensions/ask-user-questions.ts +7 -2
- package/src/resources/extensions/async-jobs/async-bash-cancel.test.ts +360 -0
- package/src/resources/extensions/async-jobs/async-bash-tool.ts +33 -56
- package/src/resources/extensions/async-jobs/await-tool.test.ts +139 -0
- package/src/resources/extensions/async-jobs/await-tool.ts +82 -12
- package/src/resources/extensions/async-jobs/index.ts +79 -0
- package/src/resources/extensions/async-jobs/job-manager.ts +21 -1
- package/src/resources/extensions/bg-shell/bg-shell-command.ts +6 -6
- package/src/resources/extensions/bg-shell/bg-shell-tool.ts +10 -6
- package/src/resources/extensions/bg-shell/overlay.ts +9 -5
- package/src/resources/extensions/bg-shell/process-manager.ts +50 -25
- package/src/resources/extensions/bg-shell/readiness-detector.ts +12 -0
- package/src/resources/extensions/bg-shell/tests/lifecycle-and-utilities.test.ts +48 -1
- package/src/resources/extensions/bg-shell/utilities.ts +5 -2
- package/src/resources/extensions/browser-tools/engine/managed-gsd-browser.ts +265 -98
- package/src/resources/extensions/browser-tools/engine/selection.ts +90 -4
- package/src/resources/extensions/browser-tools/index.ts +71 -13
- package/src/resources/extensions/browser-tools/tests/browser-engine-selection.test.mjs +83 -13
- package/src/resources/extensions/browser-tools/tests/gsd-browser-launch-config.test.mjs +40 -1
- package/src/resources/extensions/browser-tools/tests/managed-gsd-browser-tools.test.mjs +136 -0
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +543 -202
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +700 -7
- package/src/resources/extensions/claude-code-cli/turn-assembler.ts +38 -1
- package/src/resources/extensions/gsd/auto/closeout.ts +309 -0
- package/src/resources/extensions/gsd/auto/custom-verify-retry-store.ts +21 -3
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +32 -9
- package/src/resources/extensions/gsd/auto/dispatch-history.ts +168 -0
- package/src/resources/extensions/gsd/auto/dispatch-key.ts +39 -0
- package/src/resources/extensions/gsd/auto/dispatch.ts +449 -0
- package/src/resources/extensions/gsd/auto/finalize.ts +445 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -1
- package/src/resources/extensions/gsd/auto/loop.ts +7 -1
- package/src/resources/extensions/gsd/auto/milestone-lease-reclaim.ts +74 -0
- package/src/resources/extensions/gsd/auto/orchestrator.ts +232 -76
- package/src/resources/extensions/gsd/auto/phase-helpers.ts +199 -0
- package/src/resources/extensions/gsd/auto/phases.ts +58 -3013
- package/src/resources/extensions/gsd/auto/pre-dispatch.ts +704 -0
- package/src/resources/extensions/gsd/auto/session.ts +3 -0
- package/src/resources/extensions/gsd/auto/unit-phase.ts +910 -0
- package/src/resources/extensions/gsd/auto/workflow-unit-dispatch.ts +1 -1
- package/src/resources/extensions/gsd/auto/worktree-safety-phase.ts +149 -0
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +18 -48
- package/src/resources/extensions/gsd/auto-dispatch.ts +48 -61
- package/src/resources/extensions/gsd/auto-model-selection.ts +41 -12
- package/src/resources/extensions/gsd/auto-post-unit.ts +52 -13
- package/src/resources/extensions/gsd/auto-prompts.ts +118 -35
- package/src/resources/extensions/gsd/auto-start.ts +48 -33
- package/src/resources/extensions/gsd/auto-tool-tracking.ts +19 -0
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +83 -28
- package/src/resources/extensions/gsd/auto-unit-tool-scope.ts +14 -21
- package/src/resources/extensions/gsd/auto-verification.ts +26 -28
- package/src/resources/extensions/gsd/auto-worktree-repair.ts +13 -2
- package/src/resources/extensions/gsd/auto-worktree.ts +56 -366
- package/src/resources/extensions/gsd/auto.ts +69 -26
- package/src/resources/extensions/gsd/blocked-models.ts +49 -0
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +37 -10
- package/src/resources/extensions/gsd/bootstrap/dynamic-tools.ts +89 -18
- package/src/resources/extensions/gsd/bootstrap/exec-tools.ts +2 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +270 -37
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +368 -78
- package/src/resources/extensions/gsd/branch-patterns.ts +3 -0
- package/src/resources/extensions/gsd/browser-daemon-auto-prep.ts +108 -0
- package/src/resources/extensions/gsd/browser-evidence.ts +18 -2
- package/src/resources/extensions/gsd/captures.ts +5 -16
- package/src/resources/extensions/gsd/closeout-recovery.ts +2 -1
- package/src/resources/extensions/gsd/closeout-wizard.ts +102 -0
- package/src/resources/extensions/gsd/commands/catalog.ts +6 -68
- package/src/resources/extensions/gsd/commands/context.ts +16 -2
- package/src/resources/extensions/gsd/commands-handlers.ts +46 -3
- package/src/resources/extensions/gsd/commands-mcp-status.ts +2 -2
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +11 -4
- package/src/resources/extensions/gsd/consent-question.ts +431 -0
- package/src/resources/extensions/gsd/consent-verdict.ts +86 -0
- package/src/resources/extensions/gsd/constants.ts +0 -3
- package/src/resources/extensions/gsd/crash-recovery.ts +13 -11
- package/src/resources/extensions/gsd/db/engine.ts +809 -0
- package/src/resources/extensions/gsd/db/queries.ts +519 -0
- package/src/resources/extensions/gsd/db/sql-constants.ts +12 -0
- package/src/resources/extensions/gsd/db/writers/cascades.ts +237 -0
- package/src/resources/extensions/gsd/db/writers/import-restore.ts +310 -0
- package/src/resources/extensions/gsd/db/writers/memory.ts +220 -0
- package/src/resources/extensions/gsd/db/writers/reconcile.ts +500 -0
- package/src/resources/extensions/gsd/db/writers/status.ts +88 -0
- package/src/resources/extensions/gsd/db-writer.ts +11 -19
- package/src/resources/extensions/gsd/dispatch-guard.ts +8 -31
- package/src/resources/extensions/gsd/doctor-engine-checks.ts +5 -4
- package/src/resources/extensions/gsd/doctor-environment.ts +272 -155
- package/src/resources/extensions/gsd/doctor-format.ts +12 -7
- package/src/resources/extensions/gsd/doctor-git-checks.ts +5 -22
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +22 -17
- package/src/resources/extensions/gsd/engine-hook-contract.ts +79 -0
- package/src/resources/extensions/gsd/error-classifier.ts +11 -0
- package/src/resources/extensions/gsd/exec-sandbox.ts +49 -9
- package/src/resources/extensions/gsd/files.ts +33 -12
- package/src/resources/extensions/gsd/git-service.ts +1 -0
- package/src/resources/extensions/gsd/gitignore.ts +3 -0
- package/src/resources/extensions/gsd/gsd-command-home.ts +13 -3
- package/src/resources/extensions/gsd/gsd-db.ts +176 -2375
- package/src/resources/extensions/gsd/guidance.ts +217 -0
- package/src/resources/extensions/gsd/guided-flow.ts +195 -29
- package/src/resources/extensions/gsd/health-widget.ts +91 -27
- package/src/resources/extensions/gsd/markdown-renderer.ts +11 -0
- package/src/resources/extensions/gsd/mcp-bridge.ts +39 -0
- package/src/resources/extensions/gsd/mcp-filter.ts +2 -23
- package/src/resources/extensions/gsd/mcp-tool-name.ts +6 -11
- package/src/resources/extensions/gsd/memory-consolidation-scanner.ts +1 -1
- package/src/resources/extensions/gsd/migrate/safety.ts +18 -7
- package/src/resources/extensions/gsd/migration-auto-check.ts +28 -3
- package/src/resources/extensions/gsd/milestone-closeout.ts +109 -24
- package/src/resources/extensions/gsd/milestone-planning-persistence.ts +2 -2
- package/src/resources/extensions/gsd/milestone-reopen-events.ts +3 -6
- package/src/resources/extensions/gsd/milestone-settlement.ts +2 -2
- package/src/resources/extensions/gsd/model-cost-table.ts +1 -0
- package/src/resources/extensions/gsd/model-router.ts +3 -0
- package/src/resources/extensions/gsd/notification-store.ts +26 -3
- package/src/resources/extensions/gsd/notifications.ts +13 -6
- package/src/resources/extensions/gsd/parallel-merge.ts +12 -9
- package/src/resources/extensions/gsd/parallel-monitor-overlay.ts +10 -7
- package/src/resources/extensions/gsd/parsers-legacy.ts +16 -4
- package/src/resources/extensions/gsd/paths.ts +42 -22
- package/src/resources/extensions/gsd/pre-execution-checks.ts +109 -3
- package/src/resources/extensions/gsd/preferences-models.ts +12 -47
- package/src/resources/extensions/gsd/preferences.ts +18 -0
- package/src/resources/extensions/gsd/projection-flush.ts +20 -0
- package/src/resources/extensions/gsd/prompts/complete-slice.md +4 -4
- package/src/resources/extensions/gsd/prompts/execute-task.md +3 -2
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/quick-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/src/resources/extensions/gsd/prompts/refine-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/replan-slice.md +2 -2
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/rewrite-docs.md +1 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +9 -5
- package/src/resources/extensions/gsd/prompts/system.md +5 -2
- package/src/resources/extensions/gsd/prompts/triage-captures.md +1 -1
- package/src/resources/extensions/gsd/prompts/validate-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/workflow-start.md +2 -1
- package/src/resources/extensions/gsd/provider-error-guidance.ts +4 -9
- package/src/resources/extensions/gsd/provider-switch-observer.ts +1 -1
- package/src/resources/extensions/gsd/publication.ts +122 -0
- package/src/resources/extensions/gsd/reactive-graph.ts +11 -1
- package/src/resources/extensions/gsd/recovery-classification.ts +47 -88
- package/src/resources/extensions/gsd/roadmap-slices.ts +28 -3
- package/src/resources/extensions/gsd/safety/destructive-confirmation.ts +134 -0
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +36 -4
- package/src/resources/extensions/gsd/safety/evidence-cross-ref.ts +7 -2
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +14 -0
- package/src/resources/extensions/gsd/session-lock.ts +1 -1
- package/src/resources/extensions/gsd/skill-activation.ts +3 -6
- package/src/resources/extensions/gsd/state-transition-matrix.ts +42 -0
- package/src/resources/extensions/gsd/state.ts +16 -22
- package/src/resources/extensions/gsd/status-guards.ts +59 -8
- package/src/resources/extensions/gsd/stop-notice.ts +75 -0
- package/src/resources/extensions/gsd/tests/auto-abort-pause-regression.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-blocked-remediation-message.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +329 -22
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +97 -1
- package/src/resources/extensions/gsd/tests/auto-orchestrator.test.ts +273 -37
- package/src/resources/extensions/gsd/tests/auto-pause-double-entry-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/auto-paused-ui-cleanup.test.ts +54 -1
- package/src/resources/extensions/gsd/tests/auto-phases-lifecycle.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/auto-post-unit-evidence-crossref-4909.test.ts +46 -0
- package/src/resources/extensions/gsd/tests/auto-remote-session-lock-cleanup.test.ts +65 -3
- package/src/resources/extensions/gsd/tests/auto-start-orphan-bootstrap.test.ts +236 -0
- package/src/resources/extensions/gsd/tests/auto-unit-closeout.test.ts +169 -1
- package/src/resources/extensions/gsd/tests/auto-worktree-registry.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/auto-worktree-repair.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/blocked-models.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/browser-automation-contract-fixture.ts +39 -0
- package/src/resources/extensions/gsd/tests/browser-contract.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/browser-daemon-auto-prep.test.ts +144 -0
- package/src/resources/extensions/gsd/tests/checkout-branch-stash-guard.test.ts +66 -1
- package/src/resources/extensions/gsd/tests/clear-stale-autostart.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/commands-verdict.test.ts +8 -7
- package/src/resources/extensions/gsd/tests/complete-slice-verification-gate.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +141 -5
- package/src/resources/extensions/gsd/tests/consent-question.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/custom-verify-retry-store.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/db-writer.test.ts +15 -4
- package/src/resources/extensions/gsd/tests/deep-project-auto-loop.test.ts +12 -11
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/destructive-confirmation.test.ts +303 -0
- package/src/resources/extensions/gsd/tests/discuss-routing-fixes.test.ts +12 -2
- package/src/resources/extensions/gsd/tests/dispatch-history.test.ts +328 -0
- package/src/resources/extensions/gsd/tests/dispatch-run-uat-browser-tools.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/dist-redirect.mjs +8 -0
- package/src/resources/extensions/gsd/tests/doctor-git-checks-terminal.test.ts +73 -0
- package/src/resources/extensions/gsd/tests/dynamic-bash-no-cap.test.ts +132 -0
- package/src/resources/extensions/gsd/tests/engine-hook-contract.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/engine-interfaces-contract.test.ts +117 -91
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/evidence-xref-gsd-exec.test.ts +157 -0
- package/src/resources/extensions/gsd/tests/exec-graceful-kill.test.ts +193 -0
- package/src/resources/extensions/gsd/tests/exec-tool.test.ts +29 -1
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +35 -1
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +33 -1
- package/src/resources/extensions/gsd/tests/gsd-command-home.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +27 -0
- package/src/resources/extensions/gsd/tests/guidance.test.ts +148 -0
- package/src/resources/extensions/gsd/tests/guided-dispatch-root.test.ts +18 -6
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +58 -15
- package/src/resources/extensions/gsd/tests/integration/auto-worktree.test.ts +89 -59
- package/src/resources/extensions/gsd/tests/integration/doctor-environment-async.test.ts +104 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/integration/gsd-integration-fixture.ts +80 -0
- package/src/resources/extensions/gsd/tests/integration/run-uat.test.ts +217 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +47 -16
- package/src/resources/extensions/gsd/tests/mcp-project-config.test.ts +3 -1
- package/src/resources/extensions/gsd/tests/mcp-readiness-preflight.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/mcp-status.test.ts +6 -5
- package/src/resources/extensions/gsd/tests/migration-auto-check.test.ts +85 -1
- package/src/resources/extensions/gsd/tests/milestone-closeout.test.ts +95 -4
- package/src/resources/extensions/gsd/tests/milestone-merge-stash-restore.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/milestone-report-path.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/milestone-settlement.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +32 -1
- package/src/resources/extensions/gsd/tests/notification-store.test.ts +32 -0
- package/src/resources/extensions/gsd/tests/notifications.test.ts +64 -9
- package/src/resources/extensions/gsd/tests/oauth-api-model-routing.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/parsers-legacy-importers.test.ts +143 -0
- package/src/resources/extensions/gsd/tests/phases-merge-error-stops-auto.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/phases-terminal-complete-idempotent.test.ts +242 -0
- package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +63 -2
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +193 -1
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +10 -2
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +124 -6
- package/src/resources/extensions/gsd/tests/provider-error-guidance.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +2 -4
- package/src/resources/extensions/gsd/tests/publication.test.ts +120 -0
- package/src/resources/extensions/gsd/tests/recovery-classification-illegal-transition.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +248 -1
- package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +31 -81
- package/src/resources/extensions/gsd/tests/roadmap-slices.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/runtime-invariant-modules.test.ts +27 -2
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/session-switch-clears-pending-autostart.test.ts +108 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +43 -6
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +20 -17
- package/src/resources/extensions/gsd/tests/start-auto-detached.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/status-guards.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/stop-auto-race-null-unit.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/stop-notice.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/teardown-chdir-failure-clears-registry.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/token-tool-gating.test.ts +80 -2
- package/src/resources/extensions/gsd/tests/tool-invocation-error-loop-break.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/tool-surface-readiness.test.ts +329 -0
- package/src/resources/extensions/gsd/tests/tool-unavailable-retry.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/transport-gate-double-complete.test.ts +139 -0
- package/src/resources/extensions/gsd/tests/uat-policy.test.ts +112 -29
- package/src/resources/extensions/gsd/tests/unit-closeout.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/unit-context-composer.test.ts +67 -2
- package/src/resources/extensions/gsd/tests/unit-registry.test.ts +163 -0
- package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +8 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/verification-verdict.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/web-app-uat.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/workflow-events.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp-readiness-cache.test.ts +119 -0
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +67 -4
- package/src/resources/extensions/gsd/tests/workflow-phase-contract-matrix.test.ts +332 -0
- package/src/resources/extensions/gsd/tests/workflow-reconcile.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +92 -0
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +275 -40
- package/src/resources/extensions/gsd/tests/worktree-health-dispatch.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-lifecycle.test.ts +41 -4
- package/src/resources/extensions/gsd/tests/worktree-manager.test.ts +22 -1
- package/src/resources/extensions/gsd/tests/worktree-placement.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/worktree-project-root-degrade.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-reentry.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/worktree-safety-phase.test.ts +100 -0
- package/src/resources/extensions/gsd/tests/worktree-safety.test.ts +75 -1
- package/src/resources/extensions/gsd/tests/worktree-symlink-removal.test.ts +12 -6
- package/src/resources/extensions/gsd/tests/worktree-teardown-safety.test.ts +24 -2
- package/src/resources/extensions/gsd/tests/worktree.test.ts +18 -0
- package/src/resources/extensions/gsd/tests/write-gate-seam.test.ts +358 -0
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +109 -1
- package/src/resources/extensions/gsd/tool-contract.ts +38 -3
- package/src/resources/extensions/gsd/tool-presentation-plan.ts +4 -4
- package/src/resources/extensions/gsd/tool-surface-readiness.ts +183 -0
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +3 -2
- package/src/resources/extensions/gsd/tools/complete-slice.ts +45 -70
- package/src/resources/extensions/gsd/tools/complete-task.ts +90 -2
- package/src/resources/extensions/gsd/tools/exec-tool.ts +9 -8
- package/src/resources/extensions/gsd/tools/plan-slice.ts +14 -8
- package/src/resources/extensions/gsd/tools/plan-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/reassess-roadmap.ts +2 -2
- package/src/resources/extensions/gsd/tools/reopen-milestone.ts +13 -40
- package/src/resources/extensions/gsd/tools/reopen-slice.ts +16 -44
- package/src/resources/extensions/gsd/tools/reopen-task.ts +2 -2
- package/src/resources/extensions/gsd/tools/replan-slice.ts +2 -2
- package/src/resources/extensions/gsd/tools/skip-slice.ts +18 -44
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +81 -2
- package/src/resources/extensions/gsd/uat-policy.ts +62 -16
- package/src/resources/extensions/gsd/undo.ts +9 -8
- package/src/resources/extensions/gsd/unit-closeout.ts +201 -0
- package/src/resources/extensions/gsd/unit-context-composer.ts +111 -1
- package/src/resources/extensions/gsd/unit-context-manifest.ts +4 -28
- package/src/resources/extensions/gsd/unit-registry.ts +442 -0
- package/src/resources/extensions/gsd/unit-tool-contracts.ts +27 -192
- package/src/resources/extensions/gsd/verdict-parser.ts +1 -1
- package/src/resources/extensions/gsd/verification-verdict.ts +4 -2
- package/src/resources/extensions/gsd/web-app-uat.ts +51 -8
- package/src/resources/extensions/gsd/workflow-event-ledger.ts +131 -0
- package/src/resources/extensions/gsd/workflow-event-vocabulary.ts +59 -0
- package/src/resources/extensions/gsd/workflow-events.ts +12 -20
- package/src/resources/extensions/gsd/workflow-mcp-auto-prep.ts +2 -0
- package/src/resources/extensions/gsd/workflow-mcp-readiness-cache.ts +150 -0
- package/src/resources/extensions/gsd/workflow-reconcile.ts +29 -62
- package/src/resources/extensions/gsd/workflow-tool-surface.ts +4 -1
- package/src/resources/extensions/gsd/worktree-git-recovery.ts +314 -0
- package/src/resources/extensions/gsd/worktree-lifecycle.ts +13 -9
- package/src/resources/extensions/gsd/worktree-manager.ts +53 -29
- package/src/resources/extensions/gsd/worktree-placement.ts +63 -0
- package/src/resources/extensions/gsd/worktree-reentry.ts +10 -7
- package/src/resources/extensions/gsd/worktree-root.ts +29 -6
- package/src/resources/extensions/gsd/worktree-safety.ts +49 -44
- package/src/resources/extensions/gsd/worktree-session-state.ts +11 -11
- package/src/resources/extensions/gsd/worktree.ts +7 -1
- package/src/resources/extensions/mcp-client/manager.ts +7 -1
- package/src/resources/extensions/search-the-web/native-search.ts +5 -3
- package/src/resources/extensions/shared/browser-contract.ts +66 -0
- package/src/resources/extensions/shared/gsd-browser-cli.ts +141 -6
- package/src/resources/shared/gsd-browser-path-sync.ts +273 -0
- package/src/resources/shared/package-manager-detection.ts +1 -1
- package/src/resources/shared/package.json +3 -0
- package/src/resources/skills/create-skill/SKILL.md +3 -0
- package/src/resources/skills/create-skill/references/executable-code.md +1 -1
- package/src/resources/skills/create-skill/references/skill-structure.md +1 -0
- package/src/resources/skills/create-skill/workflows/add-reference.md +8 -3
- package/src/resources/skills/create-skill/workflows/add-script.md +4 -2
- package/src/resources/skills/create-skill/workflows/add-template.md +3 -1
- package/src/resources/skills/create-skill/workflows/add-workflow.md +8 -3
- package/src/resources/skills/create-skill/workflows/upgrade-to-router.md +10 -5
- package/src/resources/skills/create-skill/workflows/verify-skill.md +9 -4
- package/src/resources/skills/spike-wrap-up/SKILL.md +9 -9
- package/dist/resources/extensions/gsd/user-input-boundary.js +0 -218
- package/dist/resources/skills/gsd-browser/SKILL.md +0 -41
- package/src/resources/extensions/gsd/tests/user-input-boundary.test.ts +0 -173
- package/src/resources/extensions/gsd/user-input-boundary.ts +0 -216
- package/src/resources/skills/gsd-browser/SKILL.md +0 -41
- /package/dist/web/standalone/.next/static/{DUFWcMFRH3iXh7d2fbrOF → avEtvPrImYTq2gGe-hVNp}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{DUFWcMFRH3iXh7d2fbrOF → avEtvPrImYTq2gGe-hVNp}/_ssgManifest.js +0 -0
|
@@ -8,25 +8,27 @@
|
|
|
8
8
|
* manages create, enter, detect, and teardown for auto-mode worktrees.
|
|
9
9
|
*/
|
|
10
10
|
import { existsSync, cpSync, readFileSync, readdirSync, mkdirSync, realpathSync, rmSync, unlinkSync, lstatSync as lstatSyncFn, } from "node:fs";
|
|
11
|
-
import { dirname, isAbsolute, join, relative
|
|
11
|
+
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
12
12
|
import { GSDError, GSD_IO_ERROR, GSD_GIT_ERROR } from "./errors.js";
|
|
13
13
|
import { reconcileWorktreeDb, isDbAvailable, getMilestone, getMilestoneSlices, getSliceTasks, } from "./gsd-db.js";
|
|
14
14
|
import { closeWorkflowDatabase, getWorkflowDatabasePath, openWorkflowDatabasePath, } from "./db-workspace.js";
|
|
15
15
|
import { execFileSync } from "node:child_process";
|
|
16
16
|
import { gsdRoot, resolveGsdPathContract } from "./paths.js";
|
|
17
|
-
import { createWorktree, removeWorktree,
|
|
17
|
+
import { createWorktree, removeWorktree, worktreePath, isInsideWorktreesDir, } from "./worktree-manager.js";
|
|
18
|
+
import { worktreePathFor } from "./worktree-placement.js";
|
|
18
19
|
import { detectWorktreeName, nudgeGitBranchCache, } from "./worktree.js";
|
|
19
|
-
import { isGsdWorktreePath, normalizeWorktreePathForCompare, resolveWorktreeProjectRoot, } from "./worktree-root.js";
|
|
20
|
+
import { isGsdWorktreePath, projectRootFromWorktreePath, normalizeWorktreePathForCompare, resolveWorktreeProjectRoot, } from "./worktree-root.js";
|
|
20
21
|
import { autoResolveSafeConflictPaths } from "./git-conflict-resolve.js";
|
|
21
22
|
import { MergeConflictError, readIntegrationBranch, resolveMilestoneIntegrationBranch, RUNTIME_EXCLUSION_PATHS } from "./git-service.js";
|
|
22
|
-
import {
|
|
23
|
+
import { publishMilestone } from "./publication.js";
|
|
23
24
|
import { debugLog } from "./debug-logger.js";
|
|
24
25
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
26
|
+
import { checkoutBranchWithStashGuard, cleanupConflictState, gsdJsonlFilesWithConflictMarkers, hasConflictMarkers, popStashByRef, removeMergeStateFiles, stashAlreadyExistsFilesFromError, stashRefFromError, } from "./worktree-git-recovery.js";
|
|
25
27
|
import { loadEffectiveGSDPreferences } from "./preferences.js";
|
|
26
28
|
import { MILESTONE_ID_RE } from "./milestone-ids.js";
|
|
27
29
|
import { runWorktreePostCreateHook } from "./worktree-post-create-hook.js";
|
|
28
30
|
import { classifyProject } from "./detection.js";
|
|
29
|
-
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeWorkingTreeStatus, nativeAddAllWithExclusions, nativeCommit, nativeCheckoutBranch, nativeMergeSquash, nativeMergeRegular, nativeConflictFiles, nativeAddPaths, nativeRmForce, nativeBranchDelete, nativeBranchForceReset, nativeBranchExists, nativeDiffNumstat, nativeUpdateRef, nativeIsAncestor,
|
|
31
|
+
import { nativeGetCurrentBranch, nativeDetectMainBranch, nativeWorkingTreeStatus, nativeAddAllWithExclusions, nativeCommit, nativeCheckoutBranch, nativeMergeSquash, nativeMergeRegular, nativeConflictFiles, nativeAddPaths, nativeRmForce, nativeBranchDelete, nativeBranchForceReset, nativeBranchExists, nativeDiffNumstat, nativeUpdateRef, nativeIsAncestor, nativeWorktreeList, nativeLsFiles, } from "./native-git-bridge.js";
|
|
30
32
|
import { CLOSEOUT_CONSISTENCY_BLOCKED_REASON, } from "./closeout-consistency-gate.js";
|
|
31
33
|
import { formatCloseoutProofBlock, proveMilestoneCloseout, } from "./milestone-closeout-proof.js";
|
|
32
34
|
import { gsdHome } from "./gsd-home.js";
|
|
@@ -61,111 +63,6 @@ const ROOT_STATE_FILES = [
|
|
|
61
63
|
// Back-sync (worktree → main) must NEVER overwrite the project root's copy
|
|
62
64
|
// because the project root is authoritative for preferences (#2684).
|
|
63
65
|
];
|
|
64
|
-
/**
|
|
65
|
-
* Pop a stash entry by tracking the unique marker embedded in its message so
|
|
66
|
-
* concurrent stash operations against the same project root cannot cause us to
|
|
67
|
-
* pop the wrong entry.
|
|
68
|
-
*
|
|
69
|
-
* If `stashMarker` is null or no longer present in the stash list (e.g. a
|
|
70
|
-
* concurrent process popped/dropped it), leaves the stash list untouched and
|
|
71
|
-
* returns null.
|
|
72
|
-
*
|
|
73
|
-
* Throws on pop failure so callers can handle conflict cases the same way
|
|
74
|
-
* they would with the prior `git stash pop` form. When throwing after a
|
|
75
|
-
* targeted pop attempt, the error is annotated with the targeted stash ref.
|
|
76
|
-
*
|
|
77
|
-
* (Issue #4980 HIGH-6)
|
|
78
|
-
*/
|
|
79
|
-
function popStashByRef(basePath, stashMarker) {
|
|
80
|
-
let popArg = null;
|
|
81
|
-
if (stashMarker) {
|
|
82
|
-
try {
|
|
83
|
-
const list = execFileSync("git", ["stash", "list", "--format=%gd%x00%s"], {
|
|
84
|
-
cwd: basePath,
|
|
85
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
-
encoding: "utf-8",
|
|
87
|
-
}).trim().split("\n").filter(Boolean);
|
|
88
|
-
for (const entry of list) {
|
|
89
|
-
const [ref, subject] = entry.split("\0");
|
|
90
|
-
if (ref && subject?.includes(stashMarker)) {
|
|
91
|
-
popArg = ref;
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
logWarning("worktree", `stash list lookup failed; leaving stash untouched: ${err instanceof Error ? err.message : String(err)}`);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (!popArg) {
|
|
101
|
-
logWarning("worktree", "recorded stash entry could not be resolved; skipping automatic pop");
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
try {
|
|
105
|
-
execFileSync("git", ["stash", "pop", popArg], {
|
|
106
|
-
cwd: basePath,
|
|
107
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
108
|
-
encoding: "utf-8",
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
catch (err) {
|
|
112
|
-
if (err && typeof err === "object") {
|
|
113
|
-
err.stashRef = popArg;
|
|
114
|
-
}
|
|
115
|
-
throw err;
|
|
116
|
-
}
|
|
117
|
-
return popArg;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Extract a stash ref annotation injected by popStashByRef() when git stash
|
|
121
|
-
* pop fails and we need to conditionally drop the exact stash entry later.
|
|
122
|
-
*/
|
|
123
|
-
function stashRefFromError(err) {
|
|
124
|
-
if (!err || typeof err !== "object")
|
|
125
|
-
return null;
|
|
126
|
-
const stashRef = err.stashRef;
|
|
127
|
-
return typeof stashRef === "string" && stashRef.length > 0 ? stashRef : null;
|
|
128
|
-
}
|
|
129
|
-
function stashAlreadyExistsFilesFromError(err) {
|
|
130
|
-
if (!err || typeof err !== "object")
|
|
131
|
-
return [];
|
|
132
|
-
const stderr = err.stderr;
|
|
133
|
-
const stderrText = typeof stderr === "string"
|
|
134
|
-
? stderr
|
|
135
|
-
: stderr instanceof Uint8Array
|
|
136
|
-
? Buffer.from(stderr).toString("utf-8")
|
|
137
|
-
: "";
|
|
138
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
139
|
-
const text = `${stderrText}\n${message}`;
|
|
140
|
-
const files = new Set();
|
|
141
|
-
for (const line of text.split("\n")) {
|
|
142
|
-
const m = line.match(/^(.*?)\s+already exists, no checkout\s*$/i);
|
|
143
|
-
if (!m)
|
|
144
|
-
continue;
|
|
145
|
-
const filePath = m[1]?.trim();
|
|
146
|
-
if (filePath)
|
|
147
|
-
files.add(filePath);
|
|
148
|
-
}
|
|
149
|
-
return [...files];
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Detect whether an on-disk file still contains unresolved merge conflict
|
|
153
|
-
* markers from a failed stash-pop or merge attempt.
|
|
154
|
-
*
|
|
155
|
-
* Returns false when the file cannot be read.
|
|
156
|
-
*/
|
|
157
|
-
function hasConflictMarkers(filePath) {
|
|
158
|
-
try {
|
|
159
|
-
const content = readFileSync(filePath, "utf-8");
|
|
160
|
-
return content.includes("<<<<<<<") && content.includes("=======") && content.includes(">>>>>>>");
|
|
161
|
-
}
|
|
162
|
-
catch {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function gsdJsonlFilesWithConflictMarkers(basePath) {
|
|
167
|
-
return nativeLsFiles(basePath, ".gsd/*.jsonl").filter((f) => hasConflictMarkers(join(basePath, f)));
|
|
168
|
-
}
|
|
169
66
|
/**
|
|
170
67
|
* Check if two filesystem paths resolve to the same real location.
|
|
171
68
|
* Returns false if either path cannot be resolved (e.g. doesn't exist).
|
|
@@ -286,19 +183,6 @@ function gitPathspecForWorktreePath(basePath, targetPath) {
|
|
|
286
183
|
export function _gitPathspecForWorktreePath(basePath, targetPath) {
|
|
287
184
|
return gitPathspecForWorktreePath(basePath, targetPath);
|
|
288
185
|
}
|
|
289
|
-
function gitRemoteExists(basePath, remote) {
|
|
290
|
-
try {
|
|
291
|
-
execFileSync("git", ["remote", "get-url", remote], {
|
|
292
|
-
cwd: basePath,
|
|
293
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
294
|
-
encoding: "utf-8",
|
|
295
|
-
});
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
return false;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
186
|
function findRegularMergeChangedPaths(basePath, milestoneBranch, mainBranch) {
|
|
303
187
|
const changedPaths = new Set();
|
|
304
188
|
let mergeLog = "";
|
|
@@ -421,51 +305,6 @@ export const SAFE_AUTO_RESOLVE_PATTERNS = [
|
|
|
421
305
|
* Covers `.gsd/` state files and common build artifacts. */
|
|
422
306
|
export const isSafeToAutoResolve = (filePath) => filePath.startsWith(".gsd/") ||
|
|
423
307
|
SAFE_AUTO_RESOLVE_PATTERNS.some((re) => re.test(filePath));
|
|
424
|
-
function removeMergeStateFiles(basePath, contextLabel) {
|
|
425
|
-
try {
|
|
426
|
-
for (const f of ["SQUASH_MSG", "MERGE_MSG", "MERGE_MODE", "MERGE_HEAD", "AUTO_MERGE"]) {
|
|
427
|
-
const rawPath = execFileSync("git", ["rev-parse", "--git-path", f], {
|
|
428
|
-
cwd: basePath,
|
|
429
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
430
|
-
encoding: "utf-8",
|
|
431
|
-
}).trim();
|
|
432
|
-
const p = rawPath.length > 0
|
|
433
|
-
? (isAbsolute(rawPath) ? rawPath : resolve(basePath, rawPath))
|
|
434
|
-
: join(resolveGitDir(basePath), f);
|
|
435
|
-
if (existsSync(p))
|
|
436
|
-
unlinkSync(p);
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
catch (err) {
|
|
440
|
-
logError("worktree", `${contextLabel} merge state cleanup failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
function cleanupConflictState(basePath) {
|
|
444
|
-
// Merge conflicts can leave unmerged index entries; merge-abort alone is not
|
|
445
|
-
// enough for squash merges (MERGE_HEAD is never written). Reset the merge
|
|
446
|
-
// index, then remove merge message files that native/libgit2 paths may have
|
|
447
|
-
// created.
|
|
448
|
-
try {
|
|
449
|
-
nativeMergeAbort(basePath);
|
|
450
|
-
}
|
|
451
|
-
catch (err) {
|
|
452
|
-
// MERGE_HEAD absent (squash merge path) — abort is a no-op, which is fine.
|
|
453
|
-
debugLog("conflict-cleanup:merge-abort-skipped", {
|
|
454
|
-
error: err instanceof Error ? err.message : String(err),
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
try {
|
|
458
|
-
execFileSync("git", ["reset", "--merge"], {
|
|
459
|
-
cwd: basePath,
|
|
460
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
461
|
-
encoding: "utf-8",
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
catch (err) {
|
|
465
|
-
logError("worktree", `git reset --merge failed after merge conflict: ${err instanceof Error ? err.message : String(err)}`);
|
|
466
|
-
}
|
|
467
|
-
removeMergeStateFiles(basePath, "conflict");
|
|
468
|
-
}
|
|
469
308
|
// ─── Dispatch-Level Sync (project root ↔ worktree) ──────────────────────────
|
|
470
309
|
/**
|
|
471
310
|
* Sync milestone artifacts from project root INTO worktree before deriveState.
|
|
@@ -539,19 +378,9 @@ export function checkResourcesStale(versionOnStart) {
|
|
|
539
378
|
* Returns the corrected base path.
|
|
540
379
|
*/
|
|
541
380
|
export function escapeStaleWorktree(base) {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
if (idx === -1) {
|
|
546
|
-
// Symlink-resolved layout: /.gsd/projects/<hash>/worktrees/
|
|
547
|
-
const symlinkRe = new RegExp(`\\${pathSep}\\.gsd\\${pathSep}projects\\${pathSep}[a-f0-9]+\\${pathSep}worktrees\\${pathSep}`);
|
|
548
|
-
const match = base.match(symlinkRe);
|
|
549
|
-
if (!match || match.index === undefined)
|
|
550
|
-
return base;
|
|
551
|
-
idx = match.index;
|
|
552
|
-
}
|
|
553
|
-
// base is inside .gsd/worktrees/<something> — extract the project root
|
|
554
|
-
const projectRoot = base.slice(0, idx);
|
|
381
|
+
const projectRoot = projectRootFromWorktreePath(base);
|
|
382
|
+
if (projectRoot === null)
|
|
383
|
+
return base;
|
|
555
384
|
// Guard: If the candidate project root's .gsd IS the user-level ~/.gsd,
|
|
556
385
|
// the string-slice heuristic matched the wrong /.gsd/ boundary. This happens
|
|
557
386
|
// when .gsd is a symlink into ~/.gsd/projects/<hash> and process.cwd()
|
|
@@ -908,109 +737,6 @@ export function enterBranchModeForMilestone(basePath, milestoneId) {
|
|
|
908
737
|
}
|
|
909
738
|
checkoutBranchWithStashGuard(basePath, branch, `enter-branch-mode:${milestoneId}`);
|
|
910
739
|
}
|
|
911
|
-
export function checkoutBranchWithStashGuard(basePath, branch, reason) {
|
|
912
|
-
let stashMarker = null;
|
|
913
|
-
let stashed = false;
|
|
914
|
-
const status = nativeWorkingTreeStatus(basePath).trim();
|
|
915
|
-
if (status.length > 0) {
|
|
916
|
-
stashMarker = `gsd-checkout-stash:${reason}:${process.pid}:${Date.now()}:${process.hrtime.bigint().toString(36)}`;
|
|
917
|
-
const stashListBefore = execFileSync("git", ["stash", "list"], {
|
|
918
|
-
cwd: basePath,
|
|
919
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
920
|
-
encoding: "utf-8",
|
|
921
|
-
});
|
|
922
|
-
execFileSync("git", ["stash", "push", "--include-untracked", "-m", `gsd: checkout stash [${stashMarker}]`], {
|
|
923
|
-
cwd: basePath,
|
|
924
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
925
|
-
encoding: "utf-8",
|
|
926
|
-
});
|
|
927
|
-
const stashListAfter = execFileSync("git", ["stash", "list"], {
|
|
928
|
-
cwd: basePath,
|
|
929
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
930
|
-
encoding: "utf-8",
|
|
931
|
-
});
|
|
932
|
-
stashed = stashListAfter !== stashListBefore;
|
|
933
|
-
}
|
|
934
|
-
// Checkout and stash-restore are split so we can distinguish two failure
|
|
935
|
-
// modes: (a) checkout failed → HEAD did not move, restore stash and rethrow;
|
|
936
|
-
// (b) checkout succeeded but stash pop failed → HEAD moved to `branch` but
|
|
937
|
-
// the working-tree changes remain in the stash list. We surface a distinct
|
|
938
|
-
// error in case (b) so callers don't assume the branch switch was rolled back.
|
|
939
|
-
try {
|
|
940
|
-
nativeCheckoutBranch(basePath, branch);
|
|
941
|
-
}
|
|
942
|
-
catch (checkoutErr) {
|
|
943
|
-
if (stashed) {
|
|
944
|
-
try {
|
|
945
|
-
popStashByRef(basePath, stashMarker);
|
|
946
|
-
}
|
|
947
|
-
catch (restoreErr) {
|
|
948
|
-
logWarning("worktree", `git stash pop failed during checkout restore: ${restoreErr instanceof Error ? restoreErr.message : String(restoreErr)}`);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
throw checkoutErr;
|
|
952
|
-
}
|
|
953
|
-
if (stashed) {
|
|
954
|
-
try {
|
|
955
|
-
popStashByRef(basePath, stashMarker);
|
|
956
|
-
}
|
|
957
|
-
catch (popErr) {
|
|
958
|
-
const msg = popErr instanceof Error ? popErr.message : String(popErr);
|
|
959
|
-
const stderr = popErr && typeof popErr === "object"
|
|
960
|
-
? popErr.stderr
|
|
961
|
-
: undefined;
|
|
962
|
-
const stderrText = typeof stderr === "string"
|
|
963
|
-
? stderr
|
|
964
|
-
: stderr instanceof Uint8Array
|
|
965
|
-
? Buffer.from(stderr).toString("utf-8")
|
|
966
|
-
: "";
|
|
967
|
-
const stashPopMessage = `${stderrText}\n${msg}`.trim();
|
|
968
|
-
const alreadyExists = stashAlreadyExistsFilesFromError(popErr);
|
|
969
|
-
const gsdAlreadyExists = alreadyExists.filter((f) => f.startsWith(".gsd/"));
|
|
970
|
-
const nonGsdAlreadyExists = alreadyExists.filter((f) => !f.startsWith(".gsd/"));
|
|
971
|
-
const isUntrackedRestoreFailure = stashPopMessage.includes("could not restore untracked files from stash");
|
|
972
|
-
const stashRefForDrop = stashRefFromError(popErr);
|
|
973
|
-
const nonGsdUnmerged = nativeConflictFiles(basePath).filter((f) => !f.startsWith(".gsd/"));
|
|
974
|
-
const gsdContentConflicts = isUntrackedRestoreFailure
|
|
975
|
-
? gsdJsonlFilesWithConflictMarkers(basePath)
|
|
976
|
-
: [];
|
|
977
|
-
const gsdConflictFiles = [...new Set([...gsdAlreadyExists, ...gsdContentConflicts])];
|
|
978
|
-
if (isUntrackedRestoreFailure &&
|
|
979
|
-
gsdConflictFiles.length > 0 &&
|
|
980
|
-
nonGsdAlreadyExists.length === 0 &&
|
|
981
|
-
nonGsdUnmerged.length === 0) {
|
|
982
|
-
for (const f of gsdConflictFiles) {
|
|
983
|
-
execFileSync("git", ["checkout", "HEAD", "--", f], {
|
|
984
|
-
cwd: basePath,
|
|
985
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
986
|
-
encoding: "utf-8",
|
|
987
|
-
});
|
|
988
|
-
nativeAddPaths(basePath, [f]);
|
|
989
|
-
}
|
|
990
|
-
if (stashRefForDrop) {
|
|
991
|
-
try {
|
|
992
|
-
execFileSync("git", ["stash", "drop", stashRefForDrop], {
|
|
993
|
-
cwd: basePath,
|
|
994
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
995
|
-
encoding: "utf-8",
|
|
996
|
-
});
|
|
997
|
-
}
|
|
998
|
-
catch (err) { /* stash may already be consumed */
|
|
999
|
-
logWarning("worktree", `git stash drop failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
else {
|
|
1003
|
-
logWarning("worktree", "recorded stash entry could not be resolved; skipping automatic drop");
|
|
1004
|
-
}
|
|
1005
|
-
return;
|
|
1006
|
-
}
|
|
1007
|
-
const wrapped = new Error(`checkout to '${branch}' succeeded but stash restore failed; working tree changes remain in the stash list. Original error: ${msg}`);
|
|
1008
|
-
if (stashRefForDrop)
|
|
1009
|
-
wrapped.stashRef = stashRefForDrop;
|
|
1010
|
-
throw wrapped;
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
}
|
|
1014
740
|
// ─── Public API ────────────────────────────────────────────────────────────
|
|
1015
741
|
/**
|
|
1016
742
|
* Create a new auto-worktree for a milestone, chdir into it, and store
|
|
@@ -1074,6 +800,14 @@ function _resolveIntegrationBranchForReuse(basePath, milestoneId) {
|
|
|
1074
800
|
return null;
|
|
1075
801
|
}
|
|
1076
802
|
}
|
|
803
|
+
function safeCwd(fallback) {
|
|
804
|
+
try {
|
|
805
|
+
return process.cwd();
|
|
806
|
+
}
|
|
807
|
+
catch {
|
|
808
|
+
return fallback;
|
|
809
|
+
}
|
|
810
|
+
}
|
|
1077
811
|
/**
|
|
1078
812
|
* When reusing an existing milestone branch, fast-forward it onto the
|
|
1079
813
|
* integration branch when that's safe (branch is a strict ancestor of
|
|
@@ -1223,7 +957,7 @@ export function teardownAutoWorktree(originalBasePath, milestoneId, opts = {}) {
|
|
|
1223
957
|
originalBasePath = resolveWorktreeProjectRoot(originalBasePath);
|
|
1224
958
|
const branch = autoWorktreeBranch(milestoneId);
|
|
1225
959
|
const { preserveBranch = false, preserveWorktree = false } = opts;
|
|
1226
|
-
const previousCwd =
|
|
960
|
+
const previousCwd = safeCwd(originalBasePath);
|
|
1227
961
|
// Wrap the entire teardown body in a single try/finally so activeWorkspace
|
|
1228
962
|
// is ALWAYS cleared — even if process.chdir throws (e.g. originalBasePath
|
|
1229
963
|
// was deleted before teardown ran). Previously the finally only covered
|
|
@@ -1307,7 +1041,7 @@ export function teardownAutoWorktree(originalBasePath, milestoneId, opts = {}) {
|
|
|
1307
1041
|
* still works after process restart when module state has been reset.
|
|
1308
1042
|
*/
|
|
1309
1043
|
export function isInAutoWorktree(basePath) {
|
|
1310
|
-
const targetPath = isGsdWorktreePath(basePath) ? basePath :
|
|
1044
|
+
const targetPath = isGsdWorktreePath(basePath) ? basePath : safeCwd("");
|
|
1311
1045
|
if (!isGsdWorktreePath(targetPath))
|
|
1312
1046
|
return false;
|
|
1313
1047
|
const storedBase = getAutoWorktreeOriginalBase();
|
|
@@ -1335,7 +1069,9 @@ export function isInAutoWorktree(basePath) {
|
|
|
1335
1069
|
*/
|
|
1336
1070
|
export function getAutoWorktreePath(basePath, milestoneId) {
|
|
1337
1071
|
basePath = resolveWorktreeProjectRoot(basePath);
|
|
1338
|
-
|
|
1072
|
+
// basePath is already the resolved project root — go straight to placement
|
|
1073
|
+
// instead of worktreePath(), which would re-resolve the root.
|
|
1074
|
+
const p = worktreePathFor(basePath, milestoneId);
|
|
1339
1075
|
if (!existsSync(p))
|
|
1340
1076
|
return null;
|
|
1341
1077
|
// Validate this is a real git worktree, not a stray directory.
|
|
@@ -1995,8 +1731,6 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
1995
1731
|
const isUntrackedRestoreFailure = stashPopMessage.includes("could not restore untracked files from stash");
|
|
1996
1732
|
const gsdContentConflicts = [];
|
|
1997
1733
|
const alreadyExists = stashAlreadyExistsFilesFromError(e);
|
|
1998
|
-
const gsdAlreadyExists = alreadyExists.filter((f) => f.startsWith(".gsd/"));
|
|
1999
|
-
const nonGsdAlreadyExists = alreadyExists.filter((f) => !f.startsWith(".gsd/"));
|
|
2000
1734
|
// Untracked-file restore failures can leave marker conflicts in tracked
|
|
2001
1735
|
// .gsd JSONL files without producing `U` status entries.
|
|
2002
1736
|
if (isUntrackedRestoreFailure) {
|
|
@@ -2057,10 +1791,11 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
2057
1791
|
}
|
|
2058
1792
|
else if (gsdUU.length === 0 &&
|
|
2059
1793
|
nonGsdUU.length === 0 &&
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
//
|
|
2063
|
-
//
|
|
1794
|
+
alreadyExists.length > 0) {
|
|
1795
|
+
// Untracked-file restore failure from stash pop where all collided paths
|
|
1796
|
+
// already exist after merge (committed on target). Safe to drop the stash
|
|
1797
|
+
// for the full alreadyExists set — they were untracked on source by
|
|
1798
|
+
// definition of the "already exists, no checkout" failure.
|
|
2064
1799
|
if (stashRefForDrop) {
|
|
2065
1800
|
try {
|
|
2066
1801
|
execFileSync("git", ["stash", "drop", stashRefForDrop], {
|
|
@@ -2083,11 +1818,6 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
2083
1818
|
files: nonGsdUU.join(", "),
|
|
2084
1819
|
});
|
|
2085
1820
|
}
|
|
2086
|
-
else if (nonGsdAlreadyExists.length > 0) {
|
|
2087
|
-
logWarning("reconcile", "Stash pop restore collision on non-.gsd files after merge", {
|
|
2088
|
-
files: nonGsdAlreadyExists.join(", "),
|
|
2089
|
-
});
|
|
2090
|
-
}
|
|
2091
1821
|
else {
|
|
2092
1822
|
logWarning("worktree", "git stash pop failed without resolvable conflict files; leaving stash for manual recovery");
|
|
2093
1823
|
}
|
|
@@ -2179,66 +1909,32 @@ export function mergeMilestoneToMain(originalBasePath_, milestoneId, roadmapCont
|
|
|
2179
1909
|
}
|
|
2180
1910
|
catch (err) {
|
|
2181
1911
|
logWarning("worktree", `chdir to project root after merge failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1912
|
+
debugLog("mergeMilestoneToMain", {
|
|
1913
|
+
phase: "post-merge-chdir-failed",
|
|
1914
|
+
target: originalBasePath_,
|
|
1915
|
+
error: err instanceof Error ? err.message : String(err),
|
|
1916
|
+
});
|
|
2182
1917
|
}
|
|
2183
1918
|
};
|
|
2184
1919
|
let shouldCleanup = false;
|
|
2185
|
-
let pushed = false;
|
|
2186
|
-
let prCreated = false;
|
|
2187
1920
|
try {
|
|
2188
|
-
// 10.
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
}
|
|
2206
|
-
// 9b. Auto-create PR if enabled (#2302: no longer gated on pushed/auto_push)
|
|
2207
|
-
if (prefs.auto_pr === true && !nothingToCommit) {
|
|
2208
|
-
const remote = prefs.remote ?? "origin";
|
|
2209
|
-
const prTarget = prefs.pr_target_branch ?? mainBranch;
|
|
2210
|
-
if (gitRemoteExists(originalBasePath_, remote)) {
|
|
2211
|
-
try {
|
|
2212
|
-
// Push the milestone branch to remote first
|
|
2213
|
-
execFileSync("git", ["push", remote, milestoneBranch], {
|
|
2214
|
-
cwd: originalBasePath_,
|
|
2215
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
2216
|
-
encoding: "utf-8",
|
|
2217
|
-
});
|
|
2218
|
-
const prEvidence = buildPullRequestEvidence({
|
|
2219
|
-
milestoneId,
|
|
2220
|
-
milestoneTitle,
|
|
2221
|
-
changeType: "feat",
|
|
2222
|
-
summaries: completedSlices.map((slice) => `### ${slice.id}\n${slice.title}`),
|
|
2223
|
-
testsRun: ["Auto-created after milestone merge. Run `npm run verify:merge` before marking this draft ready."],
|
|
2224
|
-
rollbackNotes: ["Close the draft PR or revert the merge commit if review finds a behavior regression."],
|
|
2225
|
-
how: "Generated by git.auto_pr after the milestone branch was pushed and merged locally.",
|
|
2226
|
-
});
|
|
2227
|
-
const prUrl = createDraftPullRequestFromEvidence(originalBasePath_, milestoneId, prEvidence, {
|
|
2228
|
-
head: milestoneBranch,
|
|
2229
|
-
base: prTarget,
|
|
2230
|
-
});
|
|
2231
|
-
if (!prUrl) {
|
|
2232
|
-
throw new Error("gh pr create returned no URL");
|
|
2233
|
-
}
|
|
2234
|
-
prCreated = true;
|
|
2235
|
-
}
|
|
2236
|
-
catch (err) {
|
|
2237
|
-
// PR creation failure is non-fatal — gh may not be installed or authenticated
|
|
2238
|
-
logWarning("worktree", `PR creation failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
2239
|
-
}
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
1921
|
+
// 10/9b. Publication (auto-push / draft PR) — Publication module seam (ADR-034).
|
|
1922
|
+
const publication = publishMilestone({
|
|
1923
|
+
basePath: originalBasePath_,
|
|
1924
|
+
milestoneId,
|
|
1925
|
+
milestoneTitle,
|
|
1926
|
+
integrationBranch: mainBranch,
|
|
1927
|
+
milestoneBranch,
|
|
1928
|
+
sliceSummaries: completedSlices.map((slice) => `### ${slice.id}\n${slice.title}`),
|
|
1929
|
+
nothingToCommit,
|
|
1930
|
+
prefs: {
|
|
1931
|
+
autoPush: prefs.auto_push === true,
|
|
1932
|
+
autoPr: prefs.auto_pr === true,
|
|
1933
|
+
remote: prefs.remote,
|
|
1934
|
+
prTargetBranch: prefs.pr_target_branch,
|
|
1935
|
+
},
|
|
1936
|
+
});
|
|
1937
|
+
const { pushed, prCreated } = publication;
|
|
2242
1938
|
// 11. Guard removed — step 9b (#1792) now handles this with a smarter check:
|
|
2243
1939
|
// throws only when the milestone has unanchored code changes, passes
|
|
2244
1940
|
// through when the code is genuinely already on the integration branch.
|
|
@@ -25,7 +25,7 @@ import { clearActivityLogState } from "./activity-log.js";
|
|
|
25
25
|
import { synthesizeCrashRecovery, getDeepDiagnostic, readActiveMilestoneId, } from "./session-forensics.js";
|
|
26
26
|
import { writeLock, clearLock, clearStaleWorkerLock, readCrashLock, isLockProcessAlive, formatCrashInfo, emitCrashRecoveredUnitEnd, emitOpenUnitEndForUnit, } from "./crash-recovery.js";
|
|
27
27
|
import { acquireSessionLock, getSessionLockStatus, releaseSessionLock, updateSessionLock, } from "./session-lock.js";
|
|
28
|
-
import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, } from "./preferences.js";
|
|
28
|
+
import { resolveAutoSupervisorConfig, loadEffectiveGSDPreferences, getIsolationMode, resolveEffectiveUnitIsolationMode, } from "./preferences.js";
|
|
29
29
|
import { playNotificationBell, sendDesktopNotification } from "./notifications.js";
|
|
30
30
|
import { getBudgetAlertLevel, getNewBudgetAlertLevel, getBudgetEnforcementAction, resolveCompactionThresholdPercent, shouldRerootStepSessionForContext, } from "./auto-budget.js";
|
|
31
31
|
import { markToolStart as _markToolStart, markToolEnd as _markToolEnd, getOldestInFlightToolAgeMs as _getOldestInFlightToolAgeMs, clearInFlightTools, isToolInvocationError, isQueuedUserMessageSkip, isDeterministicPolicyError, } from "./auto-tool-tracking.js";
|
|
@@ -117,6 +117,7 @@ import { createWorkspace, scopeMilestone } from "./workspace.js";
|
|
|
117
117
|
import { registerAutoWorker, markWorkerStopping, } from "./db/auto-workers.js";
|
|
118
118
|
import { releaseMilestoneLease } from "./db/milestone-leases.js";
|
|
119
119
|
import { normalizeRealPath } from "./paths.js";
|
|
120
|
+
import { formatStopNoticePrefix, isBlockedStopReason, stopNoticeDisplayReason, } from "./stop-notice.js";
|
|
120
121
|
// ── ENCAPSULATION INVARIANT ─────────────────────────────────────────────────
|
|
121
122
|
// ALL mutable auto-mode state lives in the AutoSession class (auto/session.ts).
|
|
122
123
|
// This file must NOT declare module-level `let` or `var` variables for state.
|
|
@@ -137,17 +138,7 @@ export function formatAutoStopNotification(prefix, totals, unitCount) {
|
|
|
137
138
|
`Session: ${formatCost(totals.cost)} · ${formatTokenCount(totals.tokens.total)} tokens · ${unitCount} units`,
|
|
138
139
|
].join("\n");
|
|
139
140
|
}
|
|
140
|
-
|
|
141
|
-
return /^Blocked:\s*/i.test(reason ?? "");
|
|
142
|
-
}
|
|
143
|
-
function formatAutoStopDisplayReason(reason) {
|
|
144
|
-
return (reason ?? "").replace(/^Blocked:\s*/i, "").trim();
|
|
145
|
-
}
|
|
146
|
-
export function formatAutoStopNotificationPrefix(reason) {
|
|
147
|
-
const displayReason = formatAutoStopDisplayReason(reason);
|
|
148
|
-
const prefix = isBlockedStopReason(reason) ? "Auto-mode blocked" : "Auto-mode stopped";
|
|
149
|
-
return displayReason ? `${prefix} — ${displayReason}` : prefix;
|
|
150
|
-
}
|
|
141
|
+
export { formatStopNoticePrefix as formatAutoStopNotificationPrefix } from "./stop-notice.js";
|
|
151
142
|
function clearSessionModelOverrideForCommandSession(ctx) {
|
|
152
143
|
const sessionId = s.cmdCtx?.sessionManager?.getSessionId?.() ??
|
|
153
144
|
ctx?.sessionManager?.getSessionId?.();
|
|
@@ -346,14 +337,11 @@ export function startAutoDetached(ctx, pi, base, verboseMode, options) {
|
|
|
346
337
|
export function shouldUseWorktreeIsolation(basePath) {
|
|
347
338
|
return getIsolationMode(basePath) === "worktree";
|
|
348
339
|
}
|
|
349
|
-
function
|
|
350
|
-
return configuredMode
|
|
351
|
-
}
|
|
352
|
-
export function _resolveEffectiveUnitIsolationModeForTest(configuredMode, isolationDegraded) {
|
|
353
|
-
return resolveEffectiveUnitIsolationMode(configuredMode, isolationDegraded);
|
|
340
|
+
export function _resolveEffectiveUnitIsolationModeForTest(configuredMode, isolationDegraded, strandedRecoveryIsolationMode = null) {
|
|
341
|
+
return resolveEffectiveUnitIsolationMode(configuredMode, isolationDegraded, strandedRecoveryIsolationMode);
|
|
354
342
|
}
|
|
355
343
|
function getEffectiveUnitIsolationMode(basePath) {
|
|
356
|
-
return resolveEffectiveUnitIsolationMode(getIsolationMode(basePath), s.isolationDegraded);
|
|
344
|
+
return resolveEffectiveUnitIsolationMode(getIsolationMode(basePath), s.isolationDegraded, s.strandedRecoveryIsolationMode);
|
|
357
345
|
}
|
|
358
346
|
/** Crash recovery prompt — set by startAuto, consumed by the main loop */
|
|
359
347
|
/** Pending verification retry — set when gate fails with retries remaining, consumed by autoLoop */
|
|
@@ -569,6 +557,13 @@ export function getAutoModeStartModel() {
|
|
|
569
557
|
export function setCurrentDispatchedModelId(model) {
|
|
570
558
|
s.currentDispatchedModelId = model ? `${model.provider}/${model.id}` : null;
|
|
571
559
|
}
|
|
560
|
+
/**
|
|
561
|
+
* Update the active unit model after runtime recovery switches models mid-unit.
|
|
562
|
+
* The next session restore path reads this field before dispatching again.
|
|
563
|
+
*/
|
|
564
|
+
export function setCurrentUnitModelForRecovery(model) {
|
|
565
|
+
s.currentUnitModel = model;
|
|
566
|
+
}
|
|
572
567
|
// Tool tracking — delegates to auto-tool-tracking.ts
|
|
573
568
|
export function markToolStart(toolCallId, toolName) {
|
|
574
569
|
_markToolStart(toolCallId, s.active, toolName);
|
|
@@ -635,6 +630,35 @@ export function stopAutoRemote(projectRoot) {
|
|
|
635
630
|
return { found: false, error: err.message };
|
|
636
631
|
}
|
|
637
632
|
}
|
|
633
|
+
/**
|
|
634
|
+
* Force-stop a remote auto-mode session before stealing its lock.
|
|
635
|
+
* The normal stop path stays SIGTERM-only so cooperative sessions can clean up;
|
|
636
|
+
* this path is only for the explicit "Force start" action.
|
|
637
|
+
*/
|
|
638
|
+
export function forceStopAutoRemote(projectRoot) {
|
|
639
|
+
const lock = readCrashLock(projectRoot);
|
|
640
|
+
if (!lock)
|
|
641
|
+
return { found: false };
|
|
642
|
+
if (lock.pid === process.pid) {
|
|
643
|
+
clearLock(projectRoot);
|
|
644
|
+
return { found: false };
|
|
645
|
+
}
|
|
646
|
+
if (!isLockProcessAlive(lock)) {
|
|
647
|
+
clearLock(projectRoot);
|
|
648
|
+
return { found: false };
|
|
649
|
+
}
|
|
650
|
+
try {
|
|
651
|
+
process.kill(lock.pid, "SIGTERM");
|
|
652
|
+
if (isLockProcessAlive(lock)) {
|
|
653
|
+
process.kill(lock.pid, "SIGKILL");
|
|
654
|
+
}
|
|
655
|
+
clearLock(projectRoot);
|
|
656
|
+
return { found: true, pid: lock.pid };
|
|
657
|
+
}
|
|
658
|
+
catch (err) {
|
|
659
|
+
return { found: false, error: err.message };
|
|
660
|
+
}
|
|
661
|
+
}
|
|
638
662
|
/**
|
|
639
663
|
* Check if a remote auto-mode session is running (from a different process).
|
|
640
664
|
* Reads the crash lock, checks PID liveness, and returns session details.
|
|
@@ -727,6 +751,9 @@ function pauseAutoUnitIdentityMatches(expected) {
|
|
|
727
751
|
s.currentUnit.id === expected.id &&
|
|
728
752
|
s.currentUnit.startedAt === expected.startedAt;
|
|
729
753
|
}
|
|
754
|
+
function shouldPreserveCoordinationForPause(errorContext) {
|
|
755
|
+
return errorContext?.category === "provider" && errorContext.isTransient === true;
|
|
756
|
+
}
|
|
730
757
|
function setLifecycleOutcome(ctx, input) {
|
|
731
758
|
if (!ctx?.hasUI)
|
|
732
759
|
return;
|
|
@@ -993,8 +1020,8 @@ export async function stopAuto(ctx, pi, reason, options = {}) {
|
|
|
993
1020
|
if (!s.active && !s.paused)
|
|
994
1021
|
return;
|
|
995
1022
|
const loadedPreferences = loadEffectiveGSDPreferences(s.basePath || undefined)?.preferences;
|
|
996
|
-
const stopNotificationPrefix =
|
|
997
|
-
const displayReason =
|
|
1023
|
+
const stopNotificationPrefix = formatStopNoticePrefix(reason);
|
|
1024
|
+
const displayReason = stopNoticeDisplayReason(reason);
|
|
998
1025
|
const isHeadlessStop = process.env.GSD_HEADLESS === "1";
|
|
999
1026
|
const completionStopRequested = Boolean(options.completionWidget);
|
|
1000
1027
|
const preserveCloseoutTranscript = !isHeadlessStop && (options.preserveCloseoutTranscript ?? completionStopRequested);
|
|
@@ -1561,7 +1588,7 @@ export async function pauseAuto(ctx, _pi, _errorContext, options = {}) {
|
|
|
1561
1588
|
releaseSessionLock(lockBase());
|
|
1562
1589
|
clearLock(lockBase());
|
|
1563
1590
|
}
|
|
1564
|
-
if (s.workerId) {
|
|
1591
|
+
if (s.workerId && !shouldPreserveCoordinationForPause(_errorContext)) {
|
|
1565
1592
|
try {
|
|
1566
1593
|
if (s.currentMilestoneId && s.milestoneLeaseToken) {
|
|
1567
1594
|
releaseMilestoneLease(s.workerId, s.currentMilestoneId, s.milestoneLeaseToken);
|
|
@@ -1836,7 +1863,7 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1836
1863
|
if (freshStartAssessment.classification === "running") {
|
|
1837
1864
|
const pid = freshStartAssessment.lock?.pid;
|
|
1838
1865
|
ctx.ui.notify(pid
|
|
1839
|
-
? `Another auto-mode session (PID ${pid}) appears to be running.\
|
|
1866
|
+
? `Another auto-mode session (PID ${pid}) appears to be running.\nRun \`/gsd stop\` for graceful shutdown, or choose "Force start" from \`/gsd auto\` to terminate it.`
|
|
1840
1867
|
: "Another auto-mode session appears to be running.", "error");
|
|
1841
1868
|
return;
|
|
1842
1869
|
}
|