@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/utils/auth-env.js
CHANGED
|
@@ -1,30 +1,59 @@
|
|
|
1
1
|
import { decryptPassword } from './crypto.js';
|
|
2
|
-
import {
|
|
2
|
+
import { escapeShellArg, escapePowerShellArg } from './shell-escape.js';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Stored member auth env vars (encryptedEnvVars) reach the member's CLI
|
|
5
|
+
* process through a short-lived owner-only FILE, never through the command
|
|
6
|
+
* line: anything in a member-bound command string ends up in the argv of the
|
|
7
|
+
* member's shell (`bash -c <cmd>` / `powershell -c <cmd>`) for the lifetime of
|
|
8
|
+
* the dispatch, readable by every local user via ps or /proc/<pid>/cmdline.
|
|
9
|
+
*
|
|
10
|
+
* The flow (see services/member-secret-env.ts):
|
|
11
|
+
* 1. buildAuthEnvFileContent() renders the values for the member's shell;
|
|
12
|
+
* 2. the file is written over SFTP (remote) or fs (local) -- no argv;
|
|
13
|
+
* 3. buildAuthEnvSourcePrefix() returns a prefix that carries ONLY the file
|
|
14
|
+
* path: it loads the file into the shell's environment and deletes it
|
|
15
|
+
* before the CLI starts, so the CLI inherits the variables.
|
|
6
16
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// PowerShell: single-quote escaping (matching windows.ts envPrefix pattern)
|
|
16
|
-
const escaped = value.replace(/'/g, "''");
|
|
17
|
-
parts.push(`$env:${name}='${escaped}'`);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
// Linux/macOS: double-quote escaping
|
|
21
|
-
const escaped = escapeDoubleQuoted(value);
|
|
22
|
-
parts.push(`export ${name}="${escaped}"`);
|
|
23
|
-
}
|
|
17
|
+
const ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
18
|
+
/** Decrypted stored auth env vars for the member ({} when none). */
|
|
19
|
+
export function decryptAuthEnvVars(agent) {
|
|
20
|
+
const out = {};
|
|
21
|
+
for (const [name, encrypted] of Object.entries(agent.encryptedEnvVars ?? {})) {
|
|
22
|
+
if (!ENV_NAME_RE.test(name))
|
|
23
|
+
throw new Error(`Invalid stored env var name: ${name}`);
|
|
24
|
+
out[name] = decryptPassword(encrypted);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* File content for the member's shell.
|
|
30
|
+
* - POSIX: `export NAME='value'` lines (single-quoted: fully literal, safe for
|
|
31
|
+
* any byte including newlines), loaded with `.`.
|
|
32
|
+
* - PowerShell: `NAME=<base64(utf8 value)>` lines, parsed (never executed --
|
|
33
|
+
* no execution-policy or quoting exposure).
|
|
34
|
+
*/
|
|
35
|
+
export function buildAuthEnvFileContent(vars, posix) {
|
|
36
|
+
const lines = Object.entries(vars).map(([name, value]) => {
|
|
37
|
+
if (!ENV_NAME_RE.test(name))
|
|
38
|
+
throw new Error(`Invalid env var name: ${name}`);
|
|
39
|
+
return posix
|
|
40
|
+
? `export ${name}=${escapeShellArg(value)}`
|
|
41
|
+
: `${name}=${Buffer.from(value, 'utf-8').toString('base64')}`;
|
|
42
|
+
});
|
|
43
|
+
return lines.join('\n') + '\n';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Command prefix that loads the staged file into the current shell's
|
|
47
|
+
* environment and deletes it. Carries only the file path, never a value.
|
|
48
|
+
* POSIX: a missing/unreadable file short-circuits the `&&` chain (no
|
|
49
|
+
* unauthenticated run). PowerShell: fails loudly with exit 1.
|
|
50
|
+
*/
|
|
51
|
+
export function buildAuthEnvSourcePrefix(filePath, posix) {
|
|
52
|
+
if (posix) {
|
|
53
|
+
const q = escapeShellArg(filePath);
|
|
54
|
+
return `. ${q} && rm -f ${q} && `;
|
|
27
55
|
}
|
|
28
|
-
|
|
56
|
+
const q = escapePowerShellArg(filePath);
|
|
57
|
+
return `$__fleetEnv = ${q}; try { foreach ($__l in [IO.File]::ReadAllLines($__fleetEnv)) { $__i = $__l.IndexOf('='); if ($__i -gt 0) { [Environment]::SetEnvironmentVariable($__l.Substring(0, $__i), [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String($__l.Substring($__i + 1))), 'Process') } } } catch { [Console]::Error.WriteLine('apra-fleet: could not load the member credential file'); exit 1 } finally { Remove-Item -LiteralPath $__fleetEnv -Force -ErrorAction SilentlyContinue }; `;
|
|
29
58
|
}
|
|
30
59
|
//# sourceMappingURL=auth-env.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface FindOnPathOptions {
|
|
2
|
+
/** PATH string to search (default: process.env.PATH). */
|
|
3
|
+
envPath?: string;
|
|
4
|
+
/** Platform whose PATH rules apply (default: process.platform). */
|
|
5
|
+
platform?: NodeJS.Platform;
|
|
6
|
+
/** PATHEXT for win32 (default: process.env.PATHEXT). */
|
|
7
|
+
pathExt?: string;
|
|
8
|
+
/** File-existence check (default: statSync(...).isFile()). Injected by tests. */
|
|
9
|
+
isFile?: (p: string) => boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Split a PATH string with the target platform's delimiter, dropping empty
|
|
13
|
+
* entries. On win32 an entry may be wrapped in double quotes (to carry a `;`
|
|
14
|
+
* or spaces); those are stripped, since a quoted dir is not a valid path.
|
|
15
|
+
*/
|
|
16
|
+
export declare function splitPath(envPath: string, platform?: NodeJS.Platform): string[];
|
|
17
|
+
/** Resolve an executable on PATH (PATHEXT-aware on Windows) without a shell. */
|
|
18
|
+
export declare function findExecutableOnPath(name: string, opts?: FindOnPathOptions): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Actionable text for "npx (or the node it runs under) is not on this
|
|
21
|
+
* server's PATH". A service-managed server gets the PATH recorded in its
|
|
22
|
+
* service definition at install time, so re-running install refreshes it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function missingOnServerPathMessage(name: string, envPath?: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Null when npx (and, off Windows, the node its `#!/usr/bin/env node` shebang
|
|
27
|
+
* needs) resolve on PATH; otherwise the actionable missing-on-PATH message.
|
|
28
|
+
*/
|
|
29
|
+
export declare function npxUnavailableReason(opts?: FindOnPathOptions): string | null;
|
|
30
|
+
/**
|
|
31
|
+
* The install-time warning line when node and/or npx cannot be resolved from
|
|
32
|
+
* the installer's PATH (the PATH a service definition records), naming each
|
|
33
|
+
* missing tool; null when both resolve. Code intelligence runs through npx, so
|
|
34
|
+
* without them it stays unavailable until fixed.
|
|
35
|
+
*/
|
|
36
|
+
export declare function codeIntelPathWarning(opts?: FindOnPathOptions): string | null;
|
|
37
|
+
//# sourceMappingURL=find-on-path.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { statSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
/**
|
|
4
|
+
* A regular file; off Windows it must also carry an execute bit, so a plain
|
|
5
|
+
* (non-executable) file named node/npx is skipped the way the shell would.
|
|
6
|
+
*/
|
|
7
|
+
function defaultIsFile(p) {
|
|
8
|
+
try {
|
|
9
|
+
const st = statSync(p);
|
|
10
|
+
if (!st.isFile())
|
|
11
|
+
return false;
|
|
12
|
+
return process.platform === 'win32' || (st.mode & 0o111) !== 0;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Split a PATH string with the target platform's delimiter, dropping empty
|
|
20
|
+
* entries. On win32 an entry may be wrapped in double quotes (to carry a `;`
|
|
21
|
+
* or spaces); those are stripped, since a quoted dir is not a valid path.
|
|
22
|
+
*/
|
|
23
|
+
export function splitPath(envPath, platform = process.platform) {
|
|
24
|
+
const parts = envPath.split(platform === 'win32' ? ';' : ':');
|
|
25
|
+
return (platform === 'win32' ? parts.map((d) => d.trim().replace(/^"(.*)"$/, '$1')) : parts).filter(Boolean);
|
|
26
|
+
}
|
|
27
|
+
/** Resolve an executable on PATH (PATHEXT-aware on Windows) without a shell. */
|
|
28
|
+
export function findExecutableOnPath(name, opts = {}) {
|
|
29
|
+
const platform = opts.platform ?? process.platform;
|
|
30
|
+
const envPath = opts.envPath ?? process.env.PATH ?? '';
|
|
31
|
+
const isFile = opts.isFile ?? defaultIsFile;
|
|
32
|
+
const join = platform === 'win32' ? path.win32.join : path.posix.join;
|
|
33
|
+
const exts = platform === 'win32'
|
|
34
|
+
? ['', ...(opts.pathExt ?? process.env.PATHEXT ?? '.COM;.EXE;.BAT;.CMD').split(';').filter(Boolean)]
|
|
35
|
+
: [''];
|
|
36
|
+
for (const dir of splitPath(envPath, platform)) {
|
|
37
|
+
for (const ext of exts) {
|
|
38
|
+
const candidate = join(dir, name + ext);
|
|
39
|
+
if (isFile(candidate))
|
|
40
|
+
return candidate;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Actionable text for "npx (or the node it runs under) is not on this
|
|
47
|
+
* server's PATH". A service-managed server gets the PATH recorded in its
|
|
48
|
+
* service definition at install time, so re-running install refreshes it.
|
|
49
|
+
*/
|
|
50
|
+
export function missingOnServerPathMessage(name, envPath = process.env.PATH ?? '') {
|
|
51
|
+
return `${name} was not found on the apra-fleet server's PATH (searched: ${envPath || '<empty>'}). ` +
|
|
52
|
+
`Install Node.js (which provides node and npx), then re-run 'apra-fleet install' to refresh the service PATH ` +
|
|
53
|
+
`and restart the server.`;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Null when npx (and, off Windows, the node its `#!/usr/bin/env node` shebang
|
|
57
|
+
* needs) resolve on PATH; otherwise the actionable missing-on-PATH message.
|
|
58
|
+
*/
|
|
59
|
+
export function npxUnavailableReason(opts = {}) {
|
|
60
|
+
const platform = opts.platform ?? process.platform;
|
|
61
|
+
const envPath = opts.envPath ?? process.env.PATH ?? '';
|
|
62
|
+
const o = { ...opts, platform, envPath };
|
|
63
|
+
if (!findExecutableOnPath('npx', o))
|
|
64
|
+
return missingOnServerPathMessage('npx', envPath);
|
|
65
|
+
if (platform !== 'win32' && !findExecutableOnPath('node', o))
|
|
66
|
+
return missingOnServerPathMessage('node (required by npx)', envPath);
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The install-time warning line when node and/or npx cannot be resolved from
|
|
71
|
+
* the installer's PATH (the PATH a service definition records), naming each
|
|
72
|
+
* missing tool; null when both resolve. Code intelligence runs through npx, so
|
|
73
|
+
* without them it stays unavailable until fixed.
|
|
74
|
+
*/
|
|
75
|
+
export function codeIntelPathWarning(opts = {}) {
|
|
76
|
+
const platform = opts.platform ?? process.platform;
|
|
77
|
+
const envPath = opts.envPath ?? process.env.PATH ?? '';
|
|
78
|
+
const o = { ...opts, platform, envPath };
|
|
79
|
+
const missing = ['node', 'npx'].filter((name) => !findExecutableOnPath(name, o));
|
|
80
|
+
if (missing.length === 0)
|
|
81
|
+
return null;
|
|
82
|
+
return `${missing.join(' and ')} ${missing.length > 1 ? 'are' : 'is'} not resolvable from the installer PATH: code intelligence will be unavailable until it is fixed. ` +
|
|
83
|
+
`Install Node.js (which provides node and npx) or add it to PATH, then re-run 'apra-fleet install'.`;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=find-on-path.js.map
|
|
@@ -1,5 +1,29 @@
|
|
|
1
|
+
import { type OwnerOnlyDeps } from './owner-only-fs.js';
|
|
1
2
|
/** Returns the resolved path of the active log file, or null if logging is unavailable. */
|
|
2
3
|
export declare function getActiveLogFile(): string | null;
|
|
4
|
+
/**
|
|
5
|
+
* Open this process's log (<data dir>/logs/fleet-<pid>.log) owner-only, and
|
|
6
|
+
* tighten the data dir, the logs dir and the service log (<data dir>/fleet.log,
|
|
7
|
+
* written by `apra-fleet start` and the OS service manager) to the owner too.
|
|
8
|
+
* Server logs carry member ids, paths and session handles, so they must not be
|
|
9
|
+
* group/world-readable: POSIX dirs 0700 and files 0600 (pre-existing ones are
|
|
10
|
+
* chmod-tightened); Windows strips inherited ACEs and grants only the current
|
|
11
|
+
* user (see owner-only-fs.ts). Returns the open fd and every tightening
|
|
12
|
+
* failure (never fatal: logging must keep working).
|
|
13
|
+
*/
|
|
14
|
+
export declare function openOwnerOnlyLog(dataDir: string, pid: number, deps?: OwnerOnlyDeps): {
|
|
15
|
+
fd: number;
|
|
16
|
+
logFile: string;
|
|
17
|
+
problems: string[];
|
|
18
|
+
};
|
|
19
|
+
/** Close the log fd (the next write reopens it). Used by tests that rotate data dirs. */
|
|
20
|
+
export declare function closeLogFile(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Append one raw JSON record (ts + level are prepended) to the server log,
|
|
23
|
+
* synchronously and WITHOUT the stderr mirror. For records that must land
|
|
24
|
+
* even when stderr is blocked or the process is about to exit.
|
|
25
|
+
*/
|
|
26
|
+
export declare function appendLogRecord(level: 'info' | 'warn' | 'error', record: Record<string, unknown>): void;
|
|
3
27
|
type LogAgent = {
|
|
4
28
|
id: string;
|
|
5
29
|
friendlyName: string;
|
|
@@ -7,6 +31,13 @@ type LogAgent = {
|
|
|
7
31
|
export declare function logLine(tag: string, msg: string, agent?: LogAgent, inv?: string): void;
|
|
8
32
|
export declare function logWarn(tag: string, msg: string, agent?: LogAgent): void;
|
|
9
33
|
export declare function logError(tag: string, msg: string, agent?: LogAgent): void;
|
|
34
|
+
/**
|
|
35
|
+
* Per-invocation correlation id: 5 lowercase base36 chars. CSPRNG, not
|
|
36
|
+
* Math.random -- besides tagging log lines and the prompt instruction, the
|
|
37
|
+
* id names the durable output file a Linux member tees into under the
|
|
38
|
+
* shared /tmp (see durableOutputPath), so it must not be predictable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function newInvocationId(): string;
|
|
10
41
|
export declare class LogScope {
|
|
11
42
|
private readonly inv;
|
|
12
43
|
private readonly start;
|
|
@@ -24,6 +55,12 @@ export declare class LogScope {
|
|
|
24
55
|
private _exit;
|
|
25
56
|
}
|
|
26
57
|
export declare function maskSecrets(text: string): string;
|
|
58
|
+
/**
|
|
59
|
+
* Log form of an MCP session id: its first 8 characters. A session id is a
|
|
60
|
+
* bearer-like handle (a full id addresses the session), so log lines carry
|
|
61
|
+
* only this non-reversible prefix -- enough to correlate lines of one session.
|
|
62
|
+
*/
|
|
63
|
+
export declare function shortSid(sid: string | null | undefined): string;
|
|
27
64
|
export declare function truncateForLog(text: string, maxLen?: number): string;
|
|
28
65
|
export {};
|
|
29
66
|
//# sourceMappingURL=log-helpers.d.ts.map
|
|
@@ -1,28 +1,92 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
3
|
+
import { randomInt } from 'node:crypto';
|
|
4
|
+
import { FLEET_DIR, LOG_FILE_PATH } from '../paths.js';
|
|
4
5
|
import { redactSecretTokens } from '../services/secret-token.js';
|
|
5
|
-
|
|
6
|
+
import { ensureOwnerOnlyDir, openOwnerOnlyAppend, restrictToOwner } from './owner-only-fs.js';
|
|
7
|
+
// The server log is written SYNCHRONOUSLY (append-mode fd + fs.writeSync), and
|
|
8
|
+
// before the stderr mirror (GitHub #562): a console in QuickEdit selection or
|
|
9
|
+
// an undrained stderr pipe blocks console.error forever, and an async
|
|
10
|
+
// WriteStream only flushes from the (now blocked) event loop -- the result was
|
|
11
|
+
// a frozen server with zero lines in fleet-<pid>.log. A sync append also makes
|
|
12
|
+
// a line written just before process.exit durable (shutdown records).
|
|
13
|
+
let _fd = null;
|
|
6
14
|
let _activeLogFile = null;
|
|
7
15
|
/** Returns the resolved path of the active log file, or null if logging is unavailable. */
|
|
8
16
|
export function getActiveLogFile() {
|
|
9
|
-
|
|
17
|
+
getFd(); // ensure initialised
|
|
10
18
|
return _activeLogFile;
|
|
11
19
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Open this process's log (<data dir>/logs/fleet-<pid>.log) owner-only, and
|
|
22
|
+
* tighten the data dir, the logs dir and the service log (<data dir>/fleet.log,
|
|
23
|
+
* written by `apra-fleet start` and the OS service manager) to the owner too.
|
|
24
|
+
* Server logs carry member ids, paths and session handles, so they must not be
|
|
25
|
+
* group/world-readable: POSIX dirs 0700 and files 0600 (pre-existing ones are
|
|
26
|
+
* chmod-tightened); Windows strips inherited ACEs and grants only the current
|
|
27
|
+
* user (see owner-only-fs.ts). Returns the open fd and every tightening
|
|
28
|
+
* failure (never fatal: logging must keep working).
|
|
29
|
+
*/
|
|
30
|
+
export function openOwnerOnlyLog(dataDir, pid, deps = {}) {
|
|
31
|
+
const logsDir = path.join(dataDir, 'logs');
|
|
32
|
+
const problems = [...ensureOwnerOnlyDir(dataDir, deps), ...ensureOwnerOnlyDir(logsDir, deps)];
|
|
33
|
+
const logFile = path.join(logsDir, `fleet-${pid}.log`);
|
|
34
|
+
const fd = openOwnerOnlyAppend(logFile, problems, deps);
|
|
35
|
+
const serviceLog = path.join(dataDir, path.basename(LOG_FILE_PATH));
|
|
36
|
+
if (fs.existsSync(serviceLog)) {
|
|
37
|
+
const why = restrictToOwner(serviceLog, 'file', deps);
|
|
38
|
+
if (why)
|
|
39
|
+
problems.push(why);
|
|
40
|
+
}
|
|
41
|
+
return { fd, logFile, problems };
|
|
42
|
+
}
|
|
43
|
+
function getFd() {
|
|
44
|
+
if (_fd !== null)
|
|
45
|
+
return _fd;
|
|
15
46
|
try {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const logFile = path.join(logsDir, `fleet-${process.pid}.log`);
|
|
19
|
-
_stream = fs.createWriteStream(logFile, { flags: 'a' });
|
|
47
|
+
const { fd, logFile, problems } = openOwnerOnlyLog(FLEET_DIR, process.pid);
|
|
48
|
+
_fd = fd;
|
|
20
49
|
_activeLogFile = logFile;
|
|
50
|
+
for (const why of problems) {
|
|
51
|
+
appendLogRecord('warn', { tag: 'log', msg: `log permissions: ${why}` });
|
|
52
|
+
try {
|
|
53
|
+
console.error(`[fleet:warn] log log permissions: ${why}`);
|
|
54
|
+
}
|
|
55
|
+
catch { /* ignore */ }
|
|
56
|
+
}
|
|
21
57
|
}
|
|
22
58
|
catch {
|
|
23
59
|
// data dir not available
|
|
24
60
|
}
|
|
25
|
-
return
|
|
61
|
+
return _fd;
|
|
62
|
+
}
|
|
63
|
+
/** Close the log fd (the next write reopens it). Used by tests that rotate data dirs. */
|
|
64
|
+
export function closeLogFile() {
|
|
65
|
+
if (_fd !== null) {
|
|
66
|
+
try {
|
|
67
|
+
fs.closeSync(_fd);
|
|
68
|
+
}
|
|
69
|
+
catch { /* ignore */ }
|
|
70
|
+
}
|
|
71
|
+
_fd = null;
|
|
72
|
+
_activeLogFile = null;
|
|
73
|
+
}
|
|
74
|
+
function appendLine(text) {
|
|
75
|
+
try {
|
|
76
|
+
const fd = getFd();
|
|
77
|
+
if (fd === null)
|
|
78
|
+
return;
|
|
79
|
+
fs.writeSync(fd, text);
|
|
80
|
+
}
|
|
81
|
+
catch { /* ignore */ }
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Append one raw JSON record (ts + level are prepended) to the server log,
|
|
85
|
+
* synchronously and WITHOUT the stderr mirror. For records that must land
|
|
86
|
+
* even when stderr is blocked or the process is about to exit.
|
|
87
|
+
*/
|
|
88
|
+
export function appendLogRecord(level, record) {
|
|
89
|
+
appendLine(JSON.stringify({ ts: localISOString(), level, ...record }) + '\n');
|
|
26
90
|
}
|
|
27
91
|
function localISOString() {
|
|
28
92
|
const now = new Date();
|
|
@@ -36,9 +100,6 @@ function localISOString() {
|
|
|
36
100
|
}
|
|
37
101
|
function writeLog(level, tag, maskedMsg, agent, inv) {
|
|
38
102
|
try {
|
|
39
|
-
const stream = getStream();
|
|
40
|
-
if (!stream)
|
|
41
|
-
return;
|
|
42
103
|
const line = { ts: localISOString(), level, tag };
|
|
43
104
|
if (inv !== undefined)
|
|
44
105
|
line.inv = inv;
|
|
@@ -48,46 +109,61 @@ function writeLog(level, tag, maskedMsg, agent, inv) {
|
|
|
48
109
|
line.mem = agent.friendlyName;
|
|
49
110
|
}
|
|
50
111
|
line.msg = maskedMsg;
|
|
51
|
-
|
|
112
|
+
appendLine(JSON.stringify(line) + '\n');
|
|
52
113
|
}
|
|
53
114
|
catch { /* ignore */ }
|
|
54
115
|
}
|
|
116
|
+
// Every emitter writes the file line FIRST, then mirrors to stderr (which may block).
|
|
55
117
|
export function logLine(tag, msg, agent, inv) {
|
|
56
118
|
const maskedMsg = maskSecrets(msg);
|
|
119
|
+
writeLog('info', tag, maskedMsg, agent, inv);
|
|
57
120
|
try {
|
|
58
121
|
console.error(`[fleet] ${tag} ${maskedMsg}`);
|
|
59
122
|
}
|
|
60
123
|
catch { /* ignore */ }
|
|
61
|
-
writeLog('info', tag, maskedMsg, agent, inv);
|
|
62
124
|
}
|
|
63
125
|
export function logWarn(tag, msg, agent) {
|
|
64
126
|
const maskedMsg = maskSecrets(msg);
|
|
127
|
+
writeLog('warn', tag, maskedMsg, agent);
|
|
65
128
|
try {
|
|
66
129
|
console.error(`[fleet:warn] ${tag} ${maskedMsg}`);
|
|
67
130
|
}
|
|
68
131
|
catch { /* ignore */ }
|
|
69
|
-
writeLog('warn', tag, maskedMsg, agent);
|
|
70
132
|
}
|
|
71
133
|
export function logError(tag, msg, agent) {
|
|
72
134
|
const maskedMsg = maskSecrets(msg);
|
|
135
|
+
writeLog('error', tag, maskedMsg, agent);
|
|
73
136
|
try {
|
|
74
137
|
console.error(`[fleet:error] ${tag} ${maskedMsg}`);
|
|
75
138
|
}
|
|
76
139
|
catch { /* ignore */ }
|
|
77
|
-
writeLog('error', tag, maskedMsg, agent);
|
|
78
140
|
}
|
|
79
141
|
const LEVEL_PREFIX = {
|
|
80
142
|
info: '[fleet]',
|
|
81
143
|
warn: '[fleet:warn]',
|
|
82
144
|
error: '[fleet:error]',
|
|
83
145
|
};
|
|
146
|
+
const INV_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
147
|
+
const INV_LENGTH = 5;
|
|
148
|
+
/**
|
|
149
|
+
* Per-invocation correlation id: 5 lowercase base36 chars. CSPRNG, not
|
|
150
|
+
* Math.random -- besides tagging log lines and the prompt instruction, the
|
|
151
|
+
* id names the durable output file a Linux member tees into under the
|
|
152
|
+
* shared /tmp (see durableOutputPath), so it must not be predictable.
|
|
153
|
+
*/
|
|
154
|
+
export function newInvocationId() {
|
|
155
|
+
let id = '';
|
|
156
|
+
for (let i = 0; i < INV_LENGTH; i++)
|
|
157
|
+
id += INV_ALPHABET[randomInt(INV_ALPHABET.length)];
|
|
158
|
+
return id;
|
|
159
|
+
}
|
|
84
160
|
export class LogScope {
|
|
85
161
|
inv;
|
|
86
162
|
start;
|
|
87
163
|
tag;
|
|
88
164
|
agent;
|
|
89
165
|
constructor(tag, entryMsg, agent) {
|
|
90
|
-
this.inv =
|
|
166
|
+
this.inv = newInvocationId();
|
|
91
167
|
this.start = Date.now();
|
|
92
168
|
this.tag = tag;
|
|
93
169
|
this.agent = agent;
|
|
@@ -102,11 +178,11 @@ export class LogScope {
|
|
|
102
178
|
abort(msg) { this._exit('error', msg); }
|
|
103
179
|
_emit(level, msg) {
|
|
104
180
|
const masked = maskSecrets(msg);
|
|
181
|
+
writeLog(level, this.tag, masked, this.agent, this.inv);
|
|
105
182
|
try {
|
|
106
183
|
console.error(`${LEVEL_PREFIX[level]} ${this.tag} ${masked}`);
|
|
107
184
|
}
|
|
108
185
|
catch { /* ignore */ }
|
|
109
|
-
writeLog(level, this.tag, masked, this.agent, this.inv);
|
|
110
186
|
}
|
|
111
187
|
_exit(level, msg) {
|
|
112
188
|
this._emit(level, `${msg} elapsed=${Date.now() - this.start}ms`);
|
|
@@ -121,6 +197,16 @@ export function maskSecrets(text) {
|
|
|
121
197
|
return text;
|
|
122
198
|
}
|
|
123
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Log form of an MCP session id: its first 8 characters. A session id is a
|
|
202
|
+
* bearer-like handle (a full id addresses the session), so log lines carry
|
|
203
|
+
* only this non-reversible prefix -- enough to correlate lines of one session.
|
|
204
|
+
*/
|
|
205
|
+
export function shortSid(sid) {
|
|
206
|
+
if (!sid)
|
|
207
|
+
return 'none';
|
|
208
|
+
return sid.length <= 8 ? sid : `${sid.slice(0, 8)}...`;
|
|
209
|
+
}
|
|
124
210
|
export function truncateForLog(text, maxLen = 80) {
|
|
125
211
|
const single = text.replace(/[\n\t]/g, ' ');
|
|
126
212
|
return single.length <= maxLen ? single : single.slice(0, maxLen) + '...';
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owner-only file-system helpers for the server's data dir and logs.
|
|
3
|
+
*
|
|
4
|
+
* POSIX: directories are created/tightened to 0700 and files to 0600 with
|
|
5
|
+
* chmod (the mkdir/open `mode` alone is filtered by the umask and never
|
|
6
|
+
* tightens an existing path).
|
|
7
|
+
*
|
|
8
|
+
* Windows: chmod cannot express an ACL, and relying on the user-profile ACL
|
|
9
|
+
* the data dir would inherit is not enough -- APRA_FLEET_DATA_DIR can point
|
|
10
|
+
* anywhere (e.g. C:\fleet-data, readable by every local user). So the path's
|
|
11
|
+
* inherited ACEs are removed and only the current user is granted full
|
|
12
|
+
* control: `icacls <path> /inheritance:r /grant:r <user>:F` (directories get
|
|
13
|
+
* `(OI)(CI)F` so new children inherit it). icacls runs through execFile, never
|
|
14
|
+
* a shell, so the path needs no quoting.
|
|
15
|
+
*
|
|
16
|
+
* Every helper reports failure by return value (a reason string), never by
|
|
17
|
+
* throwing: a log or data dir that cannot be tightened must not stop the
|
|
18
|
+
* server. Callers log the reason.
|
|
19
|
+
*/
|
|
20
|
+
export interface OwnerOnlyDeps {
|
|
21
|
+
platform?: NodeJS.Platform;
|
|
22
|
+
execFile?: (file: string, args: string[]) => void;
|
|
23
|
+
/** Windows account to grant (default: currentWindowsUser()). */
|
|
24
|
+
windowsUser?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The account icacls (and the service task) grants on Windows, read from this
|
|
28
|
+
* process's token: `whoami` prints DOMAIN\user (<COMPUTERNAME>\user for a local
|
|
29
|
+
* account). Never env USERDOMAIN: Win32-OpenSSH sets it to WORKGROUP on a
|
|
30
|
+
* workgroup machine, a name that maps to no account. Falls back to the bare
|
|
31
|
+
* token user name (os.userInfo), which icacls/schtasks resolve themselves.
|
|
32
|
+
*/
|
|
33
|
+
export declare function currentWindowsUser(whoami?: () => string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Windows install step: restrict each path to the owner and return one loud
|
|
36
|
+
* `[!]` line per failure, naming the file and the manual fix (empty on
|
|
37
|
+
* success). Callers gate on win32; POSIX keeps its chmod path.
|
|
38
|
+
*/
|
|
39
|
+
export declare function ownerOnlyInstallWarnings(targets: Array<{
|
|
40
|
+
path: string;
|
|
41
|
+
kind: 'file' | 'dir';
|
|
42
|
+
}>, deps?: OwnerOnlyDeps): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Restrict `target` (an existing file or directory) to the current user.
|
|
45
|
+
* Returns null on success, else a one-line reason.
|
|
46
|
+
*/
|
|
47
|
+
export declare function restrictToOwner(target: string, kind: 'file' | 'dir', deps?: OwnerOnlyDeps): string | null;
|
|
48
|
+
/** mkdir -p `dir` (0700) and restrict it to the owner. Returns failure reasons. */
|
|
49
|
+
export declare function ensureOwnerOnlyDir(dir: string, deps?: OwnerOnlyDeps): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Open `file` for append, created 0600, and restrict it (new or pre-existing)
|
|
52
|
+
* to the owner. Throws only when the open itself fails; restriction failures
|
|
53
|
+
* are pushed onto `problems`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function openOwnerOnlyAppend(file: string, problems?: string[], deps?: OwnerOnlyDeps): number;
|
|
56
|
+
//# sourceMappingURL=owner-only-fs.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import { execFileSync } from 'node:child_process';
|
|
4
|
+
function defaultExecFile(file, args) {
|
|
5
|
+
execFileSync(file, args, { stdio: 'ignore', windowsHide: true, timeout: 15_000 });
|
|
6
|
+
}
|
|
7
|
+
function defaultWhoami() {
|
|
8
|
+
return execFileSync('whoami', [], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, timeout: 15_000 });
|
|
9
|
+
}
|
|
10
|
+
let cachedWindowsUser;
|
|
11
|
+
/**
|
|
12
|
+
* The account icacls (and the service task) grants on Windows, read from this
|
|
13
|
+
* process's token: `whoami` prints DOMAIN\user (<COMPUTERNAME>\user for a local
|
|
14
|
+
* account). Never env USERDOMAIN: Win32-OpenSSH sets it to WORKGROUP on a
|
|
15
|
+
* workgroup machine, a name that maps to no account. Falls back to the bare
|
|
16
|
+
* token user name (os.userInfo), which icacls/schtasks resolve themselves.
|
|
17
|
+
*/
|
|
18
|
+
export function currentWindowsUser(whoami) {
|
|
19
|
+
if (!whoami && cachedWindowsUser)
|
|
20
|
+
return cachedWindowsUser;
|
|
21
|
+
let name;
|
|
22
|
+
try {
|
|
23
|
+
const out = (whoami ?? defaultWhoami)().trim();
|
|
24
|
+
if (/^[^\\\s]+\\[^\\]+$/.test(out) && !out.includes(String.fromCharCode(0xfffd)))
|
|
25
|
+
name = out;
|
|
26
|
+
}
|
|
27
|
+
catch { /* fall back below */ }
|
|
28
|
+
if (!name) {
|
|
29
|
+
try {
|
|
30
|
+
name = os.userInfo().username;
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
name = 'unknown';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
if (!whoami)
|
|
37
|
+
cachedWindowsUser = name;
|
|
38
|
+
return name;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Windows install step: restrict each path to the owner and return one loud
|
|
42
|
+
* `[!]` line per failure, naming the file and the manual fix (empty on
|
|
43
|
+
* success). Callers gate on win32; POSIX keeps its chmod path.
|
|
44
|
+
*/
|
|
45
|
+
export function ownerOnlyInstallWarnings(targets, deps = {}) {
|
|
46
|
+
const out = [];
|
|
47
|
+
for (const t of targets) {
|
|
48
|
+
if (!fs.existsSync(t.path))
|
|
49
|
+
continue;
|
|
50
|
+
const why = restrictToOwner(t.path, t.kind, deps);
|
|
51
|
+
if (!why)
|
|
52
|
+
continue;
|
|
53
|
+
const user = deps.windowsUser ?? currentWindowsUser();
|
|
54
|
+
const grant = t.kind === 'dir' ? `${user}:(OI)(CI)F` : `${user}:F`;
|
|
55
|
+
out.push(` [!] ${t.path} is NOT owner-only (${why}). Other local users may read it. Fix: icacls "${t.path}" /inheritance:r /grant:r "${grant}"`);
|
|
56
|
+
}
|
|
57
|
+
return out;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Restrict `target` (an existing file or directory) to the current user.
|
|
61
|
+
* Returns null on success, else a one-line reason.
|
|
62
|
+
*/
|
|
63
|
+
export function restrictToOwner(target, kind, deps = {}) {
|
|
64
|
+
const platform = deps.platform ?? process.platform;
|
|
65
|
+
try {
|
|
66
|
+
if (platform === 'win32') {
|
|
67
|
+
const user = deps.windowsUser ?? currentWindowsUser();
|
|
68
|
+
const grant = kind === 'dir' ? `${user}:(OI)(CI)F` : `${user}:F`;
|
|
69
|
+
(deps.execFile ?? defaultExecFile)('icacls', [target, '/inheritance:r', '/grant:r', grant]);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
fs.chmodSync(target, kind === 'dir' ? 0o700 : 0o600);
|
|
73
|
+
}
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
return `could not restrict ${target} to its owner: ${err.message}`;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/** mkdir -p `dir` (0700) and restrict it to the owner. Returns failure reasons. */
|
|
81
|
+
export function ensureOwnerOnlyDir(dir, deps = {}) {
|
|
82
|
+
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
83
|
+
const why = restrictToOwner(dir, 'dir', deps);
|
|
84
|
+
return why ? [why] : [];
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Open `file` for append, created 0600, and restrict it (new or pre-existing)
|
|
88
|
+
* to the owner. Throws only when the open itself fails; restriction failures
|
|
89
|
+
* are pushed onto `problems`.
|
|
90
|
+
*/
|
|
91
|
+
export function openOwnerOnlyAppend(file, problems = [], deps = {}) {
|
|
92
|
+
const fd = fs.openSync(file, 'a', 0o600);
|
|
93
|
+
const why = restrictToOwner(file, 'file', deps);
|
|
94
|
+
if (why)
|
|
95
|
+
problems.push(why);
|
|
96
|
+
return fd;
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=owner-only-fs.js.map
|
|
@@ -1,3 +1,31 @@
|
|
|
1
1
|
export declare function isPidAlive(pid: number): boolean;
|
|
2
|
+
/** True when a process command line is an apra-fleet server: the SEA binary,
|
|
3
|
+
* or node running a dist/index.js build. */
|
|
4
|
+
export declare function isApraFleetCommandLine(cmd: string): boolean;
|
|
5
|
+
/** The command line of a live pid, or null when it cannot be read. */
|
|
6
|
+
export declare function processCommandLine(pid: number): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Windows image name of a live pid from `tasklist /FI "PID eq N" /FO CSV /NH`,
|
|
9
|
+
* or null when it cannot be read (no such pid, or tasklist failed).
|
|
10
|
+
*/
|
|
11
|
+
export declare function processImageName(pid: number): string | null;
|
|
12
|
+
/** The image name from tasklist CSV output for pid, or null (e.g. the
|
|
13
|
+
* localized "INFO: No tasks are running..." line, which is not CSV). */
|
|
14
|
+
export declare function parseTasklistImage(out: string, pid: number): string | null;
|
|
15
|
+
/** Image names an apra-fleet server runs as: the SEA binary, or node. */
|
|
16
|
+
export declare function isApraFleetImage(image: string): boolean;
|
|
17
|
+
export interface FleetIdentityProbes {
|
|
18
|
+
platform: NodeJS.Platform;
|
|
19
|
+
commandLine: (pid: number) => string | null;
|
|
20
|
+
imageName: (pid: number) => string | null;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* GitHub #584 review: before force-killing the pid recorded in server.json,
|
|
24
|
+
* confirm it is still an apra-fleet server -- pids are reused, and the port
|
|
25
|
+
* owner may be a foreign app. true / false, or null when it cannot be told.
|
|
26
|
+
* On Windows, when the command line is unreadable (Get-CimInstance returned
|
|
27
|
+
* nothing), fall back to the tasklist image name.
|
|
28
|
+
*/
|
|
29
|
+
export declare function isApraFleetProcess(pid: number, probes?: FleetIdentityProbes): boolean | null;
|
|
2
30
|
export declare function postShutdown(url: string): Promise<void>;
|
|
3
31
|
//# sourceMappingURL=process-utils.d.ts.map
|