@apralabs/apra-fleet 0.4.0 → 0.4.1
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 +145 -7
- package/dist/agents/backlog-groomer.md +17 -1
- package/dist/agents/ci-watcher.md +13 -1
- package/dist/agents/deployer.md +15 -3
- package/dist/agents/doer.md +35 -1
- package/dist/agents/harvester.md +22 -3
- package/dist/agents/integ-test-runner.md +18 -2
- package/dist/agents/kb-reconciler.md +216 -0
- package/dist/agents/plan-reviewer.md +14 -1
- package/dist/agents/planner.md +88 -5
- package/dist/agents/regression-test-runner.md +19 -1
- package/dist/agents/reviewer.md +104 -3
- package/dist/agents/schemas/doer-output.json +63 -3
- package/dist/agents/schemas/harvester-output.json +59 -2
- package/dist/agents/schemas/integ-test-runner-output.json +2 -2
- package/dist/agents/schemas/kb-reconciler-output.json +87 -0
- package/dist/agents/schemas/planner-output.json +65 -0
- package/dist/agents/schemas/reviewer-output.json +105 -8
- package/dist/cli/install.d.ts +1 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +136 -5
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/join.js +1 -1
- package/dist/cli/join.js.map +1 -1
- package/dist/cli/kb-commit.d.ts +12 -0
- package/dist/cli/kb-commit.d.ts.map +1 -0
- package/dist/cli/kb-commit.js +53 -0
- package/dist/cli/kb-commit.js.map +1 -0
- package/dist/cli/kb-directives.d.ts +17 -0
- package/dist/cli/kb-directives.d.ts.map +1 -0
- package/dist/cli/kb-directives.js +146 -0
- package/dist/cli/kb-directives.js.map +1 -0
- package/dist/cli/kb-import.d.ts +13 -0
- package/dist/cli/kb-import.d.ts.map +1 -0
- package/dist/cli/kb-import.js +56 -0
- package/dist/cli/kb-import.js.map +1 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +11 -0
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/watch.d.ts +53 -4
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +118 -17
- package/dist/cli/watch.js.map +1 -1
- package/dist/commands/kb-server.d.ts +8 -0
- package/dist/commands/kb-server.d.ts.map +1 -0
- package/dist/commands/kb-server.js +221 -0
- package/dist/commands/kb-server.js.map +1 -0
- package/dist/index.js +77 -2
- package/dist/index.js.map +1 -1
- package/dist/os/linux.d.ts +1 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +18 -1
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +5 -0
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows.d.ts +35 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +67 -31
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +12 -1
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +134 -9
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +11 -1
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +47 -19
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +11 -1
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +29 -6
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +11 -1
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +26 -6
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/email/headers.d.ts +15 -0
- package/dist/providers/email/headers.d.ts.map +1 -0
- package/dist/providers/email/headers.js +42 -0
- package/dist/providers/email/headers.js.map +1 -0
- package/dist/providers/email/index.d.ts +18 -0
- package/dist/providers/email/index.d.ts.map +1 -0
- package/dist/providers/email/index.js +60 -0
- package/dist/providers/email/index.js.map +1 -0
- package/dist/providers/email/provider.d.ts +49 -0
- package/dist/providers/email/provider.d.ts.map +1 -0
- package/dist/providers/email/provider.js +2 -0
- package/dist/providers/email/provider.js.map +1 -0
- package/dist/providers/email/sendgrid.d.ts +12 -0
- package/dist/providers/email/sendgrid.d.ts.map +1 -0
- package/dist/providers/email/sendgrid.js +67 -0
- package/dist/providers/email/sendgrid.js.map +1 -0
- package/dist/providers/email/smtp.d.ts +65 -0
- package/dist/providers/email/smtp.d.ts.map +1 -0
- package/dist/providers/email/smtp.js +373 -0
- package/dist/providers/email/smtp.js.map +1 -0
- package/dist/providers/gemini.d.ts +11 -1
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +38 -4
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/none.d.ts +11 -1
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +21 -0
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +11 -1
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +55 -4
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +77 -0
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +44 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.d.ts.map +1 -1
- package/dist/services/agent-provisioner.js +3 -6
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/cloud/lifecycle.d.ts.map +1 -1
- package/dist/services/cloud/lifecycle.js +3 -0
- package/dist/services/cloud/lifecycle.js.map +1 -1
- package/dist/services/cloud/task-wrapper.d.ts +18 -0
- package/dist/services/cloud/task-wrapper.d.ts.map +1 -1
- package/dist/services/cloud/task-wrapper.js +157 -0
- package/dist/services/cloud/task-wrapper.js.map +1 -1
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +11 -2
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/knowledge/audn.d.ts +37 -0
- package/dist/services/knowledge/audn.d.ts.map +1 -0
- package/dist/services/knowledge/audn.js +219 -0
- package/dist/services/knowledge/audn.js.map +1 -0
- package/dist/services/knowledge/file-hash.d.ts +11 -0
- package/dist/services/knowledge/file-hash.d.ts.map +1 -0
- package/dist/services/knowledge/file-hash.js +123 -0
- package/dist/services/knowledge/file-hash.js.map +1 -0
- package/dist/services/knowledge/http-provider.d.ts +46 -0
- package/dist/services/knowledge/http-provider.d.ts.map +1 -0
- package/dist/services/knowledge/http-provider.js +254 -0
- package/dist/services/knowledge/http-provider.js.map +1 -0
- package/dist/services/knowledge/kb-providers.d.ts +15 -0
- package/dist/services/knowledge/kb-providers.d.ts.map +1 -0
- package/dist/services/knowledge/kb-providers.js +92 -0
- package/dist/services/knowledge/kb-providers.js.map +1 -0
- package/dist/services/knowledge/kb-scope-input.d.ts +5 -0
- package/dist/services/knowledge/kb-scope-input.d.ts.map +1 -0
- package/dist/services/knowledge/kb-scope-input.js +11 -0
- package/dist/services/knowledge/kb-scope-input.js.map +1 -0
- package/dist/services/knowledge/kb-service.d.ts +3 -0
- package/dist/services/knowledge/kb-service.d.ts.map +1 -0
- package/dist/services/knowledge/kb-service.js +2 -0
- package/dist/services/knowledge/kb-service.js.map +1 -0
- package/dist/services/knowledge/path-validation.d.ts +2 -0
- package/dist/services/knowledge/path-validation.d.ts.map +1 -0
- package/dist/services/knowledge/path-validation.js +13 -0
- package/dist/services/knowledge/path-validation.js.map +1 -0
- package/dist/services/knowledge/pre-init.d.ts +14 -0
- package/dist/services/knowledge/pre-init.d.ts.map +1 -0
- package/dist/services/knowledge/pre-init.js +147 -0
- package/dist/services/knowledge/pre-init.js.map +1 -0
- package/dist/services/knowledge/project-slug.d.ts +2 -0
- package/dist/services/knowledge/project-slug.d.ts.map +1 -0
- package/dist/services/knowledge/project-slug.js +49 -0
- package/dist/services/knowledge/project-slug.js.map +1 -0
- package/dist/services/knowledge/sqlite-provider.d.ts +147 -0
- package/dist/services/knowledge/sqlite-provider.d.ts.map +1 -0
- package/dist/services/knowledge/sqlite-provider.js +1646 -0
- package/dist/services/knowledge/sqlite-provider.js.map +1 -0
- package/dist/services/knowledge/types.d.ts +163 -0
- package/dist/services/knowledge/types.d.ts.map +1 -0
- package/dist/services/knowledge/types.js +9 -0
- package/dist/services/knowledge/types.js.map +1 -0
- package/dist/services/member-home.d.ts +89 -0
- package/dist/services/member-home.d.ts.map +1 -0
- package/dist/services/member-home.js +256 -0
- package/dist/services/member-home.js.map +1 -0
- package/dist/services/member-remote-url.d.ts +34 -0
- package/dist/services/member-remote-url.d.ts.map +1 -0
- package/dist/services/member-remote-url.js +39 -0
- package/dist/services/member-remote-url.js.map +1 -0
- package/dist/services/orphan-recovery.d.ts +5 -2
- package/dist/services/orphan-recovery.d.ts.map +1 -1
- package/dist/services/orphan-recovery.js +19 -8
- package/dist/services/orphan-recovery.js.map +1 -1
- package/dist/services/preflight-check.d.ts +56 -0
- package/dist/services/preflight-check.d.ts.map +1 -0
- package/dist/services/preflight-check.js +277 -0
- package/dist/services/preflight-check.js.map +1 -0
- package/dist/services/stall/log-path-resolver.d.ts +11 -8
- package/dist/services/stall/log-path-resolver.d.ts.map +1 -1
- package/dist/services/stall/log-path-resolver.js +17 -40
- package/dist/services/stall/log-path-resolver.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts +32 -0
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +149 -6
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts +34 -0
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +134 -2
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +2 -2
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/tool-registry.d.ts.map +1 -1
- package/dist/services/tool-registry.js +87 -1
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/vcs/github.d.ts.map +1 -1
- package/dist/services/vcs/github.js +32 -1
- package/dist/services/vcs/github.js.map +1 -1
- package/dist/services/version-check.d.ts +22 -0
- package/dist/services/version-check.d.ts.map +1 -0
- package/dist/services/version-check.js +103 -0
- package/dist/services/version-check.js.map +1 -0
- package/dist/skills/fleet-sprint-cli/SKILL.md +13 -2
- package/dist/skills/pm/beads.md +6 -0
- package/dist/skills/pm/fleet-addendum.md +6 -0
- package/dist/skills/pm/index.md +56 -0
- package/dist/skills/pm/kb-reconcile.md +132 -0
- package/dist/skills/pm/kb-review.md +109 -0
- package/dist/tools/check-status.d.ts +47 -0
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +242 -0
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/code-intelligence-codebase-memory.d.ts +11 -0
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +1 -0
- package/dist/tools/code-intelligence-codebase-memory.js +270 -0
- package/dist/tools/code-intelligence-codebase-memory.js.map +1 -0
- package/dist/tools/code-intelligence-freshness.d.ts +2 -0
- package/dist/tools/code-intelligence-freshness.d.ts.map +1 -0
- package/dist/tools/code-intelligence-freshness.js +26 -0
- package/dist/tools/code-intelligence-freshness.js.map +1 -0
- package/dist/tools/code-intelligence-gitnexus.d.ts +14 -0
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +1 -0
- package/dist/tools/code-intelligence-gitnexus.js +475 -0
- package/dist/tools/code-intelligence-gitnexus.js.map +1 -0
- package/dist/tools/code-intelligence-kb-enrich.d.ts +2 -0
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +1 -0
- package/dist/tools/code-intelligence-kb-enrich.js +65 -0
- package/dist/tools/code-intelligence-kb-enrich.js.map +1 -0
- package/dist/tools/code-intelligence-reindex.d.ts +7 -0
- package/dist/tools/code-intelligence-reindex.d.ts.map +1 -0
- package/dist/tools/code-intelligence-reindex.js +106 -0
- package/dist/tools/code-intelligence-reindex.js.map +1 -0
- package/dist/tools/code-intelligence-telemetry.d.ts +5 -0
- package/dist/tools/code-intelligence-telemetry.d.ts.map +1 -0
- package/dist/tools/code-intelligence-telemetry.js +52 -0
- package/dist/tools/code-intelligence-telemetry.js.map +1 -0
- package/dist/tools/code-intelligence-tests.d.ts +2 -0
- package/dist/tools/code-intelligence-tests.d.ts.map +1 -0
- package/dist/tools/code-intelligence-tests.js +24 -0
- package/dist/tools/code-intelligence-tests.js.map +1 -0
- package/dist/tools/code-intelligence.d.ts +114 -0
- package/dist/tools/code-intelligence.d.ts.map +1 -0
- package/dist/tools/code-intelligence.js +124 -0
- package/dist/tools/code-intelligence.js.map +1 -0
- package/dist/tools/compose-permissions.d.ts +26 -0
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +244 -33
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/execute-command.d.ts +2 -0
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +86 -16
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +13 -1
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +257 -45
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/kb-capture.d.ts +53 -0
- package/dist/tools/kb-capture.d.ts.map +1 -0
- package/dist/tools/kb-capture.js +130 -0
- package/dist/tools/kb-capture.js.map +1 -0
- package/dist/tools/kb-context.d.ts +17 -0
- package/dist/tools/kb-context.d.ts.map +1 -0
- package/dist/tools/kb-context.js +29 -0
- package/dist/tools/kb-context.js.map +1 -0
- package/dist/tools/kb-export.d.ts +19 -0
- package/dist/tools/kb-export.d.ts.map +1 -0
- package/dist/tools/kb-export.js +344 -0
- package/dist/tools/kb-export.js.map +1 -0
- package/dist/tools/kb-feedback.d.ts +23 -0
- package/dist/tools/kb-feedback.d.ts.map +1 -0
- package/dist/tools/kb-feedback.js +43 -0
- package/dist/tools/kb-feedback.js.map +1 -0
- package/dist/tools/kb-freshness-sweep.d.ts +14 -0
- package/dist/tools/kb-freshness-sweep.d.ts.map +1 -0
- package/dist/tools/kb-freshness-sweep.js +29 -0
- package/dist/tools/kb-freshness-sweep.js.map +1 -0
- package/dist/tools/kb-harvest.d.ts +20 -0
- package/dist/tools/kb-harvest.d.ts.map +1 -0
- package/dist/tools/kb-harvest.js +143 -0
- package/dist/tools/kb-harvest.js.map +1 -0
- package/dist/tools/kb-import.d.ts +44 -0
- package/dist/tools/kb-import.d.ts.map +1 -0
- package/dist/tools/kb-import.js +239 -0
- package/dist/tools/kb-import.js.map +1 -0
- package/dist/tools/kb-invalidate.d.ts +19 -0
- package/dist/tools/kb-invalidate.d.ts.map +1 -0
- package/dist/tools/kb-invalidate.js +34 -0
- package/dist/tools/kb-invalidate.js.map +1 -0
- package/dist/tools/kb-list.d.ts +32 -0
- package/dist/tools/kb-list.d.ts.map +1 -0
- package/dist/tools/kb-list.js +43 -0
- package/dist/tools/kb-list.js.map +1 -0
- package/dist/tools/kb-promote.d.ts +20 -0
- package/dist/tools/kb-promote.d.ts.map +1 -0
- package/dist/tools/kb-promote.js +20 -0
- package/dist/tools/kb-promote.js.map +1 -0
- package/dist/tools/kb-query.d.ts +35 -0
- package/dist/tools/kb-query.d.ts.map +1 -0
- package/dist/tools/kb-query.js +111 -0
- package/dist/tools/kb-query.js.map +1 -0
- package/dist/tools/kb-reconcile-prefilter.d.ts +14 -0
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -0
- package/dist/tools/kb-reconcile-prefilter.js +26 -0
- package/dist/tools/kb-reconcile-prefilter.js.map +1 -0
- package/dist/tools/kb-resolve-contradiction.d.ts +23 -0
- package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -0
- package/dist/tools/kb-resolve-contradiction.js +37 -0
- package/dist/tools/kb-resolve-contradiction.js.map +1 -0
- package/dist/tools/kb-session-prime.d.ts +26 -0
- package/dist/tools/kb-session-prime.d.ts.map +1 -0
- package/dist/tools/kb-session-prime.js +392 -0
- package/dist/tools/kb-session-prime.js.map +1 -0
- package/dist/tools/kb-setup.d.ts +20 -0
- package/dist/tools/kb-setup.d.ts.map +1 -0
- package/dist/tools/kb-setup.js +49 -0
- package/dist/tools/kb-setup.js.map +1 -0
- package/dist/tools/kb-stats.d.ts +20 -0
- package/dist/tools/kb-stats.d.ts.map +1 -0
- package/dist/tools/kb-stats.js +115 -0
- package/dist/tools/kb-stats.js.map +1 -0
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +8 -0
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/monitor-task.d.ts.map +1 -1
- package/dist/tools/monitor-task.js +21 -3
- package/dist/tools/monitor-task.js.map +1 -1
- package/dist/tools/provision-auth.d.ts.map +1 -1
- package/dist/tools/provision-auth.js +10 -3
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +3 -0
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +30 -1
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts.map +1 -1
- package/dist/tools/remove-member.js +17 -3
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/report-status.d.ts.map +1 -1
- package/dist/tools/report-status.js +2 -1
- package/dist/tools/report-status.js.map +1 -1
- package/dist/tools/send-email.d.ts +69 -0
- package/dist/tools/send-email.d.ts.map +1 -0
- package/dist/tools/send-email.js +177 -0
- package/dist/tools/send-email.js.map +1 -0
- package/dist/tools/setup-ssh-key.d.ts.map +1 -1
- package/dist/tools/setup-ssh-key.js +2 -0
- package/dist/tools/setup-ssh-key.js.map +1 -1
- package/dist/tools/update-member.d.ts +3 -0
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +25 -1
- package/dist/tools/update-member.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +1 -1
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/session-caller.d.ts +28 -0
- package/dist/utils/session-caller.d.ts.map +1 -0
- package/dist/utils/session-caller.js +24 -0
- package/dist/utils/session-caller.js.map +1 -0
- package/dist/utils/work-folder-validation.d.ts +39 -0
- package/dist/utils/work-folder-validation.d.ts.map +1 -0
- package/dist/utils/work-folder-validation.js +60 -0
- package/dist/utils/work-folder-validation.js.map +1 -0
- package/dist/workflows/auto-sprint.js +546 -6
- package/package.json +7 -4
- package/packages/apra-fleet-client/src/client/api.mjs +118 -4
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +17 -1
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +13 -1
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +15 -3
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +35 -1
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +22 -3
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +18 -2
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +216 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +14 -1
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +88 -5
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +19 -1
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +104 -3
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +63 -3
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +59 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +2 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/kb-reconciler-output.json +87 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +65 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +105 -8
- package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +6 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +6 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +56 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +132 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +109 -0
- package/packages/apra-fleet-se/bin/cli.mjs +7 -0
- package/packages/apra-fleet-se/bin/serve.mjs +14 -2
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +31 -5
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +23 -151
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-manual-recovery-verified.md +256 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +1482 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +908 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +399 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +972 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +167 -101
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +50 -6
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1416 -116
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +13 -2
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +350 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-progress.mjs +101 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +30 -17
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +62 -2
- package/packages/apra-fleet-se/package.json +1 -0
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +127 -13
- package/packages/apra-fleet-workflow/src/viewer/run-title.mjs +60 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +8 -4
- package/skills/fleet/knowledge-agent.md +66 -0
- package/skills/fleet/permissions.md +28 -4
- package/skills/fleet/profiles/base-dev.json +10 -1
- package/skills/fleet/profiles/base-reviewer.json +8 -1
- package/skills/fleet/profiles/tag-kb-reconciler.json +20 -0
- package/version.json +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-tier2-runbook.md +0 -127
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-path-b.mjs +0 -339
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-tier2.mjs +0 -360
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery.mjs +0 -363
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Project Index
|
|
2
|
+
|
|
3
|
+
Index the project repo for code intelligence so fleet members can use
|
|
4
|
+
code_graph, code_impact, code_query, and code_context tools.
|
|
5
|
+
|
|
6
|
+
## Flow
|
|
7
|
+
|
|
8
|
+
1. Read `<project>/status.md` to find the repo path and an available member.
|
|
9
|
+
2. Pick any online member whose work_folder is the project repo. If no member
|
|
10
|
+
is pointed at the repo, use any local online member and set `run_from` to
|
|
11
|
+
the repo path.
|
|
12
|
+
3. Run via `execute_command` (wrap in background Agent per fleet rules):
|
|
13
|
+
```
|
|
14
|
+
npx gitnexus analyze --embeddings
|
|
15
|
+
```
|
|
16
|
+
- `run_from`: project repo root
|
|
17
|
+
- `timeout_s`: 300 (indexing large repos can take a minute)
|
|
18
|
+
4. Report the result: nodes indexed, edges, flows (gitnexus prints this on
|
|
19
|
+
completion). If gitnexus is not installed, it will be fetched automatically
|
|
20
|
+
via npx.
|
|
21
|
+
5. Non-fatal: if the command fails (e.g. no package.json, unsupported language),
|
|
22
|
+
log the error and tell the user -- do not block the sprint.
|
|
23
|
+
|
|
24
|
+
## The `--embeddings` flag
|
|
25
|
+
|
|
26
|
+
- Enables semantic embedding generation using a LOCAL ONNX CPU model
|
|
27
|
+
(`Snowflake/snowflake-arctic-embed-xs`, 384-dim) bundled with gitnexus --
|
|
28
|
+
no API key, no external service, no config needed.
|
|
29
|
+
- One-time cost: the first `--embeddings` run on a machine downloads the
|
|
30
|
+
model (~87 MB) from HuggingFace and caches it at `~/.cache/huggingface`;
|
|
31
|
+
every run after that is offline.
|
|
32
|
+
- Embeddings are OFF by default and PRESERVED across a plain `analyze`
|
|
33
|
+
(only `--drop-embeddings` removes them), so passing `--embeddings` here is
|
|
34
|
+
additive and safe to run repeatedly.
|
|
35
|
+
- win32 caveat: on Windows, LadybugDB's VECTOR index is unavailable, so
|
|
36
|
+
semantic search falls back to an exact scan (capped at 10000 chunks) --
|
|
37
|
+
this still works, it is just brute-force rather than an ANN index. Not a
|
|
38
|
+
blocker; see `docs/code-intelligence-embeddings.md` for the full
|
|
39
|
+
investigation.
|
|
40
|
+
|
|
41
|
+
## When to run
|
|
42
|
+
|
|
43
|
+
- **Automatically inside `/pm init`** -- runs as the final step of project initialization.
|
|
44
|
+
The worktree must exist before indexing (gitnexus needs files on disk to analyze).
|
|
45
|
+
- **Automatically at VERIFY checkpoints** -- checkpoints re-run npx gitnexus analyze to keep
|
|
46
|
+
mid-sprint symbols visible to later phases (incremental via fileHashes in .gitnexus/meta.json,
|
|
47
|
+
takes seconds).
|
|
48
|
+
- After a large merge or rebase that changes many files
|
|
49
|
+
- When `kb_session_prime` returns many stale entries
|
|
50
|
+
- Any time the user asks to re-index (run `/pm index` explicitly)
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
- Indexing is per-repo and persists on disk -- subsequent runs are incremental.
|
|
55
|
+
- The index is used by the gitnexus provider behind code_graph/impact/query/context.
|
|
56
|
+
- Fleet members never call gitnexus directly -- they use the fleet tools.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# /pm kb-reconcile
|
|
2
|
+
|
|
3
|
+
Reconcile a warm local KB against a merged bible after two or more branches
|
|
4
|
+
land -- absorb the incoming knowledge, revive entries whose basis matches
|
|
5
|
+
the merged worktree again, mechanically settle contradictions a file hash
|
|
6
|
+
can decide, and dispatch a reconciler agent for the rest. Ends with the
|
|
7
|
+
canonical bible re-exported so the merged branch's KB reflects merged truth.
|
|
8
|
+
|
|
9
|
+
## When to run
|
|
10
|
+
|
|
11
|
+
- After merging branches (including this sprint's own PR merging into its
|
|
12
|
+
base) -- as a standalone command, or as the post-merge hook inside
|
|
13
|
+
`/pm cleanup` (see SKILL.md's completion flow).
|
|
14
|
+
- Any time a local KB needs to catch up with a `.fleet/kb-canonical.json`
|
|
15
|
+
bible produced elsewhere (a teammate's branch, a different worktree) --
|
|
16
|
+
whether or not a formal merge just happened.
|
|
17
|
+
- Periodically, alongside `/pm kb-review`, as KB hygiene.
|
|
18
|
+
|
|
19
|
+
## Trust boundary (state honestly, do not skip)
|
|
20
|
+
|
|
21
|
+
Step 1 (`kb_import`) reads a bible file. Importing the repo-resolved
|
|
22
|
+
`.fleet/kb-canonical.json` is the git-reviewed, human-merged trusted channel
|
|
23
|
+
-- non-directive entries there keep their bible confidence. An explicit
|
|
24
|
+
`--path` bible is CALLER-ASSERTED trust: equivalent in power to the
|
|
25
|
+
already-exposed `kb_promote` surface (which can walk any entry
|
|
26
|
+
`INFERRED -> CONFIRMED` one call at a time), not a new privilege class.
|
|
27
|
+
`type: 'user-directive'` entries are quarantined to pending proposals either
|
|
28
|
+
way -- a bible can never smuggle an active directive; activation stays
|
|
29
|
+
CLI-only (`apra-fleet kb approve-directive`).
|
|
30
|
+
|
|
31
|
+
## Steps
|
|
32
|
+
|
|
33
|
+
### Step 1: Import the merged bible
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
kb_import({ repo: "<merged worktree path>" })
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
or the CLI equivalent, `apra-fleet kb import --repo <path>`, for a human
|
|
40
|
+
running this post-merge by hand. Omit `path` to resolve
|
|
41
|
+
`<repo>/.fleet/kb-canonical.json` (the trusted channel); pass an explicit
|
|
42
|
+
`path` only when importing a bible from somewhere else (caller-asserted
|
|
43
|
+
trust, see above).
|
|
44
|
+
|
|
45
|
+
Report: `{ imported, skipped, linked, flagged, sweep }`. `kb_import`
|
|
46
|
+
already runs a freshness sweep internally at the end of its own run, scoped
|
|
47
|
+
to the imported entries' impact -- Step 2 below is still worth running
|
|
48
|
+
explicitly (see its note).
|
|
49
|
+
|
|
50
|
+
### Step 2: Freshness sweep
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
kb_freshness_sweep()
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Re-hashes EVERY entry in the KB that carries a stored basis against the
|
|
57
|
+
CURRENT (merged) worktree -- not just the entries `kb_import` just touched.
|
|
58
|
+
Un-stales matches (the D2 predicate still excludes superseded, downvoted, and
|
|
59
|
+
invalidated entries from revival), stales mismatches. This is what actually
|
|
60
|
+
performs branch-switch revival: `kb_session_prime`'s candidate set excludes
|
|
61
|
+
stale entries by definition, so priming alone can never revive anything.
|
|
62
|
+
|
|
63
|
+
Idempotent, and worth running explicitly even right after `kb_import` (whose
|
|
64
|
+
internal sweep covers the same ground) because it also covers the
|
|
65
|
+
reconcile-WITHOUT-import path -- e.g. re-running `/pm kb-reconcile` after
|
|
66
|
+
just switching worktree state with no new bible to import.
|
|
67
|
+
|
|
68
|
+
No sweep is needed AFTER Step 3 or Step 4 below: `kb_resolve_contradiction`
|
|
69
|
+
sets each winner's final stale state itself, including the predicate-guarded
|
|
70
|
+
un-stale check, as part of resolving the pair (hardened D4) -- a
|
|
71
|
+
post-resolution sweep would be redundant.
|
|
72
|
+
|
|
73
|
+
### Step 3: Hash prefilter
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
kb_reconcile_prefilter()
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
For every remaining flagged contradiction pair (`flaggedPairs()` -- this
|
|
80
|
+
INCLUDES stale members; the imported side of a pair is typically stale
|
|
81
|
+
right after Step 1/2, and that is exactly the case this step exists to
|
|
82
|
+
resolve), re-hashes both sides' full source-file bases against the CURRENT
|
|
83
|
+
worktree. Exactly one side fully matching wins mechanically, via the same
|
|
84
|
+
`kb_resolve_contradiction` write path the reconciler agent uses (evidence:
|
|
85
|
+
`"hash-basis match on merged worktree"`). Pairs where both sides match, both
|
|
86
|
+
mismatch, either has an empty/missing basis, or either side is an ACTIVE
|
|
87
|
+
user-directive are left untouched for Step 4.
|
|
88
|
+
|
|
89
|
+
Report: `{ pairs, resolved, left_for_agent, skipped_directive }`.
|
|
90
|
+
|
|
91
|
+
### Step 4: Reconciler agent
|
|
92
|
+
|
|
93
|
+
If `left_for_agent` is non-empty, dispatch the `kb-reconciler` agent
|
|
94
|
+
(`agents/kb-reconciler.md`, model tier cheap/standard)
|
|
95
|
+
with that array. It reads the MERGED code via `code_context`/`code_impact`/
|
|
96
|
+
`code_query` (never Glob/Grep) for each remaining pair, resolves what the
|
|
97
|
+
code decides via `kb_resolve_contradiction`, falls back to a trust-tier
|
|
98
|
+
tiebreak (`CONFIRMED > INFERRED > UNVERIFIED`) when the code is silent, and
|
|
99
|
+
leaves genuinely undecidable pairs flagged for `/pm kb-review`. Active
|
|
100
|
+
user-directives are NEVER auto-retired. See `agents/kb-reconciler.md` for the
|
|
101
|
+
full process and the single-write-path rule.
|
|
102
|
+
|
|
103
|
+
If `left_for_agent` is empty, skip straight to Step 5.
|
|
104
|
+
|
|
105
|
+
### Step 5: Export
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
kb_export()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Writes every live `CONFIRMED` project entry -- which now includes every
|
|
112
|
+
mechanical and agent-resolved winner -- to `.fleet/kb-canonical.json` and
|
|
113
|
+
auto-commits it (pathspec-only, identity `pm-kb`, non-fatal on any git
|
|
114
|
+
failure). This is existing `kb_export` machinery; no new commit step is
|
|
115
|
+
needed here. Push is not automatic; it rides the normal sprint push cadence.
|
|
116
|
+
|
|
117
|
+
## Report
|
|
118
|
+
|
|
119
|
+
After all steps:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
/pm kb-reconcile complete.
|
|
123
|
+
Import: imported=<n> skipped=<n> linked=<n> flagged=<n>
|
|
124
|
+
Sweep: checked=<n> staled=<n> unstaled=<n>
|
|
125
|
+
Prefilter: pairs=<n> resolved=<n> left_for_agent=<n> skipped_directive=<n>
|
|
126
|
+
Reconciler: codeDecided=<n> tierDecided=<n> deferred=<n> (omitted if Step 4 was skipped)
|
|
127
|
+
Export: exported=<n> committed=<true|false>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Any `deferred` pairs from the reconciler, and any pair `kb_reconcile_prefilter`
|
|
131
|
+
skipped for an active directive, are handled the same way as any other
|
|
132
|
+
flagged entry going forward: surface them next time `/pm kb-review` runs.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# /pm kb-review
|
|
2
|
+
|
|
3
|
+
Surface all contradiction-flagged KB entries and resolve them interactively.
|
|
4
|
+
|
|
5
|
+
Note: `/pm kb-review` also surfaces pending `user-directive` proposals (via
|
|
6
|
+
`kb_query({ flagged_only: true })`) and instructs the human to run
|
|
7
|
+
`apra-fleet kb approve-directive <id>` or `reject-directive <id>` -- these are
|
|
8
|
+
CLI-only resolutions, never `kb_promote`.
|
|
9
|
+
|
|
10
|
+
## When to run
|
|
11
|
+
|
|
12
|
+
- After any sprint completes, as part of KB hygiene.
|
|
13
|
+
- When an agent reports a `flagged` audn_decision from `kb_capture`.
|
|
14
|
+
- Periodically, to keep the KB free of unresolved contradictions.
|
|
15
|
+
|
|
16
|
+
## Steps
|
|
17
|
+
|
|
18
|
+
### Step 1: Fetch flagged entries
|
|
19
|
+
|
|
20
|
+
Call `kb_query(flagged_only=true)`.
|
|
21
|
+
|
|
22
|
+
- If the response says "No flagged contradictions found -- KB is clean.", report that to the user and stop.
|
|
23
|
+
- Otherwise, collect all returned entries.
|
|
24
|
+
|
|
25
|
+
### Step 2: Group into contradiction pairs
|
|
26
|
+
|
|
27
|
+
For each entry with `contradiction_of` set, pair it with the entry whose `id` matches `contradiction_of`.
|
|
28
|
+
Entries with `flagged_for_review=true` and no `contradiction_of` are the original (challenged) entries.
|
|
29
|
+
|
|
30
|
+
Group: `{ original: entry_A, challenger: entry_B }` where `entry_B.contradiction_of = entry_A.id`.
|
|
31
|
+
|
|
32
|
+
### Step 3: Present each pair to the user
|
|
33
|
+
|
|
34
|
+
For each pair, show:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Contradiction pair (N of M):
|
|
38
|
+
|
|
39
|
+
[ORIGINAL] id: <id> confidence: <confidence> created: <created_at>
|
|
40
|
+
Title: <title>
|
|
41
|
+
Summary: <summary>
|
|
42
|
+
Content: <content>
|
|
43
|
+
|
|
44
|
+
[CHALLENGER] id: <id> confidence: <confidence> created: <created_at>
|
|
45
|
+
Title: <title>
|
|
46
|
+
Summary: <summary>
|
|
47
|
+
Content: <content>
|
|
48
|
+
|
|
49
|
+
Resolution options:
|
|
50
|
+
A - Keep original, discard challenger
|
|
51
|
+
B - Keep challenger, discard original
|
|
52
|
+
M - Merge both into a new entry (you provide merged content)
|
|
53
|
+
D - Delete both (neither is correct)
|
|
54
|
+
S - Skip (defer to later)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Wait for the user's response before proceeding to the next pair.
|
|
58
|
+
|
|
59
|
+
### Step 4: Apply resolution
|
|
60
|
+
|
|
61
|
+
Supersede is OPT-IN: you must name the entry you are retiring via
|
|
62
|
+
`supersedes=<id>`. It is honored only when AUDN independently matches that same
|
|
63
|
+
entry (same type, overlapping symbols and source_files), so the corrective
|
|
64
|
+
capture must still carry the SAME title/symbols/source_files as its target --
|
|
65
|
+
otherwise nothing is retired and you get a second live entry instead. A capture
|
|
66
|
+
without `supersedes` never retires anything.
|
|
67
|
+
|
|
68
|
+
**A -- Keep original:**
|
|
69
|
+
- `kb_promote(original.id, reason="contradiction resolved: original kept")` -- upgrades its confidence.
|
|
70
|
+
- `kb_capture` a new entry with the SAME title/symbols/source_files as the challenger, corrected content that carries no contradiction keyword or polarity word (or AUDN will flag it again instead of updating), `confidence=UNVERIFIED`, and `supersedes=<challenger.id>`. That retires the challenger.
|
|
71
|
+
|
|
72
|
+
**B -- Keep challenger:**
|
|
73
|
+
- `kb_promote(challenger.id, reason="contradiction resolved: challenger kept")`.
|
|
74
|
+
- `kb_capture` a corrected entry with the SAME title/symbols/source_files as the original, corrected content free of contradiction/polarity words, and `supersedes=<original.id>`. That retires the original.
|
|
75
|
+
|
|
76
|
+
**M -- Merge:**
|
|
77
|
+
- Ask the user to provide the merged content.
|
|
78
|
+
- `kb_capture` a new entry with merged content and `supersedes=<id of whichever entry it replaces>`. Repeat for the second entry if both must be retired -- `supersedes` names ONE entry, so retiring both takes two captures.
|
|
79
|
+
- `kb_promote` the newly captured entry id.
|
|
80
|
+
|
|
81
|
+
**D -- Delete both:**
|
|
82
|
+
- `kb_capture` a retraction entry: `title=<original title>`, `content="Retracted: neither entry describes current behavior."` (no contradiction keyword or polarity word, or AUDN will flag it again instead of updating), `confidence=UNVERIFIED`, `supersedes=<original.id>`.
|
|
83
|
+
- `kb_capture` same for the challenger, with `supersedes=<challenger.id>`.
|
|
84
|
+
|
|
85
|
+
**S -- Skip:**
|
|
86
|
+
- No action. Note it in the session summary.
|
|
87
|
+
|
|
88
|
+
**Verified actual behavior (T3.7, F11 e2e proof) -- read this before reporting "resolved":**
|
|
89
|
+
- Superseding an entry (via the corrective `kb_capture` above with `supersedes` set, AUDN decision `update`) sets its `superseded_at` and `stale=1`. That entry then drops out of every future `kb_query({flagged_only:true})` listing -- the tool always excludes superseded entries.
|
|
90
|
+
- `kb_promote` does **NOT** clear `flagged_for_review` and does **NOT** clear `contradiction_of`. This means the entry you KEPT (promoted, not superseded) stays visible in `kb_query({flagged_only:true})` forever -- it is not automatically delisted just because it was resolved. Do not expect the pair to fully disappear from the flagged list; expect only the superseded side to disappear. Recognize an already-resolved pair by its counterpart's absence (or by checking `promoted_at`/`confidence` on the id you kept), not by the pair vanishing entirely.
|
|
91
|
+
- A `kb_feedback`-downvoted entry (`stale=1` + `flagged_for_review=1`, never superseded) stays listed under `flagged_only` until it is separately resolved the same way -- superseded via a corrective capture, or otherwise retired. Simply promoting a *different* entry never clears it.
|
|
92
|
+
|
|
93
|
+
### Step 5: Report
|
|
94
|
+
|
|
95
|
+
After all pairs are processed, report:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
KB Review complete.
|
|
99
|
+
- Pairs resolved: N
|
|
100
|
+
- Pairs skipped: M
|
|
101
|
+
- Total flagged entries cleared: K
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
"Cleared" here means the SUPERSEDED side of each resolved pair (the one whose
|
|
105
|
+
`superseded_at` got set) -- per the verified behavior in Step 4, the kept/
|
|
106
|
+
promoted side of a resolved pair remains in `kb_query({flagged_only:true})`
|
|
107
|
+
indefinitely, so K is normally N, not 2N. Do not report a pair as fully gone
|
|
108
|
+
from the flagged list; report it as resolved (one side superseded, the other
|
|
109
|
+
promoted).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { type VersionMismatch } from '../services/version-check.js';
|
|
2
3
|
export declare const fleetStatusSchema: z.ZodObject<{
|
|
3
4
|
format: z.ZodDefault<z.ZodEnum<["compact", "json"]>>;
|
|
4
5
|
}, "strip", z.ZodTypeAny, {
|
|
@@ -6,6 +7,52 @@ export declare const fleetStatusSchema: z.ZodObject<{
|
|
|
6
7
|
}, {
|
|
7
8
|
format?: "compact" | "json" | undefined;
|
|
8
9
|
}>;
|
|
10
|
+
export interface TopSymbol {
|
|
11
|
+
target: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}
|
|
14
|
+
export interface CodeIntelligenceHealth {
|
|
15
|
+
present: boolean;
|
|
16
|
+
nodes?: number;
|
|
17
|
+
edges?: number;
|
|
18
|
+
files?: number;
|
|
19
|
+
indexedAt?: string;
|
|
20
|
+
lastCommit?: string;
|
|
21
|
+
headStatus?: 'matching' | 'behind' | 'unavailable';
|
|
22
|
+
commitsBehind?: number;
|
|
23
|
+
topSymbols?: TopSymbol[];
|
|
24
|
+
}
|
|
25
|
+
export declare function computeTopSymbols(now?: number, usagePath?: string, rotatedUsagePath?: string): TopSymbol[] | undefined;
|
|
26
|
+
export declare function codeIntelligenceHealth(repoDir: string): CodeIntelligenceHealth;
|
|
27
|
+
/** Render the one-line compact fleet_status code intelligence summary. */
|
|
28
|
+
export declare function codeIntelligenceCompactLine(health: CodeIntelligenceHealth): string;
|
|
29
|
+
export interface KbHealthBible {
|
|
30
|
+
present: boolean;
|
|
31
|
+
entries: number;
|
|
32
|
+
drift: number;
|
|
33
|
+
}
|
|
34
|
+
export interface KbHealth {
|
|
35
|
+
totals: {
|
|
36
|
+
by_confidence: Record<string, number>;
|
|
37
|
+
by_type: Record<string, number>;
|
|
38
|
+
total: number;
|
|
39
|
+
};
|
|
40
|
+
stale: number;
|
|
41
|
+
flagged: number;
|
|
42
|
+
superseded: number;
|
|
43
|
+
retrieval: {
|
|
44
|
+
entries_retrieved: number;
|
|
45
|
+
total_uses: number;
|
|
46
|
+
hit_rate: number | null;
|
|
47
|
+
};
|
|
48
|
+
promote_ratio: number | null;
|
|
49
|
+
bible: KbHealthBible;
|
|
50
|
+
}
|
|
51
|
+
/** Read kb_stats and shape it for fleet_status. Never throws -- any failure (DB unavailable, bad JSON) yields null so the caller omits the KB section entirely. */
|
|
52
|
+
export declare function kbHealthSummary(): Promise<KbHealth | null>;
|
|
53
|
+
/** Render the one-line compact fleet_status KB health summary. */
|
|
54
|
+
export declare function kbHealthCompactLine(health: KbHealth): string;
|
|
55
|
+
export declare function versionMismatchCompactLine(mismatch: VersionMismatch): string;
|
|
9
56
|
export type FleetStatusInput = z.infer<typeof fleetStatusSchema>;
|
|
10
57
|
export declare function fleetStatus(input?: FleetStatusInput): Promise<string>;
|
|
11
58
|
//# sourceMappingURL=check-status.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-status.d.ts","sourceRoot":"","sources":["../../src/tools/check-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"check-status.d.ts","sourceRoot":"","sources":["../../src/tools/check-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAqBxB,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAE1F,eAAO,MAAM,iBAAiB;;;;;;EAE5B,CAAC;AA2LH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,GAAG,QAAQ,GAAG,aAAa,CAAC;IACnD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,SAAS,EAAE,CAAC;CAC1B;AA0DD,wBAAgB,iBAAiB,CAC/B,GAAG,GAAE,MAAmB,EACxB,SAAS,GAAE,MAAuB,EAClC,gBAAgB,GAAE,MAA+B,GAChD,SAAS,EAAE,GAAG,SAAS,CA4BzB;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,sBAAsB,CAsC9E;AAqBD,0EAA0E;AAC1E,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,sBAAsB,GAAG,MAAM,CASlF;AAQD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAClG,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IACtF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,EAAE,aAAa,CAAC;CACtB;AAED,mKAAmK;AACnK,wBAAsB,eAAe,IAAI,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAOhE;AAWD,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAK5D;AASD,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAE5E;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,wBAAsB,WAAW,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAkK3E"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { existsSync, readFileSync } from 'fs';
|
|
3
|
+
import { execFileSync } from 'child_process';
|
|
4
|
+
import { join } from 'path';
|
|
2
5
|
import { getAllAgents } from '../services/registry.js';
|
|
3
6
|
import { getStrategy } from '../services/strategy.js';
|
|
4
7
|
import { getOsCommands } from '../os/index.js';
|
|
@@ -14,6 +17,9 @@ import { estimateCost, hourlyRate, formatUptimeDuration, uptimeHoursFromLaunch,
|
|
|
14
17
|
import { parseGpuUtilization } from '../utils/gpu-parser.js';
|
|
15
18
|
import { getUpdateNotice } from '../services/update-check.js';
|
|
16
19
|
import { getActiveLogFile } from '../utils/log-helpers.js';
|
|
20
|
+
import { USAGE_LOG_PATH, ROTATED_USAGE_LOG_PATH } from './code-intelligence-telemetry.js';
|
|
21
|
+
import { kbStats } from './kb-stats.js';
|
|
22
|
+
import { checkVersionMismatch } from '../services/version-check.js';
|
|
17
23
|
export const fleetStatusSchema = z.object({
|
|
18
24
|
format: z.enum(['compact', 'json']).default('compact').describe('Output format: "compact" (default, few lines) or "json" (structured data for detailed rendering)'),
|
|
19
25
|
});
|
|
@@ -157,6 +163,189 @@ async function checkAgent(agent) {
|
|
|
157
163
|
}
|
|
158
164
|
return row;
|
|
159
165
|
}
|
|
166
|
+
function readGitNexusMeta(repoDir) {
|
|
167
|
+
const metaPath = join(repoDir, '.gitnexus', 'meta.json');
|
|
168
|
+
if (!existsSync(metaPath))
|
|
169
|
+
return null;
|
|
170
|
+
try {
|
|
171
|
+
return JSON.parse(readFileSync(metaPath, 'utf-8'));
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function currentHead(repoDir) {
|
|
178
|
+
try {
|
|
179
|
+
return execFileSync('git', ['rev-parse', 'HEAD'], {
|
|
180
|
+
cwd: repoDir, encoding: 'utf-8', timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
181
|
+
}).trim();
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
function commitsBehindCount(repoDir, lastCommit, head) {
|
|
188
|
+
try {
|
|
189
|
+
const out = execFileSync('git', ['rev-list', '--count', `${lastCommit}..${head}`], {
|
|
190
|
+
cwd: repoDir, encoding: 'utf-8', timeout: 3000, stdio: ['ignore', 'pipe', 'ignore'],
|
|
191
|
+
}).trim();
|
|
192
|
+
const count = Number.parseInt(out, 10);
|
|
193
|
+
return Number.isFinite(count) ? count : null;
|
|
194
|
+
}
|
|
195
|
+
catch {
|
|
196
|
+
return null;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
// ---------------------------------------------------------------------------
|
|
200
|
+
// Top symbols read (T4.2, design D8 read spec). Single pass over usage.jsonl
|
|
201
|
+
// AND usage.jsonl.1 (if present), 30-day window, aggregate count by target,
|
|
202
|
+
// top 5. Degraded-safe: no usage file, an unreadable file, or any other
|
|
203
|
+
// error -> undefined (field/segment omitted entirely from fleet_status).
|
|
204
|
+
// Unparseable individual lines are skipped rather than failing the pass.
|
|
205
|
+
// ---------------------------------------------------------------------------
|
|
206
|
+
const TOP_SYMBOLS_WINDOW_MS = 30 * 24 * 60 * 60 * 1000;
|
|
207
|
+
const TOP_SYMBOLS_LIMIT = 5;
|
|
208
|
+
function readUsageLines(path) {
|
|
209
|
+
try {
|
|
210
|
+
return readFileSync(path, 'utf-8').split('\n').filter((line) => line.trim().length > 0);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export function computeTopSymbols(now = Date.now(), usagePath = USAGE_LOG_PATH, rotatedUsagePath = ROTATED_USAGE_LOG_PATH) {
|
|
217
|
+
try {
|
|
218
|
+
const lines = [...readUsageLines(usagePath), ...readUsageLines(rotatedUsagePath)];
|
|
219
|
+
if (lines.length === 0)
|
|
220
|
+
return undefined;
|
|
221
|
+
const cutoff = now - TOP_SYMBOLS_WINDOW_MS;
|
|
222
|
+
const counts = new Map();
|
|
223
|
+
for (const line of lines) {
|
|
224
|
+
try {
|
|
225
|
+
const record = JSON.parse(line);
|
|
226
|
+
if (typeof record.ts !== 'string' || typeof record.target !== 'string')
|
|
227
|
+
continue;
|
|
228
|
+
const ts = new Date(record.ts).getTime();
|
|
229
|
+
if (!Number.isFinite(ts) || ts < cutoff)
|
|
230
|
+
continue;
|
|
231
|
+
counts.set(record.target, (counts.get(record.target) ?? 0) + 1);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// Unparseable line -- skip it, keep going.
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (counts.size === 0)
|
|
238
|
+
return undefined;
|
|
239
|
+
return [...counts.entries()]
|
|
240
|
+
.sort((a, b) => b[1] - a[1])
|
|
241
|
+
.slice(0, TOP_SYMBOLS_LIMIT)
|
|
242
|
+
.map(([target, count]) => ({ target, count }));
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return undefined;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
export function codeIntelligenceHealth(repoDir) {
|
|
249
|
+
const meta = readGitNexusMeta(repoDir);
|
|
250
|
+
if (!meta)
|
|
251
|
+
return { present: false };
|
|
252
|
+
const health = {
|
|
253
|
+
present: true,
|
|
254
|
+
nodes: meta.stats?.nodes,
|
|
255
|
+
edges: meta.stats?.edges,
|
|
256
|
+
files: meta.stats?.files,
|
|
257
|
+
indexedAt: meta.indexedAt,
|
|
258
|
+
lastCommit: meta.lastCommit,
|
|
259
|
+
};
|
|
260
|
+
if (!meta.lastCommit) {
|
|
261
|
+
health.headStatus = 'unavailable';
|
|
262
|
+
return health;
|
|
263
|
+
}
|
|
264
|
+
const head = currentHead(repoDir);
|
|
265
|
+
if (!head) {
|
|
266
|
+
health.headStatus = 'unavailable';
|
|
267
|
+
return health;
|
|
268
|
+
}
|
|
269
|
+
if (head === meta.lastCommit) {
|
|
270
|
+
health.headStatus = 'matching';
|
|
271
|
+
return health;
|
|
272
|
+
}
|
|
273
|
+
const behind = commitsBehindCount(repoDir, meta.lastCommit, head);
|
|
274
|
+
if (behind === null) {
|
|
275
|
+
health.headStatus = 'unavailable';
|
|
276
|
+
return health;
|
|
277
|
+
}
|
|
278
|
+
health.headStatus = 'behind';
|
|
279
|
+
health.commitsBehind = behind;
|
|
280
|
+
return health;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Render the trailing head-comparison fragment used by the compact
|
|
284
|
+
* fleet_status line, e.g. "matching HEAD", "5 commits behind HEAD", or
|
|
285
|
+
* "indexed a1b2c3d4, HEAD comparison unavailable".
|
|
286
|
+
*/
|
|
287
|
+
function headComparisonLabel(health) {
|
|
288
|
+
if (health.headStatus === 'matching')
|
|
289
|
+
return 'matching HEAD';
|
|
290
|
+
if (health.headStatus === 'behind')
|
|
291
|
+
return `${health.commitsBehind} commits behind HEAD`;
|
|
292
|
+
const shortSha = health.lastCommit ? health.lastCommit.slice(0, 8) : 'unknown';
|
|
293
|
+
return `indexed ${shortSha}, HEAD comparison unavailable`;
|
|
294
|
+
}
|
|
295
|
+
/** Render the trailing "top symbols (30d): a (12), b (9), ..." fragment, or "" when absent. */
|
|
296
|
+
function topSymbolsFragment(topSymbols) {
|
|
297
|
+
if (!topSymbols || topSymbols.length === 0)
|
|
298
|
+
return '';
|
|
299
|
+
const rendered = topSymbols.map((s) => `${s.target} (${s.count})`).join(', ');
|
|
300
|
+
return ` | top symbols (30d): ${rendered}`;
|
|
301
|
+
}
|
|
302
|
+
/** Render the one-line compact fleet_status code intelligence summary. */
|
|
303
|
+
export function codeIntelligenceCompactLine(health) {
|
|
304
|
+
if (!health.present) {
|
|
305
|
+
return "code-intel: no index (run 'npx gitnexus analyze' or /pm index)" + topSymbolsFragment(health.topSymbols);
|
|
306
|
+
}
|
|
307
|
+
const nodes = health.nodes ?? 0;
|
|
308
|
+
const edges = health.edges ?? 0;
|
|
309
|
+
const files = health.files ?? 0;
|
|
310
|
+
const indexedAt = health.indexedAt ?? 'unknown';
|
|
311
|
+
return `code-intel: index present | ${nodes} nodes / ${edges} edges / ${files} files | indexed ${indexedAt} | ${headComparisonLabel(health)}${topSymbolsFragment(health.topSymbols)}`;
|
|
312
|
+
}
|
|
313
|
+
/** Read kb_stats and shape it for fleet_status. Never throws -- any failure (DB unavailable, bad JSON) yields null so the caller omits the KB section entirely. */
|
|
314
|
+
export async function kbHealthSummary() {
|
|
315
|
+
try {
|
|
316
|
+
const raw = await kbStats({});
|
|
317
|
+
return JSON.parse(raw);
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
// D5 (AMENDED): with F6a auto-commit in place inside kb_export, nonzero drift
|
|
324
|
+
// is an ANOMALY signal (a failed auto-commit), not a routine reminder -- the
|
|
325
|
+
// wording says so explicitly. Omitted entirely when drift is not positive
|
|
326
|
+
// (nothing anomalous to report).
|
|
327
|
+
function bibleDriftFragment(bible) {
|
|
328
|
+
if (bible.drift <= 0)
|
|
329
|
+
return '';
|
|
330
|
+
return ` | bible: ${bible.drift} promotions behind (auto-commit may have failed -- run apra-fleet kb commit)`;
|
|
331
|
+
}
|
|
332
|
+
/** Render the one-line compact fleet_status KB health summary. */
|
|
333
|
+
export function kbHealthCompactLine(health) {
|
|
334
|
+
const hitRatePct = health.retrieval.hit_rate === null ? 'n/a' : `${Math.round(health.retrieval.hit_rate * 100)}%`;
|
|
335
|
+
const promotePct = health.promote_ratio === null ? 'n/a' : `${Math.round(health.promote_ratio * 100)}%`;
|
|
336
|
+
const confirmed = health.totals.by_confidence.CONFIRMED ?? 0;
|
|
337
|
+
return `kb: ${health.totals.total} entries (confirmed:${confirmed} stale:${health.stale} flagged:${health.flagged}) | hit-rate:${hitRatePct} | promote-ratio:${promotePct}${bibleDriftFragment(health.bible)}`;
|
|
338
|
+
}
|
|
339
|
+
// ---------------------------------------------------------------------------
|
|
340
|
+
// Server version handshake (T2.4, F7, D6). Compares the compiled-in
|
|
341
|
+
// serverVersion against a fresh on-disk read (src/services/version-check.ts)
|
|
342
|
+
// of the code this process was launched from -- catches the "rebuilt dist
|
|
343
|
+
// but forgot to restart the MCP client" scenario. Degraded-safe: disk read
|
|
344
|
+
// failure -> omit silently; no auto-restart, surface only.
|
|
345
|
+
// ---------------------------------------------------------------------------
|
|
346
|
+
export function versionMismatchCompactLine(mismatch) {
|
|
347
|
+
return `server running ${mismatch.running}, disk has ${mismatch.disk} -- restart your MCP client`;
|
|
348
|
+
}
|
|
160
349
|
export async function fleetStatus(input) {
|
|
161
350
|
const format = input?.format ?? 'compact';
|
|
162
351
|
const agents = getAllAgents();
|
|
@@ -207,12 +396,60 @@ export async function fleetStatus(input) {
|
|
|
207
396
|
writeStatusline(statusOverrides);
|
|
208
397
|
const updateNotice = getUpdateNotice();
|
|
209
398
|
const logFile = getActiveLogFile();
|
|
399
|
+
let codeIntelligence;
|
|
400
|
+
try {
|
|
401
|
+
codeIntelligence = codeIntelligenceHealth(process.cwd());
|
|
402
|
+
}
|
|
403
|
+
catch {
|
|
404
|
+
// Defensive: codeIntelligenceHealth() already degrades gracefully
|
|
405
|
+
// internally, but fleet_status must never fail because of this section.
|
|
406
|
+
codeIntelligence = { present: false };
|
|
407
|
+
}
|
|
408
|
+
// T4.2: usage-telemetry top symbols (30d), independent of index presence --
|
|
409
|
+
// recordUsage() fires on every code_* call regardless of whether the repo
|
|
410
|
+
// has an index. Defensive on top of computeTopSymbols()'s own try/catch;
|
|
411
|
+
// any failure here just omits the field, never fails fleet_status.
|
|
412
|
+
try {
|
|
413
|
+
const topSymbols = computeTopSymbols();
|
|
414
|
+
if (topSymbols)
|
|
415
|
+
codeIntelligence.topSymbols = topSymbols;
|
|
416
|
+
}
|
|
417
|
+
catch {
|
|
418
|
+
// omit -- see comment above
|
|
419
|
+
}
|
|
420
|
+
// T2.2 (F5/F6, D4/D5 amended): KB health -- degraded-safe, mirrors the
|
|
421
|
+
// code-intelligence section above. kbHealthSummary() already catches
|
|
422
|
+
// internally; the outer try/catch here is defensive belt-and-suspenders
|
|
423
|
+
// (same rationale as the codeIntelligence call above), so fleet_status
|
|
424
|
+
// NEVER fails because of the KB.
|
|
425
|
+
let kbHealth = null;
|
|
426
|
+
try {
|
|
427
|
+
kbHealth = await kbHealthSummary();
|
|
428
|
+
}
|
|
429
|
+
catch {
|
|
430
|
+
kbHealth = null;
|
|
431
|
+
}
|
|
432
|
+
// T2.4 (F7, D6): version handshake -- degraded-safe, same belt-and-
|
|
433
|
+
// suspenders shape as the two sections above. checkVersionMismatch()
|
|
434
|
+
// already catches internally; the outer try/catch is defensive.
|
|
435
|
+
let versionMismatch = null;
|
|
436
|
+
try {
|
|
437
|
+
versionMismatch = checkVersionMismatch(serverVersion);
|
|
438
|
+
}
|
|
439
|
+
catch {
|
|
440
|
+
versionMismatch = null;
|
|
441
|
+
}
|
|
210
442
|
if (format === 'json') {
|
|
211
443
|
const payload = {
|
|
212
444
|
version: serverVersion,
|
|
213
445
|
summary: { total: rows.length, online, offline: rows.length - online },
|
|
214
446
|
members: rows,
|
|
447
|
+
codeIntelligence,
|
|
215
448
|
};
|
|
449
|
+
if (kbHealth)
|
|
450
|
+
payload.kbHealth = kbHealth;
|
|
451
|
+
if (versionMismatch)
|
|
452
|
+
payload.versionMismatch = versionMismatch;
|
|
216
453
|
if (logFile)
|
|
217
454
|
payload.logFile = logFile;
|
|
218
455
|
if (updateNotice) {
|
|
@@ -266,6 +503,11 @@ export async function fleetStatus(input) {
|
|
|
266
503
|
t += line + '\n';
|
|
267
504
|
}
|
|
268
505
|
}
|
|
506
|
+
t += codeIntelligenceCompactLine(codeIntelligence) + '\n';
|
|
507
|
+
if (kbHealth)
|
|
508
|
+
t += kbHealthCompactLine(kbHealth) + '\n';
|
|
509
|
+
if (versionMismatch)
|
|
510
|
+
t += versionMismatchCompactLine(versionMismatch) + '\n';
|
|
269
511
|
return t;
|
|
270
512
|
}
|
|
271
513
|
//# sourceMappingURL=check-status.js.map
|