gsd-pi 2.76.0-dev.fe143342a → 2.77.0-dev.1d17f366c
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 +17 -35
- package/dist/claude-cli-check.js +32 -3
- package/dist/cli-web-branch.d.ts +1 -0
- package/dist/cli-web-branch.js +3 -0
- package/dist/cli.js +38 -2
- package/dist/extension-discovery.d.ts +6 -0
- package/dist/extension-discovery.js +37 -0
- package/dist/extension-registry.d.ts +3 -0
- package/dist/extension-sort.d.ts +18 -0
- package/dist/extension-sort.js +114 -0
- package/dist/extension-validator.d.ts +47 -0
- package/dist/extension-validator.js +127 -0
- package/dist/loader.js +35 -7
- package/dist/onboarding.js +45 -0
- package/dist/provider-migrations.d.ts +18 -0
- package/dist/provider-migrations.js +14 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +4 -3
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +78 -59
- package/dist/resources/extensions/cmux/index.js +20 -0
- package/dist/resources/extensions/github-sync/templates.js +103 -0
- package/dist/resources/extensions/google-search/extension-manifest.json +5 -4
- package/dist/resources/extensions/google-search/index.js +3 -375
- package/dist/resources/extensions/gsd/abandon-detect.js +44 -0
- package/dist/resources/extensions/gsd/auto/loop.js +90 -2
- package/dist/resources/extensions/gsd/auto/phases.js +95 -21
- package/dist/resources/extensions/gsd/auto/resolve.js +24 -0
- package/dist/resources/extensions/gsd/auto/run-unit.js +48 -4
- package/dist/resources/extensions/gsd/auto/session.js +18 -1
- package/dist/resources/extensions/gsd/auto/turn-epoch.js +95 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +115 -17
- package/dist/resources/extensions/gsd/auto-loop.js +1 -1
- package/dist/resources/extensions/gsd/auto-model-selection.js +1 -1
- package/dist/resources/extensions/gsd/auto-post-unit.js +90 -2
- package/dist/resources/extensions/gsd/auto-prompts.js +14 -0
- package/dist/resources/extensions/gsd/auto-recovery.js +46 -1
- package/dist/resources/extensions/gsd/auto-start.js +45 -39
- package/dist/resources/extensions/gsd/auto-timeout-recovery.js +11 -5
- package/dist/resources/extensions/gsd/auto-unit-closeout.js +11 -2
- package/dist/resources/extensions/gsd/auto-worktree.js +109 -61
- package/dist/resources/extensions/gsd/auto.js +97 -31
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +27 -1
- package/dist/resources/extensions/gsd/bootstrap/provider-error-resume.js +4 -2
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +11 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +17 -6
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +11 -6
- package/dist/resources/extensions/gsd/bootstrap/write-gate.js +34 -2
- package/dist/resources/extensions/gsd/clean-root-preflight.js +93 -0
- package/dist/resources/extensions/gsd/commands/handlers/workflow.js +31 -4
- package/dist/resources/extensions/gsd/commands-cmux.js +9 -6
- package/dist/resources/extensions/gsd/commands-extensions.js +634 -43
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +968 -23
- package/dist/resources/extensions/gsd/dispatch-guard.js +29 -3
- package/dist/resources/extensions/gsd/file-lock.js +49 -9
- package/dist/resources/extensions/gsd/git-service.js +1 -0
- package/dist/resources/extensions/gsd/gitignore.js +2 -0
- package/dist/resources/extensions/gsd/gsd-db.js +90 -30
- package/dist/resources/extensions/gsd/guided-flow-queue.js +4 -1
- package/dist/resources/extensions/gsd/guided-flow.js +212 -9
- package/dist/resources/extensions/gsd/health-widget.js +4 -1
- package/dist/resources/extensions/gsd/journal.js +17 -2
- package/dist/resources/extensions/gsd/key-manager.js +22 -0
- package/dist/resources/extensions/gsd/milestone-actions.js +15 -0
- package/dist/resources/extensions/gsd/milestone-summary-classifier.js +37 -0
- package/dist/resources/extensions/gsd/model-router.js +36 -3
- package/dist/resources/extensions/gsd/notifications.js +30 -16
- package/dist/resources/extensions/gsd/pre-execution-checks.js +31 -6
- package/dist/resources/extensions/gsd/prompts/discuss-headless.md +29 -2
- package/dist/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/dist/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/dist/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/dist/resources/extensions/gsd/prompts/system.md +1 -0
- package/dist/resources/extensions/gsd/reports.js +5 -4
- package/dist/resources/extensions/gsd/safety/evidence-collector.js +96 -0
- package/dist/resources/extensions/gsd/safety/file-change-validator.js +12 -4
- package/dist/resources/extensions/gsd/safety/safety-harness.js +5 -1
- package/dist/resources/extensions/gsd/state-transition-matrix.js +118 -0
- package/dist/resources/extensions/gsd/state.js +25 -25
- package/dist/resources/extensions/gsd/token-counter.js +22 -5
- package/dist/resources/extensions/gsd/tools/complete-milestone.js +16 -10
- package/dist/resources/extensions/gsd/tools/complete-slice.js +21 -0
- package/dist/resources/extensions/gsd/tools/complete-task.js +31 -0
- package/dist/resources/extensions/gsd/uok/audit.js +18 -2
- package/dist/resources/extensions/gsd/uok/dispatch-envelope.js +33 -0
- package/dist/resources/extensions/gsd/uok/execution-graph.js +10 -0
- package/dist/resources/extensions/gsd/uok/gitops.js +2 -1
- package/dist/resources/extensions/gsd/uok/loop-adapter.js +37 -10
- package/dist/resources/extensions/gsd/uok/parity-report.js +58 -0
- package/dist/resources/extensions/gsd/uok/plan-v2.js +30 -7
- package/dist/resources/extensions/gsd/uok/writer.js +82 -0
- package/dist/resources/extensions/gsd/workflow-logger.js +10 -2
- package/dist/resources/extensions/gsd/worktree-manager.js +1 -0
- package/dist/resources/extensions/gsd/worktree-resolver.js +50 -10
- package/dist/resources/extensions/mcp-client/auth.js +10 -1
- package/dist/resources/extensions/mcp-client/index.js +118 -9
- package/dist/resources/extensions/shared/cmux-events.js +12 -0
- package/dist/resources/extensions/shared/rtk-session-stats.js +1 -2
- package/dist/resources/skills/create-skill/SKILL.md +2 -2
- package/dist/resources/skills/create-skill/references/gsd-skill-ecosystem.md +4 -4
- package/dist/resources/skills/create-skill/workflows/audit-skill.md +4 -4
- package/dist/resources/skills/create-skill/workflows/create-new-skill.md +5 -5
- package/dist/resources/skills/verify-before-complete/SKILL.md +2 -1
- package/dist/resources/skills/write-docs/SKILL.md +2 -1
- package/dist/tsconfig.extensions.tsbuildinfo +1 -1
- package/dist/web/standalone/.next/BUILD_ID +1 -1
- package/dist/web/standalone/.next/app-path-routes-manifest.json +9 -9
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/prerender-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.html +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.html +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/boot/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/input/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/resize/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/bridge-terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/captures/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/cleanup/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/doctor/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/export-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/forensics/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/git/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/history/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/hooks/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/inspect/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/knowledge/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/live-state/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/notifications/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/onboarding/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/recovery/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/browser/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/command/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/events/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/session/manage/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/settings-data/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/skill-health/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/steer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/switch-root/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/sessions/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/terminal/stream/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/undo/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js.nft.json +1 -1
- package/dist/web/standalone/.next/server/app/index.html +1 -1
- package/dist/web/standalone/.next/server/app/index.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/dist/web/standalone/.next/server/app-paths-manifest.json +9 -9
- package/dist/web/standalone/.next/server/chunks/1926.js +1 -0
- 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.e9f5195e91f9cad2.js +11 -0
- package/dist/web/standalone/.next/static/chunks/{webpack-5fc74f13a25fa1bb.js → webpack-2e68521d7c82f7c2.js} +1 -1
- package/dist/welcome-screen.js +6 -1
- package/dist/wizard.js +2 -0
- package/package.json +16 -14
- package/packages/daemon/package.json +2 -2
- package/packages/mcp-server/README.md +3 -3
- package/packages/mcp-server/dist/env-writer.d.ts +1 -0
- package/packages/mcp-server/dist/env-writer.d.ts.map +1 -1
- package/packages/mcp-server/dist/env-writer.js +74 -6
- package/packages/mcp-server/dist/env-writer.js.map +1 -1
- package/packages/mcp-server/dist/remote-questions.d.ts +45 -0
- package/packages/mcp-server/dist/remote-questions.d.ts.map +1 -0
- package/packages/mcp-server/dist/remote-questions.js +732 -0
- package/packages/mcp-server/dist/remote-questions.js.map +1 -0
- package/packages/mcp-server/dist/server.d.ts +7 -0
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +95 -10
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/session-manager.d.ts +14 -0
- package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
- package/packages/mcp-server/dist/session-manager.js +49 -1
- package/packages/mcp-server/dist/session-manager.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +15 -6
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +9 -3
- package/packages/mcp-server/src/env-writer.test.ts +79 -1
- package/packages/mcp-server/src/env-writer.ts +76 -6
- package/packages/mcp-server/src/mcp-server.test.ts +67 -0
- package/packages/mcp-server/src/readers/readers.test.ts +5 -1
- package/packages/mcp-server/src/remote-questions.test.ts +294 -0
- package/packages/mcp-server/src/remote-questions.ts +916 -0
- package/packages/mcp-server/src/server.ts +118 -16
- package/packages/mcp-server/src/session-manager.ts +43 -1
- package/packages/mcp-server/src/workflow-tools.test.ts +44 -0
- package/packages/mcp-server/src/workflow-tools.ts +19 -6
- package/packages/mcp-server/tsconfig.test.json +19 -0
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +6 -1
- package/packages/native/src/__tests__/clipboard.test.mjs +69 -23
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +6 -1
- package/packages/pi-agent-core/src/agent-loop.test.ts +220 -15
- package/packages/pi-ai/dist/models/custom.d.ts +38 -0
- package/packages/pi-ai/dist/models/custom.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/custom.js +41 -0
- package/packages/pi-ai/dist/models/custom.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +1 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +27 -4
- package/packages/pi-ai/dist/providers/anthropic-shared.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +8 -3
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js +80 -0
- package/packages/pi-ai/dist/providers/minimax-tool-name.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts +10 -0
- package/packages/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/simple-options.js +16 -1
- package/packages/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/packages/pi-ai/package.json +6 -1
- package/packages/pi-ai/src/models/custom.ts +42 -0
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +1 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +26 -5
- package/packages/pi-ai/src/providers/anthropic.ts +9 -3
- package/packages/pi-ai/src/providers/minimax-tool-name.test.ts +98 -0
- package/packages/pi-ai/src/providers/simple-options.ts +17 -1
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js +3 -2
- package/packages/pi-coding-agent/dist/core/agent-session-abort-order.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +7 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts +25 -0
- package/packages/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js +105 -6
- package/packages/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js +230 -28
- package/packages/pi-coding-agent/dist/core/compaction/compaction.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts +30 -2
- package/packages/pi-coding-agent/dist/core/compaction/utils.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction/utils.js +113 -12
- package/packages/pi-coding-agent/dist/core/compaction/utils.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js +29 -18
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.test.js +130 -0
- package/packages/pi-coding-agent/dist/core/compaction-orchestrator.test.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js +56 -1
- package/packages/pi-coding-agent/dist/core/compaction-utils.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js +8 -15
- package/packages/pi-coding-agent/dist/core/discovery-cache.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/extension-discovery.d.ts +25 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-discovery.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-discovery.js +109 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-discovery.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-registry.d.ts +67 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-registry.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-registry.js +167 -0
- package/packages/pi-coding-agent/dist/core/extensions/extension-registry.js.map +1 -0
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts +3 -2
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +24 -8
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts +14 -0
- package/packages/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js +11 -0
- package/packages/pi-coding-agent/dist/core/lsp/lsp-integration.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js +2 -2
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.test.js +203 -0
- package/packages/pi-coding-agent/dist/core/model-registry-custom-caps.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 +14 -0
- package/packages/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js +1 -1
- package/packages/pi-coding-agent/dist/core/resource-loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +4 -1
- package/packages/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.test.js +19 -1
- package/packages/pi-coding-agent/dist/core/sdk.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js +21 -1
- package/packages/pi-coding-agent/dist/core/session-manager.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/system-prompt.js +3 -3
- package/packages/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/tools/path-utils.test.js +2 -1
- package/packages/pi-coding-agent/dist/core/tools/path-utils.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js +15 -6
- package/packages/pi-coding-agent/dist/modes/interactive/components/__tests__/provider-display-name.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js +14 -5
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts +7 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js +31 -9
- package/packages/pi-coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.js +14 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/input-controller.test.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 +13 -1
- package/packages/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/packages/pi-coding-agent/package.json +6 -1
- package/packages/pi-coding-agent/src/core/agent-session-abort-order.test.ts +3 -2
- package/packages/pi-coding-agent/src/core/agent-session.ts +11 -0
- package/packages/pi-coding-agent/src/core/compaction/compaction.test.ts +368 -28
- package/packages/pi-coding-agent/src/core/compaction/compaction.ts +122 -6
- package/packages/pi-coding-agent/src/core/compaction/utils.ts +111 -13
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.test.ts +154 -0
- package/packages/pi-coding-agent/src/core/compaction-orchestrator.ts +32 -18
- package/packages/pi-coding-agent/src/core/compaction-utils.test.ts +68 -1
- package/packages/pi-coding-agent/src/core/discovery-cache.test.ts +9 -18
- package/packages/pi-coding-agent/src/core/extensions/extension-discovery.ts +119 -0
- package/packages/pi-coding-agent/src/core/extensions/extension-registry.ts +222 -0
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +24 -11
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +2 -0
- package/packages/pi-coding-agent/src/core/extensions/types.ts +15 -0
- package/packages/pi-coding-agent/src/core/lsp/lsp-integration.test.ts +13 -0
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +2 -2
- package/packages/pi-coding-agent/src/core/model-registry-custom-caps.test.ts +245 -0
- package/packages/pi-coding-agent/src/core/model-registry.ts +16 -0
- package/packages/pi-coding-agent/src/core/resource-loader.ts +1 -1
- package/packages/pi-coding-agent/src/core/sdk.test.ts +25 -1
- package/packages/pi-coding-agent/src/core/sdk.ts +10 -3
- package/packages/pi-coding-agent/src/core/session-manager.test.ts +30 -1
- package/packages/pi-coding-agent/src/core/session-manager.ts +1 -1
- package/packages/pi-coding-agent/src/core/system-prompt.ts +3 -3
- package/packages/pi-coding-agent/src/core/tools/path-utils.test.ts +2 -1
- package/packages/pi-coding-agent/src/modes/interactive/components/__tests__/provider-display-name.test.ts +17 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +14 -5
- package/packages/pi-coding-agent/src/modes/interactive/components/model-selector.ts +45 -11
- package/packages/pi-coding-agent/src/modes/interactive/controllers/input-controller.test.ts +14 -0
- package/packages/pi-coding-agent/src/modes/interactive/interactive-mode.ts +13 -1
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js +12 -5
- package/packages/pi-tui/dist/__tests__/autocomplete.test.js.map +1 -1
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js +21 -0
- package/packages/pi-tui/dist/__tests__/stdin-buffer.test.js.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.d.ts +7 -0
- package/packages/pi-tui/dist/stdin-buffer.d.ts.map +1 -1
- package/packages/pi-tui/dist/stdin-buffer.js +20 -0
- package/packages/pi-tui/dist/stdin-buffer.js.map +1 -1
- package/packages/pi-tui/package.json +6 -1
- package/packages/pi-tui/src/__tests__/autocomplete.test.ts +20 -5
- package/packages/pi-tui/src/__tests__/stdin-buffer.test.ts +27 -0
- package/packages/pi-tui/src/stdin-buffer.ts +26 -0
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +6 -1
- package/pkg/package.json +1 -1
- package/scripts/install.js +512 -0
- package/scripts/lib/workspace-manifest.cjs +86 -0
- package/scripts/link-workspace-packages.cjs +5 -17
- package/scripts/postinstall.js +9 -178
- package/src/resources/extensions/claude-code-cli/readiness.ts +4 -3
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +91 -63
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +114 -12
- package/src/resources/extensions/cmux/index.ts +35 -10
- package/src/resources/extensions/github-sync/templates.ts +151 -0
- package/src/resources/extensions/github-sync/tests/templates.test.ts +59 -0
- package/src/resources/extensions/google-search/extension-manifest.json +5 -4
- package/src/resources/extensions/google-search/index.ts +9 -470
- package/src/resources/extensions/gsd/abandon-detect.ts +62 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +14 -1
- package/src/resources/extensions/gsd/auto/loop.ts +104 -2
- package/src/resources/extensions/gsd/auto/phases.ts +123 -21
- package/src/resources/extensions/gsd/auto/resolve.ts +29 -0
- package/src/resources/extensions/gsd/auto/run-unit.ts +56 -4
- package/src/resources/extensions/gsd/auto/session.ts +28 -1
- package/src/resources/extensions/gsd/auto/turn-epoch.ts +108 -0
- package/src/resources/extensions/gsd/auto/types.ts +1 -1
- package/src/resources/extensions/gsd/auto-dispatch.ts +117 -16
- package/src/resources/extensions/gsd/auto-loop.ts +1 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +1 -1
- package/src/resources/extensions/gsd/auto-post-unit.ts +92 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +28 -1
- package/src/resources/extensions/gsd/auto-recovery.ts +40 -1
- package/src/resources/extensions/gsd/auto-start.ts +48 -52
- package/src/resources/extensions/gsd/auto-timeout-recovery.ts +12 -5
- package/src/resources/extensions/gsd/auto-unit-closeout.ts +14 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +122 -68
- package/src/resources/extensions/gsd/auto.ts +105 -35
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +34 -1
- package/src/resources/extensions/gsd/bootstrap/provider-error-resume.ts +6 -2
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +11 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +18 -6
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +13 -9
- package/src/resources/extensions/gsd/bootstrap/write-gate.ts +35 -2
- package/src/resources/extensions/gsd/clean-root-preflight.ts +111 -0
- package/src/resources/extensions/gsd/commands/handlers/workflow.ts +27 -8
- package/src/resources/extensions/gsd/commands-cmux.ts +10 -6
- package/src/resources/extensions/gsd/commands-extensions.ts +747 -41
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +898 -32
- package/src/resources/extensions/gsd/dispatch-guard.ts +26 -2
- package/src/resources/extensions/gsd/file-lock.ts +84 -11
- package/src/resources/extensions/gsd/git-service.ts +1 -0
- package/src/resources/extensions/gsd/gitignore.ts +2 -1
- package/src/resources/extensions/gsd/gsd-db.ts +92 -32
- package/src/resources/extensions/gsd/guided-flow-queue.ts +4 -1
- package/src/resources/extensions/gsd/guided-flow.ts +259 -10
- package/src/resources/extensions/gsd/health-widget.ts +3 -1
- package/src/resources/extensions/gsd/journal.ts +29 -3
- package/src/resources/extensions/gsd/key-manager.ts +22 -0
- package/src/resources/extensions/gsd/milestone-actions.ts +18 -0
- package/src/resources/extensions/gsd/milestone-summary-classifier.ts +42 -0
- package/src/resources/extensions/gsd/model-router.ts +42 -1
- package/src/resources/extensions/gsd/notifications.ts +27 -15
- package/src/resources/extensions/gsd/pre-execution-checks.ts +33 -7
- package/src/resources/extensions/gsd/preferences-types.ts +8 -0
- package/src/resources/extensions/gsd/prompts/discuss-headless.md +29 -2
- package/src/resources/extensions/gsd/prompts/discuss.md +29 -2
- package/src/resources/extensions/gsd/prompts/doctor-heal.md +5 -4
- package/src/resources/extensions/gsd/prompts/parallel-research-slices.md +5 -2
- package/src/resources/extensions/gsd/prompts/system.md +1 -0
- package/src/resources/extensions/gsd/reports.ts +5 -4
- package/src/resources/extensions/gsd/safety/evidence-collector.ts +119 -0
- package/src/resources/extensions/gsd/safety/file-change-validator.ts +16 -3
- package/src/resources/extensions/gsd/safety/safety-harness.ts +9 -0
- package/src/resources/extensions/gsd/state-transition-matrix.ts +152 -0
- package/src/resources/extensions/gsd/state.ts +35 -30
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +238 -4
- package/src/resources/extensions/gsd/tests/auto-mode-guards.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/auto-paused-session-validation.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +122 -0
- package/src/resources/extensions/gsd/tests/auto-start-bootstrap-await-3420.test.ts +141 -0
- package/src/resources/extensions/gsd/tests/auto-start-clean-runtime-db-gated.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +23 -0
- package/src/resources/extensions/gsd/tests/clean-root-preflight.test.ts +186 -0
- package/src/resources/extensions/gsd/tests/cmux.test.ts +5 -9
- package/src/resources/extensions/gsd/tests/complete-milestone-false-merge.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/complete-milestone.test.ts +61 -1
- 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/custom-engine-loop-integration.test.ts +161 -0
- package/src/resources/extensions/gsd/tests/db-access-guardrails.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +1 -2
- package/src/resources/extensions/gsd/tests/dispatch-complete-milestone-guard.test.ts +14 -9
- package/src/resources/extensions/gsd/tests/dispatch-guard-summary-db-mismatch.test.ts +77 -0
- package/src/resources/extensions/gsd/tests/dispatch-guard.test.ts +25 -0
- package/src/resources/extensions/gsd/tests/dispatch-missing-task-plans.test.ts +14 -0
- package/src/resources/extensions/gsd/tests/doctor-providers.test.ts +31 -0
- package/src/resources/extensions/gsd/tests/double-merge-guard.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/ensure-db-open.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/escalation.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/exec-history.test.ts +113 -0
- package/src/resources/extensions/gsd/tests/execution-entry-missing-context-4671.test.ts +173 -0
- package/src/resources/extensions/gsd/tests/file-change-validator.test.ts +38 -0
- package/src/resources/extensions/gsd/tests/file-lock.test.ts +86 -12
- package/src/resources/extensions/gsd/tests/google-search-stub.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/gsd-db.test.ts +296 -1
- package/src/resources/extensions/gsd/tests/headless-milestone-parity.test.ts +117 -0
- package/src/resources/extensions/gsd/tests/integration/auto-worktree-milestone-merge.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/integration/gitignore-tracked-gsd.test.ts +1 -0
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/integration/worktree-e2e.test.ts +11 -0
- package/src/resources/extensions/gsd/tests/issue-4540-regressions.test.ts +288 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +66 -0
- package/src/resources/extensions/gsd/tests/key-manager.test.ts +2 -0
- package/src/resources/extensions/gsd/tests/mcp-client-security.test.ts +76 -0
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-pressure-stuck-state.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/milestone-status-authoritative.test.ts +3 -3
- package/src/resources/extensions/gsd/tests/milestone-summary-classifier.test.ts +30 -0
- package/src/resources/extensions/gsd/tests/milestone-transition-state-rebuild.test.ts +4 -2
- package/src/resources/extensions/gsd/tests/parallel-commit-scope.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/parallel-research-dispatch.test.ts +19 -0
- package/src/resources/extensions/gsd/tests/parallel-skill-prompt-integration.test.ts +150 -0
- package/src/resources/extensions/gsd/tests/plan-gate-failed-doctor-heal-hint.test.ts +37 -0
- package/src/resources/extensions/gsd/tests/pre-exec-gate-loop.test.ts +272 -0
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +337 -0
- package/src/resources/extensions/gsd/tests/prefs-wizard-coverage.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +39 -25
- package/src/resources/extensions/gsd/tests/queue-auto-guard.test.ts +181 -0
- package/src/resources/extensions/gsd/tests/quick-auto-guard.test.ts +13 -7
- package/src/resources/extensions/gsd/tests/ready-phrase-no-files-4573.test.ts +388 -0
- package/src/resources/extensions/gsd/tests/require-slice-discussion-dispatch.test.ts +170 -0
- package/src/resources/extensions/gsd/tests/restore-tools-after-discuss.test.ts +9 -3
- package/src/resources/extensions/gsd/tests/resume-dispatch-worktree.test.ts +230 -0
- package/src/resources/extensions/gsd/tests/rewrite-docs-abandon-detect.test.ts +195 -0
- package/src/resources/extensions/gsd/tests/safety-harness-false-positives.test.ts +205 -0
- package/src/resources/extensions/gsd/tests/schema-v21-sequence.test.ts +413 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +32 -40
- package/src/resources/extensions/gsd/tests/stale-dirlistcache-4648.test.ts +112 -0
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/state-machine-full-walkthrough.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/state-transition-matrix.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/token-counter.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/tool-compatibility.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/triage-resolution.test.ts +50 -2
- package/src/resources/extensions/gsd/tests/turn-epoch.test.ts +162 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/uok-execution-graph.test.ts +16 -0
- package/src/resources/extensions/gsd/tests/uok-loop-adapter-writer.test.ts +65 -0
- package/src/resources/extensions/gsd/tests/uok-parity-report.test.ts +42 -0
- package/src/resources/extensions/gsd/tests/uok-plan-v2-wiring.test.ts +42 -2
- package/src/resources/extensions/gsd/tests/uok-writer.test.ts +75 -0
- package/src/resources/extensions/gsd/tests/validate-extension-package.test.ts +168 -0
- package/src/resources/extensions/gsd/tests/validate-milestone.test.ts +138 -5
- package/src/resources/extensions/gsd/tests/workflow-mcp.test.ts +25 -2
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +65 -2
- package/src/resources/extensions/gsd/tests/worktree-db.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +6 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +78 -5
- package/src/resources/extensions/gsd/tests/write-gate.test.ts +64 -0
- package/src/resources/extensions/gsd/token-counter.ts +22 -5
- package/src/resources/extensions/gsd/tools/complete-milestone.ts +15 -9
- package/src/resources/extensions/gsd/tools/complete-slice.ts +38 -0
- package/src/resources/extensions/gsd/tools/complete-task.ts +49 -0
- package/src/resources/extensions/gsd/uok/audit.ts +20 -2
- package/src/resources/extensions/gsd/uok/contracts.ts +65 -0
- package/src/resources/extensions/gsd/uok/dispatch-envelope.ts +56 -0
- package/src/resources/extensions/gsd/uok/execution-graph.ts +22 -0
- package/src/resources/extensions/gsd/uok/gitops.ts +6 -1
- package/src/resources/extensions/gsd/uok/loop-adapter.ts +45 -10
- package/src/resources/extensions/gsd/uok/parity-report.ts +84 -0
- package/src/resources/extensions/gsd/uok/plan-v2.ts +39 -8
- package/src/resources/extensions/gsd/uok/writer.ts +113 -0
- package/src/resources/extensions/gsd/workflow-logger.ts +23 -3
- package/src/resources/extensions/gsd/worktree-manager.ts +1 -0
- package/src/resources/extensions/gsd/worktree-resolver.ts +54 -9
- package/src/resources/extensions/mcp-client/auth.ts +12 -1
- package/src/resources/extensions/mcp-client/index.ts +129 -10
- package/src/resources/extensions/shared/cmux-events.ts +59 -0
- package/src/resources/extensions/shared/rtk-session-stats.ts +1 -2
- package/src/resources/skills/create-skill/SKILL.md +2 -2
- package/src/resources/skills/create-skill/references/gsd-skill-ecosystem.md +4 -4
- package/src/resources/skills/create-skill/workflows/audit-skill.md +4 -4
- package/src/resources/skills/create-skill/workflows/create-new-skill.md +5 -5
- package/src/resources/skills/verify-before-complete/SKILL.md +2 -1
- package/src/resources/skills/write-docs/SKILL.md +2 -1
- package/dist/web/standalone/.next/server/chunks/7461.js +0 -1
- package/dist/web/standalone/.next/static/chunks/2826.e59e8578e2e28639.js +0 -9
- /package/dist/web/standalone/.next/static/{n21VtX2hZlkpdEUO_nU4z → vidAVJkURvTJ0_V2-64ro}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{n21VtX2hZlkpdEUO_nU4z → vidAVJkURvTJ0_V2-64ro}/_ssgManifest.js +0 -0
|
@@ -1,379 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Google Search Extension
|
|
3
|
-
*
|
|
4
|
-
* Provides a `google_search` tool that performs web searches via Gemini's
|
|
5
|
-
* Google Search grounding feature. Uses the user's existing GEMINI_API_KEY
|
|
6
|
-
* and Google Cloud GenAI credits.
|
|
7
|
-
*
|
|
8
|
-
* The tool sends queries to Gemini Flash with `googleSearch: {}` enabled.
|
|
9
|
-
* Gemini internally performs Google searches, synthesizes an answer, and
|
|
10
|
-
* returns it with source URLs from grounding metadata.
|
|
11
|
-
*/
|
|
12
|
-
import { DEFAULT_MAX_BYTES, DEFAULT_MAX_LINES, formatSize, truncateHead, } from "@gsd/pi-coding-agent";
|
|
13
|
-
import { Text } from "@gsd/pi-tui";
|
|
14
|
-
import { Type } from "@sinclair/typebox";
|
|
15
|
-
let client = null;
|
|
16
|
-
async function getClient() {
|
|
17
|
-
if (!client) {
|
|
18
|
-
const { GoogleGenAI } = await import("@google/genai");
|
|
19
|
-
client = new GoogleGenAI({ apiKey: process.env.GEMINI_API_KEY });
|
|
20
|
-
}
|
|
21
|
-
return client;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Perform a search using OAuth credentials via the Cloud Code Assist API.
|
|
25
|
-
* This is used as a fallback when GEMINI_API_KEY is not set.
|
|
26
|
-
*/
|
|
27
|
-
async function searchWithOAuth(query, accessToken, projectId, signal) {
|
|
28
|
-
const model = process.env.GEMINI_SEARCH_MODEL || "gemini-2.5-flash";
|
|
29
|
-
const url = `https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent?alt=sse`;
|
|
30
|
-
const GEMINI_CLI_HEADERS = {
|
|
31
|
-
ideType: "IDE_UNSPECIFIED",
|
|
32
|
-
platform: "PLATFORM_UNSPECIFIED",
|
|
33
|
-
pluginType: "GEMINI",
|
|
34
|
-
};
|
|
35
|
-
const executeFetch = async (retries = 3) => {
|
|
36
|
-
const response = await fetch(url, {
|
|
37
|
-
method: "POST",
|
|
38
|
-
headers: {
|
|
39
|
-
Authorization: `Bearer ${accessToken}`,
|
|
40
|
-
"Content-Type": "application/json",
|
|
41
|
-
"User-Agent": "google-cloud-sdk vscode_cloudshelleditor/0.1",
|
|
42
|
-
"X-Goog-Api-Client": "gl-node/22.17.0",
|
|
43
|
-
"Client-Metadata": JSON.stringify(GEMINI_CLI_HEADERS),
|
|
44
|
-
},
|
|
45
|
-
body: JSON.stringify({
|
|
46
|
-
project: projectId,
|
|
47
|
-
model,
|
|
48
|
-
request: {
|
|
49
|
-
contents: [{ parts: [{ text: query }] }],
|
|
50
|
-
tools: [{ googleSearch: {} }],
|
|
51
|
-
},
|
|
52
|
-
userAgent: "pi-coding-agent",
|
|
53
|
-
}),
|
|
54
|
-
signal,
|
|
55
|
-
});
|
|
56
|
-
if (!response.ok && retries > 0 && (response.status === 429 || response.status >= 500)) {
|
|
57
|
-
await new Promise((resolve) => setTimeout(resolve, 1000 * (4 - retries)));
|
|
58
|
-
return executeFetch(retries - 1);
|
|
59
|
-
}
|
|
60
|
-
return response;
|
|
61
|
-
};
|
|
62
|
-
const response = await executeFetch();
|
|
63
|
-
if (!response.ok) {
|
|
64
|
-
const errorText = await response.text();
|
|
65
|
-
throw new Error(`Cloud Code Assist API error (${response.status}): ${errorText}`);
|
|
66
|
-
}
|
|
67
|
-
// Note: streamGenerateContent returns SSE; for now, we consume all chunks.
|
|
68
|
-
// For simplicity and to match the previous structure, we'll read to end.
|
|
69
|
-
const text = await response.text();
|
|
70
|
-
const jsonLines = text.split("\n")
|
|
71
|
-
.filter(l => l.startsWith("data:"))
|
|
72
|
-
.map(l => l.slice(5).trim())
|
|
73
|
-
.filter(l => l.length > 0);
|
|
74
|
-
let data;
|
|
75
|
-
if (jsonLines.length > 0) {
|
|
76
|
-
// Aggregate chunks if needed, but for now we take the last chunk or assume it's one
|
|
77
|
-
data = JSON.parse(jsonLines[jsonLines.length - 1]);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
data = JSON.parse(text);
|
|
81
|
-
}
|
|
82
|
-
const candidate = data.response?.candidates?.[0];
|
|
83
|
-
const answer = candidate?.content?.parts?.find((p) => p.text)?.text ?? "";
|
|
84
|
-
const grounding = candidate?.groundingMetadata;
|
|
85
|
-
const sources = [];
|
|
86
|
-
const seenTitles = new Set();
|
|
87
|
-
if (grounding?.groundingChunks) {
|
|
88
|
-
for (const chunk of grounding.groundingChunks) {
|
|
89
|
-
if (chunk.web) {
|
|
90
|
-
const title = chunk.web.title ?? "Untitled";
|
|
91
|
-
if (seenTitles.has(title))
|
|
92
|
-
continue;
|
|
93
|
-
seenTitles.add(title);
|
|
94
|
-
const domain = chunk.web.domain ?? title;
|
|
95
|
-
sources.push({
|
|
96
|
-
title,
|
|
97
|
-
uri: chunk.web.uri ?? "",
|
|
98
|
-
domain,
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
const searchQueries = grounding?.webSearchQueries ?? [];
|
|
104
|
-
return { answer, sources, searchQueries, cached: false };
|
|
105
|
-
}
|
|
106
|
-
// ── In-session cache ─────────────────────────────────────────────────────────
|
|
107
|
-
const resultCache = new Map();
|
|
108
|
-
function cacheKey(query) {
|
|
109
|
-
return query.toLowerCase().trim();
|
|
110
|
-
}
|
|
111
|
-
// ── Extension ────────────────────────────────────────────────────────────────
|
|
112
1
|
export default function (pi) {
|
|
113
|
-
pi.registerTool({
|
|
114
|
-
name: "google_search",
|
|
115
|
-
label: "Google Search",
|
|
116
|
-
description: "Search the web using Google Search via Gemini. " +
|
|
117
|
-
"Returns an AI-synthesized answer grounded in Google Search results, plus source URLs. " +
|
|
118
|
-
"Use this when you need current information from the web: recent events, documentation, " +
|
|
119
|
-
"product details, technical references, news, etc. " +
|
|
120
|
-
"Requires GEMINI_API_KEY or Google login. Alternative to Brave-based search tools.",
|
|
121
|
-
promptSnippet: "Search the web via Google Search to get current information with sources",
|
|
122
|
-
promptGuidelines: [
|
|
123
|
-
"Use google_search when you need up-to-date web information that isn't in your training data.",
|
|
124
|
-
"Be specific with queries for better results, e.g. 'Next.js 15 app router migration guide' not just 'Next.js'.",
|
|
125
|
-
"The tool returns both an answer and source URLs. Cite sources when sharing results with the user.",
|
|
126
|
-
"Results are cached per-session, so repeated identical queries are free.",
|
|
127
|
-
"You can still use fetch_page to read a specific URL if needed after getting results from google_search.",
|
|
128
|
-
],
|
|
129
|
-
parameters: Type.Object({
|
|
130
|
-
query: Type.String({
|
|
131
|
-
description: "The search query, e.g. 'latest Node.js LTS version' or 'how to configure Tailwind v4'",
|
|
132
|
-
}),
|
|
133
|
-
maxSources: Type.Optional(Type.Number({
|
|
134
|
-
description: "Maximum number of source URLs to include (default 5, max 10).",
|
|
135
|
-
minimum: 1,
|
|
136
|
-
maximum: 10,
|
|
137
|
-
})),
|
|
138
|
-
}),
|
|
139
|
-
async execute(_toolCallId, params, signal, _onUpdate, ctx) {
|
|
140
|
-
const startTime = Date.now();
|
|
141
|
-
const maxSources = Math.min(Math.max(params.maxSources ?? 5, 1), 10);
|
|
142
|
-
// Check for credentials
|
|
143
|
-
let oauthToken;
|
|
144
|
-
let projectId;
|
|
145
|
-
if (!process.env.GEMINI_API_KEY) {
|
|
146
|
-
const oauthRaw = await ctx.modelRegistry.getApiKeyForProvider("google-gemini-cli");
|
|
147
|
-
if (oauthRaw) {
|
|
148
|
-
try {
|
|
149
|
-
const parsed = JSON.parse(oauthRaw);
|
|
150
|
-
oauthToken = parsed.token;
|
|
151
|
-
projectId = parsed.projectId;
|
|
152
|
-
}
|
|
153
|
-
catch {
|
|
154
|
-
// Fall through to error
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
if (!process.env.GEMINI_API_KEY && (!oauthToken || !projectId)) {
|
|
159
|
-
return {
|
|
160
|
-
content: [
|
|
161
|
-
{
|
|
162
|
-
type: "text",
|
|
163
|
-
text: "Error: No authentication found for Google Search. Please set GEMINI_API_KEY or log in via Google.\n\nExample: export GEMINI_API_KEY=your_key or use /login google",
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
isError: true,
|
|
167
|
-
details: {
|
|
168
|
-
query: params.query,
|
|
169
|
-
sourceCount: 0,
|
|
170
|
-
cached: false,
|
|
171
|
-
durationMs: Date.now() - startTime,
|
|
172
|
-
error: "auth_error: No credentials set",
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
// Check cache
|
|
177
|
-
const key = cacheKey(params.query);
|
|
178
|
-
if (resultCache.has(key)) {
|
|
179
|
-
const cached = resultCache.get(key);
|
|
180
|
-
const output = formatOutput(cached, maxSources);
|
|
181
|
-
return {
|
|
182
|
-
content: [{ type: "text", text: output }],
|
|
183
|
-
details: {
|
|
184
|
-
query: params.query,
|
|
185
|
-
sourceCount: cached.sources.length,
|
|
186
|
-
cached: true,
|
|
187
|
-
durationMs: Date.now() - startTime,
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
// Call Gemini with Google Search grounding
|
|
192
|
-
let result;
|
|
193
|
-
try {
|
|
194
|
-
if (process.env.GEMINI_API_KEY) {
|
|
195
|
-
const ai = await getClient();
|
|
196
|
-
// Add a 30-second timeout to prevent hanging (#1100)
|
|
197
|
-
const timeoutController = new AbortController();
|
|
198
|
-
const timeoutId = setTimeout(() => timeoutController.abort(), 30_000);
|
|
199
|
-
const combinedSignal = signal
|
|
200
|
-
? AbortSignal.any([signal, timeoutController.signal])
|
|
201
|
-
: timeoutController.signal;
|
|
202
|
-
let response;
|
|
203
|
-
try {
|
|
204
|
-
response = await ai.models.generateContent({
|
|
205
|
-
model: process.env.GEMINI_SEARCH_MODEL || "gemini-2.5-flash",
|
|
206
|
-
contents: params.query,
|
|
207
|
-
config: {
|
|
208
|
-
tools: [{ googleSearch: {} }],
|
|
209
|
-
abortSignal: combinedSignal,
|
|
210
|
-
},
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
finally {
|
|
214
|
-
clearTimeout(timeoutId);
|
|
215
|
-
}
|
|
216
|
-
// Extract answer text
|
|
217
|
-
const answer = response.text ?? "";
|
|
218
|
-
// Extract grounding metadata
|
|
219
|
-
const candidate = response.candidates?.[0];
|
|
220
|
-
const grounding = candidate?.groundingMetadata;
|
|
221
|
-
// Parse sources from grounding chunks
|
|
222
|
-
const sources = [];
|
|
223
|
-
const seenTitles = new Set();
|
|
224
|
-
if (grounding?.groundingChunks) {
|
|
225
|
-
for (const chunk of grounding.groundingChunks) {
|
|
226
|
-
if (chunk.web) {
|
|
227
|
-
const title = chunk.web.title ?? "Untitled";
|
|
228
|
-
// Dedupe by title since URIs are redirect URLs that differ per call
|
|
229
|
-
if (seenTitles.has(title))
|
|
230
|
-
continue;
|
|
231
|
-
seenTitles.add(title);
|
|
232
|
-
// domain field is not available via Gemini API, use title as fallback
|
|
233
|
-
// (title is typically the domain name, e.g. "wikipedia.org")
|
|
234
|
-
const domain = chunk.web.domain ?? title;
|
|
235
|
-
sources.push({
|
|
236
|
-
title,
|
|
237
|
-
uri: chunk.web.uri ?? "",
|
|
238
|
-
domain,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
// Extract search queries Gemini actually performed
|
|
244
|
-
const searchQueries = grounding?.webSearchQueries ?? [];
|
|
245
|
-
result = { answer, sources, searchQueries, cached: false };
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
result = await searchWithOAuth(params.query, oauthToken, projectId, signal);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
catch (err) {
|
|
252
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
253
|
-
let errorType = "api_error";
|
|
254
|
-
if (msg.includes("401") || msg.includes("UNAUTHENTICATED")) {
|
|
255
|
-
errorType = "auth_error";
|
|
256
|
-
}
|
|
257
|
-
else if (msg.includes("429") || msg.includes("RESOURCE_EXHAUSTED") || msg.includes("quota")) {
|
|
258
|
-
errorType = "rate_limit";
|
|
259
|
-
}
|
|
260
|
-
return {
|
|
261
|
-
content: [
|
|
262
|
-
{
|
|
263
|
-
type: "text",
|
|
264
|
-
text: `Google Search failed (${errorType}): ${msg}`,
|
|
265
|
-
},
|
|
266
|
-
],
|
|
267
|
-
isError: true,
|
|
268
|
-
details: {
|
|
269
|
-
query: params.query,
|
|
270
|
-
sourceCount: 0,
|
|
271
|
-
cached: false,
|
|
272
|
-
durationMs: Date.now() - startTime,
|
|
273
|
-
error: `${errorType}: ${msg}`,
|
|
274
|
-
},
|
|
275
|
-
};
|
|
276
|
-
}
|
|
277
|
-
// Cache the result
|
|
278
|
-
resultCache.set(key, result);
|
|
279
|
-
// Format and truncate output
|
|
280
|
-
const rawOutput = formatOutput(result, maxSources);
|
|
281
|
-
const truncation = truncateHead(rawOutput, {
|
|
282
|
-
maxLines: DEFAULT_MAX_LINES,
|
|
283
|
-
maxBytes: DEFAULT_MAX_BYTES,
|
|
284
|
-
});
|
|
285
|
-
let finalText = truncation.content;
|
|
286
|
-
if (truncation.truncated) {
|
|
287
|
-
finalText +=
|
|
288
|
-
`\n\n[Truncated: showing ${truncation.outputLines}/${truncation.totalLines} lines` +
|
|
289
|
-
` (${formatSize(truncation.outputBytes)} of ${formatSize(truncation.totalBytes)})]`;
|
|
290
|
-
}
|
|
291
|
-
return {
|
|
292
|
-
content: [{ type: "text", text: finalText }],
|
|
293
|
-
details: {
|
|
294
|
-
query: params.query,
|
|
295
|
-
sourceCount: result.sources.length,
|
|
296
|
-
cached: false,
|
|
297
|
-
durationMs: Date.now() - startTime,
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
},
|
|
301
|
-
renderCall(args, theme) {
|
|
302
|
-
let text = theme.fg("toolTitle", theme.bold("google_search "));
|
|
303
|
-
text += theme.fg("accent", `"${args.query}"`);
|
|
304
|
-
return new Text(text, 0, 0);
|
|
305
|
-
},
|
|
306
|
-
renderResult(result, { isPartial, expanded }, theme) {
|
|
307
|
-
const d = result.details;
|
|
308
|
-
if (isPartial)
|
|
309
|
-
return new Text(theme.fg("warning", "Searching Google..."), 0, 0);
|
|
310
|
-
if (result.isError || d?.error) {
|
|
311
|
-
return new Text(theme.fg("error", `Error: ${d?.error ?? "unknown"}`), 0, 0);
|
|
312
|
-
}
|
|
313
|
-
let text = theme.fg("success", `${d?.sourceCount ?? 0} sources`);
|
|
314
|
-
text += theme.fg("dim", ` (${d?.durationMs ?? 0}ms)`);
|
|
315
|
-
if (d?.cached)
|
|
316
|
-
text += theme.fg("dim", " · cached");
|
|
317
|
-
if (expanded) {
|
|
318
|
-
const content = result.content[0];
|
|
319
|
-
if (content?.type === "text") {
|
|
320
|
-
const preview = content.text.split("\n").slice(0, 8).join("\n");
|
|
321
|
-
text += "\n\n" + theme.fg("dim", preview);
|
|
322
|
-
if (content.text.split("\n").length > 8) {
|
|
323
|
-
text += "\n" + theme.fg("muted", "...");
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return new Text(text, 0, 0);
|
|
328
|
-
},
|
|
329
|
-
});
|
|
330
|
-
// ── Session cleanup ─────────────────────────────────────────────────────
|
|
331
|
-
pi.on("session_shutdown", async () => {
|
|
332
|
-
resultCache.clear();
|
|
333
|
-
client = null;
|
|
334
|
-
});
|
|
335
|
-
// ── Startup notification ─────────────────────────────────────────────────
|
|
336
2
|
pi.on("session_start", async (_event, ctx) => {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (!hasOAuth) {
|
|
341
|
-
ctx.ui.notify("Google Search: No authentication set. Log in via Google or set GEMINI_API_KEY to use google_search.", "warning");
|
|
342
|
-
}
|
|
3
|
+
ctx.ui.notify("google_search is being extracted to @gsd-extensions/google-search " +
|
|
4
|
+
"(not yet published to npm). This stub will be replaced once the " +
|
|
5
|
+
"package is available. No action needed for now.", "warning");
|
|
343
6
|
});
|
|
344
7
|
}
|
|
345
|
-
// ── Output formatting ────────────────────────────────────────────────────────
|
|
346
|
-
function formatOutput(result, maxSources) {
|
|
347
|
-
const lines = [];
|
|
348
|
-
// Answer
|
|
349
|
-
if (result.answer) {
|
|
350
|
-
lines.push(result.answer);
|
|
351
|
-
}
|
|
352
|
-
else {
|
|
353
|
-
lines.push("(No answer text returned from search)");
|
|
354
|
-
}
|
|
355
|
-
// Sources
|
|
356
|
-
if (result.sources.length > 0) {
|
|
357
|
-
lines.push("");
|
|
358
|
-
lines.push("Sources:");
|
|
359
|
-
const sourcesToShow = result.sources.slice(0, maxSources);
|
|
360
|
-
for (let i = 0; i < sourcesToShow.length; i++) {
|
|
361
|
-
const s = sourcesToShow[i];
|
|
362
|
-
lines.push(`[${i + 1}] ${s.title} - ${s.domain}`);
|
|
363
|
-
lines.push(` ${s.uri}`);
|
|
364
|
-
}
|
|
365
|
-
if (result.sources.length > maxSources) {
|
|
366
|
-
lines.push(`(${result.sources.length - maxSources} more sources omitted)`);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
lines.push("");
|
|
371
|
-
lines.push("(No source URLs found in grounding metadata)");
|
|
372
|
-
}
|
|
373
|
-
// Search queries
|
|
374
|
-
if (result.searchQueries.length > 0) {
|
|
375
|
-
lines.push("");
|
|
376
|
-
lines.push(`Searches performed: ${result.searchQueries.map((q) => `"${q}"`).join(", ")}`);
|
|
377
|
-
}
|
|
378
|
-
return lines.join("\n");
|
|
379
|
-
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abandon-milestone detection for rewrite-docs overrides (#3490).
|
|
3
|
+
*
|
|
4
|
+
* Isolated from auto-post-unit.ts so behavioral tests can import this module
|
|
5
|
+
* without pulling in the full post-unit handler graph (which transitively
|
|
6
|
+
* loads model-router, workflow engine, etc.).
|
|
7
|
+
*/
|
|
8
|
+
// Detect when a rewrite-docs override is about abandoning THE CURRENT
|
|
9
|
+
// MILESTONE — not just any override containing an abandon verb. Naively
|
|
10
|
+
// matching `/\b(abandon|cancel|drop|...)\b/` against override text produces
|
|
11
|
+
// false positives on scope-change prose ("cancel the standup reminder",
|
|
12
|
+
// "drop the dependency on X", "scrap the v1 design for the landing page").
|
|
13
|
+
//
|
|
14
|
+
// To qualify as an abandon-milestone signal, an override must contain both:
|
|
15
|
+
// 1. An abandon-family verb (abandon|descope|cancel|shelve|drop|scrap)
|
|
16
|
+
// 2. A milestone reference — either the literal word "milestone" or the
|
|
17
|
+
// current milestone ID — in the same override text.
|
|
18
|
+
// Verb variants cover both US and UK inflections:
|
|
19
|
+
// cancel / canceled / canceling / cancelled / cancelling / cancels
|
|
20
|
+
// travel-style "l"-doubling also applies to shelve/drop/scrap.
|
|
21
|
+
// "descope" also accepts "de-scope" and "de scope" (hyphen / space forms).
|
|
22
|
+
const ABANDON_VERB_RE = /\b(abandon(?:ed|ing|s)?|de[-\s]?scope(?:d|s|ing)?|cancel(?:led|ling|ed|ing|s)?|shelve(?:d|s)?|shelving|drop(?:ped|ping|s)?|scrap(?:ped|ping|s)?)\b/i;
|
|
23
|
+
/**
|
|
24
|
+
* Decide whether a set of active overrides indicates the current milestone
|
|
25
|
+
* should be parked. Pure function — no I/O, no imports beyond types.
|
|
26
|
+
*/
|
|
27
|
+
export function detectAbandonMilestone(overrides, currentMilestoneId) {
|
|
28
|
+
if (!currentMilestoneId) {
|
|
29
|
+
return { shouldPark: false, reason: "", matched: [] };
|
|
30
|
+
}
|
|
31
|
+
const escapedId = currentMilestoneId.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
32
|
+
const milestoneRefRe = new RegExp(`\\b(?:milestone|${escapedId})\\b`, "i");
|
|
33
|
+
const matched = overrides
|
|
34
|
+
.filter(o => ABANDON_VERB_RE.test(o.change) && milestoneRefRe.test(o.change))
|
|
35
|
+
.map(o => o.change);
|
|
36
|
+
if (matched.length === 0) {
|
|
37
|
+
return { shouldPark: false, reason: "", matched: [] };
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
shouldPark: true,
|
|
41
|
+
reason: matched.join("; "),
|
|
42
|
+
matched,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -15,10 +15,11 @@ import { isInfrastructureError, isTransientCooldownError, getCooldownRetryAfterM
|
|
|
15
15
|
import { resolveEngine } from "../engine-resolver.js";
|
|
16
16
|
import { logWarning } from "../workflow-logger.js";
|
|
17
17
|
import { gsdRoot } from "../paths.js";
|
|
18
|
+
import { atomicWriteSync } from "../atomic-write.js";
|
|
18
19
|
import { resolveUokFlags } from "../uok/flags.js";
|
|
19
20
|
import { scheduleSidecarQueue } from "../uok/execution-graph.js";
|
|
20
21
|
import { ExecutionGraphScheduler } from "../uok/execution-graph.js";
|
|
21
|
-
import { readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
22
|
+
import { readFileSync, writeFileSync, mkdirSync, unlinkSync } from "node:fs";
|
|
22
23
|
import { join } from "node:path";
|
|
23
24
|
// ── Stuck detection persistence (#3704) ──────────────────────────────────
|
|
24
25
|
// Persist stuck detection state to disk so it survives session restarts.
|
|
@@ -30,6 +31,13 @@ function stuckStatePath(basePath) {
|
|
|
30
31
|
function loadStuckState(basePath) {
|
|
31
32
|
try {
|
|
32
33
|
const data = JSON.parse(readFileSync(stuckStatePath(basePath), "utf-8"));
|
|
34
|
+
// Only load state written by a DIFFERENT process (real session restart).
|
|
35
|
+
// If the PID matches the current process, this state was written by an earlier
|
|
36
|
+
// autoLoop call in the same process (e.g., a test that completed before this
|
|
37
|
+
// one), not by a crashed session — skip it to prevent test state pollution.
|
|
38
|
+
if (data.pid === process.pid) {
|
|
39
|
+
return { recentUnits: [], stuckRecoveryAttempts: 0 };
|
|
40
|
+
}
|
|
33
41
|
return {
|
|
34
42
|
recentUnits: Array.isArray(data.recentUnits) ? data.recentUnits : [],
|
|
35
43
|
stuckRecoveryAttempts: typeof data.stuckRecoveryAttempts === "number" ? data.stuckRecoveryAttempts : 0,
|
|
@@ -45,6 +53,7 @@ function saveStuckState(basePath, state) {
|
|
|
45
53
|
const filePath = stuckStatePath(basePath);
|
|
46
54
|
mkdirSync(join(gsdRoot(basePath), "runtime"), { recursive: true });
|
|
47
55
|
writeFileSync(filePath, JSON.stringify({
|
|
56
|
+
pid: process.pid,
|
|
48
57
|
recentUnits: state.recentUnits.slice(-20), // keep last 20 entries
|
|
49
58
|
stuckRecoveryAttempts: state.stuckRecoveryAttempts,
|
|
50
59
|
updatedAt: new Date().toISOString(),
|
|
@@ -54,12 +63,64 @@ function saveStuckState(basePath, state) {
|
|
|
54
63
|
debugLog("autoLoop", { phase: "save-stuck-state-failed", error: err instanceof Error ? err.message : String(err) });
|
|
55
64
|
}
|
|
56
65
|
}
|
|
66
|
+
// ── Custom workflow verification retry persistence ───────────────────────
|
|
67
|
+
// Custom workflows can request verification retries after a step runs. The
|
|
68
|
+
// retry budget must survive an auto-mode restart or a failing verifier can
|
|
69
|
+
// consume a fresh retry budget every session.
|
|
70
|
+
function customVerifyRetryStateDir(s) {
|
|
71
|
+
return s.activeRunDir ? join(s.activeRunDir, "runtime") : join(gsdRoot(s.basePath), "runtime");
|
|
72
|
+
}
|
|
73
|
+
function customVerifyRetryStatePath(s) {
|
|
74
|
+
return join(customVerifyRetryStateDir(s), "custom-verify-retries.json");
|
|
75
|
+
}
|
|
76
|
+
function hydrateCustomVerifyRetryCounts(s) {
|
|
77
|
+
if (s.verificationRetryCount.size > 0) {
|
|
78
|
+
return s.verificationRetryCount;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const raw = JSON.parse(readFileSync(customVerifyRetryStatePath(s), "utf-8"));
|
|
82
|
+
const counts = raw && typeof raw === "object" && raw.counts && typeof raw.counts === "object"
|
|
83
|
+
? raw.counts
|
|
84
|
+
: {};
|
|
85
|
+
for (const [key, value] of Object.entries(counts)) {
|
|
86
|
+
if (typeof value === "number" && Number.isFinite(value) && value > 0) {
|
|
87
|
+
s.verificationRetryCount.set(key, Math.floor(value));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
debugLog("autoLoop", { phase: "load-custom-verify-retries-failed", error: err instanceof Error ? err.message : String(err) });
|
|
93
|
+
}
|
|
94
|
+
return s.verificationRetryCount;
|
|
95
|
+
}
|
|
96
|
+
function saveCustomVerifyRetryCounts(s) {
|
|
97
|
+
const retryCounts = s.verificationRetryCount;
|
|
98
|
+
const filePath = customVerifyRetryStatePath(s);
|
|
99
|
+
try {
|
|
100
|
+
if (!retryCounts || retryCounts.size === 0) {
|
|
101
|
+
unlinkSync(filePath);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
mkdirSync(customVerifyRetryStateDir(s), { recursive: true });
|
|
105
|
+
atomicWriteSync(filePath, JSON.stringify({
|
|
106
|
+
counts: Object.fromEntries(retryCounts),
|
|
107
|
+
updatedAt: new Date().toISOString(),
|
|
108
|
+
}) + "\n");
|
|
109
|
+
}
|
|
110
|
+
catch (err) {
|
|
111
|
+
const code = err && typeof err === "object" && "code" in err ? err.code : undefined;
|
|
112
|
+
if (code !== "ENOENT") {
|
|
113
|
+
debugLog("autoLoop", { phase: "save-custom-verify-retries-failed", error: err instanceof Error ? err.message : String(err) });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
57
117
|
// ── Memory pressure monitoring (#3331) ──────────────────────────────────
|
|
58
118
|
// Check heap usage every N iterations and trigger graceful shutdown before
|
|
59
119
|
// the OS OOM killer sends SIGKILL. The threshold is 90% of the V8 heap
|
|
60
120
|
// limit (--max-old-space-size or default ~1.5-4GB depending on platform).
|
|
61
121
|
const MEMORY_CHECK_INTERVAL = 5; // check every 5 iterations
|
|
62
122
|
const MEMORY_PRESSURE_THRESHOLD = 0.85; // 85% of heap limit
|
|
123
|
+
const MAX_CUSTOM_ENGINE_VERIFY_RETRIES = 3;
|
|
63
124
|
function checkMemoryPressure() {
|
|
64
125
|
const mem = process.memoryUsage();
|
|
65
126
|
// v8.getHeapStatistics() gives heap_size_limit but requires import
|
|
@@ -352,15 +413,41 @@ export async function autoLoop(ctx, pi, s, deps, options) {
|
|
|
352
413
|
break;
|
|
353
414
|
}
|
|
354
415
|
if (verifyResult === "retry") {
|
|
355
|
-
|
|
416
|
+
const recoveryKey = `${iterData.unitType}/${iterData.unitId}`;
|
|
417
|
+
const retryCounts = hydrateCustomVerifyRetryCounts(s);
|
|
418
|
+
const attempts = (retryCounts.get(recoveryKey) ?? 0) + 1;
|
|
419
|
+
retryCounts.set(recoveryKey, attempts);
|
|
420
|
+
saveCustomVerifyRetryCounts(s);
|
|
421
|
+
debugLog("autoLoop", { phase: "custom-engine-verify-retry", iteration, unitId: iterData.unitId, attempts });
|
|
356
422
|
deps.uokObserver?.onPhaseResult("custom-engine", "retry", {
|
|
357
423
|
unitType: iterData.unitType,
|
|
358
424
|
unitId: iterData.unitId,
|
|
425
|
+
attempts,
|
|
359
426
|
});
|
|
427
|
+
if (attempts > MAX_CUSTOM_ENGINE_VERIFY_RETRIES) {
|
|
428
|
+
const recovery = await policy.recover(iterData.unitType, iterData.unitId, { basePath: s.basePath });
|
|
429
|
+
if (recovery.outcome === "pause") {
|
|
430
|
+
await deps.pauseAuto(ctx, pi);
|
|
431
|
+
finishTurn("paused", "manual-attention", recovery.reason ?? "custom-engine-verify-retry-exhausted");
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
if (recovery.outcome === "skip") {
|
|
435
|
+
await deps.stopAuto(ctx, pi, recovery.reason ??
|
|
436
|
+
`Custom workflow verification for ${iterData.unitId} requested skip after retry exhaustion, but the custom engine cannot reconcile skipped steps.`);
|
|
437
|
+
finishTurn("stopped", "manual-attention", "custom-engine-verify-retry-exhausted");
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
const exhaustedReason = `Custom workflow verification for ${iterData.unitId} requested retry ${attempts} times without passing.`;
|
|
441
|
+
await deps.stopAuto(ctx, pi, recovery.outcome === "stop" && recovery.reason ? recovery.reason : exhaustedReason);
|
|
442
|
+
finishTurn("stopped", "manual-attention", "custom-engine-verify-retry-exhausted");
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
360
445
|
finishTurn("retry");
|
|
361
446
|
continue;
|
|
362
447
|
}
|
|
363
448
|
// Verification passed — mark step complete
|
|
449
|
+
s.verificationRetryCount?.delete(`${iterData.unitType}/${iterData.unitId}`);
|
|
450
|
+
saveCustomVerifyRetryCounts(s);
|
|
364
451
|
debugLog("autoLoop", { phase: "custom-engine-reconcile", iteration, unitId: iterData.unitId });
|
|
365
452
|
const reconcileResult = await engine.reconcile(engineState, {
|
|
366
453
|
unitType: iterData.unitType,
|
|
@@ -497,6 +584,7 @@ export async function autoLoop(ctx, pi, s, deps, options) {
|
|
|
497
584
|
consecutiveCooldowns = 0;
|
|
498
585
|
recentErrorMessages.length = 0;
|
|
499
586
|
deps.emitJournalEvent({ ts: new Date().toISOString(), flowId, seq: nextSeq(), eventType: "iteration-end", data: { iteration } });
|
|
587
|
+
saveStuckState(s.basePath, loopState); // persist across session restarts (#4382)
|
|
500
588
|
debugLog("autoLoop", { phase: "iteration-complete", iteration });
|
|
501
589
|
finishTurn("completed");
|
|
502
590
|
}
|