@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
package/dist/task-mcp.js
CHANGED
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
import { mcpInjectionDroppedNotice, readMcpToolAxes, resolveComplianceDenies } from "@sema-agent/core";
|
|
2
|
-
import { describeBadWireName, isUsableWireName } from "
|
|
2
|
+
import { MCP_CONTENT_ORIGINS, describeBadContentOrigin, describeBadWireName, describeNotStringArray, describeValueShape, isContentOriginWord, isStringArray, isUsableWireName, readRequestMcpTransport, stripControlAndBidi, } from "@sema-agent/settings-schema";
|
|
3
3
|
import { HttpError, createCodedHttpError } from "./security.js";
|
|
4
4
|
import { GOVERNANCE_HTTP_STATUS } from "./governance-http-status.js";
|
|
5
|
-
import { CONTENT_ORIGIN_WORDS, describeBadContentOrigin, isContentOriginWord } from "./mcp-content-origin.js";
|
|
6
5
|
import { MCP_SOURCE_LABEL_MAX, isMcpSourceLabel, readMcpSourceLabel } from "./mcp-source-label.js";
|
|
7
|
-
import {
|
|
8
|
-
import { echoKeyName } from "./request-key-closure.js";
|
|
9
|
-
import { CONTROL_AND_BIDI_STRIP_RE } from "./text-bidi.js";
|
|
6
|
+
import { describeMcpAssertionHeaderNotAString, describeMcpIdentityHeadersConflict, mcpIdentityHeadersIssue, noteMcpAssertionHeaderIgnored, noteMcpAssertionHeaderNotSent, specWithholdsMcpAssertionHeader, toCoreMcpServerSpec } from "./mcp-assertion-header.js";
|
|
7
|
+
import { MAX_KEY_ECHO, echoKeyName, keyClosureClause, scanKeyClosure } from "./request-key-closure.js";
|
|
10
8
|
import { readMcpToolFaces } from "./mcp-tool-faces.js";
|
|
11
9
|
export const MAX_REQUEST_MCP_SERVERS = 32;
|
|
12
10
|
export const MAX_REQUEST_MCP_DROP_NAMES = MAX_REQUEST_MCP_SERVERS;
|
|
13
|
-
export const MCP_SERVER_ENTRY_KEYS = ["allowTools", "contentOrigin", "elicitation", "name", "source", "toolAxes", "toolFaces", "transport"];
|
|
11
|
+
export const MCP_SERVER_ENTRY_KEYS = ["allowTools", "contentOrigin", "elicitation", "name", "source", "startupTimeoutMs", "toolAxes", "toolFaces", "transport"];
|
|
14
12
|
export const STDIO_MCP_TRANSPORT_KEYS = ["args", "command", "env", "kind"];
|
|
15
13
|
export const HTTP_MCP_TRANSPORT_KEYS = ["assertionHeader", "headers", "kind", "principalHeader", "url"];
|
|
16
|
-
export const MCP_ENTRY_EMPTY_RECORD_KEYS = ["toolAxes", "toolFaces"];
|
|
17
|
-
export const MCP_ENTRY_EMPTY_ARRAY_KEYS = ["allowTools"];
|
|
18
|
-
export const MCP_TRANSPORT_EMPTY_RECORD_KEYS = ["env", "headers"];
|
|
19
|
-
export const MCP_TRANSPORT_EMPTY_ARRAY_KEYS = ["args"];
|
|
20
14
|
export function mcpInjectionHonored(config) {
|
|
21
15
|
if (config.lockedConfigKeys?.includes("mcp") === true)
|
|
22
16
|
return false;
|
|
@@ -24,83 +18,12 @@ export function mcpInjectionHonored(config) {
|
|
|
24
18
|
return false;
|
|
25
19
|
return config.requirePrincipal !== true;
|
|
26
20
|
}
|
|
27
|
-
function isStringRecord(v) {
|
|
28
|
-
return !!v && typeof v === "object" && !Array.isArray(v) && Object.values(v).every((x) => typeof x === "string");
|
|
29
|
-
}
|
|
30
21
|
function isRecord(v) {
|
|
31
22
|
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
32
23
|
}
|
|
33
|
-
function isStringArray(v) {
|
|
34
|
-
return Array.isArray(v) && v.every((a) => typeof a === "string");
|
|
35
|
-
}
|
|
36
24
|
function isElicitationFlag(v) {
|
|
37
25
|
return typeof v === "boolean";
|
|
38
26
|
}
|
|
39
|
-
function describeShape(v) {
|
|
40
|
-
if (v === undefined)
|
|
41
|
-
return "nothing (the key is absent)";
|
|
42
|
-
if (v === null)
|
|
43
|
-
return "null";
|
|
44
|
-
if (Array.isArray(v))
|
|
45
|
-
return "an array";
|
|
46
|
-
if (typeof v === "string")
|
|
47
|
-
return v.length === 0 ? "an empty string" : `a string of ${v.length} characters`;
|
|
48
|
-
if (typeof v === "object")
|
|
49
|
-
return "an object";
|
|
50
|
-
return `a ${typeof v}`;
|
|
51
|
-
}
|
|
52
|
-
function describeNotStringArray(v) {
|
|
53
|
-
return Array.isArray(v) ? "an array with a non-string element" : describeShape(v);
|
|
54
|
-
}
|
|
55
|
-
function describeNotStringRecord(v) {
|
|
56
|
-
return isRecord(v) ? "an object with a non-string value" : describeShape(v);
|
|
57
|
-
}
|
|
58
|
-
const transportBad = (path, reason) => ({ ok: false, issue: { path, reason } });
|
|
59
|
-
function readRequestTransport(t) {
|
|
60
|
-
if (!t || typeof t !== "object")
|
|
61
|
-
return transportBad("transport", `must be an object with a "kind" of "stdio" or "http" — got ${describeShape(t)}`);
|
|
62
|
-
const tr = t;
|
|
63
|
-
const lost = [];
|
|
64
|
-
if (tr.kind === "stdio") {
|
|
65
|
-
if (typeof tr.command !== "string" || tr.command.length === 0)
|
|
66
|
-
return transportBad("transport.command", `must be a non-empty string (the command to run) — got ${describeShape(tr.command)}`);
|
|
67
|
-
if (tr.args !== undefined && !isStringArray(tr.args))
|
|
68
|
-
lost.push({ path: "transport.args", reason: `must be an array of strings — got ${describeNotStringArray(tr.args)}` });
|
|
69
|
-
if (tr.env !== undefined && !isStringRecord(tr.env))
|
|
70
|
-
lost.push({ path: "transport.env", reason: `must be an object of string values — got ${describeNotStringRecord(tr.env)}` });
|
|
71
|
-
return {
|
|
72
|
-
ok: true,
|
|
73
|
-
transport: {
|
|
74
|
-
kind: "stdio",
|
|
75
|
-
command: tr.command,
|
|
76
|
-
...(isStringArray(tr.args) ? { args: tr.args } : {}),
|
|
77
|
-
...(isStringRecord(tr.env) ? { env: tr.env } : {}),
|
|
78
|
-
},
|
|
79
|
-
lost,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
if (tr.kind === "http") {
|
|
83
|
-
if (typeof tr.url !== "string" || !/^https?:\/\//i.test(tr.url))
|
|
84
|
-
return transportBad("transport.url", "must be an absolute http(s) URL (put credentials in transport.headers, never in the URL)");
|
|
85
|
-
const ids = readMcpIdentityHeaders(tr);
|
|
86
|
-
if (tr.headers !== undefined && !isStringRecord(tr.headers))
|
|
87
|
-
lost.push({ path: "transport.headers", reason: `must be an object of string values — got ${describeNotStringRecord(tr.headers)}` });
|
|
88
|
-
if (tr.principalHeader !== undefined && ids.principalHeader === undefined) {
|
|
89
|
-
lost.push({ path: "transport.principalHeader", reason: `must be a string (the HTTP header NAME the end-user principal is injected into) — got ${describeShape(tr.principalHeader)}` });
|
|
90
|
-
}
|
|
91
|
-
return {
|
|
92
|
-
ok: true,
|
|
93
|
-
transport: {
|
|
94
|
-
kind: "http",
|
|
95
|
-
url: tr.url,
|
|
96
|
-
...(isStringRecord(tr.headers) ? { headers: tr.headers } : {}),
|
|
97
|
-
...ids,
|
|
98
|
-
},
|
|
99
|
-
lost,
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return transportBad("transport.kind", `must be "stdio" or "http" — got ${describeShape(tr.kind)}`);
|
|
103
|
-
}
|
|
104
27
|
const bad = (field) => ({ ok: false, field });
|
|
105
28
|
const MALFORMED_NAME = "<malformed>";
|
|
106
29
|
function declaredName(e) {
|
|
@@ -114,7 +37,7 @@ function normalizeServer(e, noteBadOrigin, storedToolAxes) {
|
|
|
114
37
|
const o = e;
|
|
115
38
|
if (!isUsableWireName(o.name))
|
|
116
39
|
return bad("name");
|
|
117
|
-
const read =
|
|
40
|
+
const read = readRequestMcpTransport(o.transport);
|
|
118
41
|
if (!read.ok)
|
|
119
42
|
return bad(read.issue.path);
|
|
120
43
|
const spec = { name: o.name, transport: read.transport };
|
|
@@ -129,10 +52,10 @@ function normalizeServer(e, noteBadOrigin, storedToolAxes) {
|
|
|
129
52
|
let judged = axes;
|
|
130
53
|
let toolAxesReread;
|
|
131
54
|
if (!axes.ok && storedToolAxes !== undefined) {
|
|
132
|
-
const again = readMcpToolAxes(storedToolAxes(o.toolAxes));
|
|
55
|
+
const again = readMcpToolAxes(storedToolAxes.mcp(o.toolAxes));
|
|
133
56
|
if (again.ok) {
|
|
134
57
|
judged = again;
|
|
135
|
-
toolAxesReread = axes.problem
|
|
58
|
+
toolAxesReread = stripControlAndBidi(axes.problem);
|
|
136
59
|
}
|
|
137
60
|
}
|
|
138
61
|
if (!judged.ok)
|
|
@@ -146,12 +69,14 @@ function normalizeServer(e, noteBadOrigin, storedToolAxes) {
|
|
|
146
69
|
noteBadOrigin(spec.name, o.contentOrigin);
|
|
147
70
|
}
|
|
148
71
|
Object.assign(spec, readMcpSourceLabel(spec.name, o.source));
|
|
72
|
+
if (o.startupTimeoutMs !== undefined)
|
|
73
|
+
spec.startupTimeoutMs = o.startupTimeoutMs;
|
|
149
74
|
const faces = readMcpToolFaces(o.toolFaces);
|
|
150
75
|
if (!faces.ok)
|
|
151
76
|
return bad("toolFaces");
|
|
152
77
|
if (faces.faces !== undefined)
|
|
153
78
|
spec.toolFaces = faces.faces;
|
|
154
|
-
return { ok: true, spec, ...(toolAxesReread !== undefined ? { toolAxesReread } : {}) };
|
|
79
|
+
return { ok: true, spec, ...(toolAxesReread !== undefined ? { toolAxesReread } : {}), transportLost: read.lost };
|
|
155
80
|
}
|
|
156
81
|
export function validateRequestMcp(raw) {
|
|
157
82
|
if (raw !== undefined && raw !== null && !Array.isArray(raw))
|
|
@@ -164,19 +89,22 @@ function validateRequestMcpEntries(raw, storedToolAxes) {
|
|
|
164
89
|
const dropped = [];
|
|
165
90
|
const badContentOrigin = [];
|
|
166
91
|
const toolAxesReread = [];
|
|
92
|
+
const transportLost = [];
|
|
167
93
|
for (const e of raw.slice(0, MAX_REQUEST_MCP_SERVERS)) {
|
|
168
94
|
const v = normalizeServer(e, (server, value) => badContentOrigin.push({ server, value: describeBadContentOrigin(value) }), storedToolAxes);
|
|
169
95
|
if (v.ok) {
|
|
170
96
|
ok.push(v.spec);
|
|
171
97
|
if (v.toolAxesReread !== undefined)
|
|
172
98
|
toolAxesReread.push({ server: v.spec.name, problem: v.toolAxesReread });
|
|
99
|
+
if (v.transportLost.length > 0)
|
|
100
|
+
transportLost.push({ server: v.spec.name, lost: v.transportLost.map((i) => i.path) });
|
|
173
101
|
}
|
|
174
102
|
else
|
|
175
103
|
dropped.push({ server: declaredName(e), reason: "malformed_entry", field: v.field });
|
|
176
104
|
}
|
|
177
105
|
for (const e of raw.slice(MAX_REQUEST_MCP_SERVERS, MAX_REQUEST_MCP_SERVERS + MAX_REQUEST_MCP_DROP_NAMES))
|
|
178
106
|
dropped.push({ server: declaredName(e), reason: "over_cap" });
|
|
179
|
-
return { ok, dropped, droppedTotal: Math.max(0, raw.length - ok.length), badContentOrigin, toolAxesReread };
|
|
107
|
+
return { ok, dropped, droppedTotal: Math.max(0, raw.length - ok.length), badContentOrigin, toolAxesReread, transportLost };
|
|
180
108
|
}
|
|
181
109
|
export function assertRequestMcpUnlocked(bodyMcp, lockedKeys) {
|
|
182
110
|
if (!lockedKeys.has("mcp"))
|
|
@@ -195,7 +123,7 @@ export function requestEntryIdentityIssue(entry) {
|
|
|
195
123
|
return undefined;
|
|
196
124
|
return mcpIdentityHeadersIssue(t);
|
|
197
125
|
}
|
|
198
|
-
|
|
126
|
+
function requestEntryIdentityRefusal(entry, at) {
|
|
199
127
|
const issue = requestEntryIdentityIssue(entry);
|
|
200
128
|
if (issue === undefined || !isRecord(entry))
|
|
201
129
|
return undefined;
|
|
@@ -205,14 +133,44 @@ export function requestEntryIdentityRefusal(entry, at) {
|
|
|
205
133
|
const value = isRecord(transport) ? transport.assertionHeader : undefined;
|
|
206
134
|
return entryFieldRefusal(entry, at, { path: "transport.assertionHeader", reason: describeMcpAssertionHeaderNotAString(value) });
|
|
207
135
|
}
|
|
208
|
-
export function
|
|
209
|
-
if (
|
|
210
|
-
return;
|
|
211
|
-
|
|
212
|
-
|
|
136
|
+
export function requestMcpDeclarationRefusal(list) {
|
|
137
|
+
if (list === undefined || list === null)
|
|
138
|
+
return undefined;
|
|
139
|
+
if (!Array.isArray(list))
|
|
140
|
+
return listRefusal(`mcpServers is ${describeValueShape(list)}, not an array of MCP server declarations`);
|
|
141
|
+
if (list.length > MAX_REQUEST_MCP_SERVERS)
|
|
142
|
+
return listRefusal(`mcpServers carries ${list.length} declarations, above this deployment's ceiling of ${MAX_REQUEST_MCP_SERVERS}`);
|
|
143
|
+
for (let i = 0; i < list.length; i++) {
|
|
144
|
+
const refusal = requestEntryRefusal(list[i], `mcpServers[${i}]`);
|
|
213
145
|
if (refusal !== undefined)
|
|
214
|
-
|
|
146
|
+
return refusal;
|
|
215
147
|
}
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
export function assertRequestMcpEntries(bodyMcp) {
|
|
151
|
+
const refusal = requestMcpDeclarationRefusal(bodyMcp);
|
|
152
|
+
if (refusal !== undefined)
|
|
153
|
+
throw createCodedHttpError(400, refusal.errorCode, refusal.message, refusal.unknownKeys === undefined ? undefined : { unknownKeys: [...refusal.unknownKeys] });
|
|
154
|
+
}
|
|
155
|
+
const LIST_REFUSAL_TAIL = "The request is refused rather than acting on part of the list: declarations that silently did not apply would read as in effect to whoever sent them. " +
|
|
156
|
+
"Fix the list (an empty list declares none).";
|
|
157
|
+
function listRefusal(head) {
|
|
158
|
+
return { errorCode: "request.field_invalid", message: `${head}. ${LIST_REFUSAL_TAIL}` };
|
|
159
|
+
}
|
|
160
|
+
const ENTRY_KEY_SET = new Set(MCP_SERVER_ENTRY_KEYS);
|
|
161
|
+
const STDIO_TRANSPORT_KEY_SET = new Set(STDIO_MCP_TRANSPORT_KEYS);
|
|
162
|
+
const HTTP_TRANSPORT_KEY_SET = new Set(HTTP_MCP_TRANSPORT_KEYS);
|
|
163
|
+
const NO_TOLERATED_KEYS = new Set();
|
|
164
|
+
function entryUnknownKeys(entry, at) {
|
|
165
|
+
const buckets = { unknown: [], unsupported: [] };
|
|
166
|
+
scanKeyClosure(entry, `${at}.`, ENTRY_KEY_SET, NO_TOLERATED_KEYS, buckets);
|
|
167
|
+
const t = entry.transport;
|
|
168
|
+
if (isRecord(t)) {
|
|
169
|
+
const keys = t.kind === "stdio" ? STDIO_TRANSPORT_KEY_SET : t.kind === "http" ? HTTP_TRANSPORT_KEY_SET : undefined;
|
|
170
|
+
if (keys !== undefined)
|
|
171
|
+
scanKeyClosure(t, `${at}.transport.`, keys, NO_TOLERATED_KEYS, buckets);
|
|
172
|
+
}
|
|
173
|
+
return buckets.unknown.sort();
|
|
216
174
|
}
|
|
217
175
|
const ENTRY_KEY_JUDGES = {
|
|
218
176
|
allowTools: (o) => o.allowTools === undefined || isStringArray(o.allowTools)
|
|
@@ -222,14 +180,15 @@ const ENTRY_KEY_JUDGES = {
|
|
|
222
180
|
? undefined
|
|
223
181
|
: {
|
|
224
182
|
path: "contentOrigin",
|
|
225
|
-
reason: `must be one of ${
|
|
183
|
+
reason: `must be one of ${MCP_CONTENT_ORIGINS.map((w) => `"${w}"`).join(" | ")} — got ${describeBadContentOrigin(o.contentOrigin)}` +
|
|
226
184
|
` (omit the key for the default: this server's tools classify as external content)`,
|
|
227
185
|
},
|
|
228
|
-
elicitation: (o) => (o.elicitation === undefined || isElicitationFlag(o.elicitation) ? undefined : { path: "elicitation", reason: `must be a boolean — got ${
|
|
186
|
+
elicitation: (o) => (o.elicitation === undefined || isElicitationFlag(o.elicitation) ? undefined : { path: "elicitation", reason: `must be a boolean — got ${describeValueShape(o.elicitation)}` }),
|
|
229
187
|
name: (o) => (isUsableWireName(o.name) ? undefined : { path: "name", reason: `must be a non-empty string within the wire-name length bound — got ${describeBadWireName(o.name)}` }),
|
|
230
188
|
source: (o) => o.source === undefined || isMcpSourceLabel(o.source)
|
|
231
189
|
? undefined
|
|
232
|
-
: { path: "source", reason: `must be a non-empty string of at most ${MCP_SOURCE_LABEL_MAX} characters (a display label) — got ${
|
|
190
|
+
: { path: "source", reason: `must be a non-empty string of at most ${MCP_SOURCE_LABEL_MAX} characters (a display label) — got ${describeValueShape(o.source)}` },
|
|
191
|
+
startupTimeoutMs: () => undefined,
|
|
233
192
|
toolAxes: (o) => {
|
|
234
193
|
const read = readMcpToolAxes(o.toolAxes);
|
|
235
194
|
return read.ok ? undefined : { path: "toolAxes", reason: read.problem };
|
|
@@ -239,7 +198,7 @@ const ENTRY_KEY_JUDGES = {
|
|
|
239
198
|
return read.ok ? undefined : { path: "toolFaces", reason: read.problem };
|
|
240
199
|
},
|
|
241
200
|
transport: (o) => {
|
|
242
|
-
const read =
|
|
201
|
+
const read = readRequestMcpTransport(o.transport);
|
|
243
202
|
return read.ok ? read.lost[0] : read.issue;
|
|
244
203
|
},
|
|
245
204
|
};
|
|
@@ -249,12 +208,22 @@ function entryFieldRefusal(entry, at, issue) {
|
|
|
249
208
|
const server = echoKeyName("", declaredName(entry));
|
|
250
209
|
return {
|
|
251
210
|
errorCode: "request.field_invalid",
|
|
252
|
-
message: `${at}.${issue.path} (server "${server}") is not a usable declaration — ${issue.reason
|
|
211
|
+
message: `${at}.${issue.path} (server "${server}") is not a usable declaration — ${stripControlAndBidi(issue.reason)}. ${ENTRY_REFUSAL_TAIL}`,
|
|
253
212
|
};
|
|
254
213
|
}
|
|
255
214
|
function requestEntryRefusal(entry, at) {
|
|
256
215
|
if (!isRecord(entry))
|
|
257
|
-
return
|
|
216
|
+
return listRefusal(`${at} is ${describeValueShape(entry)}, not an MCP server declaration (an object)`);
|
|
217
|
+
const unknownKeys = entryUnknownKeys(entry, at);
|
|
218
|
+
if (unknownKeys.length > 0) {
|
|
219
|
+
return {
|
|
220
|
+
errorCode: "request.body_shape",
|
|
221
|
+
message: `body: unrecognized key(s) on an MCP declaration — refused rather than dropped, because a dropped key reads as "in effect" to the caller. ` +
|
|
222
|
+
`${keyClosureClause(unknownKeys, "unknown (not an mcpServers[] key — check the spelling)")}. ` +
|
|
223
|
+
`Accepted per entry: ${[...MCP_SERVER_ENTRY_KEYS].sort().join(",")} (transport.kind "stdio": ${[...STDIO_MCP_TRANSPORT_KEYS].sort().join(",")}; "http": ${[...HTTP_MCP_TRANSPORT_KEYS].sort().join(",")})`,
|
|
224
|
+
unknownKeys: unknownKeys.slice(0, MAX_KEY_ECHO),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
258
227
|
const identity = requestEntryIdentityRefusal(entry, at);
|
|
259
228
|
if (identity !== undefined)
|
|
260
229
|
return identity;
|
|
@@ -265,12 +234,6 @@ function requestEntryRefusal(entry, at) {
|
|
|
265
234
|
}
|
|
266
235
|
return undefined;
|
|
267
236
|
}
|
|
268
|
-
export function requestEntryToolAxesRefusal(entry, at) {
|
|
269
|
-
if (!isRecord(entry))
|
|
270
|
-
return undefined;
|
|
271
|
-
const issue = ENTRY_KEY_JUDGES.toolAxes(entry);
|
|
272
|
-
return issue === undefined ? undefined : entryFieldRefusal(entry, at, issue);
|
|
273
|
-
}
|
|
274
237
|
export function deploymentClosedMcpNames(baseline, reservedNames) {
|
|
275
238
|
return new Set([...(baseline ?? []).map((s) => s.name), ...reservedNames]);
|
|
276
239
|
}
|
|
@@ -311,7 +274,7 @@ function classifyHonored(baseline, entries, config, logger, storedToolAxes) {
|
|
|
311
274
|
if (v.badContentOrigin.length > 0) {
|
|
312
275
|
logger?.warn("mcp_content_class_dropped", {
|
|
313
276
|
entries: v.badContentOrigin,
|
|
314
|
-
allowed:
|
|
277
|
+
allowed: MCP_CONTENT_ORIGINS,
|
|
315
278
|
note: "declaration DROPPED — these servers keep the pre-378 default (external content, session gets marked); the servers themselves still mount",
|
|
316
279
|
});
|
|
317
280
|
}
|
|
@@ -319,7 +282,7 @@ function classifyHonored(baseline, entries, config, logger, storedToolAxes) {
|
|
|
319
282
|
const closed = deploymentClosedMcpNames(baseline, reservedNames);
|
|
320
283
|
const blocked = v.ok.filter((s) => closed.has(s.name)).map((s) => s.name);
|
|
321
284
|
for (const s of v.ok)
|
|
322
|
-
if (
|
|
285
|
+
if (specWithholdsMcpAssertionHeader(s) && !closed.has(s.name))
|
|
323
286
|
noteMcpAssertionHeaderNotSent(logger, s.name);
|
|
324
287
|
const mounted = new Set(v.ok.filter((s) => !closed.has(s.name)).map((s) => s.name));
|
|
325
288
|
for (const e of entries.slice(0, MAX_REQUEST_MCP_SERVERS)) {
|
|
@@ -337,6 +300,18 @@ function classifyHonored(baseline, entries, config, logger, storedToolAxes) {
|
|
|
337
300
|
note: "this replayed request was stored before the upgrade and its toolAxes declaration does not pass the engine's reader; while one-time migration M19 is open it is read the way the pre-upgrade server read it (members that did not fit are dropped, a declaration that is not an object counts as none) and the server stays mounted — once the window closes the same request leaves this server unmounted",
|
|
338
301
|
});
|
|
339
302
|
}
|
|
303
|
+
for (const t of v.transportLost) {
|
|
304
|
+
if (!mounted.has(t.server))
|
|
305
|
+
continue;
|
|
306
|
+
logger?.warn("mcp_transport_members_dropped", {
|
|
307
|
+
server: t.server,
|
|
308
|
+
lost: t.lost.slice(0, MAX_KEY_ECHO),
|
|
309
|
+
...(t.lost.length > MAX_KEY_ECHO ? { lostTotal: t.lost.length } : {}),
|
|
310
|
+
note: "this replayed request carries parts of this server's transport declaration that cannot be handed to the engine — an env / headers record that is not a plain object of string values (left out whole, as the pre-upgrade server read it), " +
|
|
311
|
+
"a member named \"__proto__\" in env / headers (only that member is left out: the engine refuses the name), args that are not a list of strings, a principalHeader that is not a string; " +
|
|
312
|
+
"the server mounts with the rest. A new submission with the same entry is refused (400)",
|
|
313
|
+
});
|
|
314
|
+
}
|
|
340
315
|
return {
|
|
341
316
|
mcp: mergeRequestMcp(baseline, v.ok.map(toCoreMcpServerSpec), reservedNames),
|
|
342
317
|
drops: [...v.dropped, ...blocked.map((server) => ({ server, reason: "name_reserved_by_deployment" }))],
|