@apralabs/apra-fleet 0.4.3 → 0.4.5
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 +114 -33
- package/dist/agents/backlog-groomer.md +80 -27
- package/dist/agents/ci-watcher.md +42 -22
- package/dist/agents/deployer.md +59 -24
- package/dist/agents/doer.md +111 -41
- package/dist/agents/harvester.md +60 -48
- package/dist/agents/integ-test-runner.md +45 -23
- package/dist/agents/kb-reconciler.md +34 -7
- package/dist/agents/plan-reviewer.md +54 -24
- package/dist/agents/planner.md +71 -43
- package/dist/agents/regression-test-runner.md +106 -78
- package/dist/agents/reviewer.md +170 -57
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/deployer-output.json +5 -0
- package/dist/agents/schemas/doer-output.json +110 -2
- 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 +166 -5
- 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 +42 -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 +26 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/claude-mod.d.ts +75 -0
- package/dist/cli/claude-mod.js +288 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +19 -3
- package/dist/cli/dolt-install.js +51 -16
- package/dist/cli/fleet-se-guard.d.ts +59 -0
- package/dist/cli/fleet-se-guard.js +231 -0
- package/dist/cli/install-guard.d.ts +63 -0
- package/dist/cli/install-guard.js +156 -4
- package/dist/cli/install.d.ts +89 -21
- package/dist/cli/install.js +778 -160
- 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/kb-profile.d.ts +16 -0
- package/dist/cli/kb-profile.js +81 -0
- 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 +62 -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 +112 -16
- package/dist/cli/update.d.ts +4 -0
- package/dist/cli/update.js +52 -5
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.d.ts +10 -1
- package/dist/commands/kb-server.js +292 -11
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +177 -9
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/git-executable.d.ts +57 -0
- package/dist/os/git-executable.js +85 -0
- package/dist/os/go-concurrency.d.ts +44 -0
- package/dist/os/go-concurrency.js +53 -0
- package/dist/os/index.d.ts +1 -0
- package/dist/os/index.js +1 -0
- package/dist/os/linux.d.ts +9 -2
- package/dist/os/linux.js +50 -15
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +42 -2
- package/dist/os/os-commands.js +2 -0
- package/dist/os/windows-executable.d.ts +53 -0
- package/dist/os/windows-executable.js +185 -0
- package/dist/os/windows-gitbash.d.ts +24 -14
- package/dist/os/windows-gitbash.js +56 -18
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +7 -2
- package/dist/os/windows.js +109 -32
- package/dist/paths.d.ts +30 -0
- package/dist/paths.js +52 -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 +9 -2
- package/dist/services/agy-project.js +22 -19
- package/dist/services/auth-socket.d.ts +43 -0
- package/dist/services/auth-socket.js +97 -26
- 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/credential-store.d.ts +33 -0
- package/dist/services/credential-store.js +79 -2
- 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 +78 -1
- package/dist/services/http-transport.js +347 -52
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/kb-tool-profile.d.ts +36 -0
- package/dist/services/kb-tool-profile.js +88 -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 +122 -0
- package/dist/services/knowledge/bible-import.d.ts +173 -0
- package/dist/services/knowledge/bible-import.js +344 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +155 -24
- package/dist/services/knowledge/http-provider.d.ts +305 -21
- package/dist/services/knowledge/http-provider.js +801 -119
- package/dist/services/knowledge/kb-config.d.ts +65 -1
- package/dist/services/knowledge/kb-config.js +143 -3
- package/dist/services/knowledge/kb-http-auth-state.d.ts +26 -0
- package/dist/services/knowledge/kb-http-auth-state.js +40 -0
- 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 +13 -2
- package/dist/services/knowledge/kb-providers.js +75 -37
- 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 +204 -0
- package/dist/services/knowledge/kb-self.js +358 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +207 -0
- package/dist/services/knowledge/path-validation.d.ts +7 -0
- package/dist/services/knowledge/path-validation.js +11 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +5 -4
- package/dist/services/knowledge/repository-header.d.ts +77 -0
- package/dist/services/knowledge/repository-header.js +233 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts +1 -1
- package/dist/services/knowledge/require-sqlite-project.js +1 -1
- package/dist/services/knowledge/sqlite-provider.d.ts +233 -11
- package/dist/services/knowledge/sqlite-provider.js +719 -45
- package/dist/services/knowledge/types.d.ts +59 -3
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-busy.d.ts +12 -0
- package/dist/services/member-busy.js +20 -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 +193 -0
- package/dist/services/member-config-io.js +446 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1896 -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 +115 -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 +352 -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 +54 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +187 -3
- package/dist/services/service-manager/windows.js +684 -50
- package/dist/services/service-notice.d.ts +21 -0
- package/dist/services/service-notice.js +81 -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/session-registry.d.ts +13 -0
- package/dist/services/session-registry.js +13 -0
- package/dist/services/session-roots.d.ts +67 -0
- package/dist/services/session-roots.js +126 -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/statusline.d.ts +21 -0
- package/dist/services/statusline.js +97 -1
- 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 +333 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +251 -62
- package/dist/services/tool-scope.d.ts +91 -0
- package/dist/services/tool-scope.js +124 -0
- package/dist/services/vcs/azure-devops.js +10 -0
- package/dist/services/vcs/bitbucket.d.ts +22 -1
- package/dist/services/vcs/bitbucket.js +163 -17
- package/dist/services/vcs/types.d.ts +25 -2
- package/dist/services/watch/project-resolver.js +3 -1
- 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/cost.md +5 -1
- package/dist/skills/pm/index.md +11 -9
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +7 -6
- package/dist/tools/check-status.d.ts +104 -5
- package/dist/tools/check-status.js +326 -57
- 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 +49 -0
- package/dist/tools/code-intelligence-gitnexus.js +488 -55
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +156 -0
- package/dist/tools/code-intelligence-readiness.js +291 -0
- package/dist/tools/code-intelligence-reindex.d.ts +219 -0
- package/dist/tools/code-intelligence-reindex.js +602 -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 +92 -18
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +550 -135
- package/dist/tools/fleet-snapshot.d.ts +21 -0
- package/dist/tools/fleet-snapshot.js +78 -0
- package/dist/tools/kb-bible-commit.d.ts +79 -0
- package/dist/tools/kb-bible-commit.js +348 -0
- package/dist/tools/kb-capture.d.ts +15 -11
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +85 -14
- package/dist/tools/kb-demote.d.ts +27 -0
- package/dist/tools/kb-demote.js +37 -0
- package/dist/tools/kb-export.d.ts +128 -7
- package/dist/tools/kb-export.js +273 -67
- package/dist/tools/kb-feedback.d.ts +15 -9
- package/dist/tools/kb-feedback.js +27 -11
- 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 +35 -16
- package/dist/tools/kb-import.d.ts +42 -10
- package/dist/tools/kb-import.js +185 -160
- package/dist/tools/kb-invalidate.d.ts +26 -11
- package/dist/tools/kb-invalidate.js +118 -12
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +61 -13
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +16 -8
- package/dist/tools/kb-query.d.ts +24 -11
- package/dist/tools/kb-query.js +230 -23
- 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 +127 -47
- package/dist/tools/kb-setup.d.ts +31 -4
- package/dist/tools/kb-setup.js +172 -20
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +6 -3
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +95 -20
- 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 +30 -5
- package/dist/tools/provision-vcs-auth.js +53 -7
- package/dist/tools/receive-files.js +8 -3
- 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 +9 -6
- package/dist/tools/send-message.d.ts +3 -0
- package/dist/tools/send-message.js +15 -2
- 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/stop-prompt.js +3 -1
- 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.d.ts +45 -3
- package/dist/tools/vcs-credential-exec.js +98 -13
- 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 +72 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/redact-known-secrets.d.ts +17 -0
- package/dist/utils/redact-known-secrets.js +70 -0
- 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/skill-matrix.js +1 -1
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/vcs-provider-detect.js +2 -2
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +468 -52
- package/package.json +15 -9
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +722 -38
- 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 +170 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +43 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +80 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +42 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +59 -24
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +111 -41
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +60 -48
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +45 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +34 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +54 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +71 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +106 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +170 -57
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +5 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +110 -2
- 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 +166 -5
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +5 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +11 -9
- 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 +7 -6
- package/packages/apra-fleet-se/bin/cli.mjs +282 -79
- package/packages/apra-fleet-se/bin/serve.mjs +186 -15
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +234 -46
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/bd-sync-command.mjs +69 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +229 -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-lock-probe.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-reachability.mjs +126 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +271 -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 +142 -3
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +48 -8
- package/packages/apra-fleet-se/fleet-sprint/decision-notify.mjs +338 -0
- package/packages/apra-fleet-se/fleet-sprint/decision-wait.mjs +731 -0
- package/packages/apra-fleet-se/fleet-sprint/decisions.mjs +372 -0
- 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 +244 -22
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +56 -15
- 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-settle.mjs +9 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +651 -37
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +282 -15
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +207 -10
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +169 -10
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +88 -5
- 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 +1896 -305
- 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 +454 -1
- 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 +129 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +302 -52
- 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 +142 -21
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +118 -36
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +27 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +99 -52
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +58 -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 +90 -15
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +272 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +113 -28
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1631 -213
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +26 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +183 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +138 -0
- package/packages/apra-fleet-se/fleet-sprint/set-aside.mjs +288 -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 +87 -32
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +158 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +132 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +31 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +774 -35
- 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/bitbucket.mjs +811 -17
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +138 -1
- 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 +460 -23
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +59 -3
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +1059 -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 +1662 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +370 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +292 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +335 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +611 -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 +499 -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 +542 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +544 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +993 -0
- package/packages/apra-fleet-workflow/package.json +3 -2
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +150 -14
- package/packages/apra-fleet-workflow/src/viewer/request-guard.mjs +222 -0
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +105 -7
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/plugins/claude-code/fleet-status/.claude-plugin/plugin.json +7 -0
- package/plugins/claude-code/fleet-status/hooks/hooks.json +1 -0
- package/plugins/claude-code/fleet-status/hooks/register.tsx +906 -0
- package/plugins/claude-code/fleet-status/types/index.d.ts +88 -0
- package/skills/fleet/auth-bitbucket.md +47 -20
- package/skills/fleet/onboarding.md +1 -1
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/skills/fleet/skill-matrix.md +3 -3
- 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,27 @@
|
|
|
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, recordFullInstallPort, FORCE_STOP_FULL_INSTALL_FLAG, } from './install-guard.js';
|
|
18
|
+
import { detectRunningFleetSe, fleetSeRefusalText, fleetSeRerunArgs, realFleetSeProbes, IGNORE_RUNNING_SPRINTS_FLAG } from './fleet-se-guard.js';
|
|
19
|
+
import { writeServiceNotice, appendServiceNotice, clearServiceNoticeContaining, SERVICE_NOTICE_PATH } from '../services/service-notice.js';
|
|
15
20
|
import { convertClaudeAllowToAgyPermissions, formatAgyPermissionRules } from '../providers/agy.js';
|
|
21
|
+
import { isPidAlive } from '../utils/process-utils.js';
|
|
22
|
+
import { codeIntelPathWarning } from '../utils/find-on-path.js';
|
|
23
|
+
import { gitBashCandidates } from '../os/git-bash-candidates.js';
|
|
24
|
+
import { CLAUDE_MOD_PLUGIN, CLAUDE_MOD_SOURCE_DIR, claudeModRegistered, claudeModStepEnabled, installClaudeMod, isApraFleetStatusLine, isClaudeModRuntimeFile, removeApraFleetStatusLine, } from './claude-mod.js';
|
|
16
25
|
const realDoltStepDeps = { downloadAndExtractDolt, verifyDolt };
|
|
17
26
|
let doltStepDeps = realDoltStepDeps;
|
|
18
27
|
/** Test-only: inject fakes for the dolt CLI install step's download/verify calls. */
|
|
@@ -23,6 +32,18 @@ export function _setDoltStepDeps(overrides) {
|
|
|
23
32
|
export function _resetDoltStepDeps() {
|
|
24
33
|
doltStepDeps = realDoltStepDeps;
|
|
25
34
|
}
|
|
35
|
+
/** Real transports for the Beads step (execFileSync is mocked by the install tests). */
|
|
36
|
+
function beadsStepDeps() {
|
|
37
|
+
return {
|
|
38
|
+
platform: process.platform,
|
|
39
|
+
exec: (cmd, args, opts) => execFileSync(cmd, args, { stdio: 'pipe', encoding: 'utf-8', shell: opts.shell, windowsHide: true }),
|
|
40
|
+
existsSync: p => fs.existsSync(p),
|
|
41
|
+
mkdirSync: p => { fs.mkdirSync(p, { recursive: true }); },
|
|
42
|
+
rmSync: p => { fs.rmSync(p, { recursive: true, force: true }); },
|
|
43
|
+
copyFileSync: (src, dest) => fs.copyFileSync(src, dest),
|
|
44
|
+
chmodSync: (p, mode) => fs.chmodSync(p, mode),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
26
47
|
function doltStepEnabled() {
|
|
27
48
|
if (process.env.NODE_ENV !== 'test')
|
|
28
49
|
return true;
|
|
@@ -31,7 +52,7 @@ function doltStepEnabled() {
|
|
|
31
52
|
const FLEET_SE_MIN_NODE = [22, 16, 0];
|
|
32
53
|
function probeVersion(cmd, shell) {
|
|
33
54
|
try {
|
|
34
|
-
const out = execFileSync(cmd, ['--version'], { stdio: 'pipe', encoding: 'utf-8', timeout: 15_000, shell });
|
|
55
|
+
const out = execFileSync(cmd, ['--version'], { stdio: 'pipe', encoding: 'utf-8', timeout: 15_000, shell, windowsHide: true });
|
|
35
56
|
return String(out).trim() || null;
|
|
36
57
|
}
|
|
37
58
|
catch {
|
|
@@ -55,6 +76,43 @@ export function _setFleetSePrereqProbes(overrides) {
|
|
|
55
76
|
export function _resetFleetSePrereqProbes() {
|
|
56
77
|
fleetSePrereqProbes = realFleetSePrereqProbes;
|
|
57
78
|
}
|
|
79
|
+
// Running fleet-sprint supervisor/sprint guard (fleet-se-guard.ts): same
|
|
80
|
+
// injectable-probes + NODE_ENV=test gate as the prereq check above, so unit
|
|
81
|
+
// tests never probe the real port 8787 or tmp lock dir.
|
|
82
|
+
let fleetSeProbes = realFleetSeProbes;
|
|
83
|
+
/** Test-only: inject fake probes for the running fleet-sprint guard. */
|
|
84
|
+
export function _setFleetSeProbes(overrides) {
|
|
85
|
+
fleetSeProbes = { ...realFleetSeProbes, ...overrides };
|
|
86
|
+
}
|
|
87
|
+
/** Test-only: restore the real running fleet-sprint guard probes. */
|
|
88
|
+
export function _resetFleetSeProbes() {
|
|
89
|
+
fleetSeProbes = realFleetSeProbes;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* True when a live apra-fleet server relevant to THIS install is recorded -- the
|
|
93
|
+
* same classification the running-server guard uses. The fleet-sprint refusal
|
|
94
|
+
* reads it to put --force on its rerun line. Overridable for tests.
|
|
95
|
+
*/
|
|
96
|
+
function realLiveServerProbe() {
|
|
97
|
+
try {
|
|
98
|
+
return (isSea() || isNpmGlobalInstall()) && isApraFleetRunning() && classifyRunningServer(BIN_DIR)?.relevant === true;
|
|
99
|
+
}
|
|
100
|
+
catch {
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
let liveServerProbe = realLiveServerProbe;
|
|
105
|
+
/** Test-only: replace the live-server probe used by the fleet-sprint refusal. */
|
|
106
|
+
export function _setLiveServerProbe(probe) {
|
|
107
|
+
liveServerProbe = probe ?? realLiveServerProbe;
|
|
108
|
+
}
|
|
109
|
+
/** The probes the running fleet-sprint guard uses (shared with update.ts). */
|
|
110
|
+
export function currentFleetSeProbes() { return fleetSeProbes; }
|
|
111
|
+
export function fleetSeGuardEnabled() {
|
|
112
|
+
if (process.env.NODE_ENV !== 'test')
|
|
113
|
+
return true;
|
|
114
|
+
return process.env.APRA_FLEET_ENABLE_FLEET_SE_GUARD === '1';
|
|
115
|
+
}
|
|
58
116
|
function fleetSePrereqCheckEnabled() {
|
|
59
117
|
if (process.env.NODE_ENV !== 'test')
|
|
60
118
|
return true;
|
|
@@ -97,6 +155,25 @@ export function checkFleetSePrereqs(probes) {
|
|
|
97
155
|
let _seaOverride = null;
|
|
98
156
|
/** Override isSea() result -- for tests only. Pass null to restore default. */
|
|
99
157
|
export function _setSeaOverride(v) { _seaOverride = v; }
|
|
158
|
+
let _serviceHealthWaitOverride = null;
|
|
159
|
+
export function _setServiceHealthWaitOverride(fn) { _serviceHealthWaitOverride = fn; }
|
|
160
|
+
async function waitForServiceHealth() {
|
|
161
|
+
if (_serviceHealthWaitOverride)
|
|
162
|
+
return _serviceHealthWaitOverride();
|
|
163
|
+
const raw = parseInt(process.env.APRA_FLEET_INSTALL_HEALTH_TIMEOUT_MS ?? '', 10);
|
|
164
|
+
const timeoutMs = Number.isFinite(raw) && raw >= 0 ? raw : 30_000;
|
|
165
|
+
if (timeoutMs === 0)
|
|
166
|
+
return null;
|
|
167
|
+
const { checkRunningInstance } = await import('../services/singleton.js');
|
|
168
|
+
const deadline = Date.now() + timeoutMs;
|
|
169
|
+
for (;;) {
|
|
170
|
+
if ((await checkRunningInstance()).running)
|
|
171
|
+
return true;
|
|
172
|
+
if (Date.now() >= deadline)
|
|
173
|
+
return false;
|
|
174
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
175
|
+
}
|
|
176
|
+
}
|
|
100
177
|
export function isSea() {
|
|
101
178
|
if (_seaOverride !== null)
|
|
102
179
|
return _seaOverride;
|
|
@@ -387,11 +464,19 @@ export function buildDevManifest(root) {
|
|
|
387
464
|
...(fs.existsSync(helloWorldDir) ? collectPackageTree(root, helloWorldDir, 'hello-world') : {}),
|
|
388
465
|
};
|
|
389
466
|
}
|
|
467
|
+
// fleet-status Claude Code mod (mirrors scripts/gen-sea-config.mjs's
|
|
468
|
+
// claudePlugins section): runtime files only, keyed '<plugin>/<rel path>'.
|
|
469
|
+
const claudePlugins = {};
|
|
470
|
+
const modRaw = collectFilesRec(path.join(root, ...CLAUDE_MOD_SOURCE_DIR.split('/')), CLAUDE_MOD_SOURCE_DIR, CLAUDE_MOD_SOURCE_DIR);
|
|
471
|
+
for (const [rel, diskPath] of Object.entries(modRaw)) {
|
|
472
|
+
if (isClaudeModRuntimeFile(rel))
|
|
473
|
+
claudePlugins[`${CLAUDE_MOD_PLUGIN}/${rel}`] = diskPath;
|
|
474
|
+
}
|
|
390
475
|
const vf = JSON.parse(fs.readFileSync(path.join(root, 'version.json'), 'utf-8'));
|
|
391
476
|
return {
|
|
392
477
|
version: vf.version, hooks, scripts, skills, fleetSkills, agents, workflows,
|
|
393
478
|
workflowRuntime, agentSchemas, builtinWorkflows, autoSprintArgsSkill,
|
|
394
|
-
fleetSprintCliSkill, fleetSupervisorSkill,
|
|
479
|
+
fleetSprintCliSkill, fleetSupervisorSkill, claudePlugins,
|
|
395
480
|
};
|
|
396
481
|
}
|
|
397
482
|
let _manifestOverride = null;
|
|
@@ -572,15 +657,29 @@ function mergePermissions(paths, extraPerms = []) {
|
|
|
572
657
|
}
|
|
573
658
|
writeConfig(paths, settings);
|
|
574
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* Point the provider's statusLine at apra-fleet's statusline script -- unless
|
|
662
|
+
* the user already has a statusLine of their own (one whose command is not
|
|
663
|
+
* apra-fleet's script), which is never overwritten. Returns 'kept-foreign'
|
|
664
|
+
* in that case so the caller can say so.
|
|
665
|
+
*/
|
|
575
666
|
function configureStatusline(paths, scriptPath, llm) {
|
|
576
667
|
const settings = readConfig(paths);
|
|
668
|
+
if (settings.statusLine && !isApraFleetStatusLine(settings.statusLine))
|
|
669
|
+
return 'kept-foreign';
|
|
577
670
|
let command;
|
|
578
671
|
if (process.platform === 'win32') {
|
|
579
672
|
if (llm === 'agy') {
|
|
580
|
-
const gitBash = 'C:\\Program Files\\Git\\bin\\bash.exe';
|
|
581
|
-
const bashBin = fs.existsSync(gitBash) ? `"${gitBash}"` : 'bash';
|
|
582
673
|
const formattedScriptPath = scriptPath.replace(/\\/g, '/');
|
|
583
|
-
|
|
674
|
+
const candidates = gitBashCandidates(process.env.LOCALAPPDATA);
|
|
675
|
+
const gitBash = candidates.find(c => fs.existsSync(c));
|
|
676
|
+
if (gitBash) {
|
|
677
|
+
const gitBin = path.dirname(gitBash);
|
|
678
|
+
command = `set PATH=${gitBin};%PATH% && bash '${formattedScriptPath}'`;
|
|
679
|
+
}
|
|
680
|
+
else {
|
|
681
|
+
command = `bash '${formattedScriptPath}'`;
|
|
682
|
+
}
|
|
584
683
|
}
|
|
585
684
|
else {
|
|
586
685
|
command = `bash "${scriptPath}"`;
|
|
@@ -594,6 +693,17 @@ function configureStatusline(paths, scriptPath, llm) {
|
|
|
594
693
|
command,
|
|
595
694
|
};
|
|
596
695
|
writeConfig(paths, settings);
|
|
696
|
+
return 'written';
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* The fleet-status mod's runtime files from the asset manifest (SEA or dev),
|
|
700
|
+
* relative to the mod folder. Empty when this build does not package the mod.
|
|
701
|
+
*/
|
|
702
|
+
function claudeModFiles(manifest) {
|
|
703
|
+
const prefix = `${CLAUDE_MOD_PLUGIN}/`;
|
|
704
|
+
return Object.entries(manifest.claudePlugins ?? {})
|
|
705
|
+
.filter(([key]) => key.startsWith(prefix))
|
|
706
|
+
.map(([key, assetKey]) => ({ relPath: key.slice(prefix.length), content: extractAssetBuffer(assetKey) }));
|
|
597
707
|
}
|
|
598
708
|
function mergeAgyConfig(paths, mcpConfig) {
|
|
599
709
|
const configDir = path.join(os.homedir(), '.gemini', 'config');
|
|
@@ -608,7 +718,11 @@ function mergeAgyConfig(paths, mcpConfig) {
|
|
|
608
718
|
}
|
|
609
719
|
settings.mcpServers = settings.mcpServers || {};
|
|
610
720
|
settings.mcpServers['apra-fleet'] = mcpConfig;
|
|
611
|
-
|
|
721
|
+
const out = JSON.stringify(settings, null, 2) + '\n';
|
|
722
|
+
if (mcpConfig.headers)
|
|
723
|
+
writeOwnerOnlyFile(mcpConfigFile, out);
|
|
724
|
+
else
|
|
725
|
+
fs.writeFileSync(mcpConfigFile, out);
|
|
612
726
|
}
|
|
613
727
|
function writeDefaultModel(paths, standardModel) {
|
|
614
728
|
const settings = readConfig(paths);
|
|
@@ -621,25 +735,25 @@ function mergeCopilotConfig(paths, mcpConfig) {
|
|
|
621
735
|
const settings = readConfig(paths);
|
|
622
736
|
settings.mcpServers = settings.mcpServers || {};
|
|
623
737
|
settings.mcpServers['apra-fleet'] = mcpConfig;
|
|
624
|
-
writeConfig(paths, settings);
|
|
738
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
625
739
|
}
|
|
626
740
|
function mergeOpenCodeConfig(paths, mcpConfig) {
|
|
627
741
|
const settings = readConfig(paths);
|
|
628
742
|
settings.mcp = settings.mcp || {};
|
|
629
743
|
settings.mcp['apra-fleet'] = mcpConfig.url
|
|
630
|
-
? { type: 'remote', url: mcpConfig.url, enabled: true }
|
|
744
|
+
? { type: 'remote', url: mcpConfig.url, enabled: true, ...(mcpConfig.headers ? { headers: mcpConfig.headers } : {}) }
|
|
631
745
|
: {
|
|
632
746
|
type: 'local',
|
|
633
747
|
command: [mcpConfig.command, ...(mcpConfig.args || [])],
|
|
634
748
|
enabled: true,
|
|
635
749
|
};
|
|
636
|
-
writeConfig(paths, settings);
|
|
750
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
637
751
|
}
|
|
638
752
|
function mergeCodexConfig(paths, mcpConfig) {
|
|
639
753
|
const settings = readConfig(paths);
|
|
640
754
|
settings.mcp_servers = settings.mcp_servers || {};
|
|
641
755
|
if (mcpConfig.url) {
|
|
642
|
-
settings.mcp_servers['apra-fleet'] = { url: mcpConfig.url };
|
|
756
|
+
settings.mcp_servers['apra-fleet'] = { url: mcpConfig.url, ...(mcpConfig.headers ? { http_headers: mcpConfig.headers } : {}) };
|
|
643
757
|
}
|
|
644
758
|
else {
|
|
645
759
|
settings.mcp_servers['apra-fleet'] = {
|
|
@@ -647,12 +761,101 @@ function mergeCodexConfig(paths, mcpConfig) {
|
|
|
647
761
|
args: mcpConfig.args.map((a) => a.replace(/\\/g, '/')),
|
|
648
762
|
};
|
|
649
763
|
}
|
|
650
|
-
writeConfig(paths, settings);
|
|
764
|
+
writeConfig(paths, settings, { ownerOnly: !!mcpConfig.headers });
|
|
765
|
+
}
|
|
766
|
+
export { claudeUserConfigPath } from '../services/claude-local-scope-mcp.js';
|
|
767
|
+
/**
|
|
768
|
+
* Register the http apra-fleet server in claude's user scope WITHOUT putting
|
|
769
|
+
* the access secret in argv (`claude mcp add --header` is visible to other
|
|
770
|
+
* local users via ps): the entry is merged into the claude config file
|
|
771
|
+
* directly, which is kept owner-only. An unparseable existing file is never
|
|
772
|
+
* overwritten.
|
|
773
|
+
*/
|
|
774
|
+
export function registerClaudeHttpMcp(url, headers) {
|
|
775
|
+
const file = claudeUserConfigPath();
|
|
776
|
+
let settings = {};
|
|
777
|
+
if (fs.existsSync(file)) {
|
|
778
|
+
const raw = fs.readFileSync(file, 'utf-8').trim();
|
|
779
|
+
if (raw) {
|
|
780
|
+
try {
|
|
781
|
+
settings = JSON.parse(raw);
|
|
782
|
+
}
|
|
783
|
+
catch {
|
|
784
|
+
throw new Error(`${file} is not valid JSON; fix or remove it, then re-run 'apra-fleet install'`);
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
settings.mcpServers = settings.mcpServers || {};
|
|
789
|
+
settings.mcpServers['apra-fleet'] = { type: 'http', url, headers };
|
|
790
|
+
writeOwnerOnlyFileAtomic(file, JSON.stringify(settings, null, 2) + '\n');
|
|
791
|
+
}
|
|
792
|
+
/** Write the http (url + access-secret header) apra-fleet registration for one provider. */
|
|
793
|
+
export function registerHttpMcp(provider, paths, url, headers) {
|
|
794
|
+
if (provider === 'claude')
|
|
795
|
+
registerClaudeHttpMcp(url, headers);
|
|
796
|
+
else if (provider === 'codex')
|
|
797
|
+
mergeCodexConfig(paths, { url, headers });
|
|
798
|
+
else if (provider === 'copilot')
|
|
799
|
+
mergeCopilotConfig(paths, { url, type: 'http', headers });
|
|
800
|
+
else if (provider === 'agy')
|
|
801
|
+
mergeAgyConfig(paths, { url, headers });
|
|
802
|
+
else if (provider === 'opencode')
|
|
803
|
+
mergeOpenCodeConfig(paths, { url, headers });
|
|
804
|
+
}
|
|
805
|
+
/** The apra-fleet MCP entry `provider` has registered (parsed), or undefined. Never throws. */
|
|
806
|
+
function registeredMcpEntry(provider, paths) {
|
|
807
|
+
try {
|
|
808
|
+
if (provider === 'claude')
|
|
809
|
+
return readJsonOrEmpty(claudeUserConfigPath()).mcpServers?.['apra-fleet'];
|
|
810
|
+
if (provider === 'agy')
|
|
811
|
+
return readJsonOrEmpty(path.join(os.homedir(), '.gemini', 'config', 'mcp_config.json')).mcpServers?.['apra-fleet'];
|
|
812
|
+
const settings = readConfig(paths);
|
|
813
|
+
if (provider === 'codex')
|
|
814
|
+
return settings.mcp_servers?.['apra-fleet'];
|
|
815
|
+
if (provider === 'copilot')
|
|
816
|
+
return settings.mcpServers?.['apra-fleet'];
|
|
817
|
+
if (provider === 'opencode')
|
|
818
|
+
return settings.mcp?.['apra-fleet'];
|
|
819
|
+
}
|
|
820
|
+
catch { /* unreadable -> unknown */ }
|
|
821
|
+
return undefined;
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* Key-order-independent serialization of `provider`'s apra-fleet entry, to
|
|
825
|
+
* tell whether a registration write changed it (formatting and the rest of
|
|
826
|
+
* the file do not count).
|
|
827
|
+
*/
|
|
828
|
+
function mcpRegistrationSnapshot(provider, paths) {
|
|
829
|
+
const canon = (v) => Array.isArray(v) ? v.map(canon)
|
|
830
|
+
: v && typeof v === 'object' ? Object.fromEntries(Object.keys(v).sort().map(k => [k, canon(v[k])])) : v;
|
|
831
|
+
return JSON.stringify(canon(registeredMcpEntry(provider, paths)) ?? null);
|
|
832
|
+
}
|
|
833
|
+
function readJsonOrEmpty(file) {
|
|
834
|
+
try {
|
|
835
|
+
return fs.existsSync(file) ? JSON.parse(fs.readFileSync(file, 'utf-8')) : {};
|
|
836
|
+
}
|
|
837
|
+
catch {
|
|
838
|
+
return {};
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* The transport of the apra-fleet MCP entry `provider` currently has
|
|
843
|
+
* registered, read from the provider's own config (install-config.json
|
|
844
|
+
* records no transport): 'stdio' (a command entry), 'http' (a url entry), or
|
|
845
|
+
* undefined (no entry / unreadable config). Never throws.
|
|
846
|
+
*/
|
|
847
|
+
export function registeredMcpTransport(provider, paths) {
|
|
848
|
+
const classify = (e) => !e || typeof e !== 'object' ? undefined : e.url ? 'http' : e.command ? 'stdio' : undefined;
|
|
849
|
+
const e = registeredMcpEntry(provider, paths);
|
|
850
|
+
if (provider === 'opencode') {
|
|
851
|
+
return e?.type === 'remote' || e?.url ? 'http' : e?.type === 'local' || e?.command ? 'stdio' : undefined;
|
|
852
|
+
}
|
|
853
|
+
return classify(e);
|
|
651
854
|
}
|
|
652
855
|
function run(cmd, opts) {
|
|
653
856
|
// Windows needs a shell for .cmd executables (e.g. claude.cmd)
|
|
654
857
|
const shellOpt = process.platform === 'win32' ? { shell: 'cmd.exe' } : {};
|
|
655
|
-
execSync(cmd, { stdio: 'inherit', ...shellOpt, ...opts });
|
|
858
|
+
execSync(cmd, { stdio: 'inherit', windowsHide: true, ...shellOpt, ...opts });
|
|
656
859
|
}
|
|
657
860
|
/** Is `cmd` resolvable on PATH? Used before shelling out to a provider's own
|
|
658
861
|
* CLI (e.g. `claude`) so a missing binary degrades to a clear warning
|
|
@@ -660,7 +863,7 @@ function run(cmd, opts) {
|
|
|
660
863
|
function isCommandAvailable(cmd) {
|
|
661
864
|
try {
|
|
662
865
|
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
|
|
663
|
-
execSync(checkCmd, { stdio: 'ignore' });
|
|
866
|
+
execSync(checkCmd, { stdio: 'ignore', windowsHide: true });
|
|
664
867
|
return true;
|
|
665
868
|
}
|
|
666
869
|
catch {
|
|
@@ -668,23 +871,22 @@ function isCommandAvailable(cmd) {
|
|
|
668
871
|
}
|
|
669
872
|
}
|
|
670
873
|
/**
|
|
671
|
-
* PIDs of every
|
|
874
|
+
* PIDs of every apra-fleet process currently running other than this one, as
|
|
875
|
+
* strings.
|
|
672
876
|
*
|
|
673
|
-
* OS-global on purpose -- isApraFleetRunning() is defined in terms of this
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* under a NEW pid" -- those need different remedies and different error text
|
|
681
|
-
* (see the service-aware stop note below).
|
|
877
|
+
* OS-global on purpose -- isApraFleetRunning() is defined in terms of this and
|
|
878
|
+
* is the install guard's cheap first filter and uninstall.ts's running check.
|
|
879
|
+
* It is NOT what install --force stops or watches: that is scoped to
|
|
880
|
+
* relevantServerPids() (install-guard.ts). The current process is always
|
|
881
|
+
* excluded: the installer may itself be named apra-fleet (the fleet's member
|
|
882
|
+
* upgrade runs <home>/.apra-fleet/staging/apra-fleet, and a self-update runs
|
|
883
|
+
* the installed binary).
|
|
682
884
|
*/
|
|
683
885
|
export function apraFleetPids() {
|
|
684
886
|
try {
|
|
685
887
|
const currentPid = process.pid.toString();
|
|
686
888
|
if (process.platform === 'win32') {
|
|
687
|
-
const out = execSync('tasklist /FI "IMAGENAME eq apra-fleet.exe" /NH /FO CSV', { encoding: 'utf-8', stdio: 'pipe' });
|
|
889
|
+
const out = execSync('tasklist /FI "IMAGENAME eq apra-fleet.exe" /NH /FO CSV', { encoding: 'utf-8', stdio: 'pipe', windowsHide: true });
|
|
688
890
|
// Each CSV line: "apra-fleet.exe","<PID>","..." - exclude the current installer process
|
|
689
891
|
return out.split('\n')
|
|
690
892
|
.map(line => line.match(/"apra-fleet\.exe","(\d+)"/))
|
|
@@ -693,9 +895,9 @@ export function apraFleetPids() {
|
|
|
693
895
|
.filter(pid => pid !== currentPid);
|
|
694
896
|
}
|
|
695
897
|
else {
|
|
696
|
-
// -x = exact name match; installer
|
|
697
|
-
//
|
|
698
|
-
const out = execSync('pgrep -x apra-fleet', { encoding: 'utf-8', stdio: 'pipe' });
|
|
898
|
+
// -x = exact name match; the installer itself may be named apra-fleet,
|
|
899
|
+
// so the current PID is excluded.
|
|
900
|
+
const out = execSync('pgrep -x apra-fleet', { encoding: 'utf-8', stdio: 'pipe', windowsHide: true });
|
|
699
901
|
return out.split('\n')
|
|
700
902
|
.map(line => line.trim())
|
|
701
903
|
.filter(pid => pid !== '' && pid !== currentPid);
|
|
@@ -708,18 +910,44 @@ export function apraFleetPids() {
|
|
|
708
910
|
export function isApraFleetRunning() {
|
|
709
911
|
return apraFleetPids().length > 0;
|
|
710
912
|
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
913
|
+
/**
|
|
914
|
+
* Signal the given apra-fleet pids -- by PID, never by process name. A
|
|
915
|
+
* name-based kill (pkill -x apra-fleet / taskkill /IM apra-fleet.exe) also
|
|
916
|
+
* matches the installer when it is named apra-fleet, which killed the fleet's
|
|
917
|
+
* member upgrade mid-install (exit 143), and every unrelated apra-fleet server
|
|
918
|
+
* of the same user (apra-fleet-b4g.72). This process is never signalled, even
|
|
919
|
+
* when passed in. A pid that already exited is ignored.
|
|
920
|
+
*/
|
|
921
|
+
export function killApraFleet(pids, signal = 'SIGTERM') {
|
|
922
|
+
for (const raw of pids) {
|
|
923
|
+
const pid = Number(raw);
|
|
924
|
+
if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
|
|
925
|
+
continue;
|
|
926
|
+
try {
|
|
927
|
+
if (process.platform === 'win32') {
|
|
928
|
+
// taskkill /F is already forceful -- no softer signal to escalate from,
|
|
929
|
+
// so SIGKILL escalation on Windows just reissues the same command.
|
|
930
|
+
execSync(`taskkill /F /PID ${pid}`, { stdio: 'ignore', windowsHide: true });
|
|
931
|
+
}
|
|
932
|
+
else {
|
|
933
|
+
process.kill(pid, signal);
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
catch {
|
|
937
|
+
// Already gone (ESRCH / taskkill "not found"): nothing to stop.
|
|
938
|
+
}
|
|
721
939
|
}
|
|
722
940
|
}
|
|
941
|
+
/** Manual stop advice: the pids still running, plus the by-name fallback. */
|
|
942
|
+
function manualStopHint(pids) {
|
|
943
|
+
const byName = process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pkill -x apra-fleet';
|
|
944
|
+
if (pids.length === 0)
|
|
945
|
+
return byName;
|
|
946
|
+
const byPid = process.platform === 'win32'
|
|
947
|
+
? pids.map(pid => ` taskkill /F /PID ${pid}`).join('\n')
|
|
948
|
+
: ` kill ${pids.join(' ')}`;
|
|
949
|
+
return `${byPid}\n or, when no other apra-fleet server of yours must keep running:\n${byName}`;
|
|
950
|
+
}
|
|
723
951
|
const PROD_INSTALL_FORCE_TIMING = { pollIntervalMs: 200, graceMs: 3000, killGraceMs: 2000 };
|
|
724
952
|
// Tests run with NODE_ENV=test (see tests/setup.ts) and don't fake these timers,
|
|
725
953
|
// so default to a much shorter window there to keep the suite fast, unless a
|
|
@@ -737,33 +965,35 @@ function installForceTiming() {
|
|
|
737
965
|
return process.env.NODE_ENV === 'test' ? TEST_INSTALL_FORCE_TIMING : PROD_INSTALL_FORCE_TIMING;
|
|
738
966
|
}
|
|
739
967
|
/**
|
|
740
|
-
* Wait for
|
|
741
|
-
*
|
|
742
|
-
*
|
|
743
|
-
* polls again over a second (shorter) window.
|
|
744
|
-
*
|
|
745
|
-
*
|
|
746
|
-
*
|
|
747
|
-
*
|
|
968
|
+
* Wait for the relevant apra-fleet pids (`listPids`, re-evaluated on every
|
|
969
|
+
* poll; never this process) to exit after killApraFleet() sends SIGTERM. If
|
|
970
|
+
* any is still alive once the grace window elapses, escalates to SIGKILL
|
|
971
|
+
* against exactly those and polls again over a second (shorter) window.
|
|
972
|
+
* Returns as soon as none is detected, or once both windows have elapsed --
|
|
973
|
+
* callers should not assume termination is guaranteed in the latter case (see
|
|
974
|
+
* apra-fleet-l7n.3 for surfacing that failure to the operator instead of
|
|
975
|
+
* asserting success).
|
|
748
976
|
*/
|
|
749
|
-
export async function waitForApraFleetToStop() {
|
|
977
|
+
export async function waitForApraFleetToStop(listPids) {
|
|
750
978
|
const { pollIntervalMs, graceMs, killGraceMs } = installForceTiming();
|
|
751
979
|
let deadline = Date.now() + graceMs;
|
|
752
|
-
|
|
980
|
+
let pids = listPids();
|
|
981
|
+
while (pids.length > 0 && Date.now() < deadline) {
|
|
753
982
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
983
|
+
pids = listPids();
|
|
754
984
|
}
|
|
755
|
-
if (
|
|
985
|
+
if (pids.length === 0)
|
|
756
986
|
return;
|
|
757
|
-
// Grace window elapsed and a
|
|
758
|
-
killApraFleet('SIGKILL');
|
|
987
|
+
// Grace window elapsed and a relevant apra-fleet process is still alive -- escalate.
|
|
988
|
+
killApraFleet(pids, 'SIGKILL');
|
|
759
989
|
deadline = Date.now() + killGraceMs;
|
|
760
|
-
while (
|
|
990
|
+
while (listPids().length > 0 && Date.now() < deadline) {
|
|
761
991
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
762
992
|
}
|
|
763
993
|
}
|
|
764
994
|
// --- install --force service-aware stop ---
|
|
765
995
|
//
|
|
766
|
-
// killApraFleet() signals the server
|
|
996
|
+
// killApraFleet() signals the server's pid directly. When the server is
|
|
767
997
|
// registered with the platform service manager that is a race the installer
|
|
768
998
|
// cannot win: the macOS LaunchAgent this installer writes declares
|
|
769
999
|
// KeepAlive/SuccessfulExit=false (src/services/service-manager/macos.ts), so
|
|
@@ -790,7 +1020,9 @@ async function registeredServiceManager() {
|
|
|
790
1020
|
/** Exact command an operator can run to bring the registered service back up. */
|
|
791
1021
|
export function serviceRestartCommand() {
|
|
792
1022
|
switch (process.platform) {
|
|
793
|
-
|
|
1023
|
+
// A stop disables the task (its repeating trigger would undo the stop);
|
|
1024
|
+
// apra-fleet start re-enables it before running it.
|
|
1025
|
+
case 'win32': return 'apra-fleet start';
|
|
794
1026
|
case 'linux': return `systemctl --user start ${LINUX_UNIT_NAME}`;
|
|
795
1027
|
case 'darwin': return `launchctl kickstart -k gui/${macosGuiUid()}/${MACOS_PLIST_LABEL}`;
|
|
796
1028
|
default: return 'apra-fleet install';
|
|
@@ -799,7 +1031,9 @@ export function serviceRestartCommand() {
|
|
|
799
1031
|
/** Exact command an operator can run to take the registered service down. */
|
|
800
1032
|
export function serviceStopCommand() {
|
|
801
1033
|
switch (process.platform) {
|
|
802
|
-
|
|
1034
|
+
// apra-fleet stop disables the task (its repeating trigger would undo a
|
|
1035
|
+
// bare /end) and records the stop so nothing restarts the server.
|
|
1036
|
+
case 'win32': return 'apra-fleet stop';
|
|
803
1037
|
case 'linux': return `systemctl --user stop ${LINUX_UNIT_NAME}`;
|
|
804
1038
|
case 'darwin': return `launchctl bootout gui/${macosGuiUid()}/${MACOS_PLIST_LABEL}`;
|
|
805
1039
|
default: return 'apra-fleet uninstall';
|
|
@@ -816,13 +1050,13 @@ function macosGuiUid() {
|
|
|
816
1050
|
* supervisor relaunch. Returns the pids still observed once the window closes
|
|
817
1051
|
* (empty when the service is down).
|
|
818
1052
|
*/
|
|
819
|
-
async function waitForServiceStop() {
|
|
1053
|
+
async function waitForServiceStop(listPids) {
|
|
820
1054
|
const { pollIntervalMs, graceMs } = installForceTiming();
|
|
821
1055
|
const deadline = Date.now() + graceMs;
|
|
822
|
-
let pids =
|
|
1056
|
+
let pids = listPids();
|
|
823
1057
|
while (pids.length > 0 && Date.now() < deadline) {
|
|
824
1058
|
await new Promise(resolve => setTimeout(resolve, pollIntervalMs));
|
|
825
|
-
pids =
|
|
1059
|
+
pids = listPids();
|
|
826
1060
|
}
|
|
827
1061
|
return pids;
|
|
828
1062
|
}
|
|
@@ -868,6 +1102,56 @@ function copyGlobalBible(repoCwd) {
|
|
|
868
1102
|
console.warn(' [WARN] Global knowledge bible copy skipped:', err instanceof Error ? err.message : String(err));
|
|
869
1103
|
}
|
|
870
1104
|
}
|
|
1105
|
+
/** The one next step a member install prints: the orchestrator registers the
|
|
1106
|
+
* member, which also writes its per-folder apra-fleet MCP entry. */
|
|
1107
|
+
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; ' +
|
|
1108
|
+
'it registers the member on this install and writes its per-folder apra-fleet MCP entry.';
|
|
1109
|
+
/**
|
|
1110
|
+
* The port a member install records: --port <n> / --port=<n>, else
|
|
1111
|
+
* APRA_FLEET_PORT, else the port an earlier member install in this data dir
|
|
1112
|
+
* recorded (an upgrade keeps it), else the built-in default. `explicit` is
|
|
1113
|
+
* true when --port was passed. --port that disagrees with APRA_FLEET_PORT is
|
|
1114
|
+
* an error: the two would put the server and its record on different ports.
|
|
1115
|
+
*/
|
|
1116
|
+
export function resolveMemberInstallPort(args, envPort, recordedPort) {
|
|
1117
|
+
let raw;
|
|
1118
|
+
const eq = args.find(a => a.startsWith('--port='));
|
|
1119
|
+
if (eq)
|
|
1120
|
+
raw = eq.slice('--port='.length);
|
|
1121
|
+
else {
|
|
1122
|
+
const i = args.indexOf('--port');
|
|
1123
|
+
if (i >= 0) {
|
|
1124
|
+
raw = args[i + 1];
|
|
1125
|
+
if (raw === undefined || raw.startsWith('-'))
|
|
1126
|
+
return { error: '--port requires a port number (1-65535).' };
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
const env = envPort !== undefined && envPort !== '' ? validPort(envPort) : undefined;
|
|
1130
|
+
if (raw !== undefined) {
|
|
1131
|
+
const port = validPort(raw);
|
|
1132
|
+
if (port === undefined)
|
|
1133
|
+
return { error: `--port must be a port number (1-65535), got "${raw}".` };
|
|
1134
|
+
if (env !== undefined && env !== port) {
|
|
1135
|
+
return { error: `--port ${port} disagrees with APRA_FLEET_PORT=${env}; pass one of them.` };
|
|
1136
|
+
}
|
|
1137
|
+
return { port, explicit: true };
|
|
1138
|
+
}
|
|
1139
|
+
return { port: env ?? recordedPort ?? BUILTIN_DEFAULT_PORT, explicit: false };
|
|
1140
|
+
}
|
|
1141
|
+
/** Restart-sessions text shown after an install that changed an MCP registration (ASCII only). */
|
|
1142
|
+
export const ACCESS_RESTART_NOTE = '[!] 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)").';
|
|
1143
|
+
/**
|
|
1144
|
+
* Persist ACCESS_RESTART_NOTE as a pending service notice when an install
|
|
1145
|
+
* changed a (non-member) registration. `shownInline` (stdout is a console)
|
|
1146
|
+
* marks it already shown, so an interactive install does not repeat it on the
|
|
1147
|
+
* next service verb; a detached install (apra-fleet update) leaves it pending.
|
|
1148
|
+
*/
|
|
1149
|
+
export function recordAccessRestartNotice(changed, shownInline, file = SERVICE_NOTICE_PATH) {
|
|
1150
|
+
if (!changed)
|
|
1151
|
+
return;
|
|
1152
|
+
// Append, never overwrite: registration may have left unshown legacy-task guidance.
|
|
1153
|
+
appendServiceNotice(ACCESS_RESTART_NOTE, file, new Date(), shownInline);
|
|
1154
|
+
}
|
|
871
1155
|
export async function runInstall(args) {
|
|
872
1156
|
// --help / -h guard - must come first, before any side effects (#142)
|
|
873
1157
|
if (args.includes('--help') || args.includes('-h')) {
|
|
@@ -883,6 +1167,7 @@ Usage:
|
|
|
883
1167
|
apra-fleet install --skill none Skip skill installation
|
|
884
1168
|
apra-fleet install --no-skill Same as --skill none
|
|
885
1169
|
apra-fleet install --workflows none Skip installing the workflow runtime + built-in workflows
|
|
1170
|
+
apra-fleet install --member Member install: server + user-mode auto-start only (see below)
|
|
886
1171
|
apra-fleet install --force Stop a running server before installing
|
|
887
1172
|
apra-fleet install --llm <provider> Target LLM provider: claude (default), codex, copilot, agy, opencode
|
|
888
1173
|
apra-fleet install --transport http Register MCP server with HTTP transport (default)
|
|
@@ -896,11 +1181,29 @@ Options:
|
|
|
896
1181
|
fleet server at http://localhost:7523/mcp. stdio runs fleet as a subprocess.
|
|
897
1182
|
--skill <mode> Which skills to install: all (default), fleet, pm, or none.
|
|
898
1183
|
--no-skill Alias for --skill none.
|
|
1184
|
+
--member Install only the server and its user-mode auto-start. Implies
|
|
1185
|
+
--skill none --workflows none; writes NO user-scope MCP entry,
|
|
1186
|
+
hooks/statusline/permissions settings or ~/.claude/CLAUDE.md block.
|
|
1187
|
+
Fails with E-MEMBER-AUTOSTART if the auto-start cannot be registered.
|
|
899
1188
|
--workflows <mode> Which workflow assets to install: all (default) or none. Installs
|
|
900
1189
|
~/.apra-fleet/node_modules (workflow runtime), /schemas (agent role
|
|
901
1190
|
schemas), and /workflows/{fleet-sprint,hello-world} (built-in workflows).
|
|
902
1191
|
fleet-se requires Node.js 22.16+ and npm.
|
|
903
|
-
--force Stop a running apra-fleet server before installing (SEA mode only)
|
|
1192
|
+
--force Stop a running apra-fleet server before installing (SEA mode only).
|
|
1193
|
+
With --member, only a server a previous member install left behind
|
|
1194
|
+
is stopped; anything else is refused (E-FULL-INSTALL-RUNNING).
|
|
1195
|
+
--ignore-running-sprints
|
|
1196
|
+
Install even while a fleet-sprint supervisor or sprint is running for this
|
|
1197
|
+
user; the server is replaced underneath them (ones started under 0.4.3 or
|
|
1198
|
+
earlier then fail with HTTP 401 until restarted). Without it install
|
|
1199
|
+
refuses (E-FLEET-SE-RUNNING); --force does not override this.
|
|
1200
|
+
--force-stop-full-install
|
|
1201
|
+
With --member --force: also stop a running server that was not started
|
|
1202
|
+
by a member install (e.g. a full install on a shared machine).
|
|
1203
|
+
--port <n> With --member: the port this member install's server listens on
|
|
1204
|
+
(default: APRA_FLEET_PORT, else the port a previous member install
|
|
1205
|
+
recorded, else 7523). Recorded in the member-install marker; use a
|
|
1206
|
+
different port for each Unix user's member install on one host.`);
|
|
904
1207
|
process.exit(0);
|
|
905
1208
|
return;
|
|
906
1209
|
}
|
|
@@ -978,6 +1281,7 @@ Options:
|
|
|
978
1281
|
}
|
|
979
1282
|
// Parse --force flag
|
|
980
1283
|
const force = args.includes('--force');
|
|
1284
|
+
const forceStopFullInstall = args.includes(FORCE_STOP_FULL_INSTALL_FLAG);
|
|
981
1285
|
let transport = 'http';
|
|
982
1286
|
const transportEqualArg = args.find(a => a.startsWith('--transport='));
|
|
983
1287
|
if (transportEqualArg) {
|
|
@@ -1004,8 +1308,14 @@ Options:
|
|
|
1004
1308
|
}
|
|
1005
1309
|
}
|
|
1006
1310
|
// Reject unknown flags to catch typos early
|
|
1007
|
-
const
|
|
1008
|
-
|
|
1311
|
+
const memberMode = args.includes('--member');
|
|
1312
|
+
if (memberMode) {
|
|
1313
|
+
// A member install carries the server only: no skills, no workflows.
|
|
1314
|
+
skillMode = 'none';
|
|
1315
|
+
workflowsMode = 'none';
|
|
1316
|
+
}
|
|
1317
|
+
const knownFlagPrefixes = ['--llm=', '--skill=', '--transport=', '--workflows=', '--port='];
|
|
1318
|
+
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
1319
|
for (const a of args) {
|
|
1010
1320
|
if (knownFlagExact.has(a))
|
|
1011
1321
|
continue;
|
|
@@ -1016,6 +1326,19 @@ Options:
|
|
|
1016
1326
|
console.error(`Error: Unknown option "${a}". Run apra-fleet install --help for usage.`);
|
|
1017
1327
|
process.exit(1);
|
|
1018
1328
|
}
|
|
1329
|
+
// The port a member install's server listens on, recorded in the marker
|
|
1330
|
+
// (the server reads it back at launch; the orchestrator reads it for the
|
|
1331
|
+
// member's MCP URL). Only a member install takes --port.
|
|
1332
|
+
const memberPortChoice = resolveMemberInstallPort(args, process.env.APRA_FLEET_PORT, recordedMemberInstallPort());
|
|
1333
|
+
if ('error' in memberPortChoice) {
|
|
1334
|
+
console.error(`Error: ${memberPortChoice.error}`);
|
|
1335
|
+
process.exit(1);
|
|
1336
|
+
}
|
|
1337
|
+
if (memberPortChoice.explicit && !memberMode) {
|
|
1338
|
+
console.error('Error: --port is only valid with --member (a full install uses APRA_FLEET_PORT).');
|
|
1339
|
+
process.exit(1);
|
|
1340
|
+
}
|
|
1341
|
+
const memberPort = memberPortChoice.port;
|
|
1019
1342
|
const installFleet = skillMode === 'fleet' || skillMode === 'pm' || skillMode === 'all';
|
|
1020
1343
|
const installPm = skillMode === 'pm' || skillMode === 'all';
|
|
1021
1344
|
const installAgents = installPm && paths.agentsDir !== undefined;
|
|
@@ -1028,7 +1351,58 @@ Options:
|
|
|
1028
1351
|
process.exit(1);
|
|
1029
1352
|
}
|
|
1030
1353
|
}
|
|
1354
|
+
// Running fleet-sprint supervisor/sprint guard: before the running-server
|
|
1355
|
+
// guard so a refusal stops and writes nothing. --force does not bypass it
|
|
1356
|
+
// (update always passes --force); only the dedicated flag does. A member
|
|
1357
|
+
// install is exempt: it installs no fleet-se and is driven remotely by the
|
|
1358
|
+
// orchestrator, whose own host runs the sprints.
|
|
1359
|
+
if (!memberMode && !args.includes(IGNORE_RUNNING_SPRINTS_FLAG)
|
|
1360
|
+
&& (isSea() || isNpmGlobalInstall()) && fleetSeGuardEnabled()) {
|
|
1361
|
+
let found = null;
|
|
1362
|
+
try {
|
|
1363
|
+
found = await detectRunningFleetSe(fleetSeProbes);
|
|
1364
|
+
}
|
|
1365
|
+
catch (err) {
|
|
1366
|
+
console.warn(`WARNING: could not check for a running fleet-sprint supervisor or sprint (${err.message}). If one is running, stop it before upgrading.`);
|
|
1367
|
+
}
|
|
1368
|
+
for (const w of found?.warnings ?? [])
|
|
1369
|
+
console.warn(`WARNING: ${w}`);
|
|
1370
|
+
if (found && (found.supervisor || found.sprints.length > 0)) {
|
|
1371
|
+
const self = (a) => selfInvocationLines({
|
|
1372
|
+
platform: process.platform, execPath: process.execPath, scriptPath: process.argv[1], sea: isSea(), args: ['install', ...a],
|
|
1373
|
+
});
|
|
1374
|
+
const text = fleetSeRefusalText(found, {
|
|
1375
|
+
platform: process.platform,
|
|
1376
|
+
rerunLines: self(fleetSeRerunArgs(args, liveServerProbe())),
|
|
1377
|
+
ignoreLines: self([...args, IGNORE_RUNNING_SPRINTS_FLAG]),
|
|
1378
|
+
});
|
|
1379
|
+
console.error(text);
|
|
1380
|
+
// apra-fleet update runs install detached with no console: persist it
|
|
1381
|
+
// for the next service verb.
|
|
1382
|
+
writeServiceNotice(text.trim(), undefined, new Date(), Boolean(process.stderr.isTTY));
|
|
1383
|
+
process.exit(1);
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
// Past the guard: a refusal persisted by an earlier (detached) install is
|
|
1388
|
+
// obsolete and must not be shown after this install succeeds. All OSes --
|
|
1389
|
+
// only the Windows service manager clears notices on registration.
|
|
1390
|
+
clearServiceNoticeContaining('E-FLEET-SE-RUNNING');
|
|
1031
1391
|
const serviceStep = isSea() && transport === 'http';
|
|
1392
|
+
// A member install exists to leave an auto-starting server behind. With no
|
|
1393
|
+
// service step (stdio transport or non-SEA install) nothing would register
|
|
1394
|
+
// the auto-start, so fail loudly before touching anything.
|
|
1395
|
+
if (memberMode && !serviceStep) {
|
|
1396
|
+
const why = transport !== 'http'
|
|
1397
|
+
? `--transport ${transport} has no auto-start (use --transport http)`
|
|
1398
|
+
: 'a non-SEA (dev) install has no auto-start (use the SEA binary)';
|
|
1399
|
+
console.error(`
|
|
1400
|
+
Error: E-MEMBER-AUTOSTART: --member requires the user-mode auto-start, but ${why}.
|
|
1401
|
+
Nothing was installed.
|
|
1402
|
+
`);
|
|
1403
|
+
process.exitCode = 1;
|
|
1404
|
+
return;
|
|
1405
|
+
}
|
|
1032
1406
|
let totalSteps = (installFleet && installPm) ? 8 : installFleet ? 7 : installPm ? 8 : 6;
|
|
1033
1407
|
if (installAgents)
|
|
1034
1408
|
totalSteps++;
|
|
@@ -1042,8 +1416,8 @@ Options:
|
|
|
1042
1416
|
totalSteps++;
|
|
1043
1417
|
// --- Running-process guard (SEA + npm modes -- dev mode runs via node, not a managed binary) ---
|
|
1044
1418
|
//
|
|
1045
|
-
// isApraFleetRunning() is OS-global on purpose (
|
|
1046
|
-
//
|
|
1419
|
+
// isApraFleetRunning() is OS-global on purpose (uninstall.ts depends on
|
|
1420
|
+
// that). It is only the cheap first filter here:
|
|
1047
1421
|
// classifyRunningServer() then decides whether the running server is actually
|
|
1048
1422
|
// relevant to THIS install -- recorded live in the target data dir, or running
|
|
1049
1423
|
// from the install prefix we are about to overwrite (ETXTBSY). An unrelated
|
|
@@ -1059,53 +1433,79 @@ Options:
|
|
|
1059
1433
|
// binary-copy step can bring it back up instead of leaving it down.
|
|
1060
1434
|
let guardServiceMgr = null;
|
|
1061
1435
|
let guardStoppedService = false;
|
|
1436
|
+
// The service manager's stop() resolved false: a server pid was left running
|
|
1437
|
+
// because it could not be verified as apra-fleet (so it was not killed).
|
|
1438
|
+
let guardStopLeftRunning = false;
|
|
1439
|
+
// The guard restarted the service itself (no final service step to do it).
|
|
1440
|
+
let guardRestartedService = false;
|
|
1062
1441
|
if (runningScope?.relevant) {
|
|
1063
1442
|
if (!force) {
|
|
1064
1443
|
const killHint = process.platform === 'win32'
|
|
1065
1444
|
? ' taskkill /F /IM apra-fleet.exe'
|
|
1066
1445
|
: ' pkill -x apra-fleet';
|
|
1446
|
+
// Name THIS executable, not "apra-fleet": a downloaded installer is
|
|
1447
|
+
// usually not on PATH, and PATH may resolve to the older installed one.
|
|
1448
|
+
const forceHint = selfInvocationLines({
|
|
1449
|
+
platform: process.platform,
|
|
1450
|
+
execPath: process.execPath,
|
|
1451
|
+
scriptPath: process.argv[1],
|
|
1452
|
+
sea: isSea(),
|
|
1453
|
+
args: ['install', ...args.filter(a => a !== '--force'), '--force'],
|
|
1454
|
+
}).map(l => ` ${l}`).join('\n');
|
|
1067
1455
|
console.error(`
|
|
1068
1456
|
Error: apra-fleet is currently running. Stop the server before installing.
|
|
1069
1457
|
(${runningScope.detail})
|
|
1070
1458
|
|
|
1071
1459
|
Run with --force to stop it automatically:
|
|
1072
|
-
|
|
1460
|
+
${forceHint}
|
|
1073
1461
|
|
|
1074
1462
|
Or stop it manually:
|
|
1075
1463
|
${killHint}
|
|
1076
1464
|
`);
|
|
1077
1465
|
process.exit(1);
|
|
1078
1466
|
}
|
|
1467
|
+
// A member install (fleet's remote upgrade path) never stops a server it
|
|
1468
|
+
// did not start unless explicitly told to: nothing has been stopped yet.
|
|
1469
|
+
if (!memberForceMayStop({ memberMode, overridden: forceStopFullInstall })) {
|
|
1470
|
+
console.error(fullInstallRefusalText(runningScope.detail));
|
|
1471
|
+
process.exit(3);
|
|
1472
|
+
}
|
|
1473
|
+
// Only the pids relevant to THIS install are stopped or watched -- by pid,
|
|
1474
|
+
// never by name, never this process (which may itself be named apra-fleet).
|
|
1475
|
+
// Unrelated apra-fleet servers of the same user are left alone.
|
|
1476
|
+
const relevantPids = () => relevantServerPids(BIN_DIR).map(String);
|
|
1079
1477
|
// Snapshot BEFORE anything is stopped: a pid that is present afterwards but
|
|
1080
1478
|
// absent here is a supervisor relaunch, not a process refusing to die.
|
|
1081
|
-
const pidsBeforeStop =
|
|
1479
|
+
const pidsBeforeStop = relevantPids();
|
|
1082
1480
|
guardServiceMgr = await registeredServiceManager();
|
|
1083
1481
|
if (guardServiceMgr) {
|
|
1084
1482
|
// A service is registered: stop the SERVICE, never pkill first.
|
|
1085
1483
|
console.log(' Registered service detected -- stopping it through the service manager.');
|
|
1086
1484
|
try {
|
|
1087
|
-
await guardServiceMgr.stop();
|
|
1485
|
+
const stopped = await guardServiceMgr.stop({ reason: 'install' });
|
|
1088
1486
|
guardStoppedService = true;
|
|
1487
|
+
if (stopped === false)
|
|
1488
|
+
guardStopLeftRunning = true;
|
|
1089
1489
|
}
|
|
1090
1490
|
catch (err) {
|
|
1091
1491
|
console.warn(` Service stop failed: ${err.message}`);
|
|
1092
1492
|
}
|
|
1093
|
-
const stillUp = await waitForServiceStop();
|
|
1493
|
+
const stillUp = await waitForServiceStop(relevantPids);
|
|
1094
1494
|
// Escalate ONLY when the very same pids are still there -- i.e. nothing
|
|
1095
1495
|
// relaunched the server and there is no supervisor race to lose. If a NEW
|
|
1096
|
-
// pid appeared, signalling
|
|
1097
|
-
//
|
|
1496
|
+
// pid appeared, signalling is futile and is deliberately skipped so the
|
|
1497
|
+
// relaunch is reported instead of retried forever.
|
|
1098
1498
|
if (stillUp.length > 0 && stillUp.every(pid => pidsBeforeStop.includes(pid))) {
|
|
1099
|
-
killApraFleet();
|
|
1100
|
-
await waitForApraFleetToStop();
|
|
1499
|
+
killApraFleet(stillUp);
|
|
1500
|
+
await waitForApraFleetToStop(relevantPids);
|
|
1101
1501
|
}
|
|
1102
1502
|
}
|
|
1103
1503
|
else {
|
|
1104
|
-
// No service registered:
|
|
1105
|
-
killApraFleet();
|
|
1106
|
-
await waitForApraFleetToStop();
|
|
1504
|
+
// No service registered: signal the relevant pids directly.
|
|
1505
|
+
killApraFleet(pidsBeforeStop);
|
|
1506
|
+
await waitForApraFleetToStop(relevantPids);
|
|
1107
1507
|
}
|
|
1108
|
-
const pidsAfterStop =
|
|
1508
|
+
const pidsAfterStop = relevantPids();
|
|
1109
1509
|
if (pidsAfterStop.length > 0) {
|
|
1110
1510
|
const relaunchedPids = pidsAfterStop.filter(pid => !pidsBeforeStop.includes(pid));
|
|
1111
1511
|
if (relaunchedPids.length > 0) {
|
|
@@ -1113,7 +1513,7 @@ ${killHint}
|
|
|
1113
1513
|
Error: the apra-fleet server was RELAUNCHED by its service supervisor while
|
|
1114
1514
|
install --force was stopping it -- the observed pid changed between polls (was
|
|
1115
1515
|
${pidsBeforeStop.join(', ') || 'none'}, now ${pidsAfterStop.join(', ')}), so it did not merely refuse to die.
|
|
1116
|
-
Signalling the process
|
|
1516
|
+
Signalling the process cannot win that race. Stop the service itself,
|
|
1117
1517
|
then re-run the install:
|
|
1118
1518
|
${serviceStopCommand()}
|
|
1119
1519
|
`);
|
|
@@ -1122,13 +1522,39 @@ then re-run the install:
|
|
|
1122
1522
|
console.error(`
|
|
1123
1523
|
Error: could not stop the running apra-fleet server (it is still running after
|
|
1124
1524
|
SIGTERM and a SIGKILL escalation). Stop it manually before installing:
|
|
1125
|
-
${
|
|
1525
|
+
${manualStopHint(pidsAfterStop)}
|
|
1126
1526
|
`);
|
|
1127
1527
|
process.exit(1);
|
|
1128
1528
|
}
|
|
1129
|
-
|
|
1529
|
+
// The stop reported a pid it would not force-kill: do not claim it stopped --
|
|
1530
|
+
// but only say it is still running if a candidate pid actually is. It may
|
|
1531
|
+
// have exited while waiting for the service stop, in which case the normal
|
|
1532
|
+
// message is the truthful one.
|
|
1533
|
+
let stillRunningWho = null;
|
|
1534
|
+
if (guardStopLeftRunning) {
|
|
1535
|
+
const { readServerInfoPid } = await import('../services/singleton.js');
|
|
1536
|
+
const leftPid = readServerInfoPid();
|
|
1537
|
+
const candidates = [...(leftPid !== undefined ? [String(leftPid)] : []), ...pidsBeforeStop]
|
|
1538
|
+
.filter((pid, i, all) => all.indexOf(pid) === i)
|
|
1539
|
+
.filter(pid => isPidAlive(Number(pid)));
|
|
1540
|
+
if (candidates.length > 0)
|
|
1541
|
+
stillRunningWho = `pid ${candidates.join(', ')}`;
|
|
1542
|
+
}
|
|
1543
|
+
if (stillRunningWho) {
|
|
1544
|
+
console.warn(` The server ${stillRunningWho} is still running: it did not exit after the stop request and could not be verified as an apra-fleet process, so it was not force-killed. Install continues without stopping it; check ${stillRunningWho} yourself.`);
|
|
1545
|
+
}
|
|
1546
|
+
else {
|
|
1547
|
+
console.log(pidsBeforeStop.length > 0 || guardStoppedService
|
|
1548
|
+
? ' Stopped running server.'
|
|
1549
|
+
: ' No running server process of this install was found to stop.');
|
|
1550
|
+
}
|
|
1130
1551
|
}
|
|
1131
1552
|
console.log(`\nInstalling Apra Fleet ${serverVersion} for ${paths.name}...\n`);
|
|
1553
|
+
// Installing is an explicit (re)start intent: end a previous 'apra-fleet stop'.
|
|
1554
|
+
{
|
|
1555
|
+
const { clearStoppedMarker } = await import('../services/stopped-marker.js');
|
|
1556
|
+
clearStoppedMarker();
|
|
1557
|
+
}
|
|
1132
1558
|
// --- Step 1: Copy binary ---
|
|
1133
1559
|
let binaryPath = '';
|
|
1134
1560
|
if (isSea()) {
|
|
@@ -1156,14 +1582,29 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1156
1582
|
// the exact restart command is printed, so a failure at any later step stays
|
|
1157
1583
|
// recoverable by hand.
|
|
1158
1584
|
if (guardStoppedService && guardServiceMgr) {
|
|
1159
|
-
|
|
1585
|
+
if (serviceStep) {
|
|
1586
|
+
console.log(` The registered service was stopped by --force; the final install step re-registers and starts it. (Only if a later step fails, restart it with: ${serviceRestartCommand()})`);
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
console.log(` The registered service was stopped by --force; restarting it now. (If that fails -- Restart command: ${serviceRestartCommand()})`);
|
|
1590
|
+
}
|
|
1160
1591
|
if (!serviceStep) {
|
|
1161
1592
|
try {
|
|
1162
1593
|
await guardServiceMgr.start();
|
|
1594
|
+
guardRestartedService = true;
|
|
1163
1595
|
console.log(' Restarted the registered service.');
|
|
1164
1596
|
}
|
|
1165
1597
|
catch (err) {
|
|
1166
1598
|
console.warn(` [WARN] Could not restart the registered service: ${err.message}`);
|
|
1599
|
+
// No service step ran, so nothing else prints the legacy-task guidance
|
|
1600
|
+
// (the install-reason stop suppressed it): print it once here.
|
|
1601
|
+
let guidance = null;
|
|
1602
|
+
try {
|
|
1603
|
+
guidance = guardServiceMgr.legacyGuidance?.() ?? null;
|
|
1604
|
+
}
|
|
1605
|
+
catch { /* generic warning stands */ }
|
|
1606
|
+
if (guidance)
|
|
1607
|
+
console.warn(guidance);
|
|
1167
1608
|
}
|
|
1168
1609
|
}
|
|
1169
1610
|
}
|
|
@@ -1189,13 +1630,42 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1189
1630
|
}
|
|
1190
1631
|
}
|
|
1191
1632
|
// --- Step 4: Configure hooks + statusline in settings.json ---
|
|
1633
|
+
let claudeModResult = null;
|
|
1192
1634
|
console.log(` [4/${totalSteps}] Configuring ${paths.name} settings...`);
|
|
1193
1635
|
// OpenCode has a strict config schema -- hooks/statusLine/defaultModel are not valid keys
|
|
1194
|
-
if (
|
|
1636
|
+
if (memberMode) {
|
|
1637
|
+
console.log(' Skipped (--member): user-scope settings are left untouched.');
|
|
1638
|
+
}
|
|
1639
|
+
else if (llm !== 'opencode') {
|
|
1195
1640
|
const installedHooksConfig = JSON.parse(fs.readFileSync(path.join(HOOKS_DIR, 'hooks-config.json'), 'utf-8'));
|
|
1196
1641
|
mergeHooksConfig(paths, installedHooksConfig, llm);
|
|
1197
|
-
|
|
1198
|
-
|
|
1642
|
+
// Claude: install the fleet-status mod (status line entry + /fleet-status
|
|
1643
|
+
// pane). Only when it installed does the statusLine script go away (and
|
|
1644
|
+
// only apra-fleet's own entry); otherwise today's statusLine stays.
|
|
1645
|
+
// Runs before configureStatusline and between the settings writes: the
|
|
1646
|
+
// claude CLI edits the same settings.json, and every helper re-reads it.
|
|
1647
|
+
if (llm === 'claude' && claudeModStepEnabled()) {
|
|
1648
|
+
let modFiles = [];
|
|
1649
|
+
try {
|
|
1650
|
+
modFiles = claudeModFiles(manifest);
|
|
1651
|
+
}
|
|
1652
|
+
catch { /* unreadable asset -> reported as not packaged */ }
|
|
1653
|
+
claudeModResult = installClaudeMod(modFiles, { alreadyRegistered: claudeModRegistered(paths) });
|
|
1654
|
+
}
|
|
1655
|
+
if (claudeModResult?.status === 'installed') {
|
|
1656
|
+
if (removeApraFleetStatusLine(paths)) {
|
|
1657
|
+
console.log(' Removed the apra-fleet statusLine entry (the fleet-status mod replaces it).');
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
else {
|
|
1661
|
+
if (claudeModResult?.status === 'skipped') {
|
|
1662
|
+
console.log(` fleet-status mod not installed: ${claudeModResult.reason} -- keeping the statusLine script.`);
|
|
1663
|
+
}
|
|
1664
|
+
const statuslineScript = path.join(SCRIPTS_DIR, 'fleet-statusline.sh');
|
|
1665
|
+
if (configureStatusline(paths, statuslineScript, llm) === 'kept-foreign') {
|
|
1666
|
+
console.log(` Kept your existing statusLine in ${paths.settingsFile} (not apra-fleet's; left unchanged).`);
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1199
1669
|
const standardModel = PROVIDER_STANDARD_MODELS[llm] ?? PROVIDER_STANDARD_MODELS['claude'];
|
|
1200
1670
|
writeDefaultModel(paths, standardModel);
|
|
1201
1671
|
}
|
|
@@ -1203,33 +1673,61 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1203
1673
|
console.log(` [5/${totalSteps}] Registering MCP server...`);
|
|
1204
1674
|
const fleetPort = DEFAULT_PORT;
|
|
1205
1675
|
const fleetUrl = `http://localhost:${fleetPort}/mcp`;
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1676
|
+
// The server refuses an /mcp session without this install's access secret
|
|
1677
|
+
// (an owner-only file in its data dir), so every http registration carries
|
|
1678
|
+
// it as a header. Re-running install rewrites existing registrations.
|
|
1679
|
+
const secretExisted = readMemberAccessSecret() !== null;
|
|
1680
|
+
const fleetAccessHeaders = { [MEMBER_SECRET_HEADER]: getOrCreateMemberAccessSecret() };
|
|
1681
|
+
// Open LLM CLI sessions keep the MCP config they started with; a new secret
|
|
1682
|
+
// or a rewritten registration needs them restarted (reported at the end).
|
|
1683
|
+
// stdio registrations are not gated by the secret.
|
|
1684
|
+
let registrationChanged = !secretExisted && transport === 'http';
|
|
1685
|
+
if (memberMode) {
|
|
1686
|
+
// The per-folder member entry is written by compose_permissions; a member
|
|
1687
|
+
// install must never register apra-fleet in any provider's user-scope config.
|
|
1688
|
+
console.log(' Skipped (--member): no user-scope MCP registration.');
|
|
1689
|
+
}
|
|
1690
|
+
else if (transport === 'http') {
|
|
1691
|
+
const before = mcpRegistrationSnapshot(llm, paths);
|
|
1692
|
+
registerHttpMcp(llm, paths, fleetUrl, fleetAccessHeaders);
|
|
1693
|
+
if (mcpRegistrationSnapshot(llm, paths) !== before)
|
|
1694
|
+
registrationChanged = true;
|
|
1695
|
+
// Upgrade path: every OTHER provider this install registered earlier holds a
|
|
1696
|
+
// header-less http entry the server now refuses; rewrite those too. Each
|
|
1697
|
+
// provider keeps its own transport: a stdio entry (its own server process,
|
|
1698
|
+
// not gated by the access secret) is left untouched, and a provider with
|
|
1699
|
+
// no apra-fleet entry is not given one by another provider's install.
|
|
1700
|
+
for (const other of Object.keys(readInstallConfig().providers)) {
|
|
1701
|
+
if (other === llm || !INSTALLABLE_LLM_PROVIDERS.includes(other))
|
|
1702
|
+
continue;
|
|
1703
|
+
try {
|
|
1704
|
+
const otherPaths = getProviderInstallConfig(other);
|
|
1705
|
+
const existing = registeredMcpTransport(other, otherPaths);
|
|
1706
|
+
if (existing !== 'http') {
|
|
1707
|
+
console.log(` ${other}: ${existing === 'stdio' ? 'stdio registration kept as is' : 'no apra-fleet registration, skipped'}`);
|
|
1708
|
+
continue;
|
|
1217
1709
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1710
|
+
const otherBefore = mcpRegistrationSnapshot(other, otherPaths);
|
|
1711
|
+
registerHttpMcp(other, otherPaths, fleetUrl, fleetAccessHeaders);
|
|
1712
|
+
if (mcpRegistrationSnapshot(other, otherPaths) !== otherBefore)
|
|
1713
|
+
registrationChanged = true;
|
|
1714
|
+
}
|
|
1715
|
+
catch (err) {
|
|
1716
|
+
console.warn(` [!] could not refresh the ${other} MCP registration with the access secret: ${err instanceof Error ? err.message : String(err)}`);
|
|
1220
1717
|
}
|
|
1221
1718
|
}
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1719
|
+
// Claude LOCAL-scope entries for this URL (e.g. an older `claude mcp add
|
|
1720
|
+
// apra-fleet` without --scope) win over the user-scope entry and stay
|
|
1721
|
+
// header-less: rewrite them with the secret too.
|
|
1722
|
+
try {
|
|
1723
|
+
const rewritten = refreshClaudeLocalScopeEntries(claudeUserConfigPath(), fleetUrl, fleetAccessHeaders);
|
|
1724
|
+
for (const project of rewritten)
|
|
1725
|
+
console.log(` claude: local-scope apra-fleet entry for ${project} rewritten with the access secret`);
|
|
1726
|
+
if (rewritten.length)
|
|
1727
|
+
registrationChanged = true;
|
|
1230
1728
|
}
|
|
1231
|
-
|
|
1232
|
-
|
|
1729
|
+
catch (err) {
|
|
1730
|
+
console.warn(` [!] could not refresh claude local-scope apra-fleet entries: ${err instanceof Error ? err.message : String(err)}`);
|
|
1233
1731
|
}
|
|
1234
1732
|
}
|
|
1235
1733
|
else {
|
|
@@ -1556,28 +2054,22 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1556
2054
|
}
|
|
1557
2055
|
}
|
|
1558
2056
|
// --- Beads install step ---
|
|
1559
|
-
//
|
|
1560
|
-
//
|
|
2057
|
+
// PATH first, then BIN_DIR, then npm -g, then a user-level install into
|
|
2058
|
+
// BIN_DIR (see beads-install.ts). NON-FATAL like dolt, but LOUD: a member
|
|
2059
|
+
// without bd cannot run sprint work, so the reason and the fix are printed
|
|
2060
|
+
// and repeated in the summary.
|
|
1561
2061
|
// KB + code intelligence is the final step (before the optional service step),
|
|
1562
2062
|
// so Beads sits one slot earlier than it does on main.
|
|
1563
2063
|
const beadsStep = serviceStep ? totalSteps - 2 : totalSteps - 1;
|
|
1564
2064
|
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
|
-
}
|
|
2065
|
+
const beadsResult = installBeads(BIN_DIR, beadsStepDeps());
|
|
2066
|
+
if (beadsResult.state === 'installed' && beadsResult.location === 'bin-dir') {
|
|
2067
|
+
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
2068
|
}
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
console.warn(
|
|
2069
|
+
else if (beadsResult.state === 'missing') {
|
|
2070
|
+
console.warn(` [!] Beads (bd) NOT installed: ${beadsResult.reason}`);
|
|
2071
|
+
console.warn(` [!] Fix: ${beadsResult.fix}`);
|
|
2072
|
+
console.warn(' - Beads install skipped - sprint work on this machine needs bd and will fail until it is installed');
|
|
1581
2073
|
}
|
|
1582
2074
|
// --- KB + code intelligence setup step ---
|
|
1583
2075
|
// Only runs when the installer is invoked from inside a git repository.
|
|
@@ -1598,7 +2090,7 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1598
2090
|
}
|
|
1599
2091
|
}
|
|
1600
2092
|
catch (err) {
|
|
1601
|
-
console.warn('
|
|
2093
|
+
console.warn(' [!] .mcp.json cleanup skipped:', err instanceof Error ? err.message : String(err));
|
|
1602
2094
|
}
|
|
1603
2095
|
}
|
|
1604
2096
|
else {
|
|
@@ -1617,26 +2109,33 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1617
2109
|
console.log(' [OK] Code intelligence provider config written');
|
|
1618
2110
|
}
|
|
1619
2111
|
catch (err) {
|
|
1620
|
-
console.warn('
|
|
2112
|
+
console.warn(' [!] Code intelligence config skipped:', err instanceof Error ? err.message : String(err));
|
|
1621
2113
|
}
|
|
2114
|
+
// Code intelligence runs through npx: warn now (inside this step, no new
|
|
2115
|
+
// numbered step) when node/npx cannot be resolved from the installer PATH.
|
|
2116
|
+
const codeIntelPathWarn = codeIntelPathWarning();
|
|
2117
|
+
if (codeIntelPathWarn)
|
|
2118
|
+
console.warn(` [!] ${codeIntelPathWarn}`);
|
|
1622
2119
|
// Write code intelligence routing instruction to ~/.claude/CLAUDE.md
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
fs.
|
|
1630
|
-
|
|
1631
|
-
|
|
2120
|
+
// (never for a --member install: that file belongs to the member's user)
|
|
2121
|
+
if (!memberMode)
|
|
2122
|
+
try {
|
|
2123
|
+
const claudeMdPath = path.join(os.homedir(), '.claude', 'CLAUDE.md');
|
|
2124
|
+
const sentinel = '<!-- apra-fleet:code-intelligence -->';
|
|
2125
|
+
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`;
|
|
2126
|
+
const existing = fs.existsSync(claudeMdPath) ? fs.readFileSync(claudeMdPath, 'utf-8') : '';
|
|
2127
|
+
if (!existing.includes(sentinel)) {
|
|
2128
|
+
fs.mkdirSync(path.dirname(claudeMdPath), { recursive: true });
|
|
2129
|
+
fs.appendFileSync(claudeMdPath, block);
|
|
2130
|
+
console.log(' [OK] Code intelligence routing instruction written to ~/.claude/CLAUDE.md');
|
|
2131
|
+
}
|
|
2132
|
+
}
|
|
2133
|
+
catch (err) {
|
|
2134
|
+
console.warn(' [!] ~/.claude/CLAUDE.md update skipped:', err instanceof Error ? err.message : String(err));
|
|
1632
2135
|
}
|
|
1633
|
-
}
|
|
1634
|
-
catch (err) {
|
|
1635
|
-
console.warn(' ⚠ ~/.claude/CLAUDE.md update skipped:', err instanceof Error ? err.message : String(err));
|
|
1636
|
-
}
|
|
1637
2136
|
// OpenCode uses --dangerously-skip-permissions and per-agent permission: frontmatter;
|
|
1638
2137
|
// a top-level "permissions" key is invalid in opencode.json
|
|
1639
|
-
if (llm !== 'opencode') {
|
|
2138
|
+
if (llm !== 'opencode' && !memberMode) {
|
|
1640
2139
|
const extraPerms = (llm === 'claude' && installPm)
|
|
1641
2140
|
? ['Bash(*)', 'Skill(auto-sprint)', 'Workflow(auto-sprint)']
|
|
1642
2141
|
: [];
|
|
@@ -1644,19 +2143,97 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1644
2143
|
}
|
|
1645
2144
|
// Write install-config.json (merge provider entry)
|
|
1646
2145
|
writeInstallConfig(llm, skillMode, workflowsMode);
|
|
2146
|
+
// The fleet owns this install from here on: record the marker BEFORE the
|
|
2147
|
+
// auto-start registration, which can fail. A failed auto-start still exits
|
|
2148
|
+
// non-zero (E-MEMBER-AUTOSTART) but leaves the marker, so the next fleet_install
|
|
2149
|
+
// "auto" recognises its own half-finished install and retries.
|
|
2150
|
+
if (memberMode)
|
|
2151
|
+
writeMemberInstallMarker(serverVersion, memberPort);
|
|
2152
|
+
// A full install records its port (or clears the record) the same way, so
|
|
2153
|
+
// start / service launch / logon autostart bind what the MCP registration says.
|
|
2154
|
+
else
|
|
2155
|
+
recordFullInstallPort(serverVersion);
|
|
2156
|
+
// Every install holds a member access secret (owner-only, in its data dir):
|
|
2157
|
+
// its server accepts a ?member= session only with it, so another local
|
|
2158
|
+
// user's session cannot use this install. Created once, kept on reinstall
|
|
2159
|
+
// (sessions configured with it keep working). Best effort here -- the server
|
|
2160
|
+
// creates it at start too.
|
|
2161
|
+
try {
|
|
2162
|
+
const { getOrCreateMemberAccessSecret, memberAccessSecretPath } = await import('../services/member-access-secret.js');
|
|
2163
|
+
getOrCreateMemberAccessSecret(memberAccessSecretPath(getInstallDataDir()));
|
|
2164
|
+
}
|
|
2165
|
+
catch (err) {
|
|
2166
|
+
console.warn(' [!] member access secret not created:', err instanceof Error ? err.message : String(err));
|
|
2167
|
+
}
|
|
2168
|
+
// Windows: make the data dir and the secret owner-only NOW, and say so
|
|
2169
|
+
// loudly when icacls fails (the server only logs it). POSIX keeps its
|
|
2170
|
+
// chmod path (0600 file mode, 0700 dirs at server start).
|
|
2171
|
+
if (process.platform === 'win32') {
|
|
2172
|
+
try {
|
|
2173
|
+
const { ownerOnlyInstallWarnings } = await import('../utils/owner-only-fs.js');
|
|
2174
|
+
const { memberAccessSecretPath } = await import('../services/member-access-secret.js');
|
|
2175
|
+
const dataDir = getInstallDataDir();
|
|
2176
|
+
for (const line of ownerOnlyInstallWarnings([{ path: dataDir, kind: 'dir' }, { path: memberAccessSecretPath(dataDir), kind: 'file' }])) {
|
|
2177
|
+
console.warn(line);
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
catch (err) {
|
|
2181
|
+
console.warn(' [!] owner-only permissions not checked:', err instanceof Error ? err.message : String(err));
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
1647
2184
|
// --- Step N: Register and start service (SEA + HTTP mode only) ---
|
|
1648
2185
|
let serviceRegistered = false;
|
|
2186
|
+
let serviceHealthy = null;
|
|
1649
2187
|
let serviceReused = false;
|
|
2188
|
+
let serviceRunKey = false;
|
|
1650
2189
|
if (serviceStep) {
|
|
1651
2190
|
console.log(` [${totalSteps}/${totalSteps}] Registering and starting service...`);
|
|
2191
|
+
// The server refuses to start when its configured port is taken (no
|
|
2192
|
+
// random-port fallback, GitHub #584) -- say so here rather than leaving a
|
|
2193
|
+
// service that exits on every launch with the reason only in the log.
|
|
2194
|
+
{
|
|
2195
|
+
const { checkRunningInstance, isPortInUse, portInUseMessage, readServerInfoPid } = await import('../services/singleton.js');
|
|
2196
|
+
const probe = await checkRunningInstance();
|
|
2197
|
+
const serverPort = resolveServerPort();
|
|
2198
|
+
if (probe.state === 'gone' && await isPortInUse(serverPort, DEFAULT_HOST)) {
|
|
2199
|
+
const { findPortHolder, describePortConflict } = await import('../services/port-holder.js');
|
|
2200
|
+
const conflict = describePortConflict(serverPort, portInUseMessage(serverPort, readServerInfoPid()), await findPortHolder(serverPort), memberMode ? 'member' : 'full');
|
|
2201
|
+
// Another user's process holds this install's port (a second member
|
|
2202
|
+
// install on this host): the server can never start here, so fail
|
|
2203
|
+
// now with who holds it and the remedy, not after a dead service.
|
|
2204
|
+
if (conflict.foreign) {
|
|
2205
|
+
console.error(`
|
|
2206
|
+
Error: ${conflict.message}
|
|
2207
|
+
`);
|
|
2208
|
+
// The registrations are already rewritten: keep the restart notice
|
|
2209
|
+
// pending (never shown inline on this exit) for the next verb.
|
|
2210
|
+
recordAccessRestartNotice(registrationChanged && !memberMode, false);
|
|
2211
|
+
process.exitCode = 1;
|
|
2212
|
+
return;
|
|
2213
|
+
}
|
|
2214
|
+
console.warn(` Warning: ${conflict.message}`);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
1652
2217
|
const svcMgr = await getServiceManager();
|
|
1653
2218
|
try {
|
|
1654
|
-
|
|
2219
|
+
const registered = await svcMgr.register(binaryPath, ['--transport', 'http'], LOG_FILE_PATH);
|
|
2220
|
+
serviceReused = registered === 'reused';
|
|
2221
|
+
serviceRunKey = registered === 'run-key';
|
|
1655
2222
|
if (serviceReused)
|
|
1656
2223
|
console.log(' Could not recreate the service task -- existing task reused.');
|
|
2224
|
+
if (serviceRunKey) {
|
|
2225
|
+
console.log(' Could not create the scheduled task -- registered a per-user logon entry (HKCU Run) instead.');
|
|
2226
|
+
console.log(' This starts the server at logon but does NOT restart it if it stops; use apra-fleet start.');
|
|
2227
|
+
}
|
|
1657
2228
|
try {
|
|
1658
2229
|
await svcMgr.start();
|
|
1659
2230
|
serviceRegistered = true;
|
|
2231
|
+
// Never report "running" on the strength of the start call alone (a
|
|
2232
|
+
// launcher that cannot run, a refused port, a crash): ask /health.
|
|
2233
|
+
serviceHealthy = await waitForServiceHealth();
|
|
2234
|
+
if (serviceHealthy === false) {
|
|
2235
|
+
console.warn(` Service registered, but the server is not answering /health. Check ${LOG_FILE_PATH} and run apra-fleet status.`);
|
|
2236
|
+
}
|
|
1660
2237
|
}
|
|
1661
2238
|
catch (startErr) {
|
|
1662
2239
|
// Never delete a reused task: it predates this install (e.g. elevated).
|
|
@@ -1671,43 +2248,84 @@ ${process.platform === 'win32' ? ' taskkill /F /IM apra-fleet.exe' : ' pki
|
|
|
1671
2248
|
}
|
|
1672
2249
|
catch (err) {
|
|
1673
2250
|
console.warn(` Service registration skipped: ${err.message}`);
|
|
2251
|
+
// A member install exists to leave an auto-starting server behind; without
|
|
2252
|
+
// the auto-start it is not a success, so say so with a typed status.
|
|
2253
|
+
if (memberMode) {
|
|
2254
|
+
console.error(`
|
|
2255
|
+
Error: E-MEMBER-AUTOSTART: the member install could not register the user-mode
|
|
2256
|
+
auto-start (${err.message}). The server binary is installed but will
|
|
2257
|
+
not start automatically.
|
|
2258
|
+
`);
|
|
2259
|
+
process.exitCode = 1;
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
1674
2262
|
// --force stopped the server; reporting success would leave it down silently.
|
|
1675
2263
|
if (force && (runningScope?.relevant || guardStoppedService)) {
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
2264
|
+
// A reused legacy (e.g. elevated) task refused the start; 'apra-fleet start'
|
|
2265
|
+
// hits the same refusal, so give the upgrade guidance instead.
|
|
2266
|
+
let legacyHint = null;
|
|
2267
|
+
if (serviceReused) {
|
|
2268
|
+
try {
|
|
2269
|
+
legacyHint = svcMgr.legacyGuidance?.() ?? null;
|
|
2270
|
+
}
|
|
2271
|
+
catch { /* keep the generic hint */ }
|
|
2272
|
+
}
|
|
2273
|
+
// register() already printed the full guidance for a reused legacy task:
|
|
2274
|
+
// point at it instead of repeating it, so it appears once per install.
|
|
2275
|
+
const alreadyShown = legacyHint !== null && (svcMgr.legacyGuidanceShown?.() ?? false);
|
|
2276
|
+
const restartHint = alreadyShown ? 'The task could not be started; follow the steps printed above for the existing scheduled task, then re-run install --force.'
|
|
2277
|
+
: legacyHint ? legacyHint
|
|
2278
|
+
: guardStoppedService
|
|
2279
|
+
? `Start it with:\n ${serviceRestartCommand()}\nthen run 'apra-fleet status' for how to repair the service (apra-fleet never needs an elevated install).`
|
|
2280
|
+
: 'Start it with:\n apra-fleet start';
|
|
1679
2281
|
console.error(`
|
|
1680
2282
|
Error: install --force stopped the running apra-fleet server, but the service
|
|
1681
2283
|
could not be registered/started, so the server is NOT running.
|
|
1682
2284
|
${restartHint}
|
|
1683
2285
|
`);
|
|
2286
|
+
// After register() (which may clear a stale notice): the registrations
|
|
2287
|
+
// changed, so the restart notice must survive this exit. Not shown
|
|
2288
|
+
// inline here, so it stays pending for the next status/start/update.
|
|
2289
|
+
recordAccessRestartNotice(registrationChanged && !memberMode, false);
|
|
1684
2290
|
process.exit(1);
|
|
1685
2291
|
}
|
|
1686
2292
|
}
|
|
1687
2293
|
}
|
|
1688
2294
|
// --- Done ---
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
catch {
|
|
1695
|
-
beadsVersion = 'not available';
|
|
1696
|
-
}
|
|
2295
|
+
if (!memberMode)
|
|
2296
|
+
clearMemberInstallMarker();
|
|
2297
|
+
const beadsVersion = beadsResult.state === 'missing'
|
|
2298
|
+
? `not available -- ${beadsResult.reason}. Fix: ${beadsResult.fix}`
|
|
2299
|
+
: `${beadsResult.version}${beadsResult.location === 'bin-dir' ? ` (${beadsResult.binPath})` : ''}`;
|
|
1697
2300
|
const clientName = llm === 'claude' ? 'Claude Code' : paths.name;
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
const
|
|
2301
|
+
// A member install touched no user-scope settings or MCP registration, so it
|
|
2302
|
+
// names only what it did and the member's one next step (on the orchestrator).
|
|
2303
|
+
const instructions = memberMode
|
|
2304
|
+
? MEMBER_INSTALL_NEXT_STEP
|
|
2305
|
+
: llm === 'claude' ? 'Run /mcp in Claude Code to load the server.' : `Restart ${paths.name} to load the server.`;
|
|
2306
|
+
const forceNote = force && !memberMode ? `\nRestart ${clientName} to reload the MCP server.` : '';
|
|
2307
|
+
const accessNote = registrationChanged && !memberMode ? `
|
|
2308
|
+
${ACCESS_RESTART_NOTE}` : '';
|
|
2309
|
+
// apra-fleet update runs install detached with stdio ignored, so the note above
|
|
2310
|
+
// never reaches that user: persist it for the next status/start/update.
|
|
2311
|
+
recordAccessRestartNotice(registrationChanged && !memberMode, Boolean(process.stdout.isTTY));
|
|
2312
|
+
const settingsLine = memberMode ? '' : `\n Settings: ${paths.settingsFile}`;
|
|
2313
|
+
const serviceState = serviceHealthy === true ? 'registered and running' : serviceHealthy === false ? 'registered, but NOT answering /health (see the warning above)' : 'registered (health not checked)';
|
|
2314
|
+
const claudeModLine = claudeModResult
|
|
2315
|
+
? `\n Claude mod: fleet-status ${claudeModResult.status === 'installed' ? `installed (${claudeModResult.dir}${claudeModResult.note ? `; ${claudeModResult.note}` : ''})` : `skipped: ${claudeModResult.reason}`}`
|
|
2316
|
+
: '';
|
|
2317
|
+
const serviceLine = !serviceStep && guardStoppedService
|
|
2318
|
+
? `\n Service: ${guardRestartedService ? 'restarted after --force stop' : 'NOT restarted (see the warning above; start it with ' + serviceRestartCommand() + ')'}`
|
|
2319
|
+
: serviceStep ? `\n Service: ${serviceRegistered ? `${serviceState}${serviceReused ? ' (existing task reused)' : ''}${serviceRunKey ? ' (logon autostart via HKCU Run, no automatic restart)' : ''}` : 'registration skipped'}` : '';
|
|
1701
2320
|
console.log(`
|
|
1702
2321
|
Apra Fleet ${serverVersion} installed successfully for ${paths.name}.
|
|
1703
2322
|
Binary: ${BIN_DIR}
|
|
1704
2323
|
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}` : ''}
|
|
2324
|
+
Scripts: ${SCRIPTS_DIR}${settingsLine}${installFleet ? `\n Fleet Skill: ${paths.fleetSkillsDir}` : ''}${installPm ? `\n PM Skill: ${paths.skillsDir}` : ''}${installAgents ? `\n Agents: ${paths.agentsDir}` : ''}
|
|
1707
2325
|
Beads: ${beadsVersion}
|
|
1708
|
-
Dolt: ${doltVersion}${serviceLine}
|
|
2326
|
+
Dolt: ${doltVersion}${claudeModLine}${serviceLine}
|
|
1709
2327
|
|
|
1710
|
-
${instructions}${forceNote}
|
|
2328
|
+
${instructions}${forceNote}${accessNote}
|
|
1711
2329
|
`);
|
|
1712
2330
|
if (llm === 'claude' && installPm) {
|
|
1713
2331
|
console.log(' /auto-sprint BD-1 (native workflow, current branch)');
|