gsd-pi 2.75.0 → 2.76.0
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 +186 -149
- package/dist/claude-cli-check.d.ts +10 -0
- package/dist/claude-cli-check.js +13 -3
- package/dist/headless-events.d.ts +1 -1
- package/dist/headless-events.js +5 -2
- package/dist/headless.js +5 -6
- package/dist/onboarding.d.ts +20 -1
- package/dist/onboarding.js +99 -39
- package/dist/resources/extensions/ask-user-questions.js +17 -5
- package/dist/resources/extensions/claude-code-cli/models.js +9 -0
- package/dist/resources/extensions/claude-code-cli/readiness.js +12 -2
- package/dist/resources/extensions/claude-code-cli/stream-adapter.js +76 -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 +72 -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-artifact-paths.js +20 -0
- package/dist/resources/extensions/gsd/auto-dashboard.js +37 -8
- package/dist/resources/extensions/gsd/auto-direct-dispatch.js +8 -2
- package/dist/resources/extensions/gsd/auto-dispatch.js +120 -14
- package/dist/resources/extensions/gsd/auto-loop.js +1 -1
- package/dist/resources/extensions/gsd/auto-model-selection.js +14 -4
- package/dist/resources/extensions/gsd/auto-post-unit.js +10 -8
- package/dist/resources/extensions/gsd/auto-prompts.js +190 -46
- package/dist/resources/extensions/gsd/auto-recovery.js +57 -0
- package/dist/resources/extensions/gsd/auto-start.js +5 -3
- package/dist/resources/extensions/gsd/auto-verification.js +3 -3
- package/dist/resources/extensions/gsd/auto-worktree.js +71 -2
- package/dist/resources/extensions/gsd/auto.js +57 -25
- package/dist/resources/extensions/gsd/bootstrap/agent-end-recovery.js +8 -21
- package/dist/resources/extensions/gsd/bootstrap/db-tools.js +45 -23
- package/dist/resources/extensions/gsd/bootstrap/memory-tools.js +128 -0
- package/dist/resources/extensions/gsd/bootstrap/query-tools.js +29 -0
- package/dist/resources/extensions/gsd/bootstrap/register-extension.js +2 -0
- package/dist/resources/extensions/gsd/bootstrap/register-hooks.js +22 -0
- package/dist/resources/extensions/gsd/bootstrap/system-context.js +17 -4
- package/dist/resources/extensions/gsd/commands/catalog.js +81 -9
- package/dist/resources/extensions/gsd/commands/handlers/core.js +64 -24
- package/dist/resources/extensions/gsd/commands/handlers/escalate.js +171 -0
- package/dist/resources/extensions/gsd/commands/handlers/onboarding.js +159 -0
- package/dist/resources/extensions/gsd/commands/handlers/ops.js +21 -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-config.js +5 -0
- 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-extract-learnings.js +233 -75
- package/dist/resources/extensions/gsd/commands-handlers.js +21 -2
- package/dist/resources/extensions/gsd/commands-memory.js +462 -0
- package/dist/resources/extensions/gsd/commands-prefs-wizard.js +40 -12
- 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/custom-workflow-engine.js +74 -54
- package/dist/resources/extensions/gsd/db-writer.js +1 -0
- 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 +9 -9
- package/dist/resources/extensions/gsd/doctor-environment.js +2 -1
- package/dist/resources/extensions/gsd/doctor-git-checks.js +27 -3
- package/dist/resources/extensions/gsd/doctor-proactive.js +4 -1
- package/dist/resources/extensions/gsd/doctor-providers.js +48 -20
- package/dist/resources/extensions/gsd/doctor-runtime-checks.js +22 -4
- package/dist/resources/extensions/gsd/doctor.js +7 -1
- package/dist/resources/extensions/gsd/error-classifier.js +6 -3
- package/dist/resources/extensions/gsd/escalation.js +321 -0
- 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 +26 -2
- package/dist/resources/extensions/gsd/gsd-db.js +490 -32
- package/dist/resources/extensions/gsd/health-widget-core.js +42 -14
- package/dist/resources/extensions/gsd/health-widget.js +7 -4
- package/dist/resources/extensions/gsd/init-wizard.js +86 -45
- package/dist/resources/extensions/gsd/markdown-renderer.js +5 -5
- package/dist/resources/extensions/gsd/memory-embeddings.js +219 -0
- package/dist/resources/extensions/gsd/memory-extractor.js +78 -27
- package/dist/resources/extensions/gsd/memory-ingest.js +218 -0
- package/dist/resources/extensions/gsd/memory-relations.js +189 -0
- package/dist/resources/extensions/gsd/memory-source-store.js +113 -0
- package/dist/resources/extensions/gsd/memory-store.js +299 -6
- package/dist/resources/extensions/gsd/metrics.js +1 -0
- package/dist/resources/extensions/gsd/model-cost-table.js +3 -1
- package/dist/resources/extensions/gsd/model-router.js +16 -6
- package/dist/resources/extensions/gsd/native-git-bridge.js +137 -5
- package/dist/resources/extensions/gsd/notification-overlay.js +7 -22
- package/dist/resources/extensions/gsd/notification-widget.js +24 -39
- package/dist/resources/extensions/gsd/notifications.js +4 -0
- package/dist/resources/extensions/gsd/onboarding-state.js +133 -0
- package/dist/resources/extensions/gsd/post-execution-checks.js +27 -11
- package/dist/resources/extensions/gsd/pre-execution-checks.js +105 -8
- package/dist/resources/extensions/gsd/preferences-models.js +1 -0
- package/dist/resources/extensions/gsd/preferences-types.js +2 -1
- package/dist/resources/extensions/gsd/preferences-validation.js +42 -8
- package/dist/resources/extensions/gsd/preferences.js +10 -10
- package/dist/resources/extensions/gsd/prompts/add-tests.md +1 -0
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
- 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/execute-task.md +13 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/dist/resources/extensions/gsd/prompts/refine-slice.md +69 -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/python-resolver.js +70 -0
- package/dist/resources/extensions/gsd/run-manager.js +37 -17
- package/dist/resources/extensions/gsd/setup-catalog.js +75 -0
- package/dist/resources/extensions/gsd/state.js +47 -3
- package/dist/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
- package/dist/resources/extensions/gsd/tools/complete-task.js +80 -0
- package/dist/resources/extensions/gsd/tools/memory-tools.js +306 -0
- package/dist/resources/extensions/gsd/tools/plan-milestone.js +37 -12
- package/dist/resources/extensions/gsd/tools/plan-slice.js +5 -2
- package/dist/resources/extensions/gsd/tools/skip-slice.js +78 -0
- package/dist/resources/extensions/gsd/tools/workflow-tool-executors.js +14 -0
- package/dist/resources/extensions/gsd/uok/flags.js +7 -7
- package/dist/resources/extensions/gsd/uok/kernel.js +8 -3
- package/dist/resources/extensions/gsd/verification-gate.js +2 -1
- 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-manifest.js +8 -0
- package/dist/resources/extensions/gsd/workflow-mcp.js +1 -6
- package/dist/resources/extensions/gsd/workflow-plugins.js +346 -0
- package/dist/resources/extensions/gsd/workflow-projections.js +17 -15
- 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/gsd/worktree-resolver.js +42 -1
- package/dist/resources/extensions/remote-questions/commands.js +380 -0
- package/dist/resources/extensions/remote-questions/manager.js +39 -5
- package/dist/resources/extensions/remote-questions/telegram-adapter.js +79 -4
- package/dist/resources/extensions/search-the-web/command-search-provider.js +4 -1
- package/dist/resources/extensions/search-the-web/native-search.js +13 -2
- 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 +13 -13
- package/dist/web/standalone/.next/build-manifest.json +3 -3
- package/dist/web/standalone/.next/react-loadable-manifest.json +2 -2
- package/dist/web/standalone/.next/required-server-files.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/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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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/update/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.js +1 -1
- package/dist/web/standalone/.next/server/app/api/visualizer/route.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 +3 -3
- package/dist/web/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dist/web/standalone/.next/server/app/index.segments/_full.segment.rsc +3 -3
- 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 +13 -13
- package/dist/web/standalone/.next/server/chunks/6897.js +2 -2
- package/dist/web/standalone/.next/server/chunks/7461.js +1 -0
- package/dist/web/standalone/.next/server/middleware-build-manifest.js +1 -1
- package/dist/web/standalone/.next/server/middleware-manifest.json +1 -1
- package/dist/web/standalone/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/dist/web/standalone/.next/server/pages/404.html +1 -1
- package/dist/web/standalone/.next/server/pages/500.html +1 -1
- package/dist/web/standalone/.next/static/chunks/2826.e59e8578e2e28639.js +9 -0
- package/dist/web/standalone/.next/static/chunks/{2008.71ee9230ad78df21.js → 3621.fc7480022c972438.js} +2 -2
- package/dist/web/standalone/.next/static/chunks/app/{page-7115e62689b5fd84.js → page-151349214571e2b6.js} +1 -1
- package/dist/web/standalone/.next/static/chunks/{webpack-b868033a5834586d.js → webpack-5fc74f13a25fa1bb.js} +1 -1
- package/dist/web/standalone/.next/static/css/632cd626b1731d88.css +1 -0
- package/dist/web/standalone/server.js +1 -1
- package/dist/welcome-screen.js +48 -24
- 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/daemon/package.json +2 -2
- package/packages/mcp-server/dist/server.d.ts.map +1 -1
- package/packages/mcp-server/dist/server.js +12 -10
- package/packages/mcp-server/dist/server.js.map +1 -1
- package/packages/mcp-server/dist/session-manager.d.ts.map +1 -1
- package/packages/mcp-server/dist/session-manager.js +8 -1
- package/packages/mcp-server/dist/session-manager.js.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.d.ts +1 -0
- package/packages/mcp-server/dist/workflow-tools.d.ts.map +1 -1
- package/packages/mcp-server/dist/workflow-tools.js +207 -71
- package/packages/mcp-server/dist/workflow-tools.js.map +1 -1
- package/packages/mcp-server/package.json +2 -2
- package/packages/mcp-server/src/mcp-server.test.ts +40 -4
- package/packages/mcp-server/src/server.ts +12 -10
- package/packages/mcp-server/src/session-manager.ts +10 -3
- package/packages/mcp-server/src/workflow-tools.test.ts +346 -1
- package/packages/mcp-server/src/workflow-tools.ts +228 -75
- package/packages/mcp-server/tsconfig.tsbuildinfo +1 -1
- package/packages/native/package.json +1 -1
- package/packages/native/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-agent-core/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-ai/dist/index.d.ts +1 -0
- package/packages/pi-ai/dist/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/index.js +1 -0
- package/packages/pi-ai/dist/index.js.map +1 -1
- package/packages/pi-ai/dist/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 +136 -153
- package/packages/pi-ai/dist/models/generated/index.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.d.ts.map +1 -1
- package/packages/pi-ai/dist/models/generated/openai-codex.js +17 -0
- package/packages/pi-ai/dist/models/generated/openai-codex.js.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 +17 -0
- package/packages/pi-ai/dist/models.generated.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts +22 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.js +40 -6
- package/packages/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.js +106 -0
- package/packages/pi-ai/dist/providers/amazon-bedrock.test.js.map +1 -0
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js +42 -1
- package/packages/pi-ai/dist/providers/anthropic-auth.test.js.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts +20 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic-shared.js +32 -2
- 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/dist/providers/anthropic.d.ts +11 -0
- package/packages/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/packages/pi-ai/dist/providers/anthropic.js +18 -1
- package/packages/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/packages/pi-ai/dist/providers/api-family.d.ts +27 -0
- package/packages/pi-ai/dist/providers/api-family.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/api-family.js +47 -0
- package/packages/pi-ai/dist/providers/api-family.js.map +1 -0
- package/packages/pi-ai/dist/providers/api-family.test.d.ts +2 -0
- package/packages/pi-ai/dist/providers/api-family.test.d.ts.map +1 -0
- package/packages/pi-ai/dist/providers/api-family.test.js +101 -0
- package/packages/pi-ai/dist/providers/api-family.test.js.map +1 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js +12 -0
- package/packages/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
- package/packages/pi-ai/package.json +2 -2
- package/packages/pi-ai/scripts/generate-models.ts +50 -0
- package/packages/pi-ai/src/index.ts +1 -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/openai-codex.ts +17 -0
- package/packages/pi-ai/src/models/generated/openrouter.ts +17 -0
- package/packages/pi-ai/src/models.generated.test.ts +17 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.test.ts +164 -0
- package/packages/pi-ai/src/providers/amazon-bedrock.ts +41 -7
- package/packages/pi-ai/src/providers/anthropic-auth.test.ts +47 -1
- package/packages/pi-ai/src/providers/anthropic-shared.test.ts +15 -1
- package/packages/pi-ai/src/providers/anthropic-shared.ts +36 -3
- package/packages/pi-ai/src/providers/anthropic.ts +19 -1
- package/packages/pi-ai/src/providers/api-family.test.ts +129 -0
- package/packages/pi-ai/src/providers/api-family.ts +57 -0
- package/packages/pi-ai/src/utils/oauth/openai-codex.ts +15 -0
- package/packages/pi-ai/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-coding-agent/dist/cli/args.d.ts +6 -0
- package/packages/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/cli/args.js +14 -4
- package/packages/pi-coding-agent/dist/cli/args.js.map +1 -1
- package/packages/pi-coding-agent/dist/cli/args.test.d.ts +2 -0
- package/packages/pi-coding-agent/dist/cli/args.test.d.ts.map +1 -0
- package/packages/pi-coding-agent/dist/cli/args.test.js +38 -0
- package/packages/pi-coding-agent/dist/cli/args.test.js.map +1 -0
- 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 +14 -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 +34 -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 +74 -0
- package/packages/pi-coding-agent/dist/core/auth-storage.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js +4 -1
- package/packages/pi-coding-agent/dist/core/chat-controller-ordering.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -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 +2 -1
- 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/model-registry-auth-mode.test.js +32 -0
- package/packages/pi-coding-agent/dist/core/model-registry-auth-mode.test.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js +4 -1
- package/packages/pi-coding-agent/dist/core/retry-handler.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.d.ts +10 -0
- package/packages/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/sdk.js +39 -1
- 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/main.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/main.js +3 -0
- package/packages/pi-coding-agent/dist/main.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.js +17 -7
- package/packages/pi-coding-agent/dist/modes/interactive/components/chat-frame.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 +48 -34
- package/packages/pi-coding-agent/dist/modes/interactive/components/footer.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts +4 -0
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js +83 -33
- package/packages/pi-coding-agent/dist/modes/interactive/controllers/chat-controller.js.map +1 -1
- package/packages/pi-coding-agent/dist/modes/interactive/theme/theme-schema.d.ts +70 -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 +77 -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 +1 -66
- 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 +192 -24
- package/packages/pi-coding-agent/dist/modes/interactive/theme/themes.js.map +1 -1
- package/packages/pi-coding-agent/package.json +1 -1
- package/packages/pi-coding-agent/src/cli/args.test.ts +44 -0
- package/packages/pi-coding-agent/src/cli/args.ts +21 -6
- 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 +83 -0
- package/packages/pi-coding-agent/src/core/auth-storage.ts +35 -0
- package/packages/pi-coding-agent/src/core/chat-controller-ordering.test.ts +4 -1
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +4 -1
- package/packages/pi-coding-agent/src/core/extensions/types.ts +2 -2
- package/packages/pi-coding-agent/src/core/model-registry-auth-mode.test.ts +37 -1
- package/packages/pi-coding-agent/src/core/retry-handler.ts +4 -1
- package/packages/pi-coding-agent/src/core/sdk.ts +58 -1
- package/packages/pi-coding-agent/src/core/skill-tool.test.ts +2 -2
- package/packages/pi-coding-agent/src/main.ts +4 -0
- package/packages/pi-coding-agent/src/modes/interactive/components/chat-frame.ts +19 -7
- package/packages/pi-coding-agent/src/modes/interactive/components/footer.ts +53 -31
- package/packages/pi-coding-agent/src/modes/interactive/controllers/chat-controller.ts +88 -36
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme-schema.ts +83 -0
- package/packages/pi-coding-agent/src/modes/interactive/theme/theme.ts +2 -83
- package/packages/pi-coding-agent/src/modes/interactive/theme/themes.ts +208 -27
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/pi-tui/tsconfig.tsbuildinfo +1 -1
- package/packages/rpc-client/package.json +1 -1
- package/packages/rpc-client/tsconfig.tsbuildinfo +1 -1
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts +70 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js +77 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.js.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts +1 -66
- 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 +192 -24
- package/pkg/dist/modes/interactive/theme/themes.js.map +1 -1
- package/pkg/package.json +1 -1
- package/src/resources/extensions/ask-user-questions.ts +24 -6
- package/src/resources/extensions/claude-code-cli/models.ts +9 -0
- package/src/resources/extensions/claude-code-cli/readiness.ts +13 -2
- package/src/resources/extensions/claude-code-cli/stream-adapter.ts +94 -4
- package/src/resources/extensions/claude-code-cli/tests/stream-adapter.test.ts +84 -0
- package/src/resources/extensions/gsd/auto/detect-stuck.ts +10 -0
- package/src/resources/extensions/gsd/auto/loop-deps.ts +2 -9
- package/src/resources/extensions/gsd/auto/loop.ts +109 -3
- package/src/resources/extensions/gsd/auto/phases.ts +97 -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-artifact-paths.ts +20 -0
- package/src/resources/extensions/gsd/auto-dashboard.ts +46 -5
- package/src/resources/extensions/gsd/auto-direct-dispatch.ts +15 -2
- package/src/resources/extensions/gsd/auto-dispatch.ts +141 -9
- package/src/resources/extensions/gsd/auto-loop.ts +1 -1
- package/src/resources/extensions/gsd/auto-model-selection.ts +17 -4
- package/src/resources/extensions/gsd/auto-post-unit.ts +10 -8
- package/src/resources/extensions/gsd/auto-prompts.ts +232 -47
- package/src/resources/extensions/gsd/auto-recovery.ts +63 -1
- package/src/resources/extensions/gsd/auto-start.ts +8 -6
- package/src/resources/extensions/gsd/auto-verification.ts +3 -3
- package/src/resources/extensions/gsd/auto-worktree.ts +81 -1
- package/src/resources/extensions/gsd/auto.ts +61 -28
- package/src/resources/extensions/gsd/bootstrap/agent-end-recovery.ts +8 -21
- package/src/resources/extensions/gsd/bootstrap/db-tools.ts +46 -24
- package/src/resources/extensions/gsd/bootstrap/memory-tools.ts +158 -0
- package/src/resources/extensions/gsd/bootstrap/query-tools.ts +31 -0
- package/src/resources/extensions/gsd/bootstrap/register-extension.ts +2 -0
- package/src/resources/extensions/gsd/bootstrap/register-hooks.ts +22 -0
- package/src/resources/extensions/gsd/bootstrap/system-context.ts +20 -4
- package/src/resources/extensions/gsd/commands/catalog.ts +74 -9
- package/src/resources/extensions/gsd/commands/handlers/core.ts +69 -27
- package/src/resources/extensions/gsd/commands/handlers/escalate.ts +216 -0
- package/src/resources/extensions/gsd/commands/handlers/onboarding.ts +196 -0
- package/src/resources/extensions/gsd/commands/handlers/ops.ts +21 -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-config.ts +10 -0
- 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-extract-learnings.ts +295 -76
- package/src/resources/extensions/gsd/commands-handlers.ts +19 -2
- package/src/resources/extensions/gsd/commands-memory.ts +551 -0
- package/src/resources/extensions/gsd/commands-prefs-wizard.ts +49 -12
- 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/custom-workflow-engine.ts +85 -60
- package/src/resources/extensions/gsd/db-writer.ts +3 -0
- 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 +9 -9
- package/src/resources/extensions/gsd/doctor-environment.ts +2 -1
- package/src/resources/extensions/gsd/doctor-git-checks.ts +28 -3
- package/src/resources/extensions/gsd/doctor-proactive.ts +4 -1
- package/src/resources/extensions/gsd/doctor-providers.ts +52 -22
- package/src/resources/extensions/gsd/doctor-runtime-checks.ts +23 -4
- package/src/resources/extensions/gsd/doctor-types.ts +1 -0
- package/src/resources/extensions/gsd/doctor.ts +7 -1
- package/src/resources/extensions/gsd/error-classifier.ts +6 -3
- package/src/resources/extensions/gsd/escalation.ts +367 -0
- 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 +33 -3
- package/src/resources/extensions/gsd/gsd-db.ts +578 -32
- package/src/resources/extensions/gsd/health-widget-core.ts +43 -14
- package/src/resources/extensions/gsd/health-widget.ts +7 -3
- package/src/resources/extensions/gsd/init-wizard.ts +87 -54
- package/src/resources/extensions/gsd/markdown-renderer.ts +5 -5
- package/src/resources/extensions/gsd/memory-embeddings.ts +235 -0
- package/src/resources/extensions/gsd/memory-extractor.ts +100 -34
- package/src/resources/extensions/gsd/memory-ingest.ts +286 -0
- package/src/resources/extensions/gsd/memory-relations.ts +240 -0
- package/src/resources/extensions/gsd/memory-source-store.ts +138 -0
- package/src/resources/extensions/gsd/memory-store.ts +351 -7
- package/src/resources/extensions/gsd/metrics.ts +1 -0
- package/src/resources/extensions/gsd/model-cost-table.ts +3 -1
- package/src/resources/extensions/gsd/model-router.ts +25 -6
- package/src/resources/extensions/gsd/native-git-bridge.ts +134 -6
- package/src/resources/extensions/gsd/notification-overlay.ts +9 -19
- package/src/resources/extensions/gsd/notification-widget.ts +25 -43
- package/src/resources/extensions/gsd/notifications.ts +6 -0
- package/src/resources/extensions/gsd/onboarding-state.ts +146 -0
- package/src/resources/extensions/gsd/post-execution-checks.ts +37 -14
- package/src/resources/extensions/gsd/pre-execution-checks.ts +106 -12
- package/src/resources/extensions/gsd/preferences-models.ts +1 -0
- package/src/resources/extensions/gsd/preferences-types.ts +10 -2
- package/src/resources/extensions/gsd/preferences-validation.ts +33 -7
- package/src/resources/extensions/gsd/preferences.ts +10 -10
- package/src/resources/extensions/gsd/prompts/add-tests.md +1 -0
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +4 -1
- 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/execute-task.md +13 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +12 -0
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -0
- package/src/resources/extensions/gsd/prompts/refine-slice.md +69 -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/python-resolver.ts +76 -0
- package/src/resources/extensions/gsd/run-manager.ts +53 -19
- package/src/resources/extensions/gsd/setup-catalog.ts +105 -0
- package/src/resources/extensions/gsd/state.ts +50 -2
- package/src/resources/extensions/gsd/templates/PREFERENCES.md +7 -7
- package/src/resources/extensions/gsd/tests/agent-end-retry.test.ts +1 -34
- package/src/resources/extensions/gsd/tests/artifact-corruption-2630.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/auto-dashboard.test.ts +49 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +45 -31
- package/src/resources/extensions/gsd/tests/auto-migrating-recovery.test.ts +63 -0
- package/src/resources/extensions/gsd/tests/auto-model-selection.test.ts +12 -0
- package/src/resources/extensions/gsd/tests/auto-prompts-fallback.test.ts +35 -0
- package/src/resources/extensions/gsd/tests/auto-recovery.test.ts +123 -1
- package/src/resources/extensions/gsd/tests/auto-wrapup-inflight-guard.test.ts +39 -0
- 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-extract-learnings.test.ts +333 -21
- 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/complete-slice.test.ts +6 -8
- package/src/resources/extensions/gsd/tests/complete-task.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/custom-workflow-engine.test.ts +63 -0
- 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/enhanced-verification-integration.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/escalation.test.ts +818 -0
- package/src/resources/extensions/gsd/tests/finalize-timeout-guard.test.ts +29 -12
- package/src/resources/extensions/gsd/tests/flat-rate-routing-guard.test.ts +106 -0
- 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/gsd-db.test.ts +44 -1
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +8 -2
- package/src/resources/extensions/gsd/tests/init-prefs-routing.test.ts +190 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git-symlink-cwd.test.ts +79 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-git.test.ts +39 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-proactive.test.ts +44 -0
- package/src/resources/extensions/gsd/tests/integration/doctor-runtime.test.ts +68 -1
- package/src/resources/extensions/gsd/tests/integration/git-service.test.ts +109 -11
- package/src/resources/extensions/gsd/tests/integration/idle-recovery.test.ts +51 -0
- package/src/resources/extensions/gsd/tests/integration/integration-proof.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/integration/test-isolation.ts +53 -0
- package/src/resources/extensions/gsd/tests/journal-integration.test.ts +171 -1
- package/src/resources/extensions/gsd/tests/md-importer.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/memory-embeddings.test.ts +213 -0
- package/src/resources/extensions/gsd/tests/memory-ingest.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/memory-maintenance.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/memory-relations.test.ts +175 -0
- package/src/resources/extensions/gsd/tests/memory-store.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/memory-tools.test.ts +295 -0
- package/src/resources/extensions/gsd/tests/milestone-status-tool.test.ts +3 -2
- package/src/resources/extensions/gsd/tests/model-cost-table.test.ts +2 -2
- package/src/resources/extensions/gsd/tests/model-router.test.ts +51 -1
- package/src/resources/extensions/gsd/tests/model-unittype-mapping.test.ts +59 -0
- package/src/resources/extensions/gsd/tests/notification-overlay.test.ts +56 -37
- package/src/resources/extensions/gsd/tests/notification-widget.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/onboarding-state.test.ts +105 -0
- package/src/resources/extensions/gsd/tests/plan-milestone-boundary-map-preservation.test.ts +114 -0
- package/src/resources/extensions/gsd/tests/plan-milestone.test.ts +4 -5
- package/src/resources/extensions/gsd/tests/plan-slice.test.ts +17 -0
- package/src/resources/extensions/gsd/tests/post-execution-checks.test.ts +105 -1
- package/src/resources/extensions/gsd/tests/pre-execution-checks.test.ts +341 -6
- package/src/resources/extensions/gsd/tests/preferences.test.ts +69 -1
- package/src/resources/extensions/gsd/tests/progressive-planning.test.ts +539 -0
- package/src/resources/extensions/gsd/tests/projection-no-plan-overwrite.test.ts +11 -2
- package/src/resources/extensions/gsd/tests/projection-regression.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/prompt-budget-enforcement.test.ts +159 -8
- package/src/resources/extensions/gsd/tests/prompt-contracts.test.ts +24 -0
- package/src/resources/extensions/gsd/tests/prompt-db.test.ts +1 -1
- package/src/resources/extensions/gsd/tests/prompts-no-gitignored-test-refs.test.ts +56 -0
- package/src/resources/extensions/gsd/tests/provider-errors.test.ts +33 -0
- package/src/resources/extensions/gsd/tests/python-resolver.test.ts +131 -0
- package/src/resources/extensions/gsd/tests/register-hooks-depth-verification.test.ts +67 -0
- package/src/resources/extensions/gsd/tests/remote-notification-from-desktop.test.ts +107 -0
- package/src/resources/extensions/gsd/tests/requirements.test.ts +9 -0
- package/src/resources/extensions/gsd/tests/session-start-footer.test.ts +153 -0
- package/src/resources/extensions/gsd/tests/skip-slice-cascades-tasks.test.ts +125 -0
- package/src/resources/extensions/gsd/tests/slice-context-injection.test.ts +16 -4
- package/src/resources/extensions/gsd/tests/stash-queued-context-files.test.ts +54 -0
- package/src/resources/extensions/gsd/tests/state-corruption-2945.test.ts +3 -0
- package/src/resources/extensions/gsd/tests/stuck-detection-coverage.test.ts +15 -0
- package/src/resources/extensions/gsd/tests/summary-render-parity.test.ts +5 -0
- package/src/resources/extensions/gsd/tests/uok-contracts.test.ts +2 -1
- 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/verification-gate.test.ts +35 -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-projections.test.ts +7 -0
- package/src/resources/extensions/gsd/tests/workflow-templates.test.ts +8 -2
- package/src/resources/extensions/gsd/tests/workflow-tool-executors.test.ts +97 -0
- package/src/resources/extensions/gsd/tests/worktree-journal-events.test.ts +2 -1
- package/src/resources/extensions/gsd/tests/worktree-resolver.test.ts +77 -2
- package/src/resources/extensions/gsd/tools/complete-task.ts +87 -0
- package/src/resources/extensions/gsd/tools/memory-tools.ts +380 -0
- package/src/resources/extensions/gsd/tools/plan-milestone.ts +42 -8
- package/src/resources/extensions/gsd/tools/plan-slice.ts +6 -1
- package/src/resources/extensions/gsd/tools/skip-slice.ts +133 -0
- package/src/resources/extensions/gsd/tools/workflow-tool-executors.ts +14 -0
- package/src/resources/extensions/gsd/types.ts +62 -0
- package/src/resources/extensions/gsd/unit-runtime.ts +1 -0
- package/src/resources/extensions/gsd/uok/contracts.ts +2 -1
- package/src/resources/extensions/gsd/uok/flags.ts +7 -7
- package/src/resources/extensions/gsd/uok/kernel.ts +16 -4
- package/src/resources/extensions/gsd/verification-gate.ts +2 -1
- 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-logger.ts +3 -1
- package/src/resources/extensions/gsd/workflow-manifest.ts +8 -0
- package/src/resources/extensions/gsd/workflow-mcp.ts +1 -6
- package/src/resources/extensions/gsd/workflow-plugins.ts +403 -0
- package/src/resources/extensions/gsd/workflow-projections.ts +18 -16
- 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/gsd/worktree-resolver.ts +47 -1
- package/src/resources/extensions/remote-questions/commands.ts +480 -0
- package/src/resources/extensions/remote-questions/manager.ts +49 -4
- 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/remote-answer-normalization.test.ts +92 -0
- package/src/resources/extensions/remote-questions/tests/telegram-commands.test.ts +267 -0
- package/src/resources/extensions/search-the-web/command-search-provider.ts +4 -1
- package/src/resources/extensions/search-the-web/native-search.ts +13 -3
- 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/{prkokVQFxWtUVIku57_0z → ssX7BLv3Dw9Fb4CtrCGeR}/_buildManifest.js +0 -0
- /package/dist/web/standalone/.next/static/{prkokVQFxWtUVIku57_0z → ssX7BLv3Dw9Fb4CtrCGeR}/_ssgManifest.js +0 -0
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Storage layer for auto-learned project memories. Follows context-store.ts patterns.
|
|
4
4
|
// All functions degrade gracefully: return empty results when DB unavailable, never throw.
|
|
5
|
-
import { isDbAvailable, _getAdapter, transaction, insertMemoryRow, rewriteMemoryId, updateMemoryContentRow, incrementMemoryHitCount, supersedeMemoryRow, markMemoryUnitProcessed, decayMemoriesBefore, supersedeLowestRankedMemories, } from './gsd-db.js';
|
|
5
|
+
import { isDbAvailable, _getAdapter, transaction, insertMemoryRow, rewriteMemoryId, updateMemoryContentRow, incrementMemoryHitCount, supersedeMemoryRow, markMemoryUnitProcessed, decayMemoriesBefore, supersedeLowestRankedMemories, deleteMemoryEmbedding, deleteMemoryRelationsFor, } from './gsd-db.js';
|
|
6
|
+
import { createMemoryRelation, isValidRelation } from './memory-relations.js';
|
|
6
7
|
// ─── Category Display Order ─────────────────────────────────────────────────
|
|
7
8
|
const CATEGORY_PRIORITY = {
|
|
8
9
|
gotcha: 0,
|
|
@@ -26,8 +27,21 @@ function rowToMemory(row) {
|
|
|
26
27
|
updated_at: row['updated_at'],
|
|
27
28
|
superseded_by: row['superseded_by'] ?? null,
|
|
28
29
|
hit_count: row['hit_count'],
|
|
30
|
+
scope: row['scope'] ?? 'project',
|
|
31
|
+
tags: parseTags(row['tags']),
|
|
29
32
|
};
|
|
30
33
|
}
|
|
34
|
+
function parseTags(raw) {
|
|
35
|
+
if (typeof raw !== 'string' || raw.length === 0)
|
|
36
|
+
return [];
|
|
37
|
+
try {
|
|
38
|
+
const parsed = JSON.parse(raw);
|
|
39
|
+
return Array.isArray(parsed) ? parsed.filter((t) => typeof t === 'string') : [];
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
31
45
|
// ─── Query Functions ────────────────────────────────────────────────────────
|
|
32
46
|
/**
|
|
33
47
|
* Get all memories where superseded_by IS NULL.
|
|
@@ -68,6 +82,245 @@ export function getActiveMemoriesRanked(limit = 30) {
|
|
|
68
82
|
return [];
|
|
69
83
|
}
|
|
70
84
|
}
|
|
85
|
+
export function queryMemoriesRanked(opts) {
|
|
86
|
+
if (!isDbAvailable())
|
|
87
|
+
return [];
|
|
88
|
+
const adapter = _getAdapter();
|
|
89
|
+
if (!adapter)
|
|
90
|
+
return [];
|
|
91
|
+
const k = clampLimit(opts.k, 10);
|
|
92
|
+
const rrfK = opts.rrfK ?? 60;
|
|
93
|
+
const activeClause = opts.include_superseded === true ? '' : 'WHERE superseded_by IS NULL';
|
|
94
|
+
const trimmedQuery = (opts.query ?? '').trim();
|
|
95
|
+
// 1) Keyword hits — try FTS5 first, fall back to LIKE when unavailable.
|
|
96
|
+
const keywordHits = trimmedQuery ? keywordSearch(adapter, trimmedQuery, activeClause, 50) : [];
|
|
97
|
+
// 2) Semantic hits — cosine over memory_embeddings. Requires opts.queryVector.
|
|
98
|
+
const semanticHits = opts.queryVector
|
|
99
|
+
? semanticSearch(adapter, opts.queryVector, activeClause, 50)
|
|
100
|
+
: [];
|
|
101
|
+
if (keywordHits.length === 0 && semanticHits.length === 0 && !trimmedQuery) {
|
|
102
|
+
// No query at all — fall back to the existing ranked-by-score listing.
|
|
103
|
+
return getActiveMemoriesRanked(k).map((memory) => ({
|
|
104
|
+
memory,
|
|
105
|
+
score: memory.confidence * (1 + memory.hit_count * 0.1),
|
|
106
|
+
keywordRank: null,
|
|
107
|
+
semanticRank: null,
|
|
108
|
+
confidenceBoost: memory.confidence * (1 + memory.hit_count * 0.1),
|
|
109
|
+
reason: 'ranked',
|
|
110
|
+
})).filter((hit) => passesFilters(hit.memory, opts));
|
|
111
|
+
}
|
|
112
|
+
// 3) Reciprocal rank fusion — each hit contributes 1/(rrfK + rank).
|
|
113
|
+
const fused = new Map();
|
|
114
|
+
for (let i = 0; i < keywordHits.length; i++) {
|
|
115
|
+
const hit = keywordHits[i];
|
|
116
|
+
const existing = fused.get(hit.id);
|
|
117
|
+
const rrf = 1 / (rrfK + i + 1);
|
|
118
|
+
if (existing) {
|
|
119
|
+
existing.kwRank = i + 1;
|
|
120
|
+
existing.score += rrf;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
fused.set(hit.id, { memory: hit, kwRank: i + 1, semRank: null, score: rrf });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
for (let i = 0; i < semanticHits.length; i++) {
|
|
127
|
+
const hit = semanticHits[i];
|
|
128
|
+
const existing = fused.get(hit.id);
|
|
129
|
+
const rrf = 1 / (rrfK + i + 1);
|
|
130
|
+
if (existing) {
|
|
131
|
+
existing.semRank = i + 1;
|
|
132
|
+
existing.score += rrf;
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
fused.set(hit.id, { memory: hit, kwRank: null, semRank: i + 1, score: rrf });
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
// 4) Apply filters + confidence boost, then sort.
|
|
139
|
+
const ranked = [];
|
|
140
|
+
for (const entry of fused.values()) {
|
|
141
|
+
if (!passesFilters(entry.memory, opts))
|
|
142
|
+
continue;
|
|
143
|
+
const boost = entry.memory.confidence * (1 + entry.memory.hit_count * 0.1);
|
|
144
|
+
const reason = entry.kwRank != null && entry.semRank != null
|
|
145
|
+
? 'both'
|
|
146
|
+
: entry.kwRank != null
|
|
147
|
+
? 'keyword'
|
|
148
|
+
: 'semantic';
|
|
149
|
+
ranked.push({
|
|
150
|
+
memory: entry.memory,
|
|
151
|
+
score: entry.score * boost,
|
|
152
|
+
keywordRank: entry.kwRank,
|
|
153
|
+
semanticRank: entry.semRank,
|
|
154
|
+
confidenceBoost: boost,
|
|
155
|
+
reason,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
ranked.sort((a, b) => b.score - a.score);
|
|
159
|
+
return ranked.slice(0, k);
|
|
160
|
+
}
|
|
161
|
+
function clampLimit(value, fallback) {
|
|
162
|
+
if (typeof value !== 'number' || !Number.isFinite(value))
|
|
163
|
+
return fallback;
|
|
164
|
+
if (value < 1)
|
|
165
|
+
return 1;
|
|
166
|
+
if (value > 100)
|
|
167
|
+
return 100;
|
|
168
|
+
return Math.floor(value);
|
|
169
|
+
}
|
|
170
|
+
function passesFilters(memory, filters) {
|
|
171
|
+
if (filters.category && memory.category.toLowerCase() !== filters.category.toLowerCase())
|
|
172
|
+
return false;
|
|
173
|
+
if (filters.scope && memory.scope !== filters.scope)
|
|
174
|
+
return false;
|
|
175
|
+
if (filters.tag) {
|
|
176
|
+
const needle = filters.tag.toLowerCase();
|
|
177
|
+
if (!memory.tags.map((t) => t.toLowerCase()).includes(needle))
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
182
|
+
function keywordSearch(adapter, rawQuery, activeClause, limit) {
|
|
183
|
+
const ftsAvailable = isFtsAvailable(adapter);
|
|
184
|
+
if (ftsAvailable) {
|
|
185
|
+
try {
|
|
186
|
+
const matchExpr = toFtsMatchExpr(rawQuery);
|
|
187
|
+
if (!matchExpr)
|
|
188
|
+
return [];
|
|
189
|
+
const activePart = activeClause ? `AND m.${activeClause.replace(/^WHERE\s+/i, '')}` : '';
|
|
190
|
+
const rows = adapter.prepare(`SELECT m.*
|
|
191
|
+
FROM memories_fts f
|
|
192
|
+
JOIN memories m ON m.seq = f.rowid
|
|
193
|
+
WHERE memories_fts MATCH :match
|
|
194
|
+
${activePart}
|
|
195
|
+
ORDER BY bm25(memories_fts)
|
|
196
|
+
LIMIT :limit`).all({ ':match': matchExpr, ':limit': limit });
|
|
197
|
+
return rows.map(rowToMemory);
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// fall through to LIKE
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// LIKE fallback — scans the candidate pool.
|
|
204
|
+
const terms = rawQuery
|
|
205
|
+
.toLowerCase()
|
|
206
|
+
.split(/[^a-z0-9_]+/)
|
|
207
|
+
.filter((t) => t.length >= 2);
|
|
208
|
+
if (terms.length === 0)
|
|
209
|
+
return [];
|
|
210
|
+
const rows = adapter.prepare(`SELECT * FROM memories ${activeClause}`).all();
|
|
211
|
+
const scored = [];
|
|
212
|
+
for (const row of rows) {
|
|
213
|
+
const memory = rowToMemory(row);
|
|
214
|
+
const lower = memory.content.toLowerCase();
|
|
215
|
+
let score = 0;
|
|
216
|
+
for (const term of terms) {
|
|
217
|
+
const idx = lower.indexOf(term);
|
|
218
|
+
if (idx === -1)
|
|
219
|
+
continue;
|
|
220
|
+
score += 1 + (term.length >= 5 ? 0.5 : 0);
|
|
221
|
+
}
|
|
222
|
+
if (score > 0)
|
|
223
|
+
scored.push({ memory, score });
|
|
224
|
+
}
|
|
225
|
+
scored.sort((a, b) => b.score - a.score);
|
|
226
|
+
return scored.slice(0, limit).map((s) => s.memory);
|
|
227
|
+
}
|
|
228
|
+
function isFtsAvailable(adapter) {
|
|
229
|
+
try {
|
|
230
|
+
const row = adapter
|
|
231
|
+
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='memories_fts'")
|
|
232
|
+
.get();
|
|
233
|
+
return !!row;
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
function toFtsMatchExpr(query) {
|
|
240
|
+
// Build a tolerant AND expression: quote each bare term with a trailing *.
|
|
241
|
+
const tokens = query
|
|
242
|
+
.toLowerCase()
|
|
243
|
+
.split(/[^a-z0-9_]+/)
|
|
244
|
+
.filter((t) => t.length >= 2)
|
|
245
|
+
.slice(0, 8);
|
|
246
|
+
if (tokens.length === 0)
|
|
247
|
+
return null;
|
|
248
|
+
return tokens.map((t) => `"${t.replace(/"/g, '""')}"*`).join(' OR ');
|
|
249
|
+
}
|
|
250
|
+
function semanticSearch(adapter, queryVector, activeClause, limit) {
|
|
251
|
+
try {
|
|
252
|
+
const rows = adapter
|
|
253
|
+
.prepare(`SELECT m.*, e.vector as embedding_vector, e.dim as embedding_dim
|
|
254
|
+
FROM memories m
|
|
255
|
+
JOIN memory_embeddings e ON e.memory_id = m.id
|
|
256
|
+
${activeClause}`)
|
|
257
|
+
.all();
|
|
258
|
+
const scored = [];
|
|
259
|
+
for (const row of rows) {
|
|
260
|
+
const dim = row['embedding_dim'];
|
|
261
|
+
if (dim !== queryVector.length)
|
|
262
|
+
continue;
|
|
263
|
+
const vector = unpackVector(row['embedding_vector'], dim);
|
|
264
|
+
if (!vector)
|
|
265
|
+
continue;
|
|
266
|
+
const sim = cosine(queryVector, vector);
|
|
267
|
+
if (sim <= 0)
|
|
268
|
+
continue;
|
|
269
|
+
scored.push({ memory: rowToMemory(row), sim });
|
|
270
|
+
}
|
|
271
|
+
scored.sort((a, b) => b.sim - a.sim);
|
|
272
|
+
return scored.slice(0, limit).map((s) => s.memory);
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
return [];
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
function unpackVector(blob, dim) {
|
|
279
|
+
if (!blob)
|
|
280
|
+
return null;
|
|
281
|
+
try {
|
|
282
|
+
let view = null;
|
|
283
|
+
if (blob instanceof Float32Array)
|
|
284
|
+
return blob;
|
|
285
|
+
if (blob instanceof Uint8Array)
|
|
286
|
+
view = blob;
|
|
287
|
+
else if (blob instanceof ArrayBuffer)
|
|
288
|
+
view = new Uint8Array(blob);
|
|
289
|
+
else if (blob.buffer && blob.byteLength != null) {
|
|
290
|
+
const buf = blob;
|
|
291
|
+
view = new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);
|
|
292
|
+
}
|
|
293
|
+
else if (Array.isArray(blob)) {
|
|
294
|
+
return new Float32Array(blob);
|
|
295
|
+
}
|
|
296
|
+
if (!view || view.byteLength % 4 !== 0)
|
|
297
|
+
return null;
|
|
298
|
+
const aligned = new ArrayBuffer(view.byteLength);
|
|
299
|
+
new Uint8Array(aligned).set(view);
|
|
300
|
+
const f32 = new Float32Array(aligned);
|
|
301
|
+
return f32.length === dim ? f32 : null;
|
|
302
|
+
}
|
|
303
|
+
catch {
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
function cosine(a, b) {
|
|
308
|
+
if (a.length === 0 || a.length !== b.length)
|
|
309
|
+
return 0;
|
|
310
|
+
let dot = 0;
|
|
311
|
+
let na = 0;
|
|
312
|
+
let nb = 0;
|
|
313
|
+
for (let i = 0; i < a.length; i++) {
|
|
314
|
+
const x = a[i];
|
|
315
|
+
const y = b[i];
|
|
316
|
+
dot += x * y;
|
|
317
|
+
na += x * x;
|
|
318
|
+
nb += y * y;
|
|
319
|
+
}
|
|
320
|
+
if (na === 0 || nb === 0)
|
|
321
|
+
return 0;
|
|
322
|
+
return dot / (Math.sqrt(na) * Math.sqrt(nb));
|
|
323
|
+
}
|
|
71
324
|
/**
|
|
72
325
|
* Generate the next memory ID: MEM + zero-padded 3-digit from MAX(seq).
|
|
73
326
|
* Returns MEM001 if no memories exist.
|
|
@@ -121,6 +374,8 @@ export function createMemory(fields) {
|
|
|
121
374
|
sourceUnitId: fields.source_unit_id ?? null,
|
|
122
375
|
createdAt: now,
|
|
123
376
|
updatedAt: now,
|
|
377
|
+
scope: fields.scope ?? 'project',
|
|
378
|
+
tags: fields.tags ?? [],
|
|
124
379
|
});
|
|
125
380
|
// Derive the real ID from the assigned seq (SELECT is still fine via adapter)
|
|
126
381
|
const row = adapter.prepare('SELECT seq FROM memories WHERE id = :id').get({ ':id': placeholder });
|
|
@@ -213,29 +468,34 @@ export function markUnitProcessed(unitKey, activityFile) {
|
|
|
213
468
|
/**
|
|
214
469
|
* Reduce confidence for memories not updated within the last N processed units.
|
|
215
470
|
* "Stale" = updated_at is older than the Nth most recent processed_at.
|
|
471
|
+
* Returns the number of decayed memory IDs for observability.
|
|
216
472
|
*/
|
|
217
473
|
export function decayStaleMemories(thresholdUnits = 20) {
|
|
218
474
|
if (!isDbAvailable())
|
|
219
|
-
return;
|
|
475
|
+
return [];
|
|
220
476
|
const adapter = _getAdapter();
|
|
221
477
|
if (!adapter)
|
|
222
|
-
return;
|
|
478
|
+
return [];
|
|
223
479
|
try {
|
|
224
480
|
// Find the timestamp of the Nth most recent processed unit (read-only SELECT)
|
|
225
481
|
const row = adapter.prepare(`SELECT processed_at FROM memory_processed_units
|
|
226
482
|
ORDER BY processed_at DESC
|
|
227
483
|
LIMIT 1 OFFSET :offset`).get({ ':offset': thresholdUnits - 1 });
|
|
228
484
|
if (!row)
|
|
229
|
-
return; // not enough processed units yet
|
|
485
|
+
return []; // not enough processed units yet
|
|
230
486
|
const cutoff = row['processed_at'];
|
|
487
|
+
const affected = adapter.prepare(`SELECT id FROM memories
|
|
488
|
+
WHERE superseded_by IS NULL AND updated_at < :cutoff AND confidence > 0.1`).all({ ':cutoff': cutoff }).map((r) => r['id']);
|
|
231
489
|
decayMemoriesBefore(cutoff, new Date().toISOString());
|
|
490
|
+
return affected;
|
|
232
491
|
}
|
|
233
492
|
catch {
|
|
234
|
-
|
|
493
|
+
return [];
|
|
235
494
|
}
|
|
236
495
|
}
|
|
237
496
|
/**
|
|
238
|
-
* Supersede lowest-ranked memories when count exceeds cap.
|
|
497
|
+
* Supersede lowest-ranked memories when count exceeds cap. Cascades to the
|
|
498
|
+
* embedding and relation rows so those tables don't grow unboundedly.
|
|
239
499
|
*/
|
|
240
500
|
export function enforceMemoryCap(max = 50) {
|
|
241
501
|
if (!isDbAvailable())
|
|
@@ -249,7 +509,24 @@ export function enforceMemoryCap(max = 50) {
|
|
|
249
509
|
if (count <= max)
|
|
250
510
|
return;
|
|
251
511
|
const excess = count - max;
|
|
512
|
+
// Capture the about-to-be-superseded IDs first so we can cascade cleanup.
|
|
513
|
+
const victims = adapter.prepare(`SELECT id FROM memories
|
|
514
|
+
WHERE superseded_by IS NULL
|
|
515
|
+
ORDER BY (confidence * (1.0 + hit_count * 0.1)) ASC
|
|
516
|
+
LIMIT :limit`).all({ ':limit': excess }).map((row) => row['id']);
|
|
252
517
|
supersedeLowestRankedMemories(excess, new Date().toISOString());
|
|
518
|
+
if (victims.length === 0)
|
|
519
|
+
return;
|
|
520
|
+
for (const id of victims) {
|
|
521
|
+
try {
|
|
522
|
+
deleteMemoryEmbedding(id);
|
|
523
|
+
}
|
|
524
|
+
catch { /* non-fatal */ }
|
|
525
|
+
try {
|
|
526
|
+
deleteMemoryRelationsFor(id);
|
|
527
|
+
}
|
|
528
|
+
catch { /* non-fatal */ }
|
|
529
|
+
}
|
|
253
530
|
}
|
|
254
531
|
catch {
|
|
255
532
|
// non-fatal
|
|
@@ -274,6 +551,8 @@ export function applyMemoryActions(actions, unitType, unitId) {
|
|
|
274
551
|
confidence: action.confidence,
|
|
275
552
|
source_unit_type: unitType,
|
|
276
553
|
source_unit_id: unitId,
|
|
554
|
+
scope: action.scope,
|
|
555
|
+
tags: action.tags,
|
|
277
556
|
});
|
|
278
557
|
break;
|
|
279
558
|
case 'UPDATE':
|
|
@@ -285,6 +564,9 @@ export function applyMemoryActions(actions, unitType, unitId) {
|
|
|
285
564
|
case 'SUPERSEDE':
|
|
286
565
|
supersedeMemory(action.id, action.superseded_by);
|
|
287
566
|
break;
|
|
567
|
+
case 'LINK':
|
|
568
|
+
applyLinkAction(action);
|
|
569
|
+
break;
|
|
288
570
|
}
|
|
289
571
|
}
|
|
290
572
|
enforceMemoryCap();
|
|
@@ -294,6 +576,17 @@ export function applyMemoryActions(actions, unitType, unitId) {
|
|
|
294
576
|
// non-fatal — transaction will have rolled back
|
|
295
577
|
}
|
|
296
578
|
}
|
|
579
|
+
// ─── LINK action ────────────────────────────────────────────────────────────
|
|
580
|
+
function applyLinkAction(action) {
|
|
581
|
+
try {
|
|
582
|
+
if (!isValidRelation(action.rel))
|
|
583
|
+
return;
|
|
584
|
+
createMemoryRelation(action.from, action.to, action.rel, action.confidence);
|
|
585
|
+
}
|
|
586
|
+
catch {
|
|
587
|
+
// Link failures should never break memory extraction.
|
|
588
|
+
}
|
|
589
|
+
}
|
|
297
590
|
// ─── Prompt Formatting ──────────────────────────────────────────────────────
|
|
298
591
|
/**
|
|
299
592
|
* Format memories as categorized markdown for system prompt injection.
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export const BUNDLED_COST_TABLE = [
|
|
12
12
|
// Anthropic
|
|
13
|
-
{ id: "claude-opus-4-6", inputPer1k: 0.
|
|
13
|
+
{ id: "claude-opus-4-6", inputPer1k: 0.005, outputPer1k: 0.025, updatedAt: "2026-04-16" },
|
|
14
|
+
{ id: "claude-opus-4-7", inputPer1k: 0.005, outputPer1k: 0.025, updatedAt: "2026-04-16" },
|
|
14
15
|
{ id: "claude-sonnet-4-6", inputPer1k: 0.003, outputPer1k: 0.015, updatedAt: "2025-03-15" },
|
|
15
16
|
{ id: "claude-haiku-4-5", inputPer1k: 0.0008, outputPer1k: 0.004, updatedAt: "2025-03-15" },
|
|
16
17
|
{ id: "claude-sonnet-4-5-20250514", inputPer1k: 0.003, outputPer1k: 0.015, updatedAt: "2025-03-15" },
|
|
@@ -41,6 +42,7 @@ export const BUNDLED_COST_TABLE = [
|
|
|
41
42
|
{ id: "gpt-5.3-codex", inputPer1k: 0.005, outputPer1k: 0.02, updatedAt: "2026-03-29" },
|
|
42
43
|
{ id: "gpt-5.3-codex-spark", inputPer1k: 0.0003, outputPer1k: 0.0012, updatedAt: "2026-03-29" },
|
|
43
44
|
{ id: "gpt-5.4", inputPer1k: 0.005, outputPer1k: 0.02, updatedAt: "2026-03-29" },
|
|
45
|
+
{ id: "gpt-5.4-mini", inputPer1k: 0.00075, outputPer1k: 0.0045, updatedAt: "2026-04-18" },
|
|
44
46
|
// Google
|
|
45
47
|
{ id: "gemini-2.0-flash", inputPer1k: 0.0001, outputPer1k: 0.0004, updatedAt: "2025-03-15" },
|
|
46
48
|
{ id: "gemini-flash-2.0", inputPer1k: 0.0001, outputPer1k: 0.0004, updatedAt: "2025-03-15" },
|
|
@@ -17,6 +17,7 @@ export const MODEL_CAPABILITY_TIER = {
|
|
|
17
17
|
"gpt-4.1-nano": "light",
|
|
18
18
|
"gpt-5-mini": "light",
|
|
19
19
|
"gpt-5-nano": "light",
|
|
20
|
+
"gpt-5.4-mini": "light",
|
|
20
21
|
"gpt-5.1-codex-mini": "light",
|
|
21
22
|
"gpt-5.3-codex-spark": "light",
|
|
22
23
|
"gemini-2.0-flash": "light",
|
|
@@ -32,6 +33,7 @@ export const MODEL_CAPABILITY_TIER = {
|
|
|
32
33
|
"deepseek-chat": "standard",
|
|
33
34
|
// Heavy-tier models (most capable)
|
|
34
35
|
"claude-opus-4-6": "heavy",
|
|
36
|
+
"claude-opus-4-7": "heavy",
|
|
35
37
|
"claude-3-opus-latest": "heavy",
|
|
36
38
|
"gpt-4-turbo": "heavy",
|
|
37
39
|
"gpt-5": "heavy",
|
|
@@ -54,7 +56,8 @@ const MODEL_COST_PER_1K_INPUT = {
|
|
|
54
56
|
"claude-3-5-haiku-latest": 0.0008,
|
|
55
57
|
"claude-sonnet-4-6": 0.003,
|
|
56
58
|
"claude-sonnet-4-5-20250514": 0.003,
|
|
57
|
-
"claude-opus-4-6": 0.
|
|
59
|
+
"claude-opus-4-6": 0.005,
|
|
60
|
+
"claude-opus-4-7": 0.005,
|
|
58
61
|
"gpt-4o-mini": 0.00015,
|
|
59
62
|
"gpt-4o": 0.0025,
|
|
60
63
|
"gpt-4.1": 0.002,
|
|
@@ -63,6 +66,7 @@ const MODEL_COST_PER_1K_INPUT = {
|
|
|
63
66
|
"gpt-5": 0.01,
|
|
64
67
|
"gpt-5-mini": 0.0003,
|
|
65
68
|
"gpt-5-nano": 0.0001,
|
|
69
|
+
"gpt-5.4-mini": 0.00075,
|
|
66
70
|
"gpt-5-pro": 0.015,
|
|
67
71
|
"gpt-5.1": 0.005,
|
|
68
72
|
"gpt-5.1-codex-max": 0.003,
|
|
@@ -84,6 +88,7 @@ const MODEL_COST_PER_1K_INPUT = {
|
|
|
84
88
|
export const MODEL_CAPABILITY_PROFILES = {
|
|
85
89
|
// ── Anthropic ──────────────────────────────────────────────────────────────
|
|
86
90
|
"claude-opus-4-6": { coding: 95, debugging: 90, research: 85, reasoning: 95, speed: 30, longContext: 80, instruction: 90 },
|
|
91
|
+
"claude-opus-4-7": { coding: 95, debugging: 90, research: 85, reasoning: 95, speed: 30, longContext: 80, instruction: 90 },
|
|
87
92
|
"claude-sonnet-4-6": { coding: 85, debugging: 80, research: 75, reasoning: 80, speed: 60, longContext: 75, instruction: 85 },
|
|
88
93
|
"claude-sonnet-4-5-20250514": { coding: 85, debugging: 80, research: 75, reasoning: 80, speed: 60, longContext: 75, instruction: 85 },
|
|
89
94
|
"claude-3-5-sonnet-latest": { coding: 82, debugging: 78, research: 72, reasoning: 78, speed: 62, longContext: 70, instruction: 82 },
|
|
@@ -101,6 +106,7 @@ export const MODEL_CAPABILITY_PROFILES = {
|
|
|
101
106
|
"gpt-5": { coding: 92, debugging: 88, research: 85, reasoning: 92, speed: 40, longContext: 85, instruction: 90 },
|
|
102
107
|
"gpt-5-mini": { coding: 62, debugging: 52, research: 48, reasoning: 52, speed: 88, longContext: 52, instruction: 74 },
|
|
103
108
|
"gpt-5-nano": { coding: 42, debugging: 32, research: 28, reasoning: 32, speed: 95, longContext: 32, instruction: 62 },
|
|
109
|
+
"gpt-5.4-mini": { coding: 70, debugging: 60, research: 55, reasoning: 60, speed: 84, longContext: 60, instruction: 78 },
|
|
104
110
|
"gpt-5-pro": { coding: 94, debugging: 90, research: 88, reasoning: 94, speed: 35, longContext: 88, instruction: 92 },
|
|
105
111
|
"gpt-5.1": { coding: 93, debugging: 89, research: 86, reasoning: 93, speed: 42, longContext: 86, instruction: 91 },
|
|
106
112
|
"gpt-5.1-codex-max": { coding: 90, debugging: 85, research: 70, reasoning: 85, speed: 55, longContext: 75, instruction: 85 },
|
|
@@ -183,8 +189,9 @@ export function computeTaskRequirements(unitType, metadata) {
|
|
|
183
189
|
*/
|
|
184
190
|
export function scoreEligibleModels(eligibleModelIds, requirements, capabilityOverrides) {
|
|
185
191
|
const scored = eligibleModelIds.map(modelId => {
|
|
186
|
-
const
|
|
187
|
-
const
|
|
192
|
+
const bareId = bareModelId(modelId);
|
|
193
|
+
const builtin = MODEL_CAPABILITY_PROFILES[bareId];
|
|
194
|
+
const override = capabilityOverrides?.[modelId] ?? capabilityOverrides?.[bareId];
|
|
188
195
|
const profile = builtin
|
|
189
196
|
? override ? { ...builtin, ...override } : builtin
|
|
190
197
|
: { coding: 50, debugging: 50, research: 50, reasoning: 50, speed: 50, longContext: 50, instruction: 50 };
|
|
@@ -394,7 +401,7 @@ export function defaultRoutingConfig() {
|
|
|
394
401
|
// ─── Internal ────────────────────────────────────────────────────────────────
|
|
395
402
|
function getModelTier(modelId) {
|
|
396
403
|
// Strip provider prefix if present
|
|
397
|
-
const bareId =
|
|
404
|
+
const bareId = bareModelId(modelId);
|
|
398
405
|
// Check exact match first
|
|
399
406
|
if (MODEL_CAPABILITY_TIER[bareId])
|
|
400
407
|
return MODEL_CAPABILITY_TIER[bareId];
|
|
@@ -408,7 +415,7 @@ function getModelTier(modelId) {
|
|
|
408
415
|
}
|
|
409
416
|
/** Check if a model ID has a known capability tier mapping. (#2192) */
|
|
410
417
|
function isKnownModel(modelId) {
|
|
411
|
-
const bareId =
|
|
418
|
+
const bareId = bareModelId(modelId);
|
|
412
419
|
if (MODEL_CAPABILITY_TIER[bareId])
|
|
413
420
|
return true;
|
|
414
421
|
for (const knownId of Object.keys(MODEL_CAPABILITY_TIER)) {
|
|
@@ -418,7 +425,7 @@ function isKnownModel(modelId) {
|
|
|
418
425
|
return false;
|
|
419
426
|
}
|
|
420
427
|
function getModelCost(modelId) {
|
|
421
|
-
const bareId =
|
|
428
|
+
const bareId = bareModelId(modelId);
|
|
422
429
|
if (MODEL_COST_PER_1K_INPUT[bareId] !== undefined) {
|
|
423
430
|
return MODEL_COST_PER_1K_INPUT[bareId];
|
|
424
431
|
}
|
|
@@ -430,6 +437,9 @@ function getModelCost(modelId) {
|
|
|
430
437
|
// Unknown cost — assume expensive to avoid routing to unknown cheap models
|
|
431
438
|
return 999;
|
|
432
439
|
}
|
|
440
|
+
function bareModelId(modelId) {
|
|
441
|
+
return modelId.includes("/") ? modelId.split("/").pop() : modelId;
|
|
442
|
+
}
|
|
433
443
|
// ─── Tool Compatibility Filter (ADR-005 Phase 3) ───────────────────────────
|
|
434
444
|
/**
|
|
435
445
|
* Check if a tool is compatible with a provider's capabilities.
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
// Both READ and WRITE operations are native — push operations remain as
|
|
6
6
|
// execSync calls because git2 credential handling is too complex.
|
|
7
7
|
import { execFileSync } from "node:child_process";
|
|
8
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { join } from "node:path";
|
|
8
10
|
import { GSDError, GSD_GIT_ERROR } from "./errors.js";
|
|
9
11
|
import { GIT_NO_PROMPT_ENV } from "./git-constants.js";
|
|
10
12
|
import { getErrorMessage } from "./error-utils.js";
|
|
@@ -534,6 +536,136 @@ export function nativeAddAll(basePath) {
|
|
|
534
536
|
export function nativeAddTracked(basePath) {
|
|
535
537
|
gitFileExec(basePath, ["add", "-u"]);
|
|
536
538
|
}
|
|
539
|
+
function isDotGsdIgnored(basePath) {
|
|
540
|
+
for (const path of [".gsd", ".gsd/"]) {
|
|
541
|
+
try {
|
|
542
|
+
execFileSync("git", ["check-ignore", "-q", path], {
|
|
543
|
+
cwd: basePath,
|
|
544
|
+
stdio: "pipe",
|
|
545
|
+
env: GIT_NO_PROMPT_ENV,
|
|
546
|
+
});
|
|
547
|
+
return true;
|
|
548
|
+
}
|
|
549
|
+
catch {
|
|
550
|
+
// exit 1 means this form is not ignored; try the next variant
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
return false;
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Determine whether the project opts out of GSD-managed `.gitignore` via
|
|
557
|
+
* `git.manage_gitignore: false` in `.gsd/PREFERENCES.md`. Uses a minimal
|
|
558
|
+
* inline parser to avoid importing the full preferences module (which would
|
|
559
|
+
* introduce a circular dependency back into this low-level bridge).
|
|
560
|
+
*
|
|
561
|
+
* Returns true when management is disabled. Any parse failure or missing
|
|
562
|
+
* file returns false (default: GSD may manage `.gitignore`).
|
|
563
|
+
*/
|
|
564
|
+
function isGitignoreManagementDisabled(basePath) {
|
|
565
|
+
const prefsPath = join(basePath, ".gsd", "PREFERENCES.md");
|
|
566
|
+
if (!existsSync(prefsPath))
|
|
567
|
+
return false;
|
|
568
|
+
try {
|
|
569
|
+
const content = readFileSync(prefsPath, "utf-8");
|
|
570
|
+
// Look for `manage_gitignore: false` under a `git:` block. The preference
|
|
571
|
+
// is indented; a loose regex is sufficient since we only care about the
|
|
572
|
+
// explicit opt-out case.
|
|
573
|
+
return /^\s*manage_gitignore\s*:\s*false\s*$/m.test(content);
|
|
574
|
+
}
|
|
575
|
+
catch {
|
|
576
|
+
return false;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Self-heal path for the symlinked-`.gsd` staging failure: append `.gsd` to
|
|
581
|
+
* `.gitignore` so subsequent `git add -A` calls succeed without the symlink
|
|
582
|
+
* pathspec error. Honors the `git.manage_gitignore: false` opt-out.
|
|
583
|
+
*
|
|
584
|
+
* Returns true when `.gitignore` now contains an entry covering `.gsd`
|
|
585
|
+
* (either pre-existing or newly appended). Returns false when the opt-out
|
|
586
|
+
* is set or the write fails.
|
|
587
|
+
*/
|
|
588
|
+
function trySelfHealGsdGitignore(basePath) {
|
|
589
|
+
if (isGitignoreManagementDisabled(basePath))
|
|
590
|
+
return false;
|
|
591
|
+
const gitignorePath = join(basePath, ".gitignore");
|
|
592
|
+
try {
|
|
593
|
+
const existing = existsSync(gitignorePath) ? readFileSync(gitignorePath, "utf-8") : "";
|
|
594
|
+
const lines = new Set(existing.split("\n").map(l => l.trim()).filter(l => l && !l.startsWith("#")));
|
|
595
|
+
if (lines.has(".gsd") || lines.has(".gsd/"))
|
|
596
|
+
return true;
|
|
597
|
+
const prefix = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
598
|
+
const block = `${prefix}\n# ── GSD self-heal: .gsd is a symlink to external state ──\n.gsd\n`;
|
|
599
|
+
writeFileSync(gitignorePath, existing + block, "utf-8");
|
|
600
|
+
return true;
|
|
601
|
+
}
|
|
602
|
+
catch {
|
|
603
|
+
return false;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Stage untracked files individually while skipping anything under `.gsd`.
|
|
608
|
+
* Used as a last-resort when `.gsd` is a symlink, not gitignored, and
|
|
609
|
+
* `git.manage_gitignore: false` forbids the self-heal path. Protects user
|
|
610
|
+
* work by never silently dropping new real files.
|
|
611
|
+
*/
|
|
612
|
+
function stageUntrackedExcludingDotGsd(basePath) {
|
|
613
|
+
// Stage tracked modifications first. `git add -u` never fails on pathspec
|
|
614
|
+
// issues because it doesn't walk untracked trees.
|
|
615
|
+
gitFileExec(basePath, ["add", "-u"]);
|
|
616
|
+
// Enumerate untracked paths via porcelain output. `?? ` prefix marks
|
|
617
|
+
// untracked files (status respects `.gitignore`).
|
|
618
|
+
const status = gitFileExec(basePath, ["status", "--porcelain=v1", "-z"], true);
|
|
619
|
+
if (!status)
|
|
620
|
+
return;
|
|
621
|
+
const untracked = [];
|
|
622
|
+
for (const entry of status.split("\0")) {
|
|
623
|
+
if (!entry)
|
|
624
|
+
continue;
|
|
625
|
+
// Porcelain format: "XY path" where XY is the 2-char status code.
|
|
626
|
+
if (entry.length < 4)
|
|
627
|
+
continue;
|
|
628
|
+
const code = entry.slice(0, 2);
|
|
629
|
+
const path = entry.slice(3);
|
|
630
|
+
if (code !== "??")
|
|
631
|
+
continue;
|
|
632
|
+
// Skip GSD runtime artifacts. Under `manage_gitignore: false` the user
|
|
633
|
+
// may not have these in `.gitignore`, so we filter explicitly to avoid
|
|
634
|
+
// committing transient state (.gsd external link, migration lock,
|
|
635
|
+
// background shell scratch dir).
|
|
636
|
+
if (path === ".gsd" || path.startsWith(".gsd/"))
|
|
637
|
+
continue;
|
|
638
|
+
if (path === ".gsd-id" || path === ".gsd.migrating")
|
|
639
|
+
continue;
|
|
640
|
+
if (path === ".bg-shell" || path.startsWith(".bg-shell/"))
|
|
641
|
+
continue;
|
|
642
|
+
untracked.push(path);
|
|
643
|
+
}
|
|
644
|
+
if (untracked.length === 0)
|
|
645
|
+
return;
|
|
646
|
+
// Stage in chunks to avoid exceeding ARG_MAX on large change sets.
|
|
647
|
+
const CHUNK = 200;
|
|
648
|
+
for (let i = 0; i < untracked.length; i += CHUNK) {
|
|
649
|
+
gitFileExec(basePath, ["add", "--", ...untracked.slice(i, i + CHUNK)]);
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Handle `nativeAddAllWithExclusions` failing with "beyond a symbolic link"
|
|
654
|
+
* when `.gsd` is a symlink. Self-heals by adding `.gsd` to `.gitignore`, or
|
|
655
|
+
* falls back to explicit per-file staging so user work is never dropped.
|
|
656
|
+
*/
|
|
657
|
+
function fallbackStageWithSymlinkedDotGsd(basePath) {
|
|
658
|
+
if (isDotGsdIgnored(basePath)) {
|
|
659
|
+
gitFileExec(basePath, ["add", "-A"]);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
if (trySelfHealGsdGitignore(basePath)) {
|
|
663
|
+
gitFileExec(basePath, ["add", "-A"]);
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
// `manage_gitignore: false` — protect work by staging files explicitly.
|
|
667
|
+
stageUntrackedExcludingDotGsd(basePath);
|
|
668
|
+
}
|
|
537
669
|
/**
|
|
538
670
|
* Stage all files with pathspec exclusions (git add -A -- ':!pattern' ...).
|
|
539
671
|
* Excluded paths are never hashed by git, preventing hangs on large
|
|
@@ -569,12 +701,12 @@ export function nativeAddAllWithExclusions(basePath, exclusions) {
|
|
|
569
701
|
return;
|
|
570
702
|
}
|
|
571
703
|
// When .gsd is a symlink, git rejects `:!.gsd/...` pathspecs with
|
|
572
|
-
// "beyond a symbolic link".
|
|
573
|
-
//
|
|
574
|
-
//
|
|
575
|
-
//
|
|
704
|
+
// "beyond a symbolic link". Hand off to the self-heal fallback which
|
|
705
|
+
// either adds `.gsd` to `.gitignore` and retries `git add -A`, or stages
|
|
706
|
+
// real files explicitly when `git.manage_gitignore: false` forbids the
|
|
707
|
+
// self-heal path. Either way, user work is protected from silent drops.
|
|
576
708
|
if (stderr.includes("beyond a symbolic link")) {
|
|
577
|
-
|
|
709
|
+
fallbackStageWithSymlinkedDotGsd(basePath);
|
|
578
710
|
return;
|
|
579
711
|
}
|
|
580
712
|
throw new GSDError(GSD_GIT_ERROR, `git add -A with exclusions failed in ${basePath}: ${getErrorMessage(err)}`);
|