@apralabs/apra-fleet 0.3.6 → 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 +378 -252
- package/dist/agents/backlog-groomer.md +303 -0
- package/dist/agents/ci-watcher.md +13 -1
- package/dist/agents/deployer.md +66 -13
- package/dist/agents/doer.md +67 -8
- package/dist/agents/harvester.md +22 -3
- package/dist/agents/integ-test-runner.md +166 -60
- package/dist/agents/kb-reconciler.md +216 -0
- package/dist/agents/plan-reviewer.md +88 -18
- package/dist/agents/planner.md +182 -19
- package/dist/agents/regression-test-runner.md +234 -0
- package/dist/agents/reviewer.md +125 -9
- package/dist/agents/schemas/backlog-groomer-input.json +35 -0
- package/dist/agents/schemas/backlog-groomer-output.json +164 -0
- 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 +34 -0
- package/dist/agents/schemas/kb-reconciler-output.json +87 -0
- package/dist/agents/schemas/planner-output.json +65 -0
- package/dist/agents/schemas/regression-test-runner-input.json +15 -0
- package/dist/agents/schemas/regression-test-runner-output.json +50 -0
- package/dist/agents/schemas/reviewer-output.json +108 -7
- package/dist/cli/agent-transform.d.ts +1 -0
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +77 -0
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +181 -5
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +5 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +7 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/dolt-install.d.ts +91 -0
- package/dist/cli/dolt-install.d.ts.map +1 -0
- package/dist/cli/dolt-install.js +334 -0
- package/dist/cli/dolt-install.js.map +1 -0
- package/dist/cli/install-guard.d.ts +29 -0
- package/dist/cli/install-guard.d.ts.map +1 -0
- package/dist/cli/install-guard.js +153 -0
- package/dist/cli/install-guard.js.map +1 -0
- package/dist/cli/install.d.ts +45 -3
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +736 -109
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/join.d.ts +12 -0
- package/dist/cli/join.d.ts.map +1 -0
- package/dist/cli/join.js +87 -0
- package/dist/cli/join.js.map +1 -0
- 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/register-member.d.ts +2 -0
- package/dist/cli/register-member.d.ts.map +1 -0
- package/dist/cli/register-member.js +193 -0
- package/dist/cli/register-member.js.map +1 -0
- package/dist/cli/restart.d.ts +2 -0
- package/dist/cli/restart.d.ts.map +1 -0
- package/dist/cli/restart.js +7 -0
- package/dist/cli/restart.js.map +1 -0
- package/dist/cli/spoke.d.ts +35 -0
- package/dist/cli/spoke.d.ts.map +1 -0
- package/dist/cli/spoke.js +212 -0
- package/dist/cli/spoke.js.map +1 -0
- package/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +92 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +83 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/stop.d.ts +2 -0
- package/dist/cli/stop.d.ts.map +1 -0
- package/dist/cli/stop.js +51 -0
- package/dist/cli/stop.js.map +1 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +120 -9
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +10 -1
- package/dist/cli/update.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/cli/workflow-assets.d.ts +37 -0
- package/dist/cli/workflow-assets.d.ts.map +1 -0
- package/dist/cli/workflow-assets.js +144 -0
- package/dist/cli/workflow-assets.js.map +1 -0
- package/dist/cli/workflow.d.ts +75 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +397 -0
- package/dist/cli/workflow.js.map +1 -0
- 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/hub-service/activity.d.ts +30 -0
- package/dist/hub-service/activity.d.ts.map +1 -0
- package/dist/hub-service/activity.js +20 -0
- package/dist/hub-service/activity.js.map +1 -0
- package/dist/hub-service/audit-log.d.ts +19 -0
- package/dist/hub-service/audit-log.d.ts.map +1 -0
- package/dist/hub-service/audit-log.js +13 -0
- package/dist/hub-service/audit-log.js.map +1 -0
- package/dist/hub-service/db/pool.d.ts +19 -0
- package/dist/hub-service/db/pool.d.ts.map +1 -0
- package/dist/hub-service/db/pool.js +53 -0
- package/dist/hub-service/db/pool.js.map +1 -0
- package/dist/hub-service/enrollment.d.ts +29 -0
- package/dist/hub-service/enrollment.d.ts.map +1 -0
- package/dist/hub-service/enrollment.js +48 -0
- package/dist/hub-service/enrollment.js.map +1 -0
- package/dist/hub-service/envelope-routes.d.ts +46 -0
- package/dist/hub-service/envelope-routes.d.ts.map +1 -0
- package/dist/hub-service/envelope-routes.js +94 -0
- package/dist/hub-service/envelope-routes.js.map +1 -0
- package/dist/hub-service/handlers/installers.d.ts +14 -0
- package/dist/hub-service/handlers/installers.d.ts.map +1 -0
- package/dist/hub-service/handlers/installers.js +8 -0
- package/dist/hub-service/handlers/installers.js.map +1 -0
- package/dist/hub-service/http-server.d.ts +31 -0
- package/dist/hub-service/http-server.d.ts.map +1 -0
- package/dist/hub-service/http-server.js +711 -0
- package/dist/hub-service/http-server.js.map +1 -0
- package/dist/hub-service/hub-jwt.d.ts +30 -0
- package/dist/hub-service/hub-jwt.d.ts.map +1 -0
- package/dist/hub-service/hub-jwt.js +105 -0
- package/dist/hub-service/hub-jwt.js.map +1 -0
- package/dist/hub-service/jwt-revocation.d.ts +20 -0
- package/dist/hub-service/jwt-revocation.d.ts.map +1 -0
- package/dist/hub-service/jwt-revocation.js +18 -0
- package/dist/hub-service/jwt-revocation.js.map +1 -0
- package/dist/hub-service/machines.d.ts +16 -0
- package/dist/hub-service/machines.d.ts.map +1 -0
- package/dist/hub-service/machines.js +14 -0
- package/dist/hub-service/machines.js.map +1 -0
- package/dist/hub-service/main.d.ts +3 -0
- package/dist/hub-service/main.d.ts.map +1 -0
- package/dist/hub-service/main.js +64 -0
- package/dist/hub-service/main.js.map +1 -0
- package/dist/hub-service/member-tokens.d.ts +11 -0
- package/dist/hub-service/member-tokens.d.ts.map +1 -0
- package/dist/hub-service/member-tokens.js +49 -0
- package/dist/hub-service/member-tokens.js.map +1 -0
- package/dist/hub-service/member-view.d.ts +20 -0
- package/dist/hub-service/member-view.d.ts.map +1 -0
- package/dist/hub-service/member-view.js +76 -0
- package/dist/hub-service/member-view.js.map +1 -0
- package/dist/hub-service/members.d.ts +44 -0
- package/dist/hub-service/members.d.ts.map +1 -0
- package/dist/hub-service/members.js +25 -0
- package/dist/hub-service/members.js.map +1 -0
- package/dist/hub-service/presence.d.ts +40 -0
- package/dist/hub-service/presence.d.ts.map +1 -0
- package/dist/hub-service/presence.js +44 -0
- package/dist/hub-service/presence.js.map +1 -0
- package/dist/hub-service/project-view.d.ts +12 -0
- package/dist/hub-service/project-view.d.ts.map +1 -0
- package/dist/hub-service/project-view.js +34 -0
- package/dist/hub-service/project-view.js.map +1 -0
- package/dist/hub-service/projects.d.ts +48 -0
- package/dist/hub-service/projects.d.ts.map +1 -0
- package/dist/hub-service/projects.js +80 -0
- package/dist/hub-service/projects.js.map +1 -0
- package/dist/hub-service/relay-queue.d.ts +115 -0
- package/dist/hub-service/relay-queue.d.ts.map +1 -0
- package/dist/hub-service/relay-queue.js +148 -0
- package/dist/hub-service/relay-queue.js.map +1 -0
- package/dist/hub-service/session-jwt.d.ts +10 -0
- package/dist/hub-service/session-jwt.d.ts.map +1 -0
- package/dist/hub-service/session-jwt.js +69 -0
- package/dist/hub-service/session-jwt.js.map +1 -0
- package/dist/hub-service/usage.d.ts +40 -0
- package/dist/hub-service/usage.d.ts.map +1 -0
- package/dist/hub-service/usage.js +25 -0
- package/dist/hub-service/usage.js.map +1 -0
- package/dist/hub-service/users.d.ts +56 -0
- package/dist/hub-service/users.d.ts.map +1 -0
- package/dist/hub-service/users.js +72 -0
- package/dist/hub-service/users.js.map +1 -0
- package/dist/hub-service/workspaces.d.ts +20 -0
- package/dist/hub-service/workspaces.d.ts.map +1 -0
- package/dist/hub-service/workspaces.js +10 -0
- package/dist/hub-service/workspaces.js.map +1 -0
- package/dist/index.js +254 -132
- package/dist/index.js.map +1 -1
- package/dist/os/linux.d.ts +14 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +80 -4
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +15 -0
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows.d.ts +36 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +74 -18
- package/dist/os/windows.js.map +1 -1
- package/dist/paths.d.ts +23 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -1
- package/dist/providers/agy.d.ts +20 -2
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +259 -21
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +16 -2
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +283 -16
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +13 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +36 -6
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +13 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +34 -7
- 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 +13 -2
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +49 -5
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +61 -0
- package/dist/providers/none.d.ts.map +1 -0
- package/dist/providers/none.js +124 -0
- package/dist/providers/none.js.map +1 -0
- package/dist/providers/opencode.d.ts +14 -2
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +104 -4
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +156 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +54 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.d.ts +3 -3
- package/dist/services/agent-provisioner.d.ts.map +1 -1
- package/dist/services/agent-provisioner.js +11 -7
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/auth-socket.d.ts.map +1 -1
- package/dist/services/auth-socket.js +2 -0
- package/dist/services/auth-socket.js.map +1 -1
- package/dist/services/budget-awareness.d.ts +130 -0
- package/dist/services/budget-awareness.d.ts.map +1 -0
- package/dist/services/budget-awareness.js +129 -0
- package/dist/services/budget-awareness.js.map +1 -0
- 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/cloud-sync.d.ts +35 -0
- package/dist/services/cloud-sync.d.ts.map +1 -0
- package/dist/services/cloud-sync.js +90 -0
- package/dist/services/cloud-sync.js.map +1 -0
- package/dist/services/context-admission.d.ts +82 -0
- package/dist/services/context-admission.d.ts.map +1 -0
- package/dist/services/context-admission.js +136 -0
- package/dist/services/context-admission.js.map +1 -0
- package/dist/services/event-bus.d.ts +27 -0
- package/dist/services/event-bus.d.ts.map +1 -0
- package/dist/services/event-bus.js +20 -0
- package/dist/services/event-bus.js.map +1 -0
- package/dist/services/file-chunker.d.ts +38 -0
- package/dist/services/file-chunker.d.ts.map +1 -0
- package/dist/services/file-chunker.js +63 -0
- package/dist/services/file-chunker.js.map +1 -0
- package/dist/services/file-transfer-relay.d.ts +55 -0
- package/dist/services/file-transfer-relay.d.ts.map +1 -0
- package/dist/services/file-transfer-relay.js +115 -0
- package/dist/services/file-transfer-relay.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +12 -2
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +25 -0
- package/dist/services/http-transport.d.ts.map +1 -0
- package/dist/services/http-transport.js +371 -0
- package/dist/services/http-transport.js.map +1 -0
- package/dist/services/hub-client.d.ts +69 -0
- package/dist/services/hub-client.d.ts.map +1 -0
- package/dist/services/hub-client.js +217 -0
- package/dist/services/hub-client.js.map +1 -0
- package/dist/services/jwt.d.ts +17 -0
- package/dist/services/jwt.d.ts.map +1 -0
- package/dist/services/jwt.js +70 -0
- package/dist/services/jwt.js.map +1 -0
- 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/known-sessions.d.ts +8 -0
- package/dist/services/known-sessions.d.ts.map +1 -0
- package/dist/services/known-sessions.js +40 -0
- package/dist/services/known-sessions.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/model-pricing.d.ts +36 -0
- package/dist/services/model-pricing.d.ts.map +1 -0
- package/dist/services/model-pricing.js +108 -0
- package/dist/services/model-pricing.js.map +1 -0
- package/dist/services/orphan-recovery.d.ts +59 -0
- package/dist/services/orphan-recovery.d.ts.map +1 -0
- package/dist/services/orphan-recovery.js +122 -0
- package/dist/services/orphan-recovery.js.map +1 -0
- package/dist/services/pending-responses.d.ts +23 -0
- package/dist/services/pending-responses.d.ts.map +1 -0
- package/dist/services/pending-responses.js +52 -0
- package/dist/services/pending-responses.js.map +1 -0
- 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/registry.d.ts +4 -1
- package/dist/services/registry.d.ts.map +1 -1
- package/dist/services/registry.js +3 -0
- package/dist/services/registry.js.map +1 -1
- package/dist/services/relay-context.d.ts +23 -0
- package/dist/services/relay-context.d.ts.map +1 -0
- package/dist/services/relay-context.js +8 -0
- package/dist/services/relay-context.js.map +1 -0
- package/dist/services/relay-executor.d.ts +68 -0
- package/dist/services/relay-executor.d.ts.map +1 -0
- package/dist/services/relay-executor.js +70 -0
- package/dist/services/relay-executor.js.map +1 -0
- package/dist/services/relay-request.d.ts +65 -0
- package/dist/services/relay-request.d.ts.map +1 -0
- package/dist/services/relay-request.js +129 -0
- package/dist/services/relay-request.js.map +1 -0
- package/dist/services/relay-strategy.d.ts +19 -0
- package/dist/services/relay-strategy.d.ts.map +1 -0
- package/dist/services/relay-strategy.js +111 -0
- package/dist/services/relay-strategy.js.map +1 -0
- package/dist/services/service-manager/index.d.ts +5 -0
- package/dist/services/service-manager/index.d.ts.map +1 -0
- package/dist/services/service-manager/index.js +66 -0
- package/dist/services/service-manager/index.js.map +1 -0
- package/dist/services/service-manager/linux.d.ts +10 -0
- package/dist/services/service-manager/linux.d.ts.map +1 -0
- package/dist/services/service-manager/linux.js +97 -0
- package/dist/services/service-manager/linux.js.map +1 -0
- package/dist/services/service-manager/macos.d.ts +10 -0
- package/dist/services/service-manager/macos.d.ts.map +1 -0
- package/dist/services/service-manager/macos.js +94 -0
- package/dist/services/service-manager/macos.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +18 -0
- package/dist/services/service-manager/types.d.ts.map +1 -0
- package/dist/services/service-manager/types.js +5 -0
- package/dist/services/service-manager/types.js.map +1 -0
- package/dist/services/service-manager/windows.d.ts +10 -0
- package/dist/services/service-manager/windows.d.ts.map +1 -0
- package/dist/services/service-manager/windows.js +73 -0
- package/dist/services/service-manager/windows.js.map +1 -0
- package/dist/services/session-registry.d.ts +70 -0
- package/dist/services/session-registry.d.ts.map +1 -0
- package/dist/services/session-registry.js +91 -0
- package/dist/services/session-registry.js.map +1 -0
- package/dist/services/singleton.d.ts +15 -0
- package/dist/services/singleton.d.ts.map +1 -0
- package/dist/services/singleton.js +98 -0
- package/dist/services/singleton.js.map +1 -0
- package/dist/services/sprint-coordination.d.ts +168 -0
- package/dist/services/sprint-coordination.d.ts.map +1 -0
- package/dist/services/sprint-coordination.js +564 -0
- package/dist/services/sprint-coordination.js.map +1 -0
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +70 -3
- package/dist/services/ssh.js.map +1 -1
- 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 -33
- 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 +187 -12
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts +50 -0
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +268 -18
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +57 -7
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.d.ts +20 -0
- package/dist/services/substitution-engine.d.ts.map +1 -0
- package/dist/services/substitution-engine.js +92 -0
- package/dist/services/substitution-engine.js.map +1 -0
- package/dist/services/task-cleanup.d.ts.map +1 -1
- package/dist/services/task-cleanup.js +1 -9
- package/dist/services/task-cleanup.js.map +1 -1
- package/dist/services/token-issuer.d.ts +47 -0
- package/dist/services/token-issuer.d.ts.map +1 -0
- package/dist/services/token-issuer.js +63 -0
- package/dist/services/token-issuer.js.map +1 -0
- package/dist/services/tool-registry.d.ts +3 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +225 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/user-config.d.ts +14 -0
- package/dist/services/user-config.d.ts.map +1 -1
- package/dist/services/user-config.js +55 -0
- package/dist/services/user-config.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/vcs/types.d.ts +44 -0
- package/dist/services/vcs/types.d.ts.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 +114 -0
- package/dist/skills/pm/beads.md +6 -0
- package/dist/skills/pm/cost.md +3 -0
- package/dist/skills/pm/doer-reviewer-loop.md +3 -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 +250 -2
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/child-id-allocator.d.ts +45 -0
- package/dist/tools/child-id-allocator.d.ts.map +1 -0
- package/dist/tools/child-id-allocator.js +62 -0
- package/dist/tools/child-id-allocator.js.map +1 -0
- package/dist/tools/cloud-control.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 +38 -4
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +295 -33
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/dolt-push-mutex.d.ts +44 -0
- package/dist/tools/dolt-push-mutex.d.ts.map +1 -0
- package/dist/tools/dolt-push-mutex.js +83 -0
- package/dist/tools/dolt-push-mutex.js.map +1 -0
- package/dist/tools/execute-command.d.ts +13 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +108 -21
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +84 -12
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +1191 -88
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/get-member-model-pricing.d.ts +21 -0
- package/dist/tools/get-member-model-pricing.d.ts.map +1 -0
- package/dist/tools/get-member-model-pricing.js +29 -0
- package/dist/tools/get-member-model-pricing.js.map +1 -0
- 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/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +39 -7
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +1 -1
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +16 -2
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +29 -0
- package/dist/tools/member-reservation.d.ts.map +1 -0
- package/dist/tools/member-reservation.js +71 -0
- package/dist/tools/member-reservation.js.map +1 -0
- 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/provision-vcs-auth.d.ts +7 -7
- package/dist/tools/provision-vcs-auth.js +1 -1
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +20 -5
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +174 -6
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts +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 +33 -0
- package/dist/tools/report-status.d.ts.map +1 -0
- package/dist/tools/report-status.js +45 -0
- package/dist/tools/report-status.js.map +1 -0
- package/dist/tools/respond-to-message.d.ts +21 -0
- package/dist/tools/respond-to-message.d.ts.map +1 -0
- package/dist/tools/respond-to-message.js +23 -0
- package/dist/tools/respond-to-message.js.map +1 -0
- 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/send-files.d.ts +3 -0
- package/dist/tools/send-files.d.ts.map +1 -1
- package/dist/tools/send-files.js +88 -8
- package/dist/tools/send-files.js.map +1 -1
- package/dist/tools/send-message.d.ts +27 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +46 -0
- package/dist/tools/send-message.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/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +19 -0
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +11 -8
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +36 -2
- package/dist/tools/update-member.js.map +1 -1
- package/dist/types.d.ts +16 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +2 -1
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +7 -2
- package/dist/utils/agent-helpers.js.map +1 -1
- package/dist/utils/pid-helpers.d.ts +15 -0
- package/dist/utils/pid-helpers.d.ts.map +1 -1
- package/dist/utils/pid-helpers.js +23 -0
- package/dist/utils/pid-helpers.js.map +1 -1
- package/dist/utils/process-utils.d.ts +3 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +42 -0
- package/dist/utils/process-utils.js.map +1 -0
- package/dist/utils/prompt-errors.d.ts +2 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +13 -3
- 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/utils/workspace-trust.d.ts +24 -0
- package/dist/utils/workspace-trust.d.ts.map +1 -0
- package/dist/utils/workspace-trust.js +35 -0
- package/dist/utils/workspace-trust.js.map +1 -0
- package/dist/workflows/auto-sprint.js +994 -91
- package/package.json +40 -9
- package/packages/apra-fleet-client/package.json +26 -0
- package/packages/apra-fleet-client/src/client/api.mjs +510 -0
- package/packages/apra-fleet-client/src/client/client.mjs +146 -0
- package/packages/apra-fleet-client/src/client/errors.mjs +71 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +65 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +265 -0
- package/packages/apra-fleet-client/src/client/transport.mjs +327 -0
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +303 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +101 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +151 -0
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +259 -0
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +188 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +332 -0
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +216 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +201 -0
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +322 -0
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +234 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +275 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-input.json +35 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +164 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-input.json +26 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-input.json +19 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +17 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +82 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +31 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +75 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-input.json +20 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +61 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/kb-reconciler-output.json +87 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +30 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +65 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +50 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +135 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +402 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +148 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +157 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/doer-reviewer-loop.md +300 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +127 -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/apra-pm/skills/pm/simple-sprint.md +65 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +327 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/worktrees.md +92 -0
- package/packages/apra-fleet-se/apra-pm/version.json +3 -0
- package/packages/apra-fleet-se/bin/cli.mjs +864 -0
- package/packages/apra-fleet-se/bin/serve.mjs +395 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +178 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +940 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +177 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +191 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +23 -0
- 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/fleet-sprint-diagram.md +94 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/shared-orchestrator-reservation-design.md +399 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +1125 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +72 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-settle.mjs +972 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1310 -0
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +616 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +118 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +10747 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +114 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +350 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-lock.mjs +140 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-progress.mjs +101 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +435 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +68 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +53 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +146 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/generic-git.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +235 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +218 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +942 -0
- package/packages/apra-fleet-se/package.json +29 -0
- package/packages/apra-fleet-se/workflow.json +1 -0
- package/packages/apra-fleet-workflow/package.json +30 -0
- package/packages/apra-fleet-workflow/src/viewer/command-output-cap.mjs +112 -0
- package/packages/apra-fleet-workflow/src/viewer/debounced-writer.mjs +153 -0
- package/packages/apra-fleet-workflow/src/viewer/html-utils.mjs +31 -0
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +1439 -0
- package/packages/apra-fleet-workflow/src/viewer/lean-state.mjs +237 -0
- package/packages/apra-fleet-workflow/src/viewer/run-state-paths.mjs +130 -0
- package/packages/apra-fleet-workflow/src/viewer/run-title.mjs +60 -0
- package/packages/apra-fleet-workflow/src/viewer/sprint-state-paths.mjs +29 -0
- package/packages/apra-fleet-workflow/src/workflow/engine.mjs +200 -0
- package/packages/apra-fleet-workflow/src/workflow/errors.mjs +146 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +1727 -0
- package/packages/apra-fleet-workflow/src/workflow/journal.mjs +291 -0
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +99 -0
- package/packages/apra-fleet-workflow/src/workflow/vetting.mjs +111 -0
- package/scripts/agy-transcript-reader.js +1 -0
- package/scripts/fleet-statusline.sh +17 -13
- package/skills/fleet/SKILL.md +37 -2
- package/skills/fleet/beads.md +14 -7
- package/skills/fleet/knowledge-agent.md +66 -0
- package/skills/fleet/permissions.md +76 -2
- package/skills/fleet/profiles/base-dev.json +11 -1
- package/skills/fleet/profiles/base-reviewer.json +9 -1
- package/skills/fleet/profiles/node.json +2 -2
- package/skills/fleet/profiles/tag-kb-reconciler.json +20 -0
- package/version.json +1 -1
- package/scripts/agy-settings-merge.js +0 -27
- /package/{dist → packages/apra-fleet-se/apra-pm}/agents/_shared/GRAPH-SEMANTICS.md +0 -0
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { TimeoutError, AbortError, TransportClosedError } from './errors.mjs';
|
|
2
|
+
|
|
3
|
+
// Conservative fallback when no timeout hint is supplied by the caller and
|
|
4
|
+
// none can be derived from the request payload. Never infinite: a server
|
|
5
|
+
// that accepts a request and never replies (without closing the transport)
|
|
6
|
+
// must not hang the caller forever.
|
|
7
|
+
export const DEFAULT_REQUEST_TIMEOUT_MS = 15 * 60 * 1000; // 15 minutes
|
|
8
|
+
|
|
9
|
+
export class McpClient {
|
|
10
|
+
constructor(transport) {
|
|
11
|
+
this.transport = transport;
|
|
12
|
+
this.pendingRequests = new Map();
|
|
13
|
+
this.nextId = 1;
|
|
14
|
+
|
|
15
|
+
this.transport.on('message', (message) => {
|
|
16
|
+
this.handleMessage(message);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
this.transport.on('close', () => {
|
|
20
|
+
for (const [id, pending] of this.pendingRequests.entries()) {
|
|
21
|
+
pending.reject(new TransportClosedError('Transport closed', { details: { requestId: id } }));
|
|
22
|
+
}
|
|
23
|
+
this.pendingRequests.clear();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
this.transport.on('error', (err) => {
|
|
27
|
+
for (const [id, pending] of this.pendingRequests.entries()) {
|
|
28
|
+
pending.reject(err);
|
|
29
|
+
}
|
|
30
|
+
this.pendingRequests.clear();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
handleMessage(message) {
|
|
35
|
+
if (message.jsonrpc === '2.0' && 'id' in message) {
|
|
36
|
+
const pending = this.pendingRequests.get(message.id);
|
|
37
|
+
if (pending) {
|
|
38
|
+
// A late reply (arriving after the request already timed out
|
|
39
|
+
// or was aborted) has no pending entry left to resolve --
|
|
40
|
+
// this is a silent no-op rather than a crash or corruption
|
|
41
|
+
// of any other in-flight request.
|
|
42
|
+
this.pendingRequests.delete(message.id);
|
|
43
|
+
if ('error' in message) {
|
|
44
|
+
const errMsg = message.error?.message || JSON.stringify(message.error);
|
|
45
|
+
pending.reject(new Error(errMsg));
|
|
46
|
+
} else {
|
|
47
|
+
pending.resolve(message.result);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {string} method
|
|
55
|
+
* @param {object} [params]
|
|
56
|
+
* @param {{ timeoutMs?: number, signal?: AbortSignal }} [opts]
|
|
57
|
+
* - timeoutMs: reject with a TimeoutError (.code === 'TIMEOUT') if no
|
|
58
|
+
* response arrives within this window. Defaults to
|
|
59
|
+
* DEFAULT_REQUEST_TIMEOUT_MS when omitted -- never infinite.
|
|
60
|
+
* - signal: an optional AbortSignal; aborting rejects the pending
|
|
61
|
+
* request with an AbortError (.code === 'ABORTED') and removes it
|
|
62
|
+
* from the pending map.
|
|
63
|
+
*
|
|
64
|
+
* NOTE: this is a *client-side* timeout/abort only. It stops the client
|
|
65
|
+
* from waiting forever and frees local resources, but it cannot cancel
|
|
66
|
+
* the remote job -- the fleet-server process keeps running the request
|
|
67
|
+
* it already accepted. True remote cancellation (and idempotency keys
|
|
68
|
+
* to make retries safe) require fleet-server changes, which are out of
|
|
69
|
+
* scope here (external repo, apra-fleet.exe).
|
|
70
|
+
*/
|
|
71
|
+
async request(method, params, opts = {}) {
|
|
72
|
+
const id = this.nextId++;
|
|
73
|
+
const message = {
|
|
74
|
+
jsonrpc: "2.0",
|
|
75
|
+
id: id,
|
|
76
|
+
method: method,
|
|
77
|
+
params: params
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const timeoutMs = opts.timeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
81
|
+
const signal = opts.signal;
|
|
82
|
+
|
|
83
|
+
return new Promise((resolve, reject) => {
|
|
84
|
+
let settled = false;
|
|
85
|
+
let timer = null;
|
|
86
|
+
|
|
87
|
+
const onAbort = () => {
|
|
88
|
+
settleReject(new AbortError(`Request "${method}" (id=${id}) aborted before a response was received.`, {
|
|
89
|
+
details: { method, id }
|
|
90
|
+
}));
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const cleanup = () => {
|
|
94
|
+
if (settled) return;
|
|
95
|
+
settled = true;
|
|
96
|
+
if (timer) clearTimeout(timer);
|
|
97
|
+
if (signal) signal.removeEventListener('abort', onAbort);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const settleResolve = (value) => {
|
|
101
|
+
if (settled) return;
|
|
102
|
+
cleanup();
|
|
103
|
+
resolve(value);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const settleReject = (err) => {
|
|
107
|
+
if (settled) return;
|
|
108
|
+
this.pendingRequests.delete(id);
|
|
109
|
+
cleanup();
|
|
110
|
+
reject(err);
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
if (signal) {
|
|
114
|
+
if (signal.aborted) {
|
|
115
|
+
onAbort();
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
signal.addEventListener('abort', onAbort);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (timeoutMs !== Infinity && timeoutMs != null) {
|
|
122
|
+
// Intentionally not unref()'d: a caller awaiting this
|
|
123
|
+
// request should keep the process alive until it settles
|
|
124
|
+
// (resolve, reject, timeout, or abort) rather than letting
|
|
125
|
+
// the process exit while the promise is still pending.
|
|
126
|
+
timer = setTimeout(() => {
|
|
127
|
+
settleReject(new TimeoutError(
|
|
128
|
+
`Request "${method}" (id=${id}) timed out after ${timeoutMs}ms with no response.`,
|
|
129
|
+
{ details: { method, id, timeoutMs } }
|
|
130
|
+
));
|
|
131
|
+
}, timeoutMs);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
this.pendingRequests.set(id, { resolve: settleResolve, reject: settleReject });
|
|
135
|
+
|
|
136
|
+
this.transport.send(message).catch(err => {
|
|
137
|
+
this.pendingRequests.delete(id);
|
|
138
|
+
settleReject(err);
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
async callTool(name, args, opts = {}) {
|
|
144
|
+
return this.request("tools/call", { name: name, arguments: args }, opts);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal typed error shape for the transport/client layer.
|
|
3
|
+
*
|
|
4
|
+
* NOTE (apra-fleet-unw.5): packages/apra-fleet-workflow/src/workflow/errors.mjs
|
|
5
|
+
* already defines a `WorkflowError` taxonomy (MEMBER_NOT_FOUND,
|
|
6
|
+
* AGENT_OUTPUT_INVALID, COMMAND_FAILED, TRANSPORT_ERROR, ...), but
|
|
7
|
+
* apra-fleet-client is a lower-level package that apra-fleet-workflow
|
|
8
|
+
* *depends on* (see packages/apra-fleet-workflow/package.json), so
|
|
9
|
+
* client.mjs cannot import from the workflow package without introducing a
|
|
10
|
+
* circular dependency. This module defines a small, compatible error shape
|
|
11
|
+
* (`message`, `.code`, `.details`, `.cause`) for use at the MCP
|
|
12
|
+
* request/transport layer. When the two taxonomies are reconciled, consider
|
|
13
|
+
* hoisting a shared base error class into a package both can depend on (e.g.
|
|
14
|
+
* a `@apralabs/apra-fleet-errors` package), or having the workflow layer's
|
|
15
|
+
* `FleetTransportError` classifier recognize `.code === 'TIMEOUT'` /
|
|
16
|
+
* `.code === 'ABORTED'` from this module and re-wrap accordingly.
|
|
17
|
+
*/
|
|
18
|
+
export class ClientError extends Error {
|
|
19
|
+
/**
|
|
20
|
+
* @param {string} message
|
|
21
|
+
* @param {{ code: string, details?: object, cause?: unknown }} opts
|
|
22
|
+
*/
|
|
23
|
+
constructor(message, { code, details, cause } = {}) {
|
|
24
|
+
super(message, cause !== undefined ? { cause } : undefined);
|
|
25
|
+
this.name = this.constructor.name;
|
|
26
|
+
this.code = code || 'CLIENT_ERROR';
|
|
27
|
+
this.details = details;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Thrown by McpClient.request() when no JSON-RPC response arrives within the
|
|
33
|
+
* configured (or default) timeout window.
|
|
34
|
+
*/
|
|
35
|
+
export class TimeoutError extends ClientError {
|
|
36
|
+
constructor(message, opts = {}) {
|
|
37
|
+
super(message, { code: 'TIMEOUT', ...opts });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Thrown by McpClient.request() when the caller-supplied AbortSignal fires
|
|
43
|
+
* before a response arrives.
|
|
44
|
+
*/
|
|
45
|
+
export class AbortError extends ClientError {
|
|
46
|
+
constructor(message, opts = {}) {
|
|
47
|
+
super(message, { code: 'ABORTED', ...opts });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Thrown (as the rejection for every in-flight request) when the underlying
|
|
53
|
+
* transport closes -- deliberate stop(), or the persistent SSE stream dying
|
|
54
|
+
* past its reconnect budget. Previously a bare `new Error('Transport
|
|
55
|
+
* closed')`, indistinguishable downstream from any other failure; typed so
|
|
56
|
+
* callers can classify it as a connectivity event (retryable at their
|
|
57
|
+
* discretion) rather than a request-level failure.
|
|
58
|
+
*
|
|
59
|
+
* CONVENTION (2026-07-19 stabilization): when execute_prompt /
|
|
60
|
+
* execute_command surface a NEW kind of failure that downstream code needs
|
|
61
|
+
* to branch on, add a typed error class HERE (transport/request-level
|
|
62
|
+
* failures) or a `reason` code on the workflow layer's AgentDispatchError
|
|
63
|
+
* (dispatch-level failures reported via structuredContent.isError, e.g.
|
|
64
|
+
* 'busy', 'empty_response', 'max_turns_exhausted') -- never a bare Error
|
|
65
|
+
* with only a message string to sniff.
|
|
66
|
+
*/
|
|
67
|
+
export class TransportClosedError extends ClientError {
|
|
68
|
+
constructor(message, opts = {}) {
|
|
69
|
+
super(message, { code: 'TRANSPORT_CLOSED', ...opts });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StdioTransport, StreamableHttpTransport } from './transport.mjs';
|
|
2
|
+
import { McpClient } from './client.mjs';
|
|
3
|
+
import { ApraFleet } from './api.mjs';
|
|
4
|
+
import { FleetWorkflow } from '../workflow/index.mjs';
|
|
5
|
+
import { WorkflowEngine } from '../workflow/engine.mjs';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Creates and initializes a WorkflowEngine along with its underlying transport and API layers.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} config
|
|
11
|
+
* @param {'stdio'|'http'} config.transport
|
|
12
|
+
* @param {string} [config.command] - Required if transport is 'stdio'
|
|
13
|
+
* @param {string[]} [config.args] - Optional args if transport is 'stdio'
|
|
14
|
+
* @param {string} [config.url] - Required if transport is 'http'
|
|
15
|
+
* @param {Object} [config.options] - Transport options
|
|
16
|
+
* @param {Object} [config.workflowArgs] - Arguments for the workflow context
|
|
17
|
+
* @returns {Promise<{transport: any, mcpClient: McpClient, apraFleet: ApraFleet, fleetWorkflow: FleetWorkflow, engine: WorkflowEngine}>}
|
|
18
|
+
*/
|
|
19
|
+
export async function createWorkflowEngine(config) {
|
|
20
|
+
let transport;
|
|
21
|
+
|
|
22
|
+
if (config.transport === 'stdio') {
|
|
23
|
+
if (!config.command) {
|
|
24
|
+
throw new Error("StdioTransport requires a 'command' property in config.");
|
|
25
|
+
}
|
|
26
|
+
transport = new StdioTransport(config.command, config.args || [], config.options || {});
|
|
27
|
+
} else if (config.transport === 'http') {
|
|
28
|
+
if (!config.url) {
|
|
29
|
+
throw new Error("StreamableHttpTransport requires a 'url' property in config.");
|
|
30
|
+
}
|
|
31
|
+
transport = new StreamableHttpTransport(config.url, config.options || {});
|
|
32
|
+
} else {
|
|
33
|
+
throw new Error(`Unsupported transport type: ${config.transport}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
await transport.start();
|
|
37
|
+
|
|
38
|
+
const mcpClient = new McpClient(transport);
|
|
39
|
+
|
|
40
|
+
// Standard MCP requires the client to initialize the connection
|
|
41
|
+
if (config.transport === 'stdio') {
|
|
42
|
+
await mcpClient.request('initialize', {
|
|
43
|
+
protocolVersion: '2024-11-05',
|
|
44
|
+
capabilities: {},
|
|
45
|
+
clientInfo: { name: 'fleet-client', version: '1.0.0' }
|
|
46
|
+
});
|
|
47
|
+
await transport.send({
|
|
48
|
+
jsonrpc: '2.0',
|
|
49
|
+
method: 'notifications/initialized',
|
|
50
|
+
params: {}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const apraFleet = new ApraFleet(mcpClient);
|
|
55
|
+
const fleetWorkflow = new FleetWorkflow(apraFleet, config.workflowArgs || {});
|
|
56
|
+
const engine = new WorkflowEngine(fleetWorkflow);
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
transport,
|
|
60
|
+
mcpClient,
|
|
61
|
+
apraFleet,
|
|
62
|
+
fleetWorkflow,
|
|
63
|
+
engine
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared fleet-server resolution -- the ONE implementation of "how does a client
|
|
3
|
+
* process reach the apra-fleet MCP server".
|
|
4
|
+
*
|
|
5
|
+
* Binding design doc: docs/adr-workflow-server-resolution.md (apra-fleet-7pm.6).
|
|
6
|
+
* Consumers: src/cli/workflow.ts (the `apra-fleet workflow` launcher) and
|
|
7
|
+
* packages/apra-fleet-se/bin/cli.mjs (auto-sprint). Neither duplicates this logic.
|
|
8
|
+
*
|
|
9
|
+
* Resolution order (ADR Decision 1):
|
|
10
|
+
* 1. APRA_FLEET_TRANSPORT override ('http' | 'stdio').
|
|
11
|
+
* - 'stdio' -> stdio self-spawn, no probe.
|
|
12
|
+
* - APRA_FLEET_SERVER_CMD/_BIN set (and transport is not forced 'http')
|
|
13
|
+
* -> explicit stdio request, no probe.
|
|
14
|
+
* - 'http' -> probe only; NEVER falls back to stdio.
|
|
15
|
+
* - unset -> http is the product default: probe, then fall back.
|
|
16
|
+
* 2. HTTP singleton probe -- checkRunningInstance(): ~/.apra-fleet/data/server.json
|
|
17
|
+
* {pid, url}, pid-alive check + GET <url with /mcp -> /health> (2s timeout),
|
|
18
|
+
* self-healing (deletes a stale server.json). On success: attach over
|
|
19
|
+
* StreamableHttpTransport, spawn nothing.
|
|
20
|
+
* 3. stdio self-spawn fallback -- the existing four command tiers
|
|
21
|
+
* (APRA_FLEET_SERVER_CMD, APRA_FLEET_SERVER_BIN, bundled sibling index.js,
|
|
22
|
+
* dev-monorepo dist/index.js), fed to StdioTransport.
|
|
23
|
+
*
|
|
24
|
+
* Scope guard (ADR): the launcher/auto-sprint client and the MCP server are ALWAYS
|
|
25
|
+
* separate processes. This module decides only the transport, never merges them.
|
|
26
|
+
*
|
|
27
|
+
* Every branch is unit-testable: all filesystem/env/network access goes through the
|
|
28
|
+
* injectable `deps` bag.
|
|
29
|
+
*/
|
|
30
|
+
import fs from 'node:fs';
|
|
31
|
+
import http from 'node:http';
|
|
32
|
+
import path from 'node:path';
|
|
33
|
+
import os from 'node:os';
|
|
34
|
+
import { fileURLToPath } from 'node:url';
|
|
35
|
+
import { StdioTransport, StreamableHttpTransport } from './transport.mjs';
|
|
36
|
+
import { McpClient } from './client.mjs';
|
|
37
|
+
import { ApraFleet } from './api.mjs';
|
|
38
|
+
|
|
39
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
40
|
+
|
|
41
|
+
/** @returns {string} ~/.apra-fleet/data (honors APRA_FLEET_DATA_DIR, like src/paths.ts) */
|
|
42
|
+
export function getFleetDataDir(env = process.env) {
|
|
43
|
+
return env.APRA_FLEET_DATA_DIR ?? path.join(os.homedir(), '.apra-fleet', 'data');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** @returns {string} path to the running server's server.json */
|
|
47
|
+
export function getServerInfoPath(env = process.env) {
|
|
48
|
+
return path.join(getFleetDataDir(env), 'server.json');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* pid-liveness check. Mirrors src/utils/process-utils.ts isPidAlive().
|
|
53
|
+
* @param {number} pid
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
function isPidAlive(pid) {
|
|
57
|
+
try {
|
|
58
|
+
process.kill(pid, 0);
|
|
59
|
+
return true;
|
|
60
|
+
} catch (err) {
|
|
61
|
+
// EPERM means the process exists but is owned by another user -- alive.
|
|
62
|
+
return err && err.code === 'EPERM';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* GET <url with a trailing /mcp replaced by /health>, 2s timeout.
|
|
68
|
+
* @param {string} url
|
|
69
|
+
* @returns {Promise<boolean>}
|
|
70
|
+
*/
|
|
71
|
+
function checkHealthEndpoint(url) {
|
|
72
|
+
const healthUrl = url.replace(/\/mcp$/, '/health');
|
|
73
|
+
return new Promise((resolve) => {
|
|
74
|
+
const req = http.get(healthUrl, { timeout: 2000 }, (res) => {
|
|
75
|
+
res.resume();
|
|
76
|
+
resolve(res.statusCode === 200);
|
|
77
|
+
});
|
|
78
|
+
req.on('error', () => resolve(false));
|
|
79
|
+
req.on('timeout', () => { req.destroy(); resolve(false); });
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The HTTP-singleton probe. Same semantics as src/services/singleton.ts's
|
|
85
|
+
* checkRunningInstance() (pid + /health + self-heal), so the launcher's probe and
|
|
86
|
+
* the server's own startup-dedup can never disagree.
|
|
87
|
+
*
|
|
88
|
+
* @param {{ env?: Record<string, string|undefined>, readFile?: (p: string) => string,
|
|
89
|
+
* unlink?: (p: string) => void, pidAlive?: (pid: number) => boolean,
|
|
90
|
+
* health?: (url: string) => Promise<boolean> }} [deps]
|
|
91
|
+
* @returns {Promise<{running: true, url: string, pid: number} | {running: false}>}
|
|
92
|
+
*/
|
|
93
|
+
export async function checkRunningInstance(deps = {}) {
|
|
94
|
+
const env = deps.env || process.env;
|
|
95
|
+
const readFile = deps.readFile || ((p) => fs.readFileSync(p, 'utf8'));
|
|
96
|
+
const unlink = deps.unlink || ((p) => { try { fs.unlinkSync(p); } catch { /* already gone */ } });
|
|
97
|
+
const pidAlive = deps.pidAlive || isPidAlive;
|
|
98
|
+
const health = deps.health || checkHealthEndpoint;
|
|
99
|
+
|
|
100
|
+
const serverInfoPath = getServerInfoPath(env);
|
|
101
|
+
|
|
102
|
+
let info;
|
|
103
|
+
try {
|
|
104
|
+
info = JSON.parse(readFile(serverInfoPath));
|
|
105
|
+
} catch {
|
|
106
|
+
return { running: false };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (!info || !info.pid || !info.url) return { running: false };
|
|
110
|
+
|
|
111
|
+
if (!pidAlive(info.pid)) {
|
|
112
|
+
unlink(serverInfoPath);
|
|
113
|
+
return { running: false };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (!(await health(info.url))) {
|
|
117
|
+
unlink(serverInfoPath);
|
|
118
|
+
return { running: false };
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return { running: true, url: info.url, pid: info.pid };
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Tier 3 of the ADR: the stdio self-spawn command, four resolution tiers.
|
|
126
|
+
* This is the single implementation; packages/apra-fleet-se/bin/cli.mjs re-exports it
|
|
127
|
+
* under its historical name with identical behavior.
|
|
128
|
+
*
|
|
129
|
+
* @param {{ env?: Record<string, string|undefined>, dirname?: string,
|
|
130
|
+
* exists?: (candidate: string) => boolean }} [deps]
|
|
131
|
+
* @returns {{ command: string, args: string[] }}
|
|
132
|
+
*/
|
|
133
|
+
export function resolveFleetServerCommand(deps = {}) {
|
|
134
|
+
const env = deps.env || process.env;
|
|
135
|
+
// Default dirname: the *consumer's* location matters, so callers that care
|
|
136
|
+
// (cli.mjs) pass their own __dirname. Falling back to this module's dirname
|
|
137
|
+
// keeps the dev-monorepo tier working for direct callers.
|
|
138
|
+
const dirname = deps.dirname || __dirname;
|
|
139
|
+
const exists = deps.exists || fs.existsSync;
|
|
140
|
+
|
|
141
|
+
if (env.APRA_FLEET_SERVER_CMD) {
|
|
142
|
+
const parts = env.APRA_FLEET_SERVER_CMD.split(' ').filter(Boolean);
|
|
143
|
+
if (parts.length === 0) {
|
|
144
|
+
throw new Error('APRA_FLEET_SERVER_CMD is set but empty.');
|
|
145
|
+
}
|
|
146
|
+
return { command: parts[0], args: parts.slice(1) };
|
|
147
|
+
}
|
|
148
|
+
if (env.APRA_FLEET_SERVER_BIN) {
|
|
149
|
+
return { command: env.APRA_FLEET_SERVER_BIN, args: ['run', '--transport', 'stdio'] };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const bundledSiblingEntry = path.join(dirname, 'index.js');
|
|
153
|
+
const devMonorepoEntry = path.resolve(dirname, '..', '..', '..', 'dist', 'index.js');
|
|
154
|
+
|
|
155
|
+
for (const entry of [bundledSiblingEntry, devMonorepoEntry]) {
|
|
156
|
+
if (exists(entry)) {
|
|
157
|
+
return { command: 'node', args: [entry, 'run', '--transport', 'stdio'] };
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
throw new Error(
|
|
162
|
+
'[apra-fleet-se] Could not locate the apra-fleet MCP server entry point. Tried:\n' +
|
|
163
|
+
` - ${bundledSiblingEntry} (bundled layout)\n` +
|
|
164
|
+
` - ${devMonorepoEntry} (dev-monorepo layout)\n` +
|
|
165
|
+
'Set APRA_FLEET_SERVER_CMD (a full "<command> <args...>" string) or ' +
|
|
166
|
+
'APRA_FLEET_SERVER_BIN (a server executable resolved via PATH) to point at your ' +
|
|
167
|
+
'apra-fleet server explicitly.',
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* The ADR's resolution order, as a pure descriptor (nothing is spawned or connected).
|
|
173
|
+
*
|
|
174
|
+
* @param {{ env?: Record<string, string|undefined>, dirname?: string,
|
|
175
|
+
* exists?: (candidate: string) => boolean,
|
|
176
|
+
* checkRunningInstance?: (deps?: object) => Promise<object> }} [deps]
|
|
177
|
+
* @returns {Promise<{mode: 'http', url: string, pid: number, reason: string}
|
|
178
|
+
* | {mode: 'stdio', command: string, args: string[], reason: string}>}
|
|
179
|
+
*/
|
|
180
|
+
export async function resolveFleetServerConnection(deps = {}) {
|
|
181
|
+
const env = deps.env || process.env;
|
|
182
|
+
const probe = deps.checkRunningInstance || checkRunningInstance;
|
|
183
|
+
|
|
184
|
+
const forced = (env.APRA_FLEET_TRANSPORT || '').trim().toLowerCase();
|
|
185
|
+
if (forced && forced !== 'http' && forced !== 'stdio') {
|
|
186
|
+
throw new Error(
|
|
187
|
+
`APRA_FLEET_TRANSPORT is set to '${env.APRA_FLEET_TRANSPORT}'. Valid values are 'http' or 'stdio'.`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// Step 1 -- forced-transport / explicit stdio escape hatches.
|
|
192
|
+
const explicitStdioCmd = Boolean(env.APRA_FLEET_SERVER_CMD || env.APRA_FLEET_SERVER_BIN);
|
|
193
|
+
if (forced === 'stdio' || (forced !== 'http' && explicitStdioCmd)) {
|
|
194
|
+
const cmd = resolveFleetServerCommand(deps);
|
|
195
|
+
return {
|
|
196
|
+
mode: 'stdio',
|
|
197
|
+
...cmd,
|
|
198
|
+
reason: forced === 'stdio'
|
|
199
|
+
? 'APRA_FLEET_TRANSPORT=stdio forced'
|
|
200
|
+
: 'APRA_FLEET_SERVER_CMD/APRA_FLEET_SERVER_BIN set (explicit stdio request)',
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Step 2 -- HTTP singleton probe (the default path).
|
|
205
|
+
const instance = await probe({ env });
|
|
206
|
+
if (instance && instance.running) {
|
|
207
|
+
return {
|
|
208
|
+
mode: 'http',
|
|
209
|
+
url: instance.url,
|
|
210
|
+
pid: instance.pid,
|
|
211
|
+
reason: `attached to HTTP singleton at ${instance.url} (pid ${instance.pid})`,
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// An explicit APRA_FLEET_TRANSPORT=http must never silently become a private
|
|
216
|
+
// stdio server (ADR Decision 1, step 1).
|
|
217
|
+
if (forced === 'http') {
|
|
218
|
+
throw new Error(
|
|
219
|
+
'APRA_FLEET_TRANSPORT=http was requested, but no healthy apra-fleet HTTP singleton was found.\n' +
|
|
220
|
+
` Checked: ${getServerInfoPath(env)} (pid alive + GET /health)\n` +
|
|
221
|
+
" Start one with 'apra-fleet start' (or 'apra-fleet install'), or unset " +
|
|
222
|
+
'APRA_FLEET_TRANSPORT to allow the stdio self-spawn fallback.',
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Step 3 -- stdio self-spawn fallback.
|
|
227
|
+
const cmd = resolveFleetServerCommand(deps);
|
|
228
|
+
return {
|
|
229
|
+
mode: 'stdio',
|
|
230
|
+
...cmd,
|
|
231
|
+
reason: `no healthy fleet singleton found; self-spawning stdio server via ${cmd.command} ${cmd.args.join(' ')}`,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Resolve + connect, returning a live MCP client bound to whichever transport the
|
|
237
|
+
* ADR order selected.
|
|
238
|
+
*
|
|
239
|
+
* @param {object} [deps] same bag as resolveFleetServerConnection, plus `options`
|
|
240
|
+
* forwarded to the transport.
|
|
241
|
+
* @returns {Promise<{transport: object, mcpClient: McpClient, fleetApi: ApraFleet, mode: 'http'|'stdio'}>}
|
|
242
|
+
*/
|
|
243
|
+
export async function connectFleet(deps = {}) {
|
|
244
|
+
const resolution = await resolveFleetServerConnection(deps);
|
|
245
|
+
const options = deps.options || {};
|
|
246
|
+
|
|
247
|
+
const transport = resolution.mode === 'http'
|
|
248
|
+
? new StreamableHttpTransport(resolution.url, options)
|
|
249
|
+
: new StdioTransport(resolution.command, resolution.args, options);
|
|
250
|
+
|
|
251
|
+
await transport.start();
|
|
252
|
+
|
|
253
|
+
const mcpClient = new McpClient(transport);
|
|
254
|
+
|
|
255
|
+
if (resolution.mode === 'stdio') {
|
|
256
|
+
await mcpClient.request('initialize', {
|
|
257
|
+
protocolVersion: '2024-11-05',
|
|
258
|
+
capabilities: {},
|
|
259
|
+
clientInfo: { name: 'fleet-client', version: '1.0.0' },
|
|
260
|
+
});
|
|
261
|
+
await transport.send({ jsonrpc: '2.0', method: 'notifications/initialized', params: {} });
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return { transport, mcpClient, fleetApi: new ApraFleet(mcpClient), mode: resolution.mode };
|
|
265
|
+
}
|