gsd-pi 2.75.0-dev.063e5a3 → 2.75.0-next.9c0ec0ba1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -51
- package/dist/headless-events.d.ts +1 -1
- package/dist/headless-events.js +5 -2
- package/dist/headless.js +5 -6
- package/dist/loader.js +0 -0
- package/dist/onboarding.js +39 -14
- package/dist/resources/extensions/ask-user-questions.js +11 -2
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +34 -4
- package/dist/resources/extensions/gsd/auto/detect-stuck.js +9 -0
- package/dist/resources/extensions/gsd/auto/loop.js +67 -4
- package/dist/resources/extensions/gsd/auto/phases.js +70 -47
- package/dist/resources/extensions/gsd/auto/resolve.js +1 -1
- package/dist/resources/extensions/gsd/auto/run-unit.js +10 -1
- package/dist/resources/extensions/gsd/auto/session.js +5 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +33 -5
- package/dist/resources/extensions/gsd/auto-loop.js +1 -1
- package/dist/resources/extensions/gsd/auto-post-unit.js +3 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +2 -2
- package/dist/resources/extensions/gsd/auto-recovery.js +9 -0
- package/dist/resources/extensions/gsd/auto-verification.js +3 -3
- package/dist/resources/extensions/gsd/auto.js +32 -22
- package/dist/resources/extensions/gsd/commands/catalog.js +67 -3
- package/dist/resources/extensions/gsd/commands/handlers/core.js +6 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +11 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +228 -29
- package/dist/resources/extensions/gsd/commands-cmux.js +5 -2
- package/dist/resources/extensions/gsd/commands-debug.js +388 -0
- package/dist/resources/extensions/gsd/commands-do.js +1 -0
- package/dist/resources/extensions/gsd/commands-handlers.js +21 -2
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +1 -1
- package/dist/resources/extensions/gsd/commands-scan.js +94 -0
- package/dist/resources/extensions/gsd/commands-workflow-templates.js +101 -2
- package/dist/resources/extensions/gsd/debug-session-store.js +238 -0
- package/dist/resources/extensions/gsd/definition-loader.js +7 -0
- package/dist/resources/extensions/gsd/docs/preferences-reference.md +8 -8
- package/dist/resources/extensions/gsd/doctor-providers.js +48 -20
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +1 -3
- package/dist/resources/extensions/gsd/error-classifier.js +1 -1
- package/dist/resources/extensions/gsd/forensics.js +26 -29
- package/dist/resources/extensions/gsd/git-service.js +0 -1
- package/dist/resources/extensions/gsd/graph.js +0 -2
- package/dist/resources/extensions/gsd/model-cost-table.js +2 -1
- package/dist/resources/extensions/gsd/model-router.js +4 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +21 -5
- package/dist/resources/extensions/gsd/notifications.js +4 -0
- package/dist/resources/extensions/gsd/pre-execution-checks.js +7 -0
- package/dist/resources/extensions/gsd/preferences.js +10 -10
- package/dist/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
- package/dist/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
- package/dist/resources/extensions/gsd/prompts/scan.md +79 -0
- package/dist/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
- package/dist/resources/extensions/gsd/run-manager.js +37 -17
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +6 -6
- package/dist/resources/extensions/gsd/uok/flags.js +6 -6
- package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
- package/dist/resources/extensions/gsd/workflow-dispatch.js +64 -0
- package/dist/resources/extensions/gsd/workflow-install.js +327 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +0 -6
- package/dist/resources/extensions/gsd/workflow-plugins.js +346 -0
- package/dist/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
- package/dist/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
- package/dist/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
- package/dist/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
- package/dist/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
- package/dist/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
- package/dist/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
- package/dist/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
- package/dist/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
- package/dist/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
- package/dist/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
- package/dist/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
- package/dist/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
- package/dist/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/registry.json +184 -0
- package/dist/resources/extensions/gsd/workflow-templates/release.md +118 -0
- package/dist/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
- package/dist/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/spike.md +1 -0
- package/dist/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
- package/dist/resources/extensions/remote-questions/commands.js +380 -0
- package/dist/resources/extensions/remote-questions/manager.js +28 -4
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +79 -4
- package/dist/resources/extensions/shared/interview-ui.js +189 -1
- package/dist/resources/extensions/shared/layout-utils.js +17 -0
- package/dist/resources/extensions/shared/rtk-shared.js +47 -0
- package/dist/resources/extensions/shared/rtk.js +3 -46
- package/dist/resources/skills/create-workflow/SKILL.md +33 -6
- package/dist/rtk-shared.d.ts +10 -0
- package/dist/rtk-shared.js +47 -0
- package/dist/rtk.d.ts +2 -6
- package/dist/rtk.js +3 -48
- package/dist/shared/workspace-types.d.ts +52 -0
- package/dist/shared/workspace-types.js +1 -0
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/update-check.d.ts +10 -0
- package/dist/update-check.js +24 -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 +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/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +2 -2
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/api/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +2 -2
- 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 +2 -2
- 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 +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +11 -11
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- 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/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/2826.02df9631042cc18e.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-b868033a5834586d.js → webpack-6c7cda3e318eedb6.js} +1 -1
- package/dist/web/standalone/.next/static/css/3e9cdadb4d23b8a4.css +1 -0
- package/dist/wizard.js +2 -2
- package/dist/worktree-cli.d.ts +6 -5
- package/dist/worktree-cli.js +23 -7
- package/package.json +3 -3
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/models/capability-patches.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/capability-patches.js +3 -2
- package/packages/pi-ai/dist/models/capability-patches.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts +68 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js +68 -0
- package/packages/pi-ai/dist/models/generated/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/anthropic.js +17 -0
- package/packages/pi-ai/dist/models/generated/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/google-antigravity.js +17 -0
- package/packages/pi-ai/dist/models/generated/google-antigravity.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/groq.d.ts +0 -153
- package/packages/pi-ai/dist/models/generated/groq.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/groq.js +0 -153
- package/packages/pi-ai/dist/models/generated/groq.js.map +1 -1
- package/packages/pi-ai/dist/models/generated/index.d.ts +119 -153
- package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openrouter.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openrouter.js +17 -0
- package/packages/pi-ai/dist/models/generated/openrouter.js.map +1 -1
- package/packages/pi-ai/dist/models.generated.test.js +16 -0
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +2 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +7 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js +12 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.test.js.map +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-ai/scripts/generate-models.ts +38 -0
- package/packages/pi-ai/src/models/capability-patches.ts +5 -2
- package/packages/pi-ai/src/models/generated/amazon-bedrock.ts +68 -0
- package/packages/pi-ai/src/models/generated/anthropic.ts +17 -0
- package/packages/pi-ai/src/models/generated/google-antigravity.ts +17 -0
- package/packages/pi-ai/src/models/generated/groq.ts +0 -153
- package/packages/pi-ai/src/models/generated/openrouter.ts +17 -0
- package/packages/pi-ai/src/models.generated.test.ts +16 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +2 -1
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +15 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +6 -2
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +38 -0
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts +7 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.js +9 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js +36 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +10 -0
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js +2 -2
- package/packages/pi-coding-agent/dist/core/skill-tool.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +69 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js +76 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts +0 -65
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js +1 -75
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js +185 -21
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +56 -0
- package/packages/pi-coding-agent/src/core/auth-storage.test.ts +41 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +10 -0
- package/packages/pi-coding-agent/src/core/sdk.ts +14 -0
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +2 -2
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +82 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +1 -83
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +201 -24
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +69 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js +76 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts +0 -65
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/theme.js +1 -75
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts +1 -1
- package/pkg/dist/modes/interactive/theme/themes.d.ts.map +1 -1
- package/pkg/dist/modes/interactive/theme/themes.js +185 -21
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/src/resources/extensions/ask-user-questions.ts +17 -2
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +36 -4
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +18 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +10 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +1 -0
- package/src/resources/extensions/gsd/auto/loop.ts +109 -3
- package/src/resources/extensions/gsd/auto/phases.ts +94 -60
- package/src/resources/extensions/gsd/auto/resolve.ts +1 -1
- package/src/resources/extensions/gsd/auto/run-unit.ts +11 -1
- package/src/resources/extensions/gsd/auto/session.ts +7 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +45 -5
- package/src/resources/extensions/gsd/auto-loop.ts +1 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +3 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +7 -2
- package/src/resources/extensions/gsd/auto-recovery.ts +16 -1
- package/src/resources/extensions/gsd/auto-verification.ts +3 -3
- package/src/resources/extensions/gsd/auto.ts +34 -26
- package/src/resources/extensions/gsd/commands/catalog.ts +60 -3
- package/src/resources/extensions/gsd/commands/handlers/core.ts +6 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +11 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +279 -29
- package/src/resources/extensions/gsd/commands-cmux.ts +6 -2
- package/src/resources/extensions/gsd/commands-debug.ts +484 -0
- package/src/resources/extensions/gsd/commands-do.ts +1 -0
- package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +1 -1
- package/src/resources/extensions/gsd/commands-scan.ts +125 -0
- package/src/resources/extensions/gsd/commands-workflow-templates.ts +129 -2
- package/src/resources/extensions/gsd/debug-session-store.ts +377 -0
- package/src/resources/extensions/gsd/definition-loader.ts +7 -0
- package/src/resources/extensions/gsd/docs/preferences-reference.md +8 -8
- package/src/resources/extensions/gsd/doctor-providers.ts +52 -22
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +1 -3
- package/src/resources/extensions/gsd/error-classifier.ts +1 -1
- package/src/resources/extensions/gsd/forensics.ts +25 -29
- package/src/resources/extensions/gsd/git-service.ts +0 -1
- package/src/resources/extensions/gsd/graph.ts +0 -3
- package/src/resources/extensions/gsd/model-cost-table.ts +2 -1
- package/src/resources/extensions/gsd/model-router.ts +4 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +21 -5
- package/src/resources/extensions/gsd/notifications.ts +6 -0
- package/src/resources/extensions/gsd/pre-execution-checks.ts +6 -0
- package/src/resources/extensions/gsd/preferences-types.ts +1 -1
- package/src/resources/extensions/gsd/preferences.ts +10 -10
- package/src/resources/extensions/gsd/prompts/debug-diagnose.md +25 -0
- package/src/resources/extensions/gsd/prompts/debug-session-manager.md +80 -0
- package/src/resources/extensions/gsd/prompts/scan.md +79 -0
- package/src/resources/extensions/gsd/prompts/workflow-oneshot.md +26 -0
- package/src/resources/extensions/gsd/run-manager.ts +53 -19
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +6 -6
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +1 -34
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +45 -31
- package/src/resources/extensions/gsd/tests/autocomplete-regressions-1675.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/commands-do.test.ts +48 -0
- package/src/resources/extensions/gsd/tests/commands-scan.test.ts +351 -0
- package/src/resources/extensions/gsd/tests/commands-workflow-custom.test.ts +8 -6
- package/src/resources/extensions/gsd/tests/debug-command-handler.test.ts +905 -0
- package/src/resources/extensions/gsd/tests/debug-command-lifecycle.integration.test.ts +1229 -0
- package/src/resources/extensions/gsd/tests/debug-session-store.test.ts +565 -0
- package/src/resources/extensions/gsd/tests/discuss-milestone-structured-questions.test.ts +64 -0
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +62 -18
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +29 -12
- package/src/resources/extensions/gsd/tests/forensics-hook-key-parse.test.ts +74 -0
- package/src/resources/extensions/gsd/tests/graph-operations.test.ts +0 -4
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +36 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +41 -10
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +171 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +24 -5
- package/src/resources/extensions/gsd/tests/preferences.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +4 -0
- package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/uok-flags.test.ts +31 -1
- package/src/resources/extensions/gsd/tests/uok-kernel-path.test.ts +166 -0
- package/src/resources/extensions/gsd/tests/workflow-install.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/workflow-logger-wiring.test.ts +15 -6
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/workflow-plugins.test.ts +310 -0
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +8 -2
- package/src/resources/extensions/gsd/unit-runtime.ts +1 -0
- package/src/resources/extensions/gsd/uok/flags.ts +6 -6
- package/src/resources/extensions/gsd/uok/kernel.ts +16 -4
- package/src/resources/extensions/gsd/workflow-dispatch.ts +106 -0
- package/src/resources/extensions/gsd/workflow-install.ts +423 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +0 -6
- package/src/resources/extensions/gsd/workflow-plugins.ts +403 -0
- package/src/resources/extensions/gsd/workflow-templates/accessibility-audit.md +88 -0
- package/src/resources/extensions/gsd/workflow-templates/api-breaking-change.md +117 -0
- package/src/resources/extensions/gsd/workflow-templates/bugfix.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/changelog-gen.md +82 -0
- package/src/resources/extensions/gsd/workflow-templates/ci-bootstrap.md +144 -0
- package/src/resources/extensions/gsd/workflow-templates/dead-code.md +81 -0
- package/src/resources/extensions/gsd/workflow-templates/dep-upgrade.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/docs-sync.yaml +76 -0
- package/src/resources/extensions/gsd/workflow-templates/env-audit.yaml +88 -0
- package/src/resources/extensions/gsd/workflow-templates/full-project.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/hotfix.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/issue-triage.md +84 -0
- package/src/resources/extensions/gsd/workflow-templates/observability-setup.md +133 -0
- package/src/resources/extensions/gsd/workflow-templates/onboarding-check.md +74 -0
- package/src/resources/extensions/gsd/workflow-templates/performance-audit.md +125 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-review.md +67 -0
- package/src/resources/extensions/gsd/workflow-templates/pr-triage.md +83 -0
- package/src/resources/extensions/gsd/workflow-templates/refactor.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/registry.json +184 -0
- package/src/resources/extensions/gsd/workflow-templates/release.md +118 -0
- package/src/resources/extensions/gsd/workflow-templates/rename-symbol.yaml +99 -0
- package/src/resources/extensions/gsd/workflow-templates/security-audit.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/small-feature.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/spike.md +1 -0
- package/src/resources/extensions/gsd/workflow-templates/test-backfill.yaml +73 -0
- package/src/resources/extensions/gsd/workflow-templates.ts +7 -0
- package/src/resources/extensions/gsd/workspace-index.ts +9 -4
- package/src/resources/extensions/remote-questions/commands.ts +480 -0
- package/src/resources/extensions/remote-questions/manager.ts +36 -3
- package/src/resources/extensions/remote-questions/telegram-adapter.ts +86 -4
- package/src/resources/extensions/remote-questions/tests/command-polling.test.ts +246 -0
- package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
- package/src/resources/extensions/shared/interview-ui.ts +195 -1
- package/src/resources/extensions/shared/layout-utils.ts +26 -0
- package/src/resources/extensions/shared/rtk-shared.ts +58 -0
- package/src/resources/extensions/shared/rtk.ts +12 -52
- package/src/resources/extensions/shared/tests/interview-preview.test.ts +177 -0
- package/src/resources/extensions/shared/tests/preview-layout.test.ts +120 -0
- package/src/resources/skills/create-workflow/SKILL.md +33 -6
- package/dist/web/standalone/.next/static/chunks/2826.dd3dc8bbd3025fa5.js +0 -9
- package/dist/web/standalone/.next/static/css/f6e8833d46e738d8.css +0 -1
- package/packages/native/dist/ps/types.d.ts +0 -5
- package/packages/native/dist/ps/types.js +0 -2
- package/packages/native/src/ps/types.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/LICENSE +0 -201
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/README.md +0 -9
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-cjs/index.js +0 -762
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/build-abort-error.js +0 -19
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/constants.js +0 -1
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +0 -9
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/index.js +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +0 -230
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-manager.js +0 -87
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-connection-pool.js +0 -32
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/node-http2-handler.js +0 -169
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/readable.mock.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/server.mock.js +0 -88
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-connection-timeout.js +0 -36
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-request-timeout.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-keep-alive.js +0 -22
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/set-socket-timeout.js +0 -23
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/collector.js +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/index.js +0 -41
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/stream-collector/readable.mock.js +0 -21
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/timing.js +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-es/write-request-body.js +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/build-abort-error.d.ts +0 -10
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/constants.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/get-transformed-headers.d.ts +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/index.d.ts +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http-handler.d.ts +0 -46
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-manager.d.ts +0 -24
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-connection-pool.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/node-http2-handler.d.ts +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/server.mock.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-connection-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-request-timeout.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-keep-alive.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/set-socket-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/collector.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/index.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/stream-collector/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/timing.d.ts +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/build-abort-error.d.ts +0 -10
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/constants.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/get-transformed-headers.d.ts +0 -4
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/index.d.ts +0 -3
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http-handler.d.ts +0 -46
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-manager.d.ts +0 -24
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-connection-pool.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/node-http2-handler.d.ts +0 -63
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/server.mock.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-connection-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-request-timeout.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-keep-alive.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/set-socket-timeout.d.ts +0 -2
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/collector.d.ts +0 -5
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/index.d.ts +0 -6
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/stream-collector/readable.mock.d.ts +0 -13
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/timing.d.ts +0 -8
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/ts3.4/write-request-body.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/dist-types/write-request-body.d.ts +0 -12
- package/packages/pi-ai/node_modules/@smithy/node-http-handler/package.json +0 -68
- package/packages/pi-ai/oauth.d.ts +0 -1
- package/packages/pi-ai/oauth.js +0 -1
- /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → JncJywFxCugMuXGs56m-b}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{j7IBD35UgrL2b298GLK3V → JncJywFxCugMuXGs56m-b}/_ssgManifest.js +0 -0
|
@@ -17,6 +17,7 @@ import { logWarning } from "../workflow-logger.js";
|
|
|
17
17
|
import { gsdRoot } from "../paths.js";
|
|
18
18
|
import { resolveUokFlags } from "../uok/flags.js";
|
|
19
19
|
import { scheduleSidecarQueue } from "../uok/execution-graph.js";
|
|
20
|
+
import { ExecutionGraphScheduler } from "../uok/execution-graph.js";
|
|
20
21
|
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
21
22
|
import { join } from "node:path";
|
|
22
23
|
// ── Stuck detection persistence (#3704) ──────────────────────────────────
|
|
@@ -78,17 +79,73 @@ function checkMemoryPressure() {
|
|
|
78
79
|
const pct = heapMB / limitMB;
|
|
79
80
|
return { pressured: pct > MEMORY_PRESSURE_THRESHOLD, heapMB, limitMB, pct };
|
|
80
81
|
}
|
|
82
|
+
function resolveDispatchNodeKind(unitType, sidecarItem) {
|
|
83
|
+
if (sidecarItem?.kind === "hook")
|
|
84
|
+
return "hook";
|
|
85
|
+
if (sidecarItem?.kind === "triage")
|
|
86
|
+
return "verification";
|
|
87
|
+
if (sidecarItem?.kind === "quick-task")
|
|
88
|
+
return "team-worker";
|
|
89
|
+
if (unitType.startsWith("hook/"))
|
|
90
|
+
return "hook";
|
|
91
|
+
if (unitType === "reactive-execute")
|
|
92
|
+
return "subagent";
|
|
93
|
+
if (unitType === "gate-evaluate"
|
|
94
|
+
|| unitType === "validate-milestone"
|
|
95
|
+
|| unitType === "run-uat"
|
|
96
|
+
|| unitType === "complete-slice") {
|
|
97
|
+
return "verification";
|
|
98
|
+
}
|
|
99
|
+
if (unitType === "replan-slice" || unitType === "reassess-roadmap") {
|
|
100
|
+
return "reprocess";
|
|
101
|
+
}
|
|
102
|
+
return "unit";
|
|
103
|
+
}
|
|
104
|
+
async function runUnitPhaseViaContract(dispatchContract, ic, iterData, loopState, sidecarItem) {
|
|
105
|
+
if (dispatchContract === "legacy-direct") {
|
|
106
|
+
return runUnitPhase(ic, iterData, loopState, sidecarItem);
|
|
107
|
+
}
|
|
108
|
+
const scheduler = new ExecutionGraphScheduler();
|
|
109
|
+
let outcome = null;
|
|
110
|
+
const executeNode = async () => {
|
|
111
|
+
outcome = await runUnitPhase(ic, iterData, loopState, sidecarItem);
|
|
112
|
+
};
|
|
113
|
+
const kinds = [
|
|
114
|
+
"unit",
|
|
115
|
+
"hook",
|
|
116
|
+
"subagent",
|
|
117
|
+
"team-worker",
|
|
118
|
+
"verification",
|
|
119
|
+
"reprocess",
|
|
120
|
+
];
|
|
121
|
+
for (const kind of kinds)
|
|
122
|
+
scheduler.registerHandler(kind, executeNode);
|
|
123
|
+
const nodeId = `dispatch:${ic.iteration}:${iterData.unitType}:${iterData.unitId}`;
|
|
124
|
+
await scheduler.run([
|
|
125
|
+
{
|
|
126
|
+
id: nodeId,
|
|
127
|
+
kind: resolveDispatchNodeKind(iterData.unitType, sidecarItem),
|
|
128
|
+
dependsOn: [],
|
|
129
|
+
metadata: {
|
|
130
|
+
unitType: iterData.unitType,
|
|
131
|
+
unitId: iterData.unitId,
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
], { parallel: false, maxWorkers: 1 });
|
|
135
|
+
return outcome ?? { action: "break", reason: "scheduler-dispatch-missing-result" };
|
|
136
|
+
}
|
|
81
137
|
/**
|
|
82
138
|
* Main auto-mode execution loop. Iterates: derive → dispatch → guards →
|
|
83
139
|
* runUnit → finalize → repeat. Exits when s.active becomes false or a
|
|
84
140
|
* terminal condition is reached.
|
|
85
141
|
*
|
|
86
142
|
* This is the linear replacement for the recursive
|
|
87
|
-
* dispatchNextUnit →
|
|
143
|
+
* dispatchNextUnit → resolveAgentEnd → dispatchNextUnit chain.
|
|
88
144
|
*/
|
|
89
|
-
export async function autoLoop(ctx, pi, s, deps) {
|
|
145
|
+
export async function autoLoop(ctx, pi, s, deps, options) {
|
|
90
146
|
debugLog("autoLoop", { phase: "enter" });
|
|
91
147
|
let iteration = 0;
|
|
148
|
+
const dispatchContract = options?.dispatchContract ?? "legacy-direct";
|
|
92
149
|
// Load persisted stuck state so counters survive session restarts (#3704)
|
|
93
150
|
const persisted = loadStuckState(s.basePath);
|
|
94
151
|
const loopState = {
|
|
@@ -273,7 +330,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
273
330
|
break;
|
|
274
331
|
}
|
|
275
332
|
// ── Unit execution (shared with dev path) ──
|
|
276
|
-
const unitPhaseResult = await
|
|
333
|
+
const unitPhaseResult = await runUnitPhaseViaContract(dispatchContract, ic, iterData, loopState);
|
|
277
334
|
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
278
335
|
unitType: iterData.unitType,
|
|
279
336
|
unitId: iterData.unitId,
|
|
@@ -410,7 +467,7 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
410
467
|
sidecarKind: sidecarItem.kind,
|
|
411
468
|
});
|
|
412
469
|
}
|
|
413
|
-
const unitPhaseResult = await
|
|
470
|
+
const unitPhaseResult = await runUnitPhaseViaContract(dispatchContract, ic, iterData, loopState, sidecarItem);
|
|
414
471
|
deps.uokObserver?.onPhaseResult("unit", unitPhaseResult.action, {
|
|
415
472
|
unitType: iterData.unitType,
|
|
416
473
|
unitId: iterData.unitId,
|
|
@@ -528,3 +585,9 @@ export async function autoLoop(ctx, pi, s, deps) {
|
|
|
528
585
|
_clearCurrentResolve();
|
|
529
586
|
debugLog("autoLoop", { phase: "exit", totalIterations: iteration });
|
|
530
587
|
}
|
|
588
|
+
export async function runUokKernelLoop(ctx, pi, s, deps) {
|
|
589
|
+
return autoLoop(ctx, pi, s, deps, { dispatchContract: "uok-scheduler" });
|
|
590
|
+
}
|
|
591
|
+
export async function runLegacyAutoLoop(ctx, pi, s, deps) {
|
|
592
|
+
return autoLoop(ctx, pi, s, deps, { dispatchContract: "legacy-direct" });
|
|
593
|
+
}
|
|
@@ -33,7 +33,7 @@ import { UokGateRunner } from "../uok/gate-runner.js";
|
|
|
33
33
|
import { resetEvidence } from "../safety/evidence-collector.js";
|
|
34
34
|
import { createCheckpoint, cleanupCheckpoint, rollbackToCheckpoint } from "../safety/git-checkpoint.js";
|
|
35
35
|
import { resolveSafetyHarnessConfig } from "../safety/safety-harness.js";
|
|
36
|
-
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForAutoUnit, } from "../workflow-mcp.js";
|
|
36
|
+
import { getWorkflowTransportSupportError, getRequiredWorkflowToolsForAutoUnit, supportsStructuredQuestions, } from "../workflow-mcp.js";
|
|
37
37
|
// ─── Session timeout auto-resume state ────────────────────────────────────────
|
|
38
38
|
let consecutiveSessionTimeouts = 0;
|
|
39
39
|
const MAX_SESSION_TIMEOUT_AUTO_RESUMES = 3;
|
|
@@ -136,6 +136,47 @@ async function emitCancelledUnitEnd(ic, unitType, unitId, unitStartSeq, errorCon
|
|
|
136
136
|
causedBy: { flowId: ic.flowId, seq: unitStartSeq },
|
|
137
137
|
});
|
|
138
138
|
}
|
|
139
|
+
async function failClosedOnFinalizeTimeout(ic, iterData, loopState, stage, startedAt) {
|
|
140
|
+
const { ctx, pi, s, deps } = ic;
|
|
141
|
+
const now = Date.now();
|
|
142
|
+
const unitType = iterData.unitType;
|
|
143
|
+
const unitId = iterData.unitId;
|
|
144
|
+
const timeoutMs = stage === "pre" ? FINALIZE_PRE_TIMEOUT_MS : FINALIZE_POST_TIMEOUT_MS;
|
|
145
|
+
const progressKind = stage === "pre" ? "finalize-pre-timeout" : "finalize-post-timeout";
|
|
146
|
+
writeUnitRuntimeRecord(s.basePath, unitType, unitId, startedAt, {
|
|
147
|
+
phase: "finalize-timeout",
|
|
148
|
+
timeoutAt: now,
|
|
149
|
+
lastProgressAt: now,
|
|
150
|
+
lastProgressKind: progressKind,
|
|
151
|
+
});
|
|
152
|
+
deps.emitJournalEvent({
|
|
153
|
+
ts: new Date(now).toISOString(),
|
|
154
|
+
flowId: ic.flowId,
|
|
155
|
+
seq: ic.nextSeq(),
|
|
156
|
+
eventType: "unit-end",
|
|
157
|
+
data: {
|
|
158
|
+
unitType,
|
|
159
|
+
unitId,
|
|
160
|
+
status: "timed-out-finalize",
|
|
161
|
+
artifactVerified: false,
|
|
162
|
+
finalizeStage: stage,
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
loopState.consecutiveFinalizeTimeouts++;
|
|
166
|
+
debugLog("autoLoop", {
|
|
167
|
+
phase: progressKind,
|
|
168
|
+
iteration: ic.iteration,
|
|
169
|
+
unitType,
|
|
170
|
+
unitId,
|
|
171
|
+
consecutiveTimeouts: loopState.consecutiveFinalizeTimeouts,
|
|
172
|
+
});
|
|
173
|
+
ctx.ui.notify(`${stage === "pre" ? "postUnitPreVerification" : "postUnitPostVerification"} timed out after ${timeoutMs / 1000}s for ${unitType} ${unitId} (${loopState.consecutiveFinalizeTimeouts}/${MAX_FINALIZE_TIMEOUTS}) — pausing auto-mode for recovery.`, "warning");
|
|
174
|
+
await deps.pauseAuto(ctx, pi);
|
|
175
|
+
s.currentUnit = null;
|
|
176
|
+
clearCurrentPhase();
|
|
177
|
+
drainLogs();
|
|
178
|
+
return { action: "break", reason: progressKind };
|
|
179
|
+
}
|
|
139
180
|
// ─── runPreDispatch ───────────────────────────────────────────────────────────
|
|
140
181
|
/**
|
|
141
182
|
* Phase 1: Pre-dispatch — resource guard, health gate, state derivation,
|
|
@@ -548,6 +589,15 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
548
589
|
const { ctx, pi, s, deps, prefs } = ic;
|
|
549
590
|
const { state, mid, midTitle } = preData;
|
|
550
591
|
const STUCK_WINDOW_SIZE = 6;
|
|
592
|
+
const provider = ctx.model?.provider;
|
|
593
|
+
const authMode = provider && typeof ctx.modelRegistry?.getProviderAuthMode === "function"
|
|
594
|
+
? ctx.modelRegistry.getProviderAuthMode(provider)
|
|
595
|
+
: undefined;
|
|
596
|
+
const activeTools = typeof pi.getActiveTools === "function" ? pi.getActiveTools() : [];
|
|
597
|
+
const structuredQuestionsAvailable = supportsStructuredQuestions(activeTools, {
|
|
598
|
+
authMode,
|
|
599
|
+
baseUrl: ctx.model?.baseUrl,
|
|
600
|
+
}) ? "true" : "false";
|
|
551
601
|
debugLog("autoLoop", { phase: "dispatch-resolve", iteration: ic.iteration });
|
|
552
602
|
const dispatchResult = await deps.resolveDispatch({
|
|
553
603
|
basePath: s.basePath,
|
|
@@ -556,6 +606,7 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
556
606
|
state,
|
|
557
607
|
prefs,
|
|
558
608
|
session: s,
|
|
609
|
+
structuredQuestionsAvailable,
|
|
559
610
|
});
|
|
560
611
|
if (dispatchResult.action === "stop") {
|
|
561
612
|
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId: ic.flowId, seq: ic.nextSeq(), eventType: "dispatch-stop", rule: dispatchResult.matchedRule, data: { reason: dispatchResult.reason } });
|
|
@@ -604,6 +655,18 @@ export async function runDispatch(ic, preData, loopState) {
|
|
|
604
655
|
loopState.stuckRecoveryAttempts++;
|
|
605
656
|
const artifactExists = verifyExpectedArtifact(unitType, unitId, s.basePath);
|
|
606
657
|
if (artifactExists) {
|
|
658
|
+
if (unitType === "complete-milestone") {
|
|
659
|
+
const stuckDiag = diagnoseExpectedArtifact(unitType, unitId, s.basePath);
|
|
660
|
+
const stuckParts = [
|
|
661
|
+
`Detected ${unitType} ${unitId} output on disk, but the same unit is still being derived.`,
|
|
662
|
+
"This usually means the milestone summary exists while the DB row still does not mark the milestone complete.",
|
|
663
|
+
];
|
|
664
|
+
if (stuckDiag)
|
|
665
|
+
stuckParts.push(`Expected: ${stuckDiag}`);
|
|
666
|
+
ctx.ui.notify(stuckParts.join(" "), "warning");
|
|
667
|
+
await deps.pauseAuto(ctx, pi);
|
|
668
|
+
return { action: "break", reason: "complete-milestone-artifact-db-mismatch" };
|
|
669
|
+
}
|
|
607
670
|
debugLog("autoLoop", {
|
|
608
671
|
phase: "stuck-recovery",
|
|
609
672
|
level: 1,
|
|
@@ -908,6 +971,8 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
908
971
|
// per-unit. Without this, the module-level _buffer accumulates across every
|
|
909
972
|
// unit in the same Node process (see workflow-logger.ts module header).
|
|
910
973
|
_resetLogs();
|
|
974
|
+
const dispatchKey = `${unitType}/${unitId}`;
|
|
975
|
+
s.unitDispatchCount.set(dispatchKey, (s.unitDispatchCount.get(dispatchKey) ?? 0) + 1);
|
|
911
976
|
s.currentUnit = { type: unitType, id: unitId, startedAt: Date.now() };
|
|
912
977
|
s.lastGitActionFailure = null;
|
|
913
978
|
s.lastGitActionStatus = null;
|
|
@@ -960,7 +1025,7 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
960
1025
|
finalPrompt = `${capped}\n\n---\n\n${finalPrompt}`;
|
|
961
1026
|
s.pendingCrashRecovery = null;
|
|
962
1027
|
}
|
|
963
|
-
else if ((s.unitDispatchCount.get(
|
|
1028
|
+
else if ((s.unitDispatchCount.get(dispatchKey) ?? 0) > 1) {
|
|
964
1029
|
const diagnostic = deps.getDeepDiagnostic(s.basePath);
|
|
965
1030
|
if (diagnostic) {
|
|
966
1031
|
const cappedDiag = diagnostic.length > MAX_RECOVERY_CHARS
|
|
@@ -1214,7 +1279,7 @@ export async function runUnitPhase(ic, iterData, loopState, sidecarItem) {
|
|
|
1214
1279
|
const artifactVerified = skipArtifactVerification ||
|
|
1215
1280
|
verifyExpectedArtifact(unitType, unitId, s.basePath);
|
|
1216
1281
|
if (artifactVerified) {
|
|
1217
|
-
s.unitDispatchCount.delete(
|
|
1282
|
+
s.unitDispatchCount.delete(dispatchKey);
|
|
1218
1283
|
s.unitRecoveryCount.delete(`${unitType}/${unitId}`);
|
|
1219
1284
|
}
|
|
1220
1285
|
// Write phase handoff anchor after successful research/planning completion
|
|
@@ -1299,28 +1364,7 @@ export async function runFinalize(ic, iterData, loopState, sidecarItem) {
|
|
|
1299
1364
|
: null;
|
|
1300
1365
|
const preResultGuard = await withTimeout(deps.postUnitPreVerification(postUnitCtx, preVerificationOpts), FINALIZE_PRE_TIMEOUT_MS, "postUnitPreVerification");
|
|
1301
1366
|
if (preResultGuard.timedOut) {
|
|
1302
|
-
|
|
1303
|
-
// cannot mutate state for the next unit (#3757).
|
|
1304
|
-
s.currentUnit = null;
|
|
1305
|
-
clearCurrentPhase();
|
|
1306
|
-
// Drop any logger entries from the timed-out unit so they don't bleed
|
|
1307
|
-
// into the next iteration's drain.
|
|
1308
|
-
drainLogs();
|
|
1309
|
-
loopState.consecutiveFinalizeTimeouts++;
|
|
1310
|
-
debugLog("autoLoop", {
|
|
1311
|
-
phase: "pre-verification-timeout",
|
|
1312
|
-
iteration: ic.iteration,
|
|
1313
|
-
unitType: iterData.unitType,
|
|
1314
|
-
unitId: iterData.unitId,
|
|
1315
|
-
consecutiveTimeouts: loopState.consecutiveFinalizeTimeouts,
|
|
1316
|
-
});
|
|
1317
|
-
if (loopState.consecutiveFinalizeTimeouts >= MAX_FINALIZE_TIMEOUTS) {
|
|
1318
|
-
ctx.ui.notify(`postUnitPreVerification timed out ${loopState.consecutiveFinalizeTimeouts} consecutive times — stopping auto-mode to prevent budget waste`, "error");
|
|
1319
|
-
await deps.stopAuto(ctx, pi, `${loopState.consecutiveFinalizeTimeouts} consecutive finalize timeouts`);
|
|
1320
|
-
return { action: "break", reason: "finalize-timeout-escalation" };
|
|
1321
|
-
}
|
|
1322
|
-
ctx.ui.notify(`postUnitPreVerification timed out after ${FINALIZE_PRE_TIMEOUT_MS / 1000}s for ${iterData.unitType} ${iterData.unitId} (${loopState.consecutiveFinalizeTimeouts}/${MAX_FINALIZE_TIMEOUTS}) — continuing to next iteration`, "warning");
|
|
1323
|
-
return { action: "next", data: undefined };
|
|
1367
|
+
return failClosedOnFinalizeTimeout(ic, iterData, loopState, "pre", preUnitSnapshot?.startedAt ?? Date.now());
|
|
1324
1368
|
}
|
|
1325
1369
|
const preResult = preResultGuard.value;
|
|
1326
1370
|
if (preResult === "dispatched") {
|
|
@@ -1381,28 +1425,7 @@ export async function runFinalize(ic, iterData, loopState, sidecarItem) {
|
|
|
1381
1425
|
// auto-loop is not permanently frozen (#2344).
|
|
1382
1426
|
const postResultGuard = await withTimeout(deps.postUnitPostVerification(postUnitCtx), FINALIZE_POST_TIMEOUT_MS, "postUnitPostVerification");
|
|
1383
1427
|
if (postResultGuard.timedOut) {
|
|
1384
|
-
|
|
1385
|
-
// cannot mutate state for the next unit (#3757).
|
|
1386
|
-
s.currentUnit = null;
|
|
1387
|
-
clearCurrentPhase();
|
|
1388
|
-
// Drop any logger entries from the timed-out unit so they don't bleed
|
|
1389
|
-
// into the next iteration's drain.
|
|
1390
|
-
drainLogs();
|
|
1391
|
-
loopState.consecutiveFinalizeTimeouts++;
|
|
1392
|
-
debugLog("autoLoop", {
|
|
1393
|
-
phase: "post-verification-timeout",
|
|
1394
|
-
iteration: ic.iteration,
|
|
1395
|
-
unitType: iterData.unitType,
|
|
1396
|
-
unitId: iterData.unitId,
|
|
1397
|
-
consecutiveTimeouts: loopState.consecutiveFinalizeTimeouts,
|
|
1398
|
-
});
|
|
1399
|
-
if (loopState.consecutiveFinalizeTimeouts >= MAX_FINALIZE_TIMEOUTS) {
|
|
1400
|
-
ctx.ui.notify(`postUnitPostVerification timed out ${loopState.consecutiveFinalizeTimeouts} consecutive times — stopping auto-mode to prevent budget waste`, "error");
|
|
1401
|
-
await deps.stopAuto(ctx, pi, `${loopState.consecutiveFinalizeTimeouts} consecutive finalize timeouts`);
|
|
1402
|
-
return { action: "break", reason: "finalize-timeout-escalation" };
|
|
1403
|
-
}
|
|
1404
|
-
ctx.ui.notify(`postUnitPostVerification timed out after ${FINALIZE_POST_TIMEOUT_MS / 1000}s for ${iterData.unitType} ${iterData.unitId} (${loopState.consecutiveFinalizeTimeouts}/${MAX_FINALIZE_TIMEOUTS}) — continuing to next iteration`, "warning");
|
|
1405
|
-
return { action: "next", data: undefined };
|
|
1428
|
+
return failClosedOnFinalizeTimeout(ic, iterData, loopState, "post", preUnitSnapshot?.startedAt ?? Date.now());
|
|
1406
1429
|
}
|
|
1407
1430
|
const postResult = postResultGuard.value;
|
|
1408
1431
|
if (postResult === "stopped") {
|
|
@@ -60,7 +60,7 @@ export function isSessionSwitchInFlight() {
|
|
|
60
60
|
/**
|
|
61
61
|
* Force-resolve the pending unit promise with { status: "cancelled" }.
|
|
62
62
|
*
|
|
63
|
-
* Used by pauseAuto
|
|
63
|
+
* Used by pauseAuto and supervision catch
|
|
64
64
|
* blocks to ensure the autoLoop is never stuck awaiting a promise that
|
|
65
65
|
* will never resolve. Safe to call when no resolver is pending (no-op).
|
|
66
66
|
*/
|
|
@@ -62,7 +62,16 @@ export async function runUnit(ctx, pi, s, unitType, unitId, prompt) {
|
|
|
62
62
|
if (s.currentUnitModel && typeof pi.setModel === "function") {
|
|
63
63
|
const restored = await pi.setModel(s.currentUnitModel, { persist: false });
|
|
64
64
|
if (!restored) {
|
|
65
|
-
|
|
65
|
+
const message = `Failed to restore configured model ${s.currentUnitModel.provider}/${s.currentUnitModel.id} after session creation`;
|
|
66
|
+
ctx.ui.notify(`${message}. Cancelling unit before dispatch.`, "warning");
|
|
67
|
+
return {
|
|
68
|
+
status: "cancelled",
|
|
69
|
+
errorContext: {
|
|
70
|
+
message,
|
|
71
|
+
category: "session-failed",
|
|
72
|
+
isTransient: false,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
// ── Create the agent_end promise (per-unit one-shot) ──
|
|
@@ -107,6 +107,9 @@ export class AutoSession {
|
|
|
107
107
|
checkpointSha = null;
|
|
108
108
|
// ── Signal handler ───────────────────────────────────────────────────────
|
|
109
109
|
sigtermHandler = null;
|
|
110
|
+
// ── Remote command polling ───────────────────────────────────────────────
|
|
111
|
+
/** Cleanup function returned by startCommandPolling(); null when not running. */
|
|
112
|
+
commandPollingCleanup = null;
|
|
110
113
|
// ── Loop promise state ──────────────────────────────────────────────────
|
|
111
114
|
// Per-unit resolve function and session-switch guard live at module level
|
|
112
115
|
// in auto-loop.ts (_currentResolve, _sessionSwitchInFlight).
|
|
@@ -200,6 +203,8 @@ export class AutoSession {
|
|
|
200
203
|
this.checkpointSha = null;
|
|
201
204
|
// Signal handler
|
|
202
205
|
this.sigtermHandler = null;
|
|
206
|
+
// Remote command polling — cleanup must be called before reset (auto.ts stopAuto)
|
|
207
|
+
this.commandPollingCleanup = null;
|
|
203
208
|
// Loop promise state lives in auto-loop.ts module scope
|
|
204
209
|
}
|
|
205
210
|
toJSON() {
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* without modifying orchestration code.
|
|
10
10
|
*/
|
|
11
11
|
import { loadFile, extractUatType, loadActiveOverrides } from "./files.js";
|
|
12
|
-
import { isDbAvailable, getMilestoneSlices, getPendingGates, markAllGatesOmitted, getMilestone } from "./gsd-db.js";
|
|
12
|
+
import { isDbAvailable, getMilestoneSlices, getPendingGates, markAllGatesOmitted, getMilestone, updateMilestoneStatus } from "./gsd-db.js";
|
|
13
|
+
import { isClosedStatus } from "./status-guards.js";
|
|
13
14
|
import { extractVerdict, isAcceptableUatVerdict } from "./verdict-parser.js";
|
|
14
15
|
import { gsdRoot, resolveMilestoneFile, resolveMilestonePath, resolveSliceFile, resolveTaskFile, relSliceFile, buildMilestoneFileName, } from "./paths.js";
|
|
15
16
|
import { parseRoadmap } from "./parsers-legacy.js";
|
|
@@ -238,20 +239,20 @@ export const DISPATCH_RULES = [
|
|
|
238
239
|
},
|
|
239
240
|
{
|
|
240
241
|
name: "needs-discussion → discuss-milestone",
|
|
241
|
-
match: async ({ state, mid, midTitle, basePath }) => {
|
|
242
|
+
match: async ({ state, mid, midTitle, basePath, structuredQuestionsAvailable }) => {
|
|
242
243
|
if (state.phase !== "needs-discussion")
|
|
243
244
|
return null;
|
|
244
245
|
return {
|
|
245
246
|
action: "dispatch",
|
|
246
247
|
unitType: "discuss-milestone",
|
|
247
248
|
unitId: mid,
|
|
248
|
-
prompt: await buildDiscussMilestonePrompt(mid, midTitle, basePath),
|
|
249
|
+
prompt: await buildDiscussMilestonePrompt(mid, midTitle, basePath, structuredQuestionsAvailable),
|
|
249
250
|
};
|
|
250
251
|
},
|
|
251
252
|
},
|
|
252
253
|
{
|
|
253
254
|
name: "pre-planning (no context) → discuss-milestone",
|
|
254
|
-
match: async ({ state, mid, midTitle, basePath }) => {
|
|
255
|
+
match: async ({ state, mid, midTitle, basePath, structuredQuestionsAvailable }) => {
|
|
255
256
|
if (state.phase !== "pre-planning")
|
|
256
257
|
return null;
|
|
257
258
|
const contextFile = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
@@ -262,7 +263,7 @@ export const DISPATCH_RULES = [
|
|
|
262
263
|
action: "dispatch",
|
|
263
264
|
unitType: "discuss-milestone",
|
|
264
265
|
unitId: mid,
|
|
265
|
-
prompt: await buildDiscussMilestonePrompt(mid, midTitle, basePath),
|
|
266
|
+
prompt: await buildDiscussMilestonePrompt(mid, midTitle, basePath, structuredQuestionsAvailable),
|
|
266
267
|
};
|
|
267
268
|
},
|
|
268
269
|
},
|
|
@@ -600,6 +601,33 @@ export const DISPATCH_RULES = [
|
|
|
600
601
|
match: async ({ state, mid, midTitle, basePath }) => {
|
|
601
602
|
if (state.phase !== "completing-milestone")
|
|
602
603
|
return null;
|
|
604
|
+
// Defense-in-depth (#4324): skip dispatch if the DB already marks
|
|
605
|
+
// this milestone as complete. Prevents re-enqueue when the legacy
|
|
606
|
+
// filesystem state-derivation path runs (e.g. transient DB
|
|
607
|
+
// unavailability) and produces a stale completing-milestone phase.
|
|
608
|
+
if (isDbAvailable()) {
|
|
609
|
+
const milestone = getMilestone(mid);
|
|
610
|
+
if (milestone && isClosedStatus(milestone.status)) {
|
|
611
|
+
return { action: "skip" };
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
// Reconciliation guard (#4324): when the SUMMARY file already exists
|
|
615
|
+
// on disk but the DB says the milestone is not complete, the DB is
|
|
616
|
+
// out of sync (e.g. journal reset, partial merge, crash recovery).
|
|
617
|
+
// Reconcile the DB status directly instead of re-dispatching the
|
|
618
|
+
// tool, which would overwrite the richer on-disk SUMMARY with a
|
|
619
|
+
// thinner regenerated version — causing silent data loss.
|
|
620
|
+
const existingSummary = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
621
|
+
if (existingSummary && isDbAvailable()) {
|
|
622
|
+
try {
|
|
623
|
+
updateMilestoneStatus(mid, "complete", new Date().toISOString());
|
|
624
|
+
logWarning("dispatch", `Milestone ${mid} has SUMMARY on disk but DB status was not complete — reconciled DB to complete (#4324)`);
|
|
625
|
+
}
|
|
626
|
+
catch (err) {
|
|
627
|
+
logWarning("dispatch", `Failed to reconcile milestone ${mid} status: ${err instanceof Error ? err.message : String(err)}`);
|
|
628
|
+
}
|
|
629
|
+
return { action: "skip" };
|
|
630
|
+
}
|
|
603
631
|
// Safety guard (#2675): block completion when VALIDATION verdict is
|
|
604
632
|
// needs-remediation. The state machine treats needs-remediation as
|
|
605
633
|
// terminal (to prevent validate-milestone loops per #832), but
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* (auto.ts, auto-timeout-recovery.ts, agent-end-recovery.ts, tests)
|
|
7
7
|
* continue to work without changes.
|
|
8
8
|
*/
|
|
9
|
-
export { autoLoop } from "./auto/loop.js";
|
|
9
|
+
export { autoLoop, runUokKernelLoop, runLegacyAutoLoop } from "./auto/loop.js";
|
|
10
10
|
export { isInfrastructureError, INFRA_ERROR_CODES } from "./auto/infra-errors.js";
|
|
11
11
|
export { resolveAgentEnd, resolveAgentEndCancelled, isSessionSwitchInFlight, _resetPendingResolve, _setActiveSession } from "./auto/resolve.js";
|
|
12
12
|
export { detectStuck } from "./auto/detect-stuck.js";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Post-unit processing for
|
|
2
|
+
* Post-unit processing for auto-loop — auto-commit, doctor run,
|
|
3
3
|
* state rebuild, worktree sync, DB dual-write, hooks, triage, and
|
|
4
4
|
* quick-task dispatch.
|
|
5
5
|
*
|
|
6
|
-
* Split into two functions called sequentially by
|
|
6
|
+
* Split into two functions called sequentially by auto-loop with
|
|
7
7
|
* the verification gate between them:
|
|
8
8
|
* 1. postUnitPreVerification() — commit, doctor, state rebuild, worktree sync, artifact verification
|
|
9
9
|
* 2. postUnitPostVerification() — DB dual-write, hooks, triage, quick-tasks
|
|
10
10
|
*
|
|
11
|
-
* Extracted from
|
|
11
|
+
* Extracted from the pre-loop agent_end handler in auto.ts.
|
|
12
12
|
*/
|
|
13
13
|
import { deriveState } from "./state.js";
|
|
14
14
|
import { logWarning, logError } from "./workflow-logger.js";
|
|
@@ -872,13 +872,13 @@ export async function checkNeedsRunUat(base, mid, state, prefs) {
|
|
|
872
872
|
* as a seed when present. The discussion agent interviews the user, writes
|
|
873
873
|
* a full CONTEXT.md, and the phase transitions to pre-planning automatically.
|
|
874
874
|
*/
|
|
875
|
-
export async function buildDiscussMilestonePrompt(mid, midTitle, base) {
|
|
875
|
+
export async function buildDiscussMilestonePrompt(mid, midTitle, base, structuredQuestionsAvailable = "false") {
|
|
876
876
|
const discussTemplates = inlineTemplate("context", "Context");
|
|
877
877
|
const basePrompt = loadPrompt("guided-discuss-milestone", {
|
|
878
878
|
milestoneId: mid,
|
|
879
879
|
milestoneTitle: midTitle,
|
|
880
880
|
inlinedTemplates: discussTemplates,
|
|
881
|
-
structuredQuestionsAvailable
|
|
881
|
+
structuredQuestionsAvailable,
|
|
882
882
|
commitInstruction: "Do not commit planning artifacts — .gsd/ is managed externally.",
|
|
883
883
|
fastPathInstruction: "",
|
|
884
884
|
});
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { parseUnitId } from "./unit-id.js";
|
|
10
10
|
import { appendEvent } from "./workflow-events.js";
|
|
11
|
+
import { atomicWriteSync } from "./atomic-write.js";
|
|
11
12
|
import { clearParseCache } from "./files.js";
|
|
12
13
|
import { parseRoadmap as parseLegacyRoadmap, parsePlan as parseLegacyPlan } from "./parsers-legacy.js";
|
|
13
14
|
import { isDbAvailable, getTask, getSlice, getSliceTasks, getPendingGates, updateTaskStatus, updateSliceStatus } from "./gsd-db.js";
|
|
@@ -414,6 +415,14 @@ export function writeBlockerPlaceholder(unitType, unitId, base, reason) {
|
|
|
414
415
|
if (unitType === "execute-task" && mid && sid && tid) {
|
|
415
416
|
try {
|
|
416
417
|
updateTaskStatus(mid, sid, tid, "complete", ts);
|
|
418
|
+
const planPath = resolveSliceFile(base, mid, sid, "PLAN");
|
|
419
|
+
if (planPath && existsSync(planPath)) {
|
|
420
|
+
const planContent = readFileSync(planPath, "utf-8");
|
|
421
|
+
const updatedPlan = planContent.replace(new RegExp(`^(\\s*-\\s+)\\[ \\]\\s+\\*\\*${tid}:`, "m"), `$1[x] **${tid}:`);
|
|
422
|
+
if (updatedPlan !== planContent) {
|
|
423
|
+
atomicWriteSync(planPath, updatedPlan);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
417
426
|
}
|
|
418
427
|
catch (e) {
|
|
419
428
|
logWarning("recovery", `updateTaskStatus failed during context exhaustion: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* dependency audits, handles auto-fix retry logic, and writes
|
|
6
6
|
* verification evidence JSON.
|
|
7
7
|
*
|
|
8
|
-
* Extracted from
|
|
9
|
-
* value instead of calling return/pauseAuto directly — the
|
|
10
|
-
* checks the result and handles control flow.
|
|
8
|
+
* Extracted from the pre-loop agent_end handler in auto.ts. Returns a
|
|
9
|
+
* sentinel value instead of calling return/pauseAuto directly — the
|
|
10
|
+
* caller checks the result and handles control flow.
|
|
11
11
|
*/
|
|
12
12
|
import { mkdirSync, writeFileSync } from "node:fs";
|
|
13
13
|
import { resolveSlicePath, resolveMilestoneFile } from "./paths.js";
|
|
@@ -47,6 +47,7 @@ import { GitServiceImpl } from "./git-service.js";
|
|
|
47
47
|
import { getPriorSliceCompletionBlocker } from "./dispatch-guard.js";
|
|
48
48
|
import { createAutoWorktree, enterAutoWorktree, teardownAutoWorktree, isInAutoWorktree, getAutoWorktreePath, mergeMilestoneToMain, autoWorktreeBranch, syncWorktreeStateBack, syncProjectRootToWorktree, checkResourcesStale, escapeStaleWorktree, } from "./auto-worktree.js";
|
|
49
49
|
import { pruneQueueOrder } from "./queue-order.js";
|
|
50
|
+
import { startCommandPolling as _startCommandPolling, isRemoteConfigured } from "../remote-questions/manager.js";
|
|
50
51
|
import { debugLog, isDebugEnabled, writeDebugSummary } from "./debug-logger.js";
|
|
51
52
|
import { reconcileMergeState, } from "./auto-recovery.js";
|
|
52
53
|
import { resolveDispatch, DISPATCH_RULES } from "./auto-dispatch.js";
|
|
@@ -64,7 +65,7 @@ import { runPostUnitVerification } from "./auto-verification.js";
|
|
|
64
65
|
import { autoCommitUnit, postUnitPreVerification, postUnitPostVerification, } from "./auto-post-unit.js";
|
|
65
66
|
import { bootstrapAutoSession, openProjectDbIfPresent } from "./auto-start.js";
|
|
66
67
|
import { initHealthWidget } from "./health-widget.js";
|
|
67
|
-
import {
|
|
68
|
+
import { runLegacyAutoLoop, runUokKernelLoop, resolveAgentEnd, resolveAgentEndCancelled, _resetPendingResolve, isSessionSwitchInFlight } from "./auto-loop.js";
|
|
68
69
|
import { runAutoLoopWithUok } from "./uok/kernel.js";
|
|
69
70
|
import { resolveUokFlags } from "./uok/flags.js";
|
|
70
71
|
import { WorktreeResolver, } from "./worktree-resolver.js";
|
|
@@ -185,6 +186,26 @@ function deregisterSigtermHandler() {
|
|
|
185
186
|
_deregisterSigtermHandler(s.sigtermHandler);
|
|
186
187
|
s.sigtermHandler = null;
|
|
187
188
|
}
|
|
189
|
+
/**
|
|
190
|
+
* Wrapper: start background command polling for the configured remote channel
|
|
191
|
+
* (currently Telegram only). Stores the cleanup function on the session so
|
|
192
|
+
* every exit path can stop the interval via stopCommandPolling().
|
|
193
|
+
* No-op when no remote channel is configured.
|
|
194
|
+
*/
|
|
195
|
+
function startAutoCommandPolling(basePath) {
|
|
196
|
+
if (!isRemoteConfigured())
|
|
197
|
+
return;
|
|
198
|
+
// Clear any existing interval before starting a new one (e.g. resume path).
|
|
199
|
+
stopAutoCommandPolling();
|
|
200
|
+
s.commandPollingCleanup = _startCommandPolling(basePath);
|
|
201
|
+
}
|
|
202
|
+
/** Wrapper: stop background command polling and clear the stored cleanup. */
|
|
203
|
+
function stopAutoCommandPolling() {
|
|
204
|
+
if (s.commandPollingCleanup) {
|
|
205
|
+
s.commandPollingCleanup();
|
|
206
|
+
s.commandPollingCleanup = null;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
188
209
|
export function getAutoDashboardData() {
|
|
189
210
|
const ledger = getLedger();
|
|
190
211
|
const totals = ledger ? getProjectTotals(ledger.units) : null;
|
|
@@ -392,6 +413,7 @@ function handleLostSessionLock(ctx, lockStatus) {
|
|
|
392
413
|
s.paused = false;
|
|
393
414
|
deactivateGSD();
|
|
394
415
|
clearUnitTimeout();
|
|
416
|
+
stopAutoCommandPolling();
|
|
395
417
|
restoreProjectRootEnv();
|
|
396
418
|
restoreMilestoneLockEnv();
|
|
397
419
|
deregisterSigtermHandler();
|
|
@@ -427,6 +449,7 @@ function cleanupAfterLoopExit(ctx) {
|
|
|
427
449
|
s.active = false;
|
|
428
450
|
deactivateGSD();
|
|
429
451
|
clearUnitTimeout();
|
|
452
|
+
stopAutoCommandPolling();
|
|
430
453
|
restoreProjectRootEnv();
|
|
431
454
|
restoreMilestoneLockEnv();
|
|
432
455
|
// Clear crash lock and release session lock so the next `/gsd next` does
|
|
@@ -471,6 +494,7 @@ export async function stopAuto(ctx, pi, reason) {
|
|
|
471
494
|
// ── Step 1: Timers and locks ──
|
|
472
495
|
try {
|
|
473
496
|
clearUnitTimeout();
|
|
497
|
+
stopAutoCommandPolling();
|
|
474
498
|
if (lockBase())
|
|
475
499
|
clearLock(lockBase());
|
|
476
500
|
if (lockBase())
|
|
@@ -724,6 +748,7 @@ export async function pauseAuto(ctx, _pi, _errorContext) {
|
|
|
724
748
|
if (!s.active)
|
|
725
749
|
return;
|
|
726
750
|
clearUnitTimeout();
|
|
751
|
+
stopAutoCommandPolling();
|
|
727
752
|
// Flush queued follow-up messages (#3512).
|
|
728
753
|
// Late async notifications (async_job_result, gsd-auto-wrapup) can trigger
|
|
729
754
|
// extra LLM turns after pause. Flush them the same way run-unit.ts does.
|
|
@@ -1179,12 +1204,14 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1179
1204
|
writeLock(lockBase(), "resuming", s.currentMilestoneId ?? "unknown");
|
|
1180
1205
|
logCmuxEvent(loadEffectiveGSDPreferences()?.preferences, s.stepMode ? "Step-mode resumed." : "Auto-mode resumed.", "progress");
|
|
1181
1206
|
captureProjectRootEnv(s.originalBasePath || s.basePath);
|
|
1207
|
+
startAutoCommandPolling(s.basePath);
|
|
1182
1208
|
await runAutoLoopWithUok({
|
|
1183
1209
|
ctx,
|
|
1184
1210
|
pi,
|
|
1185
1211
|
s,
|
|
1186
1212
|
deps: buildLoopDeps(),
|
|
1187
|
-
|
|
1213
|
+
runKernelLoop: runUokKernelLoop,
|
|
1214
|
+
runLegacyLoop: runLegacyAutoLoop,
|
|
1188
1215
|
});
|
|
1189
1216
|
cleanupAfterLoopExit(ctx);
|
|
1190
1217
|
return;
|
|
@@ -1208,35 +1235,18 @@ export async function startAuto(ctx, pi, base, verboseMode, options) {
|
|
|
1208
1235
|
logWarning("engine", `cmux sync failed: ${err instanceof Error ? err.message : String(err)}`, { file: "auto.ts" });
|
|
1209
1236
|
}
|
|
1210
1237
|
logCmuxEvent(loadEffectiveGSDPreferences()?.preferences, requestedStepMode ? "Step-mode started." : "Auto-mode started.", "progress");
|
|
1238
|
+
startAutoCommandPolling(s.basePath);
|
|
1211
1239
|
// Dispatch the first unit
|
|
1212
1240
|
await runAutoLoopWithUok({
|
|
1213
1241
|
ctx,
|
|
1214
1242
|
pi,
|
|
1215
1243
|
s,
|
|
1216
1244
|
deps: buildLoopDeps(),
|
|
1217
|
-
|
|
1245
|
+
runKernelLoop: runUokKernelLoop,
|
|
1246
|
+
runLegacyLoop: runLegacyAutoLoop,
|
|
1218
1247
|
});
|
|
1219
1248
|
cleanupAfterLoopExit(ctx);
|
|
1220
1249
|
}
|
|
1221
|
-
// ─── Agent End Handler ────────────────────────────────────────────────────────
|
|
1222
|
-
/**
|
|
1223
|
-
* Deprecated thin wrapper — kept as export for backward compatibility.
|
|
1224
|
-
* The actual agent_end processing now happens via resolveAgentEnd() in auto-loop.ts,
|
|
1225
|
-
* which is called directly from index.ts. The autoLoop() while loop handles all
|
|
1226
|
-
* post-unit processing (verification, hooks, dispatch) that this function used to do.
|
|
1227
|
-
*
|
|
1228
|
-
* If called by straggler code, it simply resolves the pending promise so the loop
|
|
1229
|
-
* can continue.
|
|
1230
|
-
*/
|
|
1231
|
-
export async function handleAgentEnd(ctx, pi) {
|
|
1232
|
-
if (!s.active || !s.cmdCtx) {
|
|
1233
|
-
// Even when inactive, resolve any pending promise so the loop is unblocked.
|
|
1234
|
-
resolveAgentEndCancelled();
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
clearUnitTimeout();
|
|
1238
|
-
resolveAgentEnd({ messages: [] });
|
|
1239
|
-
}
|
|
1240
1250
|
// describeNextUnit is imported from auto-dashboard.ts and re-exported
|
|
1241
1251
|
export { describeNextUnit } from "./auto-dashboard.js";
|
|
1242
1252
|
/** Thin wrapper: delegates to auto-dashboard.ts, passing state accessors. */
|