@apralabs/apra-fleet 0.4.2 → 0.4.3
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 +38 -5
- package/dist/agents/backlog-groomer.md +25 -0
- package/dist/agents/ci-watcher.md +11 -0
- package/dist/agents/deployer.md +37 -2
- package/dist/agents/doer.md +36 -12
- package/dist/agents/harvester.md +11 -0
- package/dist/agents/integ-test-runner.md +11 -0
- package/dist/agents/kb-reconciler.md +9 -0
- package/dist/agents/plan-reviewer.md +110 -22
- package/dist/agents/planner.md +125 -37
- package/dist/agents/regression-test-runner.md +11 -0
- package/dist/agents/reviewer.md +13 -2
- package/dist/agents/schemas/plan-reviewer-output.json +37 -0
- package/dist/cli/agent-transform.d.ts +83 -2
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +266 -21
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +28 -9
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +7 -5
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +44 -34
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/install.d.ts +33 -0
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +290 -23
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/kb-directives.d.ts.map +1 -1
- package/dist/cli/kb-directives.js +2 -1
- package/dist/cli/kb-directives.js.map +1 -1
- package/dist/cli/register-member.d.ts.map +1 -1
- package/dist/cli/register-member.js +6 -2
- package/dist/cli/register-member.js.map +1 -1
- package/dist/commands/kb-server.d.ts +3 -0
- package/dist/commands/kb-server.d.ts.map +1 -1
- package/dist/commands/kb-server.js +43 -3
- package/dist/commands/kb-server.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/os/linux.d.ts +6 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +35 -2
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +61 -2
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows-gitbash.d.ts +5 -0
- package/dist/os/windows-gitbash.d.ts.map +1 -1
- package/dist/os/windows-gitbash.js +15 -0
- package/dist/os/windows-gitbash.js.map +1 -1
- package/dist/os/windows.d.ts +6 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +46 -3
- package/dist/os/windows.js.map +1 -1
- package/dist/providers/agy.d.ts +115 -6
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +569 -53
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +81 -3
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +344 -10
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +4 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +19 -2
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +4 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +20 -2
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/none.d.ts +4 -2
- package/dist/providers/none.d.ts.map +1 -1
- package/dist/providers/none.js +17 -2
- package/dist/providers/none.js.map +1 -1
- package/dist/providers/opencode.d.ts +3 -1
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +22 -2
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +201 -6
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +56 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agy-project.d.ts +102 -0
- package/dist/services/agy-project.d.ts.map +1 -0
- package/dist/services/agy-project.js +356 -0
- package/dist/services/agy-project.js.map +1 -0
- package/dist/services/auth-socket.js +4 -4
- package/dist/services/auth-web.js +1 -1
- package/dist/services/cloud/lifecycle.d.ts.map +1 -1
- package/dist/services/cloud/lifecycle.js +33 -4
- package/dist/services/cloud/lifecycle.js.map +1 -1
- package/dist/services/credential-cleanup.d.ts.map +1 -1
- package/dist/services/credential-cleanup.js +35 -17
- package/dist/services/credential-cleanup.js.map +1 -1
- package/dist/services/exit-drain.d.ts +44 -0
- package/dist/services/exit-drain.d.ts.map +1 -0
- package/dist/services/exit-drain.js +52 -0
- package/dist/services/exit-drain.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +32 -4
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +1 -0
- package/dist/services/http-transport.d.ts.map +1 -1
- package/dist/services/http-transport.js +48 -1
- package/dist/services/http-transport.js.map +1 -1
- package/dist/services/knowledge/kb-config.d.ts +42 -0
- package/dist/services/knowledge/kb-config.d.ts.map +1 -0
- package/dist/services/knowledge/kb-config.js +54 -0
- package/dist/services/knowledge/kb-config.js.map +1 -0
- package/dist/services/knowledge/kb-providers.d.ts +7 -1
- package/dist/services/knowledge/kb-providers.d.ts.map +1 -1
- package/dist/services/knowledge/kb-providers.js +191 -17
- package/dist/services/knowledge/kb-providers.js.map +1 -1
- package/dist/services/knowledge/require-sqlite-project.d.ts +32 -0
- package/dist/services/knowledge/require-sqlite-project.d.ts.map +1 -0
- package/dist/services/knowledge/require-sqlite-project.js +38 -0
- package/dist/services/knowledge/require-sqlite-project.js.map +1 -0
- package/dist/services/model-pricing.d.ts.map +1 -1
- package/dist/services/model-pricing.js +7 -3
- package/dist/services/model-pricing.js.map +1 -1
- package/dist/services/secret-token.d.ts +38 -0
- package/dist/services/secret-token.d.ts.map +1 -0
- package/dist/services/secret-token.js +51 -0
- package/dist/services/secret-token.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +3 -1
- package/dist/services/service-manager/types.d.ts.map +1 -1
- package/dist/services/service-manager/windows.d.ts +14 -2
- package/dist/services/service-manager/windows.d.ts.map +1 -1
- package/dist/services/service-manager/windows.js +65 -7
- package/dist/services/service-manager/windows.js.map +1 -1
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +58 -2
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/read-log-tail.d.ts.map +1 -1
- package/dist/services/stall/read-log-tail.js +20 -10
- package/dist/services/stall/read-log-tail.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts +53 -4
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +212 -34
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +79 -2
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.js +2 -2
- package/dist/services/substitution-engine.js.map +1 -1
- package/dist/services/tool-registry.d.ts.map +1 -1
- package/dist/services/tool-registry.js +5 -3
- package/dist/services/tool-registry.js.map +1 -1
- package/dist/services/vcs/azure-devops.d.ts +66 -1
- package/dist/services/vcs/azure-devops.d.ts.map +1 -1
- package/dist/services/vcs/azure-devops.js +192 -21
- package/dist/services/vcs/azure-devops.js.map +1 -1
- package/dist/services/vcs/types.d.ts +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/dist/skills/pm/SKILL.md +1 -1
- package/dist/skills/pm/cost.md +0 -3
- package/dist/skills/pm/fleet-addendum.md +2 -2
- package/dist/tools/check-status.d.ts +7 -4
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +2 -0
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/compose-permissions.d.ts +6 -0
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +182 -34
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/credential-store-set.js +1 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +31 -20
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +15 -2
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +1196 -892
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/kb-capture.d.ts +2 -2
- package/dist/tools/kb-capture.d.ts.map +1 -1
- package/dist/tools/kb-capture.js +29 -5
- package/dist/tools/kb-capture.js.map +1 -1
- package/dist/tools/kb-export.d.ts +2 -2
- package/dist/tools/kb-export.d.ts.map +1 -1
- package/dist/tools/kb-export.js +3 -28
- package/dist/tools/kb-export.js.map +1 -1
- package/dist/tools/kb-feedback.d.ts.map +1 -1
- package/dist/tools/kb-feedback.js +3 -1
- package/dist/tools/kb-feedback.js.map +1 -1
- package/dist/tools/kb-freshness-sweep.d.ts.map +1 -1
- package/dist/tools/kb-freshness-sweep.js +3 -1
- package/dist/tools/kb-freshness-sweep.js.map +1 -1
- package/dist/tools/kb-import.d.ts.map +1 -1
- package/dist/tools/kb-import.js +2 -1
- package/dist/tools/kb-import.js.map +1 -1
- package/dist/tools/kb-list.d.ts.map +1 -1
- package/dist/tools/kb-list.js +3 -1
- package/dist/tools/kb-list.js.map +1 -1
- package/dist/tools/kb-query.d.ts +2 -2
- package/dist/tools/kb-reconcile-prefilter.d.ts.map +1 -1
- package/dist/tools/kb-reconcile-prefilter.js +3 -1
- package/dist/tools/kb-reconcile-prefilter.js.map +1 -1
- package/dist/tools/kb-resolve-contradiction.d.ts.map +1 -1
- package/dist/tools/kb-resolve-contradiction.js +3 -1
- package/dist/tools/kb-resolve-contradiction.js.map +1 -1
- package/dist/tools/kb-setup.d.ts.map +1 -1
- package/dist/tools/kb-setup.js +125 -20
- package/dist/tools/kb-setup.js.map +1 -1
- package/dist/tools/kb-stats.d.ts.map +1 -1
- package/dist/tools/kb-stats.js +64 -43
- package/dist/tools/kb-stats.js.map +1 -1
- package/dist/tools/list-members.d.ts +2 -2
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +1 -0
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +2 -2
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +17 -0
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +58 -1
- package/dist/tools/member-reservation.d.ts.map +1 -1
- package/dist/tools/member-reservation.js +61 -20
- package/dist/tools/member-reservation.js.map +1 -1
- package/dist/tools/provision-auth.d.ts +80 -1
- package/dist/tools/provision-auth.d.ts.map +1 -1
- package/dist/tools/provision-auth.js +142 -54
- package/dist/tools/provision-auth.js.map +1 -1
- package/dist/tools/provision-vcs-auth.d.ts +91 -1
- package/dist/tools/provision-vcs-auth.d.ts.map +1 -1
- package/dist/tools/provision-vcs-auth.js +209 -49
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +12 -9
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +99 -12
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts.map +1 -1
- package/dist/tools/remove-member.js +27 -2
- package/dist/tools/remove-member.js.map +1 -1
- package/dist/tools/send-email.d.ts +2 -2
- package/dist/tools/setup-git-app.d.ts.map +1 -1
- package/dist/tools/setup-git-app.js +11 -7
- package/dist/tools/setup-git-app.js.map +1 -1
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +23 -1
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +12 -9
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +43 -11
- package/dist/tools/update-member.js.map +1 -1
- package/dist/tools/vcs-credential-exec.d.ts +127 -0
- package/dist/tools/vcs-credential-exec.d.ts.map +1 -0
- package/dist/tools/vcs-credential-exec.js +197 -0
- package/dist/tools/vcs-credential-exec.js.map +1 -0
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/log-helpers.d.ts.map +1 -1
- package/dist/utils/log-helpers.js +2 -2
- package/dist/utils/log-helpers.js.map +1 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +7 -1
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/shell-escape.d.ts +16 -0
- package/dist/utils/shell-escape.d.ts.map +1 -1
- package/dist/utils/shell-escape.js +22 -2
- package/dist/utils/shell-escape.js.map +1 -1
- package/dist/utils/vcs-provider-detect.d.ts +65 -0
- package/dist/utils/vcs-provider-detect.d.ts.map +1 -0
- package/dist/utils/vcs-provider-detect.js +109 -0
- package/dist/utils/vcs-provider-detect.js.map +1 -0
- package/dist/utils/workspace-trust.d.ts +20 -17
- package/dist/utils/workspace-trust.d.ts.map +1 -1
- package/dist/utils/workspace-trust.js +87 -1
- package/dist/utils/workspace-trust.js.map +1 -1
- package/dist/workflows/auto-sprint.js +176 -15
- package/package.json +6 -4
- package/packages/apra-fleet-client/src/client/api.mjs +319 -17
- package/packages/apra-fleet-client/src/client/errors.mjs +6 -2
- package/packages/apra-fleet-se/apra-pm/agents/_shared/GRAPH-SEMANTICS.md +10 -2
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +37 -2
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +36 -12
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/kb-reconciler.md +9 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +110 -22
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +125 -37
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +11 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +13 -2
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +37 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +1 -1
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +0 -3
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +2 -2
- package/packages/apra-fleet-se/bin/cli.mjs +149 -1
- package/packages/apra-fleet-se/bin/serve.mjs +78 -4
- package/packages/apra-fleet-se/fleet-sprint/abort.mjs +481 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-children.mjs +491 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity-check.mjs +282 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-identity.mjs +208 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-scope.mjs +638 -0
- package/packages/apra-fleet-se/fleet-sprint/beads-transitions.mjs +301 -0
- package/packages/apra-fleet-se/fleet-sprint/branch-ensure.mjs +96 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +8 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +61 -14
- package/packages/apra-fleet-se/fleet-sprint/coordination.mjs +516 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-failure.mjs +184 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-role.mjs +1121 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +216 -4
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-sync-redesign.md +276 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/escalate-to-llm-design.md +1 -1
- package/packages/apra-fleet-se/fleet-sprint/docs/run-sprint-cycle-prelude-decision.md +215 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +56 -1
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +996 -32
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +267 -0
- package/packages/apra-fleet-se/fleet-sprint/explicit-id-create-guard.mjs +501 -0
- package/packages/apra-fleet-se/fleet-sprint/fatal-diagnostics.mjs +134 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +102 -0
- package/packages/apra-fleet-se/fleet-sprint/git-sync.mjs +556 -0
- package/packages/apra-fleet-se/fleet-sprint/git-topology.mjs +495 -0
- package/packages/apra-fleet-se/fleet-sprint/guarded-modules.mjs +564 -0
- package/packages/apra-fleet-se/fleet-sprint/inline-ladder-guard.mjs +216 -0
- package/packages/apra-fleet-se/fleet-sprint/kb.mjs +728 -0
- package/packages/apra-fleet-se/fleet-sprint/mcp-result.mjs +75 -0
- package/packages/apra-fleet-se/fleet-sprint/member-provisioning.mjs +252 -0
- package/packages/apra-fleet-se/fleet-sprint/member-sync.mjs +581 -0
- package/packages/apra-fleet-se/fleet-sprint/member-target.mjs +93 -0
- package/packages/apra-fleet-se/fleet-sprint/newtask-text.mjs +266 -0
- package/packages/apra-fleet-se/fleet-sprint/parent-notes-staleness.mjs +201 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/deploy.mjs +136 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/develop.mjs +822 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/ensure-sprint-branch.mjs +294 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/final-review.mjs +403 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/harvest.mjs +180 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/integ-test.mjs +358 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/plan.mjs +390 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/publish-pr.mjs +323 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/re-review.mjs +232 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/regression-test.mjs +174 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/replan.mjs +197 -0
- package/packages/apra-fleet-se/fleet-sprint/phases/review.mjs +305 -0
- package/packages/apra-fleet-se/fleet-sprint/prompts.mjs +559 -0
- package/packages/apra-fleet-se/fleet-sprint/role-policies.mjs +1416 -0
- package/packages/apra-fleet-se/fleet-sprint/round-session.mjs +100 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +1467 -9798
- package/packages/apra-fleet-se/fleet-sprint/se-posix.mjs +17 -12
- package/packages/apra-fleet-se/fleet-sprint/shell-command-guard.mjs +304 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +18 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-supervisor/SKILL.md +21 -2
- package/packages/apra-fleet-se/fleet-sprint/sprint-args.mjs +454 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-report.mjs +239 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-state.mjs +163 -0
- package/packages/apra-fleet-se/fleet-sprint/unbracketed-push-guard.mjs +234 -0
- package/packages/apra-fleet-se/fleet-sprint/usage-limit-controller.mjs +211 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-auth.mjs +1279 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +153 -19
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +71 -21
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +28 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +131 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +140 -16
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/shell-helpers.mjs +1 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +77 -2
- package/packages/apra-fleet-se/fleet-sprint/worklists.mjs +559 -0
- package/packages/apra-fleet-se/package.json +1 -1
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +17 -6
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +49 -7
- package/skills/fleet/SKILL.md +8 -8
- package/skills/fleet/auth-azdevops.md +14 -3
- package/skills/fleet/auth-bitbucket.md +2 -2
- package/skills/fleet/auth-github.md +5 -4
- package/skills/fleet/onboarding.md +3 -3
- package/skills/fleet/permissions.md +5 -1
- package/skills/fleet/profiles/node.json +1 -1
- package/skills/fleet/troubleshooting.md +3 -3
- package/version.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { FLEET_DIR } from '../../paths.js';
|
|
4
|
+
import { decryptPassword } from '../../utils/crypto.js';
|
|
5
|
+
export const KB_CONFIG_PATH = path.join(FLEET_DIR, 'knowledge', 'config.json');
|
|
6
|
+
/**
|
|
7
|
+
* Read the KB provider config kb_setup wrote (provider/url/token_encrypted). Nothing
|
|
8
|
+
* currently reads this file back -- this restores that capability as a pure reader with
|
|
9
|
+
* no side effects, so a later task can wire it into getKbProviders.
|
|
10
|
+
*
|
|
11
|
+
* - Absent file, or provider missing/"sqlite" -> { provider: 'sqlite' }, silently,
|
|
12
|
+
* without ever touching token_encrypted (a corrupt token must never break the
|
|
13
|
+
* stock sqlite path).
|
|
14
|
+
* - provider "http" -> decrypts token_encrypted and returns { provider: 'http', url, token }.
|
|
15
|
+
* Missing url, missing token_encrypted, or a decryption failure all throw a
|
|
16
|
+
* descriptive Error naming this config path and the failing key -- never a silent
|
|
17
|
+
* fallback to sqlite.
|
|
18
|
+
* - Malformed JSON throws an Error naming this config path.
|
|
19
|
+
*/
|
|
20
|
+
export function readKbConfigFromDisk() {
|
|
21
|
+
if (!fs.existsSync(KB_CONFIG_PATH)) {
|
|
22
|
+
return { provider: 'sqlite' };
|
|
23
|
+
}
|
|
24
|
+
const raw = fs.readFileSync(KB_CONFIG_PATH, 'utf-8');
|
|
25
|
+
let parsed;
|
|
26
|
+
try {
|
|
27
|
+
parsed = JSON.parse(raw);
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
throw new Error(`Malformed JSON in KB config at ${KB_CONFIG_PATH}: ${err.message}`);
|
|
31
|
+
}
|
|
32
|
+
if (parsed.provider !== 'http') {
|
|
33
|
+
// Stock path: sqlite, or provider key absent. Deliberately never touches
|
|
34
|
+
// token_encrypted here -- see module doc.
|
|
35
|
+
return { provider: 'sqlite' };
|
|
36
|
+
}
|
|
37
|
+
const url = typeof parsed.url === 'string' ? parsed.url : undefined;
|
|
38
|
+
if (!url) {
|
|
39
|
+
throw new Error(`KB config at ${KB_CONFIG_PATH} selects provider "http" but is missing required key "url"`);
|
|
40
|
+
}
|
|
41
|
+
const tokenEncrypted = typeof parsed.token_encrypted === 'string' ? parsed.token_encrypted : undefined;
|
|
42
|
+
if (!tokenEncrypted) {
|
|
43
|
+
throw new Error(`KB config at ${KB_CONFIG_PATH} selects provider "http" but is missing required key "token_encrypted"`);
|
|
44
|
+
}
|
|
45
|
+
let token;
|
|
46
|
+
try {
|
|
47
|
+
token = decryptPassword(tokenEncrypted);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
throw new Error(`KB config at ${KB_CONFIG_PATH} has an undecryptable "token_encrypted": ${err.message}`);
|
|
51
|
+
}
|
|
52
|
+
return { provider: 'http', url, token };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=kb-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kb-config.js","sourceRoot":"","sources":["../../../src/services/knowledge/kb-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA2BxD,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AAE/E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,CAAC;QACnC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,CA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GAAG,EAAE,KAAK,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SqliteProvider } from './sqlite-provider.js';
|
|
2
|
+
import type { MemoryProvider } from './types.js';
|
|
2
3
|
export interface KbProviders {
|
|
3
|
-
project:
|
|
4
|
+
project: MemoryProvider;
|
|
4
5
|
global: SqliteProvider;
|
|
5
6
|
projectSlug: string;
|
|
6
7
|
}
|
|
@@ -9,6 +10,11 @@ export declare function createKbProviders(cwd?: string, remoteUrl?: string): Pro
|
|
|
9
10
|
* Resolve the KB providers for a repo. `cwd` should be the repo the call is
|
|
10
11
|
* about -- omitting it falls back to the calling process's cwd, which is only
|
|
11
12
|
* correct for single-repo CLI invocations, never for server-handled tool calls.
|
|
13
|
+
*
|
|
14
|
+
* Returns the identical object for repeated calls on the same (slug, repoPath)
|
|
15
|
+
* while the KB config is unchanged. Once the config content changes, the next
|
|
16
|
+
* call selects the project provider afresh; the SqliteProviders underneath are
|
|
17
|
+
* reused, never reopened.
|
|
12
18
|
*/
|
|
13
19
|
export declare function getKbProviders(cwd?: string, remoteUrl?: string): Promise<KbProviders>;
|
|
14
20
|
export declare function resetKbProviders(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kb-providers.d.ts","sourceRoot":"","sources":["../../../src/services/knowledge/kb-providers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"kb-providers.d.ts","sourceRoot":"","sources":["../../../src/services/knowledge/kb-providers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAKtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAIjD,MAAM,WAAW,WAAW;IAI1B,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,iBAAiB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAE9F;AA6PD;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAmB3F;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAavC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
+
import crypto from 'crypto';
|
|
3
4
|
import { SqliteProvider } from './sqlite-provider.js';
|
|
5
|
+
import { HttpKbProvider } from './http-provider.js';
|
|
6
|
+
import { readKbConfigFromDisk, KB_CONFIG_PATH } from './kb-config.js';
|
|
4
7
|
import { resolveProjectSlug } from './project-slug.js';
|
|
5
8
|
import { FLEET_DIR } from '../../paths.js';
|
|
9
|
+
import { logWarn } from '../../utils/log-helpers.js';
|
|
6
10
|
export async function createKbProviders(cwd, remoteUrl) {
|
|
7
11
|
return createKbProvidersForSlug(slugFor(cwd, remoteUrl), cwd ?? process.cwd());
|
|
8
12
|
}
|
|
@@ -27,13 +31,107 @@ function getGlobalProvider() {
|
|
|
27
31
|
// (the Phase 1 capture basis check and the basis hashes both use it). The global
|
|
28
32
|
// provider gets none on purpose: one shared KB spans every repo, so no single
|
|
29
33
|
// root is correct for it.
|
|
30
|
-
async function
|
|
34
|
+
async function createBaseProvidersForSlug(slug, repoPath) {
|
|
31
35
|
const projectDir = path.join(FLEET_DIR, 'knowledge', slug);
|
|
32
36
|
fs.mkdirSync(projectDir, { recursive: true });
|
|
33
|
-
const
|
|
34
|
-
await
|
|
35
|
-
const
|
|
36
|
-
return {
|
|
37
|
+
const projectSqlite = new SqliteProvider(path.join(projectDir, 'kb.sqlite'), repoPath);
|
|
38
|
+
await projectSqlite.init();
|
|
39
|
+
const global = await getGlobalProvider();
|
|
40
|
+
return { projectSqlite, global };
|
|
41
|
+
}
|
|
42
|
+
async function createKbProvidersForSlug(slug, repoPath) {
|
|
43
|
+
return withSelectedProject(await createBaseProvidersForSlug(slug, repoPath), slug, kbConfigFingerprint());
|
|
44
|
+
}
|
|
45
|
+
async function withSelectedProject(base, slug, configFingerprint) {
|
|
46
|
+
return {
|
|
47
|
+
project: await selectProjectProvider(base.projectSqlite, configFingerprint),
|
|
48
|
+
global: base.global,
|
|
49
|
+
projectSlug: slug,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
// Every HttpKbProvider this module builds, so resetKbProviders can dispose them.
|
|
53
|
+
// SqliteProvider has no dispose() (it has close()), so disposal must be narrowed
|
|
54
|
+
// to HTTP providers -- and _selections holds unresolved Promises, which a sync
|
|
55
|
+
// resetKbProviders cannot read .project off of. Hence a side-list.
|
|
56
|
+
const _httpProviders = [];
|
|
57
|
+
// my-beads-db-0cd.12: parent bead .0cd criterion 1 requires getKbProviders to
|
|
58
|
+
// return SqliteProvider unchanged "in every other case, including
|
|
59
|
+
// missing/malformed config" -- but readKbConfigFromDisk (bead .1) throws by
|
|
60
|
+
// design on malformed JSON, provider "http" without a url/token_encrypted, or
|
|
61
|
+
// an undecryptable token. Resolving the conflict per bead .12's decision:
|
|
62
|
+
// readKbConfigFromDisk keeps throwing (bead .1's contract is unchanged), and
|
|
63
|
+
// THIS call site catches it, degrades to the already-built SqliteProvider, and
|
|
64
|
+
// logs a loud warning -- never a silent downgrade, never a hard failure of
|
|
65
|
+
// every kb_* tool over one bad config file.
|
|
66
|
+
//
|
|
67
|
+
// my-beads-db-u00.5: the warning is suppressed per FAILURE, not per process.
|
|
68
|
+
// A module-level boolean meant a long-lived fleet server warned once for the
|
|
69
|
+
// first bad config it ever saw and then stayed silent for the life of the
|
|
70
|
+
// process, even after the file was edited and broke differently. The key is
|
|
71
|
+
// the config path plus a hash of its content, so the same broken file warns
|
|
72
|
+
// once (no spam on every provider build), while a changed-but-still-broken
|
|
73
|
+
// file warns again.
|
|
74
|
+
const _warnedKbConfigFailures = new Set();
|
|
75
|
+
// Path plus a hash of the config file's content: the one fingerprint used both
|
|
76
|
+
// to suppress repeat warnings for the same broken file and, in getKbProviders,
|
|
77
|
+
// to notice that the config changed and the selection must be redone.
|
|
78
|
+
function kbConfigFingerprint() {
|
|
79
|
+
let contentHash;
|
|
80
|
+
try {
|
|
81
|
+
contentHash = crypto.createHash('sha256').update(fs.readFileSync(KB_CONFIG_PATH)).digest('hex');
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// Absent file, or a read that raced a delete/rename; key on why.
|
|
85
|
+
contentHash = `unreadable:${err.message}`;
|
|
86
|
+
}
|
|
87
|
+
return `${KB_CONFIG_PATH}\0${contentHash}`;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Return the project provider the KB config selects. Stock path (no config file,
|
|
91
|
+
* or provider "sqlite") returns the already-built SqliteProvider untouched.
|
|
92
|
+
* A config file that fails to read (malformed JSON, http-without-url,
|
|
93
|
+
* http-without-token, undecryptable token) degrades to the same SqliteProvider,
|
|
94
|
+
* after a warning, once per distinct config content -- see the note above
|
|
95
|
+
* _warnedKbConfigFailures.
|
|
96
|
+
*
|
|
97
|
+
* The HTTP branch passes that same SqliteProvider as the explicit fallback:
|
|
98
|
+
* HttpKbProvider's default is a NO-ARG `new SqliteProvider()`, which resolves its
|
|
99
|
+
* database from process.cwd() rather than this repo's path.
|
|
100
|
+
*/
|
|
101
|
+
async function selectProjectProvider(projectProvider, configFingerprint) {
|
|
102
|
+
let config;
|
|
103
|
+
try {
|
|
104
|
+
config = readKbConfigFromDisk();
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
if (!_warnedKbConfigFailures.has(configFingerprint)) {
|
|
108
|
+
_warnedKbConfigFailures.add(configFingerprint);
|
|
109
|
+
logWarn('kb-providers', `KB config error, falling back to SqliteProvider: ${err.message}`);
|
|
110
|
+
}
|
|
111
|
+
return projectProvider;
|
|
112
|
+
}
|
|
113
|
+
if (config.provider !== 'http') {
|
|
114
|
+
return projectProvider;
|
|
115
|
+
}
|
|
116
|
+
// my-beads-db-u00.4: the HTTP provider is init'd like any other provider,
|
|
117
|
+
// rather than relying on HttpKbProvider.init() doing nothing beyond
|
|
118
|
+
// re-init'ing its fallback. That fallback is the already-init'd
|
|
119
|
+
// projectProvider, and SqliteProvider.init() returns early once its db is
|
|
120
|
+
// open, so the double init is harmless (pinned in
|
|
121
|
+
// tests/knowledge/kb-providers-http-selection.test.ts) -- and any setup
|
|
122
|
+
// HttpKbProvider.init() grows later runs here instead of being skipped.
|
|
123
|
+
// readKbConfigFromDisk throws on http-without-url/token, so both are present here.
|
|
124
|
+
const httpProvider = new HttpKbProvider(config.url, config.token, projectProvider);
|
|
125
|
+
try {
|
|
126
|
+
await httpProvider.init();
|
|
127
|
+
}
|
|
128
|
+
catch (err) {
|
|
129
|
+
// Not yet tracked in _httpProviders, so release its beforeExit listener here.
|
|
130
|
+
httpProvider.dispose();
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
_httpProviders.push(httpProvider);
|
|
134
|
+
return httpProvider;
|
|
37
135
|
}
|
|
38
136
|
// Keyed by (slug, repoPath), NOT slug alone and NOT a single slot. The fleet
|
|
39
137
|
// server is a long-lived process serving many members across many repos; a
|
|
@@ -43,10 +141,68 @@ async function createKbProvidersForSlug(slug, repoPath) {
|
|
|
43
141
|
// capture basis check and freshness sweep) for every later caller resolving
|
|
44
142
|
// to that same slug. Joined with NUL, which cannot appear in either
|
|
45
143
|
// component, so distinct pairs cannot collide into one key.
|
|
46
|
-
const
|
|
144
|
+
const _baseProviders = new Map();
|
|
145
|
+
const _selections = new Map();
|
|
47
146
|
function providerKey(slug, repoPath) {
|
|
48
147
|
return `${slug}\0${repoPath}`;
|
|
49
148
|
}
|
|
149
|
+
// my-beads-db-0cd.12: do NOT cache a rejected promise. Without this, one
|
|
150
|
+
// failed build (e.g. a disk error, not the config-read case above which no
|
|
151
|
+
// longer throws) permanently poisons this cache key: every later call for
|
|
152
|
+
// the same (slug, repoPath) gets the same rejected promise back, and
|
|
153
|
+
// fixing whatever caused the failure never recovers without a full
|
|
154
|
+
// resetKbProviders() or process restart. This .catch() is attached purely
|
|
155
|
+
// for cleanup -- it does not consume the rejection for the cached promise
|
|
156
|
+
// itself, so every awaiter still observes the rejection normally.
|
|
157
|
+
function evictOnReject(cache, key, entry, pending) {
|
|
158
|
+
pending.catch(() => {
|
|
159
|
+
if (cache.get(key) === entry) {
|
|
160
|
+
cache.delete(key);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function getBaseProviders(slug, repoPath, key) {
|
|
165
|
+
let pending = _baseProviders.get(key);
|
|
166
|
+
if (!pending) {
|
|
167
|
+
// Store the promise, not the resolved value, so concurrent callers for the
|
|
168
|
+
// same (slug, repoPath) pair share one provider instead of racing to build
|
|
169
|
+
// two. Two different repoPaths sharing a slug get two SqliteProvider
|
|
170
|
+
// handles on the same kb.sqlite file -- safe, since SqliteProvider.init
|
|
171
|
+
// sets WAL + busy_timeout=5000.
|
|
172
|
+
pending = createBaseProvidersForSlug(slug, repoPath);
|
|
173
|
+
_baseProviders.set(key, pending);
|
|
174
|
+
evictOnReject(_baseProviders, key, pending, pending);
|
|
175
|
+
}
|
|
176
|
+
return pending;
|
|
177
|
+
}
|
|
178
|
+
function disposeIfHttp(provider) {
|
|
179
|
+
if (!(provider instanceof HttpKbProvider))
|
|
180
|
+
return;
|
|
181
|
+
// dispose() removes the beforeExit hook that would have reported unsent
|
|
182
|
+
// captures at exit, so report them now instead of dropping them silently.
|
|
183
|
+
if (provider.offlineQueue.length > 0) {
|
|
184
|
+
logWarn('kb-providers', `KB config changed: the replaced remote KB provider still had ${provider.offlineQueue.length} ` +
|
|
185
|
+
'unsent captures in its offline queue. Run kb_harvest on the session transcript to recover them.');
|
|
186
|
+
}
|
|
187
|
+
provider.dispose();
|
|
188
|
+
const index = _httpProviders.indexOf(provider);
|
|
189
|
+
if (index !== -1)
|
|
190
|
+
_httpProviders.splice(index, 1);
|
|
191
|
+
}
|
|
192
|
+
// A superseded selection's HttpKbProvider is disposed so its beforeExit
|
|
193
|
+
// listener does not outlive it (the leak my-beads-db-u00.2 fixed in kb-server).
|
|
194
|
+
// dispose() only removes that listener, so a caller still holding the old
|
|
195
|
+
// provider mid-call keeps a working provider.
|
|
196
|
+
function retireSelection(selection) {
|
|
197
|
+
selection.providers.then(providers => disposeIfHttp(providers.project), () => {
|
|
198
|
+
// Nothing to dispose: every awaiter of this build already received its
|
|
199
|
+
// rejection, and selectProjectProvider disposes an HttpKbProvider whose
|
|
200
|
+
// init fails before rethrowing.
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
async function selectProviders(slug, repoPath, key, configFingerprint) {
|
|
204
|
+
return withSelectedProject(await getBaseProviders(slug, repoPath, key), slug, configFingerprint);
|
|
205
|
+
}
|
|
50
206
|
// resolveProjectSlug shells out to git, so cache per (cwd, remoteUrl) pair --
|
|
51
207
|
// keying by cwd alone would let the first call for a directory pin its slug,
|
|
52
208
|
// leaving a later call that does supply a remote URL stuck with the stale
|
|
@@ -67,26 +223,44 @@ function slugFor(cwd, remoteUrl) {
|
|
|
67
223
|
* Resolve the KB providers for a repo. `cwd` should be the repo the call is
|
|
68
224
|
* about -- omitting it falls back to the calling process's cwd, which is only
|
|
69
225
|
* correct for single-repo CLI invocations, never for server-handled tool calls.
|
|
226
|
+
*
|
|
227
|
+
* Returns the identical object for repeated calls on the same (slug, repoPath)
|
|
228
|
+
* while the KB config is unchanged. Once the config content changes, the next
|
|
229
|
+
* call selects the project provider afresh; the SqliteProviders underneath are
|
|
230
|
+
* reused, never reopened.
|
|
70
231
|
*/
|
|
71
232
|
export async function getKbProviders(cwd, remoteUrl) {
|
|
72
233
|
const slug = slugFor(cwd, remoteUrl);
|
|
73
234
|
const repoPath = cwd ?? process.cwd();
|
|
74
235
|
const key = providerKey(slug, repoPath);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// two. Two different repoPaths sharing a slug get two SqliteProvider
|
|
80
|
-
// handles on the same kb.sqlite file -- safe, since SqliteProvider.init
|
|
81
|
-
// sets WAL + busy_timeout=5000.
|
|
82
|
-
pending = createKbProvidersForSlug(slug, repoPath);
|
|
83
|
-
_providers.set(key, pending);
|
|
236
|
+
const configFingerprint = kbConfigFingerprint();
|
|
237
|
+
const current = _selections.get(key);
|
|
238
|
+
if (current && current.configFingerprint === configFingerprint) {
|
|
239
|
+
return current.providers;
|
|
84
240
|
}
|
|
85
|
-
|
|
241
|
+
if (current) {
|
|
242
|
+
retireSelection(current);
|
|
243
|
+
}
|
|
244
|
+
const selection = {
|
|
245
|
+
configFingerprint,
|
|
246
|
+
providers: selectProviders(slug, repoPath, key, configFingerprint),
|
|
247
|
+
};
|
|
248
|
+
_selections.set(key, selection);
|
|
249
|
+
evictOnReject(_selections, key, selection, selection.providers);
|
|
250
|
+
return selection.providers;
|
|
86
251
|
}
|
|
87
252
|
export function resetKbProviders() {
|
|
88
|
-
|
|
253
|
+
// HttpKbProvider registers a process 'beforeExit' listener in its constructor;
|
|
254
|
+
// clearing the maps alone leaks one listener per reset, and a suite that resets
|
|
255
|
+
// repeatedly hits MaxListenersExceededWarning.
|
|
256
|
+
for (const httpProvider of _httpProviders) {
|
|
257
|
+
httpProvider.dispose();
|
|
258
|
+
}
|
|
259
|
+
_httpProviders.length = 0;
|
|
260
|
+
_baseProviders.clear();
|
|
261
|
+
_selections.clear();
|
|
89
262
|
_slugCache.clear();
|
|
90
263
|
_globalProvider = null;
|
|
264
|
+
_warnedKbConfigFailures.clear();
|
|
91
265
|
}
|
|
92
266
|
//# sourceMappingURL=kb-providers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kb-providers.js","sourceRoot":"","sources":["../../../src/services/knowledge/kb-providers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAA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AAC,CAAC;IACxC,MAAM,iBAAiB,GAAG,mBAAmB,EAAE,CAAC;IAChD,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACrC,IAAI,OAAO,IAAI,OAAO,CAAC,iBAAiB,KAAK,iBAAiB,EAAE,CAAC;QAC/D,OAAO,OAAO,CAAC,SAAS,CAAC;IAC3B,CAAC;IACD,IAAI,OAAO,EAAE,CAAC;QACZ,eAAe,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM,SAAS,GAAgB;QAC7B,iBAAiB;QACjB,SAAS,EAAE,eAAe,CAAC,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,iBAAiB,CAAC;KACnE,CAAC;IACF,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAChC,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAChE,OAAO,SAAS,CAAC,SAAS,CAAC;AAC7B,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,+EAA+E;IAC/E,gFAAgF;IAChF,+CAA+C;IAC/C,KAAK,MAAM,YAAY,IAAI,cAAc,EAAE,CAAC;QAC1C,YAAY,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC;IACD,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1B,cAAc,CAAC,KAAK,EAAE,CAAC;IACvB,WAAW,CAAC,KAAK,EAAE,CAAC;IACpB,UAAU,CAAC,KAAK,EAAE,CAAC;IACnB,eAAe,GAAG,IAAI,CAAC;IACvB,uBAAuB,CAAC,KAAK,EAAE,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SqliteProvider } from './sqlite-provider.js';
|
|
2
|
+
import type { MemoryProvider } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Non-throwing type guard: true when the project KB provider is a
|
|
5
|
+
* SqliteProvider. For call sites that DEGRADE over a remote provider rather
|
|
6
|
+
* than refusing (kb_stats) -- they must ask the type question directly, not
|
|
7
|
+
* catch requireSqliteProject's throw, which would also swallow any other
|
|
8
|
+
* error raised on that path.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isSqliteProject(provider: MemoryProvider): provider is SqliteProvider;
|
|
11
|
+
/**
|
|
12
|
+
* Narrows a project KB provider to SqliteProvider, for call sites that use
|
|
13
|
+
* SqliteProvider-only capabilities not part of the MemoryProvider interface
|
|
14
|
+
* (list, feedback, freshnessSweep, reconcilePrefilter, resolveContradiction,
|
|
15
|
+
* hasEntry, the DirectiveProvider methods, and capture's second CaptureOpts
|
|
16
|
+
* argument).
|
|
17
|
+
*
|
|
18
|
+
* Accepts MemoryProvider (not SqliteProvider) on purpose: KbProviders.project is
|
|
19
|
+
* SqliteProvider today, but a later task widens it to MemoryProvider so an
|
|
20
|
+
* HttpKbProvider can be selected. This helper already compiles and behaves
|
|
21
|
+
* identically against today's narrower type, so callers can adopt it ahead of
|
|
22
|
+
* that widening without breaking anything, and once the widening lands every
|
|
23
|
+
* SqliteProvider-only call site routes through here instead of failing to compile.
|
|
24
|
+
*
|
|
25
|
+
* @param provider the project KB provider to narrow
|
|
26
|
+
* @param callerLabel short label identifying the call site, surfaced in the
|
|
27
|
+
* thrown error message (e.g. the tool name)
|
|
28
|
+
* @throws Error naming callerLabel when provider is not a SqliteProvider --
|
|
29
|
+
* never returns a null/undefined sentinel
|
|
30
|
+
*/
|
|
31
|
+
export declare function requireSqliteProject(provider: MemoryProvider, callerLabel: string): SqliteProvider;
|
|
32
|
+
//# sourceMappingURL=require-sqlite-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-sqlite-project.d.ts","sourceRoot":"","sources":["../../../src/services/knowledge/require-sqlite-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,QAAQ,IAAI,cAAc,CAEpF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,GAAG,cAAc,CAOlG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { SqliteProvider } from './sqlite-provider.js';
|
|
2
|
+
/**
|
|
3
|
+
* Non-throwing type guard: true when the project KB provider is a
|
|
4
|
+
* SqliteProvider. For call sites that DEGRADE over a remote provider rather
|
|
5
|
+
* than refusing (kb_stats) -- they must ask the type question directly, not
|
|
6
|
+
* catch requireSqliteProject's throw, which would also swallow any other
|
|
7
|
+
* error raised on that path.
|
|
8
|
+
*/
|
|
9
|
+
export function isSqliteProject(provider) {
|
|
10
|
+
return provider instanceof SqliteProvider;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Narrows a project KB provider to SqliteProvider, for call sites that use
|
|
14
|
+
* SqliteProvider-only capabilities not part of the MemoryProvider interface
|
|
15
|
+
* (list, feedback, freshnessSweep, reconcilePrefilter, resolveContradiction,
|
|
16
|
+
* hasEntry, the DirectiveProvider methods, and capture's second CaptureOpts
|
|
17
|
+
* argument).
|
|
18
|
+
*
|
|
19
|
+
* Accepts MemoryProvider (not SqliteProvider) on purpose: KbProviders.project is
|
|
20
|
+
* SqliteProvider today, but a later task widens it to MemoryProvider so an
|
|
21
|
+
* HttpKbProvider can be selected. This helper already compiles and behaves
|
|
22
|
+
* identically against today's narrower type, so callers can adopt it ahead of
|
|
23
|
+
* that widening without breaking anything, and once the widening lands every
|
|
24
|
+
* SqliteProvider-only call site routes through here instead of failing to compile.
|
|
25
|
+
*
|
|
26
|
+
* @param provider the project KB provider to narrow
|
|
27
|
+
* @param callerLabel short label identifying the call site, surfaced in the
|
|
28
|
+
* thrown error message (e.g. the tool name)
|
|
29
|
+
* @throws Error naming callerLabel when provider is not a SqliteProvider --
|
|
30
|
+
* never returns a null/undefined sentinel
|
|
31
|
+
*/
|
|
32
|
+
export function requireSqliteProject(provider, callerLabel) {
|
|
33
|
+
if (isSqliteProject(provider)) {
|
|
34
|
+
return provider;
|
|
35
|
+
}
|
|
36
|
+
throw new Error(`${callerLabel}: this operation is not supported when the KB is backed by a remote HTTP provider`);
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=require-sqlite-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"require-sqlite-project.js","sourceRoot":"","sources":["../../../src/services/knowledge/require-sqlite-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAGtD;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAwB;IACtD,OAAO,QAAQ,YAAY,cAAc,CAAC;AAC5C,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAwB,EAAE,WAAmB;IAChF,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,mFAAmF,CAClG,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-pricing.d.ts","sourceRoot":"","sources":["../../src/services/model-pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"model-pricing.d.ts","sourceRoot":"","sources":["../../src/services/model-pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,aAAa,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAGhE,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,UAAU,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;CAC5B,CAAC;AA8FF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,GAAG,kBAAkB,CAQjG"}
|
|
@@ -15,9 +15,13 @@ const PROVIDER_MODEL_PRICING = {
|
|
|
15
15
|
opus: { prompt: 15.00, completion: 75.00 },
|
|
16
16
|
},
|
|
17
17
|
agy: {
|
|
18
|
-
'gemini-3.
|
|
19
|
-
|
|
20
|
-
'
|
|
18
|
+
'gemini-3.8-flash-low': { prompt: 0.10, completion: 0.40 },
|
|
19
|
+
// Effort variants of one model share its per-token rate (same weights).
|
|
20
|
+
'gemini-3.8-flash-medium': { prompt: 0.10, completion: 0.40 },
|
|
21
|
+
'gemini-3.8-flash-high': { prompt: 0.10, completion: 0.40 },
|
|
22
|
+
'gemini-3.1-pro-low': { prompt: 0.35, completion: 1.05 },
|
|
23
|
+
'gemini-3.1-pro-high': { prompt: 0.35, completion: 1.05 },
|
|
24
|
+
'claude-opus-4-6-thinking': { prompt: 15.00, completion: 75.00 },
|
|
21
25
|
},
|
|
22
26
|
codex: {
|
|
23
27
|
'gpt-5.4-mini': { prompt: 0.25, completion: 2.00 },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-pricing.js","sourceRoot":"","sources":["../../src/services/model-pricing.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAyF;IACnH,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;QACzC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;QAC3C,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;KAC3C;IACD,GAAG,EAAE;QACH,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;QAC3D,
|
|
1
|
+
{"version":3,"file":"model-pricing.js","sourceRoot":"","sources":["../../src/services/model-pricing.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAcpD;;;;;;;;GAQG;AACH,MAAM,sBAAsB,GAAyF;IACnH,MAAM,EAAE;QACN,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;QACzC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE;QAC3C,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE;KAC3C;IACD,GAAG,EAAE;QACH,sBAAsB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;QAC1D,wE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,UAAU,EAAE,CAAC;AACjF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAY,EAAE,QAAyB;IAC3E,MAAM,YAAY,GAAgB,KAAK,CAAC,WAAW,IAAI,QAAQ,CAAC;IAChE,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IAC5D,OAAO;QACL,KAAK,EAAE,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,KAAK,CAAC;QACjD,QAAQ,EAAE,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,QAAQ,CAAC;QACvD,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared token grammar for the `{{secret.NAME}}` credential-store placeholder
|
|
3
|
+
* (apra-fleet secret terminology standardization). `{{secure.NAME}}` is the
|
|
4
|
+
* legacy spelling -- it still resolves identically, but every call site that
|
|
5
|
+
* finds one must emit legacyTokenWarning() so operators migrate off it.
|
|
6
|
+
* There is no hard-fail; both spellings are accepted indefinitely.
|
|
7
|
+
*
|
|
8
|
+
* Every credential-token regex/redaction/warning in the codebase should go
|
|
9
|
+
* through this module instead of maintaining its own local pattern.
|
|
10
|
+
*/
|
|
11
|
+
/** Matches both {{secret.NAME}} (canonical) and {{secure.NAME}} (legacy). Global + stateful -- clone with `new RegExp(SECRET_TOKEN_RE.source, 'g')` or reset `.lastIndex` before reuse. */
|
|
12
|
+
export declare const SECRET_TOKEN_RE: RegExp;
|
|
13
|
+
export interface SecretTokenMatch {
|
|
14
|
+
/** The credential name inside the token. */
|
|
15
|
+
name: string;
|
|
16
|
+
/** The full matched token text, e.g. "{{secret.FOO}}" or "{{secure.FOO}}". */
|
|
17
|
+
raw: string;
|
|
18
|
+
/** True when this occurrence used the deprecated {{secure.NAME}} spelling. */
|
|
19
|
+
legacy: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Finds every {{secret.NAME}} / {{secure.NAME}} token in `text`, in order of appearance. */
|
|
22
|
+
export declare function findSecretTokens(text: string): SecretTokenMatch[];
|
|
23
|
+
/** True if `text` contains at least one {{secret.NAME}} or {{secure.NAME}} token. */
|
|
24
|
+
export declare function hasSecretToken(text: string): boolean;
|
|
25
|
+
/** Replaces every {{secret.NAME}} / {{secure.NAME}} token in `text` with `[REDACTED]`. */
|
|
26
|
+
export declare function redactSecretTokens(text: string): string;
|
|
27
|
+
/** Canonical placeholder text for a given credential name, e.g. formatSecretToken('FOO') -> "{{secret.FOO}}". */
|
|
28
|
+
export declare function formatSecretToken(name: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* One-line deprecation notice for the given legacy {{secure.NAME}} token
|
|
31
|
+
* names (deduplicated). Callers append this to a tool's text result and log
|
|
32
|
+
* it whenever resolveSecretTokens-style resolution sees at least one legacy
|
|
33
|
+
* spelling, so operators see the nudge without a hard failure.
|
|
34
|
+
* Deliberately unbraced: the log masker redacts any braced token, and a
|
|
35
|
+
* braced form here would render as "[REDACTED] is deprecated" in fleet logs.
|
|
36
|
+
*/
|
|
37
|
+
export declare function legacyTokenWarning(names: string[]): string;
|
|
38
|
+
//# sourceMappingURL=secret-token.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-token.d.ts","sourceRoot":"","sources":["../../src/services/secret-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2LAA2L;AAC3L,eAAO,MAAM,eAAe,QAAoD,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,8EAA8E;IAC9E,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,EAAE,CAQjE;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGpD;AAED,0FAA0F;AAC1F,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,iHAAiH;AACjH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAK1D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared token grammar for the `{{secret.NAME}}` credential-store placeholder
|
|
3
|
+
* (apra-fleet secret terminology standardization). `{{secure.NAME}}` is the
|
|
4
|
+
* legacy spelling -- it still resolves identically, but every call site that
|
|
5
|
+
* finds one must emit legacyTokenWarning() so operators migrate off it.
|
|
6
|
+
* There is no hard-fail; both spellings are accepted indefinitely.
|
|
7
|
+
*
|
|
8
|
+
* Every credential-token regex/redaction/warning in the codebase should go
|
|
9
|
+
* through this module instead of maintaining its own local pattern.
|
|
10
|
+
*/
|
|
11
|
+
/** Matches both {{secret.NAME}} (canonical) and {{secure.NAME}} (legacy). Global + stateful -- clone with `new RegExp(SECRET_TOKEN_RE.source, 'g')` or reset `.lastIndex` before reuse. */
|
|
12
|
+
export const SECRET_TOKEN_RE = /\{\{(secret|secure)\.([a-zA-Z0-9_-]{1,64})\}\}/g;
|
|
13
|
+
/** Finds every {{secret.NAME}} / {{secure.NAME}} token in `text`, in order of appearance. */
|
|
14
|
+
export function findSecretTokens(text) {
|
|
15
|
+
const re = new RegExp(SECRET_TOKEN_RE.source, 'g');
|
|
16
|
+
const results = [];
|
|
17
|
+
let m;
|
|
18
|
+
while ((m = re.exec(text)) !== null) {
|
|
19
|
+
results.push({ name: m[2], raw: m[0], legacy: m[1] === 'secure' });
|
|
20
|
+
}
|
|
21
|
+
return results;
|
|
22
|
+
}
|
|
23
|
+
/** True if `text` contains at least one {{secret.NAME}} or {{secure.NAME}} token. */
|
|
24
|
+
export function hasSecretToken(text) {
|
|
25
|
+
const re = new RegExp(SECRET_TOKEN_RE.source);
|
|
26
|
+
return re.test(text);
|
|
27
|
+
}
|
|
28
|
+
/** Replaces every {{secret.NAME}} / {{secure.NAME}} token in `text` with `[REDACTED]`. */
|
|
29
|
+
export function redactSecretTokens(text) {
|
|
30
|
+
const re = new RegExp(SECRET_TOKEN_RE.source, 'g');
|
|
31
|
+
return text.replace(re, '[REDACTED]');
|
|
32
|
+
}
|
|
33
|
+
/** Canonical placeholder text for a given credential name, e.g. formatSecretToken('FOO') -> "{{secret.FOO}}". */
|
|
34
|
+
export function formatSecretToken(name) {
|
|
35
|
+
return `{{secret.${name}}}`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One-line deprecation notice for the given legacy {{secure.NAME}} token
|
|
39
|
+
* names (deduplicated). Callers append this to a tool's text result and log
|
|
40
|
+
* it whenever resolveSecretTokens-style resolution sees at least one legacy
|
|
41
|
+
* spelling, so operators see the nudge without a hard failure.
|
|
42
|
+
* Deliberately unbraced: the log masker redacts any braced token, and a
|
|
43
|
+
* braced form here would render as "[REDACTED] is deprecated" in fleet logs.
|
|
44
|
+
*/
|
|
45
|
+
export function legacyTokenWarning(names) {
|
|
46
|
+
const unique = [...new Set(names)];
|
|
47
|
+
return unique
|
|
48
|
+
.map((n) => `[deprecated] secure.${n} is the legacy spelling -- write secret.${n} instead (still accepted for now)`)
|
|
49
|
+
.join('; ');
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=secret-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-token.js","sourceRoot":"","sources":["../../src/services/secret-token.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,2LAA2L;AAC3L,MAAM,CAAC,MAAM,eAAe,GAAG,iDAAiD,CAAC;AAWjF,6FAA6F;AAC7F,MAAM,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2C,CAAC,mCAAmC,CAAC;SACnH,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -7,8 +7,10 @@ export interface ServiceStatus {
|
|
|
7
7
|
pid?: number;
|
|
8
8
|
enabled?: boolean;
|
|
9
9
|
}
|
|
10
|
+
/** 'reused': the platform kept an existing registration it could not recreate (Windows). */
|
|
11
|
+
export type RegisterResult = 'created' | 'reused';
|
|
10
12
|
export interface ServiceManager {
|
|
11
|
-
register(binaryPath: string, args: string[], logPath: string): Promise<void>;
|
|
13
|
+
register(binaryPath: string, args: string[], logPath: string): Promise<RegisterResult | void>;
|
|
12
14
|
unregister(): Promise<void>;
|
|
13
15
|
start(): Promise<void>;
|
|
14
16
|
stop(): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/service-manager/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/service-manager/types.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,iBAAiB,cAAc,CAAC;AAC7C,eAAO,MAAM,eAAe,uBAAuB,CAAC;AACpD,eAAO,MAAM,iBAAiB,0BAA0B,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,4FAA4F;AAC5F,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAC9F,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,KAAK,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAChC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACjC"}
|
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
import type { ServiceManager, ServiceStatus } from './types.js';
|
|
1
|
+
import type { RegisterResult, ServiceManager, ServiceStatus } from './types.js';
|
|
2
|
+
/** Runs schtasks synchronously; throws on a non-zero exit. Injectable for tests. */
|
|
3
|
+
export type SchtasksRunner = (args: string[]) => Buffer | string;
|
|
4
|
+
/**
|
|
5
|
+
* The <Command> of an existing task's XML definition, or null. schtasks may
|
|
6
|
+
* emit UTF-16, so NUL chars are stripped before parsing; XML tag names are
|
|
7
|
+
* not localized, unlike schtasks' human-readable output.
|
|
8
|
+
*/
|
|
9
|
+
export declare function taskXmlCommand(raw: Buffer | string): string | null;
|
|
2
10
|
export declare class WindowsServiceManager implements ServiceManager {
|
|
3
|
-
|
|
11
|
+
private readonly runSchtasks;
|
|
12
|
+
private readonly wrapperPath;
|
|
13
|
+
private reusedExistingTask;
|
|
14
|
+
constructor(runSchtasks?: SchtasksRunner, wrapperPath?: string);
|
|
15
|
+
register(binaryPath: string, args: string[], logPath: string): Promise<RegisterResult>;
|
|
4
16
|
unregister(): Promise<void>;
|
|
5
17
|
start(): Promise<void>;
|
|
6
18
|
stop(): Promise<void>;
|