@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
|
@@ -3,6 +3,7 @@ import os from 'node:os';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { v4 as uuid } from 'uuid';
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
+
import { knownRepoRemoteUrl } from '../services/member-remote-url.js';
|
|
6
7
|
import { getStrategy } from '../services/strategy.js';
|
|
7
8
|
import { getOsCommands } from '../os/index.js';
|
|
8
9
|
import { getProvider } from '../providers/index.js';
|
|
@@ -15,6 +16,7 @@ import { writeStatusline } from '../services/statusline.js';
|
|
|
15
16
|
import { getModelOverride } from '../services/user-config.js';
|
|
16
17
|
import { ensureCloudReady } from '../services/cloud/lifecycle.js';
|
|
17
18
|
import { getStallDetector, resolveSessionLogPath } from '../services/stall/index.js';
|
|
19
|
+
import { getCachedMemberPathContext } from '../services/member-home.js';
|
|
18
20
|
import { provisionAgents, remoteAgentsDir, loadCanonicalAgentSet } from '../services/agent-provisioner.js';
|
|
19
21
|
import { escapeWindowsArg, escapeDoubleQuoted } from '../os/os-commands.js';
|
|
20
22
|
import { resolveTilde } from './execute-command.js';
|
|
@@ -23,7 +25,7 @@ import { tryKillPid, isPidAlive } from '../utils/pid-helpers.js';
|
|
|
23
25
|
import { recoverOrphanedDispatch, isRemoteProcessAlive } from '../services/orphan-recovery.js';
|
|
24
26
|
import { seedWorkspaceTrust } from '../utils/workspace-trust.js';
|
|
25
27
|
import { durableOutputPath } from '../os/linux.js';
|
|
26
|
-
import { LogScope, maskSecrets, truncateForLog
|
|
28
|
+
import { LogScope, logLine, logWarn, maskSecrets, truncateForLog } from '../utils/log-helpers.js';
|
|
27
29
|
import { getLogPreviewChars } from '../services/user-config.js';
|
|
28
30
|
import { validateSubstitutionKeys, applySubstitutions } from '../services/substitution-engine.js';
|
|
29
31
|
import { sessionRegistry } from '../services/session-registry.js';
|
|
@@ -34,9 +36,11 @@ import { resolveBudgetScope, evaluateBudget, recordAndEvaluate } from '../servic
|
|
|
34
36
|
import { sendMessage } from './send-message.js';
|
|
35
37
|
import { registerPending } from '../services/pending-responses.js';
|
|
36
38
|
import { isMaxTurnsResponse } from '../providers/provider.js';
|
|
39
|
+
import { preflightCheck } from '../services/preflight-check.js';
|
|
37
40
|
export const executePromptSchema = z.object({
|
|
38
41
|
...memberIdentifier,
|
|
39
42
|
prompt: z.string().describe('The prompt to send to the LLM on the remote member'),
|
|
43
|
+
session_id: z.string().optional().describe('Shorthand for explicit session resume. Equivalent to resume: "<session_id>". If provided, takes precedence over resume.'),
|
|
40
44
|
resume: z.union([z.boolean(), z.string()]).default(true).describe('Session-resume control (default: true). ' +
|
|
41
45
|
'true = best-effort resume of the member\'s stored last session (a stale/unknown stored session transparently falls back to a fresh session). ' +
|
|
42
46
|
'false = always start a fresh session. ' +
|
|
@@ -58,16 +62,17 @@ export const executePromptSchema = z.object({
|
|
|
58
62
|
'Agent file must exist at the provider-specific path on the member: ' +
|
|
59
63
|
'Claude: <workFolder>/.claude/agents/<name>.md or ~/.claude/agents/<name>.md; ' +
|
|
60
64
|
'Gemini: <workFolder>/.gemini/agents/<name>.md or ~/.gemini/agents/<name>.md; ' +
|
|
61
|
-
'AGY: <workFolder>/.gemini/antigravity-cli/agents/<name>.md or ~/.gemini/antigravity-cli/agents/<name>.md
|
|
65
|
+
'AGY: <workFolder>/.gemini/antigravity-cli/agents/<name>.md or ~/.gemini/antigravity-cli/agents/<name>.md; ' +
|
|
66
|
+
'OpenCode: <workFolder>/.opencode/agents/<name>.md or ~/.config/opencode/agents/<name>.md -- ' +
|
|
62
67
|
'the call is rejected with a clear error if neither is present.'),
|
|
63
|
-
sprint_id: z.string().optional().describe('Opaque identity of the sprint issuing this dispatch
|
|
68
|
+
sprint_id: z.string().optional().describe('Opaque identity of the sprint issuing this dispatch. ' +
|
|
64
69
|
'When provided, the server-side member-reservation check (see reservedBy below) ' +
|
|
65
70
|
'compares this value directly against the reservation instead of falling back to ' +
|
|
66
71
|
'this server process\'s APRA_FLEET_SPRINT_ID env var -- the same per-call value ' +
|
|
67
72
|
'the caller passed to member_reservation reserve/release. Callers that never set a ' +
|
|
68
73
|
'reservation, or that reserved and dispatch in the same process, should omit this; ' +
|
|
69
74
|
'omitting it preserves the pre-existing env-var-based behavior exactly.'),
|
|
70
|
-
expected_context_tokens: z.number().positive().optional().describe('Optional estimate
|
|
75
|
+
expected_context_tokens: z.number().positive().optional().describe('Optional estimate of how many tokens this dispatch will add ' +
|
|
71
76
|
'to the target session\'s context. When set (or context_size is set), the server ' +
|
|
72
77
|
'compares it against the session\'s remaining context-window headroom BEFORE ' +
|
|
73
78
|
'invoking the LLM: too little headroom rejects the call with ' +
|
|
@@ -75,7 +80,7 @@ export const executePromptSchema = z.object({
|
|
|
75
80
|
'spawn; a fit that lands inside the safety margin still proceeds but attaches a ' +
|
|
76
81
|
'structured contextWarning. Wins over context_size when both are set. Omitting both ' +
|
|
77
82
|
'fields disables the check entirely -- pre-existing behavior is unchanged.'),
|
|
78
|
-
context_size: z.enum(['S', 'M', 'L']).optional().describe('Optional size-bucket shorthand for expected_context_tokens
|
|
83
|
+
context_size: z.enum(['S', 'M', 'L']).optional().describe('Optional size-bucket shorthand for expected_context_tokens: ' +
|
|
79
84
|
'S/M/L map to configured token estimates (fleet defaults, overridable via ' +
|
|
80
85
|
'config.json\'s contextAdmission.sizeBucketTokens). Ignored when expected_context_tokens ' +
|
|
81
86
|
'is also set. The auto-sprint engine supplies this from the dispatched task\'s size ' +
|
|
@@ -189,6 +194,14 @@ export function resolveModelForTier(agent, tier, provider) {
|
|
|
189
194
|
}
|
|
190
195
|
return provider.modelForTier(tier);
|
|
191
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* apra-fleet-b4g.6: the auto-harvest dispatch (below) is a server-internal
|
|
199
|
+
* kb_harvest call, not an LLM-supplied repo_remote_url like the other kb_*
|
|
200
|
+
* tools' hot paths (apra-fleet-b4g.1). Re-exported from
|
|
201
|
+
* services/member-remote-url.ts, which documents the no-guessing rule and is
|
|
202
|
+
* shared with member_detail (the fleet-sprint engine's only source for it).
|
|
203
|
+
*/
|
|
204
|
+
export { knownRepoRemoteUrl };
|
|
192
205
|
const SECURE_TOKEN_RE = /\{\{secure\.[a-zA-Z0-9_-]{1,64}\}\}/;
|
|
193
206
|
/**
|
|
194
207
|
* The sprint id this server process dispatches on behalf of, or undefined when
|
|
@@ -246,7 +259,15 @@ async function ensureAgentFilesProvisioned(agent) {
|
|
|
246
259
|
// (d) AbortSignal/MCP client cancellation -> abortHandler kills PID, execCommand resolves, finally clears
|
|
247
260
|
// (e) stale session retry -> retried without session ID; finally clears on success or failure
|
|
248
261
|
// (f) server overload retry -> retried after delay; finally clears on success or failure
|
|
249
|
-
// (g) early returns before inFlightAgents.add
|
|
262
|
+
// (g) early returns before inFlightAgents.add (busy-rejection, reservation
|
|
263
|
+
// conflict, no-LLM member): busy state never entered
|
|
264
|
+
// (h) preflight: the lock is claimed just before the preflight await (moved
|
|
265
|
+
// here from the interactive/subprocess split further below, to close the
|
|
266
|
+
// busy-check-to-lock-claim race window -- that split no longer calls
|
|
267
|
+
// .add() itself, it relies on the claim made here). Both the {ok: false}
|
|
268
|
+
// result path and preflightCheck() itself throwing release the lock
|
|
269
|
+
// explicitly inline, since both return/rethrow before reaching any
|
|
270
|
+
// finally block below
|
|
250
271
|
/**
|
|
251
272
|
* apra-fleet-idb: liveness probe for a busy-locked member's backing process.
|
|
252
273
|
* An inFlightAgents entry can outlive the process it was guarding -- a child
|
|
@@ -290,7 +311,7 @@ async function findDeadLockPid(agent, workspaceId) {
|
|
|
290
311
|
if (subprocessPid !== undefined) {
|
|
291
312
|
const alive = agent.agentType === 'local'
|
|
292
313
|
? isPidAlive(subprocessPid)
|
|
293
|
-
: await isRemoteProcessAlive(getStrategy(agent), subprocessPid);
|
|
314
|
+
: await isRemoteProcessAlive(getStrategy(agent), subprocessPid, getAgentOS(agent));
|
|
294
315
|
if (!alive)
|
|
295
316
|
return subprocessPid;
|
|
296
317
|
}
|
|
@@ -495,6 +516,67 @@ export async function executePrompt(input, extra) {
|
|
|
495
516
|
if (agent.llmProvider === 'none') {
|
|
496
517
|
return `[FAIL] "${agent.friendlyName}" has no LLM provider (llm_provider: "none") -- it is a plain command executor. Use execute_command instead.`;
|
|
497
518
|
}
|
|
519
|
+
// Claim the busy lock BEFORE the preflight await, not after (as it
|
|
520
|
+
// originally was further below at the interactive/subprocess split).
|
|
521
|
+
// preflightCheck can take up to ~30s on a cache miss; leaving the busy-check
|
|
522
|
+
// (line ~546) and the lock claim ~150 lines apart left a window where two
|
|
523
|
+
// near-simultaneous dispatches to the same member could both pass the busy
|
|
524
|
+
// check (neither had claimed the lock yet), both await preflight, and both
|
|
525
|
+
// proceed to double-dispatch. Every return path from here to the
|
|
526
|
+
// interactive/subprocess split below (currently only the preflight-failure
|
|
527
|
+
// return immediately following) must release this lock explicitly, since
|
|
528
|
+
// it now returns AFTER the lock is claimed instead of before.
|
|
529
|
+
inFlightAgents.add(agent.id);
|
|
530
|
+
// Peek at session state early so the preflight check can skip interactive
|
|
531
|
+
// members whose dispatch routes through a live MCP push channel, not SSH.
|
|
532
|
+
const earlyWorkspaceId = getTokenIssuer().workspaceId();
|
|
533
|
+
const earlySession = sessionRegistry.get(earlyWorkspaceId, agent.id);
|
|
534
|
+
const isChannelCapable = !!earlySession?.channelCapable;
|
|
535
|
+
// Pre-dispatch readiness check (apra-fleet preflight-check): verify
|
|
536
|
+
// connectivity and LLM auth BEFORE the expensive prompt dispatch
|
|
537
|
+
// (writePromptFile + CLI invocation). Catches expired OAuth, missing
|
|
538
|
+
// credentials, and offline members in <1s instead of burning a full
|
|
539
|
+
// round trip. Local members and interactive sessions are excluded
|
|
540
|
+
// (local shares this machine's credentials; interactive sessions have
|
|
541
|
+
// their own liveness probes). The check is cached for 60s so
|
|
542
|
+
// back-to-back dispatches do not add latency.
|
|
543
|
+
if (agent.agentType !== 'local' && !isChannelCapable) {
|
|
544
|
+
let preflight;
|
|
545
|
+
try {
|
|
546
|
+
preflight = await preflightCheck(agent);
|
|
547
|
+
}
|
|
548
|
+
catch (err) {
|
|
549
|
+
// preflightCheck's own synchronous prologue (getStrategy/getProvider)
|
|
550
|
+
// and its internal exec calls are not fully guarded -- if it throws
|
|
551
|
+
// instead of resolving {ok: false}, the lock claimed above would
|
|
552
|
+
// otherwise leak forever (no pid captured yet for findDeadLockPid's
|
|
553
|
+
// stale-lock self-heal to recognize). Release and propagate unchanged
|
|
554
|
+
// -- this preserves the exact same exception the caller would have
|
|
555
|
+
// seen before the lock was claimed this early.
|
|
556
|
+
inFlightAgents.delete(agent.id);
|
|
557
|
+
throw err;
|
|
558
|
+
}
|
|
559
|
+
if (!preflight.ok) {
|
|
560
|
+
// R2-F5: use preflight-specific reason codes so fleet-sprint can
|
|
561
|
+
// distinguish pre-dispatch failures from in-dispatch ones and avoid
|
|
562
|
+
// inappropriate self-heal loops (e.g. re-provisioning auth when the
|
|
563
|
+
// member is simply offline).
|
|
564
|
+
const preflightReason = preflight.code === 'offline' ? 'preflight_offline'
|
|
565
|
+
: preflight.code === 'auth_expired' ? 'preflight_auth_expired'
|
|
566
|
+
: preflight.code === 'auth_missing' ? 'preflight_auth_missing'
|
|
567
|
+
: 'dispatch_failed';
|
|
568
|
+
// Release the lock claimed above -- this return happens before the
|
|
569
|
+
// interactive/subprocess split's own add+finally cleanup ever runs.
|
|
570
|
+
inFlightAgents.delete(agent.id);
|
|
571
|
+
return {
|
|
572
|
+
text: `[FAIL] Pre-dispatch check failed for "${agent.friendlyName}": ${preflight.reason}`,
|
|
573
|
+
structuredContent: {
|
|
574
|
+
isError: true,
|
|
575
|
+
reason: preflightReason,
|
|
576
|
+
},
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
}
|
|
498
580
|
// Interactive routing (apra-fleet-2xs.8/us9.8, docs/cloud-fleet-architecture.md
|
|
499
581
|
// section 6): if this member has a live MCP session connected right now,
|
|
500
582
|
// route via send_message + wait-for-response instead of spawning a
|
|
@@ -522,6 +604,9 @@ export async function executePrompt(input, extra) {
|
|
|
522
604
|
// gives it basic MCP tool access, apra-fleet-fnz.1-3) without that meaning
|
|
523
605
|
// it can receive or act on this push -- routing to it anyway would silently
|
|
524
606
|
// spend the full timeout_s waiting for a response that can never arrive.
|
|
607
|
+
// R2-F3: re-query session registry after the preflight await (10-20s) so
|
|
608
|
+
// interactive routing sees sessions that became channelCapable during that
|
|
609
|
+
// window, rather than using the stale pre-preflight snapshot.
|
|
525
610
|
const workspaceId = getTokenIssuer().workspaceId();
|
|
526
611
|
const rawSession = sessionRegistry.get(workspaceId, agent.id);
|
|
527
612
|
// apra-fleet-eft.74.1: interactive routing requires the EXPLICIT channel
|
|
@@ -587,7 +672,9 @@ export async function executePrompt(input, extra) {
|
|
|
587
672
|
interactiveSession = undefined;
|
|
588
673
|
}
|
|
589
674
|
if (interactiveSession?.server) {
|
|
590
|
-
|
|
675
|
+
// Lock already claimed above, before the preflight await -- do not
|
|
676
|
+
// re-add here (Set.add would be a harmless no-op, but keeping a second
|
|
677
|
+
// add site invites the lock and its release to drift out of sync).
|
|
591
678
|
writeStatusline(new Map([[agent.id, 'busy']]));
|
|
592
679
|
try {
|
|
593
680
|
return await executePromptInteractive(agent, renderedPrompt, input, workspaceId, heuristicWarningSuffix);
|
|
@@ -597,7 +684,7 @@ export async function executePrompt(input, extra) {
|
|
|
597
684
|
writeStatusline(new Map([[agent.id, 'idle']]));
|
|
598
685
|
}
|
|
599
686
|
}
|
|
600
|
-
|
|
687
|
+
// Lock already claimed above, before the preflight await.
|
|
601
688
|
await ensureAgentFilesProvisioned(agent);
|
|
602
689
|
const stallDetector = getStallDetector();
|
|
603
690
|
let clearedByStall = false;
|
|
@@ -687,7 +774,9 @@ export async function executePrompt(input, extra) {
|
|
|
687
774
|
// on that session's context, so an unknown/expired id is a
|
|
688
775
|
// TERMINAL session_not_found (handled just below) and NO
|
|
689
776
|
// fresh-session fallback is ever applied (see the retry paths).
|
|
690
|
-
const explicitResumeId = typeof input.
|
|
777
|
+
const explicitResumeId = (typeof input.session_id === 'string' && input.session_id.trim().length > 0)
|
|
778
|
+
? input.session_id.trim()
|
|
779
|
+
: (typeof input.resume === 'string' && input.resume.length > 0 ? input.resume : undefined);
|
|
691
780
|
const resumeRequested = input.resume === true || explicitResumeId !== undefined;
|
|
692
781
|
const resumeTargetId = explicitResumeId ?? agent.sessionId;
|
|
693
782
|
// An explicit-id resume must never silently degrade to a fresh session: that
|
|
@@ -695,7 +784,8 @@ export async function executePrompt(input, extra) {
|
|
|
695
784
|
// resume=false keep their pre-existing transparent recovery.
|
|
696
785
|
const allowFreshSessionFallback = explicitResumeId === undefined;
|
|
697
786
|
const resuming = !!(resumeRequested && resumeTargetId && provider.supportsResume());
|
|
698
|
-
const
|
|
787
|
+
const isCallerMinted = provider.sessionIdStrategy().type === 'caller-minted';
|
|
788
|
+
const mintedId = isCallerMinted
|
|
699
789
|
? (resuming ? resumeTargetId : uuid())
|
|
700
790
|
: (resuming ? resumeTargetId : undefined);
|
|
701
791
|
// Terminal session-not-found gate for explicit-id resumes (apra-fleet-eft.78.1).
|
|
@@ -731,6 +821,34 @@ export async function executePrompt(input, extra) {
|
|
|
731
821
|
inv: scope.getInv(),
|
|
732
822
|
agentName: input.agent,
|
|
733
823
|
};
|
|
824
|
+
// apra-fleet issue #390: session log paths live on the MEMBER's machine, under
|
|
825
|
+
// the MEMBER's home directory, joined with the MEMBER's OS convention. Before
|
|
826
|
+
// this, every remote member got a HUB-home path (os.homedir()) joined with the
|
|
827
|
+
// HUB's path convention -- a path that can never exist on the member, which
|
|
828
|
+
// silently disabled stall detection for Claude/Gemini and manufactured
|
|
829
|
+
// false-positive stall kills for AGY/OpenCode.
|
|
830
|
+
//
|
|
831
|
+
// This resolution is deliberately SYNCHRONOUS (cached probe result, else the
|
|
832
|
+
// member's known login username's default home): the dispatch path must not
|
|
833
|
+
// add a remote round trip, and a wrong guess here can only cost detection
|
|
834
|
+
// fidelity, never cause a kill. The kill-capable directory poll in
|
|
835
|
+
// stall-poller.ts uses the probe-backed async resolver instead.
|
|
836
|
+
const memberPathCtx = getCachedMemberPathContext(agent);
|
|
837
|
+
const activePreSpawnSid = resuming ? resumeTargetId : (isCallerMinted ? mintedId : undefined);
|
|
838
|
+
let resolvedLogPath = null;
|
|
839
|
+
if (activePreSpawnSid) {
|
|
840
|
+
try {
|
|
841
|
+
resolvedLogPath = resolveSessionLogPath(agent.llmProvider ?? 'claude', activePreSpawnSid, resolvedWorkFolder, memberPathCtx.homeDir, memberPathCtx.targetOs);
|
|
842
|
+
}
|
|
843
|
+
catch {
|
|
844
|
+
resolvedLogPath = null;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
stallDetector.update(agent.id, {
|
|
848
|
+
sessionId: activePreSpawnSid,
|
|
849
|
+
logFilePath: resolvedLogPath,
|
|
850
|
+
provisional: !resolvedLogPath,
|
|
851
|
+
});
|
|
734
852
|
const claudeCmd = authPrefix + cmds.buildAgentPromptCommand(provider, promptOpts);
|
|
735
853
|
// apra-fleet-6z8.1: the per-invocation durable stdout mirror the unix prompt
|
|
736
854
|
// wrapper tees to (see durableOutputPath / buildAgentPromptCommand). Windows
|
|
@@ -765,13 +883,11 @@ export async function executePrompt(input, extra) {
|
|
|
765
883
|
}
|
|
766
884
|
// Agent file validation -- verify named agent exists before any CLI invocation
|
|
767
885
|
if (input.agent) {
|
|
768
|
-
const
|
|
769
|
-
// AGY uses ~/.gemini/antigravity-cli/ as its config root, not ~/.agy/
|
|
770
|
-
const agentRelDir = provName === 'agy' ? '.gemini/antigravity-cli/agents' : `.${provName}/agents`;
|
|
886
|
+
const dirs = provider.agentDirectories(input.agent);
|
|
771
887
|
let agentFound = false;
|
|
772
888
|
if (agent.agentType === 'local') {
|
|
773
|
-
const projPath = path.join(resolvedWorkFolder,
|
|
774
|
-
const userPath = path.join(os.homedir(),
|
|
889
|
+
const projPath = path.join(resolvedWorkFolder, dirs.project);
|
|
890
|
+
const userPath = path.join(os.homedir(), dirs.home);
|
|
775
891
|
agentFound = fs.existsSync(projPath) || fs.existsSync(userPath);
|
|
776
892
|
if (!agentFound) {
|
|
777
893
|
inFlightAgents.delete(agent.id);
|
|
@@ -782,7 +898,7 @@ export async function executePrompt(input, extra) {
|
|
|
782
898
|
}
|
|
783
899
|
else {
|
|
784
900
|
// Canonical PM role agents (planner/doer/reviewer/plan-reviewer/...) are
|
|
785
|
-
// already guaranteed present in
|
|
901
|
+
// already guaranteed present in ~/dirs.home by
|
|
786
902
|
// ensureAgentFilesProvisioned() above (ln ~576, which ran provisionAgents()
|
|
787
903
|
// for this exact member earlier in this same call) -- trust that instead
|
|
788
904
|
// of re-probing the remote here. This also SIDESTEPS the bug this check
|
|
@@ -794,8 +910,8 @@ export async function executePrompt(input, extra) {
|
|
|
794
910
|
// sprint via a Windows remote member always failed plan-review with
|
|
795
911
|
// "agent 'plan-reviewer' not found").
|
|
796
912
|
const canonicalRelPath = `${input.agent}.md`;
|
|
797
|
-
agentFound = remoteAgentsDir(
|
|
798
|
-
&& loadCanonicalAgentSet(
|
|
913
|
+
agentFound = remoteAgentsDir(provider.name) !== null
|
|
914
|
+
&& loadCanonicalAgentSet(provider.name).some((f) => f.relPath === canonicalRelPath);
|
|
799
915
|
if (!agentFound) {
|
|
800
916
|
// Not part of the canonical PM set (e.g. a project-local custom
|
|
801
917
|
// agent) -- fall back to a REAL existence probe, built platform-aware
|
|
@@ -803,8 +919,8 @@ export async function executePrompt(input, extra) {
|
|
|
803
919
|
// already used the same way by list-members.ts/member-detail.ts for
|
|
804
920
|
// credential-file checks) instead of a single hardcoded shell dialect.
|
|
805
921
|
const cmds = getOsCommands(getAgentOS(agent));
|
|
806
|
-
const projPath = `${resolvedWorkFolder}/${
|
|
807
|
-
const userPath = `~/${
|
|
922
|
+
const projPath = `${resolvedWorkFolder}/${dirs.project}`;
|
|
923
|
+
const userPath = `~/${dirs.home}`;
|
|
808
924
|
const [projResult, userResult] = await Promise.all([
|
|
809
925
|
strategy.execCommand(cmds.credentialFileCheck(projPath), 10000),
|
|
810
926
|
strategy.execCommand(cmds.credentialFileCheck(userPath), 10000),
|
|
@@ -815,7 +931,7 @@ export async function executePrompt(input, extra) {
|
|
|
815
931
|
inFlightAgents.delete(agent.id);
|
|
816
932
|
stallDetector.remove(agent.id);
|
|
817
933
|
writeStatusline(new Map([[agent.id, 'idle']]));
|
|
818
|
-
return `execute_prompt: agent "${input.agent}" not found on "${agent.friendlyName}".\n\nExpected at:\n ${resolvedWorkFolder}/${
|
|
934
|
+
return `execute_prompt: agent "${input.agent}" not found on "${agent.friendlyName}".\n\nExpected at:\n ${resolvedWorkFolder}/${dirs.project}\n ~/${dirs.home}`;
|
|
819
935
|
}
|
|
820
936
|
}
|
|
821
937
|
}
|
|
@@ -877,15 +993,18 @@ export async function executePrompt(input, extra) {
|
|
|
877
993
|
capturedPid = pid;
|
|
878
994
|
scope.info(`pid=${pid}`);
|
|
879
995
|
if (mintedId) {
|
|
996
|
+
let logPath = null;
|
|
880
997
|
try {
|
|
881
|
-
|
|
882
|
-
stallDetector.update(agent.id, {
|
|
883
|
-
sessionId: mintedId,
|
|
884
|
-
logFilePath: logPath,
|
|
885
|
-
provisional: false,
|
|
886
|
-
});
|
|
998
|
+
logPath = resolveSessionLogPath(agent.llmProvider ?? 'claude', mintedId, resolvedWorkFolder, memberPathCtx.homeDir, memberPathCtx.targetOs);
|
|
887
999
|
}
|
|
888
|
-
catch {
|
|
1000
|
+
catch {
|
|
1001
|
+
logPath = null;
|
|
1002
|
+
}
|
|
1003
|
+
stallDetector.update(agent.id, {
|
|
1004
|
+
sessionId: mintedId,
|
|
1005
|
+
logFilePath: logPath,
|
|
1006
|
+
provisional: !logPath,
|
|
1007
|
+
});
|
|
889
1008
|
}
|
|
890
1009
|
};
|
|
891
1010
|
const abortHandler = () => {
|
|
@@ -950,7 +1069,7 @@ export async function executePrompt(input, extra) {
|
|
|
950
1069
|
throw dispatchErr;
|
|
951
1070
|
scope.info(`[${resolvedModel}] retrying -- dispatch exception: ${dispatchErr.message}`);
|
|
952
1071
|
await tryKillPid(agent, strategy, cmds);
|
|
953
|
-
const freshOpts = { ...promptOpts, sessionId:
|
|
1072
|
+
const freshOpts = { ...promptOpts, sessionId: isCallerMinted ? uuid() : undefined, resuming: false };
|
|
954
1073
|
const retryCmd = authPrefix + cmds.buildAgentPromptCommand(provider, freshOpts);
|
|
955
1074
|
result = await strategy.execCommand(retryCmd, budget.timeoutMs, budget.maxTotalMs, onPidCaptured, dispatchSignal);
|
|
956
1075
|
}
|
|
@@ -982,7 +1101,7 @@ export async function executePrompt(input, extra) {
|
|
|
982
1101
|
if (!staleBudget.exhausted) {
|
|
983
1102
|
scope.info(`[${resolvedModel}] retrying -- stale session`);
|
|
984
1103
|
await tryKillPid(agent, strategy, cmds);
|
|
985
|
-
const freshOpts = { ...promptOpts, sessionId:
|
|
1104
|
+
const freshOpts = { ...promptOpts, sessionId: isCallerMinted ? uuid() : undefined, resuming: false };
|
|
986
1105
|
const retryCmd = authPrefix + cmds.buildAgentPromptCommand(provider, freshOpts);
|
|
987
1106
|
result = await strategy.execCommand(retryCmd, staleBudget.timeoutMs, staleBudget.maxTotalMs, onPidCaptured, dispatchSignal);
|
|
988
1107
|
parsed = provider.parseResponse(result);
|
|
@@ -1001,7 +1120,7 @@ export async function executePrompt(input, extra) {
|
|
|
1001
1120
|
scope.info(`[${resolvedModel}] retrying -- server overloaded`);
|
|
1002
1121
|
await tryKillPid(agent, strategy, cmds);
|
|
1003
1122
|
await new Promise(r => setTimeout(r, SERVER_RETRY_DELAY_MS));
|
|
1004
|
-
const freshOpts = { ...promptOpts, sessionId:
|
|
1123
|
+
const freshOpts = { ...promptOpts, sessionId: isCallerMinted ? uuid() : undefined, resuming: false };
|
|
1005
1124
|
const retryCmd = authPrefix + cmds.buildAgentPromptCommand(provider, freshOpts);
|
|
1006
1125
|
result = await strategy.execCommand(retryCmd, overloadBudget.timeoutMs, overloadBudget.maxTotalMs, onPidCaptured, dispatchSignal);
|
|
1007
1126
|
parsed = provider.parseResponse(result);
|
|
@@ -1076,6 +1195,7 @@ export async function executePrompt(input, extra) {
|
|
|
1076
1195
|
pid: capturedPid,
|
|
1077
1196
|
durablePath,
|
|
1078
1197
|
unsupported: getAgentOS(agent) === 'windows',
|
|
1198
|
+
os: getAgentOS(agent),
|
|
1079
1199
|
maxWaitMs: maxTotalMs !== undefined ? Math.max(maxTotalMs - (Date.now() - dispatchStartedAt), 0) : undefined,
|
|
1080
1200
|
scope,
|
|
1081
1201
|
});
|
|
@@ -1110,6 +1230,7 @@ export async function executePrompt(input, extra) {
|
|
|
1110
1230
|
// onAuthFailure shape: a repeat failure after the heal is terminal, not
|
|
1111
1231
|
// looped).
|
|
1112
1232
|
if ((!parsed.result || parsed.result.trim() === '')
|
|
1233
|
+
&& allowFreshSessionFallback
|
|
1113
1234
|
&& provider.classifyError(result.stderr || result.stdout) === 'workspace_not_trusted'
|
|
1114
1235
|
&& !trustHealAttempted) {
|
|
1115
1236
|
trustHealAttempted = true;
|
|
@@ -1118,7 +1239,7 @@ export async function executePrompt(input, extra) {
|
|
|
1118
1239
|
const healBudget = retryBudget();
|
|
1119
1240
|
if (!healBudget.exhausted) {
|
|
1120
1241
|
await tryKillPid(agent, strategy, cmds);
|
|
1121
|
-
const freshOpts = { ...promptOpts, sessionId:
|
|
1242
|
+
const freshOpts = { ...promptOpts, sessionId: isCallerMinted ? uuid() : undefined, resuming: false };
|
|
1122
1243
|
const retryCmd = authPrefix + cmds.buildAgentPromptCommand(provider, freshOpts);
|
|
1123
1244
|
result = await strategy.execCommand(retryCmd, healBudget.timeoutMs, healBudget.maxTotalMs, onPidCaptured, dispatchSignal);
|
|
1124
1245
|
parsed = provider.parseResponse(result);
|
|
@@ -1138,28 +1259,66 @@ export async function executePrompt(input, extra) {
|
|
|
1138
1259
|
}
|
|
1139
1260
|
}
|
|
1140
1261
|
// Session-id assertion: returned id must match the one we minted/resumed
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1262
|
+
const expectedSid = resuming ? resumeTargetId : (isCallerMinted ? mintedId : undefined);
|
|
1263
|
+
const isMismatch = expectedSid && parsed.sessionId && parsed.sessionId !== expectedSid;
|
|
1264
|
+
if (isMismatch) {
|
|
1265
|
+
scope.info(`session-id mismatch: expected=${expectedSid} got=${parsed.sessionId} -- not persisting`);
|
|
1266
|
+
if (!allowFreshSessionFallback && explicitResumeId !== undefined) {
|
|
1267
|
+
inFlightAgents.delete(agent.id);
|
|
1268
|
+
stallDetector.remove(agent.id);
|
|
1269
|
+
writeStatusline(new Map([[agent.id, 'idle']]));
|
|
1270
|
+
clearStoredPid(agent.id);
|
|
1271
|
+
if (parsed.sessionId) {
|
|
1272
|
+
recordKnownSession(agent.id, parsed.sessionId);
|
|
1273
|
+
}
|
|
1274
|
+
if (parsed.usage) {
|
|
1275
|
+
const prev = agent.tokenUsage ?? { input: 0, output: 0 };
|
|
1276
|
+
updateAgent(agent.id, {
|
|
1277
|
+
tokenUsage: {
|
|
1278
|
+
input: prev.input + parsed.usage.input_tokens,
|
|
1279
|
+
output: prev.output + parsed.usage.output_tokens,
|
|
1280
|
+
},
|
|
1281
|
+
});
|
|
1282
|
+
recordSessionUsage(parsed.sessionId ?? expectedSid, parsed.usage);
|
|
1283
|
+
if (budgetScope) {
|
|
1284
|
+
await recordAndEvaluate({ scope: budgetScope, agent, provider, tier: resolvedTier, usage: parsed.usage });
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
return {
|
|
1288
|
+
text: `[FAIL] execute_prompt on "${agent.friendlyName}" failed -- resumed session mismatch. Expected session "${expectedSid}", but provider returned "${parsed.sessionId}".`,
|
|
1289
|
+
structuredContent: {
|
|
1290
|
+
isError: true,
|
|
1291
|
+
reason: 'session_not_found',
|
|
1292
|
+
sessionId: expectedSid,
|
|
1293
|
+
returnedSessionId: parsed.sessionId,
|
|
1294
|
+
...(parsed.usage ? { usage: { ...parsed.usage, total_tokens: parsed.usage.input_tokens + parsed.usage.output_tokens } } : {}),
|
|
1295
|
+
},
|
|
1296
|
+
};
|
|
1297
|
+
}
|
|
1144
1298
|
touchAgent(agent.id, undefined);
|
|
1145
1299
|
}
|
|
1146
1300
|
else {
|
|
1147
|
-
touchAgent(agent.id, parsed.sessionId ??
|
|
1301
|
+
touchAgent(agent.id, parsed.sessionId ?? expectedSid);
|
|
1148
1302
|
}
|
|
1149
1303
|
// apra-fleet-eft.78.1: mark the session this dispatch actually landed on as
|
|
1150
1304
|
// known/resumable for this member, so a later explicit-id resume of it
|
|
1151
1305
|
// passes the terminal session_not_found gate above instead of being
|
|
1152
1306
|
// rejected as unknown.
|
|
1153
|
-
|
|
1154
|
-
if (
|
|
1307
|
+
const finalSid = parsed.sessionId ?? expectedSid;
|
|
1308
|
+
if (finalSid) {
|
|
1309
|
+
recordKnownSession(agent.id, finalSid);
|
|
1310
|
+
let postLogPath = null;
|
|
1155
1311
|
try {
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
});
|
|
1312
|
+
postLogPath = resolveSessionLogPath(agent.llmProvider ?? 'claude', finalSid, resolvedWorkFolder, memberPathCtx.homeDir, memberPathCtx.targetOs);
|
|
1313
|
+
}
|
|
1314
|
+
catch {
|
|
1315
|
+
postLogPath = null;
|
|
1161
1316
|
}
|
|
1162
|
-
|
|
1317
|
+
stallDetector.update(agent.id, {
|
|
1318
|
+
sessionId: finalSid,
|
|
1319
|
+
logFilePath: postLogPath,
|
|
1320
|
+
provisional: !postLogPath,
|
|
1321
|
+
});
|
|
1163
1322
|
}
|
|
1164
1323
|
clearStoredPid(agent.id);
|
|
1165
1324
|
if (parsed.usage) {
|
|
@@ -1197,6 +1356,59 @@ ${parsed.result}`;
|
|
|
1197
1356
|
|
|
1198
1357
|
---
|
|
1199
1358
|
session: ${parsed.sessionId}`;
|
|
1359
|
+
// Auto-harvest learnings from session output (fire-and-forget)
|
|
1360
|
+
if (parsed.result) {
|
|
1361
|
+
// apra-fleet-tm7.2: always pass resolvedWorkFolder, local or remote.
|
|
1362
|
+
// getKbProviders(undefined) falls back to slugFor(process.cwd()) --
|
|
1363
|
+
// the FLEET SERVER's own cwd, not any generic 'default' -- so omitting
|
|
1364
|
+
// repo_path for remote members would silently route their harvested
|
|
1365
|
+
// learnings into the server's own repo KB (the exact defect apra-fleet-tm7
|
|
1366
|
+
// describes).
|
|
1367
|
+
//
|
|
1368
|
+
// apra-fleet-b4g.6: repo_remote_url (apra-fleet-b4g.1) is how a REMOTE
|
|
1369
|
+
// member's call reaches the SAME shared project KB a local clone would --
|
|
1370
|
+
// without it, resolvedWorkFolder is a path on the remote host that will
|
|
1371
|
+
// almost never exist on this (fleet server) machine, resolveProjectSlug's
|
|
1372
|
+
// git calls on it fail with ENOENT, and it falls through to the literal
|
|
1373
|
+
// 'default' slug, pooling every such member's harvest into one shared,
|
|
1374
|
+
// useless bucket (no cross-repo contamination, but no real routing
|
|
1375
|
+
// either). knownRepoRemoteUrl() forwards it whenever the member's own
|
|
1376
|
+
// registration record already carries a genuine URL. It deliberately does
|
|
1377
|
+
// NOT construct one from agent.gitRepos' bare "owner/repo" access-list
|
|
1378
|
+
// entries (see src/services/vcs/github.ts's own
|
|
1379
|
+
// https://github.com/${repo}.git construction for a DIFFERENT, narrower
|
|
1380
|
+
// purpose -- connectivity testing) or shell out to the member host to
|
|
1381
|
+
// discover it: guessing a URL that turns out wrong would route the
|
|
1382
|
+
// harvest into a KB slug that does not match the repo's real local-clone
|
|
1383
|
+
// slug, which is worse than today's honest 'default' degradation. When no
|
|
1384
|
+
// genuine URL is known, behaviour is unchanged from before this fix.
|
|
1385
|
+
// KB-TRUST PHASE 1 (apra-fleet-4wz.8): report the harvest counters. This is
|
|
1386
|
+
// the highest-volume KB writer and its result was previously discarded
|
|
1387
|
+
// entirely, so entries_rejected -- the fail-closed signal -- was invisible
|
|
1388
|
+
// on the one path that produces most of it. Rejections are EXPECTED to
|
|
1389
|
+
// dominate here: harvest's regex extraction frequently yields no file
|
|
1390
|
+
// paths at all, and an entry with no basis is refused by design. A high
|
|
1391
|
+
// rejected count is the invariant working, not a regression to tune away.
|
|
1392
|
+
void import('./kb-harvest.js')
|
|
1393
|
+
.then(({ kbHarvest }) => kbHarvest({
|
|
1394
|
+
repo_path: resolvedWorkFolder,
|
|
1395
|
+
repo_remote_url: knownRepoRemoteUrl(agent),
|
|
1396
|
+
session_transcript: parsed.result,
|
|
1397
|
+
session_id: parsed.sessionId,
|
|
1398
|
+
}))
|
|
1399
|
+
.then((raw) => {
|
|
1400
|
+
try {
|
|
1401
|
+
const r = JSON.parse(raw);
|
|
1402
|
+
if (r.entries_captured || r.entries_updated || r.entries_skipped || r.entries_rejected) {
|
|
1403
|
+
logLine('kb_harvest', `auto-harvest: captured=${r.entries_captured} updated=${r.entries_updated} skipped=${r.entries_skipped} rejected=${r.entries_rejected}`);
|
|
1404
|
+
}
|
|
1405
|
+
}
|
|
1406
|
+
catch {
|
|
1407
|
+
// A non-JSON payload is not worth failing a fire-and-forget harvest over.
|
|
1408
|
+
}
|
|
1409
|
+
})
|
|
1410
|
+
.catch((err) => logWarn('kb_harvest', `auto-harvest failed: ${err.message}`));
|
|
1411
|
+
}
|
|
1200
1412
|
if (heuristicWarningSuffix)
|
|
1201
1413
|
output += heuristicWarningSuffix;
|
|
1202
1414
|
return {
|