@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
|
@@ -1,4 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
import { FULL_TOOL_SCOPE, isToolInScope, runWithSessionMember, scopeHasKbMaintainer, scopeIsEngineOrigin, scopeMemberId } from './tool-scope.js';
|
|
2
|
+
import { recordMemberToolCall } from './member-call-counts.js';
|
|
3
|
+
import { assertNoRemovedKbScopeKeys } from './knowledge/kb-removed-scope-keys.js';
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a session's McpServer so every server.tool(...)/registerTool(...) registration below goes
|
|
6
|
+
* through the scope gate: an out-of-scope tool is simply never registered
|
|
7
|
+
* (deny by omission -- absent from tools/list, unknown when called). Every
|
|
8
|
+
* other property is forwarded to the real server unchanged.
|
|
9
|
+
*/
|
|
10
|
+
function scopeGatedServer(base, scope) {
|
|
11
|
+
if (scope.kind === 'full')
|
|
12
|
+
return base;
|
|
13
|
+
return new Proxy(base, {
|
|
14
|
+
get(target, prop, receiver) {
|
|
15
|
+
if (prop === 'tool') {
|
|
16
|
+
return (name, ...rest) => {
|
|
17
|
+
if (!isToolInScope(name, scope))
|
|
18
|
+
return undefined;
|
|
19
|
+
return target.tool.call(target, name, ...rest);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
if (prop === 'registerTool') {
|
|
23
|
+
return (name, ...rest) => {
|
|
24
|
+
if (!isToolInScope(name, scope))
|
|
25
|
+
return undefined;
|
|
26
|
+
return target.registerTool.call(target, name, ...rest);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return Reflect.get(target, prop, receiver);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Register the fleet tool surface on ONE session's McpServer. `scope` is
|
|
35
|
+
* derived from the session's identity by the HTTP transport; it defaults to
|
|
36
|
+
* FULL (every tool), which is also what the stdio path uses.
|
|
37
|
+
*/
|
|
38
|
+
export async function registerAllTools(baseServer, scope = FULL_TOOL_SCOPE) {
|
|
39
|
+
const server = scopeGatedServer(baseServer, scope);
|
|
40
|
+
const sessionMemberId = scopeMemberId(scope);
|
|
41
|
+
const engineOrigin = scopeIsEngineOrigin(scope);
|
|
42
|
+
// Whether this member session carries the engine's kb_maintainer grant;
|
|
43
|
+
// handlers read it via getSessionKbMaintainer() (src/services/tool-scope.ts).
|
|
44
|
+
const kbMaintainer = scopeHasKbMaintainer(scope);
|
|
2
45
|
// Load onboarding functions
|
|
3
46
|
const { getFirstRunPreamble, isJsonResponse, isActiveTool, getOnboardingNudge, getWelcomeBackPreamble } = await import('./onboarding.js');
|
|
4
47
|
// Tool schemas and handlers
|
|
@@ -12,7 +55,7 @@ export async function registerAllTools(server) {
|
|
|
12
55
|
const { childIdAllocatorSchema, childIdAllocator } = await import('../tools/child-id-allocator.js');
|
|
13
56
|
const { sendFilesSchema, sendFiles } = await import('../tools/send-files.js');
|
|
14
57
|
const { receiveFilesSchema, receiveFiles } = await import('../tools/receive-files.js');
|
|
15
|
-
const { executePromptSchema, executePrompt
|
|
58
|
+
const { executePromptSchema, executePrompt } = await import('../tools/execute-prompt.js');
|
|
16
59
|
const { executeCommandSchema, executeCommand } = await import('../tools/execute-command.js');
|
|
17
60
|
const { provisionAuthSchema, provisionAuth } = await import('../tools/provision-auth.js');
|
|
18
61
|
const { setupSSHKeySchema, setupSSHKey } = await import('../tools/setup-ssh-key.js');
|
|
@@ -37,7 +80,8 @@ export async function registerAllTools(server) {
|
|
|
37
80
|
const { sendEmailSchema, sendEmail } = await import('../tools/send-email.js');
|
|
38
81
|
const { reportStatusSchema, reportStatus } = await import('../tools/report-status.js');
|
|
39
82
|
const { respondToMessageSchema, respondToMessage } = await import('../tools/respond-to-message.js');
|
|
40
|
-
const {
|
|
83
|
+
const { sessionStatsSchema, sessionStats } = await import('../tools/session-stats.js');
|
|
84
|
+
const { handleCodeGraph, handleCodeImpact, handleCodeQuery, handleCodeContext, handleCodeMap, handleCodeFlow, handleCodeTests, handleCodeReindex, handleCodeStatus, codeReindexSchema, codeStatusSchema, codeGraphSchema, codeImpactSchema, codeQuerySchema, codeContextSchema, codeMapSchema, codeFlowSchema, codeTestsSchema, resolveCodeSelf, CODE_SELF_NOTE } = await import('../tools/code-intelligence.js');
|
|
41
85
|
const { enrichContextWithKb } = await import('../tools/code-intelligence-kb-enrich.js');
|
|
42
86
|
const { recordUsage } = await import('../tools/code-intelligence-telemetry.js');
|
|
43
87
|
const { kbCaptureSchema, kbCapture } = await import('../tools/kb-capture.js');
|
|
@@ -47,6 +91,7 @@ export async function registerAllTools(server) {
|
|
|
47
91
|
const { kbQuerySchema, kbQuery } = await import('../tools/kb-query.js');
|
|
48
92
|
const { kbListSchema, kbList } = await import('../tools/kb-list.js');
|
|
49
93
|
const { kbExportSchema, kbExport } = await import('../tools/kb-export.js');
|
|
94
|
+
const { kbBibleCommitSchema, kbBibleCommit } = await import('../tools/kb-bible-commit.js');
|
|
50
95
|
const { kbStatsSchema, kbStats } = await import('../tools/kb-stats.js');
|
|
51
96
|
const { kbFeedbackSchema, kbFeedback } = await import('../tools/kb-feedback.js');
|
|
52
97
|
const { kbHarvestSchema, kbHarvest } = await import('../tools/kb-harvest.js');
|
|
@@ -56,6 +101,7 @@ export async function registerAllTools(server) {
|
|
|
56
101
|
const { kbResolveContradictionSchema, kbResolveContradiction } = await import('../tools/kb-resolve-contradiction.js');
|
|
57
102
|
const { kbReconcilePrefilterSchema, kbReconcilePrefilter } = await import('../tools/kb-reconcile-prefilter.js');
|
|
58
103
|
const { kbSetupSchema, kbSetup } = await import('../tools/kb-setup.js');
|
|
104
|
+
const { KB_SELF_NOTE } = await import('./knowledge/kb-self.js');
|
|
59
105
|
// Onboarding helpers
|
|
60
106
|
async function sendOnboardingNotification(srv, text) {
|
|
61
107
|
try {
|
|
@@ -91,7 +137,25 @@ export async function registerAllTools(server) {
|
|
|
91
137
|
// human/LLM-facing text -- see ExecuteCommandResult in tools/execute-command.ts.
|
|
92
138
|
function wrapTool(toolName, handler) {
|
|
93
139
|
return async (input, extra) => {
|
|
94
|
-
|
|
140
|
+
// Per-member kb_/code_ call counts (session_stats). Counted on entry, so
|
|
141
|
+
// a call that fails still counts as a call. Engine-origin and FULL
|
|
142
|
+
// sessions are not counted (see member-call-counts.ts).
|
|
143
|
+
recordMemberToolCall(sessionMemberId, toolName, engineOrigin);
|
|
144
|
+
// Removed kb_* scope keys (repo_path, repo, repo_remote_url) are refused
|
|
145
|
+
// with a typed error before the handler runs, so an upgraded server
|
|
146
|
+
// never silently re-points an old caller at a different KB.
|
|
147
|
+
if (toolName.startsWith('kb_'))
|
|
148
|
+
assertNoRemovedKbScopeKeys(toolName, input);
|
|
149
|
+
// Every handler can read the calling session's member id: on the extra
|
|
150
|
+
// (extra.sessionMemberId) and, for code further down the call chain,
|
|
151
|
+
// via getSessionMemberId() (src/services/tool-scope.ts). Undefined for a
|
|
152
|
+
// FULL session. getSessionKbMaintainer() likewise reports whether the
|
|
153
|
+
// member session carries the kb_maintainer grant.
|
|
154
|
+
// (extra stays exactly as received for a FULL session called without one.)
|
|
155
|
+
const scopedExtra = extra === undefined && sessionMemberId === undefined
|
|
156
|
+
? undefined
|
|
157
|
+
: { ...(extra ?? {}), sessionMemberId };
|
|
158
|
+
const raw = await runWithSessionMember(sessionMemberId, () => handler(input, scopedExtra), { kbMaintainer });
|
|
95
159
|
const result = typeof raw === 'string' ? raw : raw.text;
|
|
96
160
|
const structuredContent = typeof raw === 'string' ? undefined : raw.structuredContent;
|
|
97
161
|
const isJson = isJsonResponse(result);
|
|
@@ -117,7 +181,22 @@ export async function registerAllTools(server) {
|
|
|
117
181
|
server.tool('list_members', 'List all fleet members and their current status. Use format="json" for structured data. Use tags=["gpu"] to filter to members that have ALL specified tags (AND semantics); omit tags to return all members.', listMembersSchema.shape, wrapTool('list_members', (input) => listMembers(input)));
|
|
118
182
|
server.tool('get_member_model_pricing', "Returns a member's cheap/standard/premium tier resolved to a concrete model and its per-1M-token price (prompt/completion), for real per-dispatch cost tracking instead of a tier-band estimate. A tier is null when its resolved model has no known price.", getMemberModelPricingSchema.shape, wrapTool('get_member_model_pricing', (input) => getMemberModelPricing(input)));
|
|
119
183
|
server.tool('remove_member', 'Remove a member from the fleet.', removeMemberSchema.shape, wrapTool('remove_member', (input) => removeMember(input)));
|
|
120
|
-
|
|
184
|
+
// Registered with a STRICT object schema (registerTool, not .tool(<shape>)): the
|
|
185
|
+
// SDK wraps a raw shape in a non-strict object that silently strips unknown
|
|
186
|
+
// keys, so a typo such as fleet_instal would be dropped and the member updated
|
|
187
|
+
// without it. Strict makes the MCP call fail naming the unknown key instead.
|
|
188
|
+
// Minimal test doubles that only implement .tool() get the plain shape.
|
|
189
|
+
const updateMemberDescription = "Change a member's name, connection details, working directory, AI provider, tags, or other settings. Unknown input keys are rejected. Pass fleet_install: \"auto\" to upgrade the member's own apra-fleet when it is missing or older.";
|
|
190
|
+
const updateMemberHandler = wrapTool('update_member', (input) => updateMember(input));
|
|
191
|
+
if (typeof server.registerTool === 'function') {
|
|
192
|
+
server.registerTool('update_member', {
|
|
193
|
+
description: updateMemberDescription,
|
|
194
|
+
inputSchema: updateMemberSchema.strict(),
|
|
195
|
+
}, updateMemberHandler);
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
server.tool('update_member', updateMemberDescription, updateMemberSchema.shape, updateMemberHandler);
|
|
199
|
+
}
|
|
121
200
|
server.tool('dolt_push_mutex', 'Global cross-sprint dolt push mutex hosted on the fleet server, so sprints launched WITHOUT a supervisor still serialize their `bd dolt push` calls. "acquire" enqueues (FIFO) and returns {granted, ticket, token?}; "poll" re-checks a ticket without losing its queue position; "release"/"renew" are token-guarded; "cancel" drops a ticket; "status" snapshots holder + queue.', doltPushMutexSchema.shape, wrapTool('dolt_push_mutex', (input) => doltPushMutex(input)));
|
|
122
201
|
server.tool('child_id_allocator', 'Global child-bead-id allocator hosted on the fleet server, so sprints launched WITHOUT a supervisor never mint the same child id under a shared parent. "allocate" reserves the next id under parent_id (lease + pid guarded); "confirm" commits it after a successful create; "release" returns an unused id to the free pool; "status" snapshots per-parent state.', childIdAllocatorSchema.shape, wrapTool('child_id_allocator', (input) => childIdAllocator(input)));
|
|
123
202
|
server.tool('member_reservation', 'Reserve, release, or force-release exclusive ownership of a member for a sprint (server-side reservation; does not yet block dispatch). "reserve" claims the member for sprint_id; "release" clears it if sprint_id matches the current holder; "force_release" clears a wedged reservation regardless of owner.', memberReservationSchema.shape, wrapTool('member_reservation', (input) => memberReservation(input)));
|
|
@@ -128,7 +207,7 @@ export async function registerAllTools(server) {
|
|
|
128
207
|
server.tool('execute_prompt', 'Run an AI prompt on a member. Supports session resume for multi-turn conversations. On success, the reply text is returned in structuredContent.response (alongside usage and sessionId).', executePromptSchema.shape, wrapTool('execute_prompt', (input, extra) => executePrompt(input, extra)));
|
|
129
208
|
server.tool('execute_command', 'Run a shell command on a member. Use for quick tasks like installing packages, checking versions, or running scripts.', executeCommandSchema.shape, wrapTool('execute_command', (input, extra) => executeCommand(input, extra)));
|
|
130
209
|
// Authentication & SSH
|
|
131
|
-
server.tool('provision_llm_auth', "Authenticate a fleet member so it can run prompts.
|
|
210
|
+
server.tool('provision_llm_auth', "Authenticate a fleet member so it can run prompts. With api_key, deploys that API key or Claude Code OAuth token (routed by prefix). Without api_key, re-deploys a credential already stored for the member, else copies your current login session; force_oauth_copy: true copies your login anyway and clears the stored credential. Run this before execute_prompt if the member reports no authentication. Note: a copied OAuth session is shared and its refresh token is rotated across every holder, so a refresh on one machine can invalidate the copies elsewhere; prefer an API key for unattended members.", provisionAuthSchema.shape, wrapTool('provision_llm_auth', (input) => provisionAuth(input)));
|
|
132
211
|
server.tool('setup_ssh_key', 'Generate an SSH key pair and migrate a member from password to key-based authentication.', setupSSHKeySchema.shape, wrapTool('setup_ssh_key', (input) => setupSSHKey(input)));
|
|
133
212
|
server.tool('setup_git_app', "One-time setup: register a GitHub App for git token minting. Requires a GitHub App ID, private key (.pem) file path, and installation ID. The app must already be created and installed, with the repository permissions each git_access level needs (see docs/github-app-setup.md; push+pr needs Metadata, Contents, Workflows, Pull requests, Actions) -- a mint requesting a permission the App lacks fails.", setupGitAppSchema.shape, wrapTool('setup_git_app', (input) => setupGitApp(input)));
|
|
134
213
|
server.tool('provision_vcs_auth', 'Set up git access credentials on a member. Supports GitHub, Bitbucket, and Azure DevOps. Tests connectivity after setup.', provisionVcsAuthSchema.shape, wrapTool('provision_vcs_auth', (input) => provisionVcsAuth(input)));
|
|
@@ -141,8 +220,9 @@ export async function registerAllTools(server) {
|
|
|
141
220
|
server.tool('update_llm_cli', "Update or install the AI provider CLI on members. Omit member to update all online members at once. Use install_if_missing to install on members that don't have it yet.", updateAgentCliSchema.shape, wrapTool('update_llm_cli', (input) => updateAgentCli(input)));
|
|
142
221
|
server.tool('shutdown_server', 'Gracefully shut down the MCP server. Run /mcp afterwards to start a fresh instance with the latest code.', shutdownServerSchema.shape, wrapTool('shutdown_server', () => shutdownServer()));
|
|
143
222
|
server.tool('version', 'Returns the installed apra-fleet server version', versionSchema.shape, wrapTool('version', () => version()));
|
|
223
|
+
server.tool('session_stats', "Return a member's kb_* and code_* tool call counts on this server (aggregated across the member's sessions, engine-origin sessions excluded) plus the time counting started. On a member session it reports the calling member.", sessionStatsSchema.shape, wrapTool('session_stats', (input) => sessionStats(input)));
|
|
144
224
|
// Permissions
|
|
145
|
-
server.tool('compose_permissions', 'Set up and deliver the right permissions to a member for their role or tags. Automatically tailors permissions to the project type. Pass tags (e.g. ["doer","gpu"]) to layer custom tag profiles additively on top of the base role; a doer/reviewer tag sets the primary mode and wins over role. Use grant to add specific permissions mid-sprint without a full recompose.', composePermissionsSchema.shape, wrapTool('compose_permissions', (input) => composePermissions(input)));
|
|
225
|
+
server.tool('compose_permissions', 'Set up and deliver the right permissions to a member for their role or tags. Automatically tailors permissions to the project type. Pass tags (e.g. ["doer","gpu"]) to layer custom tag profiles additively on top of the base role; a doer/reviewer tag sets the primary mode and wins over role. Use grant to add specific permissions mid-sprint without a full recompose. Use dry_run to read the composed allow list without writing anything.', composePermissionsSchema.shape, wrapTool('compose_permissions', (input) => composePermissions(input)));
|
|
146
226
|
// Cloud Control
|
|
147
227
|
server.tool('cloud_control', 'Manually start, stop, or check status of a cloud fleet member. Start waits until the member is ready; stop is immediate.', cloudControlSchema.shape, wrapTool('cloud_control', (input) => cloudControl(input)));
|
|
148
228
|
server.tool('monitor_task', 'Check status of a long-running background task on a cloud member. Optionally stop the cloud instance automatically when the task completes.', monitorTaskSchema.shape, wrapTool('monitor_task', (input) => monitorTask(input)));
|
|
@@ -160,68 +240,89 @@ export async function registerAllTools(server) {
|
|
|
160
240
|
server.tool('report_status', 'Called by a connected interactive member session (not the orchestrator) to report it is done responding to a send_message notification and available again ("online") or still connected but not actively engaged ("idle"). Closes the busy->online/idle status loop send_message opens.', reportStatusSchema.shape, wrapTool('report_status', (input, extra) => reportStatus(input, extra)));
|
|
161
241
|
server.tool('respond_to_message', 'Called by a connected interactive member session to respond to a prompt delivered via execute_prompt or send_message. Pass reply_to as the msgid from the original notification\'s meta. If execute_prompt is waiting on this reply_to, its call resolves with this content; otherwise this is a no-op response with a clear "no pending call" result.', respondToMessageSchema.shape, wrapTool('respond_to_message', (input) => respondToMessage(input)));
|
|
162
242
|
// --- Code Intelligence ---
|
|
163
|
-
//
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
243
|
+
// Every code_* tool resolves (self) -- the calling session's own folder
|
|
244
|
+
// (resolveCodeSelf, src/tools/code-intelligence.ts) -- before recording
|
|
245
|
+
// usage, so telemetry, the provider call, and code_context's KB enrichment
|
|
246
|
+
// all see the same resolved folder. A resolution failure throws a typed
|
|
247
|
+
// E-SELF-* error, which the MCP server returns as an error result.
|
|
248
|
+
//
|
|
249
|
+
// Usage telemetry (P8, design D8) is recorded here in the shared handler
|
|
250
|
+
// layer, not inside a provider, so providers stay pure proxies.
|
|
251
|
+
// Fire-and-forget -- never blocks or fails the call.
|
|
252
|
+
// Member-session attribution for usage.jsonl: the member id wrapTool put on
|
|
253
|
+
// extra (undefined for a FULL session) and the MCP session id from the SDK.
|
|
254
|
+
const usageWho = (extra) => ({
|
|
255
|
+
memberId: extra?.sessionMemberId,
|
|
256
|
+
sessionId: extra?.sessionId,
|
|
257
|
+
});
|
|
258
|
+
server.tool('code_graph', 'Trace the call graph for a symbol. Returns callers and callees across the codebase. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.' + CODE_SELF_NOTE, codeGraphSchema.shape, wrapTool('code_graph', async (input, extra) => {
|
|
259
|
+
const self = resolveCodeSelf();
|
|
260
|
+
recordUsage('code_graph', input.symbol, self.repo, usageWho(extra));
|
|
261
|
+
return JSON.stringify(await handleCodeGraph(input, self));
|
|
179
262
|
}));
|
|
180
|
-
server.tool('code_impact', 'Find what is affected by changes to a symbol. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.', codeImpactSchema.shape, wrapTool('code_impact', async (input) => {
|
|
181
|
-
|
|
182
|
-
|
|
263
|
+
server.tool('code_impact', 'Find what is affected by changes to a symbol. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.' + CODE_SELF_NOTE, codeImpactSchema.shape, wrapTool('code_impact', async (input, extra) => {
|
|
264
|
+
const self = resolveCodeSelf();
|
|
265
|
+
recordUsage('code_impact', input.target, self.repo, usageWho(extra));
|
|
266
|
+
return JSON.stringify(await handleCodeImpact(input, self));
|
|
183
267
|
}));
|
|
184
|
-
server.tool('code_query', 'Search the codebase for symbols, patterns, or concepts using natural language or code patterns. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.', codeQuerySchema.shape, wrapTool('code_query', async (input) => {
|
|
185
|
-
|
|
186
|
-
|
|
268
|
+
server.tool('code_query', 'Search the codebase for symbols, patterns, or concepts using natural language or code patterns. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.' + CODE_SELF_NOTE, codeQuerySchema.shape, wrapTool('code_query', async (input, extra) => {
|
|
269
|
+
const self = resolveCodeSelf();
|
|
270
|
+
recordUsage('code_query', input.query, self.repo, usageWho(extra));
|
|
271
|
+
return JSON.stringify(await handleCodeQuery(input, self));
|
|
187
272
|
}));
|
|
188
|
-
server.tool('code_context', 'Get callers, callees, and execution flows for a symbol. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.', codeContextSchema.shape, wrapTool('code_context', async (input) => {
|
|
189
|
-
|
|
190
|
-
|
|
273
|
+
server.tool('code_context', 'Get callers, callees, and execution flows for a symbol. Prefer this over Glob/Grep/file reads for structural questions (symbol lookup, call chains, impact) -- the answer is pre-indexed.' + CODE_SELF_NOTE, codeContextSchema.shape, wrapTool('code_context', async (input, extra) => {
|
|
274
|
+
const self = resolveCodeSelf();
|
|
275
|
+
recordUsage('code_context', input.name, self.repo, usageWho(extra));
|
|
276
|
+
const result = await handleCodeContext(input, self);
|
|
191
277
|
// P4a (design D4): KB enrichment lives one layer up from the provider --
|
|
192
278
|
// the gitnexus provider file must not import the KB service. Only this
|
|
193
|
-
// handler calls the helper, then merges.
|
|
194
|
-
|
|
279
|
+
// handler calls the helper, then merges. The KB is the one of the same
|
|
280
|
+
// (self) folder the code call was answered from.
|
|
281
|
+
const enriched = await enrichContextWithKb(input.name, result, self.repo, self.remoteUrl);
|
|
195
282
|
return JSON.stringify(enriched);
|
|
196
283
|
}));
|
|
197
|
-
server.tool('code_map', 'Get the architectural map of a repository: module communities with their key symbols and files, ranked by size. Prefer this over directory listings or file reads when orienting in an unfamiliar codebase -- the answer is pre-indexed.', codeMapSchema.shape, wrapTool('code_map', async (input) => {
|
|
198
|
-
|
|
199
|
-
|
|
284
|
+
server.tool('code_map', 'Get the architectural map of a repository: module communities with their key symbols and files, ranked by size. Prefer this over directory listings or file reads when orienting in an unfamiliar codebase -- the answer is pre-indexed.' + CODE_SELF_NOTE, codeMapSchema.shape, wrapTool('code_map', async (input, extra) => {
|
|
285
|
+
const self = resolveCodeSelf();
|
|
286
|
+
recordUsage('code_map', '', self.repo, usageWho(extra));
|
|
287
|
+
return JSON.stringify(await handleCodeMap(input, self));
|
|
288
|
+
}));
|
|
289
|
+
server.tool('code_flow', 'Find process flows (entry -> steps -> exit) matching a name or endpoints. Prefer this over manually tracing call chains across files -- the flows are pre-indexed.' + CODE_SELF_NOTE, codeFlowSchema.shape, wrapTool('code_flow', async (input, extra) => {
|
|
290
|
+
const self = resolveCodeSelf();
|
|
291
|
+
recordUsage('code_flow', input.name ?? input.from ?? input.to ?? '', self.repo, usageWho(extra));
|
|
292
|
+
return JSON.stringify(await handleCodeFlow(input, self));
|
|
293
|
+
}));
|
|
294
|
+
server.tool('code_tests', 'Find the test files and test functions that exercise a symbol (transitive callers, depth 2). Use this to run targeted tests for the code you changed instead of the full suite. Prefer this over Grep for test discovery -- the call graph is pre-indexed.' + CODE_SELF_NOTE, codeTestsSchema.shape, wrapTool('code_tests', async (input, extra) => {
|
|
295
|
+
const self = resolveCodeSelf();
|
|
296
|
+
recordUsage('code_tests', input.symbol, self.repo, usageWho(extra));
|
|
297
|
+
return JSON.stringify(await handleCodeTests(input, self));
|
|
200
298
|
}));
|
|
201
|
-
server.tool('
|
|
202
|
-
|
|
203
|
-
|
|
299
|
+
server.tool('code_reindex', 'Rebuild the code index of the calling session\'s own repo (runs gitnexus analyze detached; its output is captured to <data>/code-index/<slug>/analyze.log). Returns after the first tick -- outcome "started" (lock held, process alive, output seen), "up-to-date", "starting" (running, no tick yet), "already-running", or "not-started" with a typed reason (npx-not-found, gitnexus-not-found, analyze-failed, spawn-failed, remote-member, gitnexus-too-old, provider-not-supported); every result also carries injectedBlockFiles (agent docs still holding a gitnexus block from an earlier plain analyze run; never edited). Only the gitnexus provider is supported: provider none fails with E-CODE-INTEL-DISABLED, any other provider (e.g. codebase-memory, which manages its own index) gets not-started with reason provider-not-supported naming the provider. Poll code_status for completion.' + CODE_SELF_NOTE, codeReindexSchema.shape, wrapTool('code_reindex', async (input, extra) => {
|
|
300
|
+
const self = resolveCodeSelf();
|
|
301
|
+
recordUsage('code_reindex', '', self.repo, usageWho(extra));
|
|
302
|
+
return JSON.stringify(await handleCodeReindex(input, self));
|
|
204
303
|
}));
|
|
205
|
-
server.tool('
|
|
206
|
-
|
|
207
|
-
|
|
304
|
+
server.tool('code_status', 'Report the code index state of the calling session\'s own repo: the last analyze run (phase, result indexed|up-to-date|incomplete|failed, last log line, log path), live readiness (ready|building|interrupted|inconsistent|missing; building = an analyze is live, including one rewriting an existing index, which is never served meanwhile; interrupted = marked incomplete with no analyze running; inconsistent = the gitnexus registry or the fleet record of its last build names a different commit than meta.json, with the reason in inconsistency), the indexed commit, autoReindexPaused (a failed automatic run that paused automatic rebuilds until code_reindex), and injectedBlockFiles / injectedBlockWarning (agent docs still holding a gitnexus block from an earlier plain analyze run). Only the gitnexus provider is supported: provider none fails with E-CODE-INTEL-DISABLED, any other provider gets {outcome: "not-started", reason: "provider-not-supported", provider, indexedCommit: null} instead of gitnexus readiness.' + CODE_SELF_NOTE, codeStatusSchema.shape, wrapTool('code_status', async (input, extra) => {
|
|
305
|
+
const self = resolveCodeSelf();
|
|
306
|
+
recordUsage('code_status', '', self.repo, usageWho(extra));
|
|
307
|
+
return JSON.stringify(await handleCodeStatus(input, self));
|
|
208
308
|
}));
|
|
209
309
|
// --- Knowledge Bank ---
|
|
210
|
-
server.tool('kb_capture', 'Capture a learning, fact, or file summary into the knowledge bank. Confidence is capped at INFERRED: any CONFIRMED passed here is downgraded to INFERRED, and a user-directive is stored UNVERIFIED as a pending proposal until a human approves it; confidence_clamped:true whenever the stored confidence differs from the requested one (default INFERRED). CONFIRMED is minted ONLY via kb_promote. Returns {id, audn_decision, confidence_clamped}. audn_decision: add=new entry, none=duplicate skipped, update=same-topic predecessor linked (refines; both entries stay live), flagged=contradiction flagged for review. Pass supersedes:<id> to retire that entry instead (only takes effect if AUDN independently matched it).', kbCaptureSchema.shape, wrapTool('kb_capture', (input) => kbCapture(input)));
|
|
211
|
-
server.tool('kb_invalidate', 'Mark context-cache entries stale for the given file paths. Call after modifying files to ensure the KB reflects the current state.', kbInvalidateSchema.shape, wrapTool('kb_invalidate', (input) => kbInvalidate(input)));
|
|
212
|
-
server.tool('kb_context', 'Check freshness of files against the knowledge bank. Returns {fresh, stale, missing} -- fresh files can be skipped, stale/missing files must be re-read.', kbContextSchema.shape, wrapTool('kb_context', (input) => kbContext(input)));
|
|
213
|
-
server.tool('kb_session_prime', 'Prime a session with KB context. Returns session_warm status, stale files needing re-read, top KB entries, and recommended GitNexus calls.', kbSessionPrimeSchema.shape, wrapTool('kb_session_prime', (input) => kbSessionPrime(input)));
|
|
214
|
-
server.tool('kb_query', 'Two-level knowledge bank search. L1: FTS5 on title+summary (up to 20 results). L2: full content for top 5 hits (max 800 tokens each). Excludes stale/superseded by default. Optional tag filter (exact match) ANDs alongside other filters without touching FTS/OR-join logic, and may be used alone (no query) to list all entries carrying the tag. Pass flagged_only: true to list all contradiction-flagged entry pairs for resolution. Pass expand_related: true to also receive related_claims -- entries joined to the top hits by a refines or contradiction_of edge. Those record the KB own judgements about its contents (there is a newer framing of this; something disputes this) and cannot be reached by a text match. shares_file/shares_symbol edges are deliberately not traversed, since FTS over those same fields already surfaces them. Default false, in which case related_claims is absent and the result shape is unchanged.', kbQuerySchema.shape, wrapTool('kb_query', (input) => kbQuery(input)));
|
|
215
|
-
server.tool('kb_list', 'List KB entries by confidence/type/module/symbol/tag -- audit the CONFIRMED
|
|
216
|
-
server.tool('kb_harvest', 'Scan a session transcript for learnings and capture them into the KB. Returns {entries_captured, entries_updated, entries_skipped}. Extracted entries are UNVERIFIED and author=harvest, source=harvest.', kbHarvestSchema.shape, wrapTool('kb_harvest', (input) => kbHarvest(input)));
|
|
217
|
-
server.tool('kb_promote', 'Upgrade KB entry confidence: UNVERIFIED -> INFERRED -> CONFIRMED. Appends promotion note to content as evidence trail. CONFIRMED entries are no-op.', kbPromoteSchema.shape, wrapTool('kb_promote', (input) => kbPromote(input)));
|
|
218
|
-
server.tool('kb_freshness_sweep', 'Bounded full-KB bidirectional freshness sweep: re-hash every entry that has a stored per-file basis against the CURRENT worktree, mark mismatches stale, and revive stale entries whose full basis matches again (superseded, feedback-downvoted, and invalidated entries stay retired). This is the branch-switch revival surface kb_session_prime cannot be (prime excludes stale entries). Returns {checked, staled, unstaled}.', kbFreshnessSweepSchema.shape, wrapTool('kb_freshness_sweep', (input) => kbFreshnessSweep(input)));
|
|
219
|
-
server.tool('kb_import', 'Import a merged bible (.fleet/kb-canonical.json) into the warm local KB -- the post-merge write path (the prime-time cold-seed is output-only). Reads the repo-resolved bible, or an explicit --path file. Each entry routes through the AUDN choke point (duplicate -> skipped, refinement -> linked, contradiction -> flagged); non-directive entries KEEP their bible confidence (the bible is a git-reviewed, human-merged artifact), stamped source="import"; type="user-directive" entries are FORCED to pending proposals (never active -- a bible cannot smuggle an active directive). Idempotent (re-import of the same bible adds nothing). Runs a freshness sweep after import so entries whose basis does not match this worktree are staled. Accepts
|
|
220
|
-
server.tool('kb_resolve_contradiction', 'Resolve a KB contradiction pair: {winnerId, loserId, evidence}. The SINGLE write path for reconcile resolutions (used by kb_reconcile_prefilter and the reconciler agent alike). Winner ends confidence=CONFIRMED with the evidence note appended and both flag fields cleared (flagged_for_review + contradiction_of); stale is cleared ONLY if the D2 un-stale predicate holds on the post-flag-clear row (so a downvoted or invalidated winner still stays retired -- it wins the contradiction, not its reputation). Loser ends superseded_at=now + stale=1 + flag cleared, never deleted. REFUSES (throws, writes nothing) when either id is missing, either entry is already superseded, the ids do not form a genuinely linked contradiction pair, or the pair involves an ACTIVE user-directive.', kbResolveContradictionSchema.shape, wrapTool('kb_resolve_contradiction', (input) => kbResolveContradiction(input)));
|
|
221
|
-
server.tool('kb_reconcile_prefilter', 'Mechanical hash-basis prefilter over all flagged contradiction pairs (including stale members -- see flaggedPairs liveness contract). Re-hashes both sides of each pair against the CURRENT worktree: exactly one side fully matching wins mechanically via kb_resolve_contradiction (evidence "hash-basis match on merged worktree"); both match, both mismatch, or an empty/missing basis on either side leaves the pair for the reconciler agent. Pairs involving an ACTIVE user-directive are never touched. Returns {pairs, resolved, left_for_agent, skipped_directive}. Run after kb_import + kb_freshness_sweep, before dispatching the reconciler agent.', kbReconcilePrefilterSchema.shape, wrapTool('kb_reconcile_prefilter', (input) => kbReconcilePrefilter(input)));
|
|
222
|
-
server.tool('kb_setup', 'Set up KB: install git post-commit hook, write provider config, store remote credentials encrypted. Run once per repo.', kbSetupSchema.shape, wrapTool('kb_setup', (input) => kbSetup(input)));
|
|
223
|
-
server.tool('kb_export', 'Export
|
|
224
|
-
server.tool('
|
|
225
|
-
server.tool('
|
|
310
|
+
server.tool('kb_capture', 'Capture a learning, fact, or file summary into the knowledge bank. Confidence is capped at INFERRED: any CONFIRMED passed here is downgraded to INFERRED, and a user-directive is stored UNVERIFIED as a pending proposal until a human approves it; confidence_clamped:true whenever the stored confidence differs from the requested one (default INFERRED). CONFIRMED is minted ONLY via kb_promote. Returns {id, audn_decision, confidence_clamped}. audn_decision: add=new entry, none=duplicate skipped, update=same-topic predecessor linked (refines; both entries stay live), flagged=contradiction flagged for review. Pass supersedes:<id> to retire that entry instead (only takes effect if AUDN independently matched it). In a MEMBER session the entry is stored in the per-repo DB tagged member:<caller uuid>. A MEMBER session without the kb_maintainer grant never retires a CONFIRMED entry through supersedes (a retired entry leaves the bible at the next kb_bible_commit): the capture links to it instead (refines, both stay live) and the response adds refused, the CONFIRMED ids left live; refused is present exactly when such a session passed supersedes.' + KB_SELF_NOTE, kbCaptureSchema.shape, wrapTool('kb_capture', (input) => kbCapture(input)));
|
|
311
|
+
server.tool('kb_invalidate', 'Mark context-cache entries stale for the given file paths (pass files), or discard entries by id (pass ids): discarding sets superseded_at so the entry drops out of every read. Exactly one of files or ids. ids returns {discarded, not_found, already_discarded}. In a MEMBER session both forms act only on entries tagged member:<caller uuid>: files leaves other entries for those files untouched, and with ids any other id is reported in not_found and changes nothing. A MEMBER session without the kb_maintainer grant cannot retire a CONFIRMED entry by either form (a retired entry leaves the bible at the next kb_bible_commit): such ids are left untouched and listed in refused, which the response carries exactly for such a session. Call after modifying files to ensure the KB reflects the current state.' + KB_SELF_NOTE, kbInvalidateSchema.shape, wrapTool('kb_invalidate', (input) => kbInvalidate(input)));
|
|
312
|
+
server.tool('kb_context', 'Check freshness of files against the knowledge bank. Returns {fresh, stale, missing} -- fresh files can be skipped, stale/missing files must be re-read. With no confidence filter the default is confidence ["CONFIRMED","INFERRED"] plus exclude_disputed (a context-cache entry is verified by its content hash); UNVERIFIED only when listed explicitly. In a MEMBER session the default read merges the member\'s checkout bible (CONFIRMED) with the member\'s own CONFIRMED/INFERRED captures (tagged member:<caller uuid>).' + KB_SELF_NOTE, kbContextSchema.shape, wrapTool('kb_context', (input) => kbContext(input)));
|
|
313
|
+
server.tool('kb_session_prime', 'Prime a session with KB context. Returns session_warm status, stale files needing re-read, top KB entries, and recommended GitNexus calls. In a MEMBER session the entries come from the member\'s checkout bible.' + KB_SELF_NOTE, kbSessionPrimeSchema.shape, wrapTool('kb_session_prime', (input) => kbSessionPrime(input)));
|
|
314
|
+
server.tool('kb_query', 'Two-level knowledge bank search. L1: FTS5 on title+summary (up to 20 results). L2: full content for top 5 hits (max 800 tokens each). Excludes stale/superseded by default. Optional tag filter (exact match) ANDs alongside other filters without touching FTS/OR-join logic, and may be used alone (no query) to list all entries carrying the tag. Pass flagged_only: true to list all contradiction-flagged entry pairs for resolution. Pass expand_related: true to also receive related_claims -- entries joined to the top hits by a refines or contradiction_of edge. Those record the KB own judgements about its contents (there is a newer framing of this; something disputes this) and cannot be reached by a text match. shares_file/shares_symbol edges are deliberately not traversed, since FTS over those same fields already surfaces them. Default false, in which case related_claims is absent and the result shape is unchanged. With no confidence filter the default is confidence ["CONFIRMED"] plus exclude_disputed: true, so only CONFIRMED entries outside any unresolved contradiction are returned (related_claims included). Pass an explicit confidence list (e.g. ["CONFIRMED","INFERRED","UNVERIFIED"]) to opt into other tiers; exclude_disputed then defaults off unless set true. flagged_only is exempt. In a MEMBER session the default (CONFIRMED) read comes from the member\'s checkout bible; an explicit INFERRED/UNVERIFIED read comes from the per-repo DB and returns only entries tagged member:<caller uuid>.' + KB_SELF_NOTE, kbQuerySchema.shape, wrapTool('kb_query', (input) => kbQuery(input)));
|
|
315
|
+
server.tool('kb_list', 'List KB entries by confidence/type/module/symbol/tag -- audit the KB. With no confidence filter, returns only CONFIRMED, undisputed entries; pass an explicit confidence list (e.g. ["INFERRED","UNVERIFIED"]; a single tier string such as "INFERRED" is accepted as a one-element list) to see other tiers without touching FTS ranking or use_count telemetry. Excludes superseded/stale entries. Returns {results, total} with each entry as {id, type, confidence, title, summary, symbols, source_files}. In a MEMBER session the default (CONFIRMED) list comes from the member\'s checkout bible; an explicit INFERRED/UNVERIFIED list comes from the per-repo DB, own-tagged entries only.' + KB_SELF_NOTE, kbListSchema.shape, wrapTool('kb_list', (input) => kbList(input)));
|
|
316
|
+
server.tool('kb_harvest', 'Scan a session transcript for learnings and capture them into the KB. Returns {entries_captured, entries_updated, entries_skipped}. Extracted entries are UNVERIFIED and author=harvest, source=harvest.' + KB_SELF_NOTE, kbHarvestSchema.shape, wrapTool('kb_harvest', (input) => kbHarvest(input)));
|
|
317
|
+
server.tool('kb_promote', 'Upgrade KB entry confidence: UNVERIFIED -> INFERRED -> CONFIRMED. Appends promotion note to content as evidence trail. CONFIRMED entries are no-op. In a MEMBER session only entries tagged member:<caller uuid> can be promoted; any other id returns not-found and changes nothing.' + KB_SELF_NOTE, kbPromoteSchema.shape, wrapTool('kb_promote', (input) => kbPromote(input)));
|
|
318
|
+
server.tool('kb_freshness_sweep', 'Bounded full-KB bidirectional freshness sweep: re-hash every entry that has a stored per-file basis against the CURRENT worktree, mark mismatches stale, and revive stale entries whose full basis matches again (superseded, feedback-downvoted, and invalidated entries stay retired). This is the branch-switch revival surface kb_session_prime cannot be (prime excludes stale entries). Returns {checked, staled, unstaled}.' + KB_SELF_NOTE, kbFreshnessSweepSchema.shape, wrapTool('kb_freshness_sweep', (input) => kbFreshnessSweep(input)));
|
|
319
|
+
server.tool('kb_import', 'Import a merged bible (.fleet/kb-canonical.json) into the warm local KB -- the post-merge write path (the prime-time cold-seed is output-only). Reads the repo-resolved bible, or an explicit --path file. Each entry routes through the AUDN choke point (duplicate -> skipped, refinement -> linked, contradiction -> flagged); non-directive entries KEEP their bible confidence (the bible is a git-reviewed, human-merged artifact), stamped source="import"; type="user-directive" entries are FORCED to pending proposals (never active -- a bible cannot smuggle an active directive). Idempotent (re-import of the same bible adds nothing). Runs a freshness sweep after import so entries whose basis does not match this worktree are staled. Accepts every bible shape: a legacy bare JSON array and the v2/v3 {version, provenance:{commit, branch, entry_count}, entries} envelope. A v3 entry\'s source_file_hashes (repo-relative path -> hash, covering every cited file) is stored as its basis exactly -- local files are never re-hashed for it; an entry without a valid carried map (any v1/v2 entry) gets a LOCAL freshness-only basis hashed from this worktree, so it still goes stale when a cited file changes; that local basis is never exported and never admits the entry to kb_export or kb_bible_commit, so neither re-publishes it until it is recaptured. Entries with no source_files, or citing files absent from this worktree, are REJECTED (an entry with no checkable basis can never be staled, so nothing could falsify it) -- re-importing a legacy bible deliberately drops those. Returns {imported, skipped, linked, flagged, rejected, sweep:{checked, staled, unstaled}}. Pass skip_sweep: true to skip the post-import freshness sweep -- the sweep re-judges EVERY entry against the given worktree, which is right for a deliberate audit but wrong for a routine warm-the-KB import (it mass-stales entries merely because unrelated files moved on, which in turn empties the promotion candidates kb_list returns). `path` names only the bible file to read, never which KB is written. TRUST BOUNDARY: importing the repo-resolved bible as committed is the git-reviewed trusted channel; an explicit --path bible is caller-asserted trust, equivalent in power to kb_promote, so a MEMBER session without the kb_maintainer grant is refused an explicit path (other than its own .fleet/kb-canonical.json) with E-KB-MAINTAINER-REQUIRED and nothing is imported; without path (or naming its own bible) it imports the COMMITTED .fleet/kb-canonical.json at HEAD, never the member-writable work-tree file, and the response adds bible_source:"HEAD" and worktree_ignored (true when uncommitted work-tree content was not imported); with no committed copy, or when that committed bible was never written or imported by the maintainer side, it fails with E-KB-MAINTAINER-REQUIRED and nothing is imported. Pass ref (a plain git ref name, e.g. refs/remotes/origin/main) to read the bible as committed at that ref instead of the file on disk, in any session: the bytes are verified against the git blob id in-process, bible_source reports the ref, a ref without the bible fails with E-BIBLE-NOT-FOUND, and a kb_maintainer or FULL session records that verified blob as trusted (the engine seeds trust this way from the base branch, never from a work tree). Directives are quarantined either way; activation stays CLI-only.' + KB_SELF_NOTE, kbImportSchema.shape, wrapTool('kb_import', (input) => kbImport(input)));
|
|
320
|
+
server.tool('kb_resolve_contradiction', 'Resolve a KB contradiction pair: {winnerId, loserId, evidence}. The SINGLE write path for reconcile resolutions (used by kb_reconcile_prefilter and the reconciler agent alike). Winner ends confidence=CONFIRMED with the evidence note appended and both flag fields cleared (flagged_for_review + contradiction_of); stale is cleared ONLY if the D2 un-stale predicate holds on the post-flag-clear row (so a downvoted or invalidated winner still stays retired -- it wins the contradiction, not its reputation). Loser ends superseded_at=now + stale=1 + flag cleared, never deleted. REFUSES (throws, writes nothing) when either id is missing, either entry is already superseded, the ids do not form a genuinely linked contradiction pair, or the pair involves an ACTIVE user-directive.' + KB_SELF_NOTE, kbResolveContradictionSchema.shape, wrapTool('kb_resolve_contradiction', (input) => kbResolveContradiction(input)));
|
|
321
|
+
server.tool('kb_reconcile_prefilter', 'Mechanical hash-basis prefilter over all flagged contradiction pairs (including stale members -- see flaggedPairs liveness contract). Re-hashes both sides of each pair against the CURRENT worktree: exactly one side fully matching wins mechanically via kb_resolve_contradiction (evidence "hash-basis match on merged worktree"); both match, both mismatch, or an empty/missing basis on either side leaves the pair for the reconciler agent. Pairs involving an ACTIVE user-directive are never touched. Returns {pairs, resolved, left_for_agent, skipped_directive}. Run after kb_import + kb_freshness_sweep, before dispatching the reconciler agent. It mints CONFIRMED, so a MEMBER session is served it only with the kb_maintainer grant (like kb_resolve_contradiction).' + KB_SELF_NOTE, kbReconcilePrefilterSchema.shape, wrapTool('kb_reconcile_prefilter', (input) => kbReconcilePrefilter(input)));
|
|
322
|
+
server.tool('kb_setup', 'Set up KB: install git post-commit hook, write provider config, store remote credentials encrypted. Run once per repo.' + KB_SELF_NOTE, kbSetupSchema.shape, wrapTool('kb_setup', (input) => kbSetup(input)));
|
|
323
|
+
server.tool('kb_export', 'Export CONFIRMED, non-superseded, non-stale KB entries to a canonical bible file (stable field set, deterministic id order, ASCII-safe). scope="project" (default): reads the project KB and ADDITIVELY merges into <repo>/.fleet/kb-canonical.json. Only entries whose cited source_files each have a recorded per-file hash that matches the file at the repo\'s HEAD commit qualify (an empty or missing basis, or a cited file absent at HEAD, excludes the entry; uncommitted edits never change the verdict; a folder that is not a git work tree is refused, never hashed from disk). Entries already in the bible are never removed or rewritten (the existing bible entry wins on an id clash); only qualifying new ids are added, and when none qualify the file is left untouched and nothing is committed. exported is the entry count of the resulting bible. scope="global" is unchanged: it exports the full GLOBAL set with no basis filter. scope="global": reads the GLOBAL KB, writes <repo>/.fleet/kb-canonical-global.json (in practice the apra-fleet platform repo, committed there so the installer can distribute it to every project on the machine -- D8/F9). Run after kb_promote so the canonical set stays current. F6a: the tool itself auto-commits the bible file (pathspec-only, identity pm-kb) when the repo is a git repo and the content changed -- this is code, not agent discretion, so no manual git step is needed, and this applies to the global file too. Non-fatal on any git failure; push is not automatic. Writes the v3 format: {version:3, provenance:{commit, branch, entry_count}, entries:[...]}; each project entry it adds carries source_file_hashes, its stored per-file hash basis (repo-relative path -> hash; never re-hashed at write time). Refuses (throws, file untouched) to write a bible holding a duplicate id. provenance.branch is the target base branch (the branch the entries merge into) and provenance.commit the base commit the entries were verified against (a commit, not a timestamp, so re-exports stay diff-free when nothing changed): pass baseBranch and baseCommit to state them explicitly; when omitted they default to the export folder HEAD branch and commit. An export whose entry set is unchanged rewrites nothing. Auto-commit defaults to ON (USER DIRECTIVE 2026-08-11 -- an export left uncommitted is knowledge nobody else ever sees): set FLEET_DIR/knowledge/config.json { bible: { autoCommit: false } } to opt out. A malformed config disables it.' + KB_SELF_NOTE, kbExportSchema.shape, wrapTool('kb_export', (input) => kbExport(input)));
|
|
324
|
+
server.tool('kb_bible_commit', 'Commit one round of confirmed entries to the bible: { ids, baseBranch, baseCommit }. Merges exactly the given ids from this repository\'s KB into <repo>/.fleet/kb-canonical.json at ENTRY level -- only the given ids are added or replaced; every entry already in the file is kept unless this KB holds it as superseded or invalidated, and an entry in the file but not in the KB (or CONFIRMED and current, or merely stale) is never dropped -- in kb_export\'s stable serialization (v3 envelope, id order, ASCII-safe; each merged entry carries its stored source_file_hashes basis). provenance.branch is baseBranch (the sprint\'s target base branch) and provenance.commit is baseCommit (the base commit the entries were verified against), never the working folder HEAD. Then makes a local commit scoped to that one path (identity pm-kb). It NEVER pushes. Re-running with the same ids after resetting to a newer HEAD re-merges at entry level, so a rejected push can be retried with no manual merge. Ids that are unknown, stale, superseded, or not CONFIRMED are SKIPPED (never an error) and reported in skipped with reason not_confirmed_or_unknown. A CONFIRMED id is admitted only if it passes the same basis rule kb_export (scope=project) applies: every cited source file has a recorded per-file hash that matches that file\'s content at the repo\'s HEAD commit (an empty or missing basis, a cited file with no basis key, a file absent or changed at HEAD, or a path that is not repo-relative excludes it; uncommitted edits never change the verdict; a folder that is not a git work tree is refused, never hashed from disk); such an id is SKIPPED with reason basis_mismatch, logged, and any entry already in the bible for it is left unchanged. A CONFIRMED id that cites no source file has no checkable basis and is SKIPPED with its own reason no_source_files (never basis_mismatch), also leaving any existing bible entry unchanged. At every call (also with no ids) each bible entry this KB holds as superseded or invalidated is REMOVED and reported in removed as {id, reason} (reason superseded or invalidated); the commit message lists each removal. kb_export never removes entries. Also at every call, each bible entry with no source_file_hashes (carried over from a v1/v2 bible) that this KB holds under the same id, citing the same source files, with a stored basis that passes the same basis rule at HEAD gains that stored basis as its source_file_hashes (only that field changes; an entry that does not qualify is kept unchanged, never dropped); backfilled reports how many, and the commit message names the count. Nothing merged, nothing removed and nothing backfilled, or an unchanged entry set: no write and no commit. Refuses (throws, file untouched) when the existing bible file is unreadable or holds a duplicate id, or when the local commit fails. Returns {path, merged, skipped, removed, entry_count, backfilled, committed}.' + KB_SELF_NOTE, kbBibleCommitSchema.shape, wrapTool('kb_bible_commit', (input) => kbBibleCommit(input)));
|
|
325
|
+
server.tool('kb_stats', 'Read-only KB health aggregation: totals by confidence/type, stale/flagged/superseded counts, retrieval hit_rate, promote_ratio, canonical-bible presence/drift, and optional per-symbol coverage. Never bumps use_count/last_accessed (kb_list pattern). Bible drift is visibility for the machine that owns the KB -- CI cannot see the local kb.sqlite, so there is no CI gate on it. In a MEMBER session the counts describe the member\'s checkout bible.' + KB_SELF_NOTE, kbStatsSchema.shape, wrapTool('kb_stats', (input) => kbStats(input)));
|
|
326
|
+
server.tool('kb_feedback', 'Downvote a KB entry that proved wrong in practice: { id, reason, role? }. Marks the entry stale=1 + flagged_for_review=1 and appends an ASCII feedback note "[feedback <ISO>] <validated-role>: <reason>" (CONTENT_CAP respected). NEVER deletes and NEVER touches confidence -- a downvoted CONFIRMED entry stays CONFIRMED-but-stale-flagged; the human resolves it in kb-review, this tool only flags it for that review. Exception: an ACTIVE user-directive is flagged for review but NOT staled (directives outrank agent experience -- the human decides); a pending directive proposal stales normally. Not available in a MEMBER session: it returns E-MEMBER-VIEW-READ-ONLY and changes nothing.' + KB_SELF_NOTE, kbFeedbackSchema.shape, wrapTool('kb_feedback', (input) => kbFeedback(input)));
|
|
226
327
|
}
|
|
227
328
|
//# sourceMappingURL=tool-registry.js.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export type ToolScope = {
|
|
2
|
+
kind: 'full';
|
|
3
|
+
} | {
|
|
4
|
+
kind: 'member';
|
|
5
|
+
memberId: string;
|
|
6
|
+
channelCapable: boolean;
|
|
7
|
+
engineOrigin?: boolean;
|
|
8
|
+
kbMaintainer?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const FULL_TOOL_SCOPE: ToolScope;
|
|
11
|
+
/**
|
|
12
|
+
* `engineOrigin` marks a session the ENGINE opened as the member (origin=engine
|
|
13
|
+
* on the MCP URL: the memberCall local adapter and the `apra-fleet call` verb).
|
|
14
|
+
* Same tool surface; its kb_/code_ calls are excluded from the member's
|
|
15
|
+
* session_stats counts (src/services/member-call-counts.ts).
|
|
16
|
+
*
|
|
17
|
+
* `kbMaintainer` is the engine's kb_maintainer grant (kb_maintainer=1 on an
|
|
18
|
+
* origin=engine member URL): the engine opens it only for the member it chose
|
|
19
|
+
* as a repository's kb_maintainer, to apply promotions there. It adds
|
|
20
|
+
* MEMBER_MAINTAINER_TOOLS. It is honoured only together with engineOrigin --
|
|
21
|
+
* the per-folder ?member= entry an agent session uses never carries it. Like
|
|
22
|
+
* ?member= and origin=engine it is an unauthenticated loopback URL parameter:
|
|
23
|
+
* a routing guard that keeps agent sessions off CONFIRMED-minting tools, not a
|
|
24
|
+
* security boundary against a local process (which can open a FULL session).
|
|
25
|
+
*/
|
|
26
|
+
export declare function memberToolScope(memberId: string, channelCapable: boolean, engineOrigin?: boolean, kbMaintainer?: boolean): ToolScope;
|
|
27
|
+
/** True for a member scope whose session was opened with origin=engine. */
|
|
28
|
+
export declare function scopeIsEngineOrigin(scope: ToolScope): boolean;
|
|
29
|
+
/** True when `name` may be registered on a session with the given scope. */
|
|
30
|
+
export declare function isToolInScope(name: string, scope: ToolScope): boolean;
|
|
31
|
+
/** The member id of the session a scope belongs to (undefined for FULL). */
|
|
32
|
+
export declare function scopeMemberId(scope: ToolScope): string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* True for a member scope carrying the kb_maintainer grant (which
|
|
35
|
+
* memberToolScope only sets together with engineOrigin). False for FULL: a
|
|
36
|
+
* FULL session is not a member session and is not gated by the grant at all.
|
|
37
|
+
*/
|
|
38
|
+
export declare function scopeHasKbMaintainer(scope: ToolScope): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Run a tool handler with the calling session's member id (and whether that
|
|
41
|
+
* member session carries the kb_maintainer grant) in context.
|
|
42
|
+
*/
|
|
43
|
+
export declare function runWithSessionMember<T>(sessionMemberId: string | undefined, fn: () => T, opts?: {
|
|
44
|
+
kbMaintainer?: boolean;
|
|
45
|
+
}): T;
|
|
46
|
+
/**
|
|
47
|
+
* The member id of the MCP session whose tool call is currently executing,
|
|
48
|
+
* or undefined for a FULL (non-member) session or outside any tool call.
|
|
49
|
+
*/
|
|
50
|
+
export declare function getSessionMemberId(): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Whether the MEMBER session whose tool call is currently executing carries
|
|
53
|
+
* the kb_maintainer grant. False for a member session without it, for a FULL
|
|
54
|
+
* session (which the grant does not gate) and outside any tool call -- callers
|
|
55
|
+
* gating a member-only path check getSessionMemberId() first.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getSessionKbMaintainer(): boolean;
|
|
58
|
+
//# sourceMappingURL=tool-scope.d.ts.map
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// Per-session tool scope for the fleet MCP server.
|
|
2
|
+
//
|
|
3
|
+
// Every MCP session gets its own McpServer, and registerAllTools registers
|
|
4
|
+
// only the tools in that session's scope (deny by omission: an out-of-scope
|
|
5
|
+
// tool never appears in tools/list and calling it fails as an unknown tool).
|
|
6
|
+
//
|
|
7
|
+
// FULL -- no member identity (the local orchestrator/PM/tool session).
|
|
8
|
+
// Every tool, unchanged.
|
|
9
|
+
// MEMBER -- a session identified as a registered fleet member, by a valid
|
|
10
|
+
// member JWT or by ?member=<uuid>. The base member allowlist
|
|
11
|
+
// (src/services/member-tool-allowlist.ts), plus
|
|
12
|
+
// MEMBER_CHANNEL_TOOLS when the client declared the claude/channel
|
|
13
|
+
// capability at initialize (an interactive session that answers
|
|
14
|
+
// execute_prompt via respond_to_message), plus
|
|
15
|
+
// MEMBER_MAINTAINER_TOOLS (kb_promote, kb_resolve_contradiction,
|
|
16
|
+
// kb_reconcile_prefilter) when the session carries the
|
|
17
|
+
// kb_maintainer grant.
|
|
18
|
+
//
|
|
19
|
+
// The calling session's member id, and whether it carries the kb_maintainer
|
|
20
|
+
// grant, are also made available to tool handlers while they run
|
|
21
|
+
// (getSessionMemberId, getSessionKbMaintainer), so handlers do not have to
|
|
22
|
+
// guess them.
|
|
23
|
+
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
24
|
+
import { isMemberAllowedTool, isMemberMaintainerTool, MEMBER_CHANNEL_TOOLS } from './member-tool-allowlist.js';
|
|
25
|
+
export const FULL_TOOL_SCOPE = Object.freeze({ kind: 'full' });
|
|
26
|
+
/**
|
|
27
|
+
* `engineOrigin` marks a session the ENGINE opened as the member (origin=engine
|
|
28
|
+
* on the MCP URL: the memberCall local adapter and the `apra-fleet call` verb).
|
|
29
|
+
* Same tool surface; its kb_/code_ calls are excluded from the member's
|
|
30
|
+
* session_stats counts (src/services/member-call-counts.ts).
|
|
31
|
+
*
|
|
32
|
+
* `kbMaintainer` is the engine's kb_maintainer grant (kb_maintainer=1 on an
|
|
33
|
+
* origin=engine member URL): the engine opens it only for the member it chose
|
|
34
|
+
* as a repository's kb_maintainer, to apply promotions there. It adds
|
|
35
|
+
* MEMBER_MAINTAINER_TOOLS. It is honoured only together with engineOrigin --
|
|
36
|
+
* the per-folder ?member= entry an agent session uses never carries it. Like
|
|
37
|
+
* ?member= and origin=engine it is an unauthenticated loopback URL parameter:
|
|
38
|
+
* a routing guard that keeps agent sessions off CONFIRMED-minting tools, not a
|
|
39
|
+
* security boundary against a local process (which can open a FULL session).
|
|
40
|
+
*/
|
|
41
|
+
export function memberToolScope(memberId, channelCapable, engineOrigin = false, kbMaintainer = false) {
|
|
42
|
+
const scope = { kind: 'member', memberId, channelCapable };
|
|
43
|
+
if (engineOrigin)
|
|
44
|
+
scope.engineOrigin = true;
|
|
45
|
+
if (engineOrigin && kbMaintainer)
|
|
46
|
+
scope.kbMaintainer = true;
|
|
47
|
+
return scope;
|
|
48
|
+
}
|
|
49
|
+
/** True for a member scope whose session was opened with origin=engine. */
|
|
50
|
+
export function scopeIsEngineOrigin(scope) {
|
|
51
|
+
return scope.kind === 'member' && scope.engineOrigin === true;
|
|
52
|
+
}
|
|
53
|
+
/** True when `name` may be registered on a session with the given scope. */
|
|
54
|
+
export function isToolInScope(name, scope) {
|
|
55
|
+
if (scope.kind === 'full')
|
|
56
|
+
return true;
|
|
57
|
+
if (isMemberAllowedTool(name))
|
|
58
|
+
return true;
|
|
59
|
+
if (scope.kbMaintainer === true && isMemberMaintainerTool(name))
|
|
60
|
+
return true;
|
|
61
|
+
return scope.channelCapable && MEMBER_CHANNEL_TOOLS.includes(name);
|
|
62
|
+
}
|
|
63
|
+
/** The member id of the session a scope belongs to (undefined for FULL). */
|
|
64
|
+
export function scopeMemberId(scope) {
|
|
65
|
+
return scope.kind === 'member' ? scope.memberId : undefined;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* True for a member scope carrying the kb_maintainer grant (which
|
|
69
|
+
* memberToolScope only sets together with engineOrigin). False for FULL: a
|
|
70
|
+
* FULL session is not a member session and is not gated by the grant at all.
|
|
71
|
+
*/
|
|
72
|
+
export function scopeHasKbMaintainer(scope) {
|
|
73
|
+
return scope.kind === 'member' && scope.kbMaintainer === true;
|
|
74
|
+
}
|
|
75
|
+
const toolCallContext = new AsyncLocalStorage();
|
|
76
|
+
/**
|
|
77
|
+
* Run a tool handler with the calling session's member id (and whether that
|
|
78
|
+
* member session carries the kb_maintainer grant) in context.
|
|
79
|
+
*/
|
|
80
|
+
export function runWithSessionMember(sessionMemberId, fn, opts = {}) {
|
|
81
|
+
return toolCallContext.run({ sessionMemberId, kbMaintainer: opts.kbMaintainer === true }, fn);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The member id of the MCP session whose tool call is currently executing,
|
|
85
|
+
* or undefined for a FULL (non-member) session or outside any tool call.
|
|
86
|
+
*/
|
|
87
|
+
export function getSessionMemberId() {
|
|
88
|
+
return toolCallContext.getStore()?.sessionMemberId;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Whether the MEMBER session whose tool call is currently executing carries
|
|
92
|
+
* the kb_maintainer grant. False for a member session without it, for a FULL
|
|
93
|
+
* session (which the grant does not gate) and outside any tool call -- callers
|
|
94
|
+
* gating a member-only path check getSessionMemberId() first.
|
|
95
|
+
*/
|
|
96
|
+
export function getSessionKbMaintainer() {
|
|
97
|
+
return toolCallContext.getStore()?.kbMaintainer === true;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=tool-scope.js.map
|
|
@@ -13,7 +13,7 @@ Get the shape right before launching.
|
|
|
13
13
|
| Field | Required | Type | Default | Notes |
|
|
14
14
|
|-------|----------|------|---------|-------|
|
|
15
15
|
| `issues` | **yes** | array of strings | -- | Beads issue IDs (sprint roots), e.g. `["BD-1","BD-2"]`. Must be non-empty; every entry a non-empty string. |
|
|
16
|
-
| `branch` | **yes** | string | -- | Sprint branch name, e.g. `"feat/auth"`. Created from `origin/<base_branch>` if it does not exist. |
|
|
16
|
+
| `branch` | **yes** | string | -- | Sprint branch name, e.g. `"feat/auth"`. Created from `origin/<base_branch>` if it does not exist. Must differ from `base_branch`. |
|
|
17
17
|
| `goal` | no | string | `"P1/P2"` | Exit when no open issues at or above this priority. Must be exactly `"P1"`, `"P1/P2"`, or `"P1/P2/P3"`. |
|
|
18
18
|
| `max_cycles` | no | positive integer | `5` | Hard cycle ceiling. |
|
|
19
19
|
| `base_branch` | no | string | `"main"` | PR target branch. |
|
|
@@ -70,7 +70,7 @@ explicit `branch`.
|
|
|
70
70
|
1. **Issues exist and are open** -- `bd show <id>` for each root; a missing root hard-fails preflight.
|
|
71
71
|
2. **Ready leaf work exists** -- at least some leaves under the roots are unblocked (`bd ready`); an all-blocked backlog deadlocks and aborts.
|
|
72
72
|
3. **Branch name chosen** -- explicit `branch`, created if absent.
|
|
73
|
-
4. **`base_branch` is the intended PR target** (default `main`).
|
|
73
|
+
4. **`base_branch` is the intended PR target** (default `main`) and must differ from `branch` -- an equal pair is rejected at launch.
|
|
74
74
|
5. **Branching off latest main** -- the workflow fetches and cuts new branches from `origin/<base_branch>`; if fetch fails, launch fails. Make sure the remote is reachable.
|
|
75
75
|
|
|
76
76
|
## Common failures and the exact error you'll see
|