@apralabs/apra-fleet 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -30
- package/dist/agents/backlog-groomer.md +75 -27
- package/dist/agents/ci-watcher.md +37 -22
- package/dist/agents/deployer.md +39 -22
- package/dist/agents/doer.md +74 -40
- package/dist/agents/harvester.md +49 -40
- package/dist/agents/integ-test-runner.md +40 -23
- package/dist/agents/kb-reconciler.md +28 -7
- package/dist/agents/plan-reviewer.md +49 -24
- package/dist/agents/planner.md +66 -43
- package/dist/agents/regression-test-runner.md +101 -78
- package/dist/agents/reviewer.md +117 -56
- package/dist/agents/schemas/backlog-groomer-output.json +1 -1
- package/dist/agents/schemas/doer-output.json +32 -0
- package/dist/agents/schemas/harvester-input.json +1 -5
- package/dist/agents/schemas/planner-output.json +1 -1
- package/dist/agents/schemas/regression-test-runner-output.json +41 -7
- package/dist/agents/schemas/reviewer-output.json +62 -3
- package/dist/cli/agent-transform.d.ts +7 -0
- package/dist/cli/agent-transform.js +46 -1
- package/dist/cli/auth.d.ts +1 -0
- package/dist/cli/auth.js +38 -8
- package/dist/cli/beads-install.d.ts +35 -0
- package/dist/cli/beads-install.js +125 -0
- package/dist/cli/beads-pin.d.ts +5 -0
- package/dist/cli/beads-pin.js +27 -0
- package/dist/cli/call.d.ts +27 -0
- package/dist/cli/call.js +177 -0
- package/dist/cli/config.d.ts +24 -1
- package/dist/cli/config.js +69 -2
- package/dist/cli/dolt-install.d.ts +18 -2
- package/dist/cli/dolt-install.js +46 -15
- package/dist/cli/fleet-se-guard.d.ts +51 -0
- package/dist/cli/fleet-se-guard.js +215 -0
- package/dist/cli/install-guard.d.ts +54 -0
- package/dist/cli/install-guard.js +132 -4
- package/dist/cli/install.d.ts +77 -21
- package/dist/cli/install.js +610 -152
- package/dist/cli/kb-commit.d.ts +2 -1
- package/dist/cli/kb-commit.js +1 -1
- package/dist/cli/kb-import.d.ts +2 -1
- package/dist/cli/kb-import.js +1 -1
- package/dist/cli/register-member.js +20 -3
- package/dist/cli/remove-member.d.ts +4 -0
- package/dist/cli/remove-member.js +63 -0
- package/dist/cli/secret.js +9 -0
- package/dist/cli/start.js +59 -4
- package/dist/cli/status.d.ts +3 -0
- package/dist/cli/status.js +45 -12
- package/dist/cli/stop.js +64 -9
- package/dist/cli/uninstall.js +101 -15
- package/dist/cli/update.js +33 -2
- package/dist/cli/watch.js +1 -1
- package/dist/cli/workflow.js +3 -2
- package/dist/commands/kb-server.js +9 -2
- package/dist/hub-service/http-server.d.ts +5 -1
- package/dist/hub-service/http-server.js +55 -5
- package/dist/index.js +155 -8
- package/dist/os/child-env-bound.d.ts +77 -0
- package/dist/os/child-env-bound.js +171 -0
- package/dist/os/linux.d.ts +7 -2
- package/dist/os/linux.js +40 -14
- package/dist/os/macos.d.ts +1 -1
- package/dist/os/macos.js +2 -11
- package/dist/os/os-commands.d.ts +17 -2
- package/dist/os/windows-gitbash.d.ts +1 -0
- package/dist/os/windows-gitbash.js +17 -3
- package/dist/os/windows-wrapper.d.ts +0 -4
- package/dist/os/windows-wrapper.js +2 -1
- package/dist/os/windows.d.ts +5 -2
- package/dist/os/windows.js +75 -29
- package/dist/paths.d.ts +21 -0
- package/dist/paths.js +35 -0
- package/dist/providers/agy.d.ts +6 -2
- package/dist/providers/agy.js +245 -106
- package/dist/providers/claude-permission-denial.d.ts +7 -0
- package/dist/providers/claude-permission-denial.js +137 -0
- package/dist/providers/claude.d.ts +86 -38
- package/dist/providers/claude.js +426 -164
- package/dist/providers/codex.js +5 -1
- package/dist/providers/copilot.js +5 -1
- package/dist/providers/opencode.d.ts +10 -2
- package/dist/providers/opencode.js +114 -53
- package/dist/providers/provider.d.ts +171 -33
- package/dist/providers/provider.js +164 -3
- package/dist/services/agent-provisioner.d.ts +29 -0
- package/dist/services/agent-provisioner.js +107 -0
- package/dist/services/agent-shadow.d.ts +96 -0
- package/dist/services/agent-shadow.js +479 -0
- package/dist/services/agy-project.d.ts +2 -1
- package/dist/services/agy-project.js +15 -17
- package/dist/services/auth-socket.d.ts +25 -0
- package/dist/services/auth-socket.js +68 -23
- package/dist/services/auth-web.js +1 -1
- package/dist/services/budget-awareness.d.ts +11 -11
- package/dist/services/budget-awareness.js +15 -3
- package/dist/services/claude-local-scope-mcp.d.ts +19 -0
- package/dist/services/claude-local-scope-mcp.js +91 -0
- package/dist/services/cloud/aws.js +2 -1
- package/dist/services/cloud/lifecycle.js +19 -2
- package/dist/services/cloud/task-wrapper.d.ts +0 -9
- package/dist/services/cloud/task-wrapper.js +15 -6
- package/dist/services/event-loop-watchdog.d.ts +32 -0
- package/dist/services/event-loop-watchdog.js +140 -0
- package/dist/services/http-transport.d.ts +49 -1
- package/dist/services/http-transport.js +190 -24
- package/dist/services/in-flight-agents.d.ts +2 -0
- package/dist/services/in-flight-agents.js +4 -0
- package/dist/services/knowledge/bible-basis-filter.d.ts +53 -0
- package/dist/services/knowledge/bible-basis-filter.js +134 -0
- package/dist/services/knowledge/bible-blob-id.d.ts +44 -0
- package/dist/services/knowledge/bible-blob-id.js +113 -0
- package/dist/services/knowledge/bible-import.d.ts +65 -0
- package/dist/services/knowledge/bible-import.js +211 -0
- package/dist/services/knowledge/file-hash.d.ts +31 -0
- package/dist/services/knowledge/file-hash.js +153 -23
- package/dist/services/knowledge/http-provider.d.ts +4 -3
- package/dist/services/knowledge/http-provider.js +17 -5
- package/dist/services/knowledge/kb-maintainer-grant.d.ts +15 -0
- package/dist/services/knowledge/kb-maintainer-grant.js +34 -0
- package/dist/services/knowledge/kb-providers.d.ts +4 -0
- package/dist/services/knowledge/kb-providers.js +8 -0
- package/dist/services/knowledge/kb-removed-scope-keys.d.ts +28 -0
- package/dist/services/knowledge/kb-removed-scope-keys.js +59 -0
- package/dist/services/knowledge/kb-scopes.d.ts +14 -0
- package/dist/services/knowledge/kb-scopes.js +47 -0
- package/dist/services/knowledge/kb-self.d.ts +91 -0
- package/dist/services/knowledge/kb-self.js +198 -0
- package/dist/services/knowledge/member-bible-view.d.ts +21 -0
- package/dist/services/knowledge/member-bible-view.js +194 -0
- package/dist/services/knowledge/pre-init.js +1 -0
- package/dist/services/knowledge/project-slug.js +2 -2
- package/dist/services/knowledge/sqlite-provider.d.ts +64 -11
- package/dist/services/knowledge/sqlite-provider.js +303 -41
- package/dist/services/knowledge/types.d.ts +45 -2
- package/dist/services/member-access-secret.d.ts +70 -0
- package/dist/services/member-access-secret.js +195 -0
- package/dist/services/member-call-counts.d.ts +24 -0
- package/dist/services/member-call-counts.js +58 -0
- package/dist/services/member-config-io.d.ts +192 -0
- package/dist/services/member-config-io.js +443 -0
- package/dist/services/member-fleet-install.d.ts +710 -0
- package/dist/services/member-fleet-install.js +1895 -0
- package/dist/services/member-secret-env.d.ts +42 -0
- package/dist/services/member-secret-env.js +68 -0
- package/dist/services/member-tool-allowlist.d.ts +49 -0
- package/dist/services/member-tool-allowlist.js +111 -0
- package/dist/services/model-pricing.d.ts +19 -0
- package/dist/services/model-pricing.js +54 -8
- package/dist/services/port-holder.d.ts +86 -0
- package/dist/services/port-holder.js +351 -0
- package/dist/services/preflight-check.js +2 -0
- package/dist/services/registry.d.ts +13 -2
- package/dist/services/registry.js +27 -1
- package/dist/services/relay-strategy.d.ts +2 -0
- package/dist/services/relay-strategy.js +8 -0
- package/dist/services/server-lifecycle.d.ts +26 -0
- package/dist/services/server-lifecycle.js +85 -0
- package/dist/services/service-manager/index.d.ts +7 -1
- package/dist/services/service-manager/index.js +17 -4
- package/dist/services/service-manager/linux.d.ts +1 -1
- package/dist/services/service-manager/linux.js +15 -7
- package/dist/services/service-manager/macos.d.ts +11 -1
- package/dist/services/service-manager/macos.js +45 -7
- package/dist/services/service-manager/service-path.d.ts +24 -0
- package/dist/services/service-manager/service-path.js +55 -0
- package/dist/services/service-manager/types.d.ts +38 -3
- package/dist/services/service-manager/types.js +29 -0
- package/dist/services/service-manager/windows.d.ts +181 -2
- package/dist/services/service-manager/windows.js +666 -49
- package/dist/services/service-notice.d.ts +14 -0
- package/dist/services/service-notice.js +62 -0
- package/dist/services/service-start-guard.d.ts +20 -0
- package/dist/services/service-start-guard.js +86 -0
- package/dist/services/session-cost.d.ts +24 -0
- package/dist/services/session-cost.js +105 -0
- package/dist/services/session-mcp-config.d.ts +83 -0
- package/dist/services/session-mcp-config.js +211 -0
- package/dist/services/sftp.d.ts +34 -0
- package/dist/services/sftp.js +304 -76
- package/dist/services/shell-probe.d.ts +0 -24
- package/dist/services/shell-probe.js +28 -3
- package/dist/services/singleton.d.ts +68 -2
- package/dist/services/singleton.js +168 -11
- package/dist/services/sprint-coordination.js +9 -3
- package/dist/services/ssh.d.ts +27 -0
- package/dist/services/ssh.js +229 -38
- package/dist/services/stall/find-log-file.js +12 -5
- package/dist/services/stall/index.d.ts +1 -1
- package/dist/services/stall/read-log-tail.d.ts +23 -0
- package/dist/services/stall/read-log-tail.js +33 -2
- package/dist/services/stall/stall-detector.d.ts +25 -1
- package/dist/services/stall/stall-detector.js +85 -6
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.js +50 -6
- package/dist/services/stopped-marker.d.ts +16 -0
- package/dist/services/stopped-marker.js +55 -0
- package/dist/services/strategy.d.ts +33 -1
- package/dist/services/strategy.js +86 -17
- package/dist/services/supervisor-service-cleanup.d.ts +52 -0
- package/dist/services/supervisor-service-cleanup.js +332 -0
- package/dist/services/tool-registry.d.ts +8 -1
- package/dist/services/tool-registry.js +160 -59
- package/dist/services/tool-scope.d.ts +58 -0
- package/dist/services/tool-scope.js +99 -0
- package/dist/services/watch/project-resolver.js +1 -0
- package/dist/skills/auto-sprint-args/SKILL.md +2 -2
- package/dist/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/dist/skills/pm/SKILL.md +3 -3
- package/dist/skills/pm/index.md +4 -2
- package/dist/skills/pm/kb-reconcile.md +29 -14
- package/dist/skills/pm/kb-review.md +1 -0
- package/dist/skills/pm/sprint.md +5 -5
- package/dist/tools/check-status.d.ts +53 -5
- package/dist/tools/check-status.js +210 -53
- package/dist/tools/child-id-allocator.d.ts +2 -2
- package/dist/tools/child-id-allocator.js +1 -1
- package/dist/tools/code-index-heal.d.ts +8 -0
- package/dist/tools/code-index-heal.js +21 -0
- package/dist/tools/code-index-state.d.ts +45 -0
- package/dist/tools/code-index-state.js +115 -0
- package/dist/tools/code-intelligence-codebase-memory.js +6 -33
- package/dist/tools/code-intelligence-freshness.js +1 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts +30 -0
- package/dist/tools/code-intelligence-gitnexus.js +333 -57
- package/dist/tools/code-intelligence-kb-enrich.js +7 -6
- package/dist/tools/code-intelligence-readiness.d.ts +99 -0
- package/dist/tools/code-intelligence-readiness.js +206 -0
- package/dist/tools/code-intelligence-reindex.d.ts +195 -0
- package/dist/tools/code-intelligence-reindex.js +530 -50
- package/dist/tools/code-intelligence-telemetry.d.ts +6 -1
- package/dist/tools/code-intelligence-telemetry.js +12 -3
- package/dist/tools/code-intelligence.d.ts +81 -31
- package/dist/tools/code-intelligence.js +156 -52
- package/dist/tools/compose-permissions.d.ts +57 -2
- package/dist/tools/compose-permissions.js +497 -44
- package/dist/tools/execute-command.d.ts +11 -0
- package/dist/tools/execute-command.js +80 -12
- package/dist/tools/execute-prompt.d.ts +59 -15
- package/dist/tools/execute-prompt.js +544 -133
- package/dist/tools/kb-bible-commit.d.ts +65 -0
- package/dist/tools/kb-bible-commit.js +239 -0
- package/dist/tools/kb-capture.d.ts +13 -9
- package/dist/tools/kb-capture.js +42 -11
- package/dist/tools/kb-context.d.ts +27 -7
- package/dist/tools/kb-context.js +60 -9
- package/dist/tools/kb-export.d.ts +96 -7
- package/dist/tools/kb-export.js +228 -65
- package/dist/tools/kb-feedback.d.ts +13 -9
- package/dist/tools/kb-feedback.js +13 -7
- package/dist/tools/kb-freshness-sweep.d.ts +11 -7
- package/dist/tools/kb-freshness-sweep.js +7 -7
- package/dist/tools/kb-harvest.d.ts +11 -7
- package/dist/tools/kb-harvest.js +7 -7
- package/dist/tools/kb-import.d.ts +26 -10
- package/dist/tools/kb-import.js +169 -159
- package/dist/tools/kb-invalidate.d.ts +17 -10
- package/dist/tools/kb-invalidate.js +41 -8
- package/dist/tools/kb-list.d.ts +14 -10
- package/dist/tools/kb-list.js +30 -10
- package/dist/tools/kb-promote.d.ts +11 -7
- package/dist/tools/kb-promote.js +14 -8
- package/dist/tools/kb-query.d.ts +21 -11
- package/dist/tools/kb-query.js +76 -13
- package/dist/tools/kb-reconcile-prefilter.d.ts +11 -7
- package/dist/tools/kb-reconcile-prefilter.js +10 -8
- package/dist/tools/kb-resolve-contradiction.d.ts +11 -7
- package/dist/tools/kb-resolve-contradiction.js +7 -7
- package/dist/tools/kb-session-prime.d.ts +14 -7
- package/dist/tools/kb-session-prime.js +44 -44
- package/dist/tools/kb-setup.d.ts +11 -4
- package/dist/tools/kb-setup.js +25 -11
- package/dist/tools/kb-stats.d.ts +11 -10
- package/dist/tools/kb-stats.js +22 -41
- package/dist/tools/list-members.js +5 -2
- package/dist/tools/member-detail.d.ts +3 -0
- package/dist/tools/member-detail.js +88 -17
- package/dist/tools/member-reservation.d.ts +2 -2
- package/dist/tools/provision-auth.d.ts +39 -1
- package/dist/tools/provision-auth.js +269 -47
- package/dist/tools/provision-vcs-auth.d.ts +2 -2
- package/dist/tools/receive-files.js +3 -1
- package/dist/tools/register-member.d.ts +34 -8
- package/dist/tools/register-member.js +76 -58
- package/dist/tools/remove-member.js +110 -32
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/send-files.js +6 -4
- package/dist/tools/session-stats.d.ts +17 -0
- package/dist/tools/session-stats.js +27 -0
- package/dist/tools/shutdown-server.js +5 -0
- package/dist/tools/update-agent-cli.d.ts +19 -0
- package/dist/tools/update-agent-cli.js +59 -2
- package/dist/tools/update-member.d.ts +13 -10
- package/dist/tools/update-member.js +138 -7
- package/dist/tools/vcs-credential-exec.js +8 -2
- package/dist/types.d.ts +98 -1
- package/dist/utils/agent-helpers.js +2 -0
- package/dist/utils/auth-env.d.ts +15 -4
- package/dist/utils/auth-env.js +52 -23
- package/dist/utils/find-on-path.d.ts +37 -0
- package/dist/utils/find-on-path.js +85 -0
- package/dist/utils/log-helpers.d.ts +37 -0
- package/dist/utils/log-helpers.js +106 -20
- package/dist/utils/owner-only-fs.d.ts +56 -0
- package/dist/utils/owner-only-fs.js +98 -0
- package/dist/utils/process-utils.d.ts +28 -0
- package/dist/utils/process-utils.js +68 -0
- package/dist/utils/prompt-errors.js +4 -1
- package/dist/utils/session-caller.d.ts +4 -2
- package/dist/utils/session-caller.js +3 -2
- package/dist/utils/shell-escape.d.ts +42 -3
- package/dist/utils/shell-escape.js +70 -4
- package/dist/utils/ssh-error-messages.js +3 -0
- package/dist/utils/workspace-trust.d.ts +24 -1
- package/dist/utils/workspace-trust.js +21 -17
- package/dist/workflows/auto-sprint.js +223 -43
- package/package.json +11 -8
- package/packages/apra-fleet-client/package.json +2 -2
- package/packages/apra-fleet-client/src/client/api.mjs +558 -27
- package/packages/apra-fleet-client/src/client/auto-start.mjs +434 -0
- package/packages/apra-fleet-client/src/client/client.mjs +9 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +23 -4
- package/packages/apra-fleet-client/src/client/reconnecting-transport.mjs +137 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +267 -30
- package/packages/apra-fleet-client/src/client/transport.mjs +37 -3
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +75 -27
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +37 -22
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +39 -22
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +74 -40
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +49 -40
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +40 -23
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +28 -7
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +49 -24
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +66 -43
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +101 -78
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +117 -56
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +32 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +1 -5
- package/packages/apra-fleet-se/apra-pm/agents/schemas/planner-output.json +1 -1
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +41 -7
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +62 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +3 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/index.md +4 -2
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-reconcile.md +29 -14
- package/packages/apra-fleet-se/apra-pm/skills/pm/kb-review.md +1 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +5 -5
- package/packages/apra-fleet-se/bin/cli.mjs +184 -54
- package/packages/apra-fleet-se/bin/serve.mjs +143 -10
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +56 -20
- package/packages/apra-fleet-se/fleet-sprint/backlog-role.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +208 -53
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +576 -33
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +9 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-memory-hygiene.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +114 -7
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +154 -8
- package/packages/apra-fleet-se/fleet-sprint/ci-gate.mjs +353 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +12 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +60 -1
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +25 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-accounting.mjs +270 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +22 -2
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +205 -16
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +52 -14
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +6 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +3 -3
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +339 -20
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +210 -11
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +4 -4
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +200 -9
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +57 -9
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +53 -4
- package/packages/apra-fleet-se/fleet-sprint/kb-hints.mjs +181 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-injection.mjs +64 -0
- package/packages/apra-fleet-se/fleet-sprint/kb-maintainer.mjs +298 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +1257 -301
- package/packages/apra-fleet-se/fleet-sprint/lower-quality.mjs +39 -0
- package/packages/apra-fleet-se/fleet-sprint/member-align.mjs +391 -0
- package/packages/apra-fleet-se/fleet-sprint/member-call.mjs +374 -0
- package/packages/apra-fleet-se/fleet-sprint/member-init-probe.mjs +644 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +447 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +250 -29
- package/packages/apra-fleet-se/fleet-sprint/orphan-reclaim.mjs +153 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +82 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +97 -50
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +81 -18
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +43 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +6 -6
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +20 -15
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +60 -38
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +42 -10
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +16 -11
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +36 -3
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +72 -12
- package/packages/apra-fleet-se/fleet-sprint/pr-body.mjs +259 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +83 -25
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +19 -1
- package/packages/apra-fleet-se/fleet-sprint/runner.js +834 -142
- package/packages/apra-fleet-se/fleet-sprint/se-os-commands.mjs +24 -0
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +130 -0
- package/packages/apra-fleet-se/fleet-sprint/se-windows.mjs +111 -0
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +44 -1
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +39 -15
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +84 -30
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +138 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +111 -11
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +22 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +7 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +180 -14
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +134 -7
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +99 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +223 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +49 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +8 -4
- package/packages/apra-fleet-se/fleet-sprint/verify-block.mjs +152 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +235 -21
- package/packages/apra-fleet-se/package.json +2 -2
- package/packages/apra-fleet-se/src/supervisor/api.mjs +919 -0
- package/packages/apra-fleet-se/src/supervisor/backlog-member.mjs +332 -0
- package/packages/apra-fleet-se/src/supervisor/backlog.mjs +982 -0
- package/packages/apra-fleet-se/src/supervisor/beads-identity.mjs +246 -0
- package/packages/apra-fleet-se/src/supervisor/beads-view.mjs +438 -0
- package/packages/apra-fleet-se/src/supervisor/child-port.mjs +36 -0
- package/packages/apra-fleet-se/src/supervisor/dashboard.mjs +1659 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-mutex.mjs +350 -0
- package/packages/apra-fleet-se/src/supervisor/dolt-orphan-sweep.mjs +338 -0
- package/packages/apra-fleet-se/src/supervisor/fleet-members.mjs +279 -0
- package/packages/apra-fleet-se/src/supervisor/history-view.mjs +276 -0
- package/packages/apra-fleet-se/src/supervisor/history.mjs +328 -0
- package/packages/apra-fleet-se/src/supervisor/id-allocator.mjs +521 -0
- package/packages/apra-fleet-se/src/supervisor/launch-form.mjs +444 -0
- package/packages/apra-fleet-se/src/supervisor/ledger.mjs +629 -0
- package/packages/apra-fleet-se/src/supervisor/lib/exec-bd.mjs +303 -0
- package/packages/apra-fleet-se/src/supervisor/log-timestamp.mjs +51 -0
- package/packages/apra-fleet-se/src/supervisor/log-view.mjs +159 -0
- package/packages/apra-fleet-se/src/supervisor/proxy.mjs +474 -0
- package/packages/apra-fleet-se/src/supervisor/readopt.mjs +136 -0
- package/packages/apra-fleet-se/src/supervisor/reconcile.mjs +263 -0
- package/packages/apra-fleet-se/src/supervisor/rename-with-retry.mjs +87 -0
- package/packages/apra-fleet-se/src/supervisor/scope-overlap.mjs +327 -0
- package/packages/apra-fleet-se/src/supervisor/self-log.mjs +133 -0
- package/packages/apra-fleet-se/src/supervisor/server.mjs +399 -0
- package/packages/apra-fleet-se/src/supervisor/spawner.mjs +542 -0
- package/packages/apra-fleet-se/src/supervisor/sprint-identity.mjs +96 -0
- package/packages/apra-fleet-se/src/supervisor/watchdog.mjs +987 -0
- package/packages/apra-fleet-workflow/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +64 -9
- package/packages/apra-fleet-workflow/src/viewer/run-summary.mjs +127 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +71 -5
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +75 -25
- package/skills/fleet/permissions.md +9 -0
- package/skills/fleet/profiles/tag-kb-reconciler.json +2 -6
- package/version.json +1 -1
- package/dist/cli/agent-transform.d.ts.map +0 -1
- package/dist/cli/agent-transform.js.map +0 -1
- package/dist/cli/auth.d.ts.map +0 -1
- package/dist/cli/auth.js.map +0 -1
- package/dist/cli/config.d.ts.map +0 -1
- package/dist/cli/config.js.map +0 -1
- package/dist/cli/dolt-install.d.ts.map +0 -1
- package/dist/cli/dolt-install.js.map +0 -1
- package/dist/cli/install-guard.d.ts.map +0 -1
- package/dist/cli/install-guard.js.map +0 -1
- package/dist/cli/install.d.ts.map +0 -1
- package/dist/cli/install.js.map +0 -1
- package/dist/cli/join.d.ts.map +0 -1
- package/dist/cli/join.js.map +0 -1
- package/dist/cli/kb-commit.d.ts.map +0 -1
- package/dist/cli/kb-commit.js.map +0 -1
- package/dist/cli/kb-directives.d.ts.map +0 -1
- package/dist/cli/kb-directives.js.map +0 -1
- package/dist/cli/kb-import.d.ts.map +0 -1
- package/dist/cli/kb-import.js.map +0 -1
- package/dist/cli/register-member.d.ts.map +0 -1
- package/dist/cli/register-member.js.map +0 -1
- package/dist/cli/restart.d.ts.map +0 -1
- package/dist/cli/restart.js.map +0 -1
- package/dist/cli/secret.d.ts.map +0 -1
- package/dist/cli/secret.js.map +0 -1
- package/dist/cli/spoke.d.ts.map +0 -1
- package/dist/cli/spoke.js.map +0 -1
- package/dist/cli/start.d.ts.map +0 -1
- package/dist/cli/start.js.map +0 -1
- package/dist/cli/status.d.ts.map +0 -1
- package/dist/cli/status.js.map +0 -1
- package/dist/cli/stop.d.ts.map +0 -1
- package/dist/cli/stop.js.map +0 -1
- package/dist/cli/uninstall.d.ts.map +0 -1
- package/dist/cli/uninstall.js.map +0 -1
- package/dist/cli/update.d.ts.map +0 -1
- package/dist/cli/update.js.map +0 -1
- package/dist/cli/watch.d.ts.map +0 -1
- package/dist/cli/watch.js.map +0 -1
- package/dist/cli/workflow-assets.d.ts.map +0 -1
- package/dist/cli/workflow-assets.js.map +0 -1
- package/dist/cli/workflow.d.ts.map +0 -1
- package/dist/cli/workflow.js.map +0 -1
- package/dist/commands/kb-server.d.ts.map +0 -1
- package/dist/commands/kb-server.js.map +0 -1
- package/dist/delivery-mode.d.ts.map +0 -1
- package/dist/delivery-mode.js.map +0 -1
- package/dist/hub-service/activity.d.ts.map +0 -1
- package/dist/hub-service/activity.js.map +0 -1
- package/dist/hub-service/audit-log.d.ts.map +0 -1
- package/dist/hub-service/audit-log.js.map +0 -1
- package/dist/hub-service/db/pool.d.ts.map +0 -1
- package/dist/hub-service/db/pool.js.map +0 -1
- package/dist/hub-service/enrollment.d.ts.map +0 -1
- package/dist/hub-service/enrollment.js.map +0 -1
- package/dist/hub-service/envelope-routes.d.ts.map +0 -1
- package/dist/hub-service/envelope-routes.js.map +0 -1
- package/dist/hub-service/handlers/installers.d.ts.map +0 -1
- package/dist/hub-service/handlers/installers.js.map +0 -1
- package/dist/hub-service/http-server.d.ts.map +0 -1
- package/dist/hub-service/http-server.js.map +0 -1
- package/dist/hub-service/hub-jwt.d.ts.map +0 -1
- package/dist/hub-service/hub-jwt.js.map +0 -1
- package/dist/hub-service/jwt-revocation.d.ts.map +0 -1
- package/dist/hub-service/jwt-revocation.js.map +0 -1
- package/dist/hub-service/machines.d.ts.map +0 -1
- package/dist/hub-service/machines.js.map +0 -1
- package/dist/hub-service/main.d.ts.map +0 -1
- package/dist/hub-service/main.js.map +0 -1
- package/dist/hub-service/member-tokens.d.ts.map +0 -1
- package/dist/hub-service/member-tokens.js.map +0 -1
- package/dist/hub-service/member-view.d.ts.map +0 -1
- package/dist/hub-service/member-view.js.map +0 -1
- package/dist/hub-service/members.d.ts.map +0 -1
- package/dist/hub-service/members.js.map +0 -1
- package/dist/hub-service/presence.d.ts.map +0 -1
- package/dist/hub-service/presence.js.map +0 -1
- package/dist/hub-service/project-view.d.ts.map +0 -1
- package/dist/hub-service/project-view.js.map +0 -1
- package/dist/hub-service/projects.d.ts.map +0 -1
- package/dist/hub-service/projects.js.map +0 -1
- package/dist/hub-service/relay-queue.d.ts.map +0 -1
- package/dist/hub-service/relay-queue.js.map +0 -1
- package/dist/hub-service/session-jwt.d.ts.map +0 -1
- package/dist/hub-service/session-jwt.js.map +0 -1
- package/dist/hub-service/usage.d.ts.map +0 -1
- package/dist/hub-service/usage.js.map +0 -1
- package/dist/hub-service/users.d.ts.map +0 -1
- package/dist/hub-service/users.js.map +0 -1
- package/dist/hub-service/workspaces.d.ts.map +0 -1
- package/dist/hub-service/workspaces.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/onboarding/text.d.ts.map +0 -1
- package/dist/onboarding/text.js.map +0 -1
- package/dist/os/git-bash-candidates.d.ts.map +0 -1
- package/dist/os/git-bash-candidates.js.map +0 -1
- package/dist/os/index.d.ts.map +0 -1
- package/dist/os/index.js.map +0 -1
- package/dist/os/linux.d.ts.map +0 -1
- package/dist/os/linux.js.map +0 -1
- package/dist/os/macos.d.ts.map +0 -1
- package/dist/os/macos.js.map +0 -1
- package/dist/os/os-commands.d.ts.map +0 -1
- package/dist/os/os-commands.js.map +0 -1
- package/dist/os/windows-gitbash.d.ts.map +0 -1
- package/dist/os/windows-gitbash.js.map +0 -1
- package/dist/os/windows-wrapper.d.ts.map +0 -1
- package/dist/os/windows-wrapper.js.map +0 -1
- package/dist/os/windows.d.ts.map +0 -1
- package/dist/os/windows.js.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js.map +0 -1
- package/dist/providers/agy.d.ts.map +0 -1
- package/dist/providers/agy.js.map +0 -1
- package/dist/providers/claude.d.ts.map +0 -1
- package/dist/providers/claude.js.map +0 -1
- package/dist/providers/codex.d.ts.map +0 -1
- package/dist/providers/codex.js.map +0 -1
- package/dist/providers/copilot.d.ts.map +0 -1
- package/dist/providers/copilot.js.map +0 -1
- package/dist/providers/email/headers.d.ts.map +0 -1
- package/dist/providers/email/headers.js.map +0 -1
- package/dist/providers/email/index.d.ts.map +0 -1
- package/dist/providers/email/index.js.map +0 -1
- package/dist/providers/email/provider.d.ts.map +0 -1
- package/dist/providers/email/provider.js.map +0 -1
- package/dist/providers/email/sendgrid.d.ts.map +0 -1
- package/dist/providers/email/sendgrid.js.map +0 -1
- package/dist/providers/email/smtp.d.ts.map +0 -1
- package/dist/providers/email/smtp.js.map +0 -1
- package/dist/providers/index.d.ts.map +0 -1
- package/dist/providers/index.js.map +0 -1
- package/dist/providers/none.d.ts.map +0 -1
- package/dist/providers/none.js.map +0 -1
- package/dist/providers/opencode.d.ts.map +0 -1
- package/dist/providers/opencode.js.map +0 -1
- package/dist/providers/provider.d.ts.map +0 -1
- package/dist/providers/provider.js.map +0 -1
- package/dist/services/agent-provisioner.d.ts.map +0 -1
- package/dist/services/agent-provisioner.js.map +0 -1
- package/dist/services/agy-project.d.ts.map +0 -1
- package/dist/services/agy-project.js.map +0 -1
- package/dist/services/auth-socket.d.ts.map +0 -1
- package/dist/services/auth-socket.js.map +0 -1
- package/dist/services/auth-web.d.ts.map +0 -1
- package/dist/services/auth-web.js.map +0 -1
- package/dist/services/budget-awareness.d.ts.map +0 -1
- package/dist/services/budget-awareness.js.map +0 -1
- package/dist/services/cloud/activity.d.ts.map +0 -1
- package/dist/services/cloud/activity.js.map +0 -1
- package/dist/services/cloud/aws.d.ts.map +0 -1
- package/dist/services/cloud/aws.js.map +0 -1
- package/dist/services/cloud/cost.d.ts.map +0 -1
- package/dist/services/cloud/cost.js.map +0 -1
- package/dist/services/cloud/idle-manager.d.ts.map +0 -1
- package/dist/services/cloud/idle-manager.js.map +0 -1
- package/dist/services/cloud/lifecycle.d.ts.map +0 -1
- package/dist/services/cloud/lifecycle.js.map +0 -1
- package/dist/services/cloud/task-wrapper.d.ts.map +0 -1
- package/dist/services/cloud/task-wrapper.js.map +0 -1
- package/dist/services/cloud/types.d.ts.map +0 -1
- package/dist/services/cloud/types.js.map +0 -1
- package/dist/services/cloud-sync.d.ts.map +0 -1
- package/dist/services/cloud-sync.js.map +0 -1
- package/dist/services/context-admission.d.ts.map +0 -1
- package/dist/services/context-admission.js.map +0 -1
- package/dist/services/credential-cleanup.d.ts.map +0 -1
- package/dist/services/credential-cleanup.js.map +0 -1
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/event-bus.d.ts.map +0 -1
- package/dist/services/event-bus.js.map +0 -1
- package/dist/services/exit-drain.d.ts.map +0 -1
- package/dist/services/exit-drain.js.map +0 -1
- package/dist/services/file-chunker.d.ts.map +0 -1
- package/dist/services/file-chunker.js.map +0 -1
- package/dist/services/file-transfer-relay.d.ts.map +0 -1
- package/dist/services/file-transfer-relay.js.map +0 -1
- package/dist/services/file-transfer.d.ts.map +0 -1
- package/dist/services/file-transfer.js.map +0 -1
- package/dist/services/git-config.d.ts.map +0 -1
- package/dist/services/git-config.js.map +0 -1
- package/dist/services/github-app.d.ts.map +0 -1
- package/dist/services/github-app.js.map +0 -1
- package/dist/services/http-transport.d.ts.map +0 -1
- package/dist/services/http-transport.js.map +0 -1
- package/dist/services/hub-client.d.ts.map +0 -1
- package/dist/services/hub-client.js.map +0 -1
- package/dist/services/icons.d.ts.map +0 -1
- package/dist/services/icons.js.map +0 -1
- package/dist/services/jwt.d.ts.map +0 -1
- package/dist/services/jwt.js.map +0 -1
- package/dist/services/knowledge/audn.d.ts.map +0 -1
- package/dist/services/knowledge/audn.js.map +0 -1
- package/dist/services/knowledge/file-hash.d.ts.map +0 -1
- package/dist/services/knowledge/file-hash.js.map +0 -1
- package/dist/services/knowledge/http-provider.d.ts.map +0 -1
- package/dist/services/knowledge/http-provider.js.map +0 -1
- package/dist/services/knowledge/kb-config.d.ts.map +0 -1
- package/dist/services/knowledge/kb-config.js.map +0 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +0 -1
- package/dist/services/knowledge/kb-providers.js.map +0 -1
- package/dist/services/knowledge/kb-scope-input.d.ts +0 -5
- package/dist/services/knowledge/kb-scope-input.d.ts.map +0 -1
- package/dist/services/knowledge/kb-scope-input.js +0 -11
- package/dist/services/knowledge/kb-scope-input.js.map +0 -1
- package/dist/services/knowledge/kb-service.d.ts.map +0 -1
- package/dist/services/knowledge/kb-service.js.map +0 -1
- package/dist/services/knowledge/path-validation.d.ts.map +0 -1
- package/dist/services/knowledge/path-validation.js.map +0 -1
- package/dist/services/knowledge/pre-init.d.ts.map +0 -1
- package/dist/services/knowledge/pre-init.js.map +0 -1
- package/dist/services/knowledge/project-slug.d.ts.map +0 -1
- package/dist/services/knowledge/project-slug.js.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +0 -1
- package/dist/services/knowledge/require-sqlite-project.js.map +0 -1
- package/dist/services/knowledge/sqlite-provider.d.ts.map +0 -1
- package/dist/services/knowledge/sqlite-provider.js.map +0 -1
- package/dist/services/knowledge/types.d.ts.map +0 -1
- package/dist/services/knowledge/types.js.map +0 -1
- package/dist/services/known-hosts.d.ts.map +0 -1
- package/dist/services/known-hosts.js.map +0 -1
- package/dist/services/known-sessions.d.ts.map +0 -1
- package/dist/services/known-sessions.js.map +0 -1
- package/dist/services/member-home.d.ts.map +0 -1
- package/dist/services/member-home.js.map +0 -1
- package/dist/services/member-remote-url.d.ts.map +0 -1
- package/dist/services/member-remote-url.js.map +0 -1
- package/dist/services/model-pricing.d.ts.map +0 -1
- package/dist/services/model-pricing.js.map +0 -1
- package/dist/services/onboarding.d.ts.map +0 -1
- package/dist/services/onboarding.js.map +0 -1
- package/dist/services/orphan-recovery.d.ts.map +0 -1
- package/dist/services/orphan-recovery.js.map +0 -1
- package/dist/services/pending-responses.d.ts.map +0 -1
- package/dist/services/pending-responses.js.map +0 -1
- package/dist/services/preflight-check.d.ts.map +0 -1
- package/dist/services/preflight-check.js.map +0 -1
- package/dist/services/registry.d.ts.map +0 -1
- package/dist/services/registry.js.map +0 -1
- package/dist/services/relay-context.d.ts.map +0 -1
- package/dist/services/relay-context.js.map +0 -1
- package/dist/services/relay-executor.d.ts.map +0 -1
- package/dist/services/relay-executor.js.map +0 -1
- package/dist/services/relay-request.d.ts.map +0 -1
- package/dist/services/relay-request.js.map +0 -1
- package/dist/services/relay-strategy.d.ts.map +0 -1
- package/dist/services/relay-strategy.js.map +0 -1
- package/dist/services/secret-token.d.ts.map +0 -1
- package/dist/services/secret-token.js.map +0 -1
- package/dist/services/service-manager/index.d.ts.map +0 -1
- package/dist/services/service-manager/index.js.map +0 -1
- package/dist/services/service-manager/linux.d.ts.map +0 -1
- package/dist/services/service-manager/linux.js.map +0 -1
- package/dist/services/service-manager/macos.d.ts.map +0 -1
- package/dist/services/service-manager/macos.js.map +0 -1
- package/dist/services/service-manager/types.d.ts.map +0 -1
- package/dist/services/service-manager/types.js.map +0 -1
- package/dist/services/service-manager/windows.d.ts.map +0 -1
- package/dist/services/service-manager/windows.js.map +0 -1
- package/dist/services/session-registry.d.ts.map +0 -1
- package/dist/services/session-registry.js.map +0 -1
- package/dist/services/sftp.d.ts.map +0 -1
- package/dist/services/sftp.js.map +0 -1
- package/dist/services/shell-probe.d.ts.map +0 -1
- package/dist/services/shell-probe.js.map +0 -1
- package/dist/services/singleton.d.ts.map +0 -1
- package/dist/services/singleton.js.map +0 -1
- package/dist/services/sprint-coordination.d.ts.map +0 -1
- package/dist/services/sprint-coordination.js.map +0 -1
- package/dist/services/ssh.d.ts.map +0 -1
- package/dist/services/ssh.js.map +0 -1
- package/dist/services/stall/find-log-file.d.ts.map +0 -1
- package/dist/services/stall/find-log-file.js.map +0 -1
- package/dist/services/stall/index.d.ts.map +0 -1
- package/dist/services/stall/index.js.map +0 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +0 -1
- package/dist/services/stall/log-path-resolver.js.map +0 -1
- package/dist/services/stall/read-log-tail.d.ts.map +0 -1
- package/dist/services/stall/read-log-tail.js.map +0 -1
- package/dist/services/stall/stall-detector.d.ts.map +0 -1
- package/dist/services/stall/stall-detector.js.map +0 -1
- package/dist/services/stall/stall-poller.d.ts.map +0 -1
- package/dist/services/stall/stall-poller.js.map +0 -1
- package/dist/services/stall/time-utils.d.ts.map +0 -1
- package/dist/services/stall/time-utils.js.map +0 -1
- package/dist/services/statusline.d.ts.map +0 -1
- package/dist/services/statusline.js.map +0 -1
- package/dist/services/strategy.d.ts.map +0 -1
- package/dist/services/strategy.js.map +0 -1
- package/dist/services/substitution-engine.d.ts.map +0 -1
- package/dist/services/substitution-engine.js.map +0 -1
- package/dist/services/task-cleanup.d.ts.map +0 -1
- package/dist/services/task-cleanup.js.map +0 -1
- package/dist/services/token-issuer.d.ts.map +0 -1
- package/dist/services/token-issuer.js.map +0 -1
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/update-check.d.ts.map +0 -1
- package/dist/services/update-check.js.map +0 -1
- package/dist/services/user-config.d.ts.map +0 -1
- package/dist/services/user-config.js.map +0 -1
- package/dist/services/vcs/azure-devops.d.ts.map +0 -1
- package/dist/services/vcs/azure-devops.js.map +0 -1
- package/dist/services/vcs/bitbucket.d.ts.map +0 -1
- package/dist/services/vcs/bitbucket.js.map +0 -1
- package/dist/services/vcs/constants.d.ts.map +0 -1
- package/dist/services/vcs/constants.js.map +0 -1
- package/dist/services/vcs/github.d.ts.map +0 -1
- package/dist/services/vcs/github.js.map +0 -1
- package/dist/services/vcs/types.d.ts.map +0 -1
- package/dist/services/vcs/types.js.map +0 -1
- package/dist/services/version-check.d.ts.map +0 -1
- package/dist/services/version-check.js.map +0 -1
- package/dist/services/watch/fleet-log.d.ts.map +0 -1
- package/dist/services/watch/fleet-log.js.map +0 -1
- package/dist/services/watch/project-resolver.d.ts.map +0 -1
- package/dist/services/watch/project-resolver.js.map +0 -1
- package/dist/services/watch/transcript-formatter.d.ts.map +0 -1
- package/dist/services/watch/transcript-formatter.js.map +0 -1
- package/dist/smoke-test.d.ts.map +0 -1
- package/dist/smoke-test.js.map +0 -1
- package/dist/tools/check-status.d.ts.map +0 -1
- package/dist/tools/check-status.js.map +0 -1
- package/dist/tools/child-id-allocator.d.ts.map +0 -1
- package/dist/tools/child-id-allocator.js.map +0 -1
- package/dist/tools/cloud-control.d.ts.map +0 -1
- package/dist/tools/cloud-control.js.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.d.ts.map +0 -1
- package/dist/tools/code-intelligence-codebase-memory.js.map +0 -1
- package/dist/tools/code-intelligence-freshness.d.ts.map +0 -1
- package/dist/tools/code-intelligence-freshness.js.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.d.ts.map +0 -1
- package/dist/tools/code-intelligence-gitnexus.js.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.d.ts.map +0 -1
- package/dist/tools/code-intelligence-kb-enrich.js.map +0 -1
- package/dist/tools/code-intelligence-reindex.d.ts.map +0 -1
- package/dist/tools/code-intelligence-reindex.js.map +0 -1
- package/dist/tools/code-intelligence-telemetry.d.ts.map +0 -1
- package/dist/tools/code-intelligence-telemetry.js.map +0 -1
- package/dist/tools/code-intelligence-tests.d.ts.map +0 -1
- package/dist/tools/code-intelligence-tests.js.map +0 -1
- package/dist/tools/code-intelligence.d.ts.map +0 -1
- package/dist/tools/code-intelligence.js.map +0 -1
- package/dist/tools/compose-permissions.d.ts.map +0 -1
- package/dist/tools/compose-permissions.js.map +0 -1
- package/dist/tools/credential-store-delete.d.ts.map +0 -1
- package/dist/tools/credential-store-delete.js.map +0 -1
- package/dist/tools/credential-store-list.d.ts.map +0 -1
- package/dist/tools/credential-store-list.js.map +0 -1
- package/dist/tools/credential-store-set.d.ts.map +0 -1
- package/dist/tools/credential-store-set.js.map +0 -1
- package/dist/tools/credential-store-update.d.ts.map +0 -1
- package/dist/tools/credential-store-update.js.map +0 -1
- package/dist/tools/dolt-push-mutex.d.ts.map +0 -1
- package/dist/tools/dolt-push-mutex.js.map +0 -1
- package/dist/tools/execute-command.d.ts.map +0 -1
- package/dist/tools/execute-command.js.map +0 -1
- package/dist/tools/execute-prompt.d.ts.map +0 -1
- package/dist/tools/execute-prompt.js.map +0 -1
- package/dist/tools/get-member-model-pricing.d.ts.map +0 -1
- package/dist/tools/get-member-model-pricing.js.map +0 -1
- package/dist/tools/kb-capture.d.ts.map +0 -1
- package/dist/tools/kb-capture.js.map +0 -1
- package/dist/tools/kb-context.d.ts.map +0 -1
- package/dist/tools/kb-context.js.map +0 -1
- package/dist/tools/kb-export.d.ts.map +0 -1
- package/dist/tools/kb-export.js.map +0 -1
- package/dist/tools/kb-feedback.d.ts.map +0 -1
- package/dist/tools/kb-feedback.js.map +0 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +0 -1
- package/dist/tools/kb-freshness-sweep.js.map +0 -1
- package/dist/tools/kb-harvest.d.ts.map +0 -1
- package/dist/tools/kb-harvest.js.map +0 -1
- package/dist/tools/kb-import.d.ts.map +0 -1
- package/dist/tools/kb-import.js.map +0 -1
- package/dist/tools/kb-invalidate.d.ts.map +0 -1
- package/dist/tools/kb-invalidate.js.map +0 -1
- package/dist/tools/kb-list.d.ts.map +0 -1
- package/dist/tools/kb-list.js.map +0 -1
- package/dist/tools/kb-promote.d.ts.map +0 -1
- package/dist/tools/kb-promote.js.map +0 -1
- package/dist/tools/kb-query.d.ts.map +0 -1
- package/dist/tools/kb-query.js.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +0 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +0 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +0 -1
- package/dist/tools/kb-resolve-contradiction.js.map +0 -1
- package/dist/tools/kb-session-prime.d.ts.map +0 -1
- package/dist/tools/kb-session-prime.js.map +0 -1
- package/dist/tools/kb-setup.d.ts.map +0 -1
- package/dist/tools/kb-setup.js.map +0 -1
- package/dist/tools/kb-stats.d.ts.map +0 -1
- package/dist/tools/kb-stats.js.map +0 -1
- package/dist/tools/list-members.d.ts.map +0 -1
- package/dist/tools/list-members.js.map +0 -1
- package/dist/tools/member-detail.d.ts.map +0 -1
- package/dist/tools/member-detail.js.map +0 -1
- package/dist/tools/member-reservation.d.ts.map +0 -1
- package/dist/tools/member-reservation.js.map +0 -1
- package/dist/tools/monitor-task.d.ts.map +0 -1
- package/dist/tools/monitor-task.js.map +0 -1
- package/dist/tools/provision-auth.d.ts.map +0 -1
- package/dist/tools/provision-auth.js.map +0 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +0 -1
- package/dist/tools/provision-vcs-auth.js.map +0 -1
- package/dist/tools/receive-files.d.ts.map +0 -1
- package/dist/tools/receive-files.js.map +0 -1
- package/dist/tools/register-member.d.ts.map +0 -1
- package/dist/tools/register-member.js.map +0 -1
- package/dist/tools/remove-member.d.ts.map +0 -1
- package/dist/tools/remove-member.js.map +0 -1
- package/dist/tools/report-status.d.ts.map +0 -1
- package/dist/tools/report-status.js.map +0 -1
- package/dist/tools/respond-to-message.d.ts.map +0 -1
- package/dist/tools/respond-to-message.js.map +0 -1
- package/dist/tools/revoke-vcs-auth.d.ts.map +0 -1
- package/dist/tools/revoke-vcs-auth.js.map +0 -1
- package/dist/tools/send-email.d.ts.map +0 -1
- package/dist/tools/send-email.js.map +0 -1
- package/dist/tools/send-files.d.ts.map +0 -1
- package/dist/tools/send-files.js.map +0 -1
- package/dist/tools/send-message.d.ts.map +0 -1
- package/dist/tools/send-message.js.map +0 -1
- package/dist/tools/setup-git-app.d.ts.map +0 -1
- package/dist/tools/setup-git-app.js.map +0 -1
- package/dist/tools/setup-ssh-key.d.ts.map +0 -1
- package/dist/tools/setup-ssh-key.js.map +0 -1
- package/dist/tools/shutdown-server.d.ts.map +0 -1
- package/dist/tools/shutdown-server.js.map +0 -1
- package/dist/tools/stop-prompt.d.ts.map +0 -1
- package/dist/tools/stop-prompt.js.map +0 -1
- package/dist/tools/update-agent-cli.d.ts.map +0 -1
- package/dist/tools/update-agent-cli.js.map +0 -1
- package/dist/tools/update-member.d.ts.map +0 -1
- package/dist/tools/update-member.js.map +0 -1
- package/dist/tools/vcs-credential-exec.d.ts.map +0 -1
- package/dist/tools/vcs-credential-exec.js.map +0 -1
- package/dist/tools/version.d.ts.map +0 -1
- package/dist/tools/version.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/agent-helpers.d.ts.map +0 -1
- package/dist/utils/agent-helpers.js.map +0 -1
- package/dist/utils/ansi.d.ts.map +0 -1
- package/dist/utils/ansi.js.map +0 -1
- package/dist/utils/auth-env.d.ts.map +0 -1
- package/dist/utils/auth-env.js.map +0 -1
- package/dist/utils/collect-secret.d.ts.map +0 -1
- package/dist/utils/collect-secret.js.map +0 -1
- package/dist/utils/credential-validation.d.ts.map +0 -1
- package/dist/utils/credential-validation.js.map +0 -1
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge.js.map +0 -1
- package/dist/utils/file-permissions.d.ts.map +0 -1
- package/dist/utils/file-permissions.js.map +0 -1
- package/dist/utils/gpu-parser.d.ts.map +0 -1
- package/dist/utils/gpu-parser.js.map +0 -1
- package/dist/utils/log-helpers.d.ts.map +0 -1
- package/dist/utils/log-helpers.js.map +0 -1
- package/dist/utils/oob-timeout.d.ts.map +0 -1
- package/dist/utils/oob-timeout.js.map +0 -1
- package/dist/utils/opencode-model-validation.d.ts.map +0 -1
- package/dist/utils/opencode-model-validation.js.map +0 -1
- package/dist/utils/pid-helpers.d.ts.map +0 -1
- package/dist/utils/pid-helpers.js.map +0 -1
- package/dist/utils/platform.d.ts.map +0 -1
- package/dist/utils/platform.js.map +0 -1
- package/dist/utils/process-utils.d.ts.map +0 -1
- package/dist/utils/process-utils.js.map +0 -1
- package/dist/utils/prompt-errors.d.ts.map +0 -1
- package/dist/utils/prompt-errors.js.map +0 -1
- package/dist/utils/resolve-member.d.ts.map +0 -1
- package/dist/utils/resolve-member.js.map +0 -1
- package/dist/utils/secure-input.d.ts.map +0 -1
- package/dist/utils/secure-input.js.map +0 -1
- package/dist/utils/session-caller.d.ts.map +0 -1
- package/dist/utils/session-caller.js.map +0 -1
- package/dist/utils/shell-escape.d.ts.map +0 -1
- package/dist/utils/shell-escape.js.map +0 -1
- package/dist/utils/skill-matrix.d.ts.map +0 -1
- package/dist/utils/skill-matrix.js.map +0 -1
- package/dist/utils/ssh-error-messages.d.ts.map +0 -1
- package/dist/utils/ssh-error-messages.js.map +0 -1
- package/dist/utils/vcs-provider-detect.d.ts.map +0 -1
- package/dist/utils/vcs-provider-detect.js.map +0 -1
- package/dist/utils/work-folder-validation.d.ts.map +0 -1
- package/dist/utils/work-folder-validation.js.map +0 -1
- package/dist/utils/workspace-trust.d.ts.map +0 -1
- package/dist/utils/workspace-trust.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
package/dist/cli/auth.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import os from 'node:os';
|
|
4
|
-
import {
|
|
4
|
+
import { execFileSync } from 'node:child_process';
|
|
5
|
+
import { escapePowerShellArg } from '../utils/shell-escape.js';
|
|
5
6
|
/** Provider -> auth env var name */
|
|
6
7
|
const PROVIDER_AUTH_ENV = {
|
|
7
8
|
claude: 'ANTHROPIC_API_KEY',
|
|
@@ -227,11 +228,22 @@ function bareTokenSyntheticSessionFields() {
|
|
|
227
228
|
scopes: [...BARE_TOKEN_SYNTHETIC_SCOPES],
|
|
228
229
|
};
|
|
229
230
|
}
|
|
230
|
-
|
|
231
|
+
// Keys that would reach Object.prototype through plain-object assignment.
|
|
232
|
+
// The source is a JSON.parse result (a user-pasted credential blob or the
|
|
233
|
+
// existing credentials file), where "__proto__" is an ordinary own key.
|
|
234
|
+
const UNSAFE_MERGE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);
|
|
235
|
+
export function deepMerge(target, source) {
|
|
231
236
|
for (const key of Object.keys(source)) {
|
|
237
|
+
if (UNSAFE_MERGE_KEYS.has(key))
|
|
238
|
+
continue;
|
|
232
239
|
const sv = source[key];
|
|
233
240
|
if (sv && typeof sv === 'object' && !Array.isArray(sv)) {
|
|
234
|
-
|
|
241
|
+
// Own plain-object values only: an inherited member (e.g. toString)
|
|
242
|
+
// must never become the merge target.
|
|
243
|
+
const own = Object.prototype.hasOwnProperty.call(target, key) ? target[key] : undefined;
|
|
244
|
+
const tv = own && typeof own === 'object' && !Array.isArray(own)
|
|
245
|
+
? own
|
|
246
|
+
: {};
|
|
235
247
|
target[key] = deepMerge(tv, sv);
|
|
236
248
|
}
|
|
237
249
|
else {
|
|
@@ -246,7 +258,7 @@ async function handleOAuth(args) {
|
|
|
246
258
|
// member's registry.json encryptedEnvVars.CLAUDE_CODE_OAUTH_TOKEN instead
|
|
247
259
|
// of writing a credentials file. This is the PRIMARY, cross-platform
|
|
248
260
|
// smoke-test path (register_member/update_member's own persisted field --
|
|
249
|
-
// see src/
|
|
261
|
+
// see src/services/member-secret-env.ts#stageAuthEnv and src/os/*.ts#getCleanEnv):
|
|
250
262
|
// LocalStrategy's clean-env dispatch (env -i ... bash -l -c ...) exports
|
|
251
263
|
// this env var directly into the child shell for every dispatch, which the
|
|
252
264
|
// real Claude CLI accepts without needing a synthesized credentials-file
|
|
@@ -330,8 +342,10 @@ async function provisionEnvVarForMember(provider, token, memberName) {
|
|
|
330
342
|
const { encryptPassword } = await import('../utils/crypto.js');
|
|
331
343
|
const { updateAgent } = await import('../services/registry.js');
|
|
332
344
|
const bearerToken = extractBearerTokenFromSecret(token);
|
|
345
|
+
// Drop a stored API key: it would outrank the OAuth token at dispatch.
|
|
346
|
+
const { ANTHROPIC_API_KEY: _staleApiKey, ...otherVars } = agentOrError.encryptedEnvVars ?? {};
|
|
333
347
|
const updated = updateAgent(agentOrError.id, {
|
|
334
|
-
encryptedEnvVars: { ...
|
|
348
|
+
encryptedEnvVars: { ...otherVars, [envVarName]: encryptPassword(bearerToken) },
|
|
335
349
|
});
|
|
336
350
|
if (!updated) {
|
|
337
351
|
console.error(`✗ Failed to update member "${memberName}" -- not found in registry.`);
|
|
@@ -341,6 +355,9 @@ async function provisionEnvVarForMember(provider, token, memberName) {
|
|
|
341
355
|
console.log(`✓ ${envVarName} provisioned for member "${updated.friendlyName}"`);
|
|
342
356
|
console.log(` Stored encrypted in registry.json's encryptedEnvVars (never plaintext).`);
|
|
343
357
|
console.log(` LocalStrategy's clean-env dispatch injects it into every dispatch's child shell.`);
|
|
358
|
+
if (_staleApiKey) {
|
|
359
|
+
console.log(` Cleared the member's stored ANTHROPIC_API_KEY (it would take precedence over ${envVarName}).`);
|
|
360
|
+
}
|
|
344
361
|
}
|
|
345
362
|
catch (err) {
|
|
346
363
|
console.error(`✗ Failed to provision member env var: ${err.message}`);
|
|
@@ -352,9 +369,22 @@ async function provisionEnvVarForMember(provider, token, memberName) {
|
|
|
352
369
|
// ---------------------------------------------------------------------------
|
|
353
370
|
function setApiKeyInProfiles(envVarName, value) {
|
|
354
371
|
if (process.platform === 'win32') {
|
|
355
|
-
// Windows: set as user-level persistent environment variable
|
|
356
|
-
|
|
357
|
-
|
|
372
|
+
// Windows: set as user-level persistent environment variable. The script is
|
|
373
|
+
// passed via -EncodedCommand with no cmd.exe in between, so only PowerShell
|
|
374
|
+
// parses it; escapePowerShellArg doubles every PowerShell single-quote
|
|
375
|
+
// character (ASCII ' and U+2018..U+201B), so the value stays inside the
|
|
376
|
+
// single-quoted literal.
|
|
377
|
+
const script = `[Environment]::SetEnvironmentVariable(${escapePowerShellArg(envVarName)}, ${escapePowerShellArg(value)}, 'User')`;
|
|
378
|
+
const encoded = Buffer.from(script, 'utf16le').toString('base64');
|
|
379
|
+
try {
|
|
380
|
+
execFileSync('powershell', ['-NoProfile', '-NonInteractive', '-EncodedCommand', encoded], { stdio: 'pipe', windowsHide: true });
|
|
381
|
+
}
|
|
382
|
+
catch (err) {
|
|
383
|
+
// Node's error message embeds the full command line (and PowerShell's
|
|
384
|
+
// stderr can echo the script), both of which carry the key -- never
|
|
385
|
+
// surface either; report only the exit status.
|
|
386
|
+
throw new Error(`powershell exited with status ${err?.status ?? 'unknown'} while setting ${envVarName}`);
|
|
387
|
+
}
|
|
358
388
|
return;
|
|
359
389
|
}
|
|
360
390
|
// Linux / macOS: append to shell profiles
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** The ONE pin (src/cli/beads-pin.ts) -- never a second literal here. */
|
|
2
|
+
export declare const BEADS_NPM_PACKAGE = "@beads/bd@1.3.0";
|
|
3
|
+
export declare const BEADS_INSTALL_FIX = "install bd for this user so 'bd --version' works (for example 'npm install -g @beads/bd@1.3.0' with a user-writable npm prefix), then re-run the install";
|
|
4
|
+
export interface BeadsInstallDeps {
|
|
5
|
+
platform: NodeJS.Platform;
|
|
6
|
+
/** execFileSync-shaped; returns stdout, throws on non-zero exit. */
|
|
7
|
+
exec(cmd: string, args: string[], opts: {
|
|
8
|
+
shell: boolean;
|
|
9
|
+
}): string;
|
|
10
|
+
existsSync(p: string): boolean;
|
|
11
|
+
mkdirSync(p: string): void;
|
|
12
|
+
rmSync(p: string): void;
|
|
13
|
+
copyFileSync(src: string, dest: string): void;
|
|
14
|
+
chmodSync(p: string, mode: number): void;
|
|
15
|
+
}
|
|
16
|
+
export type BeadsInstallResult = {
|
|
17
|
+
state: 'present';
|
|
18
|
+
version: string;
|
|
19
|
+
location: 'path' | 'bin-dir';
|
|
20
|
+
binPath?: string;
|
|
21
|
+
} | {
|
|
22
|
+
state: 'installed';
|
|
23
|
+
version: string;
|
|
24
|
+
location: 'npm-global' | 'bin-dir';
|
|
25
|
+
binPath?: string;
|
|
26
|
+
} | {
|
|
27
|
+
state: 'missing';
|
|
28
|
+
reason: string;
|
|
29
|
+
fix: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function beadsBinaryName(platform: NodeJS.Platform): string;
|
|
32
|
+
/** Short, single-line reason from a failed exec (prefers npm's own error code). */
|
|
33
|
+
export declare function describeExecFailure(err: unknown): string;
|
|
34
|
+
export declare function installBeads(binDir: string, deps: BeadsInstallDeps): BeadsInstallResult;
|
|
35
|
+
//# sourceMappingURL=beads-install.d.ts.map
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beads (bd) CLI install step for `apra-fleet install`.
|
|
3
|
+
*
|
|
4
|
+
* Order, first hit wins:
|
|
5
|
+
* 1. a bd already on PATH that answers --version -> left untouched;
|
|
6
|
+
* 2. a bd already in BIN_DIR (<home>/.apra-fleet/bin) -> left untouched;
|
|
7
|
+
* 3. `npm install -g` of the pinned package, kept only when the result then
|
|
8
|
+
* resolves on PATH (the long-standing behaviour where it works);
|
|
9
|
+
* 4. otherwise -- typically a root-owned global npm prefix (EACCES) for a
|
|
10
|
+
* plain user -- a NON-global `npm install --prefix <staging>` of the same
|
|
11
|
+
* pinned package, whose postinstall downloads bd's native binary; that
|
|
12
|
+
* binary is copied into BIN_DIR next to the fleet's portable dolt. No
|
|
13
|
+
* writable global prefix and no admin rights are needed.
|
|
14
|
+
*
|
|
15
|
+
* BIN_DIR is appended to PATH by every member-bound command the fleet builds
|
|
16
|
+
* (src/os/linux.ts / windows.ts: dispatch and execute_command), so a bd placed
|
|
17
|
+
* there resolves for dispatched sessions and fleet-sprint's own bd commands.
|
|
18
|
+
*
|
|
19
|
+
* Never throws: a failure is returned with a reason and a one-line fix so the
|
|
20
|
+
* installer can print both and the summary can name them.
|
|
21
|
+
*/
|
|
22
|
+
import path from 'node:path';
|
|
23
|
+
import { BEADS_PACKAGE } from './beads-pin.js';
|
|
24
|
+
/** The ONE pin (src/cli/beads-pin.ts) -- never a second literal here. */
|
|
25
|
+
export const BEADS_NPM_PACKAGE = BEADS_PACKAGE;
|
|
26
|
+
export const BEADS_INSTALL_FIX = `install bd for this user so 'bd --version' works (for example 'npm install -g ${BEADS_NPM_PACKAGE}' with a user-writable npm prefix), then re-run the install`;
|
|
27
|
+
export function beadsBinaryName(platform) {
|
|
28
|
+
return platform === 'win32' ? 'bd.exe' : 'bd';
|
|
29
|
+
}
|
|
30
|
+
/** First non-empty output line, e.g. "bd version 1.3.0 (abc)". */
|
|
31
|
+
function firstLine(out) {
|
|
32
|
+
return String(out ?? '').split(/\r?\n/).map(l => l.trim()).find(Boolean) ?? '';
|
|
33
|
+
}
|
|
34
|
+
/** Short, single-line reason from a failed exec (prefers npm's own error code). */
|
|
35
|
+
export function describeExecFailure(err) {
|
|
36
|
+
const e = err;
|
|
37
|
+
const text = `${String(e?.stderr ?? '')}\n${String(e?.stdout ?? '')}\n${e?.message ?? ''}`;
|
|
38
|
+
if (/\bEACCES\b|\bEPERM\b|permission denied/i.test(text)) {
|
|
39
|
+
const where = /(?:EACCES|EPERM)[^\n]*?['"]?((?:\/|[A-Za-z]:\\)[^'"\s]+)/.exec(text)?.[1];
|
|
40
|
+
return `permission denied${where ? ` writing ${where}` : ''} (the global npm prefix is not writable by this user)`;
|
|
41
|
+
}
|
|
42
|
+
if (e?.code === 'ENOENT' || /npm(?:\.cmd)?: (?:command )?not found|'npm' is not recognized|not recognized as an internal or external command/i.test(text)) {
|
|
43
|
+
return 'npm is not available on PATH';
|
|
44
|
+
}
|
|
45
|
+
const tail = text.split(/\r?\n/).map(l => l.trim()).filter(Boolean).slice(-2).join(' ');
|
|
46
|
+
return (tail || 'unknown error').slice(0, 300);
|
|
47
|
+
}
|
|
48
|
+
function probe(deps, cmd, shell) {
|
|
49
|
+
try {
|
|
50
|
+
return firstLine(deps.exec(cmd, ['--version'], { shell })) || 'installed';
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** Quote a path for the shell:true npm call (args are joined unquoted). */
|
|
57
|
+
function shellQuote(p, platform) {
|
|
58
|
+
return platform === 'win32' ? `"${p}"` : `'${p.replace(/'/g, `'\\''`)}'`;
|
|
59
|
+
}
|
|
60
|
+
export function installBeads(binDir, deps) {
|
|
61
|
+
const binPath = path.join(binDir, beadsBinaryName(deps.platform));
|
|
62
|
+
// shell:true -- on Windows an npm-global bd is a .cmd wrapper Node cannot spawn directly.
|
|
63
|
+
const onPath = probe(deps, 'bd', true);
|
|
64
|
+
if (onPath)
|
|
65
|
+
return { state: 'present', version: onPath, location: 'path' };
|
|
66
|
+
if (deps.existsSync(binPath)) {
|
|
67
|
+
const inBin = probe(deps, binPath, false);
|
|
68
|
+
if (inBin)
|
|
69
|
+
return { state: 'present', version: inBin, location: 'bin-dir', binPath };
|
|
70
|
+
}
|
|
71
|
+
let globalFailure = null;
|
|
72
|
+
try {
|
|
73
|
+
deps.exec('npm', ['install', '-g', BEADS_NPM_PACKAGE], { shell: true });
|
|
74
|
+
const v = probe(deps, 'bd', true);
|
|
75
|
+
if (v)
|
|
76
|
+
return { state: 'installed', version: v, location: 'npm-global' };
|
|
77
|
+
globalFailure = 'npm install -g succeeded but bd is not on PATH (the npm global bin dir is not on PATH)';
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
globalFailure = describeExecFailure(err);
|
|
81
|
+
}
|
|
82
|
+
const staging = path.join(path.dirname(binDir), 'staging', 'beads');
|
|
83
|
+
try {
|
|
84
|
+
try {
|
|
85
|
+
deps.rmSync(staging);
|
|
86
|
+
}
|
|
87
|
+
catch { /* nothing to clear */ }
|
|
88
|
+
deps.mkdirSync(staging);
|
|
89
|
+
deps.exec('npm', [
|
|
90
|
+
'install', '--prefix', shellQuote(staging, deps.platform),
|
|
91
|
+
'--no-save', '--no-package-lock', '--no-audit', '--no-fund', BEADS_NPM_PACKAGE,
|
|
92
|
+
], { shell: true });
|
|
93
|
+
const native = path.join(staging, 'node_modules', '@beads', 'bd', 'bin', beadsBinaryName(deps.platform));
|
|
94
|
+
if (!deps.existsSync(native)) {
|
|
95
|
+
return {
|
|
96
|
+
state: 'missing',
|
|
97
|
+
reason: `global install failed (${globalFailure}); the user-level install did not produce the bd binary (its postinstall download failed: ${native} is missing)`,
|
|
98
|
+
fix: BEADS_INSTALL_FIX,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
deps.mkdirSync(binDir);
|
|
102
|
+
deps.copyFileSync(native, binPath);
|
|
103
|
+
if (deps.platform !== 'win32')
|
|
104
|
+
deps.chmodSync(binPath, 0o755);
|
|
105
|
+
const v = probe(deps, binPath, false);
|
|
106
|
+
if (!v) {
|
|
107
|
+
return { state: 'missing', reason: `global install failed (${globalFailure}); ${binPath} was installed but does not run`, fix: BEADS_INSTALL_FIX };
|
|
108
|
+
}
|
|
109
|
+
return { state: 'installed', version: v, location: 'bin-dir', binPath };
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
return {
|
|
113
|
+
state: 'missing',
|
|
114
|
+
reason: `global install failed (${globalFailure}); user-level install into ${binDir} failed (${describeExecFailure(err)})`,
|
|
115
|
+
fix: BEADS_INSTALL_FIX,
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
try {
|
|
120
|
+
deps.rmSync(staging);
|
|
121
|
+
}
|
|
122
|
+
catch { /* best effort */ }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=beads-install.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** The exact @beads/bd version this product installs and supports. */
|
|
2
|
+
export declare const BEADS_VERSION = "1.3.0";
|
|
3
|
+
/** The npm package specifier to install -- always built from BEADS_VERSION. */
|
|
4
|
+
export declare const BEADS_PACKAGE = "@beads/bd@1.3.0";
|
|
5
|
+
//# sourceMappingURL=beads-pin.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Single source of truth for the Beads (bd) npm pin (apra-fleet-i9ag.13.7.2).
|
|
2
|
+
//
|
|
3
|
+
// bd ships as an npm GLOBAL package, not a standalone release binary -- the
|
|
4
|
+
// owner re-scope recorded on apra-fleet-i9ag.13 (which supersedes that bead's
|
|
5
|
+
// original description) removed the download-a-release-binary approach and the
|
|
6
|
+
// src/cli/beads-install.ts module that used to own this constant. That left
|
|
7
|
+
// the pin as a bare literal in src/cli/install.ts while
|
|
8
|
+
// packages/apra-fleet-se/apra-pm/install.mjs kept its own copy, i.e. no single
|
|
9
|
+
// owner at all -- the exact drift shape that caused apra-fleet-i9ag.12.4 (the
|
|
10
|
+
// pm installer pinned 1.1.2 long after the product moved to 1.3.0).
|
|
11
|
+
//
|
|
12
|
+
// This module is that owner. It is deliberately dependency-free (no imports,
|
|
13
|
+
// no side effects) so anything may import it -- the installer, tests, and any
|
|
14
|
+
// future status/health reporter -- without dragging in the installer itself.
|
|
15
|
+
//
|
|
16
|
+
// The ONE unavoidable duplicate is packages/apra-fleet-se/apra-pm/install.mjs:
|
|
17
|
+
// that installer is deliberately plain, build-free Node (node: builtins only)
|
|
18
|
+
// and so cannot import from this TypeScript module. Its copy is held equal to
|
|
19
|
+
// this one by tests/apra-pm-beads-pin.test.ts, which fails the moment the two
|
|
20
|
+
// disagree. .github/workflows/ci.yml states the pin a third time for the same
|
|
21
|
+
// reason (a shell step cannot import TypeScript either); that file is owned by
|
|
22
|
+
// another track, so it is deliberately not edited from here.
|
|
23
|
+
/** The exact @beads/bd version this product installs and supports. */
|
|
24
|
+
export const BEADS_VERSION = '1.3.0';
|
|
25
|
+
/** The npm package specifier to install -- always built from BEADS_VERSION. */
|
|
26
|
+
export const BEADS_PACKAGE = `@beads/bd@${BEADS_VERSION}`;
|
|
27
|
+
//# sourceMappingURL=beads-pin.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface CallIo {
|
|
2
|
+
out(text: string): void;
|
|
3
|
+
err(text: string): void;
|
|
4
|
+
}
|
|
5
|
+
export interface CallDeps {
|
|
6
|
+
io?: CallIo;
|
|
7
|
+
readFile?: (p: string) => string;
|
|
8
|
+
removeFile?: (p: string) => void;
|
|
9
|
+
/** Connect a member session; defaults to the client's connectFleetMember. */
|
|
10
|
+
connect?: (memberId: string, opts: {
|
|
11
|
+
kbMaintainer: boolean;
|
|
12
|
+
}) => Promise<{
|
|
13
|
+
transport: {
|
|
14
|
+
stop?: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** Releases the server-side session (HTTP DELETE); preferred over transport.stop(). */
|
|
17
|
+
close?: () => Promise<void>;
|
|
18
|
+
mcpClient: {
|
|
19
|
+
callTool(name: string, args: unknown): Promise<unknown>;
|
|
20
|
+
listTools(): Promise<unknown>;
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/** Returns the process exit code. */
|
|
25
|
+
export declare function runCall(argv: string[], deps?: CallDeps): Promise<number>;
|
|
26
|
+
export declare function runCallCli(argv: string[]): void;
|
|
27
|
+
//# sourceMappingURL=call.d.ts.map
|
package/dist/cli/call.js
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `apra-fleet call` -- generic member-session tool call.
|
|
3
|
+
*
|
|
4
|
+
* apra-fleet call --member <uuid> [--kb-maintainer] <tool> [--args-file <path>]
|
|
5
|
+
* apra-fleet call --member <uuid> [--kb-maintainer] --list-tools
|
|
6
|
+
*
|
|
7
|
+
* Opens a MEMBER session (?member=<uuid>) against the LOCAL server through
|
|
8
|
+
* apra-fleet-client, so the server's own input schema validates the arguments
|
|
9
|
+
* and the member tool allowlist applies. Arguments are ALWAYS read from a JSON
|
|
10
|
+
* file -- there is deliberately no inline-JSON flag. Without --args-file the
|
|
11
|
+
* arguments are {}, allowed only for a tool whose input schema requires none. The session is opened with
|
|
12
|
+
* origin=engine, so its kb_/code_ calls are excluded from session_stats. Failures are printed as a
|
|
13
|
+
* structured JSON error on stderr and the exit code is non-zero.
|
|
14
|
+
*
|
|
15
|
+
* --kb-maintainer adds the engine's kb_maintainer grant (kb_maintainer=1): the
|
|
16
|
+
* session is also served kb_promote, kb_resolve_contradiction and
|
|
17
|
+
* kb_reconcile_prefilter, and may pass kb_import an explicit path. Remote
|
|
18
|
+
* memberCall passes it only when calling as a repository's kb_maintainer.
|
|
19
|
+
*/
|
|
20
|
+
import fs from 'node:fs';
|
|
21
|
+
const USAGE = `apra-fleet call -- call a tool as a registered member session
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
apra-fleet call --member <uuid> [--kb-maintainer] <tool> [--args-file <path>]
|
|
25
|
+
apra-fleet call --member <uuid> [--kb-maintainer] --list-tools
|
|
26
|
+
|
|
27
|
+
--member <uuid> Registered member id (an unregistered id fails with HTTP 403)
|
|
28
|
+
--args-file <path> JSON file holding the tool arguments (a JSON object); omit it
|
|
29
|
+
for a tool with no required arguments (they default to {})
|
|
30
|
+
--rm-args-file Delete the args file once read (used by remote memberCall)
|
|
31
|
+
--kb-maintainer Open the session with the kb_maintainer grant (adds kb_promote
|
|
32
|
+
and kb_resolve_contradiction; used by memberCall for the
|
|
33
|
+
repository's kb_maintainer)
|
|
34
|
+
--list-tools Print the member session's tools/list
|
|
35
|
+
--help, -h Show this help`;
|
|
36
|
+
function parse(argv) {
|
|
37
|
+
const out = { listTools: false, rmArgsFile: false, kbMaintainer: false, help: false };
|
|
38
|
+
for (let i = 0; i < argv.length; i++) {
|
|
39
|
+
const a = argv[i];
|
|
40
|
+
if (a === '--help' || a === '-h')
|
|
41
|
+
out.help = true;
|
|
42
|
+
else if (a === '--list-tools')
|
|
43
|
+
out.listTools = true;
|
|
44
|
+
else if (a === '--rm-args-file')
|
|
45
|
+
out.rmArgsFile = true;
|
|
46
|
+
else if (a === '--kb-maintainer')
|
|
47
|
+
out.kbMaintainer = true;
|
|
48
|
+
else if (a === '--member' || a === '--args-file') {
|
|
49
|
+
const v = argv[++i];
|
|
50
|
+
if (v === undefined || v.startsWith('--'))
|
|
51
|
+
return { error: `${a} requires a value` };
|
|
52
|
+
if (a === '--member')
|
|
53
|
+
out.member = v;
|
|
54
|
+
else
|
|
55
|
+
out.argsFile = v;
|
|
56
|
+
}
|
|
57
|
+
else if (a.startsWith('--'))
|
|
58
|
+
return { error: `unknown option ${a}` };
|
|
59
|
+
else if (out.tool === undefined)
|
|
60
|
+
out.tool = a;
|
|
61
|
+
else
|
|
62
|
+
return { error: `unexpected argument ${a}` };
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
function fail(io, code, message, extra = {}) {
|
|
67
|
+
io.err(JSON.stringify({ error: { code, message, ...extra } }));
|
|
68
|
+
return 1;
|
|
69
|
+
}
|
|
70
|
+
/** The required argument names of `tool` in a tools/list answer ([] when the
|
|
71
|
+
* tool is not listed: the server then reports the unknown tool itself). */
|
|
72
|
+
function requiredArgs(list, tool) {
|
|
73
|
+
const tools = list?.tools;
|
|
74
|
+
const t = Array.isArray(tools) ? tools.find(x => x?.name === tool) : undefined;
|
|
75
|
+
const req = t?.inputSchema?.required;
|
|
76
|
+
return Array.isArray(req) ? req.map(String) : [];
|
|
77
|
+
}
|
|
78
|
+
/** Returns the process exit code. */
|
|
79
|
+
export async function runCall(argv, deps = {}) {
|
|
80
|
+
const io = deps.io ?? { out: t => console.log(t), err: t => console.error(t) };
|
|
81
|
+
const parsed = parse(argv);
|
|
82
|
+
if ('error' in parsed)
|
|
83
|
+
return fail(io, 'E-USAGE', parsed.error);
|
|
84
|
+
if (parsed.help) {
|
|
85
|
+
io.out(USAGE);
|
|
86
|
+
return 0;
|
|
87
|
+
}
|
|
88
|
+
if (!parsed.member)
|
|
89
|
+
return fail(io, 'E-USAGE', '--member <uuid> is required');
|
|
90
|
+
if (parsed.listTools) {
|
|
91
|
+
if (parsed.tool || parsed.argsFile)
|
|
92
|
+
return fail(io, 'E-USAGE', '--list-tools takes no tool name or --args-file');
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
if (!parsed.tool)
|
|
96
|
+
return fail(io, 'E-USAGE', 'a tool name is required (or use --list-tools)');
|
|
97
|
+
if (parsed.rmArgsFile && !parsed.argsFile)
|
|
98
|
+
return fail(io, 'E-USAGE', '--rm-args-file requires --args-file <path>');
|
|
99
|
+
}
|
|
100
|
+
// No --args-file: the arguments default to {} -- checked against the tool's
|
|
101
|
+
// input schema once connected (a tool with required arguments still needs a file).
|
|
102
|
+
let args = parsed.listTools ? undefined : {};
|
|
103
|
+
if (!parsed.listTools && parsed.argsFile) {
|
|
104
|
+
try {
|
|
105
|
+
args = JSON.parse((deps.readFile ?? (p => fs.readFileSync(p, 'utf8')))(parsed.argsFile));
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
return fail(io, 'E-ARGS-FILE', `cannot read JSON from ${parsed.argsFile}: ${e.message}`);
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
if (parsed.rmArgsFile) {
|
|
112
|
+
try {
|
|
113
|
+
(deps.removeFile ?? (p => fs.rmSync(p, { force: true })))(parsed.argsFile);
|
|
114
|
+
}
|
|
115
|
+
catch { /* ignore */ }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
if (args === null || typeof args !== 'object' || Array.isArray(args)) {
|
|
119
|
+
return fail(io, 'E-ARGS-FILE', `${parsed.argsFile} must contain a JSON object`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const connect = deps.connect ?? (async (id, opts) => {
|
|
123
|
+
const m = await import('@apralabs/apra-fleet-client/server-resolution');
|
|
124
|
+
// origin=engine: this verb is the engine acting as the member (remote
|
|
125
|
+
// memberCall), so its kb_/code_ calls are not counted in session_stats.
|
|
126
|
+
return m.connectFleetMember(id, { origin: 'engine', ...(opts.kbMaintainer ? { kbMaintainer: true } : {}) });
|
|
127
|
+
});
|
|
128
|
+
let session;
|
|
129
|
+
try {
|
|
130
|
+
session = await connect(parsed.member, { kbMaintainer: parsed.kbMaintainer });
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
const err = e;
|
|
134
|
+
if (err.status === 403) {
|
|
135
|
+
return fail(io, 'E-MEMBER-FORBIDDEN', `server refused member ${parsed.member}: not a registered member (HTTP 403)`, { status: 403 });
|
|
136
|
+
}
|
|
137
|
+
if (err.status === 401) {
|
|
138
|
+
return fail(io, 'E-MEMBER-SECRET', `server refused the member session for ${parsed.member}: the member access secret (member-access.key in this install's data dir) was missing or did not match (HTTP 401). Run this as the install's own user, with the same APRA_FLEET_DATA_DIR as its server.`, { status: 401 });
|
|
139
|
+
}
|
|
140
|
+
return fail(io, err.code ?? 'E-CONNECT', err.message);
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
if (parsed.listTools) {
|
|
144
|
+
io.out(JSON.stringify(await session.mcpClient.listTools()));
|
|
145
|
+
return 0;
|
|
146
|
+
}
|
|
147
|
+
if (!parsed.argsFile) {
|
|
148
|
+
const required = requiredArgs(await session.mcpClient.listTools(), parsed.tool);
|
|
149
|
+
if (required.length) {
|
|
150
|
+
return fail(io, 'E-USAGE', `--args-file <path> is required (${parsed.tool} requires: ${required.join(', ')})`, { tool: parsed.tool });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
const result = await session.mcpClient.callTool(parsed.tool, args);
|
|
154
|
+
if (result && result.isError) {
|
|
155
|
+
const text = (result.content ?? []).map(c => c.text ?? '').join('\n');
|
|
156
|
+
return fail(io, 'E-TOOL', text || 'tool returned an error', { tool: parsed.tool });
|
|
157
|
+
}
|
|
158
|
+
io.out(JSON.stringify(result));
|
|
159
|
+
return 0;
|
|
160
|
+
}
|
|
161
|
+
catch (e) {
|
|
162
|
+
return fail(io, 'E-CALL', e.message, { tool: parsed.tool });
|
|
163
|
+
}
|
|
164
|
+
finally {
|
|
165
|
+
try {
|
|
166
|
+
if (session.close)
|
|
167
|
+
await session.close();
|
|
168
|
+
else
|
|
169
|
+
session.transport.stop?.();
|
|
170
|
+
}
|
|
171
|
+
catch { /* ignore */ }
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
export function runCallCli(argv) {
|
|
175
|
+
runCall(argv).then(code => process.exit(code), e => { console.error(String(e)); process.exit(1); });
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=call.js.map
|
package/dist/cli/config.d.ts
CHANGED
|
@@ -37,7 +37,30 @@ export declare function getProviderInstallConfig(provider: LlmProvider, homeDir?
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function getAgentsDirRelative(provider: LlmProvider): string | undefined;
|
|
39
39
|
export declare function readConfig(paths: ProviderInstallConfig): any;
|
|
40
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Write a file that carries a credential: owner-only (0600), never briefly
|
|
42
|
+
* readable by others. writeFileSync's mode applies only when the file is
|
|
43
|
+
* created, so an existing file (a provider config the user already had, at
|
|
44
|
+
* 0644) is chmod-ed BEFORE the credential is written into it; a new file is
|
|
45
|
+
* created 0600. The final chmod pins exactly 0600 whatever the umask.
|
|
46
|
+
*/
|
|
47
|
+
export declare function writeOwnerOnlyFile(file: string, content: string): void;
|
|
48
|
+
/**
|
|
49
|
+
* writeOwnerOnlyFile for a file another process saves concurrently (Claude
|
|
50
|
+
* Code's ~/.claude.json): the content goes to an owner-only temp file in the
|
|
51
|
+
* same directory, then replaces the target by rename, so a crash or a racing
|
|
52
|
+
* save never leaves it truncated. When the rename fails (e.g. the target is
|
|
53
|
+
* briefly locked on Windows) it falls back to the in-place owner-only write.
|
|
54
|
+
* A symlinked file keeps its link: the temp file is placed next to, and
|
|
55
|
+
* renamed over, the link's real target. On POSIX a file owned by another uid
|
|
56
|
+
* (e.g. install run under sudo) is written in place, since a rename would
|
|
57
|
+
* hand it to the current user. The temp file takes the existing file's
|
|
58
|
+
* owner permission bits (never group/other).
|
|
59
|
+
*/
|
|
60
|
+
export declare function writeOwnerOnlyFileAtomic(file: string, content: string): void;
|
|
61
|
+
export declare function writeConfig(paths: ProviderInstallConfig, config: any, opts?: {
|
|
62
|
+
ownerOnly?: boolean;
|
|
63
|
+
}): void;
|
|
41
64
|
export declare function readInstallConfig(installConfigPath?: string): MultiProviderInstallConfig;
|
|
42
65
|
export declare function writeInstallConfig(llm: string, skill: 'none' | 'all' | 'fleet' | 'pm', workflowsMode?: 'all' | 'none'): void;
|
|
43
66
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/cli/config.js
CHANGED
|
@@ -141,7 +141,71 @@ export function readConfig(paths) {
|
|
|
141
141
|
return {};
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
/**
|
|
145
|
+
* Write a file that carries a credential: owner-only (0600), never briefly
|
|
146
|
+
* readable by others. writeFileSync's mode applies only when the file is
|
|
147
|
+
* created, so an existing file (a provider config the user already had, at
|
|
148
|
+
* 0644) is chmod-ed BEFORE the credential is written into it; a new file is
|
|
149
|
+
* created 0600. The final chmod pins exactly 0600 whatever the umask.
|
|
150
|
+
*/
|
|
151
|
+
export function writeOwnerOnlyFile(file, content) {
|
|
152
|
+
try {
|
|
153
|
+
fs.chmodSync(file, 0o600);
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
if (err.code !== 'ENOENT')
|
|
157
|
+
throw err;
|
|
158
|
+
}
|
|
159
|
+
fs.writeFileSync(file, content, { mode: 0o600 });
|
|
160
|
+
fs.chmodSync(file, 0o600);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* writeOwnerOnlyFile for a file another process saves concurrently (Claude
|
|
164
|
+
* Code's ~/.claude.json): the content goes to an owner-only temp file in the
|
|
165
|
+
* same directory, then replaces the target by rename, so a crash or a racing
|
|
166
|
+
* save never leaves it truncated. When the rename fails (e.g. the target is
|
|
167
|
+
* briefly locked on Windows) it falls back to the in-place owner-only write.
|
|
168
|
+
* A symlinked file keeps its link: the temp file is placed next to, and
|
|
169
|
+
* renamed over, the link's real target. On POSIX a file owned by another uid
|
|
170
|
+
* (e.g. install run under sudo) is written in place, since a rename would
|
|
171
|
+
* hand it to the current user. The temp file takes the existing file's
|
|
172
|
+
* owner permission bits (never group/other).
|
|
173
|
+
*/
|
|
174
|
+
export function writeOwnerOnlyFileAtomic(file, content) {
|
|
175
|
+
let target = file;
|
|
176
|
+
try {
|
|
177
|
+
const real = fs.realpathSync(file);
|
|
178
|
+
if (typeof real === 'string' && real)
|
|
179
|
+
target = real;
|
|
180
|
+
}
|
|
181
|
+
catch { /* missing: write at `file` */ }
|
|
182
|
+
let st;
|
|
183
|
+
try {
|
|
184
|
+
st = fs.statSync(target);
|
|
185
|
+
}
|
|
186
|
+
catch { /* new file */ }
|
|
187
|
+
const getuid = process.getuid;
|
|
188
|
+
if (st && typeof getuid === 'function' && typeof st.uid === 'number' && st.uid !== getuid()) {
|
|
189
|
+
writeOwnerOnlyFile(target, content);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
const mode = st && typeof st.mode === 'number' && (st.mode & 0o700) ? (st.mode & 0o700) | 0o600 : 0o600;
|
|
193
|
+
const tmp = path.join(path.dirname(target), `.${path.basename(target)}.${process.pid}.${Date.now()}.tmp`);
|
|
194
|
+
try {
|
|
195
|
+
fs.writeFileSync(tmp, content, { mode, flag: 'wx' });
|
|
196
|
+
fs.chmodSync(tmp, mode);
|
|
197
|
+
fs.renameSync(tmp, target);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
try {
|
|
202
|
+
fs.unlinkSync(tmp);
|
|
203
|
+
}
|
|
204
|
+
catch { /* not created / already moved */ }
|
|
205
|
+
}
|
|
206
|
+
writeOwnerOnlyFile(target, content);
|
|
207
|
+
}
|
|
208
|
+
export function writeConfig(paths, config, opts = {}) {
|
|
145
209
|
fs.mkdirSync(paths.configDir, { recursive: true });
|
|
146
210
|
let content = '';
|
|
147
211
|
if (paths.settingsFile.endsWith('.toml')) {
|
|
@@ -150,7 +214,10 @@ export function writeConfig(paths, config) {
|
|
|
150
214
|
else {
|
|
151
215
|
content = JSON.stringify(config, null, 2) + '\n';
|
|
152
216
|
}
|
|
153
|
-
|
|
217
|
+
if (opts.ownerOnly)
|
|
218
|
+
writeOwnerOnlyFile(paths.settingsFile, content);
|
|
219
|
+
else
|
|
220
|
+
fs.writeFileSync(paths.settingsFile, content);
|
|
154
221
|
}
|
|
155
222
|
export function readInstallConfig(installConfigPath = INSTALL_CONFIG_PATH) {
|
|
156
223
|
if (!fs.existsSync(installConfigPath)) {
|
|
@@ -68,9 +68,25 @@ export interface DoltVerifyDeps {
|
|
|
68
68
|
getEphemeralPort: () => Promise<number>;
|
|
69
69
|
waitForConnect: (port: number, timeoutMs: number) => Promise<boolean>;
|
|
70
70
|
};
|
|
71
|
-
/** Terminates the spawned dolt sql-server child
|
|
72
|
-
killChild: (child: ChildProcess) => void
|
|
71
|
+
/** Terminates the spawned dolt sql-server child in bounded time (see killChild). */
|
|
72
|
+
killChild: (child: ChildProcess) => void | Promise<void>;
|
|
73
73
|
}
|
|
74
|
+
/** Seams for killChild so tests drive both OS branches on any runner. */
|
|
75
|
+
export interface KillChildOpts {
|
|
76
|
+
platform?: NodeJS.Platform;
|
|
77
|
+
execFileSync?: typeof execFileSync;
|
|
78
|
+
/** Bounded wait (ms) for the child to exit after each kill attempt. Default 3000. */
|
|
79
|
+
waitMs?: number;
|
|
80
|
+
warn?: (msg: string) => void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Terminate the dolt verify child in bounded time on every OS. child.kill()
|
|
84
|
+
* first (TerminateProcess on Windows, SIGKILL on POSIX): it needs no WMI, so it
|
|
85
|
+
* works for a standard user on a network (SSH) logon, where taskkill /T is
|
|
86
|
+
* denied. taskkill /F /T is only the Windows fallback. The child is always unref'd so a survivor can never
|
|
87
|
+
* keep the installer from exiting; a survivor is reported, not silently left.
|
|
88
|
+
*/
|
|
89
|
+
export declare function killChild(child: ChildProcess, opts?: KillChildOpts): Promise<void>;
|
|
74
90
|
/**
|
|
75
91
|
* Proves a downloaded dolt binary is actually usable:
|
|
76
92
|
* 1. Runs `dolt version` (execFileSync, shell:true on Windows per the
|