@sema-agent/server 7.132.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 +266 -0
- package/README.md +8 -9
- package/README.zh-CN.md +7 -6
- package/USAGE.md +174 -55
- 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 +79 -19
- package/dist/approval-card.js +44 -13
- 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 +27 -10
- package/dist/audit.js +12 -16
- package/dist/bake-runner/main.js +3 -2
- package/dist/boot/deferred-sandbox-path-env.js +1 -1
- package/dist/boot/execution-env.js +9 -7
- package/dist/boot/execution-lane.js +11 -0
- package/dist/boot/leader.js +2 -0
- 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/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +21 -1
- package/dist/boot/resolve-spec.d.ts +3 -0
- package/dist/boot/resolve-spec.js +60 -81
- package/dist/boot/runner-deps.js +1 -0
- package/dist/boot/session-faces.d.ts +1 -0
- package/dist/boot/session-faces.js +4 -2
- package/dist/boot/stage-02-web-admin-pull.js +4 -1
- package/dist/boot/stage-06-runners.d.ts +2 -0
- package/dist/boot/stage-06-runners.js +6 -3
- package/dist/boot/stage-07-capability-layer.d.ts +2 -0
- package/dist/boot/stage-07-capability-layer.js +24 -3
- package/dist/boot/stage-08-reapers.d.ts +2 -0
- package/dist/boot/stage-08-reapers.js +2 -2
- package/dist/boot/stage-09-leader.d.ts +3 -0
- package/dist/boot/stage-10-http-server.d.ts +3 -0
- package/dist/boot/stage-10-http-server.js +5 -6
- package/dist/boot/stores.js +2 -2
- package/dist/boot/web-admin.d.ts +4 -0
- package/dist/boot/web-admin.js +151 -63
- package/dist/boot/workflow-orchestration.d.ts +2 -0
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/brain.js +8 -3
- package/dist/breaker-key.d.ts +6 -0
- package/dist/breaker-key.js +29 -0
- package/dist/caller-text-echo.d.ts +9 -6
- package/dist/caller-text-echo.js +8 -11
- package/dist/capabilities/center-plugins.d.ts +7 -0
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +21 -0
- package/dist/capabilities/hands-lane.js +10 -0
- package/dist/capabilities/mcp-probe.d.ts +36 -4
- package/dist/capabilities/mcp-probe.js +27 -4
- package/dist/capabilities/scenarios.d.ts +63 -7
- package/dist/capabilities/scenarios.js +39 -7
- 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 +43 -28
- 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-provider.d.ts +6 -1
- package/dist/config-provider.js +6 -2
- package/dist/config-types.d.ts +71 -14
- package/dist/config-types.js +8 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +121 -59
- 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 -23
- package/dist/elicitation.js +3 -2
- package/dist/entry-problems.d.ts +34 -0
- package/dist/entry-problems.js +14 -0
- package/dist/execution-lane-caps.d.ts +49 -10
- package/dist/execution-lane-caps.js +43 -4
- 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 +10 -5
- package/dist/hooks/classic-stations.js +4 -4
- package/dist/hooks/command-spawn.d.ts +57 -0
- package/dist/hooks/command-spawn.js +139 -0
- package/dist/hooks/hook-llm.js +2 -2
- package/dist/hooks/hook-runner.d.ts +127 -25
- package/dist/hooks/hook-runner.js +668 -287
- 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.js +103 -60
- package/dist/http/approval-sweeps.js +55 -18
- package/dist/http/caller-trust.d.ts +77 -0
- package/dist/http/caller-trust.js +143 -0
- package/dist/http/checkpoint-ctx.d.ts +16 -16
- package/dist/http/checkpoint-ctx.js +13 -10
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/device-placement.d.ts +2 -4
- package/dist/http/device-placement.js +2 -1
- package/dist/http/dispatch.js +10 -4
- package/dist/http/durable-run-leg.d.ts +4 -32
- package/dist/http/durable-run-leg.js +34 -10
- package/dist/http/owner-access.d.ts +56 -0
- package/dist/http/owner-access.js +42 -0
- package/dist/http/principal-gate.d.ts +48 -23
- package/dist/http/principal-gate.js +39 -12
- package/dist/http/readiness.d.ts +11 -5
- package/dist/http/readiness.js +10 -3
- package/dist/http/request-guards.d.ts +16 -23
- package/dist/http/request-guards.js +30 -15
- 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 +3 -4
- package/dist/http/resume-legs.js +126 -69
- 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 +20 -4
- 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 +5 -1
- 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 +33 -106
- package/dist/http/routes/session-sync.js +15 -28
- package/dist/http/routes/sessions.js +30 -40
- package/dist/http/routes/side-query.js +6 -4
- package/dist/http/routes/tasks.js +50 -14
- package/dist/http/routes/workflows.d.ts +351 -0
- package/dist/http/routes/workflows.js +153 -119
- package/dist/http/send.d.ts +24 -3
- package/dist/http/send.js +14 -2
- package/dist/http/server.d.ts +17 -18
- package/dist/http/server.js +15 -13
- package/dist/http/stored-body-replay.js +17 -4
- package/dist/http/submit-ctx.js +4 -3
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +5 -4
- package/dist/http/wire-types.d.ts +10 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/lane-home-probe.d.ts +78 -9
- package/dist/lane-home-probe.js +78 -12
- package/dist/leader/endpoint.d.ts +4 -1
- package/dist/leader/endpoint.js +11 -10
- package/dist/limit-refusal.d.ts +17 -5
- package/dist/limit-refusal.js +4 -1
- package/dist/mcp-assertion-header.d.ts +31 -10
- package/dist/mcp-assertion-header.js +10 -3
- package/dist/mcp-tool-faces.js +1 -3
- package/dist/memory-project-layer.d.ts +37 -0
- package/dist/memory-project-layer.js +46 -0
- package/dist/memory-scope.d.ts +23 -16
- 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 +5 -0
- package/dist/model-provider.js +4 -2
- package/dist/model-route-endpoint.d.ts +8 -11
- package/dist/model-route-endpoint.js +4 -7
- 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/err-text.d.ts +6 -0
- package/dist/observability/err-text.js +18 -4
- package/dist/observability/fail-open.d.ts +35 -9
- package/dist/observability/fail-open.js +35 -9
- package/dist/observability/metrics.js +1 -0
- package/dist/observability/prompt-manifest.d.ts +3 -17
- package/dist/observability/prompt-manifest.js +45 -42
- package/dist/observability/tool-trace.js +9 -9
- 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/permission-rule-list.d.ts +1 -1
- package/dist/permission-rule-list.js +2 -2
- 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 +38 -25
- package/dist/plugins/blob-backend.js +29 -19
- 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 +14 -0
- package/dist/plugins/checkpoint-store-sql.js +20 -2
- 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/local-checkpoint-store.d.ts +2 -0
- package/dist/plugins/local-checkpoint-store.js +6 -1
- package/dist/plugins/local-session-store.d.ts +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 +110 -5
- package/dist/plugins/one-time-migrations.js +320 -8
- package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
- package/dist/plugins/org-delivery-quota-store.js +228 -0
- package/dist/plugins/pg-pool.js +39 -7
- package/dist/plugins/pg-session-storage.d.ts +17 -4
- package/dist/plugins/pg-session-storage.js +29 -6
- package/dist/plugins/remote-env-adb.d.ts +6 -12
- package/dist/plugins/remote-env-adb.js +12 -2
- package/dist/plugins/remote-env-k8s.d.ts +8 -12
- package/dist/plugins/remote-env-k8s.js +23 -5
- package/dist/plugins/remote-env-local-docker.d.ts +10 -15
- package/dist/plugins/remote-env-local-docker.js +12 -9
- package/dist/plugins/remote-env-ssh.d.ts +10 -16
- package/dist/plugins/remote-env-ssh.js +17 -11
- package/dist/plugins/run-store-sql.d.ts +16 -14
- package/dist/plugins/run-store-sql.js +22 -2
- 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 +32 -6
- package/dist/plugins/session-epoch-anchor.js +2 -3
- package/dist/plugins/session-store.d.ts +18 -8
- package/dist/plugins/session-store.js +15 -4
- package/dist/plugins/sql-driver.d.ts +74 -11
- package/dist/plugins/sql-driver.js +210 -12
- package/dist/plugins/sql-errors.d.ts +23 -0
- package/dist/plugins/sql-errors.js +21 -0
- package/dist/plugins/store-backend.d.ts +36 -1
- package/dist/plugins/store-backend.js +40 -14
- 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 +3 -2
- package/dist/plugins/tidb-session-storage.js +2 -2
- package/dist/plugins/tidb-session-store.d.ts +24 -4
- package/dist/plugins/tidb-session-store.js +28 -4
- 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/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 +7 -0
- package/dist/request-key-closure.js +9 -1
- package/dist/request-value-closure.d.ts +5 -0
- package/dist/request-value-closure.js +11 -3
- package/dist/rule-entry-list.d.ts +26 -2
- package/dist/rule-entry-list.js +72 -12
- 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 +36 -6
- package/dist/runs.d.ts +10 -9
- package/dist/runs.js +21 -3
- 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/session-error-wire.d.ts +19 -2
- package/dist/session-error-wire.js +5 -1
- 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 +15 -4
- package/dist/spec-fields.js +21 -2
- package/dist/sql-engine-posture.d.ts +3 -1
- package/dist/task-cwd.d.ts +1 -1
- package/dist/task-mcp.d.ts +3 -3
- package/dist/task-mcp.js +7 -66
- package/dist/task-settings.d.ts +89 -88
- package/dist/task-settings.js +71 -63
- package/dist/text-bidi.d.ts +0 -4
- package/dist/text-bidi.js +1 -3
- package/dist/tighten-only-seats.d.ts +150 -0
- package/dist/tighten-only-seats.js +196 -0
- package/dist/tool-approval.d.ts +303 -87
- package/dist/tool-approval.js +623 -239
- package/dist/trace/core-keyset-guard.d.ts +104 -22
- package/dist/trace/exit-seat.d.ts +28 -0
- package/dist/trace/exit-seat.js +76 -0
- package/dist/trace/ledger-events.d.ts +3 -2
- package/dist/trace/project.d.ts +80 -12
- package/dist/trace/project.js +41 -28
- 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 +298 -2
- package/dist/trace/wire-projection-faces.js +154 -13
- 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/facade.d.ts +1 -1
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/read-face.js +5 -9
- package/dist/web-admin-client/skills-mcp.js +4 -5
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +57 -9
- package/package.json +7 -3
|
@@ -22,7 +22,7 @@ import type { FlatServiceDeps } from "./http/server.js";
|
|
|
22
22
|
import type { ServiceConfig } from "./config.js";
|
|
23
23
|
import type { OwnerAwareSessionStore } from "./security.js";
|
|
24
24
|
import type { ServiceFileHistoryStore } from "./plugins/store-backend.js";
|
|
25
|
-
import { resolveStreamApprovalGate } from "./tool-approval.js";
|
|
25
|
+
import { resolveStreamApprovalGate, type ApprovalFrameFamily } from "./tool-approval.js";
|
|
26
26
|
import { type WorkspaceSyncCapability } from "./workspace-space.js";
|
|
27
27
|
import type { WorkspaceCacheCapability } from "./workspace-cache.js";
|
|
28
28
|
/** why 闭集:词 → 给运维看的一句义(诊断 / 测试读它;wire 上的拒句由各门自写)。 */
|
|
@@ -56,7 +56,8 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
56
56
|
readonly image_index_absent: "no image index is wired (SQL backends only)";
|
|
57
57
|
readonly shared_memory_store_absent: "no shared memory store provider is wired";
|
|
58
58
|
readonly org_memory_directory_absent: "no org memory directory (membership fold) is wired";
|
|
59
|
-
readonly
|
|
59
|
+
readonly org_delivery_gate_absent: "no organization delivery gate is mounted (PRINCIPAL_INBOX_ASSISTANT is unset: the deployment declares no principal-inbox consumer)";
|
|
60
|
+
readonly operator_principals_empty: `no operator roster (OPERATOR_PRINCIPALS is empty and OPERATOR_SINGLE_USER is not declared), so no caller can ever be an operator; ${string}`;
|
|
60
61
|
readonly adoption_store_absent: "no adoption log store is wired (SQL backends only)";
|
|
61
62
|
readonly memory_bundle_faces_absent: "the memory engine's governance bundle faces are not wired";
|
|
62
63
|
readonly memory_compliance_faces_absent: "the memory engine's provenance/erasure faces are not wired";
|
|
@@ -73,6 +74,7 @@ export declare const CAPABILITY_FACT_WHY: {
|
|
|
73
74
|
readonly ask_question_disabled: "AskUserQuestion live HITL is off (ASK_QUESTION_ENABLED)";
|
|
74
75
|
readonly tool_approval_disabled: "live tool approval is off (TOOL_APPROVAL_ENABLED)";
|
|
75
76
|
readonly stream_approval_disabled: "the stream approval protocol is off (STREAM_APPROVAL_ENABLED)";
|
|
77
|
+
readonly read_root_grant_posture_refused: "this is not a single-user host-lane deployment (REMOTE_EXEC=host without REQUIRE_PRINCIPAL), the only posture that honors a read-directory grant";
|
|
76
78
|
readonly background_agent_store_absent: "no background-agent store is wired";
|
|
77
79
|
readonly sendfile_ledger_absent: "no SendUserFile ledger is wired";
|
|
78
80
|
readonly workflow_engine_absent: "the workflow engine is not available on this worker";
|
|
@@ -199,6 +201,27 @@ type ActiveStreamApproval = Extract<ReturnType<typeof resolveStreamApprovalGate>
|
|
|
199
201
|
export declare function streamApproval(d: Pick<Deps, "toolApproval" | "config" | "backend" | "checkpointStore">): Fact<StreamApprovalWhy, {
|
|
200
202
|
askStore: ActiveStreamApproval["askStore"];
|
|
201
203
|
}>;
|
|
204
|
+
/**
|
|
205
|
+
* 读根授权(「Yes, and add directory」)这台部署**受理不受理** —— `GET /v1/capabilities` 的 `approvalReadRootGrant` 位,与
|
|
206
|
+
* `POST /v1/tool-approvals/:id/respond` 对应答体 `readRootGrant` 的受理门**读同一只**(位说不受理而口照收,就是「位说 X、行为不是 X」)。
|
|
207
|
+
*
|
|
208
|
+
* 判据 = 单用户 host 车道姿态 {@link cwdHonored}(与调用方 `cwd` / 附加目录同一条信任边界):授权把一个**宿主目录**加进本 run 的读目录,
|
|
209
|
+
* 只有「这台机器一个可信主人」的姿态才有这个授权的语义;多租户与云上 / 容器车道的读面另有归宿(沙箱内的读面档位见 `READ_FACE`)。
|
|
210
|
+
* 消费方的选项可见条件是**合取**:卡上有 `readRootCandidate`(逐卡位,引擎铸)∧ 本位为真。位缺席 = 老 server(不受理)。
|
|
211
|
+
* 没有别的端点按本位判可用与否 —— 它只管应答体里的这一键。
|
|
212
|
+
*/
|
|
213
|
+
export declare function readRootGrant(d: Pick<Deps, "config">): Fact<"read_root_grant_posture_refused">;
|
|
214
|
+
/**
|
|
215
|
+
* 审批开卡帧的族 —— `GET /v1/capabilities` 的 `approvalFrameFamilies` 位。**值族投影**(出形是闭集词数组,不是 `{ available }`;同
|
|
216
|
+
* `engineCapabilityBits` 一类),入参是 {@link streamApproval} **已求出的那一份事实**而不是 deps:一次请求里 `streamApproval` 位与本位读同一次判据求值
|
|
217
|
+
* (判据读活配置与 backend,两次求值在开关热改的窗口里会撕出 `streamApproval:true` 配旧族的应答;也多取一次 ask 店)。
|
|
218
|
+
* · 流内审批在场(呈卡协议上场)⇒ `["approval_request"]`;
|
|
219
|
+
* · 活卡协调器在、协议没上场(开关关 / 无 store backend / 无 park 设施)⇒ `["tool_approval"]`;
|
|
220
|
+
* · 活卡协调器缺席 ⇒ `[]`(没有审批卡可呈)。
|
|
221
|
+
* 对 why 闭集穷举:`streamApproval` 的拒因多一个 ⇒ 这里编译红,逼着给新拒因定族。三条执行腿选族读的是同一只判据的 `active`,
|
|
222
|
+
* 与本映射的「在场 ⇒ 呈卡族」是同一条规则(真腿对拍钉在 `test/stream-approval-on-e2e.test.ts`)。没有端点按它拒:它是消费方分派帧族的读点,`streamApproval` 的词义不变。
|
|
223
|
+
*/
|
|
224
|
+
export declare function approvalFrameFamilies(stream: ReturnType<typeof streamApproval>): readonly ApprovalFrameFamily[];
|
|
202
225
|
export declare function deviceLane(d: Pick<Deps, "deviceHub">): Fact<"device_hub_absent", {
|
|
203
226
|
hub: Store<"deviceHub">;
|
|
204
227
|
}>;
|
|
@@ -232,12 +255,19 @@ export declare function sharedMemoryRead(d: Pick<Deps, "sharedMemoryStore" | "or
|
|
|
232
255
|
provider: Store<"sharedMemoryStore">;
|
|
233
256
|
directory: Store<"orgMemoryDirectory">;
|
|
234
257
|
}>;
|
|
235
|
-
/**
|
|
258
|
+
/** 跨主体投递门在座(`POST /v1/principal-inbox/messages` 的可用性门与能力位 `principalInboxDelivery` 同读这一只)。门的装配本身是
|
|
259
|
+
* 一道合取(收件箱消费方声明 ∧ 耐久 mailbox ∧ org 成员目录 ∧ 配额店,缺一拒启 —— `boot/stage-06-runners.ts`),
|
|
260
|
+
* 所以这里只判「门在不在」:在 ⟺ 那四件都在。 */
|
|
261
|
+
export declare function principalInboxDelivery(d: Pick<Deps, "orgDeliveryGate">): Fact<"org_delivery_gate_absent", {
|
|
262
|
+
gate: Store<"orgDeliveryGate">;
|
|
263
|
+
}>;
|
|
264
|
+
/** 这台部署有运维名册(名单非空 ∨ 单用户声明 `OPERATOR_SINGLE_USER`;唯一读法 `operatorRosterPresent`)。没有时 `explicitOperatorOk` 对任何身份恒假
|
|
265
|
+
* ⇒ 这一族的口对谁都打不通 = 部署不可用(不是鉴权拒)。
|
|
236
266
|
*
|
|
237
267
|
* operator 族的复合事实**先判名单、再判设施**:门序是「身份 → 名单空(501)→ 授权(403)→ 设施缺席(501)」——
|
|
238
268
|
* 名单空时没有人过得了授权,不先判它,这一形就永远答成 403;设施缺席则留在授权之后答(不对非 operator 透露部署形态)。 */
|
|
239
269
|
export declare function operatorLane(d: {
|
|
240
|
-
readonly config: Pick<ServiceConfig, "operatorPrincipals">;
|
|
270
|
+
readonly config: Pick<ServiceConfig, "operatorPrincipals" | "operatorSingleUser">;
|
|
241
271
|
}): Fact<"operator_principals_empty">;
|
|
242
272
|
type AdoptionCapableBackend = Store<"backend"> & {
|
|
243
273
|
adoptionLog(): ReturnType<NonNullable<Store<"backend">["adoptionLog"]>>;
|
package/dist/capability-facts.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { buildOperatorRosterWayOut, operatorRosterPresent } from "./http/principal-gate.js";
|
|
1
2
|
import { mcpInjectionHonored } from "./task-mcp.js";
|
|
3
|
+
import { cwdHonored } from "./task-cwd.js";
|
|
2
4
|
import { resolveStreamApprovalGate } from "./tool-approval.js";
|
|
3
5
|
import { selfOrchestrationDenial } from "./task-workflow.js";
|
|
4
6
|
import { centerEntitlementSourceWired } from "./runtime-caps-resolver.js";
|
|
@@ -34,7 +36,8 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
34
36
|
image_index_absent: "no image index is wired (SQL backends only)",
|
|
35
37
|
shared_memory_store_absent: "no shared memory store provider is wired",
|
|
36
38
|
org_memory_directory_absent: "no org memory directory (membership fold) is wired",
|
|
37
|
-
|
|
39
|
+
org_delivery_gate_absent: "no organization delivery gate is mounted (PRINCIPAL_INBOX_ASSISTANT is unset: the deployment declares no principal-inbox consumer)",
|
|
40
|
+
operator_principals_empty: `no operator roster (OPERATOR_PRINCIPALS is empty and OPERATOR_SINGLE_USER is not declared), so no caller can ever be an operator; ${buildOperatorRosterWayOut()}`,
|
|
38
41
|
adoption_store_absent: "no adoption log store is wired (SQL backends only)",
|
|
39
42
|
memory_bundle_faces_absent: "the memory engine's governance bundle faces are not wired",
|
|
40
43
|
memory_compliance_faces_absent: "the memory engine's provenance/erasure faces are not wired",
|
|
@@ -51,6 +54,7 @@ export const CAPABILITY_FACT_WHY = {
|
|
|
51
54
|
ask_question_disabled: "AskUserQuestion live HITL is off (ASK_QUESTION_ENABLED)",
|
|
52
55
|
tool_approval_disabled: "live tool approval is off (TOOL_APPROVAL_ENABLED)",
|
|
53
56
|
stream_approval_disabled: "the stream approval protocol is off (STREAM_APPROVAL_ENABLED)",
|
|
57
|
+
read_root_grant_posture_refused: "this is not a single-user host-lane deployment (REMOTE_EXEC=host without REQUIRE_PRINCIPAL), the only posture that honors a read-directory grant",
|
|
54
58
|
background_agent_store_absent: "no background-agent store is wired",
|
|
55
59
|
sendfile_ledger_absent: "no SendUserFile ledger is wired",
|
|
56
60
|
workflow_engine_absent: "the workflow engine is not available on this worker",
|
|
@@ -211,6 +215,25 @@ export function streamApproval(d) {
|
|
|
211
215
|
}
|
|
212
216
|
}
|
|
213
217
|
}
|
|
218
|
+
export function readRootGrant(d) {
|
|
219
|
+
return cwdHonored(d.config) ? YES : no("read_root_grant_posture_refused");
|
|
220
|
+
}
|
|
221
|
+
export function approvalFrameFamilies(stream) {
|
|
222
|
+
if (stream.available)
|
|
223
|
+
return ["approval_request"];
|
|
224
|
+
switch (stream.why) {
|
|
225
|
+
case "tool_approval_disabled":
|
|
226
|
+
return [];
|
|
227
|
+
case "stream_approval_disabled":
|
|
228
|
+
case "store_backend_absent":
|
|
229
|
+
case "checkpoint_store_absent":
|
|
230
|
+
return ["tool_approval"];
|
|
231
|
+
default: {
|
|
232
|
+
const unhandled = stream.why;
|
|
233
|
+
throw new Error(`unhandled stream-approval why: ${JSON.stringify(unhandled)}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
214
237
|
export function deviceLane(d) {
|
|
215
238
|
return d.deviceHub !== undefined ? yes({ hub: d.deviceHub }) : no("device_hub_absent");
|
|
216
239
|
}
|
|
@@ -252,8 +275,11 @@ export function sharedMemoryRead(d) {
|
|
|
252
275
|
return no("org_memory_directory_absent");
|
|
253
276
|
return yes({ provider: d.sharedMemoryStore, directory: d.orgMemoryDirectory });
|
|
254
277
|
}
|
|
278
|
+
export function principalInboxDelivery(d) {
|
|
279
|
+
return d.orgDeliveryGate !== undefined ? yes({ gate: d.orgDeliveryGate }) : no("org_delivery_gate_absent");
|
|
280
|
+
}
|
|
255
281
|
export function operatorLane(d) {
|
|
256
|
-
return d.config
|
|
282
|
+
return operatorRosterPresent(d.config) ? YES : no("operator_principals_empty");
|
|
257
283
|
}
|
|
258
284
|
export function adoption(d) {
|
|
259
285
|
const lane = operatorLane(d);
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* S-667 —— **中心配置档位的唯一属主**:「在用的中心配置是谁的」+「换人之后降到了无中心配置档没有」+ 两态通告。
|
|
3
|
+
*
|
|
4
|
+
* ## 律
|
|
5
|
+
* 凭证身份(凭据文件里的主体,`center-credential.ts` 的 `identity`)变化的那一刻,server 自己:
|
|
6
|
+
* 1. 把在用的中心配置降到「无中心配置」档 —— 每个中心下发的热面回 env 底、中心提示词层撤下、Runner 的模型表换回 env 表;
|
|
7
|
+
* 2. 当场发起一次拉取(不等下一个 60s 拍);
|
|
8
|
+
* 3. 通告 {@link CenterIdentityNoticeCode} `center_identity_demoted`;新身份的候选落地 ⇒ 通告 `center_identity_landed`。
|
|
9
|
+
* 拉取成功之前**不回退**到上一个人的任何东西(盘上 LKG 是按身份分箱的,新身份的箱里没有上一个人的;内存里的在用候选在降档时已清)。
|
|
10
|
+
* 不采「壳重启引擎」:读凭据文件的那一刻引擎自己就判得出,壳只能猜;本机引擎多会话共享,重启会打断别的会话正在跑的 run。
|
|
11
|
+
*
|
|
12
|
+
* ## 本模块只管状态与词,不管动作
|
|
13
|
+
* 降档的动作(换活配置、换 Runner 席、撤提示词层、拉取)在 `boot/web-admin.ts`,那里是活配置与单飞拍的属主;本模块是纯状态机:
|
|
14
|
+
* · `committed(identity)` —— 一份中心候选(或「无中心配置」候选自己,身份缺席)提交了:记下在用配置的身份;降档态下第一份带身份的提交 = 换上了;
|
|
15
|
+
* · `drifted(identity)` —— 此刻凭证的身份与参照身份(在用配置的,或已降档时在等的)不一致吗(只有存在参照且「凭证身份读得出」才可能为真);
|
|
16
|
+
* · `demote(awaiting)` / `retarget(awaiting)` —— 记下降档、改在等的身份;
|
|
17
|
+
* · `notice()` —— 最近一条通告(`/health.centerIdentityNotice` 的取值口读它)。
|
|
18
|
+
*
|
|
19
|
+
* ## 通告的面
|
|
20
|
+
* 通告是**最近一条**,不是事件日志:`/health.centerIdentityNotice = { code, message, at, retained? }`(无鉴权面 —— 只有闭集码、冻结句、时刻,
|
|
21
|
+
* 不带身份、不带令牌、不带路径);从未换过人 ⇒ 键缺席。消费端按 `at` 判断「这一条我转述过没有」。日志轴另有同名事件
|
|
22
|
+
* (`center_identity_demoted` warn / `center_identity_landed` info)。
|
|
23
|
+
* 这两只码**不在** core 的 `EngineNotice` 码册里(那是 core 的闭集,受众与归属键由 core 定;进该册要 core 加行)—— 它们是本服务自铸的 `/health` 值,
|
|
24
|
+
* 登记在 `trace/self-minted-wire.ts` 的 `centerIdentityNotice`,契约 §0.4 成文。
|
|
25
|
+
*/
|
|
26
|
+
import type { ConfigApplyGroup } from "./web-admin-client/apply-ledger.js";
|
|
27
|
+
/** 两态通告码(闭集)。新增一个 = `CENTER_IDENTITY_NOTICE_MESSAGE` 与 `SELF_MINTED_WIRE.centerIdentityNotice` 当场编译红。 */
|
|
28
|
+
export declare const CENTER_IDENTITY_NOTICE_CODES: readonly ["center_identity_demoted", "center_identity_landed"];
|
|
29
|
+
export type CenterIdentityNoticeCode = (typeof CENTER_IDENTITY_NOTICE_CODES)[number];
|
|
30
|
+
/**
|
|
31
|
+
* 每个码的**冻结句**(wire 可见 —— `test/api-notice-text-freeze.test.ts` §8 逐字冻;改一个字节要同步契约与消费端)。
|
|
32
|
+
* 句子是定句:不带身份、不带版本号、不带路径,免鉴权面上读到它不泄露任何东西。映射型逐码穷举。
|
|
33
|
+
*/
|
|
34
|
+
export declare const CENTER_IDENTITY_NOTICE_MESSAGE: {
|
|
35
|
+
readonly center_identity_demoted: "The center credential now belongs to another account: this engine dropped the previous account's center configuration and runs on its base configuration (no center layer) until the new account's configuration is pulled.";
|
|
36
|
+
readonly center_identity_landed: "The new account's center configuration was pulled and is now in force.";
|
|
37
|
+
};
|
|
38
|
+
/** 一条通告(wire 形:`/health.centerIdentityNotice` 就是这个对象)。 */
|
|
39
|
+
export interface CenterIdentityNotice {
|
|
40
|
+
readonly code: CenterIdentityNoticeCode;
|
|
41
|
+
readonly message: string;
|
|
42
|
+
/** 铸这条通告的时刻(ms epoch)。 */
|
|
43
|
+
readonly at: number;
|
|
44
|
+
/**
|
|
45
|
+
* 只在 `center_identity_demoted` 上、且非空时在场:降档**没能降到底**的组 —— 该组被整拒(例:env 的审批名单在这台部署上无处可服务),活值仍是上一个人下发的。
|
|
46
|
+
* 冻结句说「回了基础配置」,这一键让它对这几组如实:成员是世代账的组闭集(`ConfigApplyGroup`)。缺席 = 每个热面都已回 env 底。
|
|
47
|
+
*/
|
|
48
|
+
readonly retained?: readonly ConfigApplyGroup[];
|
|
49
|
+
}
|
|
50
|
+
export interface CenterConfigTier {
|
|
51
|
+
/** 一份候选提交了(含部分应用)。`identity` = 拉到它的凭证身份;缺席 = 本地腿候选 / 「无中心配置」候选自己(没有中心配置在服务)。
|
|
52
|
+
* 降档态下第一份带身份的提交 ⇒ 铸并返回 `center_identity_landed`;其余返回 undefined。 */
|
|
53
|
+
committed(identity: string | undefined): CenterIdentityNotice | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* 此刻凭证的身份与「参照身份」不一致吗 —— 参照 = 在用中心配置的身份;已降档则是降档在等的那个身份。没有参照(没有中心配置在服务、也没降过档)/
|
|
56
|
+
* 凭证身份读不出(`undefined`)⇒ 恒假:降无可降,读不出不是换了人。
|
|
57
|
+
*/
|
|
58
|
+
drifted(identity: string | undefined): boolean;
|
|
59
|
+
/** 记下降档(此后没有中心配置在服务,在等 `awaiting` 这个身份的候选)并铸 `center_identity_demoted`;`retained` = 没能降到底的组(空 / 缺席 = 全降到底)。 */
|
|
60
|
+
demote(awaiting: string, retained?: readonly ConfigApplyGroup[]): CenterIdentityNotice;
|
|
61
|
+
/** 已降档态下凭证又换了人:只改「在等谁」,不再铸通告(还是同一次降档 —— 新身份的候选没落地)。 */
|
|
62
|
+
retarget(awaiting: string): void;
|
|
63
|
+
/** 最近一条通告;从未铸过 ⇒ undefined。 */
|
|
64
|
+
notice(): CenterIdentityNotice | undefined;
|
|
65
|
+
/** 是否在降档态(降过、新身份的候选还没落地)。 */
|
|
66
|
+
isDemoted(): boolean;
|
|
67
|
+
}
|
|
68
|
+
export declare function createCenterConfigTier(now?: () => number): CenterConfigTier;
|
|
69
|
+
//# sourceMappingURL=center-config-tier.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const CENTER_IDENTITY_NOTICE_CODES = ["center_identity_demoted", "center_identity_landed"];
|
|
2
|
+
export const CENTER_IDENTITY_NOTICE_MESSAGE = {
|
|
3
|
+
center_identity_demoted: "The center credential now belongs to another account: this engine dropped the previous account's center configuration and runs on its base configuration (no center layer) until the new account's configuration is pulled.",
|
|
4
|
+
center_identity_landed: "The new account's center configuration was pulled and is now in force.",
|
|
5
|
+
};
|
|
6
|
+
export function createCenterConfigTier(now = Date.now) {
|
|
7
|
+
let inForce;
|
|
8
|
+
let awaiting;
|
|
9
|
+
let demoted = false;
|
|
10
|
+
let last;
|
|
11
|
+
const mint = (code, retained = []) => {
|
|
12
|
+
last = { code, message: CENTER_IDENTITY_NOTICE_MESSAGE[code], at: now(), ...(retained.length > 0 ? { retained: [...retained] } : {}) };
|
|
13
|
+
return last;
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
committed(identity) {
|
|
17
|
+
inForce = identity;
|
|
18
|
+
if (!demoted || identity === undefined)
|
|
19
|
+
return undefined;
|
|
20
|
+
demoted = false;
|
|
21
|
+
awaiting = undefined;
|
|
22
|
+
return mint("center_identity_landed");
|
|
23
|
+
},
|
|
24
|
+
drifted(identity) {
|
|
25
|
+
const reference = demoted ? awaiting : inForce;
|
|
26
|
+
return reference !== undefined && identity !== undefined && identity !== reference;
|
|
27
|
+
},
|
|
28
|
+
demote(next, retained) {
|
|
29
|
+
inForce = undefined;
|
|
30
|
+
awaiting = next;
|
|
31
|
+
demoted = true;
|
|
32
|
+
return mint("center_identity_demoted", retained);
|
|
33
|
+
},
|
|
34
|
+
retarget(next) {
|
|
35
|
+
if (demoted)
|
|
36
|
+
awaiting = next;
|
|
37
|
+
},
|
|
38
|
+
notice: () => last,
|
|
39
|
+
isDemoted: () => demoted,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=center-config-tier.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** `checkpointId` 的长度上界(见本文件头注第 2 条)。 */
|
|
2
|
+
export declare const MAX_CHECKPOINT_ID_CHARS = 128;
|
|
3
|
+
/** 持久层读出的 `checkpointId` 过信任边界:是串、非空、不超长、不含 token(大小写不敏感)⇒ 原值;否则 `undefined`。判据全文见本文件头注。 */
|
|
4
|
+
export declare function trustedCheckpointId(raw: unknown, token: unknown): string | undefined;
|
|
5
|
+
/** 带 `checkpointId` 当 join 键的两类 durable 读面(计数 detail 的 `face`)。 */
|
|
6
|
+
export type DurableCheckpointFace = "approvals-queue" | "assistant-inbox";
|
|
7
|
+
/**
|
|
8
|
+
* durable 读面的一行 → 它的身份片段,**由调用方原样展开进行投影**(`...durableRowIdentity(face, raw, token)`):读得出可信值 ⇒ `{ checkpointId }`;
|
|
9
|
+
* 读不出 ⇒ `{}`(这一行**照列**,键缺席)+ 计一次(见本文件头注「durable 面的 join 键」)。
|
|
10
|
+
* `raw === undefined` = 行上没有这一格(`why=absent`,老行);在场却没过信任边界(非串 / 空串 / 超长 / 含 token / 读不出)= `why=untrusted`。
|
|
11
|
+
* 三处读面(两只店的 `listPending` + 收件 handler)只经这一只 —— 读法、计数、缺席形各只有一份。
|
|
12
|
+
*/
|
|
13
|
+
export declare function durableRowIdentity(face: DurableCheckpointFace, raw: unknown, token: unknown): {
|
|
14
|
+
readonly checkpointId?: string;
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=checkpoint-identity.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { recordFailOpen } from "./observability/fail-open.js";
|
|
2
|
+
export const MAX_CHECKPOINT_ID_CHARS = 128;
|
|
3
|
+
export function trustedCheckpointId(raw, token) {
|
|
4
|
+
if (typeof raw !== "string" || raw === "" || raw.length > MAX_CHECKPOINT_ID_CHARS)
|
|
5
|
+
return undefined;
|
|
6
|
+
const secret = token === undefined || token === null ? "" : String(token).toLowerCase();
|
|
7
|
+
if (secret !== "" && raw.toLowerCase().includes(secret))
|
|
8
|
+
return undefined;
|
|
9
|
+
return raw;
|
|
10
|
+
}
|
|
11
|
+
export function durableRowIdentity(face, raw, token) {
|
|
12
|
+
const id = trustedCheckpointId(raw, token);
|
|
13
|
+
if (id === undefined) {
|
|
14
|
+
recordFailOpen("server.approvals.durable-row-checkpoint-id-missing", `face=${face} why=${raw === undefined ? "absent" : "untrusted"}`);
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
return { checkpointId: id };
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=checkpoint-identity.js.map
|
package/dist/config-catalog.d.ts
CHANGED
|
@@ -93,7 +93,23 @@ export interface ConfigCatalogRowCenter {
|
|
|
93
93
|
/** center 写**现在真的在生效**(在管 ∧ 未被 env 占位压住;env-wins 族 env 占位 ⇒ false = ⚪ 成因 a)。 */
|
|
94
94
|
readonly effectiveNow: boolean;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
/**
|
|
97
|
+
* 行上**对 `effectiveValue` 的判词位**(闭集;S-527 收成一族)—— 每一位**只在为真时铸 `true`、恒不铸 `false`**,缺席 = 这一格没有这件事
|
|
98
|
+
* (不是「不知道」)。净化器({@link sanitizeValue})一次读出值与判词,行投影原样铺平 —— 判词位只有这一种形,第三个判词位加进本闭集即受同一条约束。
|
|
99
|
+
* · `effectiveValueInvalid`(S-100,additive)—— 本行的实算值**落在它自己宣告的回显闭集之外**(`echoWords ?? enumValues`,S-201①),
|
|
100
|
+
* 或它的实算腿回了一个本行没有声明映射的布尔。在场时 `effectiveValue` 恒 `null`:回显一个集外值等于目录在教消费方写一个写回去就非法的词,
|
|
101
|
+
* 而**静默丢**会让「配错了」与「真的没设」在 wire 上同形([ref] 响亮臂)。只服务闭集族(`type:"enum"`)。
|
|
102
|
+
* · `effectiveValueWithheld`(S-527,additive)—— `type:"url"` 行:展示铸点对这一格(单值)或其中任一项(列表)判了扣下(`failedClosed`:
|
|
103
|
+
* 位置律本会显示的一段 —— 整段 query / 一个路径段 —— 因为里面有一条凭据形而不出门)。判决的属主是铸点,目录不另判;
|
|
104
|
+
* 标准位置律(userinfo 落地、query 每个值成记号)对每一行同样成立,不是扣下;值整只成占位 = 这一行的展示律显示不了这个值
|
|
105
|
+
* (通用 url 行:不是层级式 URL;两只出网代理行的展示律更窄 —— 只显示 `scheme://host[:port]`,形不干净整只占位,`outbound-dispatcher.ts` `displayProxyUrl`),也不是本位。
|
|
106
|
+
*/
|
|
107
|
+
export type CatalogValueVerdict = "effectiveValueInvalid" | "effectiveValueWithheld";
|
|
108
|
+
/** 判词位的行内形({@link CatalogValueVerdict} 每一员都是只取 `true` 的可选键)。 */
|
|
109
|
+
export type CatalogValueVerdicts = {
|
|
110
|
+
readonly [K in CatalogValueVerdict]?: true;
|
|
111
|
+
};
|
|
112
|
+
export interface ConfigCatalogRow extends CatalogValueVerdicts {
|
|
97
113
|
readonly name: string;
|
|
98
114
|
readonly domain: CatalogDomain;
|
|
99
115
|
readonly type: CatalogValueType;
|
|
@@ -105,15 +121,6 @@ export interface ConfigCatalogRow {
|
|
|
105
121
|
readonly staticDefault?: string;
|
|
106
122
|
readonly derivedDefaultNote?: string;
|
|
107
123
|
readonly effectiveValue: CatalogValue;
|
|
108
|
-
/**
|
|
109
|
-
* S-100(additive;**只在真非法时铸,恒不铸 `false`**)—— 本行的实算值**落在它自己宣告的
|
|
110
|
-
* 回显闭集之外**(`echoWords ?? enumValues`,S-201①),或它的实算腿回了一个本行没有声明映射的布尔。
|
|
111
|
-
*
|
|
112
|
-
* 在场时 `effectiveValue` 恒 `null`:回显一个集外值等于目录在教消费方写一个写回去就非法的词,
|
|
113
|
-
* 而**静默丢**会让「配错了」与「真的没设」在 wire 上同形([ref] 响亮臂)。
|
|
114
|
-
* 缺席 = 这一格没问题(不是「不知道」)。
|
|
115
|
-
*/
|
|
116
|
-
readonly effectiveValueInvalid?: true;
|
|
117
124
|
readonly valueClass: "plain" | "secret" | "opaque";
|
|
118
125
|
readonly danger: readonly CatalogDangerAxis[];
|
|
119
126
|
readonly center?: ConfigCatalogRowCenter;
|
package/dist/config-catalog.js
CHANGED
|
@@ -5,15 +5,17 @@ import { CENTER_CREDENTIAL_RENEW_LEAD_DEFAULT_MS, CENTER_CREDENTIAL_RENEW_LEAD_M
|
|
|
5
5
|
import { SANDBOX_IPV6_DEFAULT, SANDBOX_IPV6_WORDS } from "./sandbox-egress-policy.js";
|
|
6
6
|
import { WORKSPACE_CACHE_DEFAULT, WORKSPACE_CACHE_MOUNT_DEFAULT, WORKSPACE_CACHE_SIZE_DEFAULT, WORKSPACE_CACHE_WORDS } from "./workspace-cache.js";
|
|
7
7
|
import { WORKSPACE_PERSIST_DEFAULT, WORKSPACE_PERSIST_WORDS, WORKSPACE_SNAPSHOT_KEEP_DEFAULT, WORKSPACE_SNAPSHOT_KEEP_RANGE, WORKSPACE_SNAPSHOT_TIMEOUT_MS_DEFAULT, WORKSPACE_SNAPSHOT_TIMEOUT_MS_RANGE } from "./workspace-space.js";
|
|
8
|
+
import { APPROVAL_ASK_RETENTION_DEFAULT_MS, APPROVAL_ASK_RETENTION_FLOOR_MS } from "./approval-ask-retention.js";
|
|
8
9
|
import { LIVENESS_MS_DEFAULT } from "./exec-bounds.js";
|
|
9
10
|
import { THINKING_FORMATS } from "./model-compat.js";
|
|
10
|
-
import { AUTO_MODE_CLASSIFIER_TIMEOUT_BOUNDS, CENTER_BASE_URL_RULE, CONFIG_PROVIDER_WORDS, DRAIN_SECOND_SIGNAL_MIN_GAP_BOUNDS, DRAIN_SECOND_SIGNAL_MIN_GAP_DEFAULT_MS, FIRST_BYTE_TIMEOUT_BOUNDS, FLEET_LEASE_OUTAGE_MAX_DEFAULT_MS, RESILIENCE_DEFAULTS, TASK_WRITE_FACE_ESCALATIONS } from "./config-types.js";
|
|
11
|
+
import { AUTO_MODE_CLASSIFIER_TIMEOUT_BOUNDS, CENTER_BASE_URL_RULE, CONFIG_PROVIDER_WORDS, DRAIN_SECOND_SIGNAL_MIN_GAP_BOUNDS, DRAIN_SECOND_SIGNAL_MIN_GAP_DEFAULT_MS, DEVICE_DELIVERY_TIMEOUT_BOUNDS, DEVICE_EXEC_TIMEOUT_BOUNDS, FIRST_BYTE_TIMEOUT_BOUNDS, FLEET_LEASE_OUTAGE_MAX_DEFAULT_MS, RESILIENCE_DEFAULTS, TASK_WRITE_FACE_ESCALATIONS } from "./config-types.js";
|
|
12
|
+
import { DEVICE_HELLO_ACK_BOUNDS } from "./device-ws-protocol.js";
|
|
11
13
|
import { webSearchProviderFromEnv, WEB_SEARCH_PROVIDERS } from "./plugins/web-search.js";
|
|
12
14
|
import { AUTONOMY_MODES } from "./runtime-governance.js";
|
|
13
15
|
import { REMOTE_EXEC_PROVIDER_WORDS } from "./execution-lane-caps.js";
|
|
14
16
|
import { MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS } from "@sema-agent/settings-schema/execution-lanes";
|
|
15
17
|
import { MODEL_PROVIDER_WORDS } from "./model-provider.js";
|
|
16
|
-
import {
|
|
18
|
+
import { buildDisplaySafeUrlChecked } from "./trace/redact.js";
|
|
17
19
|
import { describeAllowlistPostures } from "./env-name-allowlist-knobs.js";
|
|
18
20
|
import { buildOutboundProxyPosture } from "./outbound-dispatcher.js";
|
|
19
21
|
import { modelImageInput, modelReasoningDecl } from "./model-select.js";
|
|
@@ -64,6 +66,7 @@ export const CONFIG_CATALOG = [
|
|
|
64
66
|
r("ANTHROPIC_CACHE_BREAKPOINTS", "modelPlane", "boolean", "Anthropic 路线 prompt-cache breakpoints 开关", { staticDefault: "true" }),
|
|
65
67
|
r("ANTHROPIC_MAX_RETRIES", "modelPlane", "number", "Anthropic 路线 SDK 每次调用重试上限", { derivedDefaultNote: "缺席 ⇒ 不传引擎,core/SDK 默认当家" }),
|
|
66
68
|
r("ANTHROPIC_VERSION", "modelPlane", "string", "Anthropic API version 头(缺省由 SDK 定)"),
|
|
69
|
+
r("APPROVAL_ASK_RETENTION_MS", "approval", "number", `审批账本(问账 SQL / local 文件两形 + local 审计账)的保留窗(ms):一问结了且最后一次动静早于 now − 本值 ⇒ 维护 tick 整问删掉(没结的问永不按龄删;留下的记录逐字节不变;删了就打 approval_ask_retention_swept 读数行);0 = 不删(永久保留);正值下限 ${APPROVAL_ASK_RETENTION_FLOOR_MS}(低于即钳 + 告警);负值 / 非整数拒启`, { staticDefault: String(APPROVAL_ASK_RETENTION_DEFAULT_MS), danger: DATA, configKey: "approvalAskRetentionMs" }),
|
|
67
70
|
r("APPROVAL_AUTO_BUDGET", "approval", "number", "每 run-leg 自动放行的普通门控工具调用数上限(0=关;防审批循环的熔断,不是安全 ask 的帽)", { staticDefault: "0", danger: SEC, configKey: "approvalAutoBudget" }),
|
|
68
71
|
r("APPROVAL_DENY", "approval", "csv", "始终拒绝的工具名单(装配期拒不可匹配名)", { danger: SEC, configKey: "approvalDeny" }),
|
|
69
72
|
r("APPROVAL_GRANT", "approval", "csv", "运维的 allow 表(引擎 allow 层的部署成员 RunnerDeps.allowedTools,每只 Runner 同一席:HTTP 提交 / 续跑 / 停驻赎回 / run-local / leader 一律;规则文法 = 引擎的:工具名 / mcp__<server>__* / a2a__<peer>__* / Bash(<命令>) / Bash(<前缀>:*) / Read(//<dir>/**);命中 = 免问,清普通问与没人表态两类,内置工具也在内;清不掉任何一层的 deny / ask 规则、APPROVAL_NEVER_AUTO、shell 地板、写保护、治理、hook 的问、plan;不是白名单;引擎读成空的条目 / 服务器段铸不出 ⇒ 拒启)", { danger: SEC, configKey: "approvalGrant", derivedDefaultNote: "缺席 = 空表(本层不表态,折叠与未设逐字同)" }),
|
|
@@ -103,6 +106,7 @@ export const CONFIG_CATALOG = [
|
|
|
103
106
|
r("CONFIG_LKG_ENABLED", "integrations", "boolean", "last-known-good 配置盘缓存读写开关(仅远程 provider 有意义)", { staticDefault: "true", configKey: "configLkgEnabled" }),
|
|
104
107
|
r("CONFIG_LKG_PATH", "integrations", "path", "LKG 落盘路径(设了 ⇒ 派生一条读拒行 = 这条绝对路径:根锚定,只守这一个文件,经符号链接的目录时引擎沿链连目标一起守;大小写不敏感;用户仓里同尾的路径读得到;空串拒启)", { derivedDefaultNote: "缺席 ⇒ 配置根(SEMA_CONFIG_DIR,缺省 ~/.sema)下按 worker + 凭证身份分箱派生", configKey: "configLkgPath" }),
|
|
105
108
|
r("CONFIG_LOCAL_DIR", "integrations", "path", "本地配置源根(config.d/<domain>.json);兼作数据根回落链一环", { configKey: "configLocalDir", danger: DATA }),
|
|
109
|
+
r("CONFIG_LOCAL_OWNER_UID", "integrations", "number", "本地配置源读之前的目录信任判官多信的那一个属主 uid(本服务用户与 root 之外 —— userns-remap 的 bind-mount、运维用户持有的配置);只放宽属主判据,组 / 他人可写照拒;形错拒启", { configKey: "configLocalOwnerUid", danger: SEC, derivedDefaultNote: "缺席 = config.d 路径上的目录与文档只许属于本服务用户或 root" }),
|
|
106
110
|
r("CONFIG_PROVIDER", "integrations", "enum", "配置源双模选择(闭集,逐字比较;认不出的词 ⇒ 拒启,S-841)", { enumValues: CONFIG_PROVIDER_WORDS, derivedDefaultNote: `缺席:${WEB_ADMIN_ENV.url} 在场 ⇒ remote,否则纯 env(无管道)`, configKey: "configProvider" }),
|
|
107
111
|
r("CONFIG_REQUIRE_ROSTER", "integrations", "boolean", "远程 registry 非 dryRun 时布防 ready 门:roster 未落地 ⇒ 计费提交 503 + /health ready:false(严格 'true')", { staticDefault: "false" }),
|
|
108
112
|
r("CORS_ORIGIN", "auth", "csv", "CORS 白名单(单值 v1 兼容回显;多值按请求 Origin 匹配 + Vary;未设=无 CORS 面)", { danger: SEC, configKey: "corsOrigins" }),
|
|
@@ -114,12 +118,12 @@ export const CONFIG_CATALOG = [
|
|
|
114
118
|
r("DEFAULT_SCENARIO", "integrations", "string", "出厂缺省场景(编码产品出厂态;通用中性 persona 用 default 显式选回);必须是本部署在册的场景名(内建 ∪ web-admin 声明的),不在册 ⇒ 拒启", { staticDefault: "code", configKey: "defaultScenario" }),
|
|
115
119
|
r("DELEGATION_MAX_CONCURRENT", "orchestration", "number", "委派入口并发帽", { derivedDefaultNote: "缺席 ⇒ 不铸键,core 自缺省(CC parity 20)" }),
|
|
116
120
|
r("DELEGATION_MAX_PER_SESSION", "orchestration", "number", "委派入口每会话累计帽", { derivedDefaultNote: "缺席 ⇒ 不铸键,core 自缺省(CC parity 200)" }),
|
|
117
|
-
r("DEVICE_DELIVERY_TIMEOUT_MS", "orchestration", "number",
|
|
121
|
+
r("DEVICE_DELIVERY_TIMEOUT_MS", "orchestration", "number", `device 车道等在途槽上限(ms;到期 device.busy;0 = 槽满时只给一个定时器拍、随即 busy;须为 [${DEVICE_DELIVERY_TIMEOUT_BOUNDS.min}, ${DEVICE_DELIVERY_TIMEOUT_BOUNDS.max}] 内规范十进制整数,其余拒启)`, { derivedDefaultNote: "缺席 ⇒ adapter 默认 10s" }),
|
|
118
122
|
r("DEVICE_ENROLL_TOKEN_TTL_SEC", "orchestration", "number", "enrollment token 有效期(整秒,自 DB now 起算;域 [1,86400],坏值拒启)", { danger: SEC, derivedDefaultNote: "缺席 ⇒ 签发点默认 900(15min)" }),
|
|
119
|
-
r("DEVICE_EXEC_TIMEOUT_MS", "orchestration", "number",
|
|
120
|
-
r("DEVICE_MAX_INFLIGHT_PER_DEVICE", "orchestration", "number",
|
|
123
|
+
r("DEVICE_EXEC_TIMEOUT_MS", "orchestration", "number", `device 车道指令级默认超时(ms;命令自带 timeout 时用命令自己的,没自带的用本值;须为 [${DEVICE_EXEC_TIMEOUT_BOUNDS.min}, ${DEVICE_EXEC_TIMEOUT_BOUNDS.max}] 内规范十进制整数,其余拒启 —— 0 会让每条没自带超时的指令在派发时被汇聚端拒)`, { derivedDefaultNote: "缺席 ⇒ adapter 默认 1800s" }),
|
|
124
|
+
r("DEVICE_MAX_INFLIGHT_PER_DEVICE", "orchestration", "number", `per-device 在途上限(超额云侧排队;原值进 helloAck.maxInflight;须为 ≥ ${DEVICE_HELLO_ACK_BOUNDS.maxInflight.min} 的规范十进制整数,其余拒启 —— 0 会让每次派发都 device.busy)`, { derivedDefaultNote: "缺席 ⇒ 4(§11-O3 裁定值)" }),
|
|
121
125
|
r("DEVICE_MAX_PREAUTH_PER_REMOTE", "orchestration", "number", "未鉴权握手的 per-remote 并发帽(正整数或字面 off;XFF/NAT 形用 off+全局帽)", { danger: SEC, derivedDefaultNote: "缺席 ⇒ 8" }),
|
|
122
|
-
r("DEVICE_RECONNECT_GRACE_MS", "orchestration", "number",
|
|
126
|
+
r("DEVICE_RECONNECT_GRACE_MS", "orchestration", "number", `device 断连后在途不判丢的窗(ms;同 epoch 重连续接;原值进 helloAck.reconnectGraceMs;须为 [${DEVICE_HELLO_ACK_BOUNDS.reconnectGraceMs.min}, ${DEVICE_HELLO_ACK_BOUNDS.reconnectGraceMs.max}] 内规范十进制整数,其余拒启)`, { derivedDefaultNote: "缺席 ⇒ adapter 默认 120s" }),
|
|
123
127
|
r("DEVICE_SUPERSEDE", "orchestration", "enum", "同 deviceId 二连的顶替策略", { enumValues: ["stale_only", "deny"], staticDefault: "stale_only", danger: SEC }),
|
|
124
128
|
r("DIRECT_APPROVAL_DOOR", "approval", "boolean", "直连 /decide 门(无 BFF 的桌面/CLI 客户端;开 ⇒ 要求签名 JWT+HMAC 信封,principal 头降级不可信)", { staticDefault: "false", danger: SEC, configKey: "directApprovalDoor" }),
|
|
125
129
|
r("DOCKER_COMMAND_TIMEOUT_MS", "orchestration", "number", "local-docker 车道单命令超时(ms)"),
|
|
@@ -257,12 +261,12 @@ export const CONFIG_CATALOG = [
|
|
|
257
261
|
r("MEMORY_ORG_UNAVAILABLE_BACKOFF_MS", "memory", "number", "org 目录取数失败退避窗(ms)", { staticDefault: "10000", configKey: "memoryOrgUnavailableBackoffMs" }),
|
|
258
262
|
r("MEMORY_PERSISTENCE_CAPABLE", "memory", "enum", "本部署能否把「记住 X」落到持久处的自我声明(三态;未知词拒启)", { enumValues: ["on", "off"], derivedDefaultNote: "缺席 ⇒ 键不上 TaskSpec,core 按 roster 推断", configKey: "memoryPersistenceCapable", booleanEnum: { true: "on", false: "off" } }),
|
|
259
263
|
r("MEMORY_PROVENANCE", "memory", "enum", "已暴露会话的记忆写处置(carry=带 origin 标记照写;off=关)", { enumValues: ["off", "carry"], staticDefault: "carry", danger: SEC, configKey: "memoryProvenance" }),
|
|
260
|
-
r("MEMORY_SCOPE", "memory", "string", "单用户部署的记忆 scope 名", { derivedDefaultNote: "缺席:引擎开 ∧ 单用户 ⇒ local;其余 ⇒ 缺席(记忆暗)", configKey: "memoryScope" }),
|
|
264
|
+
r("MEMORY_SCOPE", "memory", "string", "单用户部署的记忆 scope 名(全局层;也是项目层 `userrepo:<属主>/…` 的属主 —— `user:<P>` 取 P,其余取名字本身;本服务铸的项目键族拒启)", { derivedDefaultNote: "缺席:引擎开 ∧ 单用户 ⇒ local;其余 ⇒ 缺席(记忆暗)", configKey: "memoryScope" }),
|
|
261
265
|
r("MEMORY_SYNC_MAX_PULL_ENTRIES", "memory", "number", "TOC 同步单轮 pull 条数帽(设了必须 ≥1 整数)", { derivedDefaultNote: "缺席 ⇒ 键缺席,core 默认" }),
|
|
262
266
|
r("MEMORY_SYNC_MAX_PUSH_ENTRIES", "memory", "number", "TOC 同步单轮 push 条数帽(设了必须 ≥1 整数)", { derivedDefaultNote: "缺席 ⇒ 键缺席,core 默认" }),
|
|
263
|
-
r("MEMORY_SYNC_SCOPE", "memory", "string", "TOC 同步 scope 覆写", { derivedDefaultNote: "缺席 ⇒ = MEMORY_SCOPE,仅当它已是 typed 键;非 typed 键拒启(S-964)" }),
|
|
267
|
+
r("MEMORY_SYNC_SCOPE", "memory", "string", "TOC 同步 scope 覆写(本服务铸的项目键族 `userrepo:` / `repo:` 拒启:项目层由同步腿按属主自己选)", { derivedDefaultNote: "缺席 ⇒ = MEMORY_SCOPE,仅当它已是 typed 键;非 typed 键拒启(S-964)" }),
|
|
264
268
|
r("MEMORY_SYNC_TOKEN", "memory", "secret", "TOC 同步中心面的 Bearer(URL 设了它必须在,半配拒启)", { danger: SEC }),
|
|
265
|
-
r("MEMORY_SYNC_URL", "memory", "url", "TOC 同步中心地址(设了=开;file 记忆形专用,DB
|
|
269
|
+
r("MEMORY_SYNC_URL", "memory", "url", "TOC 同步中心地址(设了=开;file 记忆形专用,DB 后端配了拒启;同步覆盖同步层与同属主的项目层 `userrepo:<属主>/…` ⇒ 同步层与 MEMORY_SCOPE 同属主时单用户任务照常按项目键控并随同步推拉;不同属主 ⇒ 写家落全局层,启动通知 `memory_project_scope_yields_to_sync`)"),
|
|
266
270
|
r("METRICS_TOKEN", "observability", "secret", "/metrics 只读令牌", { danger: SEC }),
|
|
267
271
|
r("MINIO_ACCESS_KEY", "store", "secret", "对象存储 access key(快照 blob/leader 工作区/公链签发共用)", { danger: SEC }),
|
|
268
272
|
r("MINIO_BUCKET", "store", "string", "leader 工作区快照桶", { derivedDefaultNote: "缺席 ⇒ workspaces" }),
|
|
@@ -351,7 +355,8 @@ export const CONFIG_CATALOG = [
|
|
|
351
355
|
r("MYSQL_PORT", "store", "number", "MySQL 协议端口", { staticDefault: "3306" }),
|
|
352
356
|
r("MYSQL_USER", "store", "string", "MySQL 协议用户", { danger: DATA }),
|
|
353
357
|
r("NO_PROXY", "limitsHttp", "csv", "不走代理的目标(小写 `no_proxy` 同认且优先);语法 = undici 的:逗号或空白分隔,`host` 精确且含其子域、`.host` / `*.host` 后缀、`host:port` 限端口、`*` 全直连;**回环 / 未指定地址目标无论写没写都直连**(本仓的无条件规则,不是 NO_PROXY 的一条);boot 冻结", { danger: SEC, derivedDefaultNote: "缺席 ⇒ 除回环外一律按 HTTP(S)_PROXY 走", resolve: (_c, env) => buildOutboundProxyPosture(env).noProxy }),
|
|
354
|
-
r("OPERATOR_PRINCIPALS", "auth", "csv", "operator 名单(
|
|
358
|
+
r("OPERATOR_PRINCIPALS", "auth", "csv", "operator 名单(全部运维面同一条读法:名单内的验过主体是运维;空名单 = 谁都不是;与 OPERATOR_SINGLE_USER 互斥)", { danger: SEC, configKey: "operatorPrincipals" }),
|
|
359
|
+
r("OPERATOR_SINGLE_USER", "auth", "boolean", "单用户形当自己运维的显式声明(true ⇒ 这台部署的每个调用方在全部运维面都是运维;只在 REQUIRE_PRINCIPAL 未开且 OPERATOR_PRINCIPALS 为空时成立,否则拒启;起服冻结)", { staticDefault: "false", danger: SEC, configKey: "operatorSingleUser" }),
|
|
355
360
|
r("OTEL_EXPORTER_OTLP_ENDPOINT", "observability", "url", "OTLP 出口(设了=开 otel)"),
|
|
356
361
|
r("OTEL_EXPORTER_OTLP_HEADERS", "observability", "secret", "OTLP 出口头(k=v CSV;常载鉴权头 ⇒ 按凭据处置)", { danger: SEC }),
|
|
357
362
|
r("OTEL_EXPORT_INTERVAL_MS", "observability", "number", "OTLP 批报周期(ms)", { staticDefault: "15000" }),
|
|
@@ -368,6 +373,7 @@ export const CONFIG_CATALOG = [
|
|
|
368
373
|
r("PLUGINS_ALLOW_HOSTS", "integrations", "csv", "plugins 域 clone host 白名单", { staticDefault: "github.com", danger: SEC, configKey: "pluginsAllowHosts" }),
|
|
369
374
|
r("PORT", "limitsHttp", "number", "监听端口(0=随机,测试用)", { staticDefault: "8090", configKey: "port" }),
|
|
370
375
|
r("PRINCIPAL_HEADER", "auth", "string", "principal 头名(跨仓冻结默认)", { staticDefault: "x-agent-principal", danger: SEC, configKey: "principalHeader" }),
|
|
376
|
+
r("PRINCIPAL_INBOX_ASSISTANT", "approval", "string", "principal 收件箱的消费方声明(独占读它的助理 agent handle)= 跨主体投递车道开关:在场 ⇒ 挂投递门与 POST /v1/principal-inbox/messages(耐久 mailbox / org 成员目录 / 配额店缺一拒启);空白 handle 拒启", { danger: SEC, configKey: "principalInboxAssistant", derivedDefaultNote: "缺席 ⇒ 不铸座、不挂门(跨主体投递整条不存在)", resolve: (c) => c.principalInboxAssistant ?? null }),
|
|
371
377
|
r("PRINCIPAL_JWT_AUD", "auth", "string", "直连 principal JWT 期望 aud", { danger: SEC, configKey: "principalJwtAud" }),
|
|
372
378
|
r("PRINCIPAL_JWT_ISS", "auth", "string", "直连 principal JWT 期望 iss", { danger: SEC, configKey: "principalJwtIss" }),
|
|
373
379
|
r("PRINCIPAL_JWT_MAX_TTL_SEC", "auth", "number", "接受的 principal JWT 最长寿命(秒;0=不设帽;负值拒启 —— 收紧意图不许翻成最松)", { staticDefault: "120", danger: SEC, configKey: "principalJwtMaxTtlSec" }),
|
|
@@ -384,7 +390,7 @@ export const CONFIG_CATALOG = [
|
|
|
384
390
|
r("REAP_INTERVAL_SEC", "limitsHttp", "number", "reaper 周期(秒)", { staticDefault: "60", configKey: "reapIntervalSec" }),
|
|
385
391
|
r("REAP_RUN_STALE_SEC", "limitsHttp", "number", "run 活性判陈旧阈(秒)", { staticDefault: "120", configKey: "runStaleSec", center: cLimits("runStaleSec") }),
|
|
386
392
|
r("REMOTE_EXEC", "orchestration", "enum", "执行车道选择(点名而配不齐/认不出 ⇒ 拒启,绝不静默降级到 host/stub)", { enumValues: REMOTE_EXEC_PROVIDER_WORDS, danger: SEC, derivedDefaultNote: "缺席:CONFIG_PROVIDER=local ⇒ host;其余 ⇒ 进程内 stub(手带整族不挂;残余名册看活体 wiring_manifest 里 mountedBy=hands 的条目数,不按工具名点。想让这一形拒启见 REQUIRE_EXECUTION_LANE)", configKey: "remoteExec", resolve: (c) => c.remoteExec?.provider ?? null }),
|
|
387
|
-
r("REMOTE_EXEC_HOME_DIR", "orchestration", "path", "执行环境的 home 目录(`~/` 形权限规则的基、引擎家锚拒读行的落点;core ExecutionEnv.homeDir 座)
|
|
393
|
+
r("REMOTE_EXEC_HOME_DIR", "orchestration", "path", "执行环境的 home 目录(`~/` 形权限规则的基、引擎家锚拒读行的落点;core ExecutionEnv.homeDir 座)。声明优先:不声明时 k8s / local-docker / ssh / adb 车道建环境那一拍实测执行环境自己的 $HOME 填引擎手里的座(`~/` 形规则的下单门仍只认声明);k8s / local-docker / ssh 车道的声明会在每只执行环境开起来时与它的 $HOME 对证(同一只判官、同一句拒),不一致或问不出 ⇒ 那只环境不开", { danger: SEC, derivedDefaultNote: "缺席:host/in-process ⇒ os.homedir();e2b ⇒ /home/user;k8s/local-docker/ssh/adb ⇒ 建环境时实测 $HOME(实测缺席 ⇒ 那只环境的座缺席:泄内容的递归读全 shell 面真人问、只读面拒,并响 warn execution_lane_home_undeclared);device ⇒ 无(设备协议没有家目录读数:起服 warn execution_lane_home_undeclared);`~/` 形规则的下单门恒只认声明(无声明即 422 响亮拒)", configKey: "remoteExecHomeDir", resolve: (c) => c.remoteExecHomeDir ?? null }),
|
|
388
394
|
r("REQUIRE_EXECUTION_LANE", "orchestration", "boolean", "开了之后:REMOTE_EXEC 未点名 ∧ CONFIG_PROVIDER≠local ⇒ **拒启**并点名该设什么。默认关 = 照旧启动,但执行环境是进程内 stub、**零手带工具**(手带整族不挂;活体读数:mountedBy=hands 条目 10 → 0),名册里其余工具照常执行,任务仍回 status=completed —— 凡需要手的请求,与「模型不肯用工具」在用户面同形。判据 = 活体 wiring_manifest 里 mountedBy=hands 的条目数,不按工具名点;名册总条数随 core 版本走,不写死。托管/云部署推荐开(docs/DEPLOY-PREREQS.md)", { staticDefault: "false", danger: SEC, configKey: "requireExecutionLane" }),
|
|
389
395
|
r("REQUIRE_PRINCIPAL", "auth", "boolean", "多租户开关(posture 判别位:true ⇒ CC 能力族默认收紧)", { staticDefault: "false", danger: SEC, configKey: "requirePrincipal" }),
|
|
390
396
|
r("RESOURCE_SUSPEND", "approval", "boolean", "durable 路径 opt-in core resourceSuspend(预算/preempt ⇒ 可恢复挂起)", { staticDefault: "false", configKey: "resourceSuspend" }),
|
|
@@ -449,7 +455,7 @@ export const CONFIG_CATALOG = [
|
|
|
449
455
|
r("SIGHUP_IDLE_GRACE_MS", "limitsHttp", "number", "SIGHUP 空闲关停窗(ms;共享引擎形防误杀)", { staticDefault: "120000", configKey: "sighupIdleGraceMs" }),
|
|
450
456
|
r("SKILLS_DIR", "integrations", "path", "出厂 skill 目录(设了就整个替换包内 skills/,不叠加;配置源的技能再按名盖上)", { derivedDefaultNote: "缺席 ⇒ 包内 skills/(相对模块解析,不是 cwd)", configKey: "skillsDir" }),
|
|
451
457
|
r("SNAPSHOT_BLOB_ALLOW_SQL_BYTES", "store", "boolean", "云形缺 MinIO 时显式接受 SQL 店放快照字节(严格 'true';安全姿势开关不收宽松真值)", { staticDefault: "false", danger: DATA, configKey: "snapshotBlobAllowSql" }),
|
|
452
|
-
r("SNAPSHOT_BLOB_SQL_MAX_BYTES", "store", "number", "SQL 店单 blob 帽(字节)", { derivedDefaultNote: "缺席:mysql 引擎 ⇒
|
|
458
|
+
r("SNAPSHOT_BLOB_SQL_MAX_BYTES", "store", "number", "SQL 店单 blob 帽(字节)", { derivedDefaultNote: "缺席:mysql 引擎 ⇒ 写入那条连接报的单行上限与 max_allowed_packet ÷ 2 取小(两堵墙各自读不到时按该库族文档缺省);pg ⇒ 不设", configKey: "snapshotBlobSqlMaxBytes" }),
|
|
453
459
|
r("SSH_HOST", "orchestration", "string", "ssh 车道目标主机(必需件)"),
|
|
454
460
|
r("SSH_HOST_FINGERPRINT", "orchestration", "string", "主机密钥指纹校验(坏值拒启;仅 ssh 车道被选中时求值)", { danger: SEC }),
|
|
455
461
|
r("SSH_KNOWN_HOSTS", "orchestration", "path", "known_hosts 路径(坏路径拒启)", { danger: SEC }),
|
|
@@ -495,7 +501,7 @@ export const CONFIG_CATALOG = [
|
|
|
495
501
|
r("WORKFLOW_JOURNAL_RETENTION_MS", "orchestration", "number", "workflow_journal GC 保留期(ms)", { staticDefault: String(7 * 24 * 60 * 60 * 1000), danger: DATA, configKey: "workflowJournalRetentionMs" }),
|
|
496
502
|
r("WORKFLOW_ORPHAN_GRACE_MS", "orchestration", "number", "running workflow 判崩溃孤儿的年龄阈(ms)", { staticDefault: String(24 * 60 * 60 * 1000), configKey: "workflowOrphanGraceMs" }),
|
|
497
503
|
r("WORKFLOW_RUN_RETENTION_MS", "orchestration", "number", "TERMINAL workflow_run 行保留期(ms;SQL twins)", { staticDefault: String(30 * 24 * 60 * 60 * 1000), danger: DATA, configKey: "workflowRunRetentionMs" }),
|
|
498
|
-
r("WORKFLOW_RUN_STORE", "orchestration", "enum", "后台 workflow run 店后端(auto=有 SQL 用 SQL,否则 File)", { enumValues: ["auto", "file", "memory"], staticDefault: "auto", configKey: "workflowRunStoreBackend" }),
|
|
504
|
+
r("WORKFLOW_RUN_STORE", "orchestration", "enum", "后台 workflow run 店后端(auto=有 SQL 用 SQL,否则 File;SQL 后端上配 file / memory 且开了自编排 ⇒ 起服拒:workflow 子代的审批决定行要与会话认领同库)", { enumValues: ["auto", "file", "memory"], staticDefault: "auto", configKey: "workflowRunStoreBackend" }),
|
|
499
505
|
r("WORKFLOW_SIZE_GUIDELINE", "orchestration", "enum", "Workflow 工具卡的规模建议(advisory;typo 拒启)", { enumValues: ["small", "medium", "large", "unrestricted"], configKey: "workflowSizeGuideline" }),
|
|
500
506
|
r("WORKFLOW_TOTAL_TIMEOUT_MS", "orchestration", "number", "workflow 脚本总时限(ms;0/负不是禁用 —— 无禁用臂)", { staticDefault: "3600000" }),
|
|
501
507
|
r("WORKSPACE_CACHE", "orchestration", "enum", "k8s 按工作区空间的构建缓存卷:volume = 每个空间(会话住客)一只 PVC(ws-cache-<摘要>,标签 sema.space,StorageClass 用集群缺省),挂到 WORKSPACE_CACHE_MOUNT,并在 pod env 注入工具缓存闭表(GRADLE_USER_HOME / MAVEN_OPTS / npm_config_cache / PIP_CACHE_DIR / UV_CACHE_DIR / GOMODCACHE;Rust 依赖缓存不盖 —— Cargo 没有只放下载缓存的 env;K8S_SANDBOX_ENV 同名显式值胜);卷在快照之外、可丢,pod 删卷留;卷拿不到(建不成 / 快照时限内没绑定)⇒ run 照起、无卷无缓存 env,fail-open 计数 + 一行 workspace_cache_unavailable;off = 不建卷。前提:会话店读得出会话住客(内存会话店 × volume ⇒ 拒启);委派子代不挂卷;词表外拒启", { enumValues: WORKSPACE_CACHE_WORDS, staticDefault: WORKSPACE_CACHE_DEFAULT }),
|
|
@@ -597,29 +603,40 @@ function primitiveConfigValue(config, key) {
|
|
|
597
603
|
return v;
|
|
598
604
|
return undefined;
|
|
599
605
|
}
|
|
606
|
+
const INVALID = { value: null, effectiveValueInvalid: true };
|
|
600
607
|
function sanitizeEnumValue(spec, v) {
|
|
601
608
|
const words = spec.echoWords ?? spec.enumValues;
|
|
602
609
|
if (v === null)
|
|
603
610
|
return { value: null };
|
|
604
611
|
if (words === undefined)
|
|
605
|
-
return
|
|
612
|
+
return INVALID;
|
|
606
613
|
if (typeof v === "boolean") {
|
|
607
614
|
const word = spec.booleanEnum?.[v ? "true" : "false"];
|
|
608
615
|
if (word === null)
|
|
609
616
|
return { value: null };
|
|
610
|
-
return word !== undefined && words.includes(word) ? { value: word } :
|
|
617
|
+
return word !== undefined && words.includes(word) ? { value: word } : INVALID;
|
|
611
618
|
}
|
|
612
619
|
if (typeof v === "string")
|
|
613
|
-
return words.includes(v) ? { value: v } :
|
|
614
|
-
return
|
|
620
|
+
return words.includes(v) ? { value: v } : INVALID;
|
|
621
|
+
return INVALID;
|
|
615
622
|
}
|
|
623
|
+
function displayUrlItems(raws, dropEmpty) {
|
|
624
|
+
const checked = raws.map((raw) => buildDisplaySafeUrlChecked(raw));
|
|
625
|
+
const texts = checked.map((c) => c.text);
|
|
626
|
+
return { value: dropEmpty ? texts.filter((t) => t.length > 0) : texts, ...withheldIf(checked.some((c) => c.failedClosed)) };
|
|
627
|
+
}
|
|
628
|
+
const withheldIf = (withheld) => (withheld ? { effectiveValueWithheld: true } : {});
|
|
616
629
|
function sanitizeValue(spec, v) {
|
|
617
630
|
const type = spec.type;
|
|
618
631
|
if (type === "url") {
|
|
619
|
-
if (typeof v === "string")
|
|
620
|
-
|
|
632
|
+
if (typeof v === "string") {
|
|
633
|
+
if (v.includes(","))
|
|
634
|
+
return displayUrlItems(v.split(",").map((s) => s.trim()), true);
|
|
635
|
+
const shown = buildDisplaySafeUrlChecked(v);
|
|
636
|
+
return { value: shown.text, ...withheldIf(shown.failedClosed) };
|
|
637
|
+
}
|
|
621
638
|
if (Array.isArray(v))
|
|
622
|
-
return
|
|
639
|
+
return displayUrlItems(v, false);
|
|
623
640
|
return { value: v };
|
|
624
641
|
}
|
|
625
642
|
if (type === "csv" && typeof v === "string")
|
|
@@ -651,21 +668,19 @@ export function buildConfigCatalog(inputs) {
|
|
|
651
668
|
const centerRestartSlice = seat?.restartSlice;
|
|
652
669
|
const centerEffective = seat !== undefined && managedNow && centerTiming === "hot" && (seat.precedence === "center-wins" || !envHeld);
|
|
653
670
|
const effectiveLane = centerEffective ? "center" : envHeld ? "env" : "default";
|
|
654
|
-
let
|
|
655
|
-
let effectiveValueInvalid;
|
|
671
|
+
let cell;
|
|
656
672
|
if (valueClass === "secret") {
|
|
657
|
-
|
|
673
|
+
cell = { value: { present: envHeld } };
|
|
658
674
|
}
|
|
659
675
|
else if (valueClass === "opaque") {
|
|
660
|
-
|
|
676
|
+
cell = { value: envHeld ? { present: true, length: raw.length } : { present: false } };
|
|
661
677
|
}
|
|
662
678
|
else {
|
|
663
679
|
const resolved = spec.resolve !== undefined ? spec.resolve(config, env, boot) : spec.configKey !== undefined ? primitiveConfigValue(config, spec.configKey) : undefined;
|
|
664
680
|
const picked = resolved !== undefined ? resolved : knob !== undefined ? knob.value : envHeld ? raw : spec.staticDefault ?? null;
|
|
665
|
-
|
|
666
|
-
effectiveValue = sanitized.value;
|
|
667
|
-
effectiveValueInvalid = sanitized.invalid;
|
|
681
|
+
cell = sanitizeValue(spec, picked);
|
|
668
682
|
}
|
|
683
|
+
const { value: effectiveValue, ...verdicts } = cell;
|
|
669
684
|
return {
|
|
670
685
|
name: spec.name,
|
|
671
686
|
domain: spec.domain,
|
|
@@ -678,7 +693,7 @@ export function buildConfigCatalog(inputs) {
|
|
|
678
693
|
...(spec.staticDefault !== undefined ? { staticDefault: spec.staticDefault } : {}),
|
|
679
694
|
...(spec.derivedDefaultNote !== undefined ? { derivedDefaultNote: spec.derivedDefaultNote } : {}),
|
|
680
695
|
effectiveValue,
|
|
681
|
-
...
|
|
696
|
+
...verdicts,
|
|
682
697
|
valueClass,
|
|
683
698
|
danger: spec.danger ?? [],
|
|
684
699
|
...(seat !== undefined && centerTiming !== undefined
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { type ConfigDirectoryMigration } from "@sema-agent/settings-schema/node";
|
|
1
|
+
import { type ConfigDirectoryDocument, type ConfigDirectoryMigration } from "@sema-agent/settings-schema/node";
|
|
2
|
+
/** 本地读腿读的那几份(便携域 + 退役域 + remote-exec 文档)= 迁移的覆盖面 = 目录信任判官(`config-dir-trust.ts`)判的文档名单。取契约的表与文档名,不手抄。 */
|
|
3
|
+
export declare const LOCAL_READER_DOCUMENTS: readonly ConfigDirectoryDocument[];
|
|
2
4
|
/** 一次起服迁移的结果:契约的结果闭集,外加本仓入口的两形(目录不在 ⇒ 不调;调用抛 ⇒ 失败)。纯数据。 */
|
|
3
5
|
export type ConfigDirMigration = {
|
|
4
6
|
readonly kind: "no-config-dir";
|
|
@@ -3,7 +3,7 @@ import { join } from "node:path";
|
|
|
3
3
|
import { RETIRED_DOMAINS, formatConfigPath, isRetiredDomainName } from "@sema-agent/settings-schema";
|
|
4
4
|
import { PORTABLE_DOMAINS, migrateConfigDirectory, nodeConfigDirectoryIo } from "@sema-agent/settings-schema/node";
|
|
5
5
|
import { REMOTE_EXEC_DOCUMENT } from "@sema-agent/settings-schema/remote-exec";
|
|
6
|
-
const
|
|
6
|
+
export const LOCAL_READER_DOCUMENTS = [...PORTABLE_DOMAINS, ...Object.keys(RETIRED_DOMAINS).filter(isRetiredDomainName), REMOTE_EXEC_DOCUMENT];
|
|
7
7
|
const errnoOf = (err) => (err instanceof Error && "code" in err && typeof err.code === "string" ? err.code : undefined);
|
|
8
8
|
export async function migrateLocalConfigDirectory(root) {
|
|
9
9
|
const dir = join(root, "config.d");
|
|
@@ -16,7 +16,7 @@ export async function migrateLocalConfigDirectory(root) {
|
|
|
16
16
|
return { kind: "no-config-dir", dir };
|
|
17
17
|
}
|
|
18
18
|
try {
|
|
19
|
-
return { ...(await migrateConfigDirectory(dir, { documents:
|
|
19
|
+
return { ...(await migrateConfigDirectory(dir, { documents: LOCAL_READER_DOCUMENTS, io: nodeConfigDirectoryIo })), dir };
|
|
20
20
|
}
|
|
21
21
|
catch (err) {
|
|
22
22
|
return { kind: "threw", dir, reason: `${err instanceof Error ? err.message : String(err)}${errnoOf(err) !== undefined ? ` (${errnoOf(err)})` : ""}` };
|