@sema-agent/server 1.185.0
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/LICENSE +102 -0
- package/README.md +207 -0
- package/deploy/sema-up/README.md +145 -0
- package/deploy/sema-up/chart/Chart.yaml +11 -0
- package/deploy/sema-up/chart/templates/gitea.yaml +63 -0
- package/deploy/sema-up/chart/templates/minio.yaml +62 -0
- package/deploy/sema-up/chart/templates/namespace-sandbox.yaml +9 -0
- package/deploy/sema-up/chart/templates/pg-cluster.yaml +57 -0
- package/deploy/sema-up/chart/templates/registry.yaml +88 -0
- package/deploy/sema-up/chart/templates/sandbox-rbac.yaml +45 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +76 -0
- package/deploy/sema-up/chart/templates/server.yaml +88 -0
- package/deploy/sema-up/chart/values-full-single.yaml +9 -0
- package/deploy/sema-up/chart/values.yaml +100 -0
- package/deploy/sema-up/cluster-up.sh +432 -0
- package/deploy/sema-up/kube-up.sh +377 -0
- package/deploy/sema-up/lib/parse-machines.py +117 -0
- package/deploy/sema-up/machines.example.yaml +53 -0
- package/deploy/sema-up/preflight.sh +168 -0
- package/deploy/sema-up/sema-up.sh +758 -0
- package/deploy/sema-up/smoke.sh +100 -0
- package/deploy/sema-up/stack/compose.dataroot.yaml +16 -0
- package/deploy/sema-up/stack/compose.yaml +155 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +189 -0
- package/dist/approval.d.ts +27 -0
- package/dist/approval.d.ts.map +1 -0
- package/dist/approval.js +127 -0
- package/dist/approval.js.map +1 -0
- package/dist/audit.d.ts +29 -0
- package/dist/audit.d.ts.map +1 -0
- package/dist/audit.js +95 -0
- package/dist/audit.js.map +1 -0
- package/dist/auth-bridge.d.ts +29 -0
- package/dist/auth-bridge.d.ts.map +1 -0
- package/dist/auth-bridge.js +145 -0
- package/dist/auth-bridge.js.map +1 -0
- package/dist/bake-runner/main.d.ts +20 -0
- package/dist/bake-runner/main.d.ts.map +1 -0
- package/dist/bake-runner/main.js +216 -0
- package/dist/bake-runner/main.js.map +1 -0
- package/dist/bake-runner/protocol.d.ts +49 -0
- package/dist/bake-runner/protocol.d.ts.map +1 -0
- package/dist/bake-runner/protocol.js +86 -0
- package/dist/bake-runner/protocol.js.map +1 -0
- package/dist/bake-runner/runner.d.ts +86 -0
- package/dist/bake-runner/runner.d.ts.map +1 -0
- package/dist/bake-runner/runner.js +228 -0
- package/dist/bake-runner/runner.js.map +1 -0
- package/dist/bench/l8/artifact.d.ts +62 -0
- package/dist/bench/l8/artifact.d.ts.map +1 -0
- package/dist/bench/l8/artifact.js +129 -0
- package/dist/bench/l8/artifact.js.map +1 -0
- package/dist/bench/l8/escape.d.ts +18 -0
- package/dist/bench/l8/escape.d.ts.map +1 -0
- package/dist/bench/l8/escape.js +9 -0
- package/dist/bench/l8/escape.js.map +1 -0
- package/dist/bench/l8/index.d.ts +5 -0
- package/dist/bench/l8/index.d.ts.map +1 -0
- package/dist/bench/l8/index.js +5 -0
- package/dist/bench/l8/index.js.map +1 -0
- package/dist/bench/l8/probes.d.ts +75 -0
- package/dist/bench/l8/probes.d.ts.map +1 -0
- package/dist/bench/l8/probes.js +178 -0
- package/dist/bench/l8/probes.js.map +1 -0
- package/dist/bench/l8/run-probes.d.ts +21 -0
- package/dist/bench/l8/run-probes.d.ts.map +1 -0
- package/dist/bench/l8/run-probes.js +130 -0
- package/dist/bench/l8/run-probes.js.map +1 -0
- package/dist/bench/s1/arms.d.ts +84 -0
- package/dist/bench/s1/arms.d.ts.map +1 -0
- package/dist/bench/s1/arms.js +329 -0
- package/dist/bench/s1/arms.js.map +1 -0
- package/dist/bench/s1/live-deps.d.ts +25 -0
- package/dist/bench/s1/live-deps.d.ts.map +1 -0
- package/dist/bench/s1/live-deps.js +449 -0
- package/dist/bench/s1/live-deps.js.map +1 -0
- package/dist/bench/s1/oracle.d.ts +34 -0
- package/dist/bench/s1/oracle.d.ts.map +1 -0
- package/dist/bench/s1/oracle.js +29 -0
- package/dist/bench/s1/oracle.js.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts +9 -0
- package/dist/bench/s1/repair-oracle-adapter.d.ts.map +1 -0
- package/dist/bench/s1/repair-oracle-adapter.js +27 -0
- package/dist/bench/s1/repair-oracle-adapter.js.map +1 -0
- package/dist/bench/s1/reviewer.d.ts +31 -0
- package/dist/bench/s1/reviewer.d.ts.map +1 -0
- package/dist/bench/s1/reviewer.js +26 -0
- package/dist/bench/s1/reviewer.js.map +1 -0
- package/dist/bench/s1/row.d.ts +29 -0
- package/dist/bench/s1/row.d.ts.map +1 -0
- package/dist/bench/s1/row.js +55 -0
- package/dist/bench/s1/row.js.map +1 -0
- package/dist/bench/s1/run-firm.d.ts +49 -0
- package/dist/bench/s1/run-firm.d.ts.map +1 -0
- package/dist/bench/s1/run-firm.js +291 -0
- package/dist/bench/s1/run-firm.js.map +1 -0
- package/dist/bench/s1/runner-ctx.d.ts +44 -0
- package/dist/bench/s1/runner-ctx.d.ts.map +1 -0
- package/dist/bench/s1/runner-ctx.js +59 -0
- package/dist/bench/s1/runner-ctx.js.map +1 -0
- package/dist/bench/s1/tasks.d.ts +48 -0
- package/dist/bench/s1/tasks.d.ts.map +1 -0
- package/dist/bench/s1/tasks.js +194 -0
- package/dist/bench/s1/tasks.js.map +1 -0
- package/dist/boot-reclaim.d.ts +10 -0
- package/dist/boot-reclaim.d.ts.map +1 -0
- package/dist/boot-reclaim.js +13 -0
- package/dist/boot-reclaim.js.map +1 -0
- package/dist/brain.d.ts +8 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +83 -0
- package/dist/brain.js.map +1 -0
- package/dist/budget.d.ts +25 -0
- package/dist/budget.d.ts.map +1 -0
- package/dist/budget.js +107 -0
- package/dist/budget.js.map +1 -0
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.d.ts.map +1 -0
- package/dist/capabilities/builtin-tools.js +11 -0
- package/dist/capabilities/builtin-tools.js.map +1 -0
- package/dist/capabilities/code-review-council.d.ts +21 -0
- package/dist/capabilities/code-review-council.d.ts.map +1 -0
- package/dist/capabilities/code-review-council.js +113 -0
- package/dist/capabilities/code-review-council.js.map +1 -0
- package/dist/capabilities/collab-wire.d.ts +34 -0
- package/dist/capabilities/collab-wire.d.ts.map +1 -0
- package/dist/capabilities/collab-wire.js +2 -0
- package/dist/capabilities/collab-wire.js.map +1 -0
- package/dist/capabilities/collab-workflows.d.ts +40 -0
- package/dist/capabilities/collab-workflows.d.ts.map +1 -0
- package/dist/capabilities/collab-workflows.js +90 -0
- package/dist/capabilities/collab-workflows.js.map +1 -0
- package/dist/capabilities/oa-tools.d.ts +9 -0
- package/dist/capabilities/oa-tools.d.ts.map +1 -0
- package/dist/capabilities/oa-tools.js +44 -0
- package/dist/capabilities/oa-tools.js.map +1 -0
- package/dist/capabilities/prompt.d.ts +3 -0
- package/dist/capabilities/prompt.d.ts.map +1 -0
- package/dist/capabilities/prompt.js +6 -0
- package/dist/capabilities/prompt.js.map +1 -0
- package/dist/capabilities/prompts/code-review.d.ts +11 -0
- package/dist/capabilities/prompts/code-review.d.ts.map +1 -0
- package/dist/capabilities/prompts/code-review.js +39 -0
- package/dist/capabilities/prompts/code-review.js.map +1 -0
- package/dist/capabilities/prompts/identity.d.ts +2 -0
- package/dist/capabilities/prompts/identity.d.ts.map +1 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/identity.js.map +1 -0
- package/dist/capabilities/prompts/team.d.ts +6 -0
- package/dist/capabilities/prompts/team.d.ts.map +1 -0
- package/dist/capabilities/prompts/team.js +6 -0
- package/dist/capabilities/prompts/team.js.map +1 -0
- package/dist/capabilities/repo-tools.d.ts +19 -0
- package/dist/capabilities/repo-tools.d.ts.map +1 -0
- package/dist/capabilities/repo-tools.js +98 -0
- package/dist/capabilities/repo-tools.js.map +1 -0
- package/dist/capabilities/scenarios.d.ts +72 -0
- package/dist/capabilities/scenarios.d.ts.map +1 -0
- package/dist/capabilities/scenarios.js +241 -0
- package/dist/capabilities/scenarios.js.map +1 -0
- package/dist/capabilities/select-environment-tool.d.ts +22 -0
- package/dist/capabilities/select-environment-tool.d.ts.map +1 -0
- package/dist/capabilities/select-environment-tool.js +86 -0
- package/dist/capabilities/select-environment-tool.js.map +1 -0
- package/dist/capabilities/skills.d.ts +12 -0
- package/dist/capabilities/skills.d.ts.map +1 -0
- package/dist/capabilities/skills.js +50 -0
- package/dist/capabilities/skills.js.map +1 -0
- package/dist/capabilities/team.d.ts +31 -0
- package/dist/capabilities/team.d.ts.map +1 -0
- package/dist/capabilities/team.js +66 -0
- package/dist/capabilities/team.js.map +1 -0
- package/dist/config-provider.d.ts +47 -0
- package/dist/config-provider.d.ts.map +1 -0
- package/dist/config-provider.js +156 -0
- package/dist/config-provider.js.map +1 -0
- package/dist/config.d.ts +272 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +605 -0
- package/dist/config.js.map +1 -0
- package/dist/degenerate-instrument.d.ts +17 -0
- package/dist/degenerate-instrument.d.ts.map +1 -0
- package/dist/degenerate-instrument.js +113 -0
- package/dist/degenerate-instrument.js.map +1 -0
- package/dist/elicitation.d.ts +47 -0
- package/dist/elicitation.d.ts.map +1 -0
- package/dist/elicitation.js +151 -0
- package/dist/elicitation.js.map +1 -0
- package/dist/env-facts.d.ts +18 -0
- package/dist/env-facts.d.ts.map +1 -0
- package/dist/env-facts.js +26 -0
- package/dist/env-facts.js.map +1 -0
- package/dist/finance/cost-taxonomy.d.ts +34 -0
- package/dist/finance/cost-taxonomy.d.ts.map +1 -0
- package/dist/finance/cost-taxonomy.js +26 -0
- package/dist/finance/cost-taxonomy.js.map +1 -0
- package/dist/fleet/fleet-bus.d.ts +137 -0
- package/dist/fleet/fleet-bus.d.ts.map +1 -0
- package/dist/fleet/fleet-bus.js +249 -0
- package/dist/fleet/fleet-bus.js.map +1 -0
- package/dist/fleet-client.d.ts +50 -0
- package/dist/fleet-client.d.ts.map +1 -0
- package/dist/fleet-client.js +150 -0
- package/dist/fleet-client.js.map +1 -0
- package/dist/fleet-lease.d.ts +76 -0
- package/dist/fleet-lease.d.ts.map +1 -0
- package/dist/fleet-lease.js +124 -0
- package/dist/fleet-lease.js.map +1 -0
- package/dist/hooks/hook-runner.d.ts +41 -0
- package/dist/hooks/hook-runner.d.ts.map +1 -0
- package/dist/hooks/hook-runner.js +975 -0
- package/dist/hooks/hook-runner.js.map +1 -0
- package/dist/http/idempotency.d.ts +12 -0
- package/dist/http/idempotency.d.ts.map +1 -0
- package/dist/http/idempotency.js +49 -0
- package/dist/http/idempotency.js.map +1 -0
- package/dist/http/server.d.ts +185 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +4845 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/wire-gate.d.ts +3 -0
- package/dist/http/wire-gate.d.ts.map +1 -0
- package/dist/http/wire-gate.js +6 -0
- package/dist/http/wire-gate.js.map +1 -0
- package/dist/images/bake-validate.d.ts +41 -0
- package/dist/images/bake-validate.d.ts.map +1 -0
- package/dist/images/bake-validate.js +183 -0
- package/dist/images/bake-validate.js.map +1 -0
- package/dist/images/manifest.d.ts +36 -0
- package/dist/images/manifest.d.ts.map +1 -0
- package/dist/images/manifest.js +69 -0
- package/dist/images/manifest.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/key-resolver.d.ts +5 -0
- package/dist/key-resolver.d.ts.map +1 -0
- package/dist/key-resolver.js +15 -0
- package/dist/key-resolver.js.map +1 -0
- package/dist/leader/diffout.d.ts +24 -0
- package/dist/leader/diffout.d.ts.map +1 -0
- package/dist/leader/diffout.js +54 -0
- package/dist/leader/diffout.js.map +1 -0
- package/dist/leader/diffup.d.ts +14 -0
- package/dist/leader/diffup.d.ts.map +1 -0
- package/dist/leader/diffup.js +81 -0
- package/dist/leader/diffup.js.map +1 -0
- package/dist/leader/endpoint.d.ts +30 -0
- package/dist/leader/endpoint.d.ts.map +1 -0
- package/dist/leader/endpoint.js +76 -0
- package/dist/leader/endpoint.js.map +1 -0
- package/dist/leader/fanout.d.ts +46 -0
- package/dist/leader/fanout.d.ts.map +1 -0
- package/dist/leader/fanout.js +109 -0
- package/dist/leader/fanout.js.map +1 -0
- package/dist/leader/grader-env-factory.d.ts +36 -0
- package/dist/leader/grader-env-factory.d.ts.map +1 -0
- package/dist/leader/grader-env-factory.js +73 -0
- package/dist/leader/grader-env-factory.js.map +1 -0
- package/dist/leader/leader.d.ts +102 -0
- package/dist/leader/leader.d.ts.map +1 -0
- package/dist/leader/leader.js +354 -0
- package/dist/leader/leader.js.map +1 -0
- package/dist/leader/merge.d.ts +109 -0
- package/dist/leader/merge.d.ts.map +1 -0
- package/dist/leader/merge.js +184 -0
- package/dist/leader/merge.js.map +1 -0
- package/dist/leader/planner.d.ts +26 -0
- package/dist/leader/planner.d.ts.map +1 -0
- package/dist/leader/planner.js +137 -0
- package/dist/leader/planner.js.map +1 -0
- package/dist/leader/repair-oracle.d.ts +34 -0
- package/dist/leader/repair-oracle.d.ts.map +1 -0
- package/dist/leader/repair-oracle.js +83 -0
- package/dist/leader/repair-oracle.js.map +1 -0
- package/dist/leader/repair-wire.d.ts +49 -0
- package/dist/leader/repair-wire.d.ts.map +1 -0
- package/dist/leader/repair-wire.js +90 -0
- package/dist/leader/repair-wire.js.map +1 -0
- package/dist/leader/wire.d.ts +66 -0
- package/dist/leader/wire.d.ts.map +1 -0
- package/dist/leader/wire.js +452 -0
- package/dist/leader/wire.js.map +1 -0
- package/dist/lsp/e2b-bridge.d.ts +8 -0
- package/dist/lsp/e2b-bridge.d.ts.map +1 -0
- package/dist/lsp/e2b-bridge.js +71 -0
- package/dist/lsp/e2b-bridge.js.map +1 -0
- package/dist/lsp/e2b-manager.d.ts +16 -0
- package/dist/lsp/e2b-manager.d.ts.map +1 -0
- package/dist/lsp/e2b-manager.js +49 -0
- package/dist/lsp/e2b-manager.js.map +1 -0
- package/dist/lsp/lsp-frames.d.ts +2 -0
- package/dist/lsp/lsp-frames.d.ts.map +1 -0
- package/dist/lsp/lsp-frames.js +25 -0
- package/dist/lsp/lsp-frames.js.map +1 -0
- package/dist/lsp/manager.d.ts +41 -0
- package/dist/lsp/manager.d.ts.map +1 -0
- package/dist/lsp/manager.js +84 -0
- package/dist/lsp/manager.js.map +1 -0
- package/dist/lsp/types.d.ts +2 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +2 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/lsp/ws-transport.d.ts +28 -0
- package/dist/lsp/ws-transport.d.ts.map +1 -0
- package/dist/lsp/ws-transport.js +209 -0
- package/dist/lsp/ws-transport.js.map +1 -0
- package/dist/lsp-evict.d.ts +2 -0
- package/dist/lsp-evict.d.ts.map +1 -0
- package/dist/lsp-evict.js +14 -0
- package/dist/lsp-evict.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1526 -0
- package/dist/main.js.map +1 -0
- package/dist/memory-export.d.ts +3 -0
- package/dist/memory-export.d.ts.map +1 -0
- package/dist/memory-export.js +8 -0
- package/dist/memory-export.js.map +1 -0
- package/dist/memory-sync-client.d.ts +29 -0
- package/dist/memory-sync-client.d.ts.map +1 -0
- package/dist/memory-sync-client.js +133 -0
- package/dist/memory-sync-client.js.map +1 -0
- package/dist/memory-sync.d.ts +41 -0
- package/dist/memory-sync.d.ts.map +1 -0
- package/dist/memory-sync.js +183 -0
- package/dist/memory-sync.js.map +1 -0
- package/dist/model-select.d.ts +8 -0
- package/dist/model-select.d.ts.map +1 -0
- package/dist/model-select.js +12 -0
- package/dist/model-select.js.map +1 -0
- package/dist/observability/cost-quota.d.ts +21 -0
- package/dist/observability/cost-quota.d.ts.map +1 -0
- package/dist/observability/cost-quota.js +42 -0
- package/dist/observability/cost-quota.js.map +1 -0
- package/dist/observability/logger.d.ts +9 -0
- package/dist/observability/logger.d.ts.map +1 -0
- package/dist/observability/logger.js +35 -0
- package/dist/observability/logger.js.map +1 -0
- package/dist/observability/metrics.d.ts +76 -0
- package/dist/observability/metrics.d.ts.map +1 -0
- package/dist/observability/metrics.js +263 -0
- package/dist/observability/metrics.js.map +1 -0
- package/dist/observability/otel-exporter.d.ts +37 -0
- package/dist/observability/otel-exporter.d.ts.map +1 -0
- package/dist/observability/otel-exporter.js +95 -0
- package/dist/observability/otel-exporter.js.map +1 -0
- package/dist/observability/principal-context.d.ts +5 -0
- package/dist/observability/principal-context.d.ts.map +1 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/principal-context.js.map +1 -0
- package/dist/observability/rate-limit.d.ts +18 -0
- package/dist/observability/rate-limit.d.ts.map +1 -0
- package/dist/observability/rate-limit.js +30 -0
- package/dist/observability/rate-limit.js.map +1 -0
- package/dist/observability/tool-trace.d.ts +6 -0
- package/dist/observability/tool-trace.d.ts.map +1 -0
- package/dist/observability/tool-trace.js +73 -0
- package/dist/observability/tool-trace.js.map +1 -0
- package/dist/orchestration/hardened-vm-runner.d.ts +26 -0
- package/dist/orchestration/hardened-vm-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-runner.js +217 -0
- package/dist/orchestration/hardened-vm-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +4 -0
- package/dist/orchestration/hardened-vm-worker-runner.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +79 -0
- package/dist/orchestration/hardened-vm-worker-runner.js.map +1 -0
- package/dist/orchestration/hardened-vm-worker.d.ts +2 -0
- package/dist/orchestration/hardened-vm-worker.d.ts.map +1 -0
- package/dist/orchestration/hardened-vm-worker.js +80 -0
- package/dist/orchestration/hardened-vm-worker.js.map +1 -0
- package/dist/orchestration/subagent-steer.d.ts +12 -0
- package/dist/orchestration/subagent-steer.d.ts.map +1 -0
- package/dist/orchestration/subagent-steer.js +45 -0
- package/dist/orchestration/subagent-steer.js.map +1 -0
- package/dist/orchestration/workflow-agent-steer.d.ts +14 -0
- package/dist/orchestration/workflow-agent-steer.d.ts.map +1 -0
- package/dist/orchestration/workflow-agent-steer.js +41 -0
- package/dist/orchestration/workflow-agent-steer.js.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts +101 -0
- package/dist/orchestration/workflow-completion-inbox.d.ts.map +1 -0
- package/dist/orchestration/workflow-completion-inbox.js +327 -0
- package/dist/orchestration/workflow-completion-inbox.js.map +1 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +120 -0
- package/dist/orchestration/workflow-notify-journal.d.ts.map +1 -0
- package/dist/orchestration/workflow-notify-journal.js +297 -0
- package/dist/orchestration/workflow-notify-journal.js.map +1 -0
- package/dist/per-task-image.d.ts +27 -0
- package/dist/per-task-image.d.ts.map +1 -0
- package/dist/per-task-image.js +37 -0
- package/dist/per-task-image.js.map +1 -0
- package/dist/plan-cache-probe.d.ts +21 -0
- package/dist/plan-cache-probe.d.ts.map +1 -0
- package/dist/plan-cache-probe.js +79 -0
- package/dist/plan-cache-probe.js.map +1 -0
- package/dist/plugins/approval-exemption-store.d.ts +56 -0
- package/dist/plugins/approval-exemption-store.d.ts.map +1 -0
- package/dist/plugins/approval-exemption-store.js +216 -0
- package/dist/plugins/approval-exemption-store.js.map +1 -0
- package/dist/plugins/background-shell-support.d.ts +64 -0
- package/dist/plugins/background-shell-support.d.ts.map +1 -0
- package/dist/plugins/background-shell-support.js +235 -0
- package/dist/plugins/background-shell-support.js.map +1 -0
- package/dist/plugins/blob-backend.d.ts +44 -0
- package/dist/plugins/blob-backend.d.ts.map +1 -0
- package/dist/plugins/blob-backend.js +188 -0
- package/dist/plugins/blob-backend.js.map +1 -0
- package/dist/plugins/caching-session-store.d.ts +51 -0
- package/dist/plugins/caching-session-store.d.ts.map +1 -0
- package/dist/plugins/caching-session-store.js +142 -0
- package/dist/plugins/caching-session-store.js.map +1 -0
- package/dist/plugins/file-outcome-sink.d.ts +20 -0
- package/dist/plugins/file-outcome-sink.d.ts.map +1 -0
- package/dist/plugins/file-outcome-sink.js +14 -0
- package/dist/plugins/file-outcome-sink.js.map +1 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +19 -0
- package/dist/plugins/file-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/file-resume-anchor-store.js +103 -0
- package/dist/plugins/file-resume-anchor-store.js.map +1 -0
- package/dist/plugins/file-run-store.d.ts +95 -0
- package/dist/plugins/file-run-store.d.ts.map +1 -0
- package/dist/plugins/file-run-store.js +446 -0
- package/dist/plugins/file-run-store.js.map +1 -0
- package/dist/plugins/file-workflow-journal-store.d.ts +2 -0
- package/dist/plugins/file-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/file-workflow-journal-store.js +2 -0
- package/dist/plugins/file-workflow-journal-store.js.map +1 -0
- package/dist/plugins/host-platform.d.ts +19 -0
- package/dist/plugins/host-platform.d.ts.map +1 -0
- package/dist/plugins/host-platform.js +71 -0
- package/dist/plugins/host-platform.js.map +1 -0
- package/dist/plugins/local-checkpoint-store.d.ts +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/local-checkpoint-store.js +217 -0
- package/dist/plugins/local-checkpoint-store.js.map +1 -0
- package/dist/plugins/local-session-store.d.ts +69 -0
- package/dist/plugins/local-session-store.d.ts.map +1 -0
- package/dist/plugins/local-session-store.js +431 -0
- package/dist/plugins/local-session-store.js.map +1 -0
- package/dist/plugins/memory-engine-pg.d.ts +47 -0
- package/dist/plugins/memory-engine-pg.d.ts.map +1 -0
- package/dist/plugins/memory-engine-pg.js +306 -0
- package/dist/plugins/memory-engine-pg.js.map +1 -0
- package/dist/plugins/memory-engine-tidb.d.ts +40 -0
- package/dist/plugins/memory-engine-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-engine-tidb.js +296 -0
- package/dist/plugins/memory-engine-tidb.js.map +1 -0
- package/dist/plugins/memory-engine-vector-util.d.ts +2 -0
- package/dist/plugins/memory-engine-vector-util.d.ts.map +1 -0
- package/dist/plugins/memory-engine-vector-util.js +2 -0
- package/dist/plugins/memory-engine-vector-util.js.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +12 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/memory-resume-anchor-store.js +31 -0
- package/dist/plugins/memory-resume-anchor-store.js.map +1 -0
- package/dist/plugins/memory-run-store.d.ts +75 -0
- package/dist/plugins/memory-run-store.d.ts.map +1 -0
- package/dist/plugins/memory-run-store.js +267 -0
- package/dist/plugins/memory-run-store.js.map +1 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +78 -0
- package/dist/plugins/memory-sync-store-pg.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-pg.js +152 -0
- package/dist/plugins/memory-sync-store-pg.js.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts +32 -0
- package/dist/plugins/memory-sync-store-tidb.d.ts.map +1 -0
- package/dist/plugins/memory-sync-store-tidb.js +146 -0
- package/dist/plugins/memory-sync-store-tidb.js.map +1 -0
- package/dist/plugins/pg-approval-store.d.ts +28 -0
- package/dist/plugins/pg-approval-store.d.ts.map +1 -0
- package/dist/plugins/pg-approval-store.js +107 -0
- package/dist/plugins/pg-approval-store.js.map +1 -0
- package/dist/plugins/pg-breaker-state.d.ts +20 -0
- package/dist/plugins/pg-breaker-state.d.ts.map +1 -0
- package/dist/plugins/pg-breaker-state.js +89 -0
- package/dist/plugins/pg-breaker-state.js.map +1 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +34 -0
- package/dist/plugins/pg-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/pg-checkpoint-store.js +193 -0
- package/dist/plugins/pg-checkpoint-store.js.map +1 -0
- package/dist/plugins/pg-cost-quota.d.ts +18 -0
- package/dist/plugins/pg-cost-quota.d.ts.map +1 -0
- package/dist/plugins/pg-cost-quota.js +189 -0
- package/dist/plugins/pg-cost-quota.js.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/pg-file-snapshot-store.js +181 -0
- package/dist/plugins/pg-file-snapshot-store.js.map +1 -0
- package/dist/plugins/pg-image-bake.d.ts +42 -0
- package/dist/plugins/pg-image-bake.d.ts.map +1 -0
- package/dist/plugins/pg-image-bake.js +471 -0
- package/dist/plugins/pg-image-bake.js.map +1 -0
- package/dist/plugins/pg-image-index.d.ts +23 -0
- package/dist/plugins/pg-image-index.d.ts.map +1 -0
- package/dist/plugins/pg-image-index.js +252 -0
- package/dist/plugins/pg-image-index.js.map +1 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +23 -0
- package/dist/plugins/pg-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/pg-outcome-ledger.js +102 -0
- package/dist/plugins/pg-outcome-ledger.js.map +1 -0
- package/dist/plugins/pg-pool.d.ts +7 -0
- package/dist/plugins/pg-pool.d.ts.map +1 -0
- package/dist/plugins/pg-pool.js +233 -0
- package/dist/plugins/pg-pool.js.map +1 -0
- package/dist/plugins/pg-rate-limiter.d.ts +49 -0
- package/dist/plugins/pg-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/pg-rate-limiter.js +193 -0
- package/dist/plugins/pg-rate-limiter.js.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/pg-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/pg-resume-anchor-store.js +23 -0
- package/dist/plugins/pg-resume-anchor-store.js.map +1 -0
- package/dist/plugins/pg-run-store.d.ts +76 -0
- package/dist/plugins/pg-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-run-store.js +301 -0
- package/dist/plugins/pg-run-store.js.map +1 -0
- package/dist/plugins/pg-session-policy-store.d.ts +12 -0
- package/dist/plugins/pg-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-policy-store.js +88 -0
- package/dist/plugins/pg-session-policy-store.js.map +1 -0
- package/dist/plugins/pg-session-storage.d.ts +59 -0
- package/dist/plugins/pg-session-storage.d.ts.map +1 -0
- package/dist/plugins/pg-session-storage.js +484 -0
- package/dist/plugins/pg-session-storage.js.map +1 -0
- package/dist/plugins/pg-session-store.d.ts +2 -0
- package/dist/plugins/pg-session-store.d.ts.map +1 -0
- package/dist/plugins/pg-session-store.js +2 -0
- package/dist/plugins/pg-session-store.js.map +1 -0
- package/dist/plugins/pg-tool-result-store.d.ts +16 -0
- package/dist/plugins/pg-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/pg-tool-result-store.js +52 -0
- package/dist/plugins/pg-tool-result-store.js.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-journal-store.js +28 -0
- package/dist/plugins/pg-workflow-journal-store.js.map +1 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +55 -0
- package/dist/plugins/pg-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/pg-workflow-run-store.js +216 -0
- package/dist/plugins/pg-workflow-run-store.js.map +1 -0
- package/dist/plugins/remote-env-adb.d.ts +119 -0
- package/dist/plugins/remote-env-adb.d.ts.map +1 -0
- package/dist/plugins/remote-env-adb.js +502 -0
- package/dist/plugins/remote-env-adb.js.map +1 -0
- package/dist/plugins/remote-env-e2b.d.ts +162 -0
- package/dist/plugins/remote-env-e2b.d.ts.map +1 -0
- package/dist/plugins/remote-env-e2b.js +931 -0
- package/dist/plugins/remote-env-e2b.js.map +1 -0
- package/dist/plugins/remote-env-host.d.ts +141 -0
- package/dist/plugins/remote-env-host.d.ts.map +1 -0
- package/dist/plugins/remote-env-host.js +868 -0
- package/dist/plugins/remote-env-host.js.map +1 -0
- package/dist/plugins/remote-env-k8s.d.ts +209 -0
- package/dist/plugins/remote-env-k8s.d.ts.map +1 -0
- package/dist/plugins/remote-env-k8s.js +1206 -0
- package/dist/plugins/remote-env-k8s.js.map +1 -0
- package/dist/plugins/remote-env-local-docker.d.ts +124 -0
- package/dist/plugins/remote-env-local-docker.d.ts.map +1 -0
- package/dist/plugins/remote-env-local-docker.js +597 -0
- package/dist/plugins/remote-env-local-docker.js.map +1 -0
- package/dist/plugins/remote-env-ssh.d.ts +122 -0
- package/dist/plugins/remote-env-ssh.d.ts.map +1 -0
- package/dist/plugins/remote-env-ssh.js +511 -0
- package/dist/plugins/remote-env-ssh.js.map +1 -0
- package/dist/plugins/remote-shell.d.ts +7 -0
- package/dist/plugins/remote-shell.d.ts.map +1 -0
- package/dist/plugins/remote-shell.js +25 -0
- package/dist/plugins/remote-shell.js.map +1 -0
- package/dist/plugins/s3-presign.d.ts +13 -0
- package/dist/plugins/s3-presign.d.ts.map +1 -0
- package/dist/plugins/s3-presign.js +55 -0
- package/dist/plugins/s3-presign.js.map +1 -0
- package/dist/plugins/scheduler-support.d.ts +39 -0
- package/dist/plugins/scheduler-support.d.ts.map +1 -0
- package/dist/plugins/scheduler-support.js +141 -0
- package/dist/plugins/scheduler-support.js.map +1 -0
- package/dist/plugins/session-store.d.ts +7 -0
- package/dist/plugins/session-store.d.ts.map +1 -0
- package/dist/plugins/session-store.js +14 -0
- package/dist/plugins/session-store.js.map +1 -0
- package/dist/plugins/store-backend.d.ts +88 -0
- package/dist/plugins/store-backend.d.ts.map +1 -0
- package/dist/plugins/store-backend.js +197 -0
- package/dist/plugins/store-backend.js.map +1 -0
- package/dist/plugins/tidb-approval-store.d.ts +39 -0
- package/dist/plugins/tidb-approval-store.d.ts.map +1 -0
- package/dist/plugins/tidb-approval-store.js +81 -0
- package/dist/plugins/tidb-approval-store.js.map +1 -0
- package/dist/plugins/tidb-breaker-state.d.ts +18 -0
- package/dist/plugins/tidb-breaker-state.d.ts.map +1 -0
- package/dist/plugins/tidb-breaker-state.js +75 -0
- package/dist/plugins/tidb-breaker-state.js.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +50 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts.map +1 -0
- package/dist/plugins/tidb-checkpoint-store.js +196 -0
- package/dist/plugins/tidb-checkpoint-store.js.map +1 -0
- package/dist/plugins/tidb-cost-quota.d.ts +16 -0
- package/dist/plugins/tidb-cost-quota.d.ts.map +1 -0
- package/dist/plugins/tidb-cost-quota.js +34 -0
- package/dist/plugins/tidb-cost-quota.js.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +26 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts.map +1 -0
- package/dist/plugins/tidb-file-snapshot-store.js +183 -0
- package/dist/plugins/tidb-file-snapshot-store.js.map +1 -0
- package/dist/plugins/tidb-image-bake.d.ts +102 -0
- package/dist/plugins/tidb-image-bake.d.ts.map +1 -0
- package/dist/plugins/tidb-image-bake.js +400 -0
- package/dist/plugins/tidb-image-bake.js.map +1 -0
- package/dist/plugins/tidb-image-index.d.ts +71 -0
- package/dist/plugins/tidb-image-index.d.ts.map +1 -0
- package/dist/plugins/tidb-image-index.js +192 -0
- package/dist/plugins/tidb-image-index.js.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +58 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts.map +1 -0
- package/dist/plugins/tidb-outcome-ledger.js +98 -0
- package/dist/plugins/tidb-outcome-ledger.js.map +1 -0
- package/dist/plugins/tidb-pool.d.ts +11 -0
- package/dist/plugins/tidb-pool.d.ts.map +1 -0
- package/dist/plugins/tidb-pool.js +485 -0
- package/dist/plugins/tidb-pool.js.map +1 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +15 -0
- package/dist/plugins/tidb-rate-limiter.d.ts.map +1 -0
- package/dist/plugins/tidb-rate-limiter.js +34 -0
- package/dist/plugins/tidb-rate-limiter.js.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts +14 -0
- package/dist/plugins/tidb-resume-anchor-store.d.ts.map +1 -0
- package/dist/plugins/tidb-resume-anchor-store.js +23 -0
- package/dist/plugins/tidb-resume-anchor-store.js.map +1 -0
- package/dist/plugins/tidb-run-store.d.ts +107 -0
- package/dist/plugins/tidb-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-run-store.js +321 -0
- package/dist/plugins/tidb-run-store.js.map +1 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +12 -0
- package/dist/plugins/tidb-session-policy-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-policy-store.js +88 -0
- package/dist/plugins/tidb-session-policy-store.js.map +1 -0
- package/dist/plugins/tidb-session-storage.d.ts +15 -0
- package/dist/plugins/tidb-session-storage.d.ts.map +1 -0
- package/dist/plugins/tidb-session-storage.js +101 -0
- package/dist/plugins/tidb-session-storage.js.map +1 -0
- package/dist/plugins/tidb-session-store.d.ts +46 -0
- package/dist/plugins/tidb-session-store.d.ts.map +1 -0
- package/dist/plugins/tidb-session-store.js +360 -0
- package/dist/plugins/tidb-session-store.js.map +1 -0
- package/dist/plugins/tidb-tool-result-store.d.ts +15 -0
- package/dist/plugins/tidb-tool-result-store.d.ts.map +1 -0
- package/dist/plugins/tidb-tool-result-store.js +41 -0
- package/dist/plugins/tidb-tool-result-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +11 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-journal-store.js +28 -0
- package/dist/plugins/tidb-workflow-journal-store.js.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +61 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts.map +1 -0
- package/dist/plugins/tidb-workflow-run-store.js +227 -0
- package/dist/plugins/tidb-workflow-run-store.js.map +1 -0
- package/dist/plugins/web-search.d.ts +27 -0
- package/dist/plugins/web-search.d.ts.map +1 -0
- package/dist/plugins/web-search.js +143 -0
- package/dist/plugins/web-search.js.map +1 -0
- package/dist/plugins/workflow-journal-limits.d.ts +2 -0
- package/dist/plugins/workflow-journal-limits.d.ts.map +1 -0
- package/dist/plugins/workflow-journal-limits.js +2 -0
- package/dist/plugins/workflow-journal-limits.js.map +1 -0
- package/dist/plugins/worktree-isolation.d.ts +16 -0
- package/dist/plugins/worktree-isolation.d.ts.map +1 -0
- package/dist/plugins/worktree-isolation.js +55 -0
- package/dist/plugins/worktree-isolation.js.map +1 -0
- package/dist/plugins/write-behind-counter.d.ts +43 -0
- package/dist/plugins/write-behind-counter.d.ts.map +1 -0
- package/dist/plugins/write-behind-counter.js +144 -0
- package/dist/plugins/write-behind-counter.js.map +1 -0
- package/dist/project-memory.d.ts +14 -0
- package/dist/project-memory.d.ts.map +1 -0
- package/dist/project-memory.js +96 -0
- package/dist/project-memory.js.map +1 -0
- package/dist/question.d.ts +42 -0
- package/dist/question.d.ts.map +1 -0
- package/dist/question.js +140 -0
- package/dist/question.js.map +1 -0
- package/dist/resource-suspend.d.ts +11 -0
- package/dist/resource-suspend.d.ts.map +1 -0
- package/dist/resource-suspend.js +6 -0
- package/dist/resource-suspend.js.map +1 -0
- package/dist/router/route-orchestration.d.ts +31 -0
- package/dist/router/route-orchestration.d.ts.map +1 -0
- package/dist/router/route-orchestration.js +49 -0
- package/dist/router/route-orchestration.js.map +1 -0
- package/dist/run-local.d.ts +26 -0
- package/dist/run-local.d.ts.map +1 -0
- package/dist/run-local.js +337 -0
- package/dist/run-local.js.map +1 -0
- package/dist/runs.d.ts +39 -0
- package/dist/runs.d.ts.map +1 -0
- package/dist/runs.js +392 -0
- package/dist/runs.js.map +1 -0
- package/dist/runtime-caps-resolver.d.ts +32 -0
- package/dist/runtime-caps-resolver.d.ts.map +1 -0
- package/dist/runtime-caps-resolver.js +134 -0
- package/dist/runtime-caps-resolver.js.map +1 -0
- package/dist/runtime-governance.d.ts +18 -0
- package/dist/runtime-governance.d.ts.map +1 -0
- package/dist/runtime-governance.js +103 -0
- package/dist/runtime-governance.js.map +1 -0
- package/dist/sandbox-pkg-source.d.ts +11 -0
- package/dist/sandbox-pkg-source.d.ts.map +1 -0
- package/dist/sandbox-pkg-source.js +56 -0
- package/dist/sandbox-pkg-source.js.map +1 -0
- package/dist/sealed-key.d.ts +29 -0
- package/dist/sealed-key.d.ts.map +1 -0
- package/dist/sealed-key.js +122 -0
- package/dist/sealed-key.js.map +1 -0
- package/dist/security.d.ts +153 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +292 -0
- package/dist/security.js.map +1 -0
- package/dist/sema-registry.d.ts +187 -0
- package/dist/sema-registry.d.ts.map +1 -0
- package/dist/sema-registry.js +456 -0
- package/dist/sema-registry.js.map +1 -0
- package/dist/session-sync.d.ts +96 -0
- package/dist/session-sync.d.ts.map +1 -0
- package/dist/session-sync.js +181 -0
- package/dist/session-sync.js.map +1 -0
- package/dist/session-titler.d.ts +30 -0
- package/dist/session-titler.d.ts.map +1 -0
- package/dist/session-titler.js +77 -0
- package/dist/session-titler.js.map +1 -0
- package/dist/spec-fields.d.ts +5 -0
- package/dist/spec-fields.d.ts.map +1 -0
- package/dist/spec-fields.js +43 -0
- package/dist/spec-fields.js.map +1 -0
- package/dist/task-cwd.d.ts +15 -0
- package/dist/task-cwd.d.ts.map +1 -0
- package/dist/task-cwd.js +33 -0
- package/dist/task-cwd.js.map +1 -0
- package/dist/task-mcp.d.ts +20 -0
- package/dist/task-mcp.d.ts.map +1 -0
- package/dist/task-mcp.js +93 -0
- package/dist/task-mcp.js.map +1 -0
- package/dist/task-settings.d.ts +36 -0
- package/dist/task-settings.d.ts.map +1 -0
- package/dist/task-settings.js +141 -0
- package/dist/task-settings.js.map +1 -0
- package/dist/task-workflow.d.ts +25 -0
- package/dist/task-workflow.d.ts.map +1 -0
- package/dist/task-workflow.js +43 -0
- package/dist/task-workflow.js.map +1 -0
- package/dist/trace/artifacts.d.ts +17 -0
- package/dist/trace/artifacts.d.ts.map +1 -0
- package/dist/trace/artifacts.js +65 -0
- package/dist/trace/artifacts.js.map +1 -0
- package/dist/trace/project.d.ts +170 -0
- package/dist/trace/project.d.ts.map +1 -0
- package/dist/trace/project.js +239 -0
- package/dist/trace/project.js.map +1 -0
- package/dist/trace/redact.d.ts +5 -0
- package/dist/trace/redact.d.ts.map +1 -0
- package/dist/trace/redact.js +83 -0
- package/dist/trace/redact.js.map +1 -0
- package/dist/usage-analytics.d.ts +36 -0
- package/dist/usage-analytics.d.ts.map +1 -0
- package/dist/usage-analytics.js +89 -0
- package/dist/usage-analytics.js.map +1 -0
- package/package.json +78 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { QuotaLease } from "@sema-agent/registry-core/fleet";
|
|
2
|
+
export declare const NOT_LEASE_TTL_MS: number;
|
|
3
|
+
export declare const EXHAUSTED_RETRY_MS: number;
|
|
4
|
+
export declare const LEASE_PRINCIPAL_CAP = 4096;
|
|
5
|
+
export declare const LEASE_FETCH_TIMEOUT_MS = 2500;
|
|
6
|
+
export type QuotaDenyDetail = {
|
|
7
|
+
windowType?: "fiveHour" | "weekly" | "budget";
|
|
8
|
+
remaining?: number;
|
|
9
|
+
resetAt?: string | null;
|
|
10
|
+
isEstimate?: boolean;
|
|
11
|
+
pool?: string;
|
|
12
|
+
};
|
|
13
|
+
type PrincipalState = {
|
|
14
|
+
kind: "lease";
|
|
15
|
+
lease: QuotaLease;
|
|
16
|
+
} | {
|
|
17
|
+
kind: "not-lease";
|
|
18
|
+
until: number;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "exhausted";
|
|
21
|
+
until: number;
|
|
22
|
+
detail?: QuotaDenyDetail;
|
|
23
|
+
};
|
|
24
|
+
export type LeaseAdmission = {
|
|
25
|
+
ok: true;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
reason: "budget_exhausted";
|
|
29
|
+
retryAfterSec: number;
|
|
30
|
+
detail?: QuotaDenyDetail;
|
|
31
|
+
};
|
|
32
|
+
export interface FleetLeaseOpts {
|
|
33
|
+
center: {
|
|
34
|
+
baseUrl: string;
|
|
35
|
+
token: string;
|
|
36
|
+
worker: string;
|
|
37
|
+
};
|
|
38
|
+
fetchImpl?: typeof fetch;
|
|
39
|
+
logger?: {
|
|
40
|
+
info?(msg: string, meta?: Record<string, unknown>): void;
|
|
41
|
+
warn?(msg: string, meta?: Record<string, unknown>): void;
|
|
42
|
+
};
|
|
43
|
+
metrics?: {
|
|
44
|
+
inc(name: string, labels?: Record<string, string>): void;
|
|
45
|
+
};
|
|
46
|
+
now?: () => number;
|
|
47
|
+
}
|
|
48
|
+
export declare class FleetLeaseManager {
|
|
49
|
+
private readonly opts;
|
|
50
|
+
private readonly state;
|
|
51
|
+
private readonly inflight;
|
|
52
|
+
private readonly f;
|
|
53
|
+
private readonly base;
|
|
54
|
+
private readonly headers;
|
|
55
|
+
private readonly now;
|
|
56
|
+
private failStreak;
|
|
57
|
+
constructor(opts: FleetLeaseOpts);
|
|
58
|
+
admit(principal: string): Promise<LeaseAdmission>;
|
|
59
|
+
recordSpend(principal: string | undefined, d: {
|
|
60
|
+
weightedTokens?: number;
|
|
61
|
+
costMicroUsd?: number;
|
|
62
|
+
}): void;
|
|
63
|
+
peek(principal: string): PrincipalState["kind"] | undefined;
|
|
64
|
+
private set;
|
|
65
|
+
private issueOrRenew;
|
|
66
|
+
private issueOrRenewInner;
|
|
67
|
+
}
|
|
68
|
+
export declare function buildFleetLeaseFromEnv(cfg: {
|
|
69
|
+
configCenter?: {
|
|
70
|
+
baseUrl: string;
|
|
71
|
+
token: string;
|
|
72
|
+
worker?: string;
|
|
73
|
+
};
|
|
74
|
+
}, opts: Omit<FleetLeaseOpts, "center">): FleetLeaseManager | undefined;
|
|
75
|
+
export {};
|
|
76
|
+
//# sourceMappingURL=fleet-lease.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet-lease.d.ts","sourceRoot":"","sources":["../src/fleet-lease.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,UAAU,EAAoC,MAAM,iCAAiC,CAAC;AAG/F,eAAO,MAAM,gBAAgB,QAAiB,CAAC;AAE/C,eAAO,MAAM,kBAAkB,QAAY,CAAC;AAG5C,eAAO,MAAM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,CAAC,GACnC,iBAAiB,GAAG,SAAS,CAI/B"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { QuotaLease, leaseExhausted, shouldRenewLease } from "@sema-agent/registry-core/fleet";
|
|
2
|
+
export const NOT_LEASE_TTL_MS = 10 * 60 * 1000;
|
|
3
|
+
export const EXHAUSTED_RETRY_MS = 30 * 1000;
|
|
4
|
+
export const LEASE_PRINCIPAL_CAP = 4096;
|
|
5
|
+
export const LEASE_FETCH_TIMEOUT_MS = 2500;
|
|
6
|
+
export class FleetLeaseManager {
|
|
7
|
+
opts;
|
|
8
|
+
state = new Map();
|
|
9
|
+
inflight = new Map();
|
|
10
|
+
f;
|
|
11
|
+
base;
|
|
12
|
+
headers;
|
|
13
|
+
now;
|
|
14
|
+
failStreak = 0;
|
|
15
|
+
constructor(opts) {
|
|
16
|
+
this.opts = opts;
|
|
17
|
+
this.f = opts.fetchImpl ?? fetch;
|
|
18
|
+
this.base = opts.center.baseUrl.replace(/\/+$/, "");
|
|
19
|
+
this.headers = { authorization: `Bearer ${opts.center.token}`, "content-type": "application/json" };
|
|
20
|
+
this.now = opts.now ?? Date.now;
|
|
21
|
+
}
|
|
22
|
+
async admit(principal) {
|
|
23
|
+
const now = this.now();
|
|
24
|
+
const st = this.state.get(principal);
|
|
25
|
+
if (st?.kind === "not-lease" && now < st.until)
|
|
26
|
+
return { ok: true };
|
|
27
|
+
if (st?.kind === "exhausted" && now < st.until) {
|
|
28
|
+
return { ok: false, reason: "budget_exhausted", retryAfterSec: Math.ceil((st.until - now) / 1000), ...(st.detail ? { detail: st.detail } : {}) };
|
|
29
|
+
}
|
|
30
|
+
if (st?.kind === "lease" && !leaseExhausted(st.lease, now)) {
|
|
31
|
+
if (shouldRenewLease(st.lease, now))
|
|
32
|
+
void this.issueOrRenew(principal).catch(() => undefined);
|
|
33
|
+
return { ok: true };
|
|
34
|
+
}
|
|
35
|
+
return this.issueOrRenew(principal);
|
|
36
|
+
}
|
|
37
|
+
recordSpend(principal, d) {
|
|
38
|
+
if (!principal)
|
|
39
|
+
return;
|
|
40
|
+
const st = this.state.get(principal);
|
|
41
|
+
if (st?.kind !== "lease")
|
|
42
|
+
return;
|
|
43
|
+
st.lease.consumed.weightedTokens += d.weightedTokens ?? 0;
|
|
44
|
+
st.lease.consumed.costMicroUsd += d.costMicroUsd ?? 0;
|
|
45
|
+
}
|
|
46
|
+
peek(principal) {
|
|
47
|
+
return this.state.get(principal)?.kind;
|
|
48
|
+
}
|
|
49
|
+
set(principal, st) {
|
|
50
|
+
if (!this.state.has(principal) && this.state.size >= LEASE_PRINCIPAL_CAP) {
|
|
51
|
+
const oldest = this.state.keys().next().value;
|
|
52
|
+
this.state.delete(oldest);
|
|
53
|
+
}
|
|
54
|
+
this.state.delete(principal);
|
|
55
|
+
this.state.set(principal, st);
|
|
56
|
+
}
|
|
57
|
+
issueOrRenew(principal) {
|
|
58
|
+
const existing = this.inflight.get(principal);
|
|
59
|
+
if (existing)
|
|
60
|
+
return existing;
|
|
61
|
+
const p = this.issueOrRenewInner(principal).finally(() => this.inflight.delete(principal));
|
|
62
|
+
this.inflight.set(principal, p);
|
|
63
|
+
return p;
|
|
64
|
+
}
|
|
65
|
+
async issueOrRenewInner(principal) {
|
|
66
|
+
try {
|
|
67
|
+
const res = await this.f(`${this.base}/api/fleet/leases`, {
|
|
68
|
+
method: "POST",
|
|
69
|
+
headers: this.headers,
|
|
70
|
+
body: JSON.stringify({ principal, worker: this.opts.center.worker }),
|
|
71
|
+
signal: AbortSignal.timeout(LEASE_FETCH_TIMEOUT_MS),
|
|
72
|
+
});
|
|
73
|
+
if (res.status === 200) {
|
|
74
|
+
const body = (await res.json());
|
|
75
|
+
const lease = QuotaLease.parse(body.lease);
|
|
76
|
+
this.set(principal, { kind: "lease", lease });
|
|
77
|
+
if (this.failStreak > 0)
|
|
78
|
+
this.opts.logger?.info?.("fleet_lease_recovered", { after: this.failStreak });
|
|
79
|
+
this.failStreak = 0;
|
|
80
|
+
this.opts.metrics?.inc("fleet_lease_issued_total");
|
|
81
|
+
return { ok: true };
|
|
82
|
+
}
|
|
83
|
+
if (res.status === 409) {
|
|
84
|
+
const body = (await res.json().catch(() => ({})));
|
|
85
|
+
if (body.code === "quota_exhausted") {
|
|
86
|
+
const until = this.now() + EXHAUSTED_RETRY_MS;
|
|
87
|
+
const detail = {
|
|
88
|
+
...(body.windowType !== undefined ? { windowType: body.windowType } : {}),
|
|
89
|
+
...(body.remaining !== undefined ? { remaining: body.remaining } : {}),
|
|
90
|
+
...(body.resetAt !== undefined ? { resetAt: body.resetAt } : {}),
|
|
91
|
+
...(body.isEstimate !== undefined ? { isEstimate: body.isEstimate } : {}),
|
|
92
|
+
...(body.pool !== undefined ? { pool: body.pool } : {}),
|
|
93
|
+
};
|
|
94
|
+
const hasDetail = Object.keys(detail).length > 0;
|
|
95
|
+
this.set(principal, { kind: "exhausted", until, ...(hasDetail ? { detail } : {}) });
|
|
96
|
+
this.opts.metrics?.inc("fleet_lease_exhausted_total");
|
|
97
|
+
return { ok: false, reason: "budget_exhausted", retryAfterSec: Math.ceil(EXHAUSTED_RETRY_MS / 1000), ...(hasDetail ? { detail } : {}) };
|
|
98
|
+
}
|
|
99
|
+
this.set(principal, { kind: "not-lease", until: this.now() + NOT_LEASE_TTL_MS });
|
|
100
|
+
return { ok: true };
|
|
101
|
+
}
|
|
102
|
+
if (res.status === 401 || res.status === 403 || res.status === 400) {
|
|
103
|
+
this.opts.logger?.warn?.("fleet_lease_auth_error_fail_open", { status: res.status, principal, note: "center rejected the lease request — check the service token / worker id / center URL (budget NOT enforced until fixed)" });
|
|
104
|
+
this.opts.metrics?.inc("fleet_lease_auth_error_total", { status: String(res.status) });
|
|
105
|
+
return { ok: true };
|
|
106
|
+
}
|
|
107
|
+
throw new Error(`lease ${res.status}`);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
this.failStreak += 1;
|
|
111
|
+
if (this.failStreak === 1)
|
|
112
|
+
this.opts.logger?.warn?.("fleet_lease_unavailable_fail_open", { error: err instanceof Error ? err.message : String(err) });
|
|
113
|
+
this.opts.metrics?.inc("fleet_lease_fail_open_total");
|
|
114
|
+
return { ok: true };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
export function buildFleetLeaseFromEnv(cfg, opts) {
|
|
119
|
+
const cc = cfg.configCenter;
|
|
120
|
+
if (!cc?.baseUrl || !cc.token || !cc.worker)
|
|
121
|
+
return undefined;
|
|
122
|
+
return new FleetLeaseManager({ ...opts, center: { baseUrl: cc.baseUrl, token: cc.token, worker: cc.worker } });
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=fleet-lease.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fleet-lease.js","sourceRoot":"","sources":["../src/fleet-lease.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAG/F,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAE/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAG5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAGxC,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AA0B3C,MAAM,OAAO,iBAAiB;IASC;IARZ,KAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;IAC1C,QAAQ,GAAG,IAAI,GAAG,EAAmC,CAAC;IACtD,CAAC,CAAe;IAChB,IAAI,CAAS;IACb,OAAO,CAAyB;IAChC,GAAG,CAAe;IAC3B,UAAU,GAAG,CAAC,CAAC;IAEvB,YAA6B,IAAoB;QAApB,SAAI,GAAJ,IAAI,CAAgB;QAC/C,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,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Logger } from "../observability/logger.js";
|
|
4
|
+
export declare const MAX_HOOK_ENTRIES_PER_EVENT = 32;
|
|
5
|
+
export declare const MAX_HOOK_COMMAND_CHARS = 8192;
|
|
6
|
+
export declare const MAX_HOOK_TIMEOUT_SECONDS = 600;
|
|
7
|
+
export declare const MAX_HOOK_EVENT_TOTAL_SECONDS = 120;
|
|
8
|
+
export declare const MAX_HOOK_MATCHER_GROUPS = 16;
|
|
9
|
+
export declare const MAX_HOOK_HTTP_HEADERS = 32;
|
|
10
|
+
export declare const MAX_HOOK_OUTPUT_BYTES: number;
|
|
11
|
+
export interface ParseHooksConfigResult {
|
|
12
|
+
config?: HooksConfig;
|
|
13
|
+
error?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function parseHooksConfig(raw: unknown): ParseHooksConfigResult;
|
|
16
|
+
export declare function hookMatcherMatches(matcher: string | undefined, value: string): boolean | "invalid";
|
|
17
|
+
export declare function hookIfMatches(cond: string, payload: unknown): true | "not_matched" | "unevaluable";
|
|
18
|
+
export interface HookRunnerContext {
|
|
19
|
+
logger: Logger;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
cwd: string;
|
|
22
|
+
permissionMode?: string;
|
|
23
|
+
shellEnv?: Record<string, string>;
|
|
24
|
+
hookLlm?: HookLlmCall;
|
|
25
|
+
hookAgent?: HookLlmCall;
|
|
26
|
+
wake?: (text: string) => Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export type HookLlmCall = (opts: {
|
|
29
|
+
prompt: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
timeoutMs: number;
|
|
32
|
+
}) => Promise<{
|
|
33
|
+
ok: true;
|
|
34
|
+
text: string;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
error: string;
|
|
38
|
+
}>;
|
|
39
|
+
export declare function buildTaskHooks(config: HooksConfig, ctx: HookRunnerContext): Hooks | undefined;
|
|
40
|
+
export declare function composeHooks(deployment: Hooks | undefined, task: Hooks): Hooks;
|
|
41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