gsd-pi 2.73.1-dev.d987996 → 2.74.0-dev.14c45ac
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-web-branch.d.ts +4 -3
- package/dist/cli-web-branch.js +10 -7
- package/dist/cli.js +184 -206
- package/dist/headless-query.js +4 -1
- package/dist/help-text.js +23 -0
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +1 -1
- package/dist/onboarding.js +59 -53
- package/dist/resource-loader.js +2 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +68 -4
- package/dist/resources/extensions/gsd/activity-log.js +16 -0
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +11 -4
- package/dist/resources/extensions/gsd/auto/loop.js +147 -10
- package/dist/resources/extensions/gsd/auto/phases.js +173 -13
- package/dist/resources/extensions/gsd/auto/session.js +10 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +22 -4
- package/dist/resources/extensions/gsd/auto-model-selection.js +105 -16
- package/dist/resources/extensions/gsd/auto-post-unit.js +254 -15
- package/dist/resources/extensions/gsd/auto-prompts.js +12 -0
- package/dist/resources/extensions/gsd/auto-start.js +23 -6
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +13 -0
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +18 -0
- package/dist/resources/extensions/gsd/auto-verification.js +186 -3
- package/dist/resources/extensions/gsd/auto.js +65 -12
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +21 -8
- package/dist/resources/extensions/gsd/commands/catalog.js +26 -1
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +25 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +68 -9
- package/dist/resources/extensions/gsd/commands-add-tests.js +111 -0
- package/dist/resources/extensions/gsd/commands-backlog.js +140 -0
- package/dist/resources/extensions/gsd/commands-do.js +79 -0
- package/dist/resources/extensions/gsd/commands-extract-learnings.js +225 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +8 -2
- package/dist/resources/extensions/gsd/commands-maintenance.js +6 -6
- package/dist/resources/extensions/gsd/commands-pr-branch.js +180 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands-session-report.js +82 -0
- package/dist/resources/extensions/gsd/commands-ship.js +187 -0
- package/dist/resources/extensions/gsd/db-writer.js +3 -5
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +15 -2
- package/dist/resources/extensions/gsd/git-service.js +49 -1
- package/dist/resources/extensions/gsd/graph-context.js +157 -0
- package/dist/resources/extensions/gsd/gsd-db.js +581 -2
- package/dist/resources/extensions/gsd/guided-flow.js +23 -0
- package/dist/resources/extensions/gsd/index.js +15 -2
- package/dist/resources/extensions/gsd/init-wizard.js +1 -0
- package/dist/resources/extensions/gsd/journal.js +27 -0
- package/dist/resources/extensions/gsd/md-importer.js +3 -4
- package/dist/resources/extensions/gsd/memory-store.js +19 -51
- package/dist/resources/extensions/gsd/metrics.js +19 -0
- package/dist/resources/extensions/gsd/milestone-validation-gates.js +13 -12
- package/dist/resources/extensions/gsd/native-git-bridge.js +7 -4
- package/dist/resources/extensions/gsd/notification-widget.js +2 -2
- package/dist/resources/extensions/gsd/parallel-orchestrator.js +33 -1
- package/dist/resources/extensions/gsd/preferences-models.js +63 -3
- package/dist/resources/extensions/gsd/preferences-types.js +2 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +130 -2
- package/dist/resources/extensions/gsd/preferences.js +26 -0
- package/dist/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/dist/resources/extensions/gsd/slice-parallel-orchestrator.js +12 -2
- package/dist/resources/extensions/gsd/state.js +66 -15
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +18 -0
- package/dist/resources/extensions/gsd/tools/complete-slice.js +20 -0
- package/dist/resources/extensions/gsd/tools/validate-milestone.js +39 -4
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +3 -14
- package/dist/resources/extensions/gsd/triage-resolution.js +2 -5
- package/dist/resources/extensions/gsd/unit-ownership.js +1 -1
- package/dist/resources/extensions/gsd/uok/audit-toggle.js +7 -0
- package/dist/resources/extensions/gsd/uok/audit.js +40 -0
- package/dist/resources/extensions/gsd/uok/contracts.js +1 -0
- package/dist/resources/extensions/gsd/uok/execution-graph.js +179 -0
- package/dist/resources/extensions/gsd/uok/flags.js +29 -0
- package/dist/resources/extensions/gsd/uok/gate-runner.js +109 -0
- package/dist/resources/extensions/gsd/uok/gitops.js +53 -0
- package/dist/resources/extensions/gsd/uok/kernel.js +80 -0
- package/dist/resources/extensions/gsd/uok/loop-adapter.js +133 -0
- package/dist/resources/extensions/gsd/uok/model-policy.js +66 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +132 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +22 -0
- package/dist/resources/extensions/gsd/workflow-manifest.js +8 -69
- package/dist/resources/extensions/gsd/workflow-migration.js +21 -22
- package/dist/resources/extensions/gsd/workflow-projections.js +4 -1
- package/dist/resources/extensions/gsd/workflow-reconcile.js +14 -11
- package/dist/resources/extensions/ttsr/ttsr-manager.js +3 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -0
- package/dist/update-check.d.ts +1 -0
- package/dist/update-check.js +13 -5
- package/dist/update-cmd.js +4 -3
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +11 -11
- package/dist/web/standalone/.next/build-manifest.json +2 -2
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/required-server-files.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/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 +11 -11
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +5 -5
- package/dist/web/standalone/.next/server/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/server.js +1 -1
- package/package.json +3 -3
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/dist/index.d.ts +3 -0
- package/packages/mcp-server/dist/index.d.ts.map +1 -1
- package/packages/mcp-server/dist/index.js +3 -0
- package/packages/mcp-server/dist/index.js.map +1 -1
- package/packages/mcp-server/dist/readers/graph.d.ts +87 -0
- package/packages/mcp-server/dist/readers/graph.d.ts.map +1 -0
- package/packages/mcp-server/dist/readers/graph.js +655 -0
- package/packages/mcp-server/dist/readers/graph.js.map +1 -0
- package/packages/mcp-server/dist/readers/index.d.ts +2 -0
- package/packages/mcp-server/dist/readers/index.d.ts.map +1 -1
- package/packages/mcp-server/dist/readers/index.js +1 -0
- package/packages/mcp-server/dist/readers/index.js.map +1 -1
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +65 -0
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/index.ts +15 -0
- package/packages/mcp-server/src/readers/graph.test.ts +604 -0
- package/packages/mcp-server/src/readers/graph.ts +855 -0
- package/packages/mcp-server/src/readers/index.ts +12 -0
- package/packages/mcp-server/src/server.ts +83 -0
- package/packages/mcp-server/tsconfig.json +1 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -0
- package/packages/native/package.json +2 -2
- package/packages/native/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.json +1 -0
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-ai/dist/index.d.ts +1 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/overflow.js +12 -0
- package/packages/pi-ai/dist/utils/overflow.js.map +1 -1
- package/packages/pi-ai/dist/utils/tests/overflow.test.d.ts +2 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.js +50 -0
- package/packages/pi-ai/dist/utils/tests/overflow.test.js.map +1 -0
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/src/index.ts +4 -0
- package/packages/pi-ai/src/utils/overflow.ts +14 -1
- package/packages/pi-ai/src/utils/tests/overflow.test.ts +58 -0
- package/packages/pi-ai/tsconfig.json +1 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +511 -8
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +5 -5
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js +45 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js +52 -0
- package/packages/pi-coding-agent/dist/core/model-registry-env-fallback.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry.js +2 -2
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts +12 -2
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js +61 -28
- package/packages/pi-coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +2 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js +9 -3
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js +52 -0
- package/packages/pi-coding-agent/dist/modes/interactive/components/dynamic-border.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +165 -20
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js +11 -3
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +620 -8
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +5 -5
- package/packages/pi-coding-agent/src/core/compaction-utils.test.ts +50 -0
- package/packages/pi-coding-agent/src/core/model-registry-env-fallback.test.ts +59 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/assistant-message.ts +74 -32
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.test.ts +73 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/dynamic-border.ts +9 -3
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +189 -25
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +11 -3
- package/packages/pi-coding-agent/src/types/ambient-modules.d.ts +69 -0
- package/packages/pi-coding-agent/tsconfig.json +3 -2
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -0
- package/packages/pi-tui/dist/__tests__/tui.test.js +60 -1
- package/packages/pi-tui/dist/__tests__/tui.test.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 +32 -3
- package/packages/pi-tui/dist/tui.js.map +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/src/__tests__/tui.test.ts +76 -1
- package/packages/pi-tui/src/tui.ts +31 -3
- package/packages/pi-tui/tsconfig.json +1 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -0
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.json +1 -0
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -0
- package/pkg/package.json +1 -1
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +107 -5
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +111 -2
- package/src/resources/extensions/gsd/activity-log.ts +21 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +12 -4
- package/src/resources/extensions/gsd/auto/loop-deps.ts +10 -0
- package/src/resources/extensions/gsd/auto/loop.ts +159 -10
- package/src/resources/extensions/gsd/auto/phases.ts +213 -13
- package/src/resources/extensions/gsd/auto/session.ts +10 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +26 -10
- package/src/resources/extensions/gsd/auto-model-selection.ts +151 -16
- package/src/resources/extensions/gsd/auto-post-unit.ts +278 -16
- package/src/resources/extensions/gsd/auto-prompts.ts +13 -0
- package/src/resources/extensions/gsd/auto-start.ts +30 -6
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +17 -0
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +25 -1
- package/src/resources/extensions/gsd/auto-verification.ts +225 -3
- package/src/resources/extensions/gsd/auto.ts +72 -16
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +24 -8
- package/src/resources/extensions/gsd/commands/catalog.ts +26 -1
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +25 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +74 -9
- package/src/resources/extensions/gsd/commands-add-tests.ts +137 -0
- package/src/resources/extensions/gsd/commands-backlog.ts +182 -0
- package/src/resources/extensions/gsd/commands-do.ts +109 -0
- package/src/resources/extensions/gsd/commands-extract-learnings.ts +304 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +8 -2
- package/src/resources/extensions/gsd/commands-maintenance.ts +6 -6
- package/src/resources/extensions/gsd/commands-pr-branch.ts +234 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands-session-report.ts +101 -0
- package/src/resources/extensions/gsd/commands-ship.ts +219 -0
- package/src/resources/extensions/gsd/db-writer.ts +3 -5
- package/src/resources/extensions/gsd/docs/preferences-reference.md +15 -2
- package/src/resources/extensions/gsd/git-service.ts +68 -0
- package/src/resources/extensions/gsd/graph-context.ts +212 -0
- package/src/resources/extensions/gsd/gsd-db.ts +788 -3
- package/src/resources/extensions/gsd/guided-flow.ts +32 -0
- package/src/resources/extensions/gsd/index.ts +18 -2
- package/src/resources/extensions/gsd/init-wizard.ts +3 -2
- package/src/resources/extensions/gsd/journal.ts +30 -0
- package/src/resources/extensions/gsd/md-importer.ts +3 -5
- package/src/resources/extensions/gsd/memory-store.ts +31 -62
- package/src/resources/extensions/gsd/metrics.ts +26 -0
- package/src/resources/extensions/gsd/milestone-validation-gates.ts +13 -14
- package/src/resources/extensions/gsd/native-git-bridge.ts +11 -12
- package/src/resources/extensions/gsd/notification-widget.ts +2 -2
- package/src/resources/extensions/gsd/parallel-orchestrator.ts +40 -1
- package/src/resources/extensions/gsd/preferences-models.ts +61 -3
- package/src/resources/extensions/gsd/preferences-types.ts +44 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +130 -2
- package/src/resources/extensions/gsd/preferences.ts +28 -0
- package/src/resources/extensions/gsd/prompts/add-tests.md +35 -0
- package/src/resources/extensions/gsd/session-lock.ts +14 -2
- package/src/resources/extensions/gsd/slice-parallel-orchestrator.ts +20 -1
- package/src/resources/extensions/gsd/state.ts +80 -17
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +18 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +9 -5
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +20 -0
- package/src/resources/extensions/gsd/tests/auto-post-unit-step-message.test.ts +53 -0
- package/src/resources/extensions/gsd/tests/auto-project-root-env.test.ts +7 -3
- package/src/resources/extensions/gsd/tests/auto-start-model-capture.test.ts +51 -2
- package/src/resources/extensions/gsd/tests/cold-resume-db-reopen.test.ts +6 -2
- package/src/resources/extensions/gsd/tests/commands-backlog.test.ts +158 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +127 -0
- package/src/resources/extensions/gsd/tests/commands-extract-learnings.test.ts +340 -0
- package/src/resources/extensions/gsd/tests/commands-pr-branch.test.ts +68 -0
- package/src/resources/extensions/gsd/tests/commands-session-report.test.ts +82 -0
- package/src/resources/extensions/gsd/tests/commands-ship.test.ts +71 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +142 -0
- package/src/resources/extensions/gsd/tests/complete-slice.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/completed-at-reconcile.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/derive-state-crossval.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-db.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/derive-state-helpers.test.ts +68 -8
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/extension-bootstrap-isolation.test.ts +154 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +10 -7
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +137 -1
- package/src/resources/extensions/gsd/tests/graph-context.test.ts +337 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/integration/state-machine-edge-cases.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -2
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -3
- package/src/resources/extensions/gsd/tests/model-isolation.test.ts +91 -2
- package/src/resources/extensions/gsd/tests/native-git-bridge-exec-fallback.test.ts +140 -0
- package/src/resources/extensions/gsd/tests/post-exec-retry-bypass.test.ts +79 -1
- package/src/resources/extensions/gsd/tests/post-unit-state-rebuild.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/pre-execution-pause-wiring.test.ts +40 -1
- package/src/resources/extensions/gsd/tests/preferences.test.ts +47 -0
- package/src/resources/extensions/gsd/tests/single-writer-invariant.test.ts +180 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +5 -7
- package/src/resources/extensions/gsd/tests/token-profile.test.ts +9 -6
- package/src/resources/extensions/gsd/tests/uok-audit-unified.test.ts +101 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +69 -0
- package/src/resources/extensions/gsd/tests/uok-flags.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/uok-gate-runner.test.ts +70 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-turn-action.test.ts +85 -0
- package/src/resources/extensions/gsd/tests/uok-gitops-wiring.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/uok-model-policy.test.ts +89 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +167 -0
- package/src/resources/extensions/gsd/tests/uok-preferences.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-stuck-guard.test.ts +179 -0
- package/src/resources/extensions/gsd/tests/validate-milestone-write-order.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +223 -0
- package/src/resources/extensions/gsd/tools/complete-slice.ts +26 -0
- package/src/resources/extensions/gsd/tools/validate-milestone.ts +48 -3
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +3 -11
- package/src/resources/extensions/gsd/triage-resolution.ts +2 -7
- package/src/resources/extensions/gsd/types.ts +1 -1
- package/src/resources/extensions/gsd/unit-ownership.ts +2 -2
- package/src/resources/extensions/gsd/uok/audit-toggle.ts +9 -0
- package/src/resources/extensions/gsd/uok/audit.ts +51 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +135 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +241 -0
- package/src/resources/extensions/gsd/uok/flags.ts +45 -0
- package/src/resources/extensions/gsd/uok/gate-runner.ts +146 -0
- package/src/resources/extensions/gsd/uok/gitops.ts +75 -0
- package/src/resources/extensions/gsd/uok/kernel.ts +105 -0
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +162 -0
- package/src/resources/extensions/gsd/uok/model-policy.ts +112 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +156 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +25 -0
- package/src/resources/extensions/gsd/workflow-manifest.ts +9 -104
- package/src/resources/extensions/gsd/workflow-migration.ts +21 -29
- package/src/resources/extensions/gsd/workflow-projections.ts +8 -1
- package/src/resources/extensions/gsd/workflow-reconcile.ts +15 -15
- package/src/resources/extensions/ttsr/ttsr-manager.ts +10 -5
- /package/dist/web/standalone/.next/static/{cGmbVq2su4f9tMpgIkG8u → ZMKM0OI0CrTgzKWbgfPOg}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{cGmbVq2su4f9tMpgIkG8u → ZMKM0OI0CrTgzKWbgfPOg}/_ssgManifest.js +0 -0
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
mergePendingToolCalls,
|
|
11
11
|
resolveClaudePermissionMode,
|
|
12
12
|
buildPromptFromContext,
|
|
13
|
+
buildSdkQueryPrompt,
|
|
13
14
|
buildSdkOptions,
|
|
14
15
|
createClaudeCodeElicitationHandler,
|
|
16
|
+
extractImageBlocksFromContext,
|
|
15
17
|
extractToolResultsFromSdkUserMessage,
|
|
16
18
|
getClaudeLookupCommand,
|
|
17
19
|
parseAskUserQuestionsElicitation,
|
|
@@ -167,6 +169,92 @@ describe("stream-adapter — full context prompt (#2859)", () => {
|
|
|
167
169
|
});
|
|
168
170
|
});
|
|
169
171
|
|
|
172
|
+
describe("stream-adapter — image prompt forwarding (#4183)", () => {
|
|
173
|
+
test("extractImageBlocksFromContext maps user image parts to Anthropic base64 image blocks", () => {
|
|
174
|
+
const context: Context = {
|
|
175
|
+
messages: [
|
|
176
|
+
{
|
|
177
|
+
role: "user",
|
|
178
|
+
content: [
|
|
179
|
+
{ type: "text", text: "look" },
|
|
180
|
+
{
|
|
181
|
+
type: "image",
|
|
182
|
+
data: "data:image/png;base64,abc123",
|
|
183
|
+
mimeType: "image/png",
|
|
184
|
+
},
|
|
185
|
+
],
|
|
186
|
+
} as Message,
|
|
187
|
+
],
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const imageBlocks = extractImageBlocksFromContext(context);
|
|
191
|
+
assert.deepEqual(imageBlocks, [
|
|
192
|
+
{
|
|
193
|
+
type: "image",
|
|
194
|
+
source: {
|
|
195
|
+
type: "base64",
|
|
196
|
+
media_type: "image/png",
|
|
197
|
+
data: "abc123",
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
]);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test("buildSdkQueryPrompt returns plain string when no images exist in context", () => {
|
|
204
|
+
const context: Context = {
|
|
205
|
+
messages: [{ role: "user", content: "hello" } as Message],
|
|
206
|
+
};
|
|
207
|
+
const textPrompt = buildPromptFromContext(context);
|
|
208
|
+
|
|
209
|
+
const prompt = buildSdkQueryPrompt(context, textPrompt);
|
|
210
|
+
assert.equal(typeof prompt, "string");
|
|
211
|
+
assert.equal(prompt, textPrompt);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test("buildSdkQueryPrompt wraps images and prompt text in an SDK user message iterable", async () => {
|
|
215
|
+
const context: Context = {
|
|
216
|
+
messages: [
|
|
217
|
+
{
|
|
218
|
+
role: "user",
|
|
219
|
+
content: [
|
|
220
|
+
{ type: "image", data: "ZmFrZQ==", mimeType: "image/jpeg" },
|
|
221
|
+
{ type: "text", text: "What is in this image?" },
|
|
222
|
+
],
|
|
223
|
+
} as Message,
|
|
224
|
+
],
|
|
225
|
+
};
|
|
226
|
+
const textPrompt = buildPromptFromContext(context);
|
|
227
|
+
|
|
228
|
+
const prompt = buildSdkQueryPrompt(context, textPrompt);
|
|
229
|
+
assert.notEqual(typeof prompt, "string");
|
|
230
|
+
assert.ok(prompt && typeof (prompt as any)[Symbol.asyncIterator] === "function");
|
|
231
|
+
|
|
232
|
+
const messages: any[] = [];
|
|
233
|
+
for await (const item of prompt as AsyncIterable<any>) {
|
|
234
|
+
messages.push(item);
|
|
235
|
+
}
|
|
236
|
+
assert.equal(messages.length, 1);
|
|
237
|
+
assert.deepEqual(messages[0], {
|
|
238
|
+
type: "user",
|
|
239
|
+
message: {
|
|
240
|
+
role: "user",
|
|
241
|
+
content: [
|
|
242
|
+
{
|
|
243
|
+
type: "image",
|
|
244
|
+
source: {
|
|
245
|
+
type: "base64",
|
|
246
|
+
media_type: "image/jpeg",
|
|
247
|
+
data: "ZmFrZQ==",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
{ type: "text", text: textPrompt },
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
parent_tool_use_id: null,
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
|
|
170
258
|
// ---------------------------------------------------------------------------
|
|
171
259
|
// Bug #4102 — transcript fabrication regression tests
|
|
172
260
|
// ---------------------------------------------------------------------------
|
|
@@ -343,6 +431,26 @@ describe("stream-adapter — session persistence (#2859)", () => {
|
|
|
343
431
|
);
|
|
344
432
|
});
|
|
345
433
|
|
|
434
|
+
test("buildSdkOptions maps reasoning to effort for adaptive Claude Code models (#3917)", () => {
|
|
435
|
+
const options = buildSdkOptions("claude-sonnet-4-6", "test", undefined, { reasoning: "high" });
|
|
436
|
+
assert.equal(options.effort, "high");
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
test("buildSdkOptions upgrades xhigh reasoning to max for opus 4.6 (#3917)", () => {
|
|
440
|
+
const options = buildSdkOptions("claude-opus-4-6", "test", undefined, { reasoning: "xhigh" });
|
|
441
|
+
assert.equal(options.effort, "max");
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
test("buildSdkOptions omits effort when reasoning is undefined (#3917)", () => {
|
|
445
|
+
const options = buildSdkOptions("claude-sonnet-4-6", "test");
|
|
446
|
+
assert.equal("effort" in options, false);
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
test("buildSdkOptions omits effort for non-adaptive Claude models (#3917)", () => {
|
|
450
|
+
const options = buildSdkOptions("claude-sonnet-4-20250514", "test", undefined, { reasoning: "high" });
|
|
451
|
+
assert.equal("effort" in options, false);
|
|
452
|
+
});
|
|
453
|
+
|
|
346
454
|
test("buildSdkOptions includes workflow MCP server config when env is set", () => {
|
|
347
455
|
const prev = {
|
|
348
456
|
GSD_WORKFLOW_MCP_COMMAND: process.env.GSD_WORKFLOW_MCP_COMMAND,
|
|
@@ -774,11 +882,12 @@ describe("stream-adapter — MCP elicitation bridge", () => {
|
|
|
774
882
|
},
|
|
775
883
|
};
|
|
776
884
|
|
|
885
|
+
const secureValue = "ui-collected-value";
|
|
777
886
|
const inputCalls: Array<{ opts?: { secure?: boolean } }> = [];
|
|
778
887
|
const handler = createClaudeCodeElicitationHandler({
|
|
779
888
|
input: async (_title: string, _placeholder?: string, opts?: { secure?: boolean }) => {
|
|
780
889
|
inputCalls.push({ opts });
|
|
781
|
-
return
|
|
890
|
+
return secureValue;
|
|
782
891
|
},
|
|
783
892
|
} as any);
|
|
784
893
|
assert.ok(handler);
|
|
@@ -787,7 +896,7 @@ describe("stream-adapter — MCP elicitation bridge", () => {
|
|
|
787
896
|
assert.deepEqual(result, {
|
|
788
897
|
action: "accept",
|
|
789
898
|
content: {
|
|
790
|
-
TEST_SECURE_FIELD:
|
|
899
|
+
TEST_SECURE_FIELD: secureValue,
|
|
791
900
|
},
|
|
792
901
|
});
|
|
793
902
|
assert.equal(inputCalls.length, 1);
|
|
@@ -16,6 +16,8 @@ import { GSDError, GSD_IO_ERROR } from "./errors.js";
|
|
|
16
16
|
const SEQ_PREFIX_RE = /^(\d+)-/;
|
|
17
17
|
import type { ExtensionContext } from "@gsd/pi-coding-agent";
|
|
18
18
|
import { gsdRoot } from "./paths.js";
|
|
19
|
+
import { buildAuditEnvelope, emitUokAuditEvent } from "./uok/audit.js";
|
|
20
|
+
import { isUnifiedAuditEnabled } from "./uok/audit-toggle.js";
|
|
19
21
|
|
|
20
22
|
interface ActivityLogState {
|
|
21
23
|
nextSeq: number;
|
|
@@ -132,6 +134,25 @@ export function saveActivityLog(
|
|
|
132
134
|
}
|
|
133
135
|
state.nextSeq += 1;
|
|
134
136
|
state.lastSnapshotKeyByUnit.set(unitKey, key);
|
|
137
|
+
|
|
138
|
+
if (isUnifiedAuditEnabled()) {
|
|
139
|
+
emitUokAuditEvent(
|
|
140
|
+
basePath,
|
|
141
|
+
buildAuditEnvelope({
|
|
142
|
+
traceId: `activity:${unitType}:${unitId}`,
|
|
143
|
+
turnId: unitId,
|
|
144
|
+
category: "execution",
|
|
145
|
+
type: "activity-log-saved",
|
|
146
|
+
payload: {
|
|
147
|
+
unitType,
|
|
148
|
+
unitId,
|
|
149
|
+
filePath,
|
|
150
|
+
entryCount: entries.length,
|
|
151
|
+
},
|
|
152
|
+
}),
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
135
156
|
return filePath;
|
|
136
157
|
} catch (e) {
|
|
137
158
|
// Don't let logging failures break auto-mode
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import type { WindowEntry } from "./types.js";
|
|
8
|
+
import { summarizeLogs } from "../workflow-logger.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Pattern matching ENOENT errors with a file path.
|
|
@@ -28,6 +29,13 @@ export function detectStuck(
|
|
|
28
29
|
): { stuck: true; reason: string } | null {
|
|
29
30
|
if (window.length < 2) return null;
|
|
30
31
|
|
|
32
|
+
// Peek (not drain) the workflow-logger buffer so stuck reasons can surface
|
|
33
|
+
// the underlying diagnostic context (projection failures, DB degradations,
|
|
34
|
+
// reconcile warnings) that usually explains *why* the loop is stuck. The
|
|
35
|
+
// auto-loop's finalize step owns the buffer lifecycle — this is read-only.
|
|
36
|
+
const loggerSummary = summarizeLogs();
|
|
37
|
+
const suffix = loggerSummary ? ` — ${loggerSummary}` : "";
|
|
38
|
+
|
|
31
39
|
const last = window[window.length - 1];
|
|
32
40
|
const prev = window[window.length - 2];
|
|
33
41
|
|
|
@@ -35,7 +43,7 @@ export function detectStuck(
|
|
|
35
43
|
if (last.error && prev.error && last.error === prev.error) {
|
|
36
44
|
return {
|
|
37
45
|
stuck: true,
|
|
38
|
-
reason: `Same error repeated: ${last.error.slice(0, 200)}`,
|
|
46
|
+
reason: `Same error repeated: ${last.error.slice(0, 200)}${suffix}`,
|
|
39
47
|
};
|
|
40
48
|
}
|
|
41
49
|
|
|
@@ -45,7 +53,7 @@ export function detectStuck(
|
|
|
45
53
|
if (lastThree.every((u) => u.key === last.key)) {
|
|
46
54
|
return {
|
|
47
55
|
stuck: true,
|
|
48
|
-
reason: `${last.key} derived 3 consecutive times without progress`,
|
|
56
|
+
reason: `${last.key} derived 3 consecutive times without progress${suffix}`,
|
|
49
57
|
};
|
|
50
58
|
}
|
|
51
59
|
}
|
|
@@ -60,7 +68,7 @@ export function detectStuck(
|
|
|
60
68
|
) {
|
|
61
69
|
return {
|
|
62
70
|
stuck: true,
|
|
63
|
-
reason: `Oscillation detected: ${w[0].key} ↔ ${w[1].key}`,
|
|
71
|
+
reason: `Oscillation detected: ${w[0].key} ↔ ${w[1].key}${suffix}`,
|
|
64
72
|
};
|
|
65
73
|
}
|
|
66
74
|
}
|
|
@@ -77,7 +85,7 @@ export function detectStuck(
|
|
|
77
85
|
if (count >= 2) {
|
|
78
86
|
return {
|
|
79
87
|
stuck: true,
|
|
80
|
-
reason: `Missing file referenced twice: ${filePath} (ENOENT)`,
|
|
88
|
+
reason: `Missing file referenced twice: ${filePath} (ENOENT)${suffix}`,
|
|
81
89
|
};
|
|
82
90
|
}
|
|
83
91
|
enoentPaths.set(filePath, count);
|
|
@@ -21,6 +21,7 @@ import type { WorktreeResolver } from "../worktree-resolver.js";
|
|
|
21
21
|
import type { CmuxLogLevel } from "../../cmux/index.js";
|
|
22
22
|
import type { JournalEntry } from "../journal.js";
|
|
23
23
|
import type { MergeReconcileResult } from "../auto-recovery.js";
|
|
24
|
+
import type { UokTurnObserver } from "../uok/contracts.js";
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Dependencies injected by the caller (auto.ts startAuto) so autoLoop
|
|
@@ -180,6 +181,12 @@ export interface LoopDeps {
|
|
|
180
181
|
startedAt: number,
|
|
181
182
|
opts?: CloseoutOptions & Record<string, unknown>,
|
|
182
183
|
) => Promise<void>;
|
|
184
|
+
autoCommitUnit?: (
|
|
185
|
+
basePath: string,
|
|
186
|
+
unitType: string,
|
|
187
|
+
unitId: string,
|
|
188
|
+
ctx?: ExtensionContext,
|
|
189
|
+
) => Promise<string | null>;
|
|
183
190
|
recordOutcome: (unitType: string, tier: string, success: boolean) => void;
|
|
184
191
|
writeLock: (
|
|
185
192
|
lockBase: string,
|
|
@@ -268,4 +275,7 @@ export interface LoopDeps {
|
|
|
268
275
|
|
|
269
276
|
// Journal
|
|
270
277
|
emitJournalEvent: (entry: JournalEntry) => void;
|
|
278
|
+
|
|
279
|
+
// UOK (optional, flag-gated)
|
|
280
|
+
uokObserver?: UokTurnObserver;
|
|
271
281
|
}
|
|
@@ -31,6 +31,8 @@ import { isInfrastructureError, isTransientCooldownError, getCooldownRetryAfterM
|
|
|
31
31
|
import { resolveEngine } from "../engine-resolver.js";
|
|
32
32
|
import { logWarning } from "../workflow-logger.js";
|
|
33
33
|
import { gsdRoot } from "../paths.js";
|
|
34
|
+
import { resolveUokFlags } from "../uok/flags.js";
|
|
35
|
+
import { scheduleSidecarQueue } from "../uok/execution-graph.js";
|
|
34
36
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
35
37
|
import { join } from "node:path";
|
|
36
38
|
|
|
@@ -128,6 +130,43 @@ export async function autoLoop(
|
|
|
128
130
|
const flowId = randomUUID();
|
|
129
131
|
let seqCounter = 0;
|
|
130
132
|
const nextSeq = () => ++seqCounter;
|
|
133
|
+
const turnId = randomUUID();
|
|
134
|
+
s.currentTraceId = flowId;
|
|
135
|
+
s.currentTurnId = turnId;
|
|
136
|
+
const turnStartedAt = new Date().toISOString();
|
|
137
|
+
let observedUnitType: string | undefined;
|
|
138
|
+
let observedUnitId: string | undefined;
|
|
139
|
+
let turnFinished = false;
|
|
140
|
+
const finishTurn = (
|
|
141
|
+
status: "completed" | "failed" | "paused" | "stopped" | "skipped" | "retry",
|
|
142
|
+
failureClass: "none" | "unknown" | "manual-attention" | "timeout" | "execution" | "closeout" | "git" = "none",
|
|
143
|
+
error?: string,
|
|
144
|
+
): void => {
|
|
145
|
+
if (turnFinished) return;
|
|
146
|
+
turnFinished = true;
|
|
147
|
+
deps.uokObserver?.onTurnResult({
|
|
148
|
+
traceId: flowId,
|
|
149
|
+
turnId,
|
|
150
|
+
iteration,
|
|
151
|
+
unitType: observedUnitType,
|
|
152
|
+
unitId: observedUnitId,
|
|
153
|
+
status,
|
|
154
|
+
failureClass,
|
|
155
|
+
phaseResults: [],
|
|
156
|
+
error,
|
|
157
|
+
startedAt: turnStartedAt,
|
|
158
|
+
finishedAt: new Date().toISOString(),
|
|
159
|
+
});
|
|
160
|
+
s.currentTraceId = null;
|
|
161
|
+
s.currentTurnId = null;
|
|
162
|
+
};
|
|
163
|
+
deps.uokObserver?.onTurnStart({
|
|
164
|
+
traceId: flowId,
|
|
165
|
+
turnId,
|
|
166
|
+
iteration,
|
|
167
|
+
basePath: s.basePath,
|
|
168
|
+
startedAt: turnStartedAt,
|
|
169
|
+
});
|
|
131
170
|
|
|
132
171
|
if (iteration > MAX_LOOP_ITERATIONS) {
|
|
133
172
|
debugLog("autoLoop", {
|
|
@@ -140,6 +179,7 @@ export async function autoLoop(
|
|
|
140
179
|
pi,
|
|
141
180
|
`Safety: loop exceeded ${MAX_LOOP_ITERATIONS} iterations — possible runaway`,
|
|
142
181
|
);
|
|
182
|
+
finishTurn("stopped", "manual-attention", "max-iterations");
|
|
143
183
|
break;
|
|
144
184
|
}
|
|
145
185
|
|
|
@@ -157,22 +197,32 @@ export async function autoLoop(
|
|
|
157
197
|
`Stopping gracefully to prevent OOM kill after ${iteration} iterations. ` +
|
|
158
198
|
`Resume with /gsd auto to continue from where you left off.`,
|
|
159
199
|
);
|
|
200
|
+
finishTurn("stopped", "timeout", "memory-pressure");
|
|
160
201
|
break;
|
|
161
202
|
}
|
|
162
203
|
}
|
|
163
204
|
|
|
164
205
|
if (!s.cmdCtx) {
|
|
165
206
|
debugLog("autoLoop", { phase: "exit", reason: "no-cmdCtx" });
|
|
207
|
+
finishTurn("stopped", "manual-attention", "missing-command-context");
|
|
166
208
|
break;
|
|
167
209
|
}
|
|
168
210
|
|
|
169
211
|
try {
|
|
170
212
|
// ── Blanket try/catch: one bad iteration must not kill the session
|
|
171
213
|
const prefs = deps.loadEffectiveGSDPreferences()?.preferences;
|
|
214
|
+
const uokFlags = resolveUokFlags(prefs);
|
|
172
215
|
|
|
173
216
|
// ── Check sidecar queue before deriveState ──
|
|
174
217
|
let sidecarItem: SidecarItem | undefined;
|
|
175
218
|
if (s.sidecarQueue.length > 0) {
|
|
219
|
+
if (uokFlags.executionGraph && s.sidecarQueue.length > 1) {
|
|
220
|
+
try {
|
|
221
|
+
s.sidecarQueue = await scheduleSidecarQueue(s.sidecarQueue);
|
|
222
|
+
} catch (err) {
|
|
223
|
+
logWarning("dispatch", `sidecar queue scheduling failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
176
226
|
sidecarItem = s.sidecarQueue.shift()!;
|
|
177
227
|
debugLog("autoLoop", {
|
|
178
228
|
phase: "sidecar-dequeue",
|
|
@@ -256,27 +306,53 @@ export async function autoLoop(
|
|
|
256
306
|
isRetry: false,
|
|
257
307
|
previousTier: undefined,
|
|
258
308
|
};
|
|
309
|
+
observedUnitType = iterData.unitType;
|
|
310
|
+
observedUnitId = iterData.unitId;
|
|
259
311
|
|
|
260
312
|
// ── Progress widget (mirrors dev path in runDispatch) ──
|
|
261
313
|
deps.updateProgressWidget(ctx, iterData.unitType, iterData.unitId, iterData.state);
|
|
262
314
|
|
|
263
315
|
// ── Guards (shared with dev path) ──
|
|
264
316
|
const guardsResult = await runGuards(ic, s.currentMilestoneId ?? "workflow");
|
|
265
|
-
|
|
317
|
+
deps.uokObserver?.onPhaseResult("guard", guardsResult.action, {
|
|
318
|
+
unitType: iterData.unitType,
|
|
319
|
+
unitId: iterData.unitId,
|
|
320
|
+
});
|
|
321
|
+
if (guardsResult.action === "break") {
|
|
322
|
+
finishTurn("stopped", "manual-attention", "guard-break");
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
266
325
|
|
|
267
326
|
// ── Unit execution (shared with dev path) ──
|
|
268
327
|
const unitPhaseResult = await runUnitPhase(ic, iterData, loopState);
|
|
269
|
-
|
|
328
|
+
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
329
|
+
unitType: iterData.unitType,
|
|
330
|
+
unitId: iterData.unitId,
|
|
331
|
+
});
|
|
332
|
+
if (unitPhaseResult.action === "break") {
|
|
333
|
+
finishTurn("stopped", "execution", "unit-break");
|
|
334
|
+
break;
|
|
335
|
+
}
|
|
270
336
|
|
|
271
337
|
// ── Verify first, then reconcile (only mark complete on pass) ──
|
|
272
338
|
debugLog("autoLoop", { phase: "custom-engine-verify", iteration, unitId: iterData.unitId });
|
|
273
339
|
const verifyResult = await policy.verify(iterData.unitType, iterData.unitId, { basePath: s.basePath });
|
|
274
340
|
if (verifyResult === "pause") {
|
|
275
341
|
await deps.pauseAuto(ctx, pi);
|
|
342
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "pause", {
|
|
343
|
+
unitType: iterData.unitType,
|
|
344
|
+
unitId: iterData.unitId,
|
|
345
|
+
});
|
|
346
|
+
finishTurn("paused", "manual-attention", "custom-engine-verify-pause");
|
|
276
347
|
break;
|
|
277
348
|
}
|
|
278
349
|
if (verifyResult === "retry") {
|
|
279
350
|
debugLog("autoLoop", { phase: "custom-engine-verify-retry", iteration, unitId: iterData.unitId });
|
|
351
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "retry", {
|
|
352
|
+
unitType: iterData.unitType,
|
|
353
|
+
unitId: iterData.unitId,
|
|
354
|
+
});
|
|
355
|
+
finishTurn("retry");
|
|
280
356
|
continue;
|
|
281
357
|
}
|
|
282
358
|
|
|
@@ -299,36 +375,77 @@ export async function autoLoop(
|
|
|
299
375
|
|
|
300
376
|
if (reconcileResult.outcome === "milestone-complete") {
|
|
301
377
|
await deps.stopAuto(ctx, pi, "Workflow complete");
|
|
378
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "milestone-complete", {
|
|
379
|
+
unitType: iterData.unitType,
|
|
380
|
+
unitId: iterData.unitId,
|
|
381
|
+
});
|
|
382
|
+
finishTurn("completed");
|
|
302
383
|
break;
|
|
303
384
|
}
|
|
304
385
|
if (reconcileResult.outcome === "pause") {
|
|
305
386
|
await deps.pauseAuto(ctx, pi);
|
|
387
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "pause", {
|
|
388
|
+
unitType: iterData.unitType,
|
|
389
|
+
unitId: iterData.unitId,
|
|
390
|
+
});
|
|
391
|
+
finishTurn("paused", "manual-attention");
|
|
306
392
|
break;
|
|
307
393
|
}
|
|
308
394
|
if (reconcileResult.outcome === "stop") {
|
|
309
395
|
await deps.stopAuto(ctx, pi, reconcileResult.reason ?? "Engine stopped");
|
|
396
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "stop", {
|
|
397
|
+
unitType: iterData.unitType,
|
|
398
|
+
unitId: iterData.unitId,
|
|
399
|
+
reason: reconcileResult.reason,
|
|
400
|
+
});
|
|
401
|
+
finishTurn("stopped", "manual-attention", reconcileResult.reason);
|
|
310
402
|
break;
|
|
311
403
|
}
|
|
404
|
+
deps.uokObserver?.onPhaseResult("custom-engine", "continue", {
|
|
405
|
+
unitType: iterData.unitType,
|
|
406
|
+
unitId: iterData.unitId,
|
|
407
|
+
});
|
|
408
|
+
finishTurn("completed");
|
|
312
409
|
continue;
|
|
313
410
|
}
|
|
314
411
|
|
|
315
412
|
if (!sidecarItem) {
|
|
316
413
|
// ── Phase 1: Pre-dispatch ─────────────────────────────────────────
|
|
317
414
|
const preDispatchResult = await runPreDispatch(ic, loopState);
|
|
318
|
-
|
|
319
|
-
if (preDispatchResult.action === "
|
|
415
|
+
deps.uokObserver?.onPhaseResult("pre-dispatch", preDispatchResult.action);
|
|
416
|
+
if (preDispatchResult.action === "break") {
|
|
417
|
+
finishTurn("stopped", "manual-attention", "pre-dispatch-break");
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
420
|
+
if (preDispatchResult.action === "continue") {
|
|
421
|
+
finishTurn("skipped");
|
|
422
|
+
continue;
|
|
423
|
+
}
|
|
320
424
|
|
|
321
425
|
const preData = preDispatchResult.data;
|
|
322
426
|
|
|
323
427
|
// ── Phase 2: Guards ───────────────────────────────────────────────
|
|
324
428
|
const guardsResult = await runGuards(ic, preData.mid);
|
|
325
|
-
|
|
429
|
+
deps.uokObserver?.onPhaseResult("guard", guardsResult.action);
|
|
430
|
+
if (guardsResult.action === "break") {
|
|
431
|
+
finishTurn("stopped", "manual-attention", "guard-break");
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
326
434
|
|
|
327
435
|
// ── Phase 3: Dispatch ─────────────────────────────────────────────
|
|
328
436
|
const dispatchResult = await runDispatch(ic, preData, loopState);
|
|
329
|
-
|
|
330
|
-
if (dispatchResult.action === "
|
|
437
|
+
deps.uokObserver?.onPhaseResult("dispatch", dispatchResult.action);
|
|
438
|
+
if (dispatchResult.action === "break") {
|
|
439
|
+
finishTurn("stopped", "manual-attention", "dispatch-break");
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
if (dispatchResult.action === "continue") {
|
|
443
|
+
finishTurn("skipped");
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
331
446
|
iterData = dispatchResult.data;
|
|
447
|
+
observedUnitType = iterData.unitType;
|
|
448
|
+
observedUnitId = iterData.unitId;
|
|
332
449
|
} else {
|
|
333
450
|
// ── Sidecar path: use values from the sidecar item directly ──
|
|
334
451
|
const sidecarState = await deps.deriveState(s.basePath);
|
|
@@ -343,22 +460,50 @@ export async function autoLoop(
|
|
|
343
460
|
midTitle: sidecarState.activeMilestone?.title,
|
|
344
461
|
isRetry: false, previousTier: undefined,
|
|
345
462
|
};
|
|
463
|
+
observedUnitType = iterData.unitType;
|
|
464
|
+
observedUnitId = iterData.unitId;
|
|
465
|
+
deps.uokObserver?.onPhaseResult("dispatch", "sidecar", {
|
|
466
|
+
unitType: iterData.unitType,
|
|
467
|
+
unitId: iterData.unitId,
|
|
468
|
+
sidecarKind: sidecarItem.kind,
|
|
469
|
+
});
|
|
346
470
|
}
|
|
347
471
|
|
|
348
472
|
const unitPhaseResult = await runUnitPhase(ic, iterData, loopState, sidecarItem);
|
|
349
|
-
|
|
473
|
+
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
474
|
+
unitType: iterData.unitType,
|
|
475
|
+
unitId: iterData.unitId,
|
|
476
|
+
});
|
|
477
|
+
if (unitPhaseResult.action === "break") {
|
|
478
|
+
finishTurn("stopped", "execution", "unit-break");
|
|
479
|
+
break;
|
|
480
|
+
}
|
|
350
481
|
|
|
351
482
|
// ── Phase 5: Finalize ───────────────────────────────────────────────
|
|
352
483
|
|
|
353
484
|
const finalizeResult = await runFinalize(ic, iterData, loopState, sidecarItem);
|
|
354
|
-
|
|
355
|
-
|
|
485
|
+
deps.uokObserver?.onPhaseResult("finalize", finalizeResult.action, {
|
|
486
|
+
unitType: iterData.unitType,
|
|
487
|
+
unitId: iterData.unitId,
|
|
488
|
+
});
|
|
489
|
+
if (finalizeResult.action === "break") {
|
|
490
|
+
const finalizeFailureClass = finalizeResult.reason === "git-closeout-failure"
|
|
491
|
+
? "git"
|
|
492
|
+
: "closeout";
|
|
493
|
+
finishTurn("stopped", finalizeFailureClass, "finalize-break");
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
if (finalizeResult.action === "continue") {
|
|
497
|
+
finishTurn("retry");
|
|
498
|
+
continue;
|
|
499
|
+
}
|
|
356
500
|
|
|
357
501
|
consecutiveErrors = 0; // Iteration completed successfully
|
|
358
502
|
consecutiveCooldowns = 0;
|
|
359
503
|
recentErrorMessages.length = 0;
|
|
360
504
|
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId, seq: nextSeq(), eventType: "iteration-end", data: { iteration } });
|
|
361
505
|
debugLog("autoLoop", { phase: "iteration-complete", iteration });
|
|
506
|
+
finishTurn("completed");
|
|
362
507
|
} catch (loopErr) {
|
|
363
508
|
// ── Blanket catch: absorb unexpected exceptions, apply graduated recovery ──
|
|
364
509
|
const msg = loopErr instanceof Error ? loopErr.message : String(loopErr);
|
|
@@ -388,6 +533,7 @@ export async function autoLoop(
|
|
|
388
533
|
pi,
|
|
389
534
|
`Infrastructure error (${infraCode}): not recoverable by retry`,
|
|
390
535
|
);
|
|
536
|
+
finishTurn("failed", "execution", msg);
|
|
391
537
|
break;
|
|
392
538
|
}
|
|
393
539
|
|
|
@@ -429,6 +575,7 @@ export async function autoLoop(
|
|
|
429
575
|
"warning",
|
|
430
576
|
);
|
|
431
577
|
await new Promise(resolve => setTimeout(resolve, waitMs));
|
|
578
|
+
finishTurn("retry", "timeout", msg);
|
|
432
579
|
continue; // Retry iteration without incrementing consecutiveErrors
|
|
433
580
|
}
|
|
434
581
|
|
|
@@ -455,6 +602,7 @@ export async function autoLoop(
|
|
|
455
602
|
pi,
|
|
456
603
|
`${consecutiveErrors} consecutive iteration failures`,
|
|
457
604
|
);
|
|
605
|
+
finishTurn("failed", "execution", msg);
|
|
458
606
|
break;
|
|
459
607
|
} else if (consecutiveErrors === 2) {
|
|
460
608
|
// 2nd consecutive: try invalidating caches + re-deriving state
|
|
@@ -467,6 +615,7 @@ export async function autoLoop(
|
|
|
467
615
|
// 1st error: log and retry — transient failures happen
|
|
468
616
|
ctx.ui.notify(`Iteration error: ${msg}. Retrying.`, "warning");
|
|
469
617
|
}
|
|
618
|
+
finishTurn("retry", "execution", msg);
|
|
470
619
|
}
|
|
471
620
|
}
|
|
472
621
|
|