@sema-agent/server 1.323.0 → 2.0.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/dist/approval-hmac.d.ts +40 -0
- package/dist/approval-hmac.js +67 -0
- package/dist/approval.d.ts +31 -0
- package/dist/approval.js +72 -4
- package/dist/audit.d.ts +26 -0
- package/dist/audit.js +40 -1
- package/dist/auth-bridge.d.ts +10 -0
- package/dist/auth-bridge.js +47 -4
- package/dist/auth-keys.d.ts +19 -0
- package/dist/auth-keys.js +13 -0
- package/dist/bake-runner/main.d.ts +5 -0
- package/dist/bake-runner/main.js +43 -4
- package/dist/bake-runner/protocol.d.ts +57 -0
- package/dist/bake-runner/protocol.js +58 -3
- package/dist/bake-runner/runner.d.ts +54 -0
- package/dist/bake-runner/runner.js +87 -5
- package/dist/bench/l8/artifact.d.ts +63 -0
- package/dist/bench/l8/artifact.js +61 -2
- package/dist/bench/l8/escape.d.ts +36 -0
- package/dist/bench/l8/escape.js +25 -0
- package/dist/bench/l8/index.d.ts +14 -0
- package/dist/bench/l8/index.js +14 -0
- package/dist/bench/l8/probes.d.ts +74 -0
- package/dist/bench/l8/probes.js +60 -0
- package/dist/bench/l8/run-probes.d.ts +43 -0
- package/dist/bench/l8/run-probes.js +45 -2
- package/dist/bench/s1/arms.d.ts +126 -0
- package/dist/bench/s1/arms.js +188 -13
- package/dist/bench/s1/live-deps.d.ts +66 -0
- package/dist/bench/s1/live-deps.js +249 -11
- package/dist/bench/s1/oracle.d.ts +49 -0
- package/dist/bench/s1/oracle.js +36 -1
- package/dist/bench/s1/repair-oracle-adapter.d.ts +33 -0
- package/dist/bench/s1/repair-oracle-adapter.js +30 -0
- package/dist/bench/s1/reviewer.d.ts +38 -0
- package/dist/bench/s1/reviewer.js +34 -0
- package/dist/bench/s1/row.d.ts +77 -0
- package/dist/bench/s1/row.js +62 -0
- package/dist/bench/s1/run-firm.d.ts +47 -0
- package/dist/bench/s1/run-firm.js +70 -4
- package/dist/bench/s1/runner-ctx.d.ts +71 -0
- package/dist/bench/s1/runner-ctx.js +36 -0
- package/dist/bench/s1/tasks.d.ts +108 -0
- package/dist/bench/s1/tasks.js +115 -0
- package/dist/boot-reclaim.d.ts +19 -0
- package/dist/boot-reclaim.js +20 -0
- package/dist/brain.d.ts +25 -0
- package/dist/brain.js +61 -1
- package/dist/budget.d.ts +66 -0
- package/dist/budget.js +128 -4
- package/dist/capabilities/builtin-tools.d.ts +3 -0
- package/dist/capabilities/builtin-tools.js +3 -0
- package/dist/capabilities/center-plugins.d.ts +17 -1
- package/dist/capabilities/center-plugins.js +45 -4
- package/dist/capabilities/center-prompts.d.ts +46 -0
- package/dist/capabilities/center-prompts.js +57 -3
- package/dist/capabilities/code-review-council.d.ts +28 -0
- package/dist/capabilities/code-review-council.js +40 -7
- package/dist/capabilities/collab-wire.d.ts +2 -0
- package/dist/capabilities/collab-workflows.d.ts +7 -0
- package/dist/capabilities/collab-workflows.js +44 -1
- package/dist/capabilities/oa-tools.d.ts +6 -0
- package/dist/capabilities/oa-tools.js +10 -0
- package/dist/capabilities/prompt.d.ts +14 -0
- package/dist/capabilities/prompt.js +14 -0
- package/dist/capabilities/prompts/code-review.d.ts +14 -0
- package/dist/capabilities/prompts/code-review.js +14 -0
- package/dist/capabilities/prompts/identity.d.ts +6 -0
- package/dist/capabilities/prompts/identity.js +6 -0
- package/dist/capabilities/prompts/team.d.ts +4 -0
- package/dist/capabilities/prompts/team.js +4 -0
- package/dist/capabilities/repo-tools.d.ts +11 -0
- package/dist/capabilities/repo-tools.js +8 -0
- package/dist/capabilities/sandbox-file-send.d.ts +95 -0
- package/dist/capabilities/sandbox-file-send.js +91 -3
- package/dist/capabilities/scenarios.d.ts +130 -0
- package/dist/capabilities/scenarios.js +180 -7
- package/dist/capabilities/select-environment-tool.d.ts +7 -0
- package/dist/capabilities/select-environment-tool.js +30 -0
- package/dist/capabilities/send-user-file-tool.d.ts +33 -0
- package/dist/capabilities/send-user-file-tool.js +65 -1
- package/dist/capabilities/skills.d.ts +29 -0
- package/dist/capabilities/skills.js +13 -2
- package/dist/capabilities/team.d.ts +22 -0
- package/dist/capabilities/team.js +22 -2
- package/dist/capabilities/tool-defer.d.ts +26 -0
- package/dist/capabilities/tool-defer.js +3 -0
- package/dist/config-center/apply-effective.d.ts +65 -0
- package/dist/config-center/apply-effective.js +204 -12
- package/dist/config-center/http-client.d.ts +34 -0
- package/dist/config-center/http-client.js +68 -0
- package/dist/config-center/restart-signal.d.ts +22 -0
- package/dist/config-center/restart-signal.js +39 -0
- package/dist/config-center/skills-mcp.d.ts +20 -1
- package/dist/config-center/skills-mcp.js +42 -7
- package/dist/config-center/types.d.ts +92 -1
- package/dist/config-lkg.d.ts +12 -0
- package/dist/config-lkg.js +41 -0
- package/dist/config-provider.d.ts +78 -0
- package/dist/config-provider.js +165 -2
- package/dist/config-types.d.ts +546 -0
- package/dist/config.d.ts +64 -0
- package/dist/config.js +455 -60
- package/dist/degenerate-instrument.d.ts +38 -0
- package/dist/degenerate-instrument.js +55 -3
- package/dist/elicitation.d.ts +39 -0
- package/dist/elicitation.js +87 -3
- package/dist/env-facts.d.ts +61 -0
- package/dist/env-facts.js +73 -7
- package/dist/fleet/fleet-bus.d.ts +185 -0
- package/dist/fleet/fleet-bus.js +333 -27
- package/dist/fleet/subagent-tail-bus.d.ts +11 -0
- package/dist/fleet/subagent-tail-bus.js +33 -2
- package/dist/fleet-client.d.ts +38 -0
- package/dist/fleet-client.js +44 -9
- package/dist/fleet-lease.d.ts +46 -0
- package/dist/fleet-lease.js +73 -5
- package/dist/hooks/branch-transcript.d.ts +8 -0
- package/dist/hooks/branch-transcript.js +33 -0
- package/dist/hooks/cc-stop-prompt.d.ts +42 -0
- package/dist/hooks/cc-stop-prompt.js +43 -1
- package/dist/hooks/hook-llm.d.ts +15 -0
- package/dist/hooks/hook-llm.js +47 -0
- package/dist/hooks/hook-runner.d.ts +89 -0
- package/dist/hooks/hook-runner.js +327 -18
- package/dist/http/idempotency.d.ts +31 -0
- package/dist/http/idempotency.js +34 -0
- package/dist/http/principal-gate.d.ts +17 -0
- package/dist/http/principal-gate.js +35 -3
- package/dist/http/route-ctx.d.ts +36 -0
- package/dist/http/routes/approvals-assistant.d.ts +25 -0
- package/dist/http/routes/approvals-assistant.js +253 -23
- package/dist/http/routes/attachments.js +22 -4
- package/dist/http/routes/capabilities.d.ts +7 -0
- package/dist/http/routes/capabilities.js +202 -1
- package/dist/http/routes/fleet.d.ts +6 -0
- package/dist/http/routes/fleet.js +94 -5
- package/dist/http/routes/images.d.ts +17 -0
- package/dist/http/routes/images.js +222 -14
- package/dist/http/routes/leader.d.ts +7 -0
- package/dist/http/routes/leader.js +10 -0
- package/dist/http/routes/memory-policy.d.ts +6 -0
- package/dist/http/routes/memory-policy.js +38 -6
- package/dist/http/routes/notify-wake.d.ts +10 -0
- package/dist/http/routes/notify-wake.js +19 -3
- package/dist/http/routes/observability.d.ts +6 -0
- package/dist/http/routes/observability.js +19 -2
- package/dist/http/routes/runs.d.ts +15 -0
- package/dist/http/routes/runs.js +464 -41
- package/dist/http/routes/session-sync.d.ts +15 -0
- package/dist/http/routes/session-sync.js +229 -19
- package/dist/http/routes/sessions-list.d.ts +6 -0
- package/dist/http/routes/sessions-list.js +35 -4
- package/dist/http/routes/sessions.d.ts +14 -0
- package/dist/http/routes/sessions.js +176 -31
- package/dist/http/routes/side-query.d.ts +8 -0
- package/dist/http/routes/side-query.js +26 -1
- package/dist/http/routes/tasks.d.ts +18 -0
- package/dist/http/routes/tasks.js +501 -38
- package/dist/http/routes/trace-usage.d.ts +10 -0
- package/dist/http/routes/trace-usage.js +66 -14
- package/dist/http/routes/workflows.d.ts +12 -0
- package/dist/http/routes/workflows.js +180 -19
- package/dist/http/run-meta.d.ts +11 -0
- package/dist/http/run-meta.js +6 -0
- package/dist/http/send.d.ts +19 -0
- package/dist/http/send.js +11 -0
- package/dist/http/server.d.ts +255 -0
- package/dist/http/server.js +921 -75
- package/dist/http/sse-log.d.ts +15 -0
- package/dist/http/sse-log.js +16 -0
- package/dist/http/tar.d.ts +9 -0
- package/dist/http/tar.js +21 -5
- package/dist/http/wire-gate.d.ts +9 -0
- package/dist/http/wire-gate.js +9 -0
- package/dist/http/wire-types.d.ts +187 -0
- package/dist/http/workspace-content.d.ts +8 -0
- package/dist/http/workspace-content.js +10 -0
- package/dist/images/bake-validate.d.ts +63 -0
- package/dist/images/bake-validate.js +71 -1
- package/dist/images/manifest.d.ts +19 -0
- package/dist/images/manifest.js +6 -1
- package/dist/index.d.ts +1 -5
- package/dist/index.js +10 -5
- package/dist/key-resolver.d.ts +23 -0
- package/dist/key-resolver.js +27 -2
- package/dist/leader/diffout.d.ts +23 -0
- package/dist/leader/diffout.js +8 -1
- package/dist/leader/diffup.d.ts +32 -0
- package/dist/leader/diffup.js +43 -0
- package/dist/leader/endpoint.d.ts +20 -0
- package/dist/leader/endpoint.js +25 -2
- package/dist/leader/fanout.d.ts +60 -0
- package/dist/leader/fanout.js +29 -3
- package/dist/leader/grader-env-factory.d.ts +74 -0
- package/dist/leader/grader-env-factory.js +62 -3
- package/dist/leader/leader.d.ts +97 -0
- package/dist/leader/leader.js +151 -4
- package/dist/leader/merge.d.ts +94 -0
- package/dist/leader/merge.js +112 -9
- package/dist/leader/planner.d.ts +52 -0
- package/dist/leader/planner.js +47 -3
- package/dist/leader/repair-oracle.d.ts +61 -0
- package/dist/leader/repair-oracle.js +59 -1
- package/dist/leader/repair-wire.d.ts +78 -0
- package/dist/leader/repair-wire.js +79 -2
- package/dist/leader/wire.d.ts +79 -0
- package/dist/leader/wire.js +255 -8
- package/dist/lsp/e2b-bridge.d.ts +16 -0
- package/dist/lsp/e2b-bridge.js +32 -4
- package/dist/lsp/e2b-manager.d.ts +10 -0
- package/dist/lsp/e2b-manager.js +18 -2
- package/dist/lsp/lsp-frames.d.ts +12 -0
- package/dist/lsp/lsp-frames.js +12 -0
- package/dist/lsp/manager.d.ts +12 -0
- package/dist/lsp/manager.js +35 -2
- package/dist/lsp/types.d.ts +10 -0
- package/dist/lsp/ws-transport.d.ts +12 -0
- package/dist/lsp/ws-transport.js +53 -5
- package/dist/lsp-evict.d.ts +14 -0
- package/dist/lsp-evict.js +15 -1
- package/dist/main.js +2132 -96
- package/dist/memory-export.d.ts +1 -0
- package/dist/memory-export.js +4 -0
- package/dist/memory-scope.d.ts +49 -0
- package/dist/memory-scope.js +87 -4
- package/dist/memory-sync-client.d.ts +24 -0
- package/dist/memory-sync-client.js +41 -2
- package/dist/memory-sync.d.ts +23 -0
- package/dist/memory-sync.js +70 -1
- package/dist/model-select.d.ts +39 -0
- package/dist/model-select.js +42 -1
- package/dist/observability/cost-quota.d.ts +20 -0
- package/dist/observability/cost-quota.js +4 -0
- package/dist/observability/cost-taxonomy.d.ts +45 -0
- package/dist/observability/cost-taxonomy.js +34 -0
- package/dist/observability/logger.d.ts +1 -0
- package/dist/observability/logger.js +6 -0
- package/dist/observability/metrics.d.ts +13 -0
- package/dist/observability/metrics.js +63 -0
- package/dist/observability/otel-exporter.d.ts +9 -0
- package/dist/observability/otel-exporter.js +11 -3
- package/dist/observability/principal-context.d.ts +9 -0
- package/dist/observability/principal-context.js +9 -0
- package/dist/observability/prompt-manifest.d.ts +37 -0
- package/dist/observability/prompt-manifest.js +35 -1
- package/dist/observability/rate-limit.d.ts +10 -0
- package/dist/observability/rate-limit.js +1 -0
- package/dist/observability/tool-trace.d.ts +24 -0
- package/dist/observability/tool-trace.js +41 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +107 -0
- package/dist/orchestration/hardened-vm-runner.js +119 -4
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +14 -0
- package/dist/orchestration/hardened-vm-worker-runner.js +26 -1
- package/dist/orchestration/hardened-vm-worker.js +27 -0
- package/dist/orchestration/subagent-steer.d.ts +44 -0
- package/dist/orchestration/subagent-steer.js +45 -1
- package/dist/orchestration/workflow-agent-steer.d.ts +54 -0
- package/dist/orchestration/workflow-agent-steer.js +80 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +189 -2
- package/dist/orchestration/workflow-completion-inbox.js +283 -32
- package/dist/orchestration/workflow-notify-journal.d.ts +132 -1
- package/dist/orchestration/workflow-notify-journal.js +187 -13
- package/dist/parked-decide.d.ts +61 -0
- package/dist/parked-decide.js +58 -1
- package/dist/per-task-image.d.ts +54 -0
- package/dist/per-task-image.js +41 -0
- package/dist/plan-cache-probe.d.ts +35 -0
- package/dist/plan-cache-probe.js +18 -3
- package/dist/plugins/approval-exemption-store.d.ts +7 -0
- package/dist/plugins/approval-exemption-store.js +28 -2
- package/dist/plugins/approval-store-sql.d.ts +64 -0
- package/dist/plugins/approval-store-sql.js +32 -0
- package/dist/plugins/background-agent-store-sql.d.ts +55 -0
- package/dist/plugins/background-agent-store-sql.js +91 -4
- package/dist/plugins/background-shell-support.d.ts +98 -0
- package/dist/plugins/background-shell-support.js +117 -13
- package/dist/plugins/blob-backend.d.ts +104 -0
- package/dist/plugins/blob-backend.js +163 -6
- package/dist/plugins/breaker-state-sql.d.ts +65 -1
- package/dist/plugins/breaker-state-sql.js +46 -8
- package/dist/plugins/caching-session-store.d.ts +42 -0
- package/dist/plugins/caching-session-store.js +63 -3
- package/dist/plugins/checkpoint-store-sql.d.ts +179 -0
- package/dist/plugins/checkpoint-store-sql.js +239 -11
- package/dist/plugins/file-outcome-sink.d.ts +4 -0
- package/dist/plugins/file-outcome-sink.js +9 -0
- package/dist/plugins/file-resume-anchor-store.d.ts +20 -0
- package/dist/plugins/file-resume-anchor-store.js +43 -4
- package/dist/plugins/file-run-store.d.ts +90 -0
- package/dist/plugins/file-run-store.js +145 -13
- package/dist/plugins/file-snapshot-store-sql.d.ts +133 -1
- package/dist/plugins/file-snapshot-store-sql.js +178 -10
- package/dist/plugins/file-workflow-journal-store.d.ts +10 -0
- package/dist/plugins/file-workflow-journal-store.js +10 -0
- package/dist/plugins/fork-routing-session-store.d.ts +47 -0
- package/dist/plugins/fork-routing-session-store.js +51 -3
- package/dist/plugins/host-platform.d.ts +69 -0
- package/dist/plugins/host-platform.js +81 -2
- package/dist/plugins/image-bake-store-sql.d.ts +136 -1
- package/dist/plugins/image-bake-store-sql.js +241 -7
- package/dist/plugins/image-index-sql.d.ts +46 -0
- package/dist/plugins/image-index-sql.js +113 -4
- package/dist/plugins/k8s-bg-scripts.d.ts +34 -0
- package/dist/plugins/k8s-bg-scripts.js +88 -4
- package/dist/plugins/k8s-exec-protocol.d.ts +33 -0
- package/dist/plugins/k8s-exec-protocol.js +41 -0
- package/dist/plugins/local-checkpoint-store.d.ts +40 -0
- package/dist/plugins/local-checkpoint-store.js +86 -7
- package/dist/plugins/local-session-store.d.ts +157 -0
- package/dist/plugins/local-session-store.js +289 -34
- package/dist/plugins/local-task-attachment-store.js +14 -2
- package/dist/plugins/mailbox-store-sql.d.ts +38 -0
- package/dist/plugins/mailbox-store-sql.js +39 -6
- package/dist/plugins/memory-engine-pg.d.ts +30 -0
- package/dist/plugins/memory-engine-pg.js +122 -4
- package/dist/plugins/memory-engine-tidb.d.ts +26 -0
- package/dist/plugins/memory-engine-tidb.js +115 -5
- package/dist/plugins/memory-engine-vector-util.d.ts +5 -0
- package/dist/plugins/memory-engine-vector-util.js +5 -0
- package/dist/plugins/memory-resume-anchor-store.d.ts +8 -0
- package/dist/plugins/memory-resume-anchor-store.js +17 -0
- package/dist/plugins/memory-run-store.d.ts +63 -0
- package/dist/plugins/memory-run-store.js +73 -8
- package/dist/plugins/memory-session-policy-store.d.ts +17 -0
- package/dist/plugins/memory-session-policy-store.js +17 -0
- package/dist/plugins/memory-sync-store-pg.d.ts +42 -0
- package/dist/plugins/memory-sync-store-pg.js +45 -2
- package/dist/plugins/memory-sync-store-tidb.d.ts +9 -0
- package/dist/plugins/memory-sync-store-tidb.js +31 -1
- package/dist/plugins/outcome-ledger-sql.d.ts +63 -0
- package/dist/plugins/outcome-ledger-sql.js +97 -3
- package/dist/plugins/pg-approval-store.d.ts +7 -0
- package/dist/plugins/pg-approval-store.js +7 -0
- package/dist/plugins/pg-breaker-state.d.ts +6 -0
- package/dist/plugins/pg-breaker-state.js +6 -0
- package/dist/plugins/pg-checkpoint-store.d.ts +8 -0
- package/dist/plugins/pg-checkpoint-store.js +8 -0
- package/dist/plugins/pg-cost-quota.d.ts +17 -0
- package/dist/plugins/pg-cost-quota.js +6 -0
- package/dist/plugins/pg-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/pg-file-snapshot-store.js +6 -0
- package/dist/plugins/pg-image-bake.d.ts +9 -0
- package/dist/plugins/pg-image-bake.js +9 -0
- package/dist/plugins/pg-image-index.d.ts +9 -0
- package/dist/plugins/pg-image-index.js +9 -0
- package/dist/plugins/pg-outcome-ledger.d.ts +9 -0
- package/dist/plugins/pg-outcome-ledger.js +9 -0
- package/dist/plugins/pg-pool.d.ts +50 -0
- package/dist/plugins/pg-pool.js +78 -0
- package/dist/plugins/pg-query.d.ts +11 -0
- package/dist/plugins/pg-rate-limiter.d.ts +23 -0
- package/dist/plugins/pg-rate-limiter.js +12 -2
- package/dist/plugins/pg-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/pg-resume-anchor-store.js +5 -0
- package/dist/plugins/pg-run-store.d.ts +7 -0
- package/dist/plugins/pg-run-store.js +7 -0
- package/dist/plugins/pg-safe-json.d.ts +13 -0
- package/dist/plugins/pg-safe-json.js +40 -4
- package/dist/plugins/pg-session-policy-store.d.ts +5 -0
- package/dist/plugins/pg-session-policy-store.js +5 -0
- package/dist/plugins/pg-session-storage.d.ts +72 -0
- package/dist/plugins/pg-session-storage.js +152 -20
- package/dist/plugins/pg-session-store.d.ts +10 -0
- package/dist/plugins/pg-session-store.js +10 -0
- package/dist/plugins/pg-tool-result-store.d.ts +7 -0
- package/dist/plugins/pg-tool-result-store.js +7 -0
- package/dist/plugins/pg-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-journal-store.js +7 -0
- package/dist/plugins/pg-workflow-run-store.d.ts +7 -0
- package/dist/plugins/pg-workflow-run-store.js +7 -0
- package/dist/plugins/posix-shell-fs.d.ts +3 -0
- package/dist/plugins/posix-shell-fs.js +31 -1
- package/dist/plugins/remote-env-adb.d.ts +25 -0
- package/dist/plugins/remote-env-adb.js +95 -12
- package/dist/plugins/remote-env-e2b.d.ts +146 -0
- package/dist/plugins/remote-env-e2b.js +371 -40
- package/dist/plugins/remote-env-file-error.d.ts +34 -0
- package/dist/plugins/remote-env-file-error.js +37 -0
- package/dist/plugins/remote-env-host.d.ts +151 -0
- package/dist/plugins/remote-env-host.js +468 -70
- package/dist/plugins/remote-env-k8s.d.ts +135 -0
- package/dist/plugins/remote-env-k8s.js +318 -32
- package/dist/plugins/remote-env-local-docker.d.ts +65 -0
- package/dist/plugins/remote-env-local-docker.js +149 -24
- package/dist/plugins/remote-env-ssh.d.ts +35 -0
- package/dist/plugins/remote-env-ssh.js +117 -20
- package/dist/plugins/remote-scratchpad.d.ts +38 -0
- package/dist/plugins/remote-scratchpad.js +32 -2
- package/dist/plugins/remote-shell.d.ts +22 -0
- package/dist/plugins/remote-shell.js +27 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +28 -0
- package/dist/plugins/resume-anchor-store-sql.js +11 -0
- package/dist/plugins/roster-store-sql.d.ts +27 -0
- package/dist/plugins/roster-store-sql.js +54 -0
- package/dist/plugins/run-store-sql.d.ts +194 -0
- package/dist/plugins/run-store-sql.js +210 -9
- package/dist/plugins/s3-presign.d.ts +20 -0
- package/dist/plugins/s3-presign.js +49 -2
- package/dist/plugins/scheduler-support.d.ts +12 -0
- package/dist/plugins/scheduler-support.js +75 -3
- package/dist/plugins/send-file-ledger.d.ts +15 -0
- package/dist/plugins/send-file-ledger.js +53 -4
- package/dist/plugins/send-user-file.d.ts +77 -0
- package/dist/plugins/send-user-file.js +92 -4
- package/dist/plugins/session-policy-store-sql.d.ts +15 -0
- package/dist/plugins/session-policy-store-sql.js +75 -3
- package/dist/plugins/session-store.d.ts +45 -0
- package/dist/plugins/session-store.js +51 -0
- package/dist/plugins/sql-driver.d.ts +77 -0
- package/dist/plugins/sql-driver.js +4 -0
- package/dist/plugins/sql-escape.d.ts +8 -0
- package/dist/plugins/sql-escape.js +8 -0
- package/dist/plugins/sql-row-helpers.d.ts +25 -0
- package/dist/plugins/sql-row-helpers.js +25 -0
- package/dist/plugins/store-backend.d.ts +103 -0
- package/dist/plugins/store-backend.js +120 -27
- package/dist/plugins/store-contracts.d.ts +62 -0
- package/dist/plugins/store-contracts.js +3 -0
- package/dist/plugins/task-attachment-store.d.ts +60 -0
- package/dist/plugins/task-attachment-store.js +49 -3
- package/dist/plugins/task-list-store-sql.d.ts +25 -0
- package/dist/plugins/task-list-store-sql.js +21 -0
- package/dist/plugins/tidb-approval-store.d.ts +6 -0
- package/dist/plugins/tidb-approval-store.js +6 -0
- package/dist/plugins/tidb-breaker-state.d.ts +5 -0
- package/dist/plugins/tidb-breaker-state.js +5 -0
- package/dist/plugins/tidb-checkpoint-store.d.ts +7 -0
- package/dist/plugins/tidb-checkpoint-store.js +7 -0
- package/dist/plugins/tidb-cost-quota.d.ts +6 -0
- package/dist/plugins/tidb-cost-quota.js +1 -0
- package/dist/plugins/tidb-file-snapshot-store.d.ts +6 -0
- package/dist/plugins/tidb-file-snapshot-store.js +6 -0
- package/dist/plugins/tidb-image-bake.d.ts +8 -0
- package/dist/plugins/tidb-image-bake.js +8 -0
- package/dist/plugins/tidb-image-index.d.ts +8 -0
- package/dist/plugins/tidb-image-index.js +8 -0
- package/dist/plugins/tidb-outcome-ledger.d.ts +10 -0
- package/dist/plugins/tidb-outcome-ledger.js +10 -0
- package/dist/plugins/tidb-pool.d.ts +56 -0
- package/dist/plugins/tidb-pool.js +181 -1
- package/dist/plugins/tidb-rate-limiter.d.ts +11 -0
- package/dist/plugins/tidb-rate-limiter.js +5 -2
- package/dist/plugins/tidb-resume-anchor-store.d.ts +5 -0
- package/dist/plugins/tidb-resume-anchor-store.js +5 -0
- package/dist/plugins/tidb-run-store.d.ts +7 -0
- package/dist/plugins/tidb-run-store.js +7 -0
- package/dist/plugins/tidb-session-policy-store.d.ts +5 -0
- package/dist/plugins/tidb-session-policy-store.js +5 -0
- package/dist/plugins/tidb-session-storage.d.ts +43 -0
- package/dist/plugins/tidb-session-storage.js +62 -3
- package/dist/plugins/tidb-session-store.d.ts +142 -0
- package/dist/plugins/tidb-session-store.js +264 -16
- package/dist/plugins/tidb-tool-result-store.d.ts +5 -0
- package/dist/plugins/tidb-tool-result-store.js +7 -0
- package/dist/plugins/tidb-workflow-journal-store.d.ts +7 -0
- package/dist/plugins/tidb-workflow-journal-store.js +7 -0
- package/dist/plugins/tidb-workflow-run-store.d.ts +8 -0
- package/dist/plugins/tidb-workflow-run-store.js +8 -0
- package/dist/plugins/tool-result-store-sql.d.ts +58 -0
- package/dist/plugins/tool-result-store-sql.js +38 -2
- package/dist/plugins/web-search.d.ts +35 -0
- package/dist/plugins/web-search.js +45 -9
- package/dist/plugins/workflow-journal-limits.d.ts +10 -0
- package/dist/plugins/workflow-journal-limits.js +10 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +78 -0
- package/dist/plugins/workflow-journal-store-sql.js +58 -2
- package/dist/plugins/workflow-run-store-sql.d.ts +84 -0
- package/dist/plugins/workflow-run-store-sql.js +84 -6
- package/dist/plugins/worktree-isolation.d.ts +45 -0
- package/dist/plugins/worktree-isolation.js +105 -6
- package/dist/plugins/write-behind-counter.d.ts +56 -1
- package/dist/plugins/write-behind-counter.js +53 -14
- package/dist/principal-jwt.d.ts +24 -0
- package/dist/principal-jwt.js +60 -5
- package/dist/project-memory.d.ts +22 -0
- package/dist/project-memory.js +144 -15
- package/dist/prompts-domain-validate.d.ts +28 -0
- package/dist/prompts-domain-validate.js +42 -1
- package/dist/question.d.ts +33 -0
- package/dist/question.js +69 -2
- package/dist/resource-suspend.d.ts +21 -0
- package/dist/resource-suspend.js +16 -0
- package/dist/router/route-orchestration.d.ts +78 -0
- package/dist/router/route-orchestration.js +77 -0
- package/dist/run-local.d.ts +32 -0
- package/dist/run-local.js +172 -8
- package/dist/runs.d.ts +189 -4
- package/dist/runs.js +465 -24
- package/dist/runtime-caps-resolver.d.ts +106 -0
- package/dist/runtime-caps-resolver.js +89 -4
- package/dist/runtime-governance.d.ts +84 -0
- package/dist/runtime-governance.js +127 -1
- package/dist/sandbox-pkg-source.d.ts +23 -0
- package/dist/sandbox-pkg-source.js +37 -0
- package/dist/sealed-key.d.ts +54 -0
- package/dist/sealed-key.js +68 -3
- package/dist/security.d.ts +108 -0
- package/dist/security.js +145 -6
- package/dist/sema-registry.d.ts +21 -0
- package/dist/sema-registry.js +21 -0
- package/dist/session-leaf-bus.d.ts +31 -0
- package/dist/session-leaf-bus.js +32 -0
- package/dist/session-sync-content.d.ts +46 -0
- package/dist/session-sync-content.js +47 -1
- package/dist/session-sync-kernel.d.ts +89 -0
- package/dist/session-sync-kernel.js +48 -3
- package/dist/session-sync.d.ts +125 -0
- package/dist/session-sync.js +181 -8
- package/dist/session-titler.d.ts +26 -0
- package/dist/session-titler.js +41 -7
- package/dist/session-watch.d.ts +53 -1
- package/dist/session-watch.js +73 -9
- package/dist/sighup-idle.d.ts +30 -0
- package/dist/sighup-idle.js +12 -1
- package/dist/spec-fields.d.ts +91 -3
- package/dist/spec-fields.js +116 -4
- package/dist/task-cwd.d.ts +50 -0
- package/dist/task-cwd.js +68 -1
- package/dist/task-mcp.d.ts +47 -0
- package/dist/task-mcp.js +29 -0
- package/dist/task-settings.d.ts +175 -0
- package/dist/task-settings.js +226 -11
- package/dist/task-workflow.d.ts +67 -0
- package/dist/task-workflow.js +75 -8
- package/dist/tool-approval.d.ts +91 -0
- package/dist/tool-approval.js +215 -0
- package/dist/trace/artifacts.d.ts +9 -0
- package/dist/trace/artifacts.js +30 -5
- package/dist/trace/core-keyset-guard.d.ts +18 -0
- package/dist/trace/ledger-sink.d.ts +43 -0
- package/dist/trace/ledger-sink.js +64 -5
- package/dist/trace/project.d.ts +133 -0
- package/dist/trace/project.js +189 -2
- package/dist/trace/redact.d.ts +19 -0
- package/dist/trace/redact.js +66 -9
- package/dist/usage-analytics.d.ts +26 -0
- package/dist/usage-analytics.js +26 -3
- package/package.json +1 -1
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { FileConfigStore } from "@sema-agent/registry-core/node";
|
|
2
2
|
import { type EffectiveConfig as AgentConfigEffective } from "@sema-agent/registry-core";
|
|
3
3
|
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, type EffectiveConfig } from "./sema-registry.js";
|
|
4
|
+
/** Result of a `fetchEffective` — EXACTLY sema-registry's return: the effective config + its etag, or
|
|
5
|
+
* `null` for "unchanged" (remote 304; local: the version matched the caller's prior etag).
|
|
6
|
+
* `domainErrors`([898] registry-core 0.10.12 tolerant seam,local lane only):catalog 域坏文件不再
|
|
7
|
+
* 连坐全包回落 env——坏域按该域 schema default 落+错误单列,好域照常生效;caller(main.ts)对每条打
|
|
8
|
+
* per-domain warn 点名坏域。gate 域(governance/rosters/…)坏文件 tolerant 仍 throw(READ 容错不放宽
|
|
9
|
+
* gate fail-loud,registry-core 半场精化)——那条路走既有的整包 catch。 */
|
|
4
10
|
export type FetchEffectiveResult = {
|
|
5
11
|
effective: EffectiveConfig;
|
|
6
12
|
etag?: string;
|
|
@@ -9,23 +15,67 @@ export type FetchEffectiveResult = {
|
|
|
9
15
|
error: string;
|
|
10
16
|
}>;
|
|
11
17
|
} | null;
|
|
18
|
+
/** Sentinel returned by {@link raceBootFetch} when the boot pull outlived its budget — the caller
|
|
19
|
+
* starts serving on the env fallback and the SAME promise settles in the background (never cancelled). */
|
|
12
20
|
export declare const BOOT_FETCH_DEFERRED: unique symbol;
|
|
21
|
+
/**
|
|
22
|
+
* Race the boot config pull against a wall-clock budget (clay 2026-07-17: a black-holed center made
|
|
23
|
+
* the SYNCHRONOUS boot pull hang ~5.7s on the TOC lane — the "local server takes 5s to start" report).
|
|
24
|
+
* Inside the budget → the fetch result verbatim (the healthy-center fast path is unchanged, typically
|
|
25
|
+
* <300ms). Past it → {@link BOOT_FETCH_DEFERRED}; the fetch is NOT aborted — the caller chains a
|
|
26
|
+
* background continuation that triggers a refresh tick when it finally settles. The timer is unref'd
|
|
27
|
+
* (never holds the loop) and cleared as soon as the fetch wins.
|
|
28
|
+
*/
|
|
13
29
|
export declare function raceBootFetch<T>(fetch: Promise<T>, budgetMs: number): Promise<T | typeof BOOT_FETCH_DEFERRED>;
|
|
30
|
+
/**
|
|
31
|
+
* The two transport calls the service makes to obtain config, behind a backend-selectable seam. Both
|
|
32
|
+
* signatures and return shapes match `sema-registry.fetchEffective` / `sema-registry.fetchSkillContent`
|
|
33
|
+
* EXACTLY so that, ONCE WIRED, the caller (main.ts) could swap remote↔local without touching applyEffective
|
|
34
|
+
* et al. (main.ts does not swap on this seam yet — see the NOT-YET-WIRED note at the top of this module).
|
|
35
|
+
*/
|
|
14
36
|
export interface ConfigProvider {
|
|
37
|
+
/** "remote" = sema-registry HTTP; "local" = on-disk FileConfigStore. */
|
|
15
38
|
readonly kind: "remote" | "local";
|
|
39
|
+
/**
|
|
40
|
+
* Pull the effective config. `etag` is the caller's last-seen version token (`if-none-match` on remote;
|
|
41
|
+
* the stable version string on local). Returns `null` when unchanged, else the config + a fresh etag.
|
|
42
|
+
* Throws on a transport/read error (caller keeps env fallback).
|
|
43
|
+
*/
|
|
16
44
|
fetchEffective(etag: string | undefined): Promise<FetchEffectiveResult>;
|
|
45
|
+
/**
|
|
46
|
+
* Fetch one skill body by content hash (`sha256:<hex>`). Remote: GET the content endpoint + verify the
|
|
47
|
+
* hash. Local: content-addressed lookup over the local skills domain. Returns `undefined` when the hash
|
|
48
|
+
* is unknown (remote 404 / local miss) so the caller keeps its baseline; throws only on a hard error
|
|
49
|
+
* (remote non-404 HTTP / hash mismatch).
|
|
50
|
+
*/
|
|
17
51
|
fetchSkillContent(contentHash: string): Promise<string | undefined>;
|
|
18
52
|
}
|
|
53
|
+
/** The config-provider knobs read off ServiceConfig (a structural subset — avoids importing the whole
|
|
54
|
+
* ServiceConfig type and keeps this module testable with a plain object). */
|
|
19
55
|
export interface ConfigProviderInput {
|
|
56
|
+
/** Set when SEMA_REGISTRY_URL (legacy CONFIG_CENTER_URL) is configured (config.ts `configCenter`). `dryRun` is carried through so a
|
|
57
|
+
* remote↔local swap via this seam does NOT drop the dry-run posture main.ts branches on (config.ts
|
|
58
|
+
* `configCenter.dryRun`); the provider itself does not consume it (the caller still branches on it). */
|
|
20
59
|
configCenter?: {
|
|
21
60
|
baseUrl: string;
|
|
22
61
|
token: string;
|
|
23
62
|
worker?: string;
|
|
24
63
|
dryRun?: boolean;
|
|
25
64
|
};
|
|
65
|
+
/** `CONFIG_PROVIDER` env — a CLOSED enum `local` | `remote` | undefined. `local` forces the local
|
|
66
|
+
* backend; `remote` selects the center (falls through to local if no URL); any OTHER value is treated as
|
|
67
|
+
* a misconfiguration and defaults to local (safe, non-network) with a warn. Normalize/trim the raw env
|
|
68
|
+
* string at parse time in config.ts when this knob is actually wired. */
|
|
26
69
|
provider?: string;
|
|
70
|
+
/** `CONFIG_LOCAL_DIR` env — root holding `config.d/<domain>.json` for the local backend. Defaults to
|
|
71
|
+
* `./config.d`'s parent convention (the FileConfigStore takes the ROOT, and reads `<root>/config.d`). */
|
|
27
72
|
localDir?: string;
|
|
28
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* RemoteConfigProvider — DELEGATES to the exported sema-registry HTTP functions. No HTTP is reimplemented;
|
|
76
|
+
* baseUrl/token/worker are bound once and passed through. The two delegate fns are injectable (defaulting
|
|
77
|
+
* to the real sema-registry exports) so a unit test can assert delegation without module-mocking.
|
|
78
|
+
*/
|
|
29
79
|
export declare class RemoteConfigProvider implements ConfigProvider {
|
|
30
80
|
private readonly cc;
|
|
31
81
|
private readonly deps;
|
|
@@ -41,14 +91,42 @@ export declare class RemoteConfigProvider implements ConfigProvider {
|
|
|
41
91
|
fetchEffective(etag: string | undefined): Promise<FetchEffectiveResult>;
|
|
42
92
|
fetchSkillContent(contentHash: string): Promise<string | undefined>;
|
|
43
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* LocalConfigProvider — reads the SAME config contract from disk via `FileConfigStore`. `getEffective()`
|
|
96
|
+
* returns the registry `EffectiveConfig` (all domains, defaults filled); `getVersion()` returns a
|
|
97
|
+
* stable change-detector. We map that down to the service-local `EffectiveConfig` shape and surface the
|
|
98
|
+
* version as the etag (so the caller's "skip re-apply if etag unchanged" works locally too).
|
|
99
|
+
*/
|
|
44
100
|
export declare class LocalConfigProvider implements ConfigProvider {
|
|
45
101
|
readonly kind: "local";
|
|
46
102
|
private readonly store;
|
|
103
|
+
/** [875]b 可观测性:config_loaded 日志要能回答「到底读的哪个目录」——复验实录:只设 LOCAL_DATA_ROOT 时
|
|
104
|
+
* config.d 静默读不到且 0 模型无告警(CONFIG_LOCAL_DIR 才是本 lane 的选目录旋钮)。 */
|
|
47
105
|
readonly root: string;
|
|
48
106
|
constructor(root: string, store?: FileConfigStore);
|
|
49
107
|
fetchEffective(etag: string | undefined): Promise<FetchEffectiveResult>;
|
|
50
108
|
fetchSkillContent(contentHash: string): Promise<string | undefined>;
|
|
51
109
|
}
|
|
110
|
+
/**
|
|
111
|
+
* Map the registry `EffectiveConfig` (superset, all domains) → the service-local `EffectiveConfig`
|
|
112
|
+
* the consumers (`applyEffective`, `resolveMcpServers`, …) expect. The two are structurally compatible
|
|
113
|
+
* for every field the consumers read; this projection makes that explicit (and drops control-plane-only
|
|
114
|
+
* domains the service never consumes: rosters, systems, workers, hosts, integrations, access).
|
|
115
|
+
*
|
|
116
|
+
* Skills are mapped to the MANIFEST shape (name/description/scenarios/contentHash/enabled) — the same
|
|
117
|
+
* shape RemoteConfigProvider's `/effective` ships — so the lazy `fetchSkillContent`-by-hash path is
|
|
118
|
+
* identical in both modes. The local content hash is the `contentHash` the store already computed.
|
|
119
|
+
*/
|
|
52
120
|
export declare function mapToServiceEffective(eff: AgentConfigEffective, version: number): EffectiveConfig;
|
|
121
|
+
/**
|
|
122
|
+
* Pick the backend off a CLOSED `provider` enum (`local` | `remote` | undefined): LOCAL when
|
|
123
|
+
* `CONFIG_PROVIDER=local`, OR when no sema-registry URL is configured (a lone box with config.d/ on disk
|
|
124
|
+
* and no control plane). REMOTE otherwise (a configured center URL, the default fleet posture). A
|
|
125
|
+
* `CONFIG_PROVIDER=remote` with no URL is a misconfiguration — we fall through to local rather than
|
|
126
|
+
* constructing a remote provider with no endpoint (the caller would have skipped the remote pull entirely
|
|
127
|
+
* under the old code path; local-with-empty-config.d degrades to env the same way). An UNRECOGNIZED value
|
|
128
|
+
* (typo / wrong case) is NOT treated as remote: it defaults to local (non-network) with a warn, so a
|
|
129
|
+
* fat-fingered knob can never silently source config from an unintended/stale network endpoint.
|
|
130
|
+
*/
|
|
53
131
|
export declare function createConfigProvider(input: ConfigProviderInput): ConfigProvider;
|
|
54
132
|
//# sourceMappingURL=config-provider.d.ts.map
|
package/dist/config-provider.js
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ConfigProvider — the dual-mode seam over WHERE the effective config comes from (see
|
|
3
|
+
* sema-registry docs/DUAL-MODE-DESIGN.md §4).
|
|
4
|
+
*
|
|
5
|
+
* The service consumes sema-registry through EXACTLY two transport calls — `fetchEffective` (pull the
|
|
6
|
+
* effective config, ETag-conditional) and `fetchSkillContent` (lazy-pull one skill body by content hash).
|
|
7
|
+
* Everything downstream (applyEffective / applyRuntimeGates / resolveMcpServers / mcpForScenario / the
|
|
8
|
+
* skill overlay) is transport-agnostic: it operates on the returned `EffectiveConfig` / skill string.
|
|
9
|
+
*
|
|
10
|
+
* STATUS — FULLY provider-routed (提示词装配协议 §9.5-1/-3): boot AND the 60s refresh loop both pull
|
|
11
|
+
* through `configProvider.fetchEffective` (main.ts), so `CONFIG_PROVIDER=local` gets the same ongoing
|
|
12
|
+
* poll as the fleet path — a config.d edit lands within one poll (the local etag is the store's raws
|
|
13
|
+
* hash). The caller runs a whole-candidate gate over `domainErrors` (§9.5-5): on refresh an invalid
|
|
14
|
+
* domain rejects the candidate and the last-known-good keeps serving; boot stays tolerant per-domain
|
|
15
|
+
* (no LKG exists yet).
|
|
16
|
+
*
|
|
17
|
+
* This module factors those two calls behind a `ConfigProvider` interface with two backends:
|
|
18
|
+
*
|
|
19
|
+
* - {@link RemoteConfigProvider} — the existing behaviour. DELEGATES verbatim to the exported
|
|
20
|
+
* `sema-registry.fetchEffective` / `sema-registry.fetchSkillContent` (HTTP + Bearer + ETag + hash
|
|
21
|
+
* verify). No HTTP is reimplemented here; this is a thin wrapper that binds baseUrl/token/worker.
|
|
22
|
+
*
|
|
23
|
+
* - {@link LocalConfigProvider} — reads the SAME config contract from the local filesystem via
|
|
24
|
+
* `@sema-agent/registry-core/node` `FileConfigStore` (`.env` + `config.d/<domain>.json` → an
|
|
25
|
+
* `EffectiveConfig` through the SAME resolver the center uses). The registry `EffectiveConfig`
|
|
26
|
+
* is a structural SUPERSET of the service-local `EffectiveConfig` the consumers expect, so we map
|
|
27
|
+
* it down to EXACTLY that shape (see `mapToServiceEffective`). Skills are stored locally WITH their
|
|
28
|
+
* bodies (the local store doesn't split content into a manifest), so `fetchSkillContent` is a
|
|
29
|
+
* content-addressed lookup over the local skills domain (absent → undefined, mirroring a remote 404).
|
|
30
|
+
*
|
|
31
|
+
* SECRET BOUNDARY (unchanged in both modes): the config plane carries only env-NAME refs — `apiKeyEnv`,
|
|
32
|
+
* `envRefs`/`headerRefs`, `tokenEnv`. The real secret VALUE is never stored in config.d/<domain>.json and
|
|
33
|
+
* never read by this module; it is resolved from `process.env` downstream (sema-registry.ts
|
|
34
|
+
* `applyEffective`/`resolveMcpServers`). The local store is symmetric with the remote center on this: it
|
|
35
|
+
* ships NAMEs only. (Unit test asserts the local path resolves env-NAME→value via process.env and never
|
|
36
|
+
* persists a value.)
|
|
37
|
+
*/
|
|
1
38
|
import { createHmac, randomBytes } from "node:crypto";
|
|
2
39
|
import { FileConfigStore } from "@sema-agent/registry-core/node";
|
|
3
40
|
import { findSkillContent, skillContentHash, refIntegrityIssues, siblingResolver, } from "@sema-agent/registry-core";
|
|
@@ -5,14 +42,35 @@ import { redactSecrets } from "./trace/redact.js";
|
|
|
5
42
|
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, ConfigCenterHttpError, } from "./sema-registry.js";
|
|
6
43
|
import { createLogger } from "./observability/logger.js";
|
|
7
44
|
const logger = createLogger();
|
|
45
|
+
/**
|
|
46
|
+
* domainError strings must not echo raw config operands (self-review, information-surface lens):
|
|
47
|
+
* ref-integrity messages quote the referenced value verbatim, and tolerant-read parse failures carry
|
|
48
|
+
* zod/JSON.parse fragments of the file text — a controlled value pasted into the wrong slot (say, a
|
|
49
|
+
* credential in a model-ref position) would otherwise ride `config_candidate_rejected` /
|
|
50
|
+
* `config_domain_invalid` into the structured log stream. This runs at the producing boundary (the
|
|
51
|
+
* local provider is the only domainErrors producer): shared secret-shape redaction first, then every
|
|
52
|
+
* quoted operand becomes a short one-way fingerprint — keyed per process so the fingerprint is not a
|
|
53
|
+
* dictionary-comparable digest of the value, while equal operands still correlate within one log
|
|
54
|
+
* stream. The issue `path` stays clear; it is how the operator locates the entry.
|
|
55
|
+
*/
|
|
8
56
|
const OPERAND_FINGERPRINT_KEY = randomBytes(16);
|
|
9
57
|
function redactConfigError(text) {
|
|
10
58
|
return redactSecrets(text).replace(/"[^"]*"|'[^']*'/g, (m) => `"#${createHmac("sha256", OPERAND_FINGERPRINT_KEY).update(m.slice(1, -1)).digest("hex").slice(0, 8)}"`);
|
|
11
59
|
}
|
|
60
|
+
/** Sentinel returned by {@link raceBootFetch} when the boot pull outlived its budget — the caller
|
|
61
|
+
* starts serving on the env fallback and the SAME promise settles in the background (never cancelled). */
|
|
12
62
|
export const BOOT_FETCH_DEFERRED = Symbol("boot-fetch-deferred");
|
|
63
|
+
/**
|
|
64
|
+
* Race the boot config pull against a wall-clock budget (clay 2026-07-17: a black-holed center made
|
|
65
|
+
* the SYNCHRONOUS boot pull hang ~5.7s on the TOC lane — the "local server takes 5s to start" report).
|
|
66
|
+
* Inside the budget → the fetch result verbatim (the healthy-center fast path is unchanged, typically
|
|
67
|
+
* <300ms). Past it → {@link BOOT_FETCH_DEFERRED}; the fetch is NOT aborted — the caller chains a
|
|
68
|
+
* background continuation that triggers a refresh tick when it finally settles. The timer is unref'd
|
|
69
|
+
* (never holds the loop) and cleared as soon as the fetch wins.
|
|
70
|
+
*/
|
|
13
71
|
export function raceBootFetch(fetch, budgetMs) {
|
|
14
72
|
if (budgetMs <= 0)
|
|
15
|
-
return Promise.resolve(BOOT_FETCH_DEFERRED);
|
|
73
|
+
return Promise.resolve(BOOT_FETCH_DEFERRED); // explicit "never block boot" posture
|
|
16
74
|
let timer;
|
|
17
75
|
const budget = new Promise((res) => {
|
|
18
76
|
timer = setTimeout(() => res(BOOT_FETCH_DEFERRED), budgetMs);
|
|
@@ -20,6 +78,11 @@ export function raceBootFetch(fetch, budgetMs) {
|
|
|
20
78
|
});
|
|
21
79
|
return Promise.race([fetch.finally(() => clearTimeout(timer)), budget]);
|
|
22
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* RemoteConfigProvider — DELEGATES to the exported sema-registry HTTP functions. No HTTP is reimplemented;
|
|
83
|
+
* baseUrl/token/worker are bound once and passed through. The two delegate fns are injectable (defaulting
|
|
84
|
+
* to the real sema-registry exports) so a unit test can assert delegation without module-mocking.
|
|
85
|
+
*/
|
|
23
86
|
export class RemoteConfigProvider {
|
|
24
87
|
cc;
|
|
25
88
|
deps;
|
|
@@ -30,10 +93,16 @@ export class RemoteConfigProvider {
|
|
|
30
93
|
}
|
|
31
94
|
fetchEffective(etag) {
|
|
32
95
|
const fn = this.deps.fetchEffective ?? remoteFetchEffective;
|
|
96
|
+
// 5th arg = worker scope; transport (fetchImpl) stays sema-registry's default.
|
|
33
97
|
return fn(this.cc.baseUrl, this.cc.token, etag, undefined, this.cc.worker);
|
|
34
98
|
}
|
|
35
99
|
async fetchSkillContent(contentHash) {
|
|
36
100
|
const fn = this.deps.fetchSkillContent ?? remoteFetchSkillContent;
|
|
101
|
+
// Honor the ConfigProvider contract symmetrically with the local backend: an UNKNOWN hash → undefined
|
|
102
|
+
// (caller keeps its baseline), and ONLY a hard error (non-404 HTTP / hash mismatch) throws. The remote
|
|
103
|
+
// transport throws a ConfigCenterHttpError(status=404) for an unknown hash; we translate that single
|
|
104
|
+
// case to undefined and re-throw everything else, so both backends return the same thing for the same
|
|
105
|
+
// "unknown hash" input (substitutability — the whole point of this seam).
|
|
37
106
|
try {
|
|
38
107
|
return await fn(this.cc.baseUrl, this.cc.token, contentHash);
|
|
39
108
|
}
|
|
@@ -44,23 +113,48 @@ export class RemoteConfigProvider {
|
|
|
44
113
|
}
|
|
45
114
|
}
|
|
46
115
|
}
|
|
116
|
+
/**
|
|
117
|
+
* LocalConfigProvider — reads the SAME config contract from disk via `FileConfigStore`. `getEffective()`
|
|
118
|
+
* returns the registry `EffectiveConfig` (all domains, defaults filled); `getVersion()` returns a
|
|
119
|
+
* stable change-detector. We map that down to the service-local `EffectiveConfig` shape and surface the
|
|
120
|
+
* version as the etag (so the caller's "skip re-apply if etag unchanged" works locally too).
|
|
121
|
+
*/
|
|
47
122
|
export class LocalConfigProvider {
|
|
48
123
|
kind = "local";
|
|
49
124
|
store;
|
|
125
|
+
/** [875]b 可观测性:config_loaded 日志要能回答「到底读的哪个目录」——复验实录:只设 LOCAL_DATA_ROOT 时
|
|
126
|
+
* config.d 静默读不到且 0 模型无告警(CONFIG_LOCAL_DIR 才是本 lane 的选目录旋钮)。 */
|
|
50
127
|
root;
|
|
51
128
|
constructor(root, store) {
|
|
52
129
|
this.root = root;
|
|
53
130
|
this.store = store ?? new FileConfigStore(root);
|
|
54
131
|
}
|
|
55
132
|
async fetchEffective(etag) {
|
|
133
|
+
// SINGLE store read: derive BOTH the etag AND the mapped payload from ONE atomic raws snapshot. Reading
|
|
134
|
+
// getVersion() and getEffective() separately would pair an etag from snapshot A with a payload from
|
|
135
|
+
// snapshot B if config.d is rewritten between the two awaits — a consumer could then cache etag=A bound
|
|
136
|
+
// to payload-B and, once files settle back to A, skip re-applying the now-correct config (304-skip
|
|
137
|
+
// staleness). `eff.version` IS the authoritative version of THIS payload (file-store getEffective()
|
|
138
|
+
// invariant), so it is the only correct source for the etag. Cost: we compute `eff` even on an
|
|
139
|
+
// unchanged poll, but that preserves snapshot consistency — see finding #3.
|
|
140
|
+
// [898] tolerant read(0.10.12):catalog 域坏文件 ⇒ 该域 default+domainErrors 单列(不再连坐整包回落
|
|
141
|
+
// env);gate 域坏文件仍 throw(走 caller 的整包 catch)。坏文件文本 hash 参与 version(坏≠absent、
|
|
142
|
+
// 坏→修好均 bump),304-skip 纪律不漏拍——所以坏域场景下 etag 对比照旧安全。
|
|
56
143
|
const { effective: eff, domainErrors } = await this.store.getEffective({ tolerant: true });
|
|
57
144
|
const tag = String(eff.version);
|
|
58
145
|
if (etag !== undefined && etag === tag)
|
|
59
|
-
return null;
|
|
146
|
+
return null; // unchanged → mirror remote 304
|
|
147
|
+
// 提示词装配协议 §9.5-4 read-side cross-domain reference validation: dangling refs (a roster naming a
|
|
148
|
+
// model that isn't in the catalog, …) fold into domainErrors, so the caller's candidate gate rejects
|
|
149
|
+
// the tree whole on refresh (boot warns and proceeds — no LKG exists yet). Write-side zod is
|
|
150
|
+
// per-domain only and the center runs this check on its write path; the local lane never had it.
|
|
151
|
+
// The resolver gets THIS snapshot's domain values as `pending` (builder output is default-filled for
|
|
152
|
+
// every domain), so the check never re-reads config.d — the one-atomic-snapshot invariant above holds.
|
|
60
153
|
const refErrors = [];
|
|
61
154
|
const resolve = siblingResolver(this.store, eff);
|
|
62
155
|
for (const d of ["rosters", "workers", "models", "collab", "systems", "entitlement"]) {
|
|
63
156
|
const issues = await refIntegrityIssues(d, eff[d], resolve);
|
|
157
|
+
// path CLEAR (locates the entry) + message operand-fingerprinted (see redactConfigError).
|
|
64
158
|
if (issues.length > 0)
|
|
65
159
|
refErrors.push({ domain: d, error: issues.map((i) => `${i.path.join(".")}: ${redactConfigError(i.message)}`).join("; ") });
|
|
66
160
|
}
|
|
@@ -68,12 +162,24 @@ export class LocalConfigProvider {
|
|
|
68
162
|
return { effective: mapToServiceEffective(eff, eff.version), etag: tag, ...(errors.length > 0 ? { domainErrors: errors } : {}) };
|
|
69
163
|
}
|
|
70
164
|
async fetchSkillContent(contentHash) {
|
|
165
|
+
// The local store keeps skill BODIES inline (no manifest split), so this is a content-addressed lookup
|
|
166
|
+
// over the skills domain. Absent hash → undefined (mirrors a remote 404 → caller keeps the baseline).
|
|
71
167
|
const skills = await this.store.getDomain("skills");
|
|
72
168
|
if (!skills)
|
|
73
169
|
return undefined;
|
|
74
170
|
return findSkillContent(skills, contentHash);
|
|
75
171
|
}
|
|
76
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Map the registry `EffectiveConfig` (superset, all domains) → the service-local `EffectiveConfig`
|
|
175
|
+
* the consumers (`applyEffective`, `resolveMcpServers`, …) expect. The two are structurally compatible
|
|
176
|
+
* for every field the consumers read; this projection makes that explicit (and drops control-plane-only
|
|
177
|
+
* domains the service never consumes: rosters, systems, workers, hosts, integrations, access).
|
|
178
|
+
*
|
|
179
|
+
* Skills are mapped to the MANIFEST shape (name/description/scenarios/contentHash/enabled) — the same
|
|
180
|
+
* shape RemoteConfigProvider's `/effective` ships — so the lazy `fetchSkillContent`-by-hash path is
|
|
181
|
+
* identical in both modes. The local content hash is the `contentHash` the store already computed.
|
|
182
|
+
*/
|
|
77
183
|
export function mapToServiceEffective(eff, version) {
|
|
78
184
|
return {
|
|
79
185
|
version,
|
|
@@ -91,27 +197,52 @@ export function mapToServiceEffective(eff, version) {
|
|
|
91
197
|
vision: m.vision,
|
|
92
198
|
...(m.contextWindow !== undefined ? { contextWindow: m.contextWindow } : {}),
|
|
93
199
|
...(m.maxTokens !== undefined ? { maxTokens: m.maxTokens } : {}),
|
|
200
|
+
// codex F5 ([818]① 1M dual-window): an EXPLICIT `autoCompactTokens` must survive this CLOSED
|
|
201
|
+
// projection — the remote lane ships the roster JSON verbatim and toModel reads the field
|
|
202
|
+
// structurally, but the local lane funnels through this mapper, which silently ATE the explicit
|
|
203
|
+
// value (it then fell back to the contextWindow derivation). Structural read (registry-core's
|
|
204
|
+
// ModelEntry doesn't declare it — same passthrough posture as tierGroups below). NOTE (honest
|
|
205
|
+
// gap): registry-core's zod ModelEntry is "strip"-mode, so a value in a config.d/models.json read
|
|
206
|
+
// through FileConfigStore is ALSO dropped upstream of this mapper — that half needs a registry-core
|
|
207
|
+
// schema addition; this fix removes OUR projection's drop for any caller of this seam.
|
|
94
208
|
...(typeof m.autoCompactTokens === "number"
|
|
95
209
|
? { autoCompactTokens: m.autoCompactTokens }
|
|
96
210
|
: {}),
|
|
97
211
|
...(m.cost !== undefined ? { cost: m.cost } : {}),
|
|
98
212
|
...(m.extraBody !== undefined ? { extraBody: m.extraBody } : {}),
|
|
213
|
+
// registry-core 0.10.13 promptGuidance ([998]⑤c): the CLOSED projection must pass it through or
|
|
214
|
+
// the local lane silently drops the configured sentences (autoCompactTokens 同类病).
|
|
99
215
|
...(m.promptGuidance !== undefined ? { promptGuidance: m.promptGuidance } : {}),
|
|
100
216
|
enabled: m.enabled,
|
|
101
217
|
})),
|
|
102
218
|
roles: eff.models.roles ?? {},
|
|
219
|
+
// [874] registry-core 0.10.11:池结构级 `default?`(catalog name 目录键,与 roles.default 角色词两回事)。
|
|
220
|
+
// 本 mapper 是 CLOSED 投影——不直通则本地 lane 静默丢键(autoCompactTokens 同类病),applyEffective 的
|
|
221
|
+
// resolveDefaultModelName 第一优先级在本地 lane 永远点不亮。写面悬空 ref 由 registry-core superRefine
|
|
222
|
+
// fail-loud;存量/未经 schema 的路径仍由消费方 warn 降级(sema-registry.ts resolveDefaultModelName)。
|
|
103
223
|
...(eff.models.default !== undefined ? { default: eff.models.default } : {}),
|
|
104
224
|
...(eff.models.atModelAllowlist !== undefined ? { atModelAllowlist: eff.models.atModelAllowlist } : {}),
|
|
225
|
+
// registry-core 0.9.0 档位组: verbatim passthrough — applyEffective's resolveActiveTiers reads
|
|
226
|
+
// these structurally off eff.models (the remote lane ships them JSON-verbatim; the local lane must too).
|
|
105
227
|
...(eff.models.tierGroups !== undefined ? { tierGroups: eff.models.tierGroups } : {}),
|
|
106
228
|
...(eff.models.activeTierGroup !== undefined ? { activeTierGroup: eff.models.activeTierGroup } : {}),
|
|
107
229
|
},
|
|
230
|
+
// registry-core 0.7 DELETED the teams domain (BREAKING, no compat key) — the local lane ships an EMPTY
|
|
231
|
+
// teams face: applyEffective's teams branch no-ops and the team scenario falls back to the builtin
|
|
232
|
+
// TEAM_PERSONAS base (a permanent base, not a stopgap). Its successor is `collab` below.
|
|
108
233
|
teams: { teams: [] },
|
|
234
|
+
// collab domain: verbatim structural passthrough — FileConfigStore reads
|
|
235
|
+
// config.d/collab.json (PORTABLE_DOMAINS includes collab since 0.7) and applyEffective's
|
|
236
|
+
// projectCollabToTeams consumes the same shape on both lanes. Optional-chained against shape drift.
|
|
109
237
|
...(eff.collab?.templates?.length ? { collab: { templates: eff.collab.templates } } : {}),
|
|
110
238
|
skills: {
|
|
111
239
|
skills: (eff.skills.skills ?? []).map((s) => ({
|
|
112
240
|
name: s.name,
|
|
113
241
|
description: s.description,
|
|
114
242
|
scenarios: s.scenarios ?? [],
|
|
243
|
+
// The local store keeps the body inline; content-address it HERE so the manifest carries the same
|
|
244
|
+
// `sha256:<hex>` the remote /effective ships — and `fetchSkillContent` (findSkillContent) resolves
|
|
245
|
+
// the same hash back to the body. (skillContentHash is byte-identical to the center's hash.)
|
|
115
246
|
contentHash: skillContentHash(s.content),
|
|
116
247
|
enabled: s.enabled,
|
|
117
248
|
})),
|
|
@@ -123,6 +254,8 @@ export function mapToServiceEffective(eff, version) {
|
|
|
123
254
|
scenarios: s.scenarios ?? [],
|
|
124
255
|
enabled: s.enabled,
|
|
125
256
|
...(s.allowTools !== undefined ? { allowTools: s.allowTools } : {}),
|
|
257
|
+
// E23: carry the per-server inbound-elicitation opt-in (default OFF). Typed end-to-end since
|
|
258
|
+
// registry-core 0.1.34 added `McpServerSpec.elicitation?: boolean`.
|
|
126
259
|
...(s.elicitation !== undefined ? { elicitation: s.elicitation } : {}),
|
|
127
260
|
};
|
|
128
261
|
if (s.transport.kind === "stdio") {
|
|
@@ -147,13 +280,22 @@ export function mapToServiceEffective(eff, version) {
|
|
|
147
280
|
};
|
|
148
281
|
}),
|
|
149
282
|
},
|
|
283
|
+
// prompts 域投影(a 实现班车,[985]a §3/[1234]① 位):**catalog 轴打通 local lane**——catalog 是
|
|
284
|
+
// center 铸好的 immutable envelope(免 covering 解析,server 零解析义务红线 [1042]②b 不破),
|
|
285
|
+
// config.d/prompts.json 携带 `catalog` 即以 wire 双轴形(registry-core `EffectivePromptsWire`)下发,
|
|
286
|
+
// 与 remote lane 的 additive prompts key 同门(adoptCenterPrompts→validatePromptsDomain,core verify
|
|
287
|
+
// 全管线)。bindings(declaration 轴原料)仍不投影:covering 解析半场恒在 center,local lane 的
|
|
288
|
+
// declaration 轴维持不透传(那不是遗漏,是分工)。
|
|
150
289
|
...(eff.prompts?.catalog !== undefined
|
|
151
290
|
? { prompts: { schemaVersion: 1, catalog: eff.prompts.catalog } }
|
|
152
291
|
: {}),
|
|
153
292
|
scenarios: {
|
|
293
|
+
// ([1057] 注记保留:declaration 轴 remote lane only——covering 解析半场在 center(web),
|
|
294
|
+
// local FileConfigStore 只有 bindings 原文而 server 零解析义务([1042]②b 红线)。)
|
|
154
295
|
scenarios: (eff.scenarios.scenarios ?? []).map((sc) => ({
|
|
155
296
|
name: sc.name,
|
|
156
297
|
toolset: sc.toolset,
|
|
298
|
+
// ([1053] 0.10.15:ScenarioEntry.prompt 字段已删——scenario 级提示词走 center prompts binding)
|
|
157
299
|
enabled: sc.enabled,
|
|
158
300
|
})),
|
|
159
301
|
},
|
|
@@ -164,15 +306,36 @@ export function mapToServiceEffective(eff, version) {
|
|
|
164
306
|
...(eff.runtime.maxPrincipalCostUsd !== undefined ? { maxPrincipalCostUsd: eff.runtime.maxPrincipalCostUsd } : {}),
|
|
165
307
|
...(eff.runtime.costQuotaWindowSec !== undefined ? { costQuotaWindowSec: eff.runtime.costQuotaWindowSec } : {}),
|
|
166
308
|
},
|
|
309
|
+
// Governance trio (autonomy/commandPolicy/approvalRequire): moved OUT of runtime into the dedicated
|
|
310
|
+
// governance domain (registry-core 0.6, runtime double-write mirror removed in 0.7.1 — buildEffective
|
|
311
|
+
// still READ-lifts legacy raw runtime values into governance, so old on-disk config keeps working).
|
|
312
|
+
// Mapped to the service-local `governance` slot; applyEffective's gatesView consumes it with priority.
|
|
313
|
+
// The registry shapes are IDENTICAL to the service's Autonomy/CommandRule declarations (straight passthrough).
|
|
167
314
|
governance: {
|
|
168
315
|
...(eff.governance.autonomy !== undefined ? { autonomy: eff.governance.autonomy } : {}),
|
|
169
316
|
...(eff.governance.commandPolicy !== undefined ? { commandPolicy: eff.governance.commandPolicy } : {}),
|
|
170
317
|
...(eff.governance.approvalRequire !== undefined ? { approvalRequire: eff.governance.approvalRequire } : {}),
|
|
171
318
|
},
|
|
319
|
+
// NOTE: entitlement is NOT mapped — the ruling is that the local lane never carries it (by design;
|
|
320
|
+
// TOB governance concept) and the fleet scenario ruling rides center's caps view, not /effective.
|
|
172
321
|
};
|
|
173
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Pick the backend off a CLOSED `provider` enum (`local` | `remote` | undefined): LOCAL when
|
|
325
|
+
* `CONFIG_PROVIDER=local`, OR when no sema-registry URL is configured (a lone box with config.d/ on disk
|
|
326
|
+
* and no control plane). REMOTE otherwise (a configured center URL, the default fleet posture). A
|
|
327
|
+
* `CONFIG_PROVIDER=remote` with no URL is a misconfiguration — we fall through to local rather than
|
|
328
|
+
* constructing a remote provider with no endpoint (the caller would have skipped the remote pull entirely
|
|
329
|
+
* under the old code path; local-with-empty-config.d degrades to env the same way). An UNRECOGNIZED value
|
|
330
|
+
* (typo / wrong case) is NOT treated as remote: it defaults to local (non-network) with a warn, so a
|
|
331
|
+
* fat-fingered knob can never silently source config from an unintended/stale network endpoint.
|
|
332
|
+
*/
|
|
174
333
|
export function createConfigProvider(input) {
|
|
175
334
|
const p = input.provider;
|
|
335
|
+
// Closed enum: only `local` | `remote` | undefined are valid. An unrecognized/typo'd value (`Local`,
|
|
336
|
+
// `LOCAL`, ` local`, garbage) must NOT silently fall through to the network source — pick the non-network
|
|
337
|
+
// safe default (local) and warn, so a misconfigured knob never sources config (incl. env-NAME refs that
|
|
338
|
+
// gate secret wiring) from a possibly-stale remote URL the operator didn't intend. See finding #4.
|
|
176
339
|
if (p !== undefined && p !== "local" && p !== "remote") {
|
|
177
340
|
logger.warn("config_provider_unrecognized", {
|
|
178
341
|
provider: p,
|