@sema-agent/server 7.131.0 → 7.133.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/MIGRATION.md +575 -0
- package/README.md +12 -9
- package/README.zh-CN.md +9 -6
- package/USAGE.md +326 -98
- package/deploy/sema-up/README.md +19 -1
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
- package/deploy/sema-up/chart/templates/server.yaml +5 -2
- package/deploy/sema-up/stack/compose.yaml +3 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
- package/dist/adoption/plan.d.ts +3 -2
- package/dist/adoption/plan.js +7 -5
- package/dist/adoption/runner.js +3 -10
- package/dist/adoption/sql.d.ts +3 -2
- package/dist/adoption/sql.js +3 -5
- package/dist/adoption/wire.d.ts +4 -1
- package/dist/adoption/wire.js +1 -0
- package/dist/approval-ask-audit-store.d.ts +31 -13
- package/dist/approval-ask-audit-store.js +272 -74
- package/dist/approval-ask-machine.d.ts +15 -0
- package/dist/approval-ask-machine.js +6 -0
- package/dist/approval-ask-retention.d.ts +136 -0
- package/dist/approval-ask-retention.js +102 -0
- package/dist/approval-card.d.ts +82 -20
- package/dist/approval-card.js +46 -16
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval.d.ts +9 -0
- package/dist/approval.js +24 -3
- package/dist/audit.d.ts +33 -19
- package/dist/audit.js +12 -16
- package/dist/auth-bridge.d.ts +4 -0
- package/dist/auth-bridge.js +10 -11
- package/dist/bake-runner/main.js +3 -2
- package/dist/boot/deferred-sandbox-path-env.js +1 -1
- package/dist/boot/deployment-mods.d.ts +31 -0
- package/dist/boot/deployment-mods.js +26 -0
- package/dist/boot/execution-env.d.ts +1 -1
- package/dist/boot/execution-env.js +27 -12
- package/dist/boot/execution-lane.js +11 -0
- package/dist/boot/leader.js +2 -0
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-boundary.js +2 -2
- package/dist/boot/memory-consolidation.d.ts +5 -4
- package/dist/boot/memory-consolidation.js +7 -6
- package/dist/boot/org-delivery.d.ts +28 -0
- package/dist/boot/org-delivery.js +20 -0
- package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
- package/dist/boot/read-deny-anchor-audit.js +36 -0
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +21 -1
- package/dist/boot/resolve-spec.d.ts +4 -5
- package/dist/boot/resolve-spec.js +74 -123
- package/dist/boot/runner-deps.d.ts +19 -8
- package/dist/boot/runner-deps.js +15 -2
- package/dist/boot/session-faces.d.ts +2 -7
- package/dist/boot/session-faces.js +4 -2
- package/dist/boot/stage-02-web-admin-pull.js +4 -1
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -4
- package/dist/boot/stage-05-execution-env.js +7 -10
- package/dist/boot/stage-06-runners.d.ts +4 -2
- package/dist/boot/stage-06-runners.js +11 -7
- package/dist/boot/stage-07-capability-layer.d.ts +4 -2
- package/dist/boot/stage-07-capability-layer.js +27 -6
- package/dist/boot/stage-08-reapers.d.ts +4 -2
- package/dist/boot/stage-08-reapers.js +2 -2
- package/dist/boot/stage-09-leader.d.ts +6 -9
- package/dist/boot/stage-10-http-server.d.ts +6 -9
- package/dist/boot/stage-10-http-server.js +7 -9
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/stores.js +7 -8
- package/dist/boot/web-admin.d.ts +4 -3
- package/dist/boot/web-admin.js +186 -98
- package/dist/boot/workflow-orchestration.d.ts +2 -0
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/brain.js +25 -25
- package/dist/breaker-key.d.ts +6 -0
- package/dist/breaker-key.js +29 -0
- package/dist/budget.js +5 -4
- package/dist/caller-text-echo.d.ts +23 -0
- package/dist/caller-text-echo.js +21 -0
- package/dist/capabilities/brand-identity.d.ts +26 -0
- package/dist/capabilities/brand-identity.js +27 -0
- package/dist/capabilities/center-plugins.d.ts +7 -0
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +32 -59
- package/dist/capabilities/center-prompts.js +18 -32
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/engine-capabilities.js +2 -1
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +30 -6
- package/dist/capabilities/hands-lane.js +11 -1
- package/dist/capabilities/mcp-probe.d.ts +48 -3
- package/dist/capabilities/mcp-probe.js +47 -135
- package/dist/capabilities/scenarios.d.ts +95 -45
- package/dist/capabilities/scenarios.js +53 -38
- package/dist/capabilities/skills.d.ts +19 -4
- package/dist/capabilities/skills.js +30 -10
- package/dist/capability-facts.d.ts +34 -4
- package/dist/capability-facts.js +28 -2
- package/dist/center-config-tier.d.ts +69 -0
- package/dist/center-config-tier.js +42 -0
- package/dist/checkpoint-identity.d.ts +16 -0
- package/dist/checkpoint-identity.js +19 -0
- package/dist/config-catalog.d.ts +17 -10
- package/dist/config-catalog.js +47 -32
- package/dist/config-d-migration.d.ts +3 -1
- package/dist/config-d-migration.js +2 -2
- package/dist/config-dir-trust.d.ts +114 -0
- package/dist/config-dir-trust.js +388 -0
- package/dist/config-invariants.d.ts +18 -5
- package/dist/config-invariants.js +35 -3
- package/dist/config-lkg.d.ts +9 -9
- package/dist/config-lkg.js +20 -4
- package/dist/config-provider.d.ts +9 -2
- package/dist/config-provider.js +18 -6
- package/dist/config-types.d.ts +75 -20
- package/dist/config-types.js +8 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +137 -62
- package/dist/delegated-session-owner.d.ts +185 -0
- package/dist/delegated-session-owner.js +119 -0
- package/dist/device-protocol.d.ts +5 -3
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.js +21 -2
- package/dist/device-ws-protocol.d.ts +70 -6
- package/dist/device-ws-protocol.js +50 -22
- package/dist/elicitation.js +3 -2
- package/dist/entry-problems.d.ts +34 -0
- package/dist/entry-problems.js +14 -0
- package/dist/env-name-allowlist-knobs.d.ts +12 -2
- package/dist/env-name-allowlist-knobs.js +5 -4
- package/dist/exec-bounds.d.ts +15 -3
- package/dist/exec-bounds.js +4 -0
- package/dist/execution-lane-caps.d.ts +56 -10
- package/dist/execution-lane-caps.js +50 -0
- package/dist/field-conflict.d.ts +43 -0
- package/dist/field-conflict.js +20 -0
- package/dist/fleet/fleet-bus.d.ts +80 -6
- package/dist/fleet/fleet-bus.js +41 -9
- package/dist/hooks/classic-stations.d.ts +91 -0
- package/dist/hooks/classic-stations.js +27 -0
- package/dist/hooks/command-spawn.d.ts +57 -0
- package/dist/hooks/command-spawn.js +139 -0
- package/dist/hooks/hook-llm.d.ts +8 -5
- package/dist/hooks/hook-llm.js +79 -36
- package/dist/hooks/hook-runner.d.ts +349 -95
- package/dist/hooks/hook-runner.js +855 -568
- package/dist/hooks/hook-source.d.ts +44 -0
- package/dist/hooks/hook-source.js +40 -0
- package/dist/http/active-run-conflict.d.ts +5 -13
- package/dist/http/active-run-conflict.js +17 -27
- package/dist/http/admission.d.ts +8 -2
- package/dist/http/admission.js +188 -101
- package/dist/http/approval-sweeps.js +99 -21
- package/dist/http/caller-trust.d.ts +77 -0
- package/dist/http/caller-trust.js +143 -0
- package/dist/http/checkpoint-ctx.d.ts +41 -24
- package/dist/http/checkpoint-ctx.js +23 -16
- package/dist/http/claimed-run.d.ts +14 -0
- package/dist/http/claimed-run.js +15 -0
- package/dist/http/device-placement.d.ts +2 -4
- package/dist/http/device-placement.js +7 -11
- package/dist/http/dispatch.d.ts +0 -4
- package/dist/http/dispatch.js +15 -13
- package/dist/http/durable-run-leg.d.ts +6 -33
- package/dist/http/durable-run-leg.js +36 -10
- package/dist/http/health-self-report.d.ts +7 -5
- package/dist/http/health-self-report.js +4 -18
- package/dist/http/owner-access.d.ts +56 -0
- package/dist/http/owner-access.js +42 -0
- package/dist/http/principal-gate.d.ts +70 -28
- package/dist/http/principal-gate.js +61 -15
- package/dist/http/readiness.d.ts +11 -5
- package/dist/http/readiness.js +10 -3
- package/dist/http/refusal-body.d.ts +21 -0
- package/dist/http/refusal-body.js +4 -0
- package/dist/http/request-guards.d.ts +43 -23
- package/dist/http/request-guards.js +53 -17
- package/dist/http/resume-ctx-read.d.ts +2 -5
- package/dist/http/resume-ctx-read.js +7 -4
- package/dist/http/resume-legs.d.ts +28 -4
- package/dist/http/resume-legs.js +169 -91
- package/dist/http/retired-service-deps.d.ts +43 -0
- package/dist/http/retired-service-deps.js +18 -0
- package/dist/http/route-ctx.d.ts +44 -28
- package/dist/http/route-ctx.js +4 -0
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.js +3 -4
- package/dist/http/routes/admin-config-refresh.js +1 -1
- package/dist/http/routes/admin-drain.js +1 -1
- package/dist/http/routes/admin-memory-optout.js +5 -1
- package/dist/http/routes/adoption.js +2 -9
- package/dist/http/routes/approvals-assistant.js +49 -48
- package/dist/http/routes/background.js +3 -2
- package/dist/http/routes/capabilities.js +21 -5
- package/dist/http/routes/config-catalog.d.ts +3 -3
- package/dist/http/routes/config-catalog.js +1 -1
- package/dist/http/routes/devices.js +3 -17
- package/dist/http/routes/diagnostics.js +6 -2
- package/dist/http/routes/images.js +6 -7
- package/dist/http/routes/leader.js +1 -8
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +3 -2
- package/dist/http/routes/memory-bundle.js +1 -1
- package/dist/http/routes/memory-compliance.js +1 -1
- package/dist/http/routes/memory-consolidation.js +1 -1
- package/dist/http/routes/memory-origin.js +1 -1
- package/dist/http/routes/memory-policy.d.ts +1 -1
- package/dist/http/routes/memory-policy.js +3 -2
- package/dist/http/routes/notify-wake.js +8 -21
- package/dist/http/routes/observability.js +2 -2
- package/dist/http/routes/principal-inbox.d.ts +39 -0
- package/dist/http/routes/principal-inbox.js +76 -0
- package/dist/http/routes/retention-ops.js +2 -9
- package/dist/http/routes/rules.js +5 -18
- package/dist/http/routes/runs.d.ts +5 -0
- package/dist/http/routes/runs.js +34 -107
- package/dist/http/routes/session-sync.js +15 -26
- package/dist/http/routes/sessions.js +30 -40
- package/dist/http/routes/shared-memory.js +2 -13
- package/dist/http/routes/side-query.js +8 -7
- package/dist/http/routes/tasks.js +67 -21
- package/dist/http/routes/workflows.d.ts +351 -0
- package/dist/http/routes/workflows.js +153 -119
- package/dist/http/send.d.ts +33 -10
- package/dist/http/send.js +21 -4
- package/dist/http/server.d.ts +27 -18
- package/dist/http/server.js +34 -6
- package/dist/http/stored-body-replay.js +17 -4
- package/dist/http/submit-ctx.d.ts +25 -0
- package/dist/http/submit-ctx.js +40 -0
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +5 -4
- package/dist/http/wire-types.d.ts +11 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -2
- package/dist/lane-home-probe.d.ts +112 -0
- package/dist/lane-home-probe.js +101 -0
- package/dist/leader/endpoint.d.ts +4 -1
- package/dist/leader/endpoint.js +11 -10
- package/dist/limit-refusal.d.ts +59 -0
- package/dist/limit-refusal.js +15 -0
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +32 -19
- package/dist/mcp-assertion-header.js +10 -9
- package/dist/mcp-tool-faces.d.ts +5 -0
- package/dist/mcp-tool-faces.js +6 -4
- package/dist/memory-project-layer.d.ts +37 -0
- package/dist/memory-project-layer.js +46 -0
- package/dist/memory-scope.d.ts +24 -17
- package/dist/memory-scope.js +24 -8
- package/dist/memory-sync-client.d.ts +27 -13
- package/dist/memory-sync-client.js +107 -18
- package/dist/model-entry-refusal.d.ts +9 -1
- package/dist/model-entry-refusal.js +6 -1
- package/dist/model-plane-face.d.ts +51 -0
- package/dist/model-plane-face.js +24 -0
- package/dist/model-provider.d.ts +44 -12
- package/dist/model-provider.js +21 -2
- package/dist/model-route-endpoint.d.ts +9 -12
- package/dist/model-route-endpoint.js +8 -11
- package/dist/model-route-env.d.ts +22 -0
- package/dist/model-route-env.js +2 -0
- package/dist/model-route-gap.d.ts +60 -30
- package/dist/model-route-gap.js +21 -15
- package/dist/observability/corrupt-read-seat.d.ts +7 -0
- package/dist/observability/corrupt-read-seat.js +9 -0
- package/dist/observability/cost-taxonomy.d.ts +7 -7
- package/dist/observability/err-text.d.ts +6 -0
- package/dist/observability/err-text.js +18 -4
- package/dist/observability/fail-open.d.ts +76 -14
- package/dist/observability/fail-open.js +76 -14
- package/dist/observability/metrics.js +4 -1
- package/dist/observability/prompt-manifest.d.ts +33 -82
- package/dist/observability/prompt-manifest.js +122 -17
- package/dist/observability/run-terminal.js +14 -6
- package/dist/observability/secret-env-scrub.d.ts +13 -1
- package/dist/observability/secret-env-scrub.js +13 -1
- package/dist/observability/tool-trace.d.ts +16 -21
- package/dist/observability/tool-trace.js +58 -49
- package/dist/operator-ask.d.ts +10 -0
- package/dist/operator-ask.js +3 -0
- package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
- package/dist/orchestration/workflow-agent-session-index.js +9 -13
- package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
- package/dist/orchestration/workflow-completion-inbox.js +13 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
- package/dist/orchestration/workflow-notify-journal.js +27 -34
- package/dist/orchestration/workflow-park-decision.d.ts +89 -0
- package/dist/orchestration/workflow-park-decision.js +118 -0
- package/dist/org-delivery-gate.d.ts +81 -0
- package/dist/org-delivery-gate.js +59 -0
- package/dist/panel-tool-names.d.ts +23 -0
- package/dist/panel-tool-names.js +8 -0
- package/dist/parked-decide.d.ts +39 -6
- package/dist/parked-decide.js +98 -51
- package/dist/parked-revive-surface.d.ts +9 -2
- package/dist/parked-revive-surface.js +11 -8
- package/dist/per-task-image.d.ts +7 -1
- package/dist/per-task-image.js +3 -3
- package/dist/permission-rule-list.d.ts +1 -1
- package/dist/permission-rule-list.js +2 -2
- package/dist/plain-string-record.d.ts +25 -0
- package/dist/plain-string-record.js +32 -0
- package/dist/plugins/approval-ask-store-file.d.ts +16 -1
- package/dist/plugins/approval-ask-store-file.js +21 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
- package/dist/plugins/approval-ask-store-memory.js +34 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
- package/dist/plugins/approval-ask-store-sql.js +37 -1
- package/dist/plugins/blob-backend.d.ts +83 -15
- package/dist/plugins/blob-backend.js +68 -15
- package/dist/plugins/breaker-state-sql.d.ts +2 -2
- package/dist/plugins/breaker-state-sql.js +4 -4
- package/dist/plugins/caching-session-store.d.ts +3 -0
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +28 -4
- package/dist/plugins/checkpoint-store-sql.js +59 -28
- package/dist/plugins/file-history-store-sql.d.ts +5 -2
- package/dist/plugins/file-history-store-sql.js +3 -1
- package/dist/plugins/file-run-store.d.ts +5 -13
- package/dist/plugins/file-run-store.js +9 -0
- package/dist/plugins/fork-routing-session-store.d.ts +9 -1
- package/dist/plugins/fork-routing-session-store.js +12 -1
- package/dist/plugins/host-platform.d.ts +2 -0
- package/dist/plugins/host-platform.js +2 -1
- package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
- package/dist/plugins/k8s-bg-scripts.js +22 -0
- package/dist/plugins/local-checkpoint-store.d.ts +2 -0
- package/dist/plugins/local-checkpoint-store.js +11 -3
- package/dist/plugins/local-session-store.d.ts +1 -1
- package/dist/plugins/local-session-store.js +1 -1
- package/dist/plugins/local-session-window.d.ts +39 -0
- package/dist/plugins/local-session-window.js +54 -0
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
- package/dist/plugins/mailbox-store-sql.d.ts +30 -48
- package/dist/plugins/mailbox-store-sql.js +77 -52
- package/dist/plugins/memory-embedder-fingerprint.js +2 -1
- package/dist/plugins/memory-run-store.d.ts +5 -13
- package/dist/plugins/memory-run-store.js +8 -0
- package/dist/plugins/one-time-migrations.d.ts +245 -93
- package/dist/plugins/one-time-migrations.js +668 -207
- package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
- package/dist/plugins/org-delivery-quota-store.js +228 -0
- package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
- package/dist/plugins/permission-rule-store-sql.js +4 -18
- package/dist/plugins/pg-pool.js +39 -7
- package/dist/plugins/pg-session-storage.d.ts +20 -8
- package/dist/plugins/pg-session-storage.js +34 -21
- package/dist/plugins/remote-env-adb.d.ts +12 -12
- package/dist/plugins/remote-env-adb.js +21 -6
- package/dist/plugins/remote-env-device.js +3 -0
- package/dist/plugins/remote-env-e2b.d.ts +1 -1
- package/dist/plugins/remote-env-e2b.js +21 -9
- package/dist/plugins/remote-env-host.d.ts +9 -9
- package/dist/plugins/remote-env-host.js +10 -32
- package/dist/plugins/remote-env-k8s.d.ts +103 -38
- package/dist/plugins/remote-env-k8s.js +288 -95
- package/dist/plugins/remote-env-local-docker.d.ts +27 -13
- package/dist/plugins/remote-env-local-docker.js +82 -11
- package/dist/plugins/remote-env-ssh.d.ts +21 -12
- package/dist/plugins/remote-env-ssh.js +117 -5
- package/dist/plugins/remote-shell.d.ts +0 -1
- package/dist/plugins/remote-shell.js +1 -2
- package/dist/plugins/retention-store-sql.js +6 -2
- package/dist/plugins/run-store-sql.d.ts +16 -14
- package/dist/plugins/run-store-sql.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +54 -0
- package/dist/plugins/schema-consistency.js +52 -0
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-user-file.js +2 -2
- package/dist/plugins/session-epoch-anchor.d.ts +39 -0
- package/dist/plugins/session-epoch-anchor.js +22 -0
- package/dist/plugins/session-store.d.ts +18 -8
- package/dist/plugins/session-store.js +15 -4
- package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
- package/dist/plugins/shared-memory-store-sql.js +5 -16
- package/dist/plugins/sql-driver.d.ts +205 -1
- package/dist/plugins/sql-driver.js +325 -13
- package/dist/plugins/sql-errors.d.ts +64 -0
- package/dist/plugins/sql-errors.js +57 -0
- package/dist/plugins/store-backend.d.ts +36 -1
- package/dist/plugins/store-backend.js +42 -15
- package/dist/plugins/store-contracts.d.ts +42 -0
- package/dist/plugins/store-contracts.js +1 -0
- package/dist/plugins/tidb-pool.d.ts +6 -1
- package/dist/plugins/tidb-pool.js +44 -10
- package/dist/plugins/tidb-session-storage.d.ts +8 -11
- package/dist/plugins/tidb-session-storage.js +6 -16
- package/dist/plugins/tidb-session-store.d.ts +24 -4
- package/dist/plugins/tidb-session-store.js +29 -5
- package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
- package/dist/plugins/workflow-journal-store-sql.js +19 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
- package/dist/plugins/workflow-run-store-sql.js +50 -9
- package/dist/posture-source.d.ts +18 -10
- package/dist/posture-source.js +4 -1
- package/dist/project-identity.d.ts +45 -6
- package/dist/project-identity.js +162 -8
- package/dist/project-layer-key.d.ts +28 -0
- package/dist/project-layer-key.js +29 -0
- package/dist/prompts-domain-validate.d.ts +17 -61
- package/dist/prompts-domain-validate.js +9 -119
- package/dist/question.js +3 -2
- package/dist/read-deny-entry.d.ts +25 -0
- package/dist/read-deny-entry.js +12 -0
- package/dist/read-face-posture.d.ts +37 -11
- package/dist/read-face-posture.js +32 -3
- package/dist/request-key-closure.d.ts +9 -2
- package/dist/request-key-closure.js +11 -5
- package/dist/request-value-closure.d.ts +5 -0
- package/dist/request-value-closure.js +11 -3
- package/dist/rule-entry-list.d.ts +38 -11
- package/dist/rule-entry-list.js +106 -30
- package/dist/rules-consent.js +3 -4
- package/dist/run-acceptance.d.ts +19 -3
- package/dist/run-acceptance.js +13 -1
- package/dist/run-local.js +54 -24
- package/dist/runs.d.ts +15 -8
- package/dist/runs.js +35 -1
- package/dist/runtime-caps-resolver.d.ts +16 -6
- package/dist/runtime-caps-resolver.js +18 -5
- package/dist/sandbox-pkg-source.d.ts +19 -1
- package/dist/sandbox-pkg-source.js +29 -7
- package/dist/security.d.ts +87 -9
- package/dist/security.js +52 -9
- package/dist/server-secret-env.d.ts +44 -18
- package/dist/server-secret-env.js +49 -8
- package/dist/session-error-wire.d.ts +19 -2
- package/dist/session-error-wire.js +5 -1
- package/dist/session-incarnation.d.ts +15 -5
- package/dist/session-incarnation.js +16 -9
- package/dist/session-titled-frame.d.ts +33 -0
- package/dist/session-titled-frame.js +4 -0
- package/dist/session-titler.d.ts +9 -1
- package/dist/session-titler.js +27 -6
- package/dist/spec-fields.d.ts +28 -16
- package/dist/spec-fields.js +66 -54
- package/dist/sql-engine-posture.d.ts +31 -4
- package/dist/sql-engine-posture.js +36 -1
- package/dist/stored-request-tool-axes-m19.d.ts +19 -4
- package/dist/stored-request-tool-axes-m19.js +30 -2
- package/dist/task-a2a.d.ts +9 -1
- package/dist/task-a2a.js +73 -47
- package/dist/task-cwd.d.ts +1 -1
- package/dist/task-mcp.d.ts +46 -58
- package/dist/task-mcp.js +82 -107
- package/dist/task-settings.d.ts +95 -108
- package/dist/task-settings.js +77 -98
- package/dist/text-bidi.d.ts +1 -48
- package/dist/text-bidi.js +3 -5
- package/dist/tighten-only-seats.d.ts +150 -0
- package/dist/tighten-only-seats.js +196 -0
- package/dist/tool-approval.d.ts +304 -88
- package/dist/tool-approval.js +623 -239
- package/dist/trace/core-keyset-guard.d.ts +122 -20
- package/dist/trace/engine-notice-wire.d.ts +11 -3
- package/dist/trace/engine-notice-wire.js +8 -1
- package/dist/trace/exit-seat.d.ts +28 -0
- package/dist/trace/exit-seat.js +76 -0
- package/dist/trace/ledger-events.d.ts +6 -3
- package/dist/trace/ledger-sink.js +4 -1
- package/dist/trace/model-segment.js +1 -1
- package/dist/trace/project.d.ts +98 -17
- package/dist/trace/project.js +98 -50
- package/dist/trace/projection-table.d.ts +100 -0
- package/dist/trace/projection-table.js +130 -0
- package/dist/trace/redact.d.ts +54 -0
- package/dist/trace/redact.js +778 -152
- package/dist/trace/self-minted-wire.d.ts +345 -1
- package/dist/trace/self-minted-wire.js +117 -1
- package/dist/trace/wire-projection-faces.d.ts +377 -3
- package/dist/trace/wire-projection-faces.js +164 -1
- package/dist/url-refusal.js +2 -0
- package/dist/web-admin-client/apply-effective.d.ts +12 -0
- package/dist/web-admin-client/apply-effective.js +56 -5
- package/dist/web-admin-client/candidate-gate.d.ts +6 -6
- package/dist/web-admin-client/candidate-gate.js +3 -3
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/http-client.js +0 -6
- package/dist/web-admin-client/read-face.js +5 -9
- package/dist/web-admin-client/read-warnings.d.ts +13 -0
- package/dist/web-admin-client/read-warnings.js +10 -0
- package/dist/web-admin-client/skills-mcp.d.ts +3 -0
- package/dist/web-admin-client/skills-mcp.js +11 -9
- package/dist/web-admin-client/types.d.ts +2 -3
- package/dist/workspace-cache.d.ts +35 -0
- package/dist/workspace-cache.js +36 -0
- package/dist/workspace-space.d.ts +3 -2
- package/dist/workspace-space.js +2 -0
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +65 -10
- package/package.json +8 -4
- package/scripts/drain-check-local.mjs +34 -1
- package/scripts/drain-check.mysql.sql +30 -2
- package/scripts/drain-check.pg.sql +29 -2
- package/dist/capabilities/memory-notice.d.ts +0 -138
- package/dist/capabilities/memory-notice.js +0 -64
- package/dist/capabilities/prompt.d.ts +0 -17
- package/dist/capabilities/prompt.js +0 -6
- package/dist/mcp-content-origin.d.ts +0 -34
- package/dist/mcp-content-origin.js +0 -10
- package/dist/tool-axis-words.d.ts +0 -27
- package/dist/tool-axis-words.js +0 -9
- package/dist/wire-name-bound.d.ts +0 -14
- package/dist/wire-name-bound.js +0 -13
|
@@ -34,19 +34,28 @@ export function halfOpenDirectDoorRefusal(v) {
|
|
|
34
34
|
if (!v.principalJwtAud)
|
|
35
35
|
missing.push("PRINCIPAL_JWT_AUD");
|
|
36
36
|
if (v.operatorPrincipals.length === 0)
|
|
37
|
-
missing.push("OPERATOR_PRINCIPALS (
|
|
37
|
+
missing.push("OPERATOR_PRINCIPALS (an empty list means no operator, and the direct door's operator faces need named operators)");
|
|
38
38
|
if (!v.requirePrincipal)
|
|
39
39
|
missing.push("REQUIRE_PRINCIPAL=true (a direct door is multi-tenant; without it an absent principal is anonymous and the self-asserted header governs owner/quota checks)");
|
|
40
40
|
return missing.length > 0 ? `DIRECT_APPROVAL_DOOR=true but D-G anchors are missing: ${missing.join(", ")} — refusing to start a half-open direct door (design/80 D-G boot invariant)` : undefined;
|
|
41
41
|
}
|
|
42
42
|
export function operatorPrincipalsRequiredRefusal(v) {
|
|
43
43
|
return v.durableApproval === true && v.requirePrincipal && v.operatorPrincipals.length === 0
|
|
44
|
-
? "DURABLE_APPROVAL=true + REQUIRE_PRINCIPAL=true but OPERATOR_PRINCIPALS is empty —
|
|
44
|
+
? "DURABLE_APPROVAL=true + REQUIRE_PRINCIPAL=true but OPERATOR_PRINCIPALS is empty — an empty operator list means no operator, so nobody could operate this multi-tenant worker's approval queue (list any owner's pending via GET /v1/approvals & siblings, decide any approval). Set OPERATOR_PRINCIPALS, or unset REQUIRE_PRINCIPAL if this is a single-tenant deployment (#157-① boot invariant)"
|
|
45
45
|
: undefined;
|
|
46
46
|
}
|
|
47
|
+
export function operatorSingleUserRefusal(v) {
|
|
48
|
+
if (v.operatorSingleUser !== true)
|
|
49
|
+
return undefined;
|
|
50
|
+
if (v.requirePrincipal)
|
|
51
|
+
return "OPERATOR_SINGLE_USER=true but REQUIRE_PRINCIPAL=true — the declaration makes every caller an operator, which only fits a single-user deployment; a multi-tenant worker names its operators in OPERATOR_PRINCIPALS. Unset OPERATOR_SINGLE_USER, or unset REQUIRE_PRINCIPAL if this is a single-user deployment";
|
|
52
|
+
if (v.operatorPrincipals.length > 0)
|
|
53
|
+
return "OPERATOR_SINGLE_USER=true but OPERATOR_PRINCIPALS is also set — the two answer the same question (who is an operator) in two ways. Keep one: OPERATOR_SINGLE_USER=true (every caller of this single-user deployment) or OPERATOR_PRINCIPALS (only the named principals)";
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
47
56
|
export function bakeOperatorPrincipalsRefusal(v) {
|
|
48
57
|
return v.imageBakes.enabled && v.operatorPrincipals.length === 0
|
|
49
|
-
? "IMAGE_BAKES_ENABLED=true but OPERATOR_PRINCIPALS is empty — the bake door runs build.sh on the privileged build host
|
|
58
|
+
? "IMAGE_BAKES_ENABLED=true but OPERATOR_PRINCIPALS is empty — the bake door runs build.sh on the privileged build host and needs named operators: with an empty list nobody can use it, and the single-user operator declaration would open it to every caller (world-writable RCE). Set OPERATOR_PRINCIPALS or disable bakes (IMAGE-API-DESIGN.md §P2.4a boot invariant)"
|
|
50
59
|
: undefined;
|
|
51
60
|
}
|
|
52
61
|
export function bakeRunnerCredentialRefusal(v) {
|
|
@@ -64,6 +73,15 @@ export function leaderDurableStoreRefusal(v) {
|
|
|
64
73
|
"(#193 车4 件2 / staleness ledger P1-9+P1-10 boot invariant)"
|
|
65
74
|
: undefined;
|
|
66
75
|
}
|
|
76
|
+
export function workflowParkDecisionDomainRefusal(v) {
|
|
77
|
+
const sqlStore = (v.dbBackend === "mysql" && v.tidb !== undefined) || (v.dbBackend === "pg" && v.pg !== undefined);
|
|
78
|
+
return sqlStore && v.selfOrchestrationEnabled && v.workflowRunStoreBackend !== "auto"
|
|
79
|
+
? `DB_BACKEND=${v.dbBackend} with self-orchestration on and WORKFLOW_RUN_STORE=${v.workflowRunStoreBackend} is refused before any schema migration runs (the database was not touched) ` +
|
|
80
|
+
"[workflow-park-decision-domain]: a workflow approval decision is written in the same atomic step that checks the delivering run still holds the host session, so on a SQL backend it lives in the database " +
|
|
81
|
+
"with the session claims and is reaped with the workflow records — which this setting keeps off the database. " +
|
|
82
|
+
"Leave WORKFLOW_RUN_STORE=auto (unset it: the workflow records go to the same database), or turn self-orchestration off (SELF_ORCHESTRATION_ENABLED=false)"
|
|
83
|
+
: undefined;
|
|
84
|
+
}
|
|
67
85
|
export function centerIdentityRefusal(v) {
|
|
68
86
|
const webBaseUrl = v.webAdmin?.webBaseUrl;
|
|
69
87
|
if (webBaseUrl === undefined)
|
|
@@ -125,6 +143,13 @@ export const CONFIG_CROSS_INVARIANTS = [
|
|
|
125
143
|
bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:operator-principals-required" },
|
|
126
144
|
check: ({ next }) => operatorPrincipalsRequiredRefusal(next),
|
|
127
145
|
},
|
|
146
|
+
{
|
|
147
|
+
id: "operator-single-user",
|
|
148
|
+
keys: ["operatorSingleUser", "requirePrincipal", "operatorPrincipals"],
|
|
149
|
+
restartReason: "operator-principals",
|
|
150
|
+
bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:operator-single-user" },
|
|
151
|
+
check: ({ next }) => operatorSingleUserRefusal(next),
|
|
152
|
+
},
|
|
128
153
|
{
|
|
129
154
|
id: "bake-operator-principals",
|
|
130
155
|
keys: ["imageBakes", "operatorPrincipals"],
|
|
@@ -183,6 +208,13 @@ export const CONFIG_CROSS_INVARIANTS = [
|
|
|
183
208
|
bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:leader-durable-store" },
|
|
184
209
|
check: ({ next }) => leaderDurableStoreRefusal(next),
|
|
185
210
|
},
|
|
211
|
+
{
|
|
212
|
+
id: "workflow-park-decision-domain",
|
|
213
|
+
keys: ["selfOrchestrationEnabled", "workflowRunStoreBackend", "dbBackend", "tidb", "pg"],
|
|
214
|
+
restartReason: "workflow-orchestration",
|
|
215
|
+
bootAnchor: { file: "src/config.ts", marker: "CROSS-INVARIANT:workflow-park-decision-domain" },
|
|
216
|
+
check: ({ next }) => workflowParkDecisionDomainRefusal(next),
|
|
217
|
+
},
|
|
186
218
|
{
|
|
187
219
|
id: "device-durable-store",
|
|
188
220
|
keys: ["remoteExec", "dbBackend", "tidb", "pg"],
|
package/dist/config-lkg.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type MigrationReceipt } from "@sema-agent/settings-schema/one-time-migrations";
|
|
2
|
-
import type {
|
|
3
|
-
/** 落盘信封。`effective`/`etag` 逐字=当时的 fetchEffective 返回(JSON verbatim 面)。`formatVersion` 的语义见头注(
|
|
2
|
+
import type { PublishedPromptArtifact } from "@sema-agent/core";
|
|
3
|
+
/** 落盘信封。`effective`/`etag` 逐字=当时的 fetchEffective 返回(JSON verbatim 面)。`formatVersion` 的语义见头注(5 = 载荷的 prompts 是中心层唯一的那种 wire 形)。 */
|
|
4
4
|
export interface PersistedLkg {
|
|
5
|
-
formatVersion:
|
|
5
|
+
formatVersion: 5;
|
|
6
6
|
savedAt: string;
|
|
7
7
|
worker: string;
|
|
8
8
|
/** 拉到这份候选时所用凭证的身份(`center-credential.ts`;摘要形,不含凭证原文)。 */
|
|
@@ -48,10 +48,10 @@ export declare function lkgReadDenyRows(configLkgPath: string | undefined): {
|
|
|
48
48
|
/** 原子落盘一个干净候选(tmp+rename,0600)。BEST-EFFORT:失败=一条 warn 的素材(调用方发),绝不
|
|
49
49
|
* 影响在飞的应用链——LKG 缓存丢失的代价只是下次冷启动回到 env 兜底。 */
|
|
50
50
|
export declare function saveLkg(path: string, worker: string | undefined, identity: string, effective: Record<string, unknown>, etag: string | undefined): Promise<void>;
|
|
51
|
-
/** 一次读回做过的一次性迁移(调用方响亮打一行 `config_lkg_migrated`,并按
|
|
52
|
-
* (2 → 3
|
|
51
|
+
/** 一次读回做过的一次性迁移(调用方响亮打一行 `config_lkg_migrated`,并按 5 写回原位):`fromFormat` = 盘上的版本号;`note` = 信封层的说明
|
|
52
|
+
* (2 → 3 那一步 {@link migrateV2Lkg} / 4 → 5 那一步 {@link migrateV4Lkg});`receipts` = 载荷层 settings-schema 迁移的收据(只点名坐标与处置,不带值)。 */
|
|
53
53
|
export interface LkgReadMigration {
|
|
54
|
-
readonly fromFormat: 2 | 3 | 4;
|
|
54
|
+
readonly fromFormat: 2 | 3 | 4 | 5;
|
|
55
55
|
readonly note?: string;
|
|
56
56
|
readonly receipts: readonly MigrationReceipt[];
|
|
57
57
|
}
|
|
@@ -59,12 +59,12 @@ export interface LkgReadMigration {
|
|
|
59
59
|
* 读盘上 LKG。返回 undefined 的所有情形都「安静地回 env 兜底」(调用方 warn 点名 reason):
|
|
60
60
|
* 文件缺席/JSON 坏/信封形不对/worker 或凭证身份不匹配(防同名文件跨 worker / 跨账号串包;`CONFIG_LKG_PATH`
|
|
61
61
|
* 单一路径时这是唯一的一道)/载荷有迁不动的旧形({@link migrateLkgPayload})/prompts 面复判失败。
|
|
62
|
-
* `migrated`:读回时做过一次性迁移(信封 2 → 3 或载荷的 settings-schema 迁移)—— 调用方响亮打一行,并把交回的
|
|
63
|
-
* `prompts`:候选判官对这份载荷 prompts
|
|
62
|
+
* `migrated`:读回时做过一次性迁移(信封 2 → 3 / 4 → 5 或载荷的 settings-schema 迁移)—— 调用方响亮打一行,并把交回的 5 写回原位。
|
|
63
|
+
* `prompts`:候选判官对这份载荷 prompts 面交出的中心层(引擎 verify 过的发布形 artifact;`undefined` = 载荷不带 prompts 键)—— 调用方采纳直接用它。
|
|
64
64
|
*/
|
|
65
65
|
export declare function loadLkg(path: string, worker: string | undefined, identity: string): Promise<{
|
|
66
66
|
lkg: PersistedLkg;
|
|
67
|
-
prompts:
|
|
67
|
+
prompts: PublishedPromptArtifact | undefined;
|
|
68
68
|
migrated?: LkgReadMigration;
|
|
69
69
|
} | {
|
|
70
70
|
lkg?: undefined;
|
package/dist/config-lkg.js
CHANGED
|
@@ -27,7 +27,7 @@ export function lkgReadDenyRows(configLkgPath) {
|
|
|
27
27
|
return [{ pattern: configLkgPath, caseSensitive: false }];
|
|
28
28
|
}
|
|
29
29
|
export async function saveLkg(path, worker, identity, effective, etag) {
|
|
30
|
-
const body = { formatVersion:
|
|
30
|
+
const body = { formatVersion: 5, savedAt: new Date().toISOString(), worker: worker ?? "global", identity, ...(etag !== undefined ? { etag } : {}), effective };
|
|
31
31
|
const tmp = `${path}.${randomBytes(6).toString("hex")}.tmp`;
|
|
32
32
|
await fs.mkdir(dirname(path), { recursive: true });
|
|
33
33
|
await fs.writeFile(tmp, JSON.stringify(body), { mode: 0o600 });
|
|
@@ -54,7 +54,7 @@ export async function loadLkg(path, worker, identity) {
|
|
|
54
54
|
const formatVersion = p.formatVersion;
|
|
55
55
|
if (formatVersion === 1)
|
|
56
56
|
return { reason: "pre-identity LKG (formatVersion 1) — not read back: it cannot prove whose credential fetched it (S-651); the next clean candidate rewrites it" };
|
|
57
|
-
if (formatVersion !== 2 && formatVersion !== 3 && formatVersion !== 4)
|
|
57
|
+
if (formatVersion !== 2 && formatVersion !== 3 && formatVersion !== 4 && formatVersion !== 5)
|
|
58
58
|
return { reason: `unknown formatVersion ${String(formatVersion)}` };
|
|
59
59
|
if (typeof p.worker !== "string" || p.worker !== (worker ?? "global"))
|
|
60
60
|
return { reason: `worker mismatch (file=${String(p.worker)})` };
|
|
@@ -71,14 +71,20 @@ export async function loadLkg(path, worker, identity) {
|
|
|
71
71
|
envelope = v2.lkg;
|
|
72
72
|
note = v2.migrated;
|
|
73
73
|
}
|
|
74
|
+
if (formatVersion !== 5) {
|
|
75
|
+
const v4 = migrateV4Lkg(envelope, formatVersion);
|
|
76
|
+
if (v4.lkg === undefined)
|
|
77
|
+
return v4;
|
|
78
|
+
note = note === undefined ? v4.migrated : `${note}; ${v4.migrated}`;
|
|
79
|
+
}
|
|
74
80
|
const payload = migrateLkgPayload(envelope.effective);
|
|
75
81
|
if ("refused" in payload)
|
|
76
82
|
return { reason: payload.refused };
|
|
77
83
|
const judged = lkgPayloadJudged(payload.effective, envelope.etag);
|
|
78
84
|
if ("problem" in judged)
|
|
79
85
|
return { reason: judged.problem };
|
|
80
|
-
const lkg = { ...envelope, formatVersion:
|
|
81
|
-
const migrated = formatVersion !==
|
|
86
|
+
const lkg = { ...envelope, formatVersion: 5, effective: payload.effective };
|
|
87
|
+
const migrated = formatVersion !== 5 || payload.receipts.length > 0;
|
|
82
88
|
return migrated ? { lkg, prompts: judged.prompts, migrated: { fromFormat: formatVersion, ...(note !== undefined ? { note } : {}), receipts: payload.receipts } } : { lkg, prompts: judged.prompts };
|
|
83
89
|
}
|
|
84
90
|
export function migrateLkgPayload(effective) {
|
|
@@ -93,6 +99,16 @@ export function migrateLkgPayload(effective) {
|
|
|
93
99
|
}
|
|
94
100
|
return { effective: m.effective, receipts: m.receipts };
|
|
95
101
|
}
|
|
102
|
+
function migrateV4Lkg(lkg, fromFormat) {
|
|
103
|
+
if (Object.hasOwn(lkg.effective, "prompts")) {
|
|
104
|
+
return {
|
|
105
|
+
reason: `formatVersion ${fromFormat} LKG carries a prompts face` +
|
|
106
|
+
" — written before 7.132.0, so it is the retired two-axis wire (declarations / v1 catalog) the engine no longer reads; not read back: " +
|
|
107
|
+
"the center's next candidate (republished as {schemaVersion: 2, artifact}) rewrites it",
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return { lkg, migrated: `formatVersion ${fromFormat} → 5 (one-time): the payload carries no prompts face, read back unchanged` };
|
|
111
|
+
}
|
|
96
112
|
const RETIRED_CATALOG_COORDINATE = /^models\.(0|[1-9][0-9]*)$/;
|
|
97
113
|
function migrateDroppedIdentityRow(row) {
|
|
98
114
|
if (row === null || typeof row !== "object")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DroppedConfigEntry, type RetiredDomainFinding, type UnreadConfigFile } from "./web-admin-client/read-warnings.js";
|
|
1
|
+
import { type DroppedConfigEntry, type RetiredDomainFinding, type UnreadConfigFile, type UnreadConfigKey } from "./web-admin-client/read-warnings.js";
|
|
2
2
|
import { FileConfigStore } from "@sema-agent/settings-schema/node";
|
|
3
3
|
import { type EffectiveConfig as AgentConfigEffective, type EffectiveReadWarning } from "@sema-agent/settings-schema";
|
|
4
4
|
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, type EffectiveConfig } from "./web-admin-client/facade.js";
|
|
@@ -28,6 +28,7 @@ import type { ConfigProviderWord } from "./config-types.js";
|
|
|
28
28
|
/** `retiredDomains`(S-1456):带事实的退役域文档(契约包的墓碑)—— 读腿不抛,交成发现,候选判官以成因 `retired_domain` 整拒这份候选(与域判形失败
|
|
29
29
|
* 同一条回落链、同一行拒判);缺席 = 没有。远端腿:那一键不进 effective、其余域照读;本地腿:契约读腿在读便携域之前就拒,交出的候选只有版本
|
|
30
30
|
* (这棵树的内容版本,哈希含退役文件 ⇒ 改 / 删它版本即变),内容是空的 effective(被整拒,不会被应用)。 */
|
|
31
|
+
/** `unreadKeys`:本地读腿读了那份文件、却结构上不读其中一键(`prompts.json` 的 `workers`)—— 同 `unreadFiles`,不进候选门,调用方一键一行 `config_unread_key`。 */
|
|
31
32
|
export type FetchEffectiveResult = {
|
|
32
33
|
effective: EffectiveConfig;
|
|
33
34
|
etag?: string;
|
|
@@ -37,6 +38,7 @@ export type FetchEffectiveResult = {
|
|
|
37
38
|
}>;
|
|
38
39
|
droppedEntries?: DroppedConfigEntry[];
|
|
39
40
|
unreadFiles?: UnreadConfigFile[];
|
|
41
|
+
unreadKeys?: UnreadConfigKey[];
|
|
40
42
|
retiredDomains?: RetiredDomainFinding[];
|
|
41
43
|
readWarnings: readonly EffectiveReadWarning[];
|
|
42
44
|
credentialIdentity?: string;
|
|
@@ -125,6 +127,9 @@ export interface ConfigProviderInput {
|
|
|
125
127
|
* `process.cwd()`,而工厂只在 `CONFIG_PROVIDER === "local"` 字面上递它 ⇒ 另一条走到 local 的路上配置源读 cwd、
|
|
126
128
|
* 合成步读 localRoot,两个根分家。一个远程源也收它:`remote` 而无中心 URL 的形照样落回 local。 */
|
|
127
129
|
localDir: string;
|
|
130
|
+
/** S-163:本地配置源的属主声明(`CONFIG_LOCAL_OWNER_UID`,配置席 `configLocalOwnerUid`)—— 每拍读 `config.d` 之前的目录信任判官与起服那一次判同一个值。
|
|
131
|
+
* **必填**(值可以是 `undefined` = 没声明):两个生产构造点都必须递,漏递 = 起服判过、每拍却按「没声明」判 ⇒ 每一拍都拒(tsc 在这里挡)。 */
|
|
132
|
+
localOwnerUid: number | undefined;
|
|
128
133
|
/** S-1556:远程配置源的技能正文盘缓存目录(见 {@link ConfigProvider.skillBodyCacheDir});本地配置源不认它(正文本就在盘上)。缺席 = 不落盘。 */
|
|
129
134
|
skillBodyCacheDir?: string;
|
|
130
135
|
}
|
|
@@ -163,7 +168,9 @@ export declare class LocalConfigProvider implements ConfigProvider {
|
|
|
163
168
|
/** [ref]b 可观测性:config_loaded 日志要能回答「到底读的哪个目录」——复验实录:只设 LOCAL_DATA_ROOT 时
|
|
164
169
|
* config.d 静默读不到且 0 模型无告警(CONFIG_LOCAL_DIR 才是本 lane 的选目录旋钮)。 */
|
|
165
170
|
readonly root: string;
|
|
166
|
-
constructor(root: string, store?: FileConfigStore
|
|
171
|
+
constructor(root: string, store?: FileConfigStore, trust?: {
|
|
172
|
+
readonly declaredOwnerUid: number | undefined;
|
|
173
|
+
});
|
|
167
174
|
fetchEffective(etag: string | undefined): Promise<FetchEffectiveResult>;
|
|
168
175
|
fetchSkillContent(contentHash: string): Promise<string | undefined>;
|
|
169
176
|
}
|
package/dist/config-provider.js
CHANGED
|
@@ -2,7 +2,8 @@ import { readMcpSourceLabel } from "./mcp-source-label.js";
|
|
|
2
2
|
import { createHmac, randomBytes } from "node:crypto";
|
|
3
3
|
import { retiredDomainFindingOf, splitFoldedReadWarnings, withDroppedCatalogEntries } from "./web-admin-client/read-warnings.js";
|
|
4
4
|
import { FileConfigStore } from "@sema-agent/settings-schema/node";
|
|
5
|
-
import {
|
|
5
|
+
import { assertLocalConfigDirTrusted } from "./config-dir-trust.js";
|
|
6
|
+
import { danglingRefs, emptyEffective, findSkillContent, promptArtifactFor, renderRefIssue, skillContentHash, } from "@sema-agent/settings-schema";
|
|
6
7
|
import { redactSecrets } from "./trace/redact.js";
|
|
7
8
|
import { fetchEffective as remoteFetchEffective, fetchSkillContent as remoteFetchSkillContent, WebAdminHttpError, } from "./web-admin-client/facade.js";
|
|
8
9
|
import { homedir } from "node:os";
|
|
@@ -75,12 +76,15 @@ export class LocalConfigProvider {
|
|
|
75
76
|
store;
|
|
76
77
|
root;
|
|
77
78
|
#injectedStore;
|
|
78
|
-
|
|
79
|
+
#declaredOwnerUid;
|
|
80
|
+
constructor(root, store, trust = { declaredOwnerUid: undefined }) {
|
|
79
81
|
this.root = root;
|
|
80
82
|
this.#injectedStore = store;
|
|
81
83
|
this.store = store ?? new FileConfigStore(root);
|
|
84
|
+
this.#declaredOwnerUid = trust.declaredOwnerUid;
|
|
82
85
|
}
|
|
83
86
|
async fetchEffective(etag) {
|
|
87
|
+
await assertLocalConfigDirTrusted({ root: this.root, declaredOwnerUid: this.#declaredOwnerUid });
|
|
84
88
|
const readWarnings = [];
|
|
85
89
|
const store = this.#injectedStore ??
|
|
86
90
|
new FileConfigStore(this.root, {
|
|
@@ -120,6 +124,7 @@ export class LocalConfigProvider {
|
|
|
120
124
|
const droppedEntries = folded.droppedEntries.map(redactDroppedEntry);
|
|
121
125
|
const errors = [...domainErrors.map((de) => ({ domain: de.domain, error: redactConfigError(de.error) })), ...parseErrors, ...refErrors];
|
|
122
126
|
this.#servedSkills = eff.skills;
|
|
127
|
+
const unreadKeys = localUnreadPromptKeys(eff.prompts);
|
|
123
128
|
return {
|
|
124
129
|
effective: withDroppedCatalogEntries(mapToServiceEffective(eff, eff.version), folded.droppedCatalogEntries),
|
|
125
130
|
etag: tag,
|
|
@@ -127,6 +132,7 @@ export class LocalConfigProvider {
|
|
|
127
132
|
...(errors.length > 0 ? { domainErrors: errors } : {}),
|
|
128
133
|
...(droppedEntries.length > 0 ? { droppedEntries } : {}),
|
|
129
134
|
...(folded.unreadFiles.length > 0 ? { unreadFiles: folded.unreadFiles } : {}),
|
|
135
|
+
...(unreadKeys.length > 0 ? { unreadKeys } : {}),
|
|
130
136
|
...(retired !== undefined ? { retiredDomains: [retired] } : {}),
|
|
131
137
|
};
|
|
132
138
|
}
|
|
@@ -134,6 +140,14 @@ export class LocalConfigProvider {
|
|
|
134
140
|
return findSkillContent(this.#servedSkills, contentHash);
|
|
135
141
|
}
|
|
136
142
|
}
|
|
143
|
+
function localUnreadPromptKeys(prompts) {
|
|
144
|
+
const names = prompts?.workers === undefined ? [] : Object.keys(prompts.workers);
|
|
145
|
+
return names.length === 0 ? [] : [{ file: "prompts.json", domain: "prompts", key: "workers", names }];
|
|
146
|
+
}
|
|
147
|
+
function localPromptsWire(prompts, version) {
|
|
148
|
+
const artifact = prompts === undefined ? undefined : promptArtifactFor(prompts, null);
|
|
149
|
+
return artifact === undefined ? {} : { prompts: { schemaVersion: 2, artifact: { ...artifact, sourceRevision: `local:r${version}` } } };
|
|
150
|
+
}
|
|
137
151
|
export function mapToServiceEffective(eff, version) {
|
|
138
152
|
return {
|
|
139
153
|
version,
|
|
@@ -216,9 +230,7 @@ export function mapToServiceEffective(eff, version) {
|
|
|
216
230
|
};
|
|
217
231
|
}),
|
|
218
232
|
},
|
|
219
|
-
...(eff.prompts
|
|
220
|
-
? { prompts: { schemaVersion: 1, catalog: eff.prompts.catalog } }
|
|
221
|
-
: {}),
|
|
233
|
+
...localPromptsWire(eff.prompts, version),
|
|
222
234
|
scenarios: {
|
|
223
235
|
scenarios: (eff.scenarios.scenarios ?? []).map((sc) => ({
|
|
224
236
|
name: sc.name,
|
|
@@ -237,7 +249,7 @@ export function mapToServiceEffective(eff, version) {
|
|
|
237
249
|
export function createConfigProvider(input) {
|
|
238
250
|
return configProviderKind(input) === "remote" && input.webAdmin !== undefined
|
|
239
251
|
? new RemoteConfigProvider(input.webAdmin, {}, input.skillBodyCacheDir)
|
|
240
|
-
: new LocalConfigProvider(input.localDir);
|
|
252
|
+
: new LocalConfigProvider(input.localDir, undefined, { declaredOwnerUid: input.localOwnerUid });
|
|
241
253
|
}
|
|
242
254
|
export function configLocalRoot(config) {
|
|
243
255
|
return config.configLocalDir ?? process.env.AGENT_DATA_DIR ?? join(homedir(), ".ai-agent");
|
package/dist/config-types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ import type { InfraCostRates } from "./observability/cost-taxonomy.js";
|
|
|
19
19
|
import type { Autonomy, CommandRule } from "./runtime-governance.js";
|
|
20
20
|
import type { CenterCredentialSource } from "./center-credential.js";
|
|
21
21
|
import type { GitApiKind } from "./git-api-kind.js";
|
|
22
|
+
import type { CustomPkgSource } from "./sandbox-pkg-source.js";
|
|
22
23
|
import type { MemoryEngineBackend, StoreBackend as StoreBackendWord } from "@sema-agent/settings-schema/execution-lanes";
|
|
23
24
|
import { DRAIN_GRACE_FLOOR_MS } from "@sema-agent/settings-schema/fleet";
|
|
24
25
|
import type { AtMention } from "@sema-agent/settings-schema";
|
|
@@ -148,6 +149,35 @@ export declare const FIRST_BYTE_TIMEOUT_BOUNDS: {
|
|
|
148
149
|
readonly minMs: 0;
|
|
149
150
|
readonly maxMs: 2147483647;
|
|
150
151
|
};
|
|
152
|
+
/**
|
|
153
|
+
* 整数合法域(闭区间)的**一种说法**:device 车道的数值旋钮(`DEVICE_RECONNECT_GRACE_MS` / `DEVICE_MAX_INFLIGHT_PER_DEVICE` /
|
|
154
|
+
* `DEVICE_DELIVERY_TIMEOUT_MS` / `DEVICE_EXEC_TIMEOUT_MS`)、汇聚端创建时对 helloAck 六个数值位的校验、协议文档与配置目录的合法域句,
|
|
155
|
+
* 都问这一只判据、读这一句话 —— 判据与说法各只有一处。`max === Number.MAX_SAFE_INTEGER` 读作「无上界」(JSON 数字在 2^53−1 内精确)。
|
|
156
|
+
*/
|
|
157
|
+
export interface WholeNumberBounds {
|
|
158
|
+
readonly min: number;
|
|
159
|
+
readonly max: number;
|
|
160
|
+
}
|
|
161
|
+
/** `value` 是落在 `bounds` 内的安全整数(NaN / ±Infinity / 小数 / 非数 / 越界全否)。 */
|
|
162
|
+
export declare function inWholeNumberBounds(bounds: WholeNumberBounds, value: unknown): value is number;
|
|
163
|
+
/** 合法域的一句话:`an integer in [0, 2147483647]` / `an integer ≥ 1`(无上界时)。拒句与协议文档读同一句。 */
|
|
164
|
+
export declare function wholeNumberBoundsRule(bounds: WholeNumberBounds): string;
|
|
165
|
+
/**
|
|
166
|
+
* device 车道两根**不上 helloAck** 的数值旋钮的合法域(上 helloAck 的另两根 —— `DEVICE_RECONNECT_GRACE_MS` / `DEVICE_MAX_INFLIGHT_PER_DEVICE` ——
|
|
167
|
+
* 的界属协议,见 `device-ws-protocol.ts` 的 `DEVICE_HELLO_ACK_BOUNDS`)。解析器(`config.ts`)与配置目录行共读这一处。
|
|
168
|
+
*
|
|
169
|
+
* · `DEVICE_DELIVERY_TIMEOUT_MS`(等 per-device 在途槽的上限):下界 `0` = 不排队,槽满即 `device.busy`,是真含义;
|
|
170
|
+
* · `DEVICE_EXEC_TIMEOUT_MS`(指令级默认超时,进每条指令帧的 `timeoutMs`):下界 `1` —— `0` 会让每条没自带超时的指令出生即超时;
|
|
171
|
+
* · 两者上界 = {@link MAX_TIMER_DELAY_MS}:排队计时与指令级超时都从这两个数起算 `setTimeout` 的 delay,更大的值被 Node 折成 1 ms。
|
|
172
|
+
*/
|
|
173
|
+
export declare const DEVICE_DELIVERY_TIMEOUT_BOUNDS: {
|
|
174
|
+
readonly min: 0;
|
|
175
|
+
readonly max: 2147483647;
|
|
176
|
+
};
|
|
177
|
+
export declare const DEVICE_EXEC_TIMEOUT_BOUNDS: {
|
|
178
|
+
readonly min: 1;
|
|
179
|
+
readonly max: 2147483647;
|
|
180
|
+
};
|
|
151
181
|
/**
|
|
152
182
|
* S-220 —— **`resilience` 块缺省的唯一属主**(S-202 的单源从一根扩到整族)。
|
|
153
183
|
*
|
|
@@ -1107,9 +1137,9 @@ export interface ServiceConfigFlat {
|
|
|
1107
1137
|
keyPrefix?: string;
|
|
1108
1138
|
presignTtlSec?: number;
|
|
1109
1139
|
};
|
|
1110
|
-
/** (a)(clay 拍 a+c,2026-07-27)SQL 默认店的 per-blob 帽显式覆写(字节)。未设 ⇒
|
|
1111
|
-
*
|
|
1112
|
-
*
|
|
1140
|
+
/** (a)(clay 拍 a+c,2026-07-27)SQL 默认店的 per-blob 帽显式覆写(字节)。未设 ⇒ `sqlBlobDefaultCapBytes`
|
|
1141
|
+
* 按**将要写入的那条连接**报的两堵墙推导(MySQL 协议 = 单行上限 − 64 KiB 与 ⌊(包墙 `max_allowed_packet` − 1 KiB) ÷ 2⌋ 取小;
|
|
1142
|
+
* pg 连接两堵都没有 = 不设帽);设了 ⇒ 两方言都生效(调高过 entry/packet 限的部署放宽用)。软旋钮:坏值=undefined 走默认。 */
|
|
1113
1143
|
snapshotBlobSqlMaxBytes?: number;
|
|
1114
1144
|
/** (c) 的显式逃生口:云形(mysql|pg 后端)缺 MinIO 本应 boot fail-loud(bytes-in-DB 撞包墙已两役
|
|
1115
1145
|
* 实证,大字节归对象存储);`SNAPSHOT_BLOB_ALLOW_SQL_BYTES=true` 显式接受 SQL 店 + (a) 的帽
|
|
@@ -1273,11 +1303,16 @@ export interface ServiceConfigFlat {
|
|
|
1273
1303
|
retentionSweep: RetentionSweepConfig;
|
|
1274
1304
|
/** Tool names that require operator approval before running (F4). Empty = no approval gate. */
|
|
1275
1305
|
approvalRequire: string[];
|
|
1276
|
-
/** Principals allowed to act as OPERATORS
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1306
|
+
/** Principals allowed to act as OPERATORS (`OPERATOR_PRINCIPALS`): every operator face reads it through the one reading
|
|
1307
|
+
* `explicitOperatorOk` (`http/principal-gate.ts`) — e.g. the F4 approval queue (`/v1/approvals`): list ANY owner's pending +
|
|
1308
|
+
* decide. A non-operator principal may only LIST ITS OWN pending. **Empty = no one is an operator** (S-1050: the old
|
|
1309
|
+
* "empty = everyone on the approval queue" reading is gone); a single-user deployment that wants to be its own operator
|
|
1310
|
+
* declares {@link operatorSingleUser}. */
|
|
1280
1311
|
operatorPrincipals: string[];
|
|
1312
|
+
/** `OPERATOR_SINGLE_USER=true` —— 单用户形显式声明「这台部署的每个调用方都是运维」(S-1050,[ref] ① 裁 A)。缺席 = 不声明(没人是,除非在名单里)。
|
|
1313
|
+
* 只在单用户形(`REQUIRE_PRINCIPAL` 未开)且名单为空时成立 —— 否则拒启(`config-invariants.ts` 的 `operator-single-user`:一个事实一个来源)。
|
|
1314
|
+
* env 独有(没有中心写位),起服冻结。读法只有 `explicitOperatorOk` / `operatorRosterPresent` 两只。 */
|
|
1315
|
+
operatorSingleUser?: boolean;
|
|
1281
1316
|
/**
|
|
1282
1317
|
* DESIGN-278 §5 S2([ref])—— `GET /v1/config/catalog`(配置目录自描述端点)的显式旋钮。
|
|
1283
1318
|
* 默认 **ON**(设计稿 §0.5:合规部署可关)。端点本身已是 operator-only(`explicitOperatorOk`,
|
|
@@ -1470,8 +1505,10 @@ export interface ServiceConfigFlat {
|
|
|
1470
1505
|
/** SVC-1: the durable WorkflowRunStore backend for BACKGROUND workflow runs.
|
|
1471
1506
|
* `auto` (DEFAULT) = the SQL-backed cross-replica store when a SQL backend is configured, else the
|
|
1472
1507
|
* crash-safe `FileWorkflowRunStore` ledger under `localDataRoot/workflows` (dispatch: main.ts, keyed off
|
|
1473
|
-
* `sqlWorkflowRunStore` presence). `file` = force the file ledger
|
|
1474
|
-
*
|
|
1508
|
+
* `sqlWorkflowRunStore` presence). `file` = force the file ledger — on the local backend only: with a SQL backend
|
|
1509
|
+
* and SELF_ORCHESTRATION_ENABLED, `file` / `memory` are refused at start (the workflow park decision store must
|
|
1510
|
+
* live where the session claims live and be reaped with the records; no store does both off the database —
|
|
1511
|
+
* `parkDecisionStoreRefusal`). Either durable form means a background run's record SURVIVES a restart, which is what lets the
|
|
1475
1512
|
* at-least-once completion notify re-derive a run's terminal state after a crash. `memory` = the ephemeral
|
|
1476
1513
|
* `InMemoryWorkflowRunStore` (process-local; no crash recovery, no notify journal) — an explicit opt-out for
|
|
1477
1514
|
* a single-instance/ephemeral deployment. ([ref]: the old docblock claimed `file` was the default and
|
|
@@ -1526,14 +1563,12 @@ export interface ServiceConfigFlat {
|
|
|
1526
1563
|
* tools for a declared `plan` itself, and no plan entry clamps the hands (only `AUTONOMY=read-only` does). */
|
|
1527
1564
|
planModeEnabled: boolean;
|
|
1528
1565
|
/**
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1566
|
+
* `HOOKS_TIMEOUT_MS` —— 请求 `settings.hooks` 那张 mods 注册(`settings.hooks`)每个 handler 的时间预算(ms;一个事件跑一遍本请求的钩子条目)。
|
|
1567
|
+
* **缺席 = 不铸键**;唯一读法 = `hooks/hook-runner.ts` 的 `settingsHooksBudgetMs`(未设 ⇒ 600000,单条命令超时的上限;这只数是引擎的钟,不是钩子子进程的墙钟)。
|
|
1531
1568
|
*
|
|
1532
|
-
* 🔴 `0` 是有效值(
|
|
1569
|
+
* 🔴 `0` 是有效值(引擎按字面:零预算,下一个定时器拍就到期),不是「未设」;
|
|
1533
1570
|
* 坏值(非整数 / 负 / 超 `setTimeout` 32 位上限)**拒启**,解析见 config.ts `parseHooksTimeoutEnv`。
|
|
1534
|
-
*
|
|
1535
|
-
* merge-rescan 745 补折:该腿今日仅同步计数器席位、折上为防倒退)。server 车道一处施加两条腿同时
|
|
1536
|
-
* 生效:既是 `RunnerDeps.hooks`,又是 `resolve-spec` 折进 task hooks 的部署基线。
|
|
1571
|
+
* 部署座的两张观察注册(拒绝计量 / 工具追踪)不读它(同步返回,用引擎缺省)。
|
|
1537
1572
|
*/
|
|
1538
1573
|
hooksTimeoutMs?: number;
|
|
1539
1574
|
/** SVC-2 (adversarial-review): the workflow_journal GC retention — the reaper purges journal rows older than
|
|
@@ -1604,6 +1639,11 @@ export interface ServiceConfigFlat {
|
|
|
1604
1639
|
* nothing (the pre-2026-07-13 unset behavior — byte-identical sandbox). Operator env `SANDBOX_PKG_SOURCE`;
|
|
1605
1640
|
* per-region via the registry effective-config (shell B3) later. */
|
|
1606
1641
|
sandboxPkgSource?: string;
|
|
1642
|
+
/** The explicit addresses of `SANDBOX_PKG_SOURCE=custom` (`SEMA_APT_MIRROR` / `SEMA_PIP_INDEX` / `SEMA_UV_INDEX` / `SEMA_UV_PY_MIRROR` /
|
|
1643
|
+
* `SEMA_NPM_REGISTRY` / `SEMA_NODE_MIRROR`), read and judged ONCE at load by `customPkgSourceFromEnv` (a value with userinfo — or a shape
|
|
1644
|
+
* the URL judge cannot call credential-free — refuses startup) and handed to the sandbox lanes' env composer from here: the lane never
|
|
1645
|
+
* reads `process.env` for them again. Present iff the profile is `custom` AND at least one address is set. */
|
|
1646
|
+
sandboxPkgSourceCustom?: CustomPkgSource;
|
|
1607
1647
|
/** Auto-generate a session title at first submit (one cheap-model call per
|
|
1608
1648
|
* session; fills a NULL title only — a title the user set via `PATCH /v1/sessions/:id` is never overwritten).
|
|
1609
1649
|
* Default ON; `SESSION_AUTO_TITLE=false` opts out. */
|
|
@@ -1635,7 +1675,7 @@ export interface ServiceConfigFlat {
|
|
|
1635
1675
|
* `deriveSettingsPolicy` 的 fs-write gate 闭包里,而那个闭包只在 default/auto/acceptEdits 三臂被调用 ⇒
|
|
1636
1676
|
* `bypassPermissions` / `permissionMode` 键缺席(headless `-p` 的默认姿势)/ body 连 settings 都没有
|
|
1637
1677
|
* 这三形整条 DENY 腿不建(邻仓 46 格真机矩阵实证)。裁决 env 仍按 lane 分形(host 真 fs / 沙箱
|
|
1638
|
-
* `DeferredSandboxPathEnv` 代理)
|
|
1678
|
+
* `DeferredSandboxPathEnv` 代理),单点构造(resolve-spec 的 `pathAdjudication`)。
|
|
1639
1679
|
* 折叠仍是 deny-wins(tightenTaskSpec ⇒ combinePolicies),所以会话豁免 / acceptEdits 自动 allow /
|
|
1640
1680
|
* 客户端 settings allow 一律越不过它;非守卫目标该 policy 返回 `action:"allow"`(core 的 ToolPolicy
|
|
1641
1681
|
* 没有「无意见」第三态;这个 allow 在 combinePolicies 的 deny/ask 优先折叠里不构成一票,故在折叠
|
|
@@ -1741,6 +1781,11 @@ export interface ServiceConfigFlat {
|
|
|
1741
1781
|
* 不静默吞)。`"never"` = 不设期限。**未设 ⇒ 不铸键**,由引擎落它自己的缺省(`"5m"`)——本仓不复制上游
|
|
1742
1782
|
* 缺省值。词表外 boot 拒启。⚠️ CC 同名键还有第二个消费面(远端审批对话框停靠时长),本旋钮今天不驱动它。 */
|
|
1743
1783
|
crossSessionDialogExpiry?: CrossSessionDialogExpiry;
|
|
1784
|
+
/** [ref] §10.2 —— principal 收件箱(`principal.inbox`)的消费方声明:独占读它的那只助理的 agent handle
|
|
1785
|
+
* (`PRINCIPAL_INBOX_ASSISTANT`)→ core `RunnerDeps.principalInboxConsumer: { assistant }`。**它就是跨主体投递车道的开关**:
|
|
1786
|
+
* 在场 ⇒ 装配挂投递门(`org-delivery-gate.ts`)与受理口 `POST /v1/principal-inbox/messages`,前提(耐久 mailbox / org 成员
|
|
1787
|
+
* 目录 / 配额店)缺一拒启;缺席 ⇒ 不铸座、不挂门(收件箱这条车道整条不存在)。判形归 core `principalInboxConsumerOf`。 */
|
|
1788
|
+
principalInboxAssistant?: string;
|
|
1744
1789
|
/** [ref]④ defer face (EXPERIMENTAL, default OFF): mark the default scenario's LONG-TAIL first-party tools
|
|
1745
1790
|
* (today = SelectEnvironment only) `defer:true` (core tool-disclosure: the model sees a placeholder until it
|
|
1746
1791
|
* ToolSearch-loads the schema). Assessment says the win is marginal for us (spec.tools total ≈4.2k tokens, of
|
|
@@ -2102,6 +2147,12 @@ export interface ServiceConfigFlat {
|
|
|
2102
2147
|
};
|
|
2103
2148
|
/** Expire pending approvals older than this (seconds). 0 disables the reaper. */
|
|
2104
2149
|
approvalTimeoutSec: number;
|
|
2150
|
+
/**
|
|
2151
|
+
* 审批账本(问账三形 + local 审计账)的保留窗(ms):一问结了且最后一次动静早于 `now − 本值`,它的全部记录由维护 tick 整问删掉;
|
|
2152
|
+
* 没结的问永不按龄删。`0` = 不删(永久保留)。缺省 30 天;正值下限 1 天(低于即钳 + 点名);负值 / 非整数拒启。
|
|
2153
|
+
* 律、节律与下限的理由一处成文在 `approval-ask-retention.ts`。`APPROVAL_ASK_RETENTION_MS`。
|
|
2154
|
+
*/
|
|
2155
|
+
approvalAskRetentionMs: number;
|
|
2105
2156
|
/** Background reaper interval (seconds) for stale runs / expired approvals / rate windows. */
|
|
2106
2157
|
reapIntervalSec: number;
|
|
2107
2158
|
/** TTL (seconds) for offloaded tool results in the durable store. Must comfortably exceed a run's
|
|
@@ -2198,6 +2249,10 @@ export interface ServiceConfigFlat {
|
|
|
2198
2249
|
configProvider?: ConfigProviderWord;
|
|
2199
2250
|
/** Root dir holding `config.d/<domain>.json` for the local config source. Env: CONFIG_LOCAL_DIR. */
|
|
2200
2251
|
configLocalDir?: string;
|
|
2252
|
+
/** 本地配置源的目录信任判官(`config-dir-trust.ts`)多信的那一个属主 uid —— 本服务用户与 root 之外,`config.d` 及其路径上的目录与文档还可以属于谁
|
|
2253
|
+
* (userns-remap 的 bind-mount 呈现为未映射 uid、运维用户持有的配置)。只放宽属主判据,模式判据照校。缺席 = 只信本服务用户与 root。
|
|
2254
|
+
* Env: CONFIG_LOCAL_OWNER_UID(形错拒启;解析口 `parseConfigLocalOwnerUid`)。 */
|
|
2255
|
+
configLocalOwnerUid?: number;
|
|
2201
2256
|
}
|
|
2202
2257
|
/** 组:store(持久化)—— DB 引擎三态、session 后端、SQL coords、快照 BLOB / SendUserFile 对象存储。 */
|
|
2203
2258
|
export type ServiceStoreConfig = Pick<ServiceConfigFlat, "sessionBackend" | "sessionCacheTtlSec" | "storeProbeIntervalMs" | "storeLockWaitMs" | "dbBackend" | "dbBackendExplicit" | "localDataRoot" | "runStoreStrictHydrate" | "tidb" | "pg" | "dbQueryTimeoutMs" | "snapshotBlobStore" | "snapshotBlobSqlMaxBytes" | "snapshotBlobAllowSql" | "fileHistory" | "fileHistoryCapture" | "sendUserFile">;
|
|
@@ -2205,7 +2260,7 @@ export type ServiceStoreConfig = Pick<ServiceConfigFlat, "sessionBackend" | "ses
|
|
|
2205
2260
|
export type ServiceModelPlaneConfig = Pick<ServiceConfigFlat, "gatewayBaseUrl" | "gatewayApiKey" | "gatewayFallbackUrls" | "gatewayMaxRetries" | "anthropic" | "resilience" | "model" | "envModel" | "models" | "modelApiKeyEnv" | "modelApiKeys" | "modelRefusals" | "droppedCatalogEntries" | "modelQuotaWeights" | "tiers" | "projects" | "roles" | "atMention" | "cascadeLadder" | "degrade">;
|
|
2206
2261
|
/** 组:approval(审批 / HITL 门)。`directDoorActive` 无 env 解析腿(装配层三域合取的产物),但语义上
|
|
2207
2262
|
* 就是本组的门状态,故进组;`parseApprovalDomain` 的返回类型相应是 `Omit<…, "directDoorActive">`。 */
|
|
2208
|
-
export type ServiceApprovalConfig = Pick<ServiceConfigFlat, "approvalRequire" | "approvalDeny" | "approvalTimeoutSec" | "approvalAutoBudget" | "approvalNeverAuto" | "approvalGrant" | "approvalHmacKeys" | "durableApproval" | "durableApprovalSource" | "streamAskWindowMsSource" | "directApprovalDoor" | "directDoorActive" | "resourceSuspend" | "resourceSuspendTtlSec" | "resourceSuspendTotalTokens" | "resourceSuspendTotalBudgetUsd" | "resourceSuspendMaxSlices" | "askQuestionEnabled" | "questionThrottle" | "toolApprovalEnabled" | "permissionRulesEnabled" | "permissionRulesEnabledExplicit" | "streamAskWindowMarginMs" | "streamApproval" | "unattendedApprovalPolicy" | "mcpElicitation" | "sensitiveWritePatterns" | "writeProtectedPaths" | "manualModeShellGate" | "permissionsDisableAutoMode" | "autoModeClassifierFallback" | "autoModeClassifierTimeoutMs" | "crossSessionInbound" | "crossSessionDialogExpiry">;
|
|
2263
|
+
export type ServiceApprovalConfig = Pick<ServiceConfigFlat, "approvalRequire" | "approvalDeny" | "approvalTimeoutSec" | "approvalAskRetentionMs" | "approvalAutoBudget" | "approvalNeverAuto" | "approvalGrant" | "approvalHmacKeys" | "durableApproval" | "durableApprovalSource" | "streamAskWindowMsSource" | "directApprovalDoor" | "directDoorActive" | "resourceSuspend" | "resourceSuspendTtlSec" | "resourceSuspendTotalTokens" | "resourceSuspendTotalBudgetUsd" | "resourceSuspendMaxSlices" | "askQuestionEnabled" | "questionThrottle" | "toolApprovalEnabled" | "permissionRulesEnabled" | "permissionRulesEnabledExplicit" | "streamAskWindowMarginMs" | "streamApproval" | "unattendedApprovalPolicy" | "mcpElicitation" | "sensitiveWritePatterns" | "writeProtectedPaths" | "manualModeShellGate" | "permissionsDisableAutoMode" | "autoModeClassifierFallback" | "autoModeClassifierTimeoutMs" | "crossSessionInbound" | "crossSessionDialogExpiry" | "principalInboxAssistant">;
|
|
2209
2264
|
/** 组:memory(记忆面 + TOC 同步腿)。 */
|
|
2210
2265
|
export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled" | "memoryEngineDir" | "memoryEngineRemoteLaneAllowed" | "memoryEngineBackend" | "memoryScope" | "memoryPersistenceCapable" | "memorySync" | "memoryEmbedder" | "memoryOrgAdmissionMode" | "memoryDelegationEvidence" | "memoryProvenance" | "memoryCapturePolicy" | "memoryConsolidationDriver" | "memoryOrgDirectoryJson" | "memoryOrgGrantTtlMs" | "memoryOrgUnavailableBackoffMs" | "projectMemoryEnabled" | "syncImportLeaseStaleSec">;
|
|
2211
2266
|
/** 组:auth(鉴权 / 身份 / 治理棒)。`commandPolicy` 只有 web-admin 腿(无 env 标量形),故 env 解析
|
|
@@ -2214,15 +2269,15 @@ export type ServiceMemoryConfig = Pick<ServiceConfigFlat, "memoryEngineEnabled"
|
|
|
2214
2269
|
* 三者都是 operator 在配置面写下的**治理声明**(与 autonomy/commandPolicy 同族),不是存储旋钮
|
|
2215
2270
|
* ——`retentionPolicy` 尤其容易被误归 store 组:它的消费点是 core 的启动期能力校验与将来的调度面,
|
|
2216
2271
|
* config 这一层它只是一句声明。 */
|
|
2217
|
-
export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
|
|
2272
|
+
export type ServiceAuthConfig = Pick<ServiceConfigFlat, "authToken" | "authTokens" | "allowUnauthedWrites" | "corsOrigins" | "principalHeader" | "requirePrincipal" | "autonomy" | "commandPolicy" | "compliancePosture" | "lockedConfigKeys" | "configCatalogEnabled" | "retentionPolicy" | "retentionSweep" | "operatorPrincipals" | "operatorSingleUser" | "principalJwtPubkeys" | "principalJwtIss" | "principalJwtAud" | "authBridgeIssuer" | "principalJwtMaxTtlSec" | "bindHost" | "bindHostSource">;
|
|
2218
2273
|
/** 组:orchestration(编排 + 执行车道 + 沙箱面 + workflow/后台 agent 存留)。 */
|
|
2219
|
-
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2274
|
+
export type ServiceOrchestrationConfig = Pick<ServiceConfigFlat, "remoteExec" | "remoteExecHomeDir" | "requireExecutionLane" | "worktreeIsolation" | "leaderEnabled" | "leaderFanoutEnabled" | "routerEnabled" | "selfOrchestrationEnabled" | "selfOrchestrationModels" | "selfOrchestrationWorkerIsolation" | "forkEnabled" | "experimentalObserverAgents" | "schedulerEnabled" | "schedulerSessionWakeup" | "schedulerSessionLifetime" | "schedulerStorePath" | "planModeEnabled" | "hooksTimeoutMs" | "workflowRunStoreBackend" | "workflowOrphanGraceMs" | "workflowJournalRetentionMs" | "workflowRunRetentionMs" | "usageWindows" | "workflowAgentsReadOnly" | "workflowSizeGuideline" | "backgroundAgentRetentionMs" | "backgroundAgentStaleRunningMs" | "backgroundAgentParkClaimStaleMs" | "delegationEntryCaps" | "rosterRetentionMs" | "leaderRunStaleMs" | "scratchpadSweepTtlMs" | "sandboxPkgSource" | "sandboxPkgSourceCustom" | "sessionAutoTitle" | "sessionAutoTitleSource" | "selectEnvironmentTool" | "envFactsEnabled" | "toolDeferLongtail" | "lspEnabled" | "lspHostEnabled" | "lspEnvAllow" | "imageBakes" | "readFace" | "readFaceSource" | "taskWriteFaceEscalation" | "readDenyPatterns" | "readDenyBuiltinTiers" | "readDenyBuiltinExclude" | "agentConfigDir" | "configLkgPath" | "configLkgEnabled">;
|
|
2220
2275
|
/** 组:limitsHttp(HTTP 面 + 各类上限/配额/回收窗)。 */
|
|
2221
2276
|
export type ServiceLimitsHttpConfig = Pick<ServiceConfigFlat, "port" | "attachmentOrphanGraceMs" | "workspaceFileMaxBytes" | "attachmentMaxBytes" | "attachmentMimeAllowlist" | "attachmentUnboundTtlMs" | "infraCostRates" | "drainGraceMs" | "drainSecondSignalMinGapMs" | "sighupIdleGraceMs" | "parentPid" | "engineAutoExit" | "engineLingerMs" | "engineOrphanLingerMs" | "rateLimitPerMin" | "maxTaskCostUsd" | "maxTaskTokens" | "maxPrincipalCostUsd" | "costQuotaWindowSec" | "reapIntervalSec" | "runStaleSec" | "toolResultTtlSec">;
|
|
2222
2277
|
/** 组:observability(可观测)。 */
|
|
2223
2278
|
export type ServiceObservabilityConfig = Pick<ServiceConfigFlat, "metricsToken" | "traceToken" | "toolTrace" | "traceThinking" | "logLevel" | "otel">;
|
|
2224
2279
|
/** 组:integrations(外部集成)。`mcpServers` / `a2aPeers` 由 web-admin 适配器填(无 env 腿),归本组。 */
|
|
2225
|
-
export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "centerCredentialRenewLeadMs" | "webAdmin" | "fleetLeaseFailClosed" | "fleetGeneration" | "fleetScope" | "fleetAdvertiseAddress" | "fleetLeaseOutageMaxMs" | "configProvider" | "configLocalDir">;
|
|
2280
|
+
export type ServiceIntegrationsConfig = Pick<ServiceConfigFlat, "pluginsAllowHosts" | "mcpServers" | "a2aPeers" | "a2aServe" | "configBootFetchBudgetMs" | "gitApiBaseUrl" | "gitApiToken" | "gitApiKind" | "defaultScenario" | "skillsDir" | "centerCredentialRenewLeadMs" | "webAdmin" | "fleetLeaseFailClosed" | "fleetGeneration" | "fleetScope" | "fleetAdvertiseAddress" | "fleetLeaseOutageMaxMs" | "configProvider" | "configLocalDir" | "configLocalOwnerUid">;
|
|
2226
2281
|
/** 九个组槽。每组恒在场(`loadConfig` / `attachConfigGroups` 装好才交出配置),故不可选——新代码写
|
|
2227
2282
|
* `config.modelPlane.model` 不需要 `?.`(可选组会把 `Model` 污染成 `Model | undefined`)。 */
|
|
2228
2283
|
export interface ServiceConfigGroups {
|
package/dist/config-types.js
CHANGED
|
@@ -15,6 +15,14 @@ export function fleetScopeOf(raw) {
|
|
|
15
15
|
export const CENTER_BASE_URL_RULE = "设了就必须是可解析的 http(s) URL,且不带凭据 / query / fragment(基址后面要拼路径);坏形拒启(没接中心也拒),拒句只点名规则,不回显 scheme";
|
|
16
16
|
export const FLEET_LEASE_OUTAGE_MAX_DEFAULT_MS = 86_400_000;
|
|
17
17
|
export const FIRST_BYTE_TIMEOUT_BOUNDS = { minMs: 0, maxMs: MAX_TIMER_DELAY_MS };
|
|
18
|
+
export function inWholeNumberBounds(bounds, value) {
|
|
19
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= bounds.min && value <= bounds.max;
|
|
20
|
+
}
|
|
21
|
+
export function wholeNumberBoundsRule(bounds) {
|
|
22
|
+
return bounds.max === Number.MAX_SAFE_INTEGER ? `an integer ≥ ${bounds.min}` : `an integer in [${bounds.min}, ${bounds.max}]`;
|
|
23
|
+
}
|
|
24
|
+
export const DEVICE_DELIVERY_TIMEOUT_BOUNDS = { min: 0, max: MAX_TIMER_DELAY_MS };
|
|
25
|
+
export const DEVICE_EXEC_TIMEOUT_BOUNDS = { min: 1, max: MAX_TIMER_DELAY_MS };
|
|
18
26
|
export const RESILIENCE_DEFAULTS = {
|
|
19
27
|
firstTokenTimeoutMs: { env: "MODEL_FIRST_TOKEN_TIMEOUT_MS", value: 600_000 },
|
|
20
28
|
idleTimeoutMs: { env: "MODEL_IDLE_TIMEOUT_MS", value: 300_000 },
|
package/dist/config.d.ts
CHANGED
|
@@ -288,6 +288,11 @@ export declare function isRosterGateArmed(webAdmin: ServiceConfig["webAdmin"]):
|
|
|
288
288
|
export interface UnmatchableToolName {
|
|
289
289
|
name: string;
|
|
290
290
|
guidance: string;
|
|
291
|
+
/**
|
|
292
|
+
* 这一条为什么永远不生效 —— 机读位的 `reason`(`entry-problems.ts`):引擎名字判官的判词 `retired` / `unmintable_segment` / `unprefixed_namespace`、引擎规则文法的码原样(`invalid.*` /
|
|
293
|
+
* `unsupported.*`)、近似名 `near_miss`、名表消费者的 CC 规则形 `cc_rule_form`。句子里的 `guidance` 给人读,本字给机器读;两者在同一处同时铸。
|
|
294
|
+
*/
|
|
295
|
+
reason: string;
|
|
291
296
|
}
|
|
292
297
|
/**
|
|
293
298
|
* S-177(core 7.9.0 [ref])—— **这条名单条目喂给谁**,决定「永不匹配」这句话怎么判。三个消费者形态:
|
|
@@ -327,6 +332,14 @@ export declare function unmatchableToolNamesRefusal(source: string, names: reado
|
|
|
327
332
|
readonly message: string;
|
|
328
333
|
readonly names: readonly string[];
|
|
329
334
|
} | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* {@link unmatchableToolNamesRefusal} 的本体:判一遍,句子(点名有界)与**全部**坏条目(每条带 `reason`)同时交出 —— 需要机读位的调用方(请求的 `settings.permissions.deny` / `ask` 的 422 与存体预判)读 `bad`,
|
|
337
|
+
* 只要句子与条目名的调用方(env / 中心下发的拒启)读上面那只薄壳。判据与句子只此一份。
|
|
338
|
+
*/
|
|
339
|
+
export declare function judgeUnmatchableToolNames(source: string, names: readonly string[], judgment: UnmatchableToolNameJudgment): {
|
|
340
|
+
readonly message: string;
|
|
341
|
+
readonly bad: readonly UnmatchableToolName[];
|
|
342
|
+
} | undefined;
|
|
330
343
|
/**
|
|
331
344
|
* 运维 allow 表 `APPROVAL_GRANT` 的**拒启判据与拒因句**(同一只函数;`config-invariants.ts` 的 `…Refusal` 形:返回句子 = 拒,`undefined` = 通过)。
|
|
332
345
|
* 7.117.0(core 7.42.0)起这张表整份投 `RunnerDeps.allowedTools`(引擎 allow 层的部署成员,构造时读一次),判据是**引擎的读法**,与请求的两张
|