@apralabs/apra-fleet 0.4.3 → 0.4.4
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 +66 -30
- package/dist/agents/backlog-groomer.md +75 -27
- package/dist/agents/ci-watcher.md +37 -22
- package/dist/agents/deployer.md +39 -22
- package/dist/agents/doer.md +74 -40
- package/dist/agents/harvester.md +49 -40
- package/dist/agents/integ-test-runner.md +40 -23
- package/dist/agents/kb-reconciler.md +28 -7
- package/dist/agents/plan-reviewer.md +49 -24
- package/dist/agents/planner.md +66 -43
- package/dist/agents/regression-test-runner.md +101 -78
- package/dist/agents/reviewer.md +117 -56
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/doer-output.json +32 -0
- package/dist/agents/schemas/harvester-input.json +1 -5
- package/dist/agents/schemas/planner-output.json +1 -1
- package/dist/agents/schemas/regression-test-runner-output.json +41 -7
- package/dist/agents/schemas/reviewer-output.json +62 -3
- package/dist/cli/agent-transform.d.ts +7 -0
- package/dist/cli/agent-transform.js +46 -1
- package/dist/cli/auth.d.ts +1 -0
- package/dist/cli/auth.js +38 -8
- package/dist/cli/beads-install.d.ts +35 -0
- package/dist/cli/beads-install.js +125 -0
- package/dist/cli/beads-pin.d.ts +5 -0
- package/dist/cli/beads-pin.js +27 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +18 -2
- package/dist/cli/dolt-install.js +46 -15
- package/dist/cli/fleet-se-guard.d.ts +51 -0
- package/dist/cli/fleet-se-guard.js +215 -0
- package/dist/cli/install-guard.d.ts +54 -0
- package/dist/cli/install-guard.js +132 -4
- package/dist/cli/install.d.ts +77 -21
- package/dist/cli/install.js +610 -152
- package/dist/cli/kb-commit.d.ts +2 -1
- package/dist/cli/kb-commit.js +1 -1
- package/dist/cli/kb-import.d.ts +2 -1
- package/dist/cli/kb-import.js +1 -1
- package/dist/cli/register-member.js +20 -3
- package/dist/cli/remove-member.d.ts +4 -0
- package/dist/cli/remove-member.js +63 -0
- package/dist/cli/secret.js +9 -0
- package/dist/cli/start.js +59 -4
- package/dist/cli/status.d.ts +3 -0
- package/dist/cli/status.js +45 -12
- package/dist/cli/stop.js +64 -9
- package/dist/cli/uninstall.js +101 -15
- package/dist/cli/update.js +33 -2
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.js +9 -2
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +155 -8
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/linux.d.ts +7 -2
- package/dist/os/linux.js +40 -14
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +17 -2
- package/dist/os/windows-gitbash.d.ts +1 -0
- package/dist/os/windows-gitbash.js +17 -3
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +5 -2
- package/dist/os/windows.js +75 -29
- package/dist/paths.d.ts +21 -0
- package/dist/paths.js +35 -0
- package/dist/providers/agy.d.ts +6 -2
- package/dist/providers/agy.js +245 -106
- package/dist/providers/claude-permission-denial.d.ts +7 -0
- package/dist/providers/claude-permission-denial.js +137 -0
- package/dist/providers/claude.d.ts +86 -38
- package/dist/providers/claude.js +426 -164
- package/dist/providers/codex.js +5 -1
- package/dist/providers/copilot.js +5 -1
- package/dist/providers/opencode.d.ts +10 -2
- package/dist/providers/opencode.js +114 -53
- package/dist/providers/provider.d.ts +171 -33
- package/dist/providers/provider.js +164 -3
- package/dist/services/agent-provisioner.d.ts +29 -0
- package/dist/services/agent-provisioner.js +107 -0
- package/dist/services/agent-shadow.d.ts +96 -0
- package/dist/services/agent-shadow.js +479 -0
- package/dist/services/agy-project.d.ts +2 -1
- package/dist/services/agy-project.js +15 -17
- package/dist/services/auth-socket.d.ts +25 -0
- package/dist/services/auth-socket.js +68 -23
- package/dist/services/auth-web.js +1 -1
- package/dist/services/budget-awareness.d.ts +11 -11
- package/dist/services/budget-awareness.js +15 -3
- package/dist/services/claude-local-scope-mcp.d.ts +19 -0
- package/dist/services/claude-local-scope-mcp.js +91 -0
- package/dist/services/cloud/aws.js +2 -1
- package/dist/services/cloud/lifecycle.js +19 -2
- package/dist/services/cloud/task-wrapper.d.ts +0 -9
- package/dist/services/cloud/task-wrapper.js +15 -6
- package/dist/services/event-loop-watchdog.d.ts +32 -0
- package/dist/services/event-loop-watchdog.js +140 -0
- package/dist/services/http-transport.d.ts +49 -1
- package/dist/services/http-transport.js +190 -24
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
- package/dist/services/knowledge/bible-basis-filter.js +134 -0
- package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
- package/dist/services/knowledge/bible-blob-id.js +113 -0
- package/dist/services/knowledge/bible-import.d.ts +65 -0
- package/dist/services/knowledge/bible-import.js +211 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +153 -23
- package/dist/services/knowledge/http-provider.d.ts +4 -3
- package/dist/services/knowledge/http-provider.js +17 -5
- package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
- package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
- package/dist/services/knowledge/kb-providers.d.ts +4 -0
- package/dist/services/knowledge/kb-providers.js +8 -0
- package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
- package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
- package/dist/services/knowledge/kb-scopes.d.ts +14 -0
- package/dist/services/knowledge/kb-scopes.js +47 -0
- package/dist/services/knowledge/kb-self.d.ts +91 -0
- package/dist/services/knowledge/kb-self.js +198 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +194 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +2 -2
- package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
- package/dist/services/knowledge/sqlite-provider.js +303 -41
- package/dist/services/knowledge/types.d.ts +45 -2
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-call-counts.d.ts +24 -0
- package/dist/services/member-call-counts.js +58 -0
- package/dist/services/member-config-io.d.ts +192 -0
- package/dist/services/member-config-io.js +443 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1895 -0
- package/dist/services/member-secret-env.d.ts +42 -0
- package/dist/services/member-secret-env.js +68 -0
- package/dist/services/member-tool-allowlist.d.ts +49 -0
- package/dist/services/member-tool-allowlist.js +111 -0
- package/dist/services/model-pricing.d.ts +19 -0
- package/dist/services/model-pricing.js +54 -8
- package/dist/services/port-holder.d.ts +86 -0
- package/dist/services/port-holder.js +351 -0
- package/dist/services/preflight-check.js +2 -0
- package/dist/services/registry.d.ts +13 -2
- package/dist/services/registry.js +27 -1
- package/dist/services/relay-strategy.d.ts +2 -0
- package/dist/services/relay-strategy.js +8 -0
- package/dist/services/server-lifecycle.d.ts +26 -0
- package/dist/services/server-lifecycle.js +85 -0
- package/dist/services/service-manager/index.d.ts +7 -1
- package/dist/services/service-manager/index.js +17 -4
- package/dist/services/service-manager/linux.d.ts +1 -1
- package/dist/services/service-manager/linux.js +15 -7
- package/dist/services/service-manager/macos.d.ts +11 -1
- package/dist/services/service-manager/macos.js +45 -7
- package/dist/services/service-manager/service-path.d.ts +24 -0
- package/dist/services/service-manager/service-path.js +55 -0
- package/dist/services/service-manager/types.d.ts +38 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +181 -2
- package/dist/services/service-manager/windows.js +666 -49
- package/dist/services/service-notice.d.ts +14 -0
- package/dist/services/service-notice.js +62 -0
- package/dist/services/service-start-guard.d.ts +20 -0
- package/dist/services/service-start-guard.js +86 -0
- package/dist/services/session-cost.d.ts +24 -0
- package/dist/services/session-cost.js +105 -0
- package/dist/services/session-mcp-config.d.ts +83 -0
- package/dist/services/session-mcp-config.js +211 -0
- package/dist/services/sftp.d.ts +34 -0
- package/dist/services/sftp.js +304 -76
- package/dist/services/shell-probe.d.ts +0 -24
- package/dist/services/shell-probe.js +28 -3
- package/dist/services/singleton.d.ts +68 -2
- package/dist/services/singleton.js +168 -11
- package/dist/services/sprint-coordination.js +9 -3
- package/dist/services/ssh.d.ts +27 -0
- package/dist/services/ssh.js +229 -38
- package/dist/services/stall/find-log-file.js +12 -5
- package/dist/services/stall/index.d.ts +1 -1
- package/dist/services/stall/read-log-tail.d.ts +23 -0
- package/dist/services/stall/read-log-tail.js +33 -2
- package/dist/services/stall/stall-detector.d.ts +25 -1
- package/dist/services/stall/stall-detector.js +85 -6
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.js +50 -6
- package/dist/services/stopped-marker.d.ts +16 -0
- package/dist/services/stopped-marker.js +55 -0
- package/dist/services/strategy.d.ts +33 -1
- package/dist/services/strategy.js +86 -17
- package/dist/services/supervisor-service-cleanup.d.ts +52 -0
- package/dist/services/supervisor-service-cleanup.js +332 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +160 -59
- package/dist/services/tool-scope.d.ts +58 -0
- package/dist/services/tool-scope.js +99 -0
- package/dist/services/watch/project-resolver.js +1 -0
- package/dist/skills/auto-sprint-args/SKILL.md +2 -2
- package/dist/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/dist/skills/pm/SKILL.md +3 -3
- package/dist/skills/pm/index.md +4 -2
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +5 -5
- package/dist/tools/check-status.d.ts +53 -5
- package/dist/tools/check-status.js +210 -53
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/child-id-allocator.js +1 -1
- package/dist/tools/code-index-heal.d.ts +8 -0
- package/dist/tools/code-index-heal.js +21 -0
- package/dist/tools/code-index-state.d.ts +45 -0
- package/dist/tools/code-index-state.js +115 -0
- package/dist/tools/code-intelligence-codebase-memory.js +6 -33
- package/dist/tools/code-intelligence-freshness.js +1 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
- package/dist/tools/code-intelligence-gitnexus.js +333 -57
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +99 -0
- package/dist/tools/code-intelligence-readiness.js +206 -0
- package/dist/tools/code-intelligence-reindex.d.ts +195 -0
- package/dist/tools/code-intelligence-reindex.js +530 -50
- package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
- package/dist/tools/code-intelligence-telemetry.js +12 -3
- package/dist/tools/code-intelligence.d.ts +81 -31
- package/dist/tools/code-intelligence.js +156 -52
- package/dist/tools/compose-permissions.d.ts +57 -2
- package/dist/tools/compose-permissions.js +497 -44
- package/dist/tools/execute-command.d.ts +11 -0
- package/dist/tools/execute-command.js +80 -12
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +544 -133
- package/dist/tools/kb-bible-commit.d.ts +65 -0
- package/dist/tools/kb-bible-commit.js +239 -0
- package/dist/tools/kb-capture.d.ts +13 -9
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +60 -9
- package/dist/tools/kb-export.d.ts +96 -7
- package/dist/tools/kb-export.js +228 -65
- package/dist/tools/kb-feedback.d.ts +13 -9
- package/dist/tools/kb-feedback.js +13 -7
- package/dist/tools/kb-freshness-sweep.d.ts +11 -7
- package/dist/tools/kb-freshness-sweep.js +7 -7
- package/dist/tools/kb-harvest.d.ts +11 -7
- package/dist/tools/kb-harvest.js +7 -7
- package/dist/tools/kb-import.d.ts +26 -10
- package/dist/tools/kb-import.js +169 -159
- package/dist/tools/kb-invalidate.d.ts +17 -10
- package/dist/tools/kb-invalidate.js +41 -8
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +30 -10
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +14 -8
- package/dist/tools/kb-query.d.ts +21 -11
- package/dist/tools/kb-query.js +76 -13
- package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
- package/dist/tools/kb-reconcile-prefilter.js +10 -8
- package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
- package/dist/tools/kb-resolve-contradiction.js +7 -7
- package/dist/tools/kb-session-prime.d.ts +14 -7
- package/dist/tools/kb-session-prime.js +44 -44
- package/dist/tools/kb-setup.d.ts +11 -4
- package/dist/tools/kb-setup.js +25 -11
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +5 -2
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +88 -17
- package/dist/tools/member-reservation.d.ts +2 -2
- package/dist/tools/provision-auth.d.ts +39 -1
- package/dist/tools/provision-auth.js +269 -47
- package/dist/tools/provision-vcs-auth.d.ts +2 -2
- package/dist/tools/receive-files.js +3 -1
- package/dist/tools/register-member.d.ts +34 -8
- package/dist/tools/register-member.js +76 -58
- package/dist/tools/remove-member.js +110 -32
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/send-files.js +6 -4
- package/dist/tools/session-stats.d.ts +17 -0
- package/dist/tools/session-stats.js +27 -0
- package/dist/tools/shutdown-server.js +5 -0
- package/dist/tools/update-agent-cli.d.ts +19 -0
- package/dist/tools/update-agent-cli.js +59 -2
- package/dist/tools/update-member.d.ts +13 -10
- package/dist/tools/update-member.js +138 -7
- package/dist/tools/vcs-credential-exec.js +8 -2
- package/dist/types.d.ts +98 -1
- package/dist/utils/agent-helpers.js +2 -0
- package/dist/utils/auth-env.d.ts +15 -4
- package/dist/utils/auth-env.js +52 -23
- package/dist/utils/find-on-path.d.ts +37 -0
- package/dist/utils/find-on-path.js +85 -0
- package/dist/utils/log-helpers.d.ts +37 -0
- package/dist/utils/log-helpers.js +106 -20
- package/dist/utils/owner-only-fs.d.ts +56 -0
- package/dist/utils/owner-only-fs.js +98 -0
- package/dist/utils/process-utils.d.ts +28 -0
- package/dist/utils/process-utils.js +68 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/session-caller.d.ts +4 -2
- package/dist/utils/session-caller.js +3 -2
- package/dist/utils/shell-escape.d.ts +42 -3
- package/dist/utils/shell-escape.js +70 -4
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +223 -43
- package/package.json +11 -8
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +558 -27
- package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
- package/packages/apra-fleet-client/src/client/client.mjs +9 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
- package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +75 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +37 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +39 -22
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +74 -40
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +49 -40
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +40 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +28 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +49 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +66 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +101 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -56
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
- package/packages/apra-fleet-se/bin/cli.mjs +184 -54
- package/packages/apra-fleet-se/bin/serve.mjs +143 -10
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +56 -20
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +208 -53
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +576 -33
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +9 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +114 -7
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +154 -8
- package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +12 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +60 -1
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +25 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +22 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +205 -16
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +52 -14
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +6 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +339 -20
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +210 -11
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +200 -9
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +57 -9
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +53 -4
- package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1257 -301
- package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
- package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
- package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
- package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +447 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +250 -29
- package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +82 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +97 -50
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +81 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +43 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +20 -15
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +60 -38
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +42 -10
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +16 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +36 -3
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +72 -12
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +83 -25
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +834 -142
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +130 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +44 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +84 -30
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +138 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +111 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +22 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +180 -14
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +134 -7
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +99 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +49 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +8 -4
- package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +235 -21
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
- package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
- package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
- package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
- package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
- package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
- package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
- package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
- package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
- package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
- package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
- package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
- package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
- package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
- package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
- package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
- package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
- package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
- package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
- package/packages/apra-fleet-workflow/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +64 -9
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +71 -5
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/version.json +1 -1
- package/dist/cli/agent-transform.d.ts.map +0 -1
- package/dist/cli/agent-transform.js.map +0 -1
- package/dist/cli/auth.d.ts.map +0 -1
- package/dist/cli/auth.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/dolt-install.d.ts.map +0 -1
- package/dist/cli/dolt-install.js.map +0 -1
- package/dist/cli/install-guard.d.ts.map +0 -1
- package/dist/cli/install-guard.js.map +0 -1
- package/dist/cli/install.d.ts.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/join.d.ts.map +0 -1
- package/dist/cli/join.js.map +0 -1
- package/dist/cli/kb-commit.d.ts.map +0 -1
- package/dist/cli/kb-commit.js.map +0 -1
- package/dist/cli/kb-directives.d.ts.map +0 -1
- package/dist/cli/kb-directives.js.map +0 -1
- package/dist/cli/kb-import.d.ts.map +0 -1
- package/dist/cli/kb-import.js.map +0 -1
- package/dist/cli/register-member.d.ts.map +0 -1
- package/dist/cli/register-member.js.map +0 -1
- package/dist/cli/restart.d.ts.map +0 -1
- package/dist/cli/restart.js.map +0 -1
- package/dist/cli/secret.d.ts.map +0 -1
- package/dist/cli/secret.js.map +0 -1
- package/dist/cli/spoke.d.ts.map +0 -1
- package/dist/cli/spoke.js.map +0 -1
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js.map +0 -1
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/stop.d.ts.map +0 -1
- package/dist/cli/stop.js.map +0 -1
- package/dist/cli/uninstall.d.ts.map +0 -1
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/workflow-assets.d.ts.map +0 -1
- package/dist/cli/workflow-assets.js.map +0 -1
- package/dist/cli/workflow.d.ts.map +0 -1
- package/dist/cli/workflow.js.map +0 -1
- package/dist/commands/kb-server.d.ts.map +0 -1
- package/dist/commands/kb-server.js.map +0 -1
- package/dist/delivery-mode.d.ts.map +0 -1
- package/dist/delivery-mode.js.map +0 -1
- package/dist/hub-service/activity.d.ts.map +0 -1
- package/dist/hub-service/activity.js.map +0 -1
- package/dist/hub-service/audit-log.d.ts.map +0 -1
- package/dist/hub-service/audit-log.js.map +0 -1
- package/dist/hub-service/db/pool.d.ts.map +0 -1
- package/dist/hub-service/db/pool.js.map +0 -1
- package/dist/hub-service/enrollment.d.ts.map +0 -1
- package/dist/hub-service/enrollment.js.map +0 -1
- package/dist/hub-service/envelope-routes.d.ts.map +0 -1
- package/dist/hub-service/envelope-routes.js.map +0 -1
- package/dist/hub-service/handlers/installers.d.ts.map +0 -1
- package/dist/hub-service/handlers/installers.js.map +0 -1
- package/dist/hub-service/http-server.d.ts.map +0 -1
- package/dist/hub-service/http-server.js.map +0 -1
- package/dist/hub-service/hub-jwt.d.ts.map +0 -1
- package/dist/hub-service/hub-jwt.js.map +0 -1
- package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
- package/dist/hub-service/jwt-revocation.js.map +0 -1
- package/dist/hub-service/machines.d.ts.map +0 -1
- package/dist/hub-service/machines.js.map +0 -1
- package/dist/hub-service/main.d.ts.map +0 -1
- package/dist/hub-service/main.js.map +0 -1
- package/dist/hub-service/member-tokens.d.ts.map +0 -1
- package/dist/hub-service/member-tokens.js.map +0 -1
- package/dist/hub-service/member-view.d.ts.map +0 -1
- package/dist/hub-service/member-view.js.map +0 -1
- package/dist/hub-service/members.d.ts.map +0 -1
- package/dist/hub-service/members.js.map +0 -1
- package/dist/hub-service/presence.d.ts.map +0 -1
- package/dist/hub-service/presence.js.map +0 -1
- package/dist/hub-service/project-view.d.ts.map +0 -1
- package/dist/hub-service/project-view.js.map +0 -1
- package/dist/hub-service/projects.d.ts.map +0 -1
- package/dist/hub-service/projects.js.map +0 -1
- package/dist/hub-service/relay-queue.d.ts.map +0 -1
- package/dist/hub-service/relay-queue.js.map +0 -1
- package/dist/hub-service/session-jwt.d.ts.map +0 -1
- package/dist/hub-service/session-jwt.js.map +0 -1
- package/dist/hub-service/usage.d.ts.map +0 -1
- package/dist/hub-service/usage.js.map +0 -1
- package/dist/hub-service/users.d.ts.map +0 -1
- package/dist/hub-service/users.js.map +0 -1
- package/dist/hub-service/workspaces.d.ts.map +0 -1
- package/dist/hub-service/workspaces.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/onboarding/text.d.ts.map +0 -1
- package/dist/onboarding/text.js.map +0 -1
- package/dist/os/git-bash-candidates.d.ts.map +0 -1
- package/dist/os/git-bash-candidates.js.map +0 -1
- package/dist/os/index.d.ts.map +0 -1
- package/dist/os/index.js.map +0 -1
- package/dist/os/linux.d.ts.map +0 -1
- package/dist/os/linux.js.map +0 -1
- package/dist/os/macos.d.ts.map +0 -1
- package/dist/os/macos.js.map +0 -1
- package/dist/os/os-commands.d.ts.map +0 -1
- package/dist/os/os-commands.js.map +0 -1
- package/dist/os/windows-gitbash.d.ts.map +0 -1
- package/dist/os/windows-gitbash.js.map +0 -1
- package/dist/os/windows-wrapper.d.ts.map +0 -1
- package/dist/os/windows-wrapper.js.map +0 -1
- package/dist/os/windows.d.ts.map +0 -1
- package/dist/os/windows.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/providers/agy.d.ts.map +0 -1
- package/dist/providers/agy.js.map +0 -1
- package/dist/providers/claude.d.ts.map +0 -1
- package/dist/providers/claude.js.map +0 -1
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/email/headers.d.ts.map +0 -1
- package/dist/providers/email/headers.js.map +0 -1
- package/dist/providers/email/index.d.ts.map +0 -1
- package/dist/providers/email/index.js.map +0 -1
- package/dist/providers/email/provider.d.ts.map +0 -1
- package/dist/providers/email/provider.js.map +0 -1
- package/dist/providers/email/sendgrid.d.ts.map +0 -1
- package/dist/providers/email/sendgrid.js.map +0 -1
- package/dist/providers/email/smtp.d.ts.map +0 -1
- package/dist/providers/email/smtp.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/none.d.ts.map +0 -1
- package/dist/providers/none.js.map +0 -1
- package/dist/providers/opencode.d.ts.map +0 -1
- package/dist/providers/opencode.js.map +0 -1
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/provider.js.map +0 -1
- package/dist/services/agent-provisioner.d.ts.map +0 -1
- package/dist/services/agent-provisioner.js.map +0 -1
- package/dist/services/agy-project.d.ts.map +0 -1
- package/dist/services/agy-project.js.map +0 -1
- package/dist/services/auth-socket.d.ts.map +0 -1
- package/dist/services/auth-socket.js.map +0 -1
- package/dist/services/auth-web.d.ts.map +0 -1
- package/dist/services/auth-web.js.map +0 -1
- package/dist/services/budget-awareness.d.ts.map +0 -1
- package/dist/services/budget-awareness.js.map +0 -1
- package/dist/services/cloud/activity.d.ts.map +0 -1
- package/dist/services/cloud/activity.js.map +0 -1
- package/dist/services/cloud/aws.d.ts.map +0 -1
- package/dist/services/cloud/aws.js.map +0 -1
- package/dist/services/cloud/cost.d.ts.map +0 -1
- package/dist/services/cloud/cost.js.map +0 -1
- package/dist/services/cloud/idle-manager.d.ts.map +0 -1
- package/dist/services/cloud/idle-manager.js.map +0 -1
- package/dist/services/cloud/lifecycle.d.ts.map +0 -1
- package/dist/services/cloud/lifecycle.js.map +0 -1
- package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
- package/dist/services/cloud/task-wrapper.js.map +0 -1
- package/dist/services/cloud/types.d.ts.map +0 -1
- package/dist/services/cloud/types.js.map +0 -1
- package/dist/services/cloud-sync.d.ts.map +0 -1
- package/dist/services/cloud-sync.js.map +0 -1
- package/dist/services/context-admission.d.ts.map +0 -1
- package/dist/services/context-admission.js.map +0 -1
- package/dist/services/credential-cleanup.d.ts.map +0 -1
- package/dist/services/credential-cleanup.js.map +0 -1
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/event-bus.d.ts.map +0 -1
- package/dist/services/event-bus.js.map +0 -1
- package/dist/services/exit-drain.d.ts.map +0 -1
- package/dist/services/exit-drain.js.map +0 -1
- package/dist/services/file-chunker.d.ts.map +0 -1
- package/dist/services/file-chunker.js.map +0 -1
- package/dist/services/file-transfer-relay.d.ts.map +0 -1
- package/dist/services/file-transfer-relay.js.map +0 -1
- package/dist/services/file-transfer.d.ts.map +0 -1
- package/dist/services/file-transfer.js.map +0 -1
- package/dist/services/git-config.d.ts.map +0 -1
- package/dist/services/git-config.js.map +0 -1
- package/dist/services/github-app.d.ts.map +0 -1
- package/dist/services/github-app.js.map +0 -1
- package/dist/services/http-transport.d.ts.map +0 -1
- package/dist/services/http-transport.js.map +0 -1
- package/dist/services/hub-client.d.ts.map +0 -1
- package/dist/services/hub-client.js.map +0 -1
- package/dist/services/icons.d.ts.map +0 -1
- package/dist/services/icons.js.map +0 -1
- package/dist/services/jwt.d.ts.map +0 -1
- package/dist/services/jwt.js.map +0 -1
- package/dist/services/knowledge/audn.d.ts.map +0 -1
- package/dist/services/knowledge/audn.js.map +0 -1
- package/dist/services/knowledge/file-hash.d.ts.map +0 -1
- package/dist/services/knowledge/file-hash.js.map +0 -1
- package/dist/services/knowledge/http-provider.d.ts.map +0 -1
- package/dist/services/knowledge/http-provider.js.map +0 -1
- package/dist/services/knowledge/kb-config.d.ts.map +0 -1
- package/dist/services/knowledge/kb-config.js.map +0 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
- package/dist/services/knowledge/kb-providers.js.map +0 -1
- package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
- package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
- package/dist/services/knowledge/kb-scope-input.js +0 -11
- package/dist/services/knowledge/kb-scope-input.js.map +0 -1
- package/dist/services/knowledge/kb-service.d.ts.map +0 -1
- package/dist/services/knowledge/kb-service.js.map +0 -1
- package/dist/services/knowledge/path-validation.d.ts.map +0 -1
- package/dist/services/knowledge/path-validation.js.map +0 -1
- package/dist/services/knowledge/pre-init.d.ts.map +0 -1
- package/dist/services/knowledge/pre-init.js.map +0 -1
- package/dist/services/knowledge/project-slug.d.ts.map +0 -1
- package/dist/services/knowledge/project-slug.js.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.js.map +0 -1
- package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
- package/dist/services/knowledge/sqlite-provider.js.map +0 -1
- package/dist/services/knowledge/types.d.ts.map +0 -1
- package/dist/services/knowledge/types.js.map +0 -1
- package/dist/services/known-hosts.d.ts.map +0 -1
- package/dist/services/known-hosts.js.map +0 -1
- package/dist/services/known-sessions.d.ts.map +0 -1
- package/dist/services/known-sessions.js.map +0 -1
- package/dist/services/member-home.d.ts.map +0 -1
- package/dist/services/member-home.js.map +0 -1
- package/dist/services/member-remote-url.d.ts.map +0 -1
- package/dist/services/member-remote-url.js.map +0 -1
- package/dist/services/model-pricing.d.ts.map +0 -1
- package/dist/services/model-pricing.js.map +0 -1
- package/dist/services/onboarding.d.ts.map +0 -1
- package/dist/services/onboarding.js.map +0 -1
- package/dist/services/orphan-recovery.d.ts.map +0 -1
- package/dist/services/orphan-recovery.js.map +0 -1
- package/dist/services/pending-responses.d.ts.map +0 -1
- package/dist/services/pending-responses.js.map +0 -1
- package/dist/services/preflight-check.d.ts.map +0 -1
- package/dist/services/preflight-check.js.map +0 -1
- package/dist/services/registry.d.ts.map +0 -1
- package/dist/services/registry.js.map +0 -1
- package/dist/services/relay-context.d.ts.map +0 -1
- package/dist/services/relay-context.js.map +0 -1
- package/dist/services/relay-executor.d.ts.map +0 -1
- package/dist/services/relay-executor.js.map +0 -1
- package/dist/services/relay-request.d.ts.map +0 -1
- package/dist/services/relay-request.js.map +0 -1
- package/dist/services/relay-strategy.d.ts.map +0 -1
- package/dist/services/relay-strategy.js.map +0 -1
- package/dist/services/secret-token.d.ts.map +0 -1
- package/dist/services/secret-token.js.map +0 -1
- package/dist/services/service-manager/index.d.ts.map +0 -1
- package/dist/services/service-manager/index.js.map +0 -1
- package/dist/services/service-manager/linux.d.ts.map +0 -1
- package/dist/services/service-manager/linux.js.map +0 -1
- package/dist/services/service-manager/macos.d.ts.map +0 -1
- package/dist/services/service-manager/macos.js.map +0 -1
- package/dist/services/service-manager/types.d.ts.map +0 -1
- package/dist/services/service-manager/types.js.map +0 -1
- package/dist/services/service-manager/windows.d.ts.map +0 -1
- package/dist/services/service-manager/windows.js.map +0 -1
- package/dist/services/session-registry.d.ts.map +0 -1
- package/dist/services/session-registry.js.map +0 -1
- package/dist/services/sftp.d.ts.map +0 -1
- package/dist/services/sftp.js.map +0 -1
- package/dist/services/shell-probe.d.ts.map +0 -1
- package/dist/services/shell-probe.js.map +0 -1
- package/dist/services/singleton.d.ts.map +0 -1
- package/dist/services/singleton.js.map +0 -1
- package/dist/services/sprint-coordination.d.ts.map +0 -1
- package/dist/services/sprint-coordination.js.map +0 -1
- package/dist/services/ssh.d.ts.map +0 -1
- package/dist/services/ssh.js.map +0 -1
- package/dist/services/stall/find-log-file.d.ts.map +0 -1
- package/dist/services/stall/find-log-file.js.map +0 -1
- package/dist/services/stall/index.d.ts.map +0 -1
- package/dist/services/stall/index.js.map +0 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
- package/dist/services/stall/log-path-resolver.js.map +0 -1
- package/dist/services/stall/read-log-tail.d.ts.map +0 -1
- package/dist/services/stall/read-log-tail.js.map +0 -1
- package/dist/services/stall/stall-detector.d.ts.map +0 -1
- package/dist/services/stall/stall-detector.js.map +0 -1
- package/dist/services/stall/stall-poller.d.ts.map +0 -1
- package/dist/services/stall/stall-poller.js.map +0 -1
- package/dist/services/stall/time-utils.d.ts.map +0 -1
- package/dist/services/stall/time-utils.js.map +0 -1
- package/dist/services/statusline.d.ts.map +0 -1
- package/dist/services/statusline.js.map +0 -1
- package/dist/services/strategy.d.ts.map +0 -1
- package/dist/services/strategy.js.map +0 -1
- package/dist/services/substitution-engine.d.ts.map +0 -1
- package/dist/services/substitution-engine.js.map +0 -1
- package/dist/services/task-cleanup.d.ts.map +0 -1
- package/dist/services/task-cleanup.js.map +0 -1
- package/dist/services/token-issuer.d.ts.map +0 -1
- package/dist/services/token-issuer.js.map +0 -1
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/update-check.d.ts.map +0 -1
- package/dist/services/update-check.js.map +0 -1
- package/dist/services/user-config.d.ts.map +0 -1
- package/dist/services/user-config.js.map +0 -1
- package/dist/services/vcs/azure-devops.d.ts.map +0 -1
- package/dist/services/vcs/azure-devops.js.map +0 -1
- package/dist/services/vcs/bitbucket.d.ts.map +0 -1
- package/dist/services/vcs/bitbucket.js.map +0 -1
- package/dist/services/vcs/constants.d.ts.map +0 -1
- package/dist/services/vcs/constants.js.map +0 -1
- package/dist/services/vcs/github.d.ts.map +0 -1
- package/dist/services/vcs/github.js.map +0 -1
- package/dist/services/vcs/types.d.ts.map +0 -1
- package/dist/services/vcs/types.js.map +0 -1
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/services/watch/fleet-log.d.ts.map +0 -1
- package/dist/services/watch/fleet-log.js.map +0 -1
- package/dist/services/watch/project-resolver.d.ts.map +0 -1
- package/dist/services/watch/project-resolver.js.map +0 -1
- package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
- package/dist/services/watch/transcript-formatter.js.map +0 -1
- package/dist/smoke-test.d.ts.map +0 -1
- package/dist/smoke-test.js.map +0 -1
- package/dist/tools/check-status.d.ts.map +0 -1
- package/dist/tools/check-status.js.map +0 -1
- package/dist/tools/child-id-allocator.d.ts.map +0 -1
- package/dist/tools/child-id-allocator.js.map +0 -1
- package/dist/tools/cloud-control.d.ts.map +0 -1
- package/dist/tools/cloud-control.js.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
- package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
- package/dist/tools/code-intelligence-freshness.js.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
- package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
- package/dist/tools/code-intelligence-reindex.js.map +0 -1
- package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
- package/dist/tools/code-intelligence-telemetry.js.map +0 -1
- package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
- package/dist/tools/code-intelligence-tests.js.map +0 -1
- package/dist/tools/code-intelligence.d.ts.map +0 -1
- package/dist/tools/code-intelligence.js.map +0 -1
- package/dist/tools/compose-permissions.d.ts.map +0 -1
- package/dist/tools/compose-permissions.js.map +0 -1
- package/dist/tools/credential-store-delete.d.ts.map +0 -1
- package/dist/tools/credential-store-delete.js.map +0 -1
- package/dist/tools/credential-store-list.d.ts.map +0 -1
- package/dist/tools/credential-store-list.js.map +0 -1
- package/dist/tools/credential-store-set.d.ts.map +0 -1
- package/dist/tools/credential-store-set.js.map +0 -1
- package/dist/tools/credential-store-update.d.ts.map +0 -1
- package/dist/tools/credential-store-update.js.map +0 -1
- package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
- package/dist/tools/dolt-push-mutex.js.map +0 -1
- package/dist/tools/execute-command.d.ts.map +0 -1
- package/dist/tools/execute-command.js.map +0 -1
- package/dist/tools/execute-prompt.d.ts.map +0 -1
- package/dist/tools/execute-prompt.js.map +0 -1
- package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
- package/dist/tools/get-member-model-pricing.js.map +0 -1
- package/dist/tools/kb-capture.d.ts.map +0 -1
- package/dist/tools/kb-capture.js.map +0 -1
- package/dist/tools/kb-context.d.ts.map +0 -1
- package/dist/tools/kb-context.js.map +0 -1
- package/dist/tools/kb-export.d.ts.map +0 -1
- package/dist/tools/kb-export.js.map +0 -1
- package/dist/tools/kb-feedback.d.ts.map +0 -1
- package/dist/tools/kb-feedback.js.map +0 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
- package/dist/tools/kb-freshness-sweep.js.map +0 -1
- package/dist/tools/kb-harvest.d.ts.map +0 -1
- package/dist/tools/kb-harvest.js.map +0 -1
- package/dist/tools/kb-import.d.ts.map +0 -1
- package/dist/tools/kb-import.js.map +0 -1
- package/dist/tools/kb-invalidate.d.ts.map +0 -1
- package/dist/tools/kb-invalidate.js.map +0 -1
- package/dist/tools/kb-list.d.ts.map +0 -1
- package/dist/tools/kb-list.js.map +0 -1
- package/dist/tools/kb-promote.d.ts.map +0 -1
- package/dist/tools/kb-promote.js.map +0 -1
- package/dist/tools/kb-query.d.ts.map +0 -1
- package/dist/tools/kb-query.js.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
- package/dist/tools/kb-resolve-contradiction.js.map +0 -1
- package/dist/tools/kb-session-prime.d.ts.map +0 -1
- package/dist/tools/kb-session-prime.js.map +0 -1
- package/dist/tools/kb-setup.d.ts.map +0 -1
- package/dist/tools/kb-setup.js.map +0 -1
- package/dist/tools/kb-stats.d.ts.map +0 -1
- package/dist/tools/kb-stats.js.map +0 -1
- package/dist/tools/list-members.d.ts.map +0 -1
- package/dist/tools/list-members.js.map +0 -1
- package/dist/tools/member-detail.d.ts.map +0 -1
- package/dist/tools/member-detail.js.map +0 -1
- package/dist/tools/member-reservation.d.ts.map +0 -1
- package/dist/tools/member-reservation.js.map +0 -1
- package/dist/tools/monitor-task.d.ts.map +0 -1
- package/dist/tools/monitor-task.js.map +0 -1
- package/dist/tools/provision-auth.d.ts.map +0 -1
- package/dist/tools/provision-auth.js.map +0 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
- package/dist/tools/provision-vcs-auth.js.map +0 -1
- package/dist/tools/receive-files.d.ts.map +0 -1
- package/dist/tools/receive-files.js.map +0 -1
- package/dist/tools/register-member.d.ts.map +0 -1
- package/dist/tools/register-member.js.map +0 -1
- package/dist/tools/remove-member.d.ts.map +0 -1
- package/dist/tools/remove-member.js.map +0 -1
- package/dist/tools/report-status.d.ts.map +0 -1
- package/dist/tools/report-status.js.map +0 -1
- package/dist/tools/respond-to-message.d.ts.map +0 -1
- package/dist/tools/respond-to-message.js.map +0 -1
- package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
- package/dist/tools/revoke-vcs-auth.js.map +0 -1
- package/dist/tools/send-email.d.ts.map +0 -1
- package/dist/tools/send-email.js.map +0 -1
- package/dist/tools/send-files.d.ts.map +0 -1
- package/dist/tools/send-files.js.map +0 -1
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/setup-git-app.d.ts.map +0 -1
- package/dist/tools/setup-git-app.js.map +0 -1
- package/dist/tools/setup-ssh-key.d.ts.map +0 -1
- package/dist/tools/setup-ssh-key.js.map +0 -1
- package/dist/tools/shutdown-server.d.ts.map +0 -1
- package/dist/tools/shutdown-server.js.map +0 -1
- package/dist/tools/stop-prompt.d.ts.map +0 -1
- package/dist/tools/stop-prompt.js.map +0 -1
- package/dist/tools/update-agent-cli.d.ts.map +0 -1
- package/dist/tools/update-agent-cli.js.map +0 -1
- package/dist/tools/update-member.d.ts.map +0 -1
- package/dist/tools/update-member.js.map +0 -1
- package/dist/tools/vcs-credential-exec.d.ts.map +0 -1
- package/dist/tools/vcs-credential-exec.js.map +0 -1
- package/dist/tools/version.d.ts.map +0 -1
- package/dist/tools/version.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/agent-helpers.d.ts.map +0 -1
- package/dist/utils/agent-helpers.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/auth-env.d.ts.map +0 -1
- package/dist/utils/auth-env.js.map +0 -1
- package/dist/utils/collect-secret.d.ts.map +0 -1
- package/dist/utils/collect-secret.js.map +0 -1
- package/dist/utils/credential-validation.d.ts.map +0 -1
- package/dist/utils/credential-validation.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/gpu-parser.d.ts.map +0 -1
- package/dist/utils/gpu-parser.js.map +0 -1
- package/dist/utils/log-helpers.d.ts.map +0 -1
- package/dist/utils/log-helpers.js.map +0 -1
- package/dist/utils/oob-timeout.d.ts.map +0 -1
- package/dist/utils/oob-timeout.js.map +0 -1
- package/dist/utils/opencode-model-validation.d.ts.map +0 -1
- package/dist/utils/opencode-model-validation.js.map +0 -1
- package/dist/utils/pid-helpers.d.ts.map +0 -1
- package/dist/utils/pid-helpers.js.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/process-utils.d.ts.map +0 -1
- package/dist/utils/process-utils.js.map +0 -1
- package/dist/utils/prompt-errors.d.ts.map +0 -1
- package/dist/utils/prompt-errors.js.map +0 -1
- package/dist/utils/resolve-member.d.ts.map +0 -1
- package/dist/utils/resolve-member.js.map +0 -1
- package/dist/utils/secure-input.d.ts.map +0 -1
- package/dist/utils/secure-input.js.map +0 -1
- package/dist/utils/session-caller.d.ts.map +0 -1
- package/dist/utils/session-caller.js.map +0 -1
- package/dist/utils/shell-escape.d.ts.map +0 -1
- package/dist/utils/shell-escape.js.map +0 -1
- package/dist/utils/skill-matrix.d.ts.map +0 -1
- package/dist/utils/skill-matrix.js.map +0 -1
- package/dist/utils/ssh-error-messages.d.ts.map +0 -1
- package/dist/utils/ssh-error-messages.js.map +0 -1
- package/dist/utils/vcs-provider-detect.d.ts.map +0 -1
- package/dist/utils/vcs-provider-detect.js.map +0 -1
- package/dist/utils/work-folder-validation.d.ts.map +0 -1
- package/dist/utils/work-folder-validation.js.map +0 -1
- package/dist/utils/workspace-trust.d.ts.map +0 -1
- package/dist/utils/workspace-trust.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
package/dist/cli/install.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
+
import { getOrCreateMemberAccessSecret, MEMBER_SECRET_HEADER, readMemberAccessSecret } from '../services/member-access-secret.js';
|
|
3
|
+
import { claudeUserConfigPath, refreshClaudeLocalScopeEntries } from '../services/claude-local-scope-mcp.js';
|
|
2
4
|
import path from 'node:path';
|
|
3
5
|
import os from 'node:os';
|
|
4
6
|
import { execSync, execFileSync } from 'node:child_process';
|
|
5
7
|
import { serverVersion } from '../version.js';
|
|
6
|
-
import { DEFAULT_PORT, LOG_FILE_PATH } from '../paths.js';
|
|
8
|
+
import { BUILTIN_DEFAULT_PORT, DEFAULT_PORT, DEFAULT_HOST, LOG_FILE_PATH, recordedMemberInstallPort, resolveServerPort, validPort } from '../paths.js';
|
|
7
9
|
import { getServiceManager } from '../services/service-manager/index.js';
|
|
8
|
-
import { LINUX_UNIT_NAME, MACOS_PLIST_LABEL
|
|
9
|
-
import { BIN_DIR, HOOKS_DIR, SCRIPTS_DIR, getProviderInstallConfig, readConfig, writeConfig, writeInstallConfig, PROVIDER_STANDARD_MODELS, INSTALLABLE_LLM_PROVIDERS } from './config.js';
|
|
10
|
+
import { LINUX_UNIT_NAME, MACOS_PLIST_LABEL } from '../services/service-manager/types.js';
|
|
11
|
+
import { BIN_DIR, HOOKS_DIR, SCRIPTS_DIR, getProviderInstallConfig, readConfig, readInstallConfig, writeOwnerOnlyFile, writeOwnerOnlyFileAtomic, writeConfig, writeInstallConfig, PROVIDER_STANDARD_MODELS, INSTALLABLE_LLM_PROVIDERS } from './config.js';
|
|
10
12
|
import { transformAgentForOpenCode, transformAgentForAgy, transformAgentForClaude } from './agent-transform.js';
|
|
11
13
|
import { FLEET_DIR } from '../paths.js';
|
|
12
14
|
import { extractWorkflowSubsystemAssets } from './workflow-assets.js';
|
|
13
15
|
import { downloadAndExtractDolt, verifyDolt } from './dolt-install.js';
|
|
14
|
-
import {
|
|
16
|
+
import { installBeads } from './beads-install.js';
|
|
17
|
+
import { classifyRunningServer, relevantServerPids, getInstallDataDir, memberForceMayStop, fullInstallRefusalText, selfInvocationLines, writeMemberInstallMarker, clearMemberInstallMarker, FORCE_STOP_FULL_INSTALL_FLAG, } from './install-guard.js';
|
|
18
|
+
import { detectRunningFleetSe, fleetSeRefusalText, realFleetSeProbes, IGNORE_RUNNING_SPRINTS_FLAG } from './fleet-se-guard.js';
|
|
19
|
+
import { writeServiceNotice, clearServiceNoticeContaining } from '../services/service-notice.js';
|
|
15
20
|
import { convertClaudeAllowToAgyPermissions, formatAgyPermissionRules } from '../providers/agy.js';
|
|
21
|
+
import { codeIntelPathWarning } from '../utils/find-on-path.js';
|
|
22
|
+
import { gitBashCandidates } from '../os/git-bash-candidates.js';
|
|
16
23
|
const realDoltStepDeps = { downloadAndExtractDolt, verifyDolt };
|
|
17
24
|
let doltStepDeps = realDoltStepDeps;
|
|
18
25
|
/** Test-only: inject fakes for the dolt CLI install step's download/verify calls. */
|
|
@@ -23,6 +30,18 @@ export function _setDoltStepDeps(overrides) {
|
|
|
23
30
|
export function _resetDoltStepDeps() {
|
|
24
31
|
doltStepDeps = realDoltStepDeps;
|
|
25
32
|
}
|
|
33
|
+
/** Real transports for the Beads step (execFileSync is mocked by the install tests). */
|
|
34
|
+
function beadsStepDeps() {
|
|
35
|
+
return {
|
|
36
|
+
platform: process.platform,
|
|
37
|
+
exec: (cmd, args, opts) => execFileSync(cmd, args, { stdio: 'pipe', encoding: 'utf-8', shell: opts.shell, windowsHide: true }),
|
|
38
|
+
existsSync: p => fs.existsSync(p),
|
|
39
|
+
mkdirSync: p => { fs.mkdirSync(p, { recursive: true }); },
|
|
40
|
+
rmSync: p => { fs.rmSync(p, { recursive: true, force: true }); },
|
|
41
|
+
copyFileSync: (src, dest) => fs.copyFileSync(src, dest),
|
|
42
|
+
chmodSync: (p, mode) => fs.chmodSync(p, mode),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
26
45
|
function doltStepEnabled() {
|
|
27
46
|
if (process.env.NODE_ENV !== 'test')
|
|
28
47
|
return true;
|
|
@@ -31,7 +50,7 @@ function doltStepEnabled() {
|
|
|
31
50
|
const FLEET_SE_MIN_NODE = [22, 16, 0];
|
|
32
51
|
function probeVersion(cmd, shell) {
|
|
33
52
|
try {
|
|
34
|
-
const out = execFileSync(cmd, ['--version'], { stdio: 'pipe', encoding: 'utf-8', timeout: 15_000, shell });
|
|
53
|
+
const out = execFileSync(cmd, ['--version'], { stdio: 'pipe', encoding: 'utf-8', timeout: 15_000, shell, windowsHide: true });
|
|
35
54
|
return String(out).trim() || null;
|
|
36
55
|
}
|
|
37
56
|
catch {
|
|
@@ -55,6 +74,25 @@ export function _setFleetSePrereqProbes(overrides) {
|
|
|
55
74
|
export function _resetFleetSePrereqProbes() {
|
|
56
75
|
fleetSePrereqProbes = realFleetSePrereqProbes;
|
|
57
76
|
}
|
|
77
|
+
// Running fleet-sprint supervisor/sprint guard (fleet-se-guard.ts): same
|
|
78
|
+
// injectable-probes + NODE_ENV=test gate as the prereq check above, so unit
|
|
79
|
+
// tests never probe the real port 8787 or tmp lock dir.
|
|
80
|
+
let fleetSeProbes = realFleetSeProbes;
|
|
81
|
+
/** Test-only: inject fake probes for the running fleet-sprint guard. */
|
|
82
|
+
export function _setFleetSeProbes(overrides) {
|
|
83
|
+
fleetSeProbes = { ...realFleetSeProbes, ...overrides };
|
|
84
|
+
}
|
|
85
|
+
/** Test-only: restore the real running fleet-sprint guard probes. */
|
|
86
|
+
export function _resetFleetSeProbes() {
|
|
87
|
+
fleetSeProbes = realFleetSeProbes;
|
|
88
|
+
}
|
|
89
|
+
/** The probes the running fleet-sprint guard uses (shared with update.ts). */
|
|
90
|
+
export function currentFleetSeProbes() { return fleetSeProbes; }
|
|
91
|
+
export function fleetSeGuardEnabled() {
|
|
92
|
+
if (process.env.NODE_ENV !== 'test')
|
|
93
|
+
return true;
|
|
94
|
+
return process.env.APRA_FLEET_ENABLE_FLEET_SE_GUARD === '1';
|
|
95
|
+
}
|
|
58
96
|
function fleetSePrereqCheckEnabled() {
|
|
59
97
|
if (process.env.NODE_ENV !== 'test')
|
|
60
98
|
return true;
|
|
@@ -97,6 +135,25 @@ export function checkFleetSePrereqs(probes) {
|
|
|
97
135
|
let _seaOverride = null;
|
|
98
136
|
/** Override isSea() result -- for tests only. Pass null to restore default. */
|
|
99
137
|
export function _setSeaOverride(v) { _seaOverride = v; }
|
|
138
|
+
let _serviceHealthWaitOverride = null;
|
|
139
|
+
export function _setServiceHealthWaitOverride(fn) { _serviceHealthWaitOverride = fn; }
|
|
140
|
+
async function waitForServiceHealth() {
|
|
141
|
+
if (_serviceHealthWaitOverride)
|
|
142
|
+
return _serviceHealthWaitOverride();
|
|
143
|
+
const raw = parseInt(process.env.APRA_FLEET_INSTALL_HEALTH_TIMEOUT_MS ?? '', 10);
|
|
144
|
+
const timeoutMs = Number.isFinite(raw) && raw >= 0 ? raw : 30_000;
|
|
145
|
+
if (timeoutMs === 0)
|
|
146
|
+
return null;
|
|
147
|
+
const { checkRunningInstance } = await import('../services/singleton.js');
|
|
148
|
+
const deadline = Date.now() + timeoutMs;
|
|
149
|
+
for (;;) {
|
|
150
|
+
if ((await checkRunningInstance()).running)
|
|
151
|
+
return true;
|
|
152
|
+
if (Date.now() >= deadline)
|
|
153
|
+
return false;
|
|
154
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
100
157
|
export function isSea() {
|
|
101
158
|
if (_seaOverride !== null)
|
|
102
159
|
return _seaOverride;
|
|
@@ -577,10 +634,16 @@ function configureStatusline(paths, scriptPath, llm) {
|
|
|
577
634
|
let command;
|
|
578
635
|
if (process.platform === 'win32') {
|
|
579
636
|
if (llm === 'agy') {
|
|
580
|
-
const gitBash = 'C:\\Program Files\\Git\\bin\\bash.exe';
|
|
581
|
-
const bashBin = fs.existsSync(gitBash) ? `"${gitBash}"` : 'bash';
|
|
582
637
|
const formattedScriptPath = scriptPath.replace(/\\/g, '/');
|
|
583
|
-
|
|
638
|
+
const candidates = gitBashCandidates(process.env.LOCALAPPDATA);
|
|
639
|
+
const gitBash = candidates.find(c => fs.existsSync(c));
|
|
640
|
+
if (gitBash) {
|
|
641
|
+
const gitBin = path.dirname(gitBash);
|
|
642
|
+
command = `set PATH=${gitBin};%PATH% && bash '${formattedScriptPath}'`;
|
|
643
|
+
}
|
|
644
|
+
else {
|
|
645
|
+
command = `bash '${formattedScriptPath}'`;
|
|
646
|
+
}
|
|
584
647
|
}
|
|
585
648
|
else {
|
|
586
649
|
command = `bash "${scriptPath}"`;
|
|
@@ -608,7 +671,11 @@ function mergeAgyConfig(paths, mcpConfig) {
|
|
|
608
671
|
}
|
|
609
672
|
settings.mcpServers = settings.mcpServers || {};
|
|
610
673
|
settings.mcpServers['apra-fleet'] = mcpConfig;
|
|
611
|
-
|
|
674
|
+
const out = JSON.stringify(settings, null, 2) + '\n';
|
|
675
|
+
if (mcpConfig.headers)
|
|
676
|
+
writeOwnerOnlyFile(mcpConfigFile, out);
|
|
677
|
+
else
|
|
678
|
+
fs.writeFileSync(mcpConfigFile, out);
|
|
612
679
|
}
|
|
613
680
|
function writeDefaultModel(paths, standardModel) {
|
|
614
681
|
const settings = readConfig(paths);
|
|
@@ -621,25 +688,25 @@ function mergeCopilotConfig(paths, mcpConfig) {
|
|
|
621
688
|
const settings = readConfig(paths);
|
|
622
689
|
settings.mcpServers = settings.mcpServers || {};
|
|
623
690
|
settings.mcpServers['apra-fleet'] = mcpConfig;
|
|
624
|
-
writeConfig(paths, settings);
|
|
691
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
625
692
|
}
|
|
626
693
|
function mergeOpenCodeConfig(paths, mcpConfig) {
|
|
627
694
|
const settings = readConfig(paths);
|
|
628
695
|
settings.mcp = settings.mcp || {};
|
|
629
696
|
settings.mcp['apra-fleet'] = mcpConfig.url
|
|
630
|
-
? { type: 'remote', url: mcpConfig.url, enabled: true }
|
|
697
|
+
? { type: 'remote', url: mcpConfig.url, enabled: true, ...(mcpConfig.headers ? { headers: mcpConfig.headers } : {}) }
|
|
631
698
|
: {
|
|
632
699
|
type: 'local',
|
|
633
700
|
command: [mcpConfig.command, ...(mcpConfig.args || [])],
|
|
634
701
|
enabled: true,
|
|
635
702
|
};
|
|
636
|
-
writeConfig(paths, settings);
|
|
703
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
637
704
|
}
|
|
638
705
|
function mergeCodexConfig(paths, mcpConfig) {
|
|
639
706
|
const settings = readConfig(paths);
|
|
640
707
|
settings.mcp_servers = settings.mcp_servers || {};
|
|
641
708
|
if (mcpConfig.url) {
|
|
642
|
-
settings.mcp_servers['apra-fleet'] = { url: mcpConfig.url };
|
|
709
|
+
settings.mcp_servers['apra-fleet'] = { url: mcpConfig.url, ...(mcpConfig.headers ? { http_headers: mcpConfig.headers } : {}) };
|
|
643
710
|
}
|
|
644
711
|
else {
|
|
645
712
|
settings.mcp_servers['apra-fleet'] = {
|
|
@@ -647,12 +714,101 @@ function mergeCodexConfig(paths, mcpConfig) {
|
|
|
647
714
|
args: mcpConfig.args.map((a) => a.replace(/\\/g, '/')),
|
|
648
715
|
};
|
|
649
716
|
}
|
|
650
|
-
writeConfig(paths, settings);
|
|
717
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
718
|
+
}
|
|
719
|
+
export { claudeUserConfigPath } from '../services/claude-local-scope-mcp.js';
|
|
720
|
+
/**
|
|
721
|
+
* Register the http apra-fleet server in claude's user scope WITHOUT putting
|
|
722
|
+
* the access secret in argv (`claude mcp add --header` is visible to other
|
|
723
|
+
* local users via ps): the entry is merged into the claude config file
|
|
724
|
+
* directly, which is kept owner-only. An unparseable existing file is never
|
|
725
|
+
* overwritten.
|
|
726
|
+
*/
|
|
727
|
+
export function registerClaudeHttpMcp(url, headers) {
|
|
728
|
+
const file = claudeUserConfigPath();
|
|
729
|
+
let settings = {};
|
|
730
|
+
if (fs.existsSync(file)) {
|
|
731
|
+
const raw = fs.readFileSync(file, 'utf-8').trim();
|
|
732
|
+
if (raw) {
|
|
733
|
+
try {
|
|
734
|
+
settings = JSON.parse(raw);
|
|
735
|
+
}
|
|
736
|
+
catch {
|
|
737
|
+
throw new Error(`${file} is not valid JSON; fix or remove it, then re-run 'apra-fleet install'`);
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
settings.mcpServers = settings.mcpServers || {};
|
|
742
|
+
settings.mcpServers['apra-fleet'] = { type: 'http', url, headers };
|
|
743
|
+
writeOwnerOnlyFileAtomic(file, JSON.stringify(settings, null, 2) + '\n');
|
|
744
|
+
}
|
|
745
|
+
/** Write the http (url + access-secret header) apra-fleet registration for one provider. */
|
|
746
|
+
export function registerHttpMcp(provider, paths, url, headers) {
|
|
747
|
+
if (provider === 'claude')
|
|
748
|
+
registerClaudeHttpMcp(url, headers);
|
|
749
|
+
else if (provider === 'codex')
|
|
750
|
+
mergeCodexConfig(paths, { url, headers });
|
|
751
|
+
else if (provider === 'copilot')
|
|
752
|
+
mergeCopilotConfig(paths, { url, type: 'http', headers });
|
|
753
|
+
else if (provider === 'agy')
|
|
754
|
+
mergeAgyConfig(paths, { url, headers });
|
|
755
|
+
else if (provider === 'opencode')
|
|
756
|
+
mergeOpenCodeConfig(paths, { url, headers });
|
|
757
|
+
}
|
|
758
|
+
/** The apra-fleet MCP entry `provider` has registered (parsed), or undefined. Never throws. */
|
|
759
|
+
function registeredMcpEntry(provider, paths) {
|
|
760
|
+
try {
|
|
761
|
+
if (provider === 'claude')
|
|
762
|
+
return readJsonOrEmpty(claudeUserConfigPath()).mcpServers?.['apra-fleet'];
|
|
763
|
+
if (provider === 'agy')
|
|
764
|
+
return readJsonOrEmpty(path.join(os.homedir(), '.gemini', 'config', 'mcp_config.json')).mcpServers?.['apra-fleet'];
|
|
765
|
+
const settings = readConfig(paths);
|
|
766
|
+
if (provider === 'codex')
|
|
767
|
+
return settings.mcp_servers?.['apra-fleet'];
|
|
768
|
+
if (provider === 'copilot')
|
|
769
|
+
return settings.mcpServers?.['apra-fleet'];
|
|
770
|
+
if (provider === 'opencode')
|
|
771
|
+
return settings.mcp?.['apra-fleet'];
|
|
772
|
+
}
|
|
773
|
+
catch { /* unreadable -> unknown */ }
|
|
774
|
+
return undefined;
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Key-order-independent serialization of `provider`'s apra-fleet entry, to
|
|
778
|
+
* tell whether a registration write changed it (formatting and the rest of
|
|
779
|
+
* the file do not count).
|
|
780
|
+
*/
|
|
781
|
+
function mcpRegistrationSnapshot(provider, paths) {
|
|
782
|
+
const canon = (v) => Array.isArray(v) ? v.map(canon)
|
|
783
|
+
: v && typeof v === 'object' ? Object.fromEntries(Object.keys(v).sort().map(k => [k, canon(v[k])])) : v;
|
|
784
|
+
return JSON.stringify(canon(registeredMcpEntry(provider, paths)) ?? null);
|
|
785
|
+
}
|
|
786
|
+
function readJsonOrEmpty(file) {
|
|
787
|
+
try {
|
|
788
|
+
return fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf-8')) : {};
|
|
789
|
+
}
|
|
790
|
+
catch {
|
|
791
|
+
return {};
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* The transport of the apra-fleet MCP entry `provider` currently has
|
|
796
|
+
* registered, read from the provider's own config (install-config.json
|
|
797
|
+
* records no transport): 'stdio' (a command entry), 'http' (a url entry), or
|
|
798
|
+
* undefined (no entry / unreadable config). Never throws.
|
|
799
|
+
*/
|
|
800
|
+
export function registeredMcpTransport(provider, paths) {
|
|
801
|
+
const classify = (e) => !e || typeof e !== 'object' ? undefined : e.url ? 'http' : e.command ? 'stdio' : undefined;
|
|
802
|
+
const e = registeredMcpEntry(provider, paths);
|
|
803
|
+
if (provider === 'opencode') {
|
|
804
|
+
return e?.type === 'remote' || e?.url ? 'http' : e?.type === 'local' || e?.command ? 'stdio' : undefined;
|
|
805
|
+
}
|
|
806
|
+
return classify(e);
|
|
651
807
|
}
|
|
652
808
|
function run(cmd, opts) {
|
|
653
809
|
// Windows needs a shell for .cmd executables (e.g. claude.cmd)
|
|
654
810
|
const shellOpt = process.platform === 'win32' ? { shell: 'cmd.exe' } : {};
|
|
655
|
-
execSync(cmd, { stdio: 'inherit', ...shellOpt, ...opts });
|
|
811
|
+
execSync(cmd, { stdio: 'inherit', windowsHide: true, ...shellOpt, ...opts });
|
|
656
812
|
}
|
|
657
813
|
/** Is `cmd` resolvable on PATH? Used before shelling out to a provider's own
|
|
658
814
|
* CLI (e.g. `claude`) so a missing binary degrades to a clear warning
|
|
@@ -660,7 +816,7 @@ function run(cmd, opts) {
|
|
|
660
816
|
function isCommandAvailable(cmd) {
|
|
661
817
|
try {
|
|
662
818
|
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
|
|
663
|
-
execSync(checkCmd, { stdio: 'ignore' });
|
|
819
|
+
execSync(checkCmd, { stdio: 'ignore', windowsHide: true });
|
|
664
820
|
return true;
|
|
665
821
|
}
|
|
666
822
|
catch {
|
|
@@ -668,23 +824,22 @@ function isCommandAvailable(cmd) {
|
|
|
668
824
|
}
|
|
669
825
|
}
|
|
670
826
|
/**
|
|
671
|
-
* PIDs of every
|
|
672
|
-
*
|
|
673
|
-
* OS-global on purpose -- isApraFleetRunning() is defined in terms of this, and
|
|
674
|
-
* waitForApraFleetToStop()/uninstall.ts depend on that scope. The current
|
|
675
|
-
* process is always excluded so a self-update (the installed apra-fleet binary
|
|
676
|
-
* running `install`) never sees itself.
|
|
827
|
+
* PIDs of every apra-fleet process currently running other than this one, as
|
|
828
|
+
* strings.
|
|
677
829
|
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* (
|
|
830
|
+
* OS-global on purpose -- isApraFleetRunning() is defined in terms of this and
|
|
831
|
+
* is the install guard's cheap first filter and uninstall.ts's running check.
|
|
832
|
+
* It is NOT what install --force stops or watches: that is scoped to
|
|
833
|
+
* relevantServerPids() (install-guard.ts). The current process is always
|
|
834
|
+
* excluded: the installer may itself be named apra-fleet (the fleet's member
|
|
835
|
+
* upgrade runs <home>/.apra-fleet/staging/apra-fleet, and a self-update runs
|
|
836
|
+
* the installed binary).
|
|
682
837
|
*/
|
|
683
838
|
export function apraFleetPids() {
|
|
684
839
|
try {
|
|
685
840
|
const currentPid = process.pid.toString();
|
|
686
841
|
if (process.platform === 'win32') {
|
|
687
|
-
const out = execSync('tasklist /FI "IMAGENAME eq apra-fleet.exe" /NH /FO CSV', { encoding: 'utf-8', stdio: 'pipe' });
|
|
842
|
+
const out = execSync('tasklist /FI "IMAGENAME eq apra-fleet.exe" /NH /FO CSV', { encoding: 'utf-8', stdio: 'pipe', windowsHide: true });
|
|
688
843
|
// Each CSV line: "apra-fleet.exe","<PID>","..." - exclude the current installer process
|
|
689
844
|
return out.split('\n')
|
|
690
845
|
.map(line => line.match(/"apra-fleet\.exe","(\d+)"/))
|
|
@@ -693,9 +848,9 @@ export function apraFleetPids() {
|
|
|
693
848
|
.filter(pid => pid !== currentPid);
|
|
694
849
|
}
|
|
695
850
|
else {
|
|
696
|
-
// -x = exact name match; installer
|
|
697
|
-
//
|
|
698
|
-
const out = execSync('pgrep -x apra-fleet', { encoding: 'utf-8', stdio: 'pipe' });
|
|
851
|
+
// -x = exact name match; the installer itself may be named apra-fleet,
|
|
852
|
+
// so the current PID is excluded.
|
|
853
|
+
const out = execSync('pgrep -x apra-fleet', { encoding: 'utf-8', stdio: 'pipe', windowsHide: true });
|
|
699
854
|
return out.split('\n')
|
|
700
855
|
.map(line => line.trim())
|
|
701
856
|
.filter(pid => pid !== '' && pid !== currentPid);
|
|
@@ -708,18 +863,44 @@ export function apraFleetPids() {
|
|
|
708
863
|
export function isApraFleetRunning() {
|
|
709
864
|
return apraFleetPids().length > 0;
|
|
710
865
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
866
|
+
/**
|
|
867
|
+
* Signal the given apra-fleet pids -- by PID, never by process name. A
|
|
868
|
+
* name-based kill (pkill -x apra-fleet / taskkill /IM apra-fleet.exe) also
|
|
869
|
+
* matches the installer when it is named apra-fleet, which killed the fleet's
|
|
870
|
+
* member upgrade mid-install (exit 143), and every unrelated apra-fleet server
|
|
871
|
+
* of the same user (apra-fleet-b4g.72). This process is never signalled, even
|
|
872
|
+
* when passed in. A pid that already exited is ignored.
|
|
873
|
+
*/
|
|
874
|
+
export function killApraFleet(pids, signal = 'SIGTERM') {
|
|
875
|
+
for (const raw of pids) {
|
|
876
|
+
const pid = Number(raw);
|
|
877
|
+
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
|
|
878
|
+
continue;
|
|
879
|
+
try {
|
|
880
|
+
if (process.platform === 'win32') {
|
|
881
|
+
// taskkill /F is already forceful -- no softer signal to escalate from,
|
|
882
|
+
// so SIGKILL escalation on Windows just reissues the same command.
|
|
883
|
+
execSync(`taskkill /F /PID ${pid}`, { stdio: 'ignore', windowsHide: true });
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
process.kill(pid, signal);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
catch {
|
|
890
|
+
// Already gone (ESRCH / taskkill "not found"): nothing to stop.
|
|
891
|
+
}
|
|
721
892
|
}
|
|
722
893
|
}
|
|
894
|
+
/** Manual stop advice: the pids still running, plus the by-name fallback. */
|
|
895
|
+
function manualStopHint(pids) {
|
|
896
|
+
const byName = process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pkill -x apra-fleet';
|
|
897
|
+
if (pids.length === 0)
|
|
898
|
+
return byName;
|
|
899
|
+
const byPid = process.platform === 'win32'
|
|
900
|
+
? pids.map(pid => ` taskkill /F /PID ${pid}`).join('\n')
|
|
901
|
+
: ` kill ${pids.join(' ')}`;
|
|
902
|
+
return `${byPid}\n or, when no other apra-fleet server of yours must keep running:\n${byName}`;
|
|
903
|
+
}
|
|
723
904
|
const PROD_INSTALL_FORCE_TIMING = { pollIntervalMs: 200, graceMs: 3000, killGraceMs: 2000 };
|
|
724
905
|
// Tests run with NODE_ENV=test (see tests/setup.ts) and don't fake these timers,
|
|
725
906
|
// so default to a much shorter window there to keep the suite fast, unless a
|
|
@@ -737,33 +918,35 @@ function installForceTiming() {
|
|
|
737
918
|
return process.env.NODE_ENV === 'test' ? TEST_INSTALL_FORCE_TIMING : PROD_INSTALL_FORCE_TIMING;
|
|
738
919
|
}
|
|
739
920
|
/**
|
|
740
|
-
* Wait for
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
* polls again over a second (shorter) window.
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
921
|
+
* Wait for the relevant apra-fleet pids (`listPids`, re-evaluated on every
|
|
922
|
+
* poll; never this process) to exit after killApraFleet() sends SIGTERM. If
|
|
923
|
+
* any is still alive once the grace window elapses, escalates to SIGKILL
|
|
924
|
+
* against exactly those and polls again over a second (shorter) window.
|
|
925
|
+
* Returns as soon as none is detected, or once both windows have elapsed --
|
|
926
|
+
* callers should not assume termination is guaranteed in the latter case (see
|
|
927
|
+
* apra-fleet-l7n.3 for surfacing that failure to the operator instead of
|
|
928
|
+
* asserting success).
|
|
748
929
|
*/
|
|
749
|
-
export async function waitForApraFleetToStop() {
|
|
930
|
+
export async function waitForApraFleetToStop(listPids) {
|
|
750
931
|
const { pollIntervalMs, graceMs, killGraceMs } = installForceTiming();
|
|
751
932
|
let deadline = Date.now() + graceMs;
|
|
752
|
-
|
|
933
|
+
let pids = listPids();
|
|
934
|
+
while (pids.length > 0 && Date.now() < deadline) {
|
|
753
935
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
936
|
+
pids = listPids();
|
|
754
937
|
}
|
|
755
|
-
if (
|
|
938
|
+
if (pids.length === 0)
|
|
756
939
|
return;
|
|
757
|
-
// Grace window elapsed and a
|
|
758
|
-
killApraFleet('SIGKILL');
|
|
940
|
+
// Grace window elapsed and a relevant apra-fleet process is still alive -- escalate.
|
|
941
|
+
killApraFleet(pids, 'SIGKILL');
|
|
759
942
|
deadline = Date.now() + killGraceMs;
|
|
760
|
-
while (
|
|
943
|
+
while (listPids().length > 0 && Date.now() < deadline) {
|
|
761
944
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
762
945
|
}
|
|
763
946
|
}
|
|
764
947
|
// --- install --force service-aware stop ---
|
|
765
948
|
//
|
|
766
|
-
// killApraFleet() signals the server
|
|
949
|
+
// killApraFleet() signals the server's pid directly. When the server is
|
|
767
950
|
// registered with the platform service manager that is a race the installer
|
|
768
951
|
// cannot win: the macOS LaunchAgent this installer writes declares
|
|
769
952
|
// KeepAlive/SuccessfulExit=false (src/services/service-manager/macos.ts), so
|
|
@@ -790,7 +973,9 @@ async function registeredServiceManager() {
|
|
|
790
973
|
/** Exact command an operator can run to bring the registered service back up. */
|
|
791
974
|
export function serviceRestartCommand() {
|
|
792
975
|
switch (process.platform) {
|
|
793
|
-
|
|
976
|
+
// A stop disables the task (its repeating trigger would undo the stop);
|
|
977
|
+
// apra-fleet start re-enables it before running it.
|
|
978
|
+
case 'win32': return 'apra-fleet start';
|
|
794
979
|
case 'linux': return `systemctl --user start ${LINUX_UNIT_NAME}`;
|
|
795
980
|
case 'darwin': return `launchctl kickstart -k gui/${macosGuiUid()}/${MACOS_PLIST_LABEL}`;
|
|
796
981
|
default: return 'apra-fleet install';
|
|
@@ -799,7 +984,9 @@ export function serviceRestartCommand() {
|
|
|
799
984
|
/** Exact command an operator can run to take the registered service down. */
|
|
800
985
|
export function serviceStopCommand() {
|
|
801
986
|
switch (process.platform) {
|
|
802
|
-
|
|
987
|
+
// apra-fleet stop disables the task (its repeating trigger would undo a
|
|
988
|
+
// bare /end) and records the stop so nothing restarts the server.
|
|
989
|
+
case 'win32': return 'apra-fleet stop';
|
|
803
990
|
case 'linux': return `systemctl --user stop ${LINUX_UNIT_NAME}`;
|
|
804
991
|
case 'darwin': return `launchctl bootout gui/${macosGuiUid()}/${MACOS_PLIST_LABEL}`;
|
|
805
992
|
default: return 'apra-fleet uninstall';
|
|
@@ -816,13 +1003,13 @@ function macosGuiUid() {
|
|
|
816
1003
|
* supervisor relaunch. Returns the pids still observed once the window closes
|
|
817
1004
|
* (empty when the service is down).
|
|
818
1005
|
*/
|
|
819
|
-
async function waitForServiceStop() {
|
|
1006
|
+
async function waitForServiceStop(listPids) {
|
|
820
1007
|
const { pollIntervalMs, graceMs } = installForceTiming();
|
|
821
1008
|
const deadline = Date.now() + graceMs;
|
|
822
|
-
let pids =
|
|
1009
|
+
let pids = listPids();
|
|
823
1010
|
while (pids.length > 0 && Date.now() < deadline) {
|
|
824
1011
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
825
|
-
pids =
|
|
1012
|
+
pids = listPids();
|
|
826
1013
|
}
|
|
827
1014
|
return pids;
|
|
828
1015
|
}
|
|
@@ -868,6 +1055,42 @@ function copyGlobalBible(repoCwd) {
|
|
|
868
1055
|
console.warn(' [WARN] Global knowledge bible copy skipped:', err instanceof Error ? err.message : String(err));
|
|
869
1056
|
}
|
|
870
1057
|
}
|
|
1058
|
+
/** The one next step a member install prints: the orchestrator registers the
|
|
1059
|
+
* member, which also writes its per-folder apra-fleet MCP entry. */
|
|
1060
|
+
export const MEMBER_INSTALL_NEXT_STEP = 'Next step (on the orchestrator): run update_member {member_id, fleet_install: "auto"} (or register_member) for this member; ' +
|
|
1061
|
+
'it registers the member on this install and writes its per-folder apra-fleet MCP entry.';
|
|
1062
|
+
/**
|
|
1063
|
+
* The port a member install records: --port <n> / --port=<n>, else
|
|
1064
|
+
* APRA_FLEET_PORT, else the port an earlier member install in this data dir
|
|
1065
|
+
* recorded (an upgrade keeps it), else the built-in default. `explicit` is
|
|
1066
|
+
* true when --port was passed. --port that disagrees with APRA_FLEET_PORT is
|
|
1067
|
+
* an error: the two would put the server and its record on different ports.
|
|
1068
|
+
*/
|
|
1069
|
+
export function resolveMemberInstallPort(args, envPort, recordedPort) {
|
|
1070
|
+
let raw;
|
|
1071
|
+
const eq = args.find(a => a.startsWith('--port='));
|
|
1072
|
+
if (eq)
|
|
1073
|
+
raw = eq.slice('--port='.length);
|
|
1074
|
+
else {
|
|
1075
|
+
const i = args.indexOf('--port');
|
|
1076
|
+
if (i >= 0) {
|
|
1077
|
+
raw = args[i + 1];
|
|
1078
|
+
if (raw === undefined || raw.startsWith('-'))
|
|
1079
|
+
return { error: '--port requires a port number (1-65535).' };
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
const env = envPort !== undefined && envPort !== '' ? validPort(envPort) : undefined;
|
|
1083
|
+
if (raw !== undefined) {
|
|
1084
|
+
const port = validPort(raw);
|
|
1085
|
+
if (port === undefined)
|
|
1086
|
+
return { error: `--port must be a port number (1-65535), got "${raw}".` };
|
|
1087
|
+
if (env !== undefined && env !== port) {
|
|
1088
|
+
return { error: `--port ${port} disagrees with APRA_FLEET_PORT=${env}; pass one of them.` };
|
|
1089
|
+
}
|
|
1090
|
+
return { port, explicit: true };
|
|
1091
|
+
}
|
|
1092
|
+
return { port: env ?? recordedPort ?? BUILTIN_DEFAULT_PORT, explicit: false };
|
|
1093
|
+
}
|
|
871
1094
|
export async function runInstall(args) {
|
|
872
1095
|
// --help / -h guard - must come first, before any side effects (#142)
|
|
873
1096
|
if (args.includes('--help') || args.includes('-h')) {
|
|
@@ -883,6 +1106,7 @@ Usage:
|
|
|
883
1106
|
apra-fleet install --skill none Skip skill installation
|
|
884
1107
|
apra-fleet install --no-skill Same as --skill none
|
|
885
1108
|
apra-fleet install --workflows none Skip installing the workflow runtime + built-in workflows
|
|
1109
|
+
apra-fleet install --member Member install: server + user-mode auto-start only (see below)
|
|
886
1110
|
apra-fleet install --force Stop a running server before installing
|
|
887
1111
|
apra-fleet install --llm <provider> Target LLM provider: claude (default), codex, copilot, agy, opencode
|
|
888
1112
|
apra-fleet install --transport http Register MCP server with HTTP transport (default)
|
|
@@ -896,11 +1120,29 @@ Options:
|
|
|
896
1120
|
fleet server at http://localhost:7523/mcp. stdio runs fleet as a subprocess.
|
|
897
1121
|
--skill <mode> Which skills to install: all (default), fleet, pm, or none.
|
|
898
1122
|
--no-skill Alias for --skill none.
|
|
1123
|
+
--member Install only the server and its user-mode auto-start. Implies
|
|
1124
|
+
--skill none --workflows none; writes NO user-scope MCP entry,
|
|
1125
|
+
hooks/statusline/permissions settings or ~/.claude/CLAUDE.md block.
|
|
1126
|
+
Fails with E-MEMBER-AUTOSTART if the auto-start cannot be registered.
|
|
899
1127
|
--workflows <mode> Which workflow assets to install: all (default) or none. Installs
|
|
900
1128
|
~/.apra-fleet/node_modules (workflow runtime), /schemas (agent role
|
|
901
1129
|
schemas), and /workflows/{fleet-sprint,hello-world} (built-in workflows).
|
|
902
1130
|
fleet-se requires Node.js 22.16+ and npm.
|
|
903
|
-
--force Stop a running apra-fleet server before installing (SEA mode only)
|
|
1131
|
+
--force Stop a running apra-fleet server before installing (SEA mode only).
|
|
1132
|
+
With --member, only a server a previous member install left behind
|
|
1133
|
+
is stopped; anything else is refused (E-FULL-INSTALL-RUNNING).
|
|
1134
|
+
--ignore-running-sprints
|
|
1135
|
+
Install even while a fleet-sprint supervisor or sprint is running for this
|
|
1136
|
+
user; the server is replaced underneath them (ones started under 0.4.3 or
|
|
1137
|
+
earlier then fail with HTTP 401 until restarted). Without it install
|
|
1138
|
+
refuses (E-FLEET-SE-RUNNING); --force does not override this.
|
|
1139
|
+
--force-stop-full-install
|
|
1140
|
+
With --member --force: also stop a running server that was not started
|
|
1141
|
+
by a member install (e.g. a full install on a shared machine).
|
|
1142
|
+
--port <n> With --member: the port this member install's server listens on
|
|
1143
|
+
(default: APRA_FLEET_PORT, else the port a previous member install
|
|
1144
|
+
recorded, else 7523). Recorded in the member-install marker; use a
|
|
1145
|
+
different port for each Unix user's member install on one host.`);
|
|
904
1146
|
process.exit(0);
|
|
905
1147
|
return;
|
|
906
1148
|
}
|
|
@@ -978,6 +1220,7 @@ Options:
|
|
|
978
1220
|
}
|
|
979
1221
|
// Parse --force flag
|
|
980
1222
|
const force = args.includes('--force');
|
|
1223
|
+
const forceStopFullInstall = args.includes(FORCE_STOP_FULL_INSTALL_FLAG);
|
|
981
1224
|
let transport = 'http';
|
|
982
1225
|
const transportEqualArg = args.find(a => a.startsWith('--transport='));
|
|
983
1226
|
if (transportEqualArg) {
|
|
@@ -1004,8 +1247,14 @@ Options:
|
|
|
1004
1247
|
}
|
|
1005
1248
|
}
|
|
1006
1249
|
// Reject unknown flags to catch typos early
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1250
|
+
const memberMode = args.includes('--member');
|
|
1251
|
+
if (memberMode) {
|
|
1252
|
+
// A member install carries the server only: no skills, no workflows.
|
|
1253
|
+
skillMode = 'none';
|
|
1254
|
+
workflowsMode = 'none';
|
|
1255
|
+
}
|
|
1256
|
+
const knownFlagPrefixes = ['--llm=', '--skill=', '--transport=', '--workflows=', '--port='];
|
|
1257
|
+
const knownFlagExact = new Set(['--member', '--llm', '--skill', '--no-skill', '--workflows', '--force', FORCE_STOP_FULL_INSTALL_FLAG, IGNORE_RUNNING_SPRINTS_FLAG, '--transport', '--port', '--help', '-h']);
|
|
1009
1258
|
for (const a of args) {
|
|
1010
1259
|
if (knownFlagExact.has(a))
|
|
1011
1260
|
continue;
|
|
@@ -1016,6 +1265,19 @@ Options:
|
|
|
1016
1265
|
console.error(`Error: Unknown option "${a}". Run apra-fleet install --help for usage.`);
|
|
1017
1266
|
process.exit(1);
|
|
1018
1267
|
}
|
|
1268
|
+
// The port a member install's server listens on, recorded in the marker
|
|
1269
|
+
// (the server reads it back at launch; the orchestrator reads it for the
|
|
1270
|
+
// member's MCP URL). Only a member install takes --port.
|
|
1271
|
+
const memberPortChoice = resolveMemberInstallPort(args, process.env.APRA_FLEET_PORT, recordedMemberInstallPort());
|
|
1272
|
+
if ('error' in memberPortChoice) {
|
|
1273
|
+
console.error(`Error: ${memberPortChoice.error}`);
|
|
1274
|
+
process.exit(1);
|
|
1275
|
+
}
|
|
1276
|
+
if (memberPortChoice.explicit && !memberMode) {
|
|
1277
|
+
console.error('Error: --port is only valid with --member (a full install uses APRA_FLEET_PORT).');
|
|
1278
|
+
process.exit(1);
|
|
1279
|
+
}
|
|
1280
|
+
const memberPort = memberPortChoice.port;
|
|
1019
1281
|
const installFleet = skillMode === 'fleet' || skillMode === 'pm' || skillMode === 'all';
|
|
1020
1282
|
const installPm = skillMode === 'pm' || skillMode === 'all';
|
|
1021
1283
|
const installAgents = installPm && paths.agentsDir !== undefined;
|
|
@@ -1028,7 +1290,58 @@ Options:
|
|
|
1028
1290
|
process.exit(1);
|
|
1029
1291
|
}
|
|
1030
1292
|
}
|
|
1293
|
+
// Running fleet-sprint supervisor/sprint guard: before the running-server
|
|
1294
|
+
// guard so a refusal stops and writes nothing. --force does not bypass it
|
|
1295
|
+
// (update always passes --force); only the dedicated flag does. A member
|
|
1296
|
+
// install is exempt: it installs no fleet-se and is driven remotely by the
|
|
1297
|
+
// orchestrator, whose own host runs the sprints.
|
|
1298
|
+
if (!memberMode && !args.includes(IGNORE_RUNNING_SPRINTS_FLAG)
|
|
1299
|
+
&& (isSea() || isNpmGlobalInstall()) && fleetSeGuardEnabled()) {
|
|
1300
|
+
let found = null;
|
|
1301
|
+
try {
|
|
1302
|
+
found = await detectRunningFleetSe(fleetSeProbes);
|
|
1303
|
+
}
|
|
1304
|
+
catch (err) {
|
|
1305
|
+
console.warn(`WARNING: could not check for a running fleet-sprint supervisor or sprint (${err.message}). If one is running, stop it before upgrading.`);
|
|
1306
|
+
}
|
|
1307
|
+
for (const w of found?.warnings ?? [])
|
|
1308
|
+
console.warn(`WARNING: ${w}`);
|
|
1309
|
+
if (found && (found.supervisor || found.sprints.length > 0)) {
|
|
1310
|
+
const self = (a) => selfInvocationLines({
|
|
1311
|
+
platform: process.platform, execPath: process.execPath, scriptPath: process.argv[1], sea: isSea(), args: ['install', ...a],
|
|
1312
|
+
});
|
|
1313
|
+
const text = fleetSeRefusalText(found, {
|
|
1314
|
+
platform: process.platform,
|
|
1315
|
+
rerunLines: self(args),
|
|
1316
|
+
ignoreLines: self([...args, IGNORE_RUNNING_SPRINTS_FLAG]),
|
|
1317
|
+
});
|
|
1318
|
+
console.error(text);
|
|
1319
|
+
// apra-fleet update runs install detached with no console: persist it
|
|
1320
|
+
// for the next service verb.
|
|
1321
|
+
writeServiceNotice(text.trim(), undefined, new Date(), Boolean(process.stderr.isTTY));
|
|
1322
|
+
process.exit(1);
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
// Past the guard: a refusal persisted by an earlier (detached) install is
|
|
1327
|
+
// obsolete and must not be shown after this install succeeds. All OSes --
|
|
1328
|
+
// only the Windows service manager clears notices on registration.
|
|
1329
|
+
clearServiceNoticeContaining('E-FLEET-SE-RUNNING');
|
|
1031
1330
|
const serviceStep = isSea() && transport === 'http';
|
|
1331
|
+
// A member install exists to leave an auto-starting server behind. With no
|
|
1332
|
+
// service step (stdio transport or non-SEA install) nothing would register
|
|
1333
|
+
// the auto-start, so fail loudly before touching anything.
|
|
1334
|
+
if (memberMode && !serviceStep) {
|
|
1335
|
+
const why = transport !== 'http'
|
|
1336
|
+
? `--transport ${transport} has no auto-start (use --transport http)`
|
|
1337
|
+
: 'a non-SEA (dev) install has no auto-start (use the SEA binary)';
|
|
1338
|
+
console.error(`
|
|
1339
|
+
Error: E-MEMBER-AUTOSTART: --member requires the user-mode auto-start, but ${why}.
|
|
1340
|
+
Nothing was installed.
|
|
1341
|
+
`);
|
|
1342
|
+
process.exitCode = 1;
|
|
1343
|
+
return;
|
|
1344
|
+
}
|
|
1032
1345
|
let totalSteps = (installFleet && installPm) ? 8 : installFleet ? 7 : installPm ? 8 : 6;
|
|
1033
1346
|
if (installAgents)
|
|
1034
1347
|
totalSteps++;
|
|
@@ -1042,8 +1355,8 @@ Options:
|
|
|
1042
1355
|
totalSteps++;
|
|
1043
1356
|
// --- Running-process guard (SEA + npm modes -- dev mode runs via node, not a managed binary) ---
|
|
1044
1357
|
//
|
|
1045
|
-
// isApraFleetRunning() is OS-global on purpose (
|
|
1046
|
-
//
|
|
1358
|
+
// isApraFleetRunning() is OS-global on purpose (uninstall.ts depends on
|
|
1359
|
+
// that). It is only the cheap first filter here:
|
|
1047
1360
|
// classifyRunningServer() then decides whether the running server is actually
|
|
1048
1361
|
// relevant to THIS install -- recorded live in the target data dir, or running
|
|
1049
1362
|
// from the install prefix we are about to overwrite (ETXTBSY). An unrelated
|
|
@@ -1064,21 +1377,40 @@ Options:
|
|
|
1064
1377
|
const killHint = process.platform === 'win32'
|
|
1065
1378
|
? ' taskkill /F /IM apra-fleet.exe'
|
|
1066
1379
|
: ' pkill -x apra-fleet';
|
|
1380
|
+
// Name THIS executable, not "apra-fleet": a downloaded installer is
|
|
1381
|
+
// usually not on PATH, and PATH may resolve to the older installed one.
|
|
1382
|
+
const forceHint = selfInvocationLines({
|
|
1383
|
+
platform: process.platform,
|
|
1384
|
+
execPath: process.execPath,
|
|
1385
|
+
scriptPath: process.argv[1],
|
|
1386
|
+
sea: isSea(),
|
|
1387
|
+
args: ['install', ...args.filter(a => a !== '--force'), '--force'],
|
|
1388
|
+
}).map(l => ` ${l}`).join('\n');
|
|
1067
1389
|
console.error(`
|
|
1068
1390
|
Error: apra-fleet is currently running. Stop the server before installing.
|
|
1069
1391
|
(${runningScope.detail})
|
|
1070
1392
|
|
|
1071
1393
|
Run with --force to stop it automatically:
|
|
1072
|
-
|
|
1394
|
+
${forceHint}
|
|
1073
1395
|
|
|
1074
1396
|
Or stop it manually:
|
|
1075
1397
|
${killHint}
|
|
1076
1398
|
`);
|
|
1077
1399
|
process.exit(1);
|
|
1078
1400
|
}
|
|
1401
|
+
// A member install (fleet's remote upgrade path) never stops a server it
|
|
1402
|
+
// did not start unless explicitly told to: nothing has been stopped yet.
|
|
1403
|
+
if (!memberForceMayStop({ memberMode, overridden: forceStopFullInstall })) {
|
|
1404
|
+
console.error(fullInstallRefusalText(runningScope.detail));
|
|
1405
|
+
process.exit(3);
|
|
1406
|
+
}
|
|
1407
|
+
// Only the pids relevant to THIS install are stopped or watched -- by pid,
|
|
1408
|
+
// never by name, never this process (which may itself be named apra-fleet).
|
|
1409
|
+
// Unrelated apra-fleet servers of the same user are left alone.
|
|
1410
|
+
const relevantPids = () => relevantServerPids(BIN_DIR).map(String);
|
|
1079
1411
|
// Snapshot BEFORE anything is stopped: a pid that is present afterwards but
|
|
1080
1412
|
// absent here is a supervisor relaunch, not a process refusing to die.
|
|
1081
|
-
const pidsBeforeStop =
|
|
1413
|
+
const pidsBeforeStop = relevantPids();
|
|
1082
1414
|
guardServiceMgr = await registeredServiceManager();
|
|
1083
1415
|
if (guardServiceMgr) {
|
|
1084
1416
|
// A service is registered: stop the SERVICE, never pkill first.
|
|
@@ -1090,22 +1422,22 @@ ${killHint}
|
|
|
1090
1422
|
catch (err) {
|
|
1091
1423
|
console.warn(` Service stop failed: ${err.message}`);
|
|
1092
1424
|
}
|
|
1093
|
-
const stillUp = await waitForServiceStop();
|
|
1425
|
+
const stillUp = await waitForServiceStop(relevantPids);
|
|
1094
1426
|
// Escalate ONLY when the very same pids are still there -- i.e. nothing
|
|
1095
1427
|
// relaunched the server and there is no supervisor race to lose. If a NEW
|
|
1096
|
-
// pid appeared, signalling
|
|
1097
|
-
//
|
|
1428
|
+
// pid appeared, signalling is futile and is deliberately skipped so the
|
|
1429
|
+
// relaunch is reported instead of retried forever.
|
|
1098
1430
|
if (stillUp.length > 0 && stillUp.every(pid => pidsBeforeStop.includes(pid))) {
|
|
1099
|
-
killApraFleet();
|
|
1100
|
-
await waitForApraFleetToStop();
|
|
1431
|
+
killApraFleet(stillUp);
|
|
1432
|
+
await waitForApraFleetToStop(relevantPids);
|
|
1101
1433
|
}
|
|
1102
1434
|
}
|
|
1103
1435
|
else {
|
|
1104
|
-
// No service registered:
|
|
1105
|
-
killApraFleet();
|
|
1106
|
-
await waitForApraFleetToStop();
|
|
1436
|
+
// No service registered: signal the relevant pids directly.
|
|
1437
|
+
killApraFleet(pidsBeforeStop);
|
|
1438
|
+
await waitForApraFleetToStop(relevantPids);
|
|
1107
1439
|
}
|
|
1108
|
-
const pidsAfterStop =
|
|
1440
|
+
const pidsAfterStop = relevantPids();
|
|
1109
1441
|
if (pidsAfterStop.length > 0) {
|
|
1110
1442
|
const relaunchedPids = pidsAfterStop.filter(pid => !pidsBeforeStop.includes(pid));
|
|
1111
1443
|
if (relaunchedPids.length > 0) {
|
|
@@ -1113,7 +1445,7 @@ ${killHint}
|
|
|
1113
1445
|
Error: the apra-fleet server was RELAUNCHED by its service supervisor while
|
|
1114
1446
|
install --force was stopping it -- the observed pid changed between polls (was
|
|
1115
1447
|
${pidsBeforeStop.join(', ') || 'none'}, now ${pidsAfterStop.join(', ')}), so it did not merely refuse to die.
|
|
1116
|
-
Signalling the process
|
|
1448
|
+
Signalling the process cannot win that race. Stop the service itself,
|
|
1117
1449
|
then re-run the install:
|
|
1118
1450
|
${serviceStopCommand()}
|
|
1119
1451
|
`);
|
|
@@ -1122,13 +1454,20 @@ then re-run the install:
|
|
|
1122
1454
|
console.error(`
|
|
1123
1455
|
Error: could not stop the running apra-fleet server (it is still running after
|
|
1124
1456
|
SIGTERM and a SIGKILL escalation). Stop it manually before installing:
|
|
1125
|
-
${
|
|
1457
|
+
${manualStopHint(pidsAfterStop)}
|
|
1126
1458
|
`);
|
|
1127
1459
|
process.exit(1);
|
|
1128
1460
|
}
|
|
1129
|
-
console.log(
|
|
1461
|
+
console.log(pidsBeforeStop.length > 0 || guardStoppedService
|
|
1462
|
+
? ' Stopped running server.'
|
|
1463
|
+
: ' No running server process of this install was found to stop.');
|
|
1130
1464
|
}
|
|
1131
1465
|
console.log(`\nInstalling Apra Fleet ${serverVersion} for ${paths.name}...\n`);
|
|
1466
|
+
// Installing is an explicit (re)start intent: end a previous 'apra-fleet stop'.
|
|
1467
|
+
{
|
|
1468
|
+
const { clearStoppedMarker } = await import('../services/stopped-marker.js');
|
|
1469
|
+
clearStoppedMarker();
|
|
1470
|
+
}
|
|
1132
1471
|
// --- Step 1: Copy binary ---
|
|
1133
1472
|
let binaryPath = '';
|
|
1134
1473
|
if (isSea()) {
|
|
@@ -1191,7 +1530,10 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1191
1530
|
// --- Step 4: Configure hooks + statusline in settings.json ---
|
|
1192
1531
|
console.log(` [4/${totalSteps}] Configuring ${paths.name} settings...`);
|
|
1193
1532
|
// OpenCode has a strict config schema -- hooks/statusLine/defaultModel are not valid keys
|
|
1194
|
-
if (
|
|
1533
|
+
if (memberMode) {
|
|
1534
|
+
console.log(' Skipped (--member): user-scope settings are left untouched.');
|
|
1535
|
+
}
|
|
1536
|
+
else if (llm !== 'opencode') {
|
|
1195
1537
|
const installedHooksConfig = JSON.parse(fs.readFileSync(path.join(HOOKS_DIR, 'hooks-config.json'), 'utf-8'));
|
|
1196
1538
|
mergeHooksConfig(paths, installedHooksConfig, llm);
|
|
1197
1539
|
const statuslineScript = path.join(SCRIPTS_DIR, 'fleet-statusline.sh');
|
|
@@ -1203,33 +1545,61 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1203
1545
|
console.log(` [5/${totalSteps}] Registering MCP server...`);
|
|
1204
1546
|
const fleetPort = DEFAULT_PORT;
|
|
1205
1547
|
const fleetUrl = `http://localhost:${fleetPort}/mcp`;
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1548
|
+
// The server refuses an /mcp session without this install's access secret
|
|
1549
|
+
// (an owner-only file in its data dir), so every http registration carries
|
|
1550
|
+
// it as a header. Re-running install rewrites existing registrations.
|
|
1551
|
+
const secretExisted = readMemberAccessSecret() !== null;
|
|
1552
|
+
const fleetAccessHeaders = { [MEMBER_SECRET_HEADER]: getOrCreateMemberAccessSecret() };
|
|
1553
|
+
// Open LLM CLI sessions keep the MCP config they started with; a new secret
|
|
1554
|
+
// or a rewritten registration needs them restarted (reported at the end).
|
|
1555
|
+
// stdio registrations are not gated by the secret.
|
|
1556
|
+
let registrationChanged = !secretExisted && transport === 'http';
|
|
1557
|
+
if (memberMode) {
|
|
1558
|
+
// The per-folder member entry is written by compose_permissions; a member
|
|
1559
|
+
// install must never register apra-fleet in any provider's user-scope config.
|
|
1560
|
+
console.log(' Skipped (--member): no user-scope MCP registration.');
|
|
1561
|
+
}
|
|
1562
|
+
else if (transport === 'http') {
|
|
1563
|
+
const before = mcpRegistrationSnapshot(llm, paths);
|
|
1564
|
+
registerHttpMcp(llm, paths, fleetUrl, fleetAccessHeaders);
|
|
1565
|
+
if (mcpRegistrationSnapshot(llm, paths) !== before)
|
|
1566
|
+
registrationChanged = true;
|
|
1567
|
+
// Upgrade path: every OTHER provider this install registered earlier holds a
|
|
1568
|
+
// header-less http entry the server now refuses; rewrite those too. Each
|
|
1569
|
+
// provider keeps its own transport: a stdio entry (its own server process,
|
|
1570
|
+
// not gated by the access secret) is left untouched, and a provider with
|
|
1571
|
+
// no apra-fleet entry is not given one by another provider's install.
|
|
1572
|
+
for (const other of Object.keys(readInstallConfig().providers)) {
|
|
1573
|
+
if (other === llm || !INSTALLABLE_LLM_PROVIDERS.includes(other))
|
|
1574
|
+
continue;
|
|
1575
|
+
try {
|
|
1576
|
+
const otherPaths = getProviderInstallConfig(other);
|
|
1577
|
+
const existing = registeredMcpTransport(other, otherPaths);
|
|
1578
|
+
if (existing !== 'http') {
|
|
1579
|
+
console.log(` ${other}: ${existing === 'stdio' ? 'stdio registration kept as is' : 'no apra-fleet registration, skipped'}`);
|
|
1580
|
+
continue;
|
|
1217
1581
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1582
|
+
const otherBefore = mcpRegistrationSnapshot(other, otherPaths);
|
|
1583
|
+
registerHttpMcp(other, otherPaths, fleetUrl, fleetAccessHeaders);
|
|
1584
|
+
if (mcpRegistrationSnapshot(other, otherPaths) !== otherBefore)
|
|
1585
|
+
registrationChanged = true;
|
|
1586
|
+
}
|
|
1587
|
+
catch (err) {
|
|
1588
|
+
console.warn(` [!] could not refresh the ${other} MCP registration with the access secret: ${err instanceof Error ? err.message : String(err)}`);
|
|
1220
1589
|
}
|
|
1221
1590
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1591
|
+
// Claude LOCAL-scope entries for this URL (e.g. an older `claude mcp add
|
|
1592
|
+
// apra-fleet` without --scope) win over the user-scope entry and stay
|
|
1593
|
+
// header-less: rewrite them with the secret too.
|
|
1594
|
+
try {
|
|
1595
|
+
const rewritten = refreshClaudeLocalScopeEntries(claudeUserConfigPath(), fleetUrl, fleetAccessHeaders);
|
|
1596
|
+
for (const project of rewritten)
|
|
1597
|
+
console.log(` claude: local-scope apra-fleet entry for ${project} rewritten with the access secret`);
|
|
1598
|
+
if (rewritten.length)
|
|
1599
|
+
registrationChanged = true;
|
|
1230
1600
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1601
|
+
catch (err) {
|
|
1602
|
+
console.warn(` [!] could not refresh claude local-scope apra-fleet entries: ${err instanceof Error ? err.message : String(err)}`);
|
|
1233
1603
|
}
|
|
1234
1604
|
}
|
|
1235
1605
|
else {
|
|
@@ -1556,28 +1926,22 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1556
1926
|
}
|
|
1557
1927
|
}
|
|
1558
1928
|
// --- Beads install step ---
|
|
1559
|
-
//
|
|
1560
|
-
//
|
|
1929
|
+
// PATH first, then BIN_DIR, then npm -g, then a user-level install into
|
|
1930
|
+
// BIN_DIR (see beads-install.ts). NON-FATAL like dolt, but LOUD: a member
|
|
1931
|
+
// without bd cannot run sprint work, so the reason and the fix are printed
|
|
1932
|
+
// and repeated in the summary.
|
|
1561
1933
|
// KB + code intelligence is the final step (before the optional service step),
|
|
1562
1934
|
// so Beads sits one slot earlier than it does on main.
|
|
1563
1935
|
const beadsStep = serviceStep ? totalSteps - 2 : totalSteps - 1;
|
|
1564
1936
|
console.log(` [${beadsStep}/${totalSteps}] Installing Beads task tracker...`);
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
execFileSync('bd', ['--version'], { stdio: 'pipe', shell: true });
|
|
1569
|
-
// already installed - skip
|
|
1570
|
-
}
|
|
1571
|
-
catch {
|
|
1572
|
-
// not installed - install it
|
|
1573
|
-
// apra-fleet-4ipl: bumped 1.1.2 -> 1.3.0 to match .github/workflows/ci.yml's
|
|
1574
|
-
// pin -- see that file's comment for why (schema v66 compatibility).
|
|
1575
|
-
execFileSync('npm', ['install', '-g', '@beads/bd@1.3.0'], { stdio: 'inherit', shell: true });
|
|
1576
|
-
}
|
|
1937
|
+
const beadsResult = installBeads(BIN_DIR, beadsStepDeps());
|
|
1938
|
+
if (beadsResult.state === 'installed' && beadsResult.location === 'bin-dir') {
|
|
1939
|
+
console.log(` - bd installed for this user at ${beadsResult.binPath} (fleet commands find it there; add ${BIN_DIR} to your own shell PATH to use bd by hand)`);
|
|
1577
1940
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
console.warn(
|
|
1941
|
+
else if (beadsResult.state === 'missing') {
|
|
1942
|
+
console.warn(` [!] Beads (bd) NOT installed: ${beadsResult.reason}`);
|
|
1943
|
+
console.warn(` [!] Fix: ${beadsResult.fix}`);
|
|
1944
|
+
console.warn(' - Beads install skipped - sprint work on this machine needs bd and will fail until it is installed');
|
|
1581
1945
|
}
|
|
1582
1946
|
// --- KB + code intelligence setup step ---
|
|
1583
1947
|
// Only runs when the installer is invoked from inside a git repository.
|
|
@@ -1598,7 +1962,7 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1598
1962
|
}
|
|
1599
1963
|
}
|
|
1600
1964
|
catch (err) {
|
|
1601
|
-
console.warn('
|
|
1965
|
+
console.warn(' [!] .mcp.json cleanup skipped:', err instanceof Error ? err.message : String(err));
|
|
1602
1966
|
}
|
|
1603
1967
|
}
|
|
1604
1968
|
else {
|
|
@@ -1617,26 +1981,33 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1617
1981
|
console.log(' [OK] Code intelligence provider config written');
|
|
1618
1982
|
}
|
|
1619
1983
|
catch (err) {
|
|
1620
|
-
console.warn('
|
|
1984
|
+
console.warn(' [!] Code intelligence config skipped:', err instanceof Error ? err.message : String(err));
|
|
1621
1985
|
}
|
|
1986
|
+
// Code intelligence runs through npx: warn now (inside this step, no new
|
|
1987
|
+
// numbered step) when node/npx cannot be resolved from the installer PATH.
|
|
1988
|
+
const codeIntelPathWarn = codeIntelPathWarning();
|
|
1989
|
+
if (codeIntelPathWarn)
|
|
1990
|
+
console.warn(` [!] ${codeIntelPathWarn}`);
|
|
1622
1991
|
// Write code intelligence routing instruction to ~/.claude/CLAUDE.md
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
fs.
|
|
1630
|
-
|
|
1631
|
-
|
|
1992
|
+
// (never for a --member install: that file belongs to the member's user)
|
|
1993
|
+
if (!memberMode)
|
|
1994
|
+
try {
|
|
1995
|
+
const claudeMdPath = path.join(os.homedir(), '.claude', 'CLAUDE.md');
|
|
1996
|
+
const sentinel = '<!-- apra-fleet:code-intelligence -->';
|
|
1997
|
+
const block = `\n${sentinel}\nWhen code_graph, code_impact, code_query, or code_context tools are available,\nuse them for symbol lookups, call chain tracing, and impact analysis.\nNever use grep or file reads for structural questions when these tools are present.\n<!-- /apra-fleet:code-intelligence -->\n`;
|
|
1998
|
+
const existing = fs.existsSync(claudeMdPath) ? fs.readFileSync(claudeMdPath, 'utf-8') : '';
|
|
1999
|
+
if (!existing.includes(sentinel)) {
|
|
2000
|
+
fs.mkdirSync(path.dirname(claudeMdPath), { recursive: true });
|
|
2001
|
+
fs.appendFileSync(claudeMdPath, block);
|
|
2002
|
+
console.log(' [OK] Code intelligence routing instruction written to ~/.claude/CLAUDE.md');
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
catch (err) {
|
|
2006
|
+
console.warn(' [!] ~/.claude/CLAUDE.md update skipped:', err instanceof Error ? err.message : String(err));
|
|
1632
2007
|
}
|
|
1633
|
-
}
|
|
1634
|
-
catch (err) {
|
|
1635
|
-
console.warn(' ⚠ ~/.claude/CLAUDE.md update skipped:', err instanceof Error ? err.message : String(err));
|
|
1636
|
-
}
|
|
1637
2008
|
// OpenCode uses --dangerously-skip-permissions and per-agent permission: frontmatter;
|
|
1638
2009
|
// a top-level "permissions" key is invalid in opencode.json
|
|
1639
|
-
if (llm !== 'opencode') {
|
|
2010
|
+
if (llm !== 'opencode' && !memberMode) {
|
|
1640
2011
|
const extraPerms = (llm === 'claude' && installPm)
|
|
1641
2012
|
? ['Bash(*)', 'Skill(auto-sprint)', 'Workflow(auto-sprint)']
|
|
1642
2013
|
: [];
|
|
@@ -1644,19 +2015,90 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1644
2015
|
}
|
|
1645
2016
|
// Write install-config.json (merge provider entry)
|
|
1646
2017
|
writeInstallConfig(llm, skillMode, workflowsMode);
|
|
2018
|
+
// The fleet owns this install from here on: record the marker BEFORE the
|
|
2019
|
+
// auto-start registration, which can fail. A failed auto-start still exits
|
|
2020
|
+
// non-zero (E-MEMBER-AUTOSTART) but leaves the marker, so the next fleet_install
|
|
2021
|
+
// "auto" recognises its own half-finished install and retries.
|
|
2022
|
+
if (memberMode)
|
|
2023
|
+
writeMemberInstallMarker(serverVersion, memberPort);
|
|
2024
|
+
// Every install holds a member access secret (owner-only, in its data dir):
|
|
2025
|
+
// its server accepts a ?member= session only with it, so another local
|
|
2026
|
+
// user's session cannot use this install. Created once, kept on reinstall
|
|
2027
|
+
// (sessions configured with it keep working). Best effort here -- the server
|
|
2028
|
+
// creates it at start too.
|
|
2029
|
+
try {
|
|
2030
|
+
const { getOrCreateMemberAccessSecret, memberAccessSecretPath } = await import('../services/member-access-secret.js');
|
|
2031
|
+
getOrCreateMemberAccessSecret(memberAccessSecretPath(getInstallDataDir()));
|
|
2032
|
+
}
|
|
2033
|
+
catch (err) {
|
|
2034
|
+
console.warn(' [!] member access secret not created:', err instanceof Error ? err.message : String(err));
|
|
2035
|
+
}
|
|
2036
|
+
// Windows: make the data dir and the secret owner-only NOW, and say so
|
|
2037
|
+
// loudly when icacls fails (the server only logs it). POSIX keeps its
|
|
2038
|
+
// chmod path (0600 file mode, 0700 dirs at server start).
|
|
2039
|
+
if (process.platform === 'win32') {
|
|
2040
|
+
try {
|
|
2041
|
+
const { ownerOnlyInstallWarnings } = await import('../utils/owner-only-fs.js');
|
|
2042
|
+
const { memberAccessSecretPath } = await import('../services/member-access-secret.js');
|
|
2043
|
+
const dataDir = getInstallDataDir();
|
|
2044
|
+
for (const line of ownerOnlyInstallWarnings([{ path: dataDir, kind: 'dir' }, { path: memberAccessSecretPath(dataDir), kind: 'file' }])) {
|
|
2045
|
+
console.warn(line);
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
catch (err) {
|
|
2049
|
+
console.warn(' [!] owner-only permissions not checked:', err instanceof Error ? err.message : String(err));
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
1647
2052
|
// --- Step N: Register and start service (SEA + HTTP mode only) ---
|
|
1648
2053
|
let serviceRegistered = false;
|
|
2054
|
+
let serviceHealthy = null;
|
|
1649
2055
|
let serviceReused = false;
|
|
2056
|
+
let serviceRunKey = false;
|
|
1650
2057
|
if (serviceStep) {
|
|
1651
2058
|
console.log(` [${totalSteps}/${totalSteps}] Registering and starting service...`);
|
|
2059
|
+
// The server refuses to start when its configured port is taken (no
|
|
2060
|
+
// random-port fallback, GitHub #584) -- say so here rather than leaving a
|
|
2061
|
+
// service that exits on every launch with the reason only in the log.
|
|
2062
|
+
{
|
|
2063
|
+
const { checkRunningInstance, isPortInUse, portInUseMessage, readServerInfoPid } = await import('../services/singleton.js');
|
|
2064
|
+
const probe = await checkRunningInstance();
|
|
2065
|
+
const serverPort = resolveServerPort();
|
|
2066
|
+
if (probe.state === 'gone' && await isPortInUse(serverPort, DEFAULT_HOST)) {
|
|
2067
|
+
const { findPortHolder, describePortConflict } = await import('../services/port-holder.js');
|
|
2068
|
+
const conflict = describePortConflict(serverPort, portInUseMessage(serverPort, readServerInfoPid()), await findPortHolder(serverPort), memberMode ? 'member' : 'full');
|
|
2069
|
+
// Another user's process holds this install's port (a second member
|
|
2070
|
+
// install on this host): the server can never start here, so fail
|
|
2071
|
+
// now with who holds it and the remedy, not after a dead service.
|
|
2072
|
+
if (conflict.foreign) {
|
|
2073
|
+
console.error(`
|
|
2074
|
+
Error: ${conflict.message}
|
|
2075
|
+
`);
|
|
2076
|
+
process.exitCode = 1;
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
console.warn(` Warning: ${conflict.message}`);
|
|
2080
|
+
}
|
|
2081
|
+
}
|
|
1652
2082
|
const svcMgr = await getServiceManager();
|
|
1653
2083
|
try {
|
|
1654
|
-
|
|
2084
|
+
const registered = await svcMgr.register(binaryPath, ['--transport', 'http'], LOG_FILE_PATH);
|
|
2085
|
+
serviceReused = registered === 'reused';
|
|
2086
|
+
serviceRunKey = registered === 'run-key';
|
|
1655
2087
|
if (serviceReused)
|
|
1656
2088
|
console.log(' Could not recreate the service task -- existing task reused.');
|
|
2089
|
+
if (serviceRunKey) {
|
|
2090
|
+
console.log(' Could not create the scheduled task -- registered a per-user logon entry (HKCU Run) instead.');
|
|
2091
|
+
console.log(' This starts the server at logon but does NOT restart it if it stops; use apra-fleet start.');
|
|
2092
|
+
}
|
|
1657
2093
|
try {
|
|
1658
2094
|
await svcMgr.start();
|
|
1659
2095
|
serviceRegistered = true;
|
|
2096
|
+
// Never report "running" on the strength of the start call alone (a
|
|
2097
|
+
// launcher that cannot run, a refused port, a crash): ask /health.
|
|
2098
|
+
serviceHealthy = await waitForServiceHealth();
|
|
2099
|
+
if (serviceHealthy === false) {
|
|
2100
|
+
console.warn(` Service registered, but the server is not answering /health. Check ${LOG_FILE_PATH} and run apra-fleet status.`);
|
|
2101
|
+
}
|
|
1660
2102
|
}
|
|
1661
2103
|
catch (startErr) {
|
|
1662
2104
|
// Never delete a reused task: it predates this install (e.g. elevated).
|
|
@@ -1671,10 +2113,21 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1671
2113
|
}
|
|
1672
2114
|
catch (err) {
|
|
1673
2115
|
console.warn(` Service registration skipped: ${err.message}`);
|
|
2116
|
+
// A member install exists to leave an auto-starting server behind; without
|
|
2117
|
+
// the auto-start it is not a success, so say so with a typed status.
|
|
2118
|
+
if (memberMode) {
|
|
2119
|
+
console.error(`
|
|
2120
|
+
Error: E-MEMBER-AUTOSTART: the member install could not register the user-mode
|
|
2121
|
+
auto-start (${err.message}). The server binary is installed but will
|
|
2122
|
+
not start automatically.
|
|
2123
|
+
`);
|
|
2124
|
+
process.exitCode = 1;
|
|
2125
|
+
return;
|
|
2126
|
+
}
|
|
1674
2127
|
// --force stopped the server; reporting success would leave it down silently.
|
|
1675
2128
|
if (force && (runningScope?.relevant || guardStoppedService)) {
|
|
1676
2129
|
const restartHint = guardStoppedService
|
|
1677
|
-
? `Start it with:\n ${serviceRestartCommand()}\
|
|
2130
|
+
? `Start it with:\n ${serviceRestartCommand()}\nthen run 'apra-fleet status' for how to repair the service (apra-fleet never needs an elevated install).`
|
|
1678
2131
|
: 'Start it with:\n apra-fleet start';
|
|
1679
2132
|
console.error(`
|
|
1680
2133
|
Error: install --force stopped the running apra-fleet server, but the service
|
|
@@ -1686,28 +2139,33 @@ ${restartHint}
|
|
|
1686
2139
|
}
|
|
1687
2140
|
}
|
|
1688
2141
|
// --- Done ---
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
catch {
|
|
1695
|
-
beadsVersion = 'not available';
|
|
1696
|
-
}
|
|
2142
|
+
if (!memberMode)
|
|
2143
|
+
clearMemberInstallMarker();
|
|
2144
|
+
const beadsVersion = beadsResult.state === 'missing'
|
|
2145
|
+
? `not available -- ${beadsResult.reason}. Fix: ${beadsResult.fix}`
|
|
2146
|
+
: `${beadsResult.version}${beadsResult.location === 'bin-dir' ? ` (${beadsResult.binPath})` : ''}`;
|
|
1697
2147
|
const clientName = llm === 'claude' ? 'Claude Code' : paths.name;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
const
|
|
2148
|
+
// A member install touched no user-scope settings or MCP registration, so it
|
|
2149
|
+
// names only what it did and the member's one next step (on the orchestrator).
|
|
2150
|
+
const instructions = memberMode
|
|
2151
|
+
? MEMBER_INSTALL_NEXT_STEP
|
|
2152
|
+
: llm === 'claude' ? 'Run /mcp in Claude Code to load the server.' : `Restart ${paths.name} to load the server.`;
|
|
2153
|
+
const forceNote = force && !memberMode ? `\nRestart ${clientName} to reload the MCP server.` : '';
|
|
2154
|
+
const accessNote = registrationChanged && !memberMode
|
|
2155
|
+
? '\n[!] Restart every open LLM CLI session (Claude Code, Codex, ...): sessions started before this install keep their old MCP registration without the access secret, and the server refuses them (Claude Code shows "Dynamic Client Registration rejected (HTTP 404)").'
|
|
2156
|
+
: '';
|
|
2157
|
+
const settingsLine = memberMode ? '' : `\n Settings: ${paths.settingsFile}`;
|
|
2158
|
+
const serviceState = serviceHealthy === true ? 'registered and running' : serviceHealthy === false ? 'registered, but NOT answering /health (see the warning above)' : 'registered (health not checked)';
|
|
2159
|
+
const serviceLine = serviceStep ? `\n Service: ${serviceRegistered ? `${serviceState}${serviceReused ? ' (existing task reused)' : ''}${serviceRunKey ? ' (logon autostart via HKCU Run, no automatic restart)' : ''}` : 'registration skipped'}` : '';
|
|
1701
2160
|
console.log(`
|
|
1702
2161
|
Apra Fleet ${serverVersion} installed successfully for ${paths.name}.
|
|
1703
2162
|
Binary: ${BIN_DIR}
|
|
1704
2163
|
Hooks: ${HOOKS_DIR}
|
|
1705
|
-
Scripts: ${SCRIPTS_DIR}
|
|
1706
|
-
Settings: ${paths.settingsFile}${installFleet ? `\n Fleet Skill: ${paths.fleetSkillsDir}` : ''}${installPm ? `\n PM Skill: ${paths.skillsDir}` : ''}${installAgents ? `\n Agents: ${paths.agentsDir}` : ''}
|
|
2164
|
+
Scripts: ${SCRIPTS_DIR}${settingsLine}${installFleet ? `\n Fleet Skill: ${paths.fleetSkillsDir}` : ''}${installPm ? `\n PM Skill: ${paths.skillsDir}` : ''}${installAgents ? `\n Agents: ${paths.agentsDir}` : ''}
|
|
1707
2165
|
Beads: ${beadsVersion}
|
|
1708
2166
|
Dolt: ${doltVersion}${serviceLine}
|
|
1709
2167
|
|
|
1710
|
-
${instructions}${forceNote}
|
|
2168
|
+
${instructions}${forceNote}${accessNote}
|
|
1711
2169
|
`);
|
|
1712
2170
|
if (llm === 'claude' && installPm) {
|
|
1713
2171
|
console.log(' /auto-sprint BD-1 (native workflow, current branch)');
|