@sema-agent/server 7.134.0 → 7.136.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 +197 -1
- package/USAGE.md +147 -42
- package/deploy/sema-up/README.md +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/values.yaml +1 -1
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +24 -24
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +122 -154
- package/dist/approval-card.js +50 -51
- package/dist/approval-content-kind.d.ts +23 -5
- package/dist/approval-content-kind.js +8 -1
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +22 -3
- package/dist/approval-gate-currency.js +44 -18
- package/dist/approval-hmac.d.ts +7 -7
- package/dist/approval-policy-settlement.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +3 -3
- package/dist/approval.d.ts +8 -8
- package/dist/approval.js +4 -2
- package/dist/auth-bridge.d.ts +35 -6
- package/dist/auth-bridge.js +20 -3
- package/dist/auto-mode-face.d.ts +4 -4
- package/dist/background-session-reap.d.ts +2 -2
- package/dist/bake-runner/main.d.ts +2 -2
- package/dist/bake-runner/runner.d.ts +4 -4
- package/dist/bench/s1/live-deps.d.ts +1 -1
- package/dist/bench/s1/run-firm.d.ts +1 -1
- package/dist/boot/budget-tracing.d.ts +1 -2
- package/dist/boot/budget-tracing.js +2 -2
- package/dist/boot/coordinators.d.ts +2 -2
- package/dist/boot/coordinators.js +2 -2
- package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
- package/dist/boot/deferred-sandbox-path-env.js +0 -5
- package/dist/boot/engine-lease.d.ts +5 -5
- package/dist/boot/execution-env.d.ts +16 -15
- package/dist/boot/execution-env.js +19 -21
- package/dist/boot/fatal-exit.d.ts +2 -2
- package/dist/boot/late-binds.d.ts +1 -1
- package/dist/boot/leader.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +36 -29
- package/dist/boot/runner-deps.d.ts +11 -11
- package/dist/boot/runner-deps.js +7 -4
- package/dist/boot/session-faces.d.ts +3 -3
- package/dist/boot/session-faces.js +11 -30
- package/dist/boot/shutdown.d.ts +5 -5
- package/dist/boot/side-query-lane.d.ts +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +1 -1
- package/dist/boot/stage-06-runners.js +0 -2
- package/dist/boot/stage-07-capability-layer.d.ts +1 -1
- package/dist/boot/stage-08-reapers.d.ts +1 -1
- package/dist/boot/stage-09-leader.d.ts +1 -1
- package/dist/boot/stage-10-http-server.d.ts +1 -1
- package/dist/boot/stores.js +4 -4
- package/dist/boot/web-admin.d.ts +17 -17
- package/dist/boot/web-admin.js +15 -27
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/brain.js +12 -3
- package/dist/budget.d.ts +7 -7
- package/dist/budget.js +4 -0
- package/dist/capabilities/approvals-push.d.ts +4 -4
- package/dist/capabilities/builtin-tools.d.ts +5 -5
- package/dist/capabilities/center-plugins.d.ts +5 -5
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +1 -1
- package/dist/capabilities/center-wiring.d.ts +1 -1
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/execution-lane.d.ts +5 -5
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +5 -5
- package/dist/capabilities/mcp-probe.d.ts +11 -7
- package/dist/capabilities/sandbox-file-send.d.ts +1 -18
- package/dist/capabilities/sandbox-file-send.js +0 -7
- package/dist/capabilities/scenarios.d.ts +28 -10
- package/dist/capabilities/scenarios.js +15 -5
- package/dist/capabilities/send-user-file-tool.d.ts +1 -1
- package/dist/capabilities/skills.d.ts +31 -12
- package/dist/capabilities/skills.js +23 -17
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +29 -32
- package/dist/capability-facts.js +17 -21
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +22 -8
- package/dist/center-credential.js +18 -3
- package/dist/checkpoint-identity.d.ts +5 -0
- package/dist/checkpoint-identity.js +14 -0
- package/dist/config-catalog.d.ts +12 -12
- package/dist/config-catalog.js +12 -10
- package/dist/config-d-migration.js +1 -1
- package/dist/config-invariants.d.ts +5 -5
- package/dist/config-invariants.js +11 -2
- package/dist/config-lkg.d.ts +1 -39
- package/dist/config-lkg.js +1 -83
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +95 -87
- package/dist/config.d.ts +26 -24
- package/dist/config.js +38 -18
- package/dist/cross-session-settings.d.ts +1 -1
- package/dist/delegated-session-owner.d.ts +16 -13
- package/dist/delegated-session-owner.js +9 -10
- package/dist/deployment-governance.d.ts +16 -16
- package/dist/deployment-shape.d.ts +127 -0
- package/dist/deployment-shape.js +72 -0
- package/dist/device-store.d.ts +1 -1
- package/dist/device-ws-hub.d.ts +1 -1
- package/dist/egress-redirect.d.ts +1 -1
- package/dist/elicitation.d.ts +8 -7
- package/dist/elicitation.js +9 -8
- package/dist/entry-mode-clamp-notice.d.ts +2 -2
- package/dist/env-facts.d.ts +10 -9
- package/dist/env-facts.js +1 -1
- package/dist/env-name-allowlist-knobs.d.ts +5 -5
- package/dist/exec-bounds.d.ts +2 -2
- package/dist/execution-lane-caps.d.ts +31 -43
- package/dist/execution-lane-caps.js +0 -13
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +25 -11
- package/dist/file-history-disclosure.js +25 -14
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +22 -14
- package/dist/fleet/fleet-bus.js +5 -5
- package/dist/fleet/fleet-reconciler.d.ts +9 -9
- package/dist/fleet/subagent-tail-bus.d.ts +4 -4
- package/dist/fleet-client.d.ts +45 -14
- package/dist/fleet-client.js +24 -4
- package/dist/fleet-lease.d.ts +23 -19
- package/dist/fleet-lease.js +31 -23
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-llm.js +14 -8
- package/dist/hooks/hook-runner.d.ts +58 -31
- package/dist/hooks/hook-runner.js +37 -19
- package/dist/host-decision.d.ts +5 -5
- package/dist/host-lsp-manager.d.ts +5 -5
- package/dist/hosted-posture.d.ts +23 -13
- package/dist/hosted-posture.js +4 -9
- package/dist/http/admission.d.ts +2 -2
- package/dist/http/admission.js +20 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +2 -1
- package/dist/http/checkpoint-ctx.d.ts +62 -17
- package/dist/http/checkpoint-ctx.js +78 -35
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +9 -9
- package/dist/http/durable-run-leg.js +4 -3
- package/dist/http/idempotency.d.ts +2 -2
- package/dist/http/mcp-dial-deadline.d.ts +7 -5
- package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
- package/dist/http/owner-access.d.ts +4 -6
- package/dist/http/owner-access.js +1 -1
- package/dist/http/principal-gate.d.ts +7 -7
- package/dist/http/principal-gate.js +3 -2
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/request-guards.d.ts +4 -4
- package/dist/http/request-guards.js +2 -1
- package/dist/http/resume-ctx-read.d.ts +9 -23
- package/dist/http/resume-ctx-read.js +2 -3
- package/dist/http/resume-legs.d.ts +3 -3
- package/dist/http/resume-legs.js +11 -8
- package/dist/http/route-ctx.d.ts +29 -29
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +5 -7
- package/dist/http/routes/approvals-assistant.js +101 -26
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +2 -2
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +16 -8
- package/dist/http/routes/config-catalog.d.ts +1 -1
- package/dist/http/routes/devices.d.ts +1 -1
- package/dist/http/routes/diagnostics.d.ts +3 -3
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +2 -1
- package/dist/http/routes/mcp-reconnect.d.ts +4 -4
- package/dist/http/routes/mcp-reconnect.js +3 -3
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/notify-wake.js +2 -2
- package/dist/http/routes/rules.d.ts +1 -1
- package/dist/http/routes/runs.js +23 -11
- package/dist/http/routes/session-sync.d.ts +1 -1
- package/dist/http/routes/session-sync.js +97 -46
- package/dist/http/routes/sessions-list.js +1 -1
- package/dist/http/routes/sessions.js +43 -53
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +3 -0
- package/dist/http/routes/workflows.js +31 -28
- package/dist/http/send.d.ts +5 -5
- package/dist/http/server.d.ts +34 -34
- package/dist/http/session-inherit-env.d.ts +3 -3
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +2 -2
- package/dist/http/submit-ctx.js +1 -1
- package/dist/http/sync-submit-body.d.ts +1 -1
- package/dist/http/verify-rounds.d.ts +1 -1
- package/dist/http/wire-types.d.ts +33 -24
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/instruction-source-notice.d.ts +2 -2
- package/dist/key-resolver.d.ts +3 -3
- package/dist/lane-home-probe.d.ts +1 -1
- package/dist/leader/diffout.d.ts +1 -1
- package/dist/leader/diffup.d.ts +2 -2
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +1 -1
- package/dist/leader/leader.d.ts +4 -4
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/repair-wire.d.ts +1 -1
- package/dist/leader/wire.d.ts +6 -6
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/mcp-assertion-header.d.ts +1 -1
- package/dist/memory-layer-legacy-lock.d.ts +1 -1
- package/dist/memory-operator-faces.d.ts +1 -1
- package/dist/memory-posture.js +4 -2
- package/dist/memory-project-layer.d.ts +1 -1
- package/dist/memory-scope.d.ts +19 -19
- package/dist/memory-store-refusal.d.ts +4 -4
- package/dist/model-entry-headers.d.ts +2 -2
- package/dist/model-entry-refusal.d.ts +17 -17
- package/dist/model-provider.d.ts +10 -10
- package/dist/model-reach-scope.d.ts +1 -1
- package/dist/model-route-endpoint.d.ts +6 -6
- package/dist/model-route-gap.d.ts +49 -4
- package/dist/model-route-gap.js +34 -1
- package/dist/model-route-url.d.ts +5 -5
- package/dist/model-select.d.ts +15 -6
- package/dist/model-select.js +5 -0
- package/dist/model-unreachable-notice.d.ts +3 -3
- package/dist/namespaced-rule-name.d.ts +15 -5
- package/dist/namespaced-rule-name.js +3 -2
- package/dist/object-store-buckets.d.ts +13 -0
- package/dist/object-store-buckets.js +3 -0
- package/dist/observability/corrupt-read-seat.d.ts +9 -9
- package/dist/observability/cost-taxonomy.d.ts +1 -1
- package/dist/observability/err-text.d.ts +1 -1
- package/dist/observability/fail-open.d.ts +17 -13
- package/dist/observability/fail-open.js +17 -13
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/metrics.js +1 -1
- package/dist/observability/principal-context.d.ts +4 -1
- package/dist/observability/principal-context.js +6 -1
- package/dist/observability/run-terminal.d.ts +36 -36
- package/dist/observability/secret-env-scrub.d.ts +3 -3
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/operator-ask.d.ts +4 -4
- package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
- package/dist/orchestration/workflow-completion-inbox.js +29 -7
- package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
- package/dist/orchestration/workflow-notify-journal.js +17 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -18
- package/dist/parked-decide.js +31 -11
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +5 -4
- package/dist/peer-directory.js +6 -6
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +2 -2
- package/dist/plugins/adoption-log-sql.d.ts +1 -1
- package/dist/plugins/approval-ask-store-file.d.ts +8 -1
- package/dist/plugins/approval-ask-store-file.js +6 -3
- package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
- package/dist/plugins/approval-ask-store-memory.js +11 -7
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -15
- package/dist/plugins/approval-ask-store-sql.js +21 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/background-agent-store-sql.d.ts +1 -1
- package/dist/plugins/background-shell-support.d.ts +2 -2
- package/dist/plugins/blob-backend.d.ts +1 -1
- package/dist/plugins/blob-backend.js +2 -1
- package/dist/plugins/caching-session-store.d.ts +23 -32
- package/dist/plugins/caching-session-store.js +5 -17
- package/dist/plugins/checkpoint-index-columns.d.ts +130 -0
- package/dist/plugins/checkpoint-index-columns.js +90 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +71 -69
- package/dist/plugins/checkpoint-store-sql.js +109 -127
- package/dist/plugins/device-store-sql.d.ts +7 -6
- package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
- package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
- package/dist/plugins/file-history-store-sql.d.ts +15 -7
- package/dist/plugins/file-history-store-sql.js +55 -36
- package/dist/plugins/file-run-store.d.ts +8 -8
- package/dist/plugins/fork-routing-session-store.d.ts +2 -2
- package/dist/plugins/fork-routing-session-store.js +1 -1
- package/dist/plugins/host-platform.d.ts +10 -10
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +10 -10
- package/dist/plugins/local-checkpoint-store.js +7 -7
- package/dist/plugins/local-session-store.d.ts +34 -38
- package/dist/plugins/local-session-store.js +20 -39
- package/dist/plugins/local-session-window.d.ts +1 -1
- package/dist/plugins/mailbox-store-sql.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-run-store.d.ts +4 -4
- package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
- package/dist/plugins/one-time-migrations.d.ts +73 -54
- package/dist/plugins/one-time-migrations.js +131 -134
- package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
- package/dist/plugins/park-commit-watch.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +5 -5
- package/dist/plugins/permission-rule-store-file.js +12 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +67 -24
- package/dist/plugins/pg-cost-quota.d.ts +1 -1
- package/dist/plugins/pg-pool.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -2
- package/dist/plugins/pg-rate-limiter.d.ts +1 -1
- package/dist/plugins/pg-session-storage.d.ts +8 -20
- package/dist/plugins/pg-session-storage.js +14 -27
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +10 -9
- package/dist/plugins/remote-env-device.js +6 -2
- package/dist/plugins/remote-env-e2b.d.ts +3 -3
- package/dist/plugins/remote-env-host.d.ts +16 -16
- package/dist/plugins/remote-env-k8s.d.ts +26 -13
- package/dist/plugins/remote-env-k8s.js +24 -7
- package/dist/plugins/remote-env-local-docker.d.ts +2 -2
- package/dist/plugins/remote-env-ssh.d.ts +4 -4
- package/dist/plugins/remote-scratchpad.d.ts +2 -3
- package/dist/plugins/remote-scratchpad.js +0 -4
- package/dist/plugins/remote-shell.d.ts +6 -6
- package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
- package/dist/plugins/retention-store-sql.d.ts +4 -4
- package/dist/plugins/roster-store-sql.d.ts +1 -1
- package/dist/plugins/run-store-sql.d.ts +8 -8
- package/dist/plugins/s3-answer.d.ts +15 -0
- package/dist/plugins/s3-answer.js +5 -0
- package/dist/plugins/schema-consistency.d.ts +2 -2
- package/dist/plugins/schema-ensure-legs.d.ts +3 -3
- package/dist/plugins/schema-indexes.d.ts +1 -1
- package/dist/plugins/schema-live-columns.d.ts +1 -1
- package/dist/plugins/session-event-payload.d.ts +4 -4
- package/dist/plugins/session-fork.d.ts +34 -0
- package/dist/plugins/session-fork.js +29 -0
- package/dist/plugins/session-ownership.js +1 -1
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +12 -12
- package/dist/plugins/session-store.d.ts +2 -2
- package/dist/plugins/session-store.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
- package/dist/plugins/snapshot-bucket-presence.d.ts +39 -4
- package/dist/plugins/snapshot-bucket-presence.js +35 -7
- package/dist/plugins/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +40 -1
- package/dist/plugins/sql-errors.js +49 -1
- package/dist/plugins/sql-json-column.d.ts +21 -21
- package/dist/plugins/sql-row-helpers.d.ts +2 -2
- package/dist/plugins/store-backend.d.ts +17 -16
- package/dist/plugins/store-backend.js +3 -3
- package/dist/plugins/store-contracts.d.ts +21 -21
- package/dist/plugins/store-fault.d.ts +4 -0
- package/dist/plugins/store-fault.js +8 -0
- package/dist/plugins/task-attachment-store.d.ts +2 -2
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/tidb-pool.d.ts +2 -2
- package/dist/plugins/tidb-pool.js +10 -3
- package/dist/plugins/tidb-session-store.d.ts +16 -26
- package/dist/plugins/tidb-session-store.js +15 -27
- package/dist/plugins/tool-result-store-sql.d.ts +1 -1
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/user-input-ledger-file.d.ts +1 -1
- package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +19 -5
- package/dist/plugins/web-search.js +20 -5
- package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
- package/dist/plugins/workflow-journal-payload.js +32 -0
- package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
- package/dist/plugins/workflow-journal-store-sql.js +34 -15
- package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
- package/dist/posture-source.d.ts +11 -11
- package/dist/principal-jwt.d.ts +6 -6
- package/dist/project-identity.d.ts +3 -3
- package/dist/project-memory.d.ts +4 -4
- package/dist/read-face-posture.d.ts +7 -7
- package/dist/request-declaration-refusal.d.ts +94 -0
- package/dist/request-declaration-refusal.js +78 -0
- package/dist/request-image-urls.d.ts +6 -0
- package/dist/request-image-urls.js +27 -0
- package/dist/request-key-closure.d.ts +6 -1
- package/dist/request-key-closure.js +5 -2
- package/dist/request-value-closure.d.ts +15 -8
- package/dist/request-value-closure.js +2 -0
- package/dist/router/route-orchestration.d.ts +11 -16
- package/dist/router/route-orchestration.js +2 -12
- package/dist/rule-entry-list.d.ts +8 -7
- package/dist/rule-entry-list.js +2 -9
- package/dist/rules-consent.d.ts +6 -6
- package/dist/rules-consent.js +2 -0
- package/dist/run-cancel-context.d.ts +5 -5
- package/dist/run-local.d.ts +10 -10
- package/dist/runs.d.ts +13 -11
- package/dist/runs.js +15 -1
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-caps-resolver.js +1 -1
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +17 -12
- package/dist/sandbox-pkg-source.js +14 -9
- package/dist/sealed-key.d.ts +22 -3
- package/dist/sealed-key.js +47 -4
- package/dist/security.d.ts +23 -26
- package/dist/security.js +12 -9
- package/dist/server-secret-env.d.ts +10 -10
- package/dist/session-children-retire.d.ts +1 -1
- package/dist/session-error-wire.d.ts +7 -7
- package/dist/session-incarnation.d.ts +65 -37
- package/dist/session-incarnation.js +30 -12
- package/dist/session-policy-wire.d.ts +27 -5
- package/dist/session-policy-wire.js +15 -1
- package/dist/session-records-skipped-notice.d.ts +1 -1
- package/dist/session-row.d.ts +3 -17
- package/dist/session-row.js +4 -0
- package/dist/session-sync-kernel.d.ts +4 -4
- package/dist/session-sync.d.ts +61 -6
- package/dist/session-sync.js +55 -10
- package/dist/session-titler.d.ts +7 -6
- package/dist/session-titler.js +8 -13
- package/dist/session-watch.d.ts +3 -3
- package/dist/session-watch.js +4 -4
- package/dist/sighup-idle.d.ts +2 -2
- package/dist/spec-fields.d.ts +4 -4
- package/dist/sql-engine-posture.d.ts +3 -3
- package/dist/store-posture.d.ts +2 -2
- package/dist/stored-request-tool-axes-m19.d.ts +1 -1
- package/dist/task-a2a.d.ts +52 -79
- package/dist/task-a2a.js +224 -62
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +13 -17
- package/dist/task-mcp.js +29 -49
- package/dist/task-settings.d.ts +30 -18
- package/dist/task-settings.js +33 -3
- package/dist/task-workflow.d.ts +0 -24
- package/dist/task-workflow.js +2 -1
- package/dist/terminal.d.ts +5 -5
- package/dist/tighten-only-seats.d.ts +7 -6
- package/dist/tighten-only-seats.js +1 -1
- package/dist/tool-approval.d.ts +166 -207
- package/dist/tool-approval.js +61 -61
- package/dist/tool-rule-names.d.ts +2 -2
- package/dist/trace/core-keyset-guard.d.ts +13 -8
- package/dist/trace/engine-notice-wire.d.ts +5 -5
- package/dist/trace/engine-notice-wire.js +1 -0
- package/dist/trace/exit-seat.d.ts +31 -4
- package/dist/trace/exit-seat.js +69 -67
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +47 -45
- package/dist/trace/project.js +33 -1
- package/dist/trace/redact.d.ts +61 -31
- package/dist/trace/redact.js +394 -153
- package/dist/trace/self-minted-wire.d.ts +302 -14
- package/dist/trace/self-minted-wire.js +87 -0
- package/dist/trace/sema-provenance.d.ts +1 -1
- package/dist/trace/task-notification-facets.d.ts +4 -4
- package/dist/trace/wire-projection-faces.d.ts +3 -3
- package/dist/trace/wire-projection-faces.js +1 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential-refusal.d.ts +52 -0
- package/dist/url-credential-refusal.js +14 -0
- package/dist/url-refusal.d.ts +16 -3
- package/dist/url-refusal.js +15 -2
- package/dist/usage-analytics.d.ts +2 -2
- package/dist/user-input-ledger.d.ts +23 -23
- package/dist/web-admin-client/apply-effective.d.ts +5 -5
- package/dist/web-admin-client/apply-effective.js +2 -1
- package/dist/web-admin-client/apply-ledger.d.ts +2 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/facade.d.ts +5 -5
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
- package/dist/web-admin-client/http-client.d.ts +4 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/pull-state.d.ts +1 -1
- package/dist/web-admin-client/read-face.d.ts +2 -2
- package/dist/web-admin-client/read-warnings.d.ts +5 -5
- package/dist/web-admin-client/restart-signal.d.ts +6 -6
- package/dist/web-admin-client/skills-mcp.d.ts +28 -3
- package/dist/web-admin-client/skills-mcp.js +29 -1
- package/dist/web-admin-client/types.d.ts +16 -9
- package/dist/workspace-space.d.ts +32 -3
- package/dist/workspace-space.js +26 -0
- package/dist/write-protection.d.ts +2 -2
- package/package.json +5 -3
- package/scripts/drain-check-local.mjs +4 -2
- package/scripts/drain-check.mysql.sql +6 -2
- package/scripts/drain-check.pg.sql +6 -2
- package/skills/loop.md +1 -1
- package/skills/schedule.md +1 -1
- package/wire-changes/server@7.104.0.json +134 -0
- package/wire-changes/server@7.105.0.json +53 -0
- package/wire-changes/server@7.106.0.json +475 -0
- package/wire-changes/server@7.107.0.json +64 -0
- package/wire-changes/server@7.108.0.json +153 -0
- package/wire-changes/server@7.109.0.json +46 -0
- package/wire-changes/server@7.110.0.json +90 -0
- package/wire-changes/server@7.111.0.json +86 -0
- package/wire-changes/server@7.112.0.json +60 -0
- package/wire-changes/server@7.113.0.json +26 -0
- package/wire-changes/server@7.114.0.json +26 -0
- package/wire-changes/server@7.115.0.json +97 -0
- package/wire-changes/server@7.116.0.json +218 -0
- package/wire-changes/server@7.116.1.json +26 -0
- package/wire-changes/server@7.117.0.json +65 -0
- package/wire-changes/server@7.118.0.json +129 -0
- package/wire-changes/server@7.119.0.json +65 -0
- package/wire-changes/server@7.120.0.json +89 -0
- package/wire-changes/server@7.121.0.json +219 -0
- package/wire-changes/server@7.122.0.json +54 -0
- package/wire-changes/server@7.123.0.json +26 -0
- package/wire-changes/server@7.124.0.json +336 -0
- package/wire-changes/server@7.124.1.json +26 -0
- package/wire-changes/server@7.125.0.json +111 -0
- package/wire-changes/server@7.126.0.json +285 -0
- package/wire-changes/server@7.127.0.json +77 -0
- package/wire-changes/server@7.127.1.json +26 -0
- package/wire-changes/server@7.127.2.json +53 -0
- package/wire-changes/server@7.128.0.json +26 -0
- package/wire-changes/server@7.129.0.json +106 -0
- package/wire-changes/server@7.129.1.json +26 -0
- package/wire-changes/server@7.130.0.json +26 -0
- package/wire-changes/server@7.131.0.json +118 -0
- package/wire-changes/server@7.132.0.json +226 -0
- package/wire-changes/server@7.133.0.json +1155 -0
- package/wire-changes/server@7.134.0.json +107 -0
- package/wire-changes/server@7.135.0.json +174 -0
- package/wire-changes/server@7.136.0.json +448 -0
- package/dist/http/run-declared-families.d.ts +0 -16
- package/dist/http/run-declared-families.js +0 -12
- package/dist/orchestration/workflow-journal-entry.js +0 -27
package/dist/hosted-posture.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] / [ref](车LT,7.95.0)→ [ref] / B-10(车NB,7.99.0)—— **「这台部署是不是托管 / 多租」的单一铸点**。
|
|
3
3
|
*
|
|
4
4
|
* ## 为什么是一处
|
|
5
5
|
*
|
|
@@ -11,14 +11,12 @@
|
|
|
11
11
|
* ⚠️ 这句话此前在本仓被抄成「`boot/resolve-spec.ts` 阶段④ 的 `partitions` 字面量」——`src/` 里**没有**
|
|
12
12
|
* 那个字面量(全仓 `partitions` 的 src 命中全是注释;尺子:同目录 `config` 3721 命中)。手抄的**坐标**
|
|
13
13
|
* 比手抄的值更难发现烂掉,[ref] 的第一排查点就是它;
|
|
14
|
-
* ·
|
|
15
|
-
* (
|
|
16
|
-
* · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调)
|
|
17
|
-
* `
|
|
18
|
-
* · `additionalDirectories` / `additionalReadDirectories` ——
|
|
19
|
-
*
|
|
20
|
-
* · `settings.env` / `cwd` —— `cwdHonored ‖ deviceCwdHonored`,而
|
|
21
|
-
* **`deviceCwdHonored` 这一臂里没有 `requirePrincipal` 项**(`task-cwd.ts`:device 车道上那条路径落在
|
|
14
|
+
* · 能力授予面的赦免挂在「单主」上 —— 但**三条面读的是部署形表(`deployment-shape.ts`)里三个不同的行**
|
|
15
|
+
* (异源复核实测,别照「它们都一样」写;[ref] 起三行并排在一张表里,轴列即差异):
|
|
16
|
+
* · `settings.hooks` —— `task-settings.ts` 的 `taskHooksHonored`(唯一属主;resolve-spec 装配 / 受理面 / 能力位三处同调)= 表行
|
|
17
|
+
* `multiTenant` 的反面 ⇒ 采纳,否则忽略(**不看车道**,任何 `REMOTE_EXEC` 都一样);
|
|
18
|
+
* · `additionalDirectories` / `additionalReadDirectories` —— 表行 `callerOwnsWorkerDisk`(手在本 worker 盘上 ∧ 单主 = 今天只有 host);
|
|
19
|
+
* · `settings.env` / `cwd` —— 表行 `callerCwd`(读能力表 `callerCwd` 位:host 单主才开,**device 不读租户**:那条路径落在
|
|
22
20
|
* **发起者自己的设备**上,归属由 `device_session` 绑定行验过 ⇒ 跨租户面结构性不存在)。
|
|
23
21
|
*
|
|
24
22
|
* ⇒ 先把这个判定位铸成**一处**,再让各条腿都读它(clay 裁定③,2026-09-22):**不许各自加特判**——
|
|
@@ -36,7 +34,7 @@
|
|
|
36
34
|
* ⇒ 签发方配置是**身份验签轴**(谁的 JWT 算数),不是租户轴(这台机器有几个主人)。「受控于控制面」
|
|
37
35
|
* (`SEMA_WEB_ADMIN_*`,含 worker 名)同理是 fleet 管理轴,本判据同样不读。
|
|
38
36
|
*
|
|
39
|
-
* 随两臂一起删掉的(按类删干净,规则集变小):
|
|
37
|
+
* 随两臂一起删掉的(按类删干净,规则集变小):[ref] 腿①「托管 ∧ 未开 `REQUIRE_PRINCIPAL` ⇒ 拒启」
|
|
40
38
|
* (判据只剩读 `requirePrincipal` 的那一臂之后,那条合取恒假 ⇒ 结构上不可达)及其跨键不变量行;
|
|
41
39
|
* `run-local.ts` 为那两臂清 env 的清除口。
|
|
42
40
|
*
|
|
@@ -85,7 +83,7 @@ export interface HostedPostureFacts {
|
|
|
85
83
|
readonly evidence: readonly HostedEvidence[];
|
|
86
84
|
}
|
|
87
85
|
/**
|
|
88
|
-
* 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ `
|
|
86
|
+
* 判定位的**唯一**铸点(纯数据 ⇒ `build*`)。托管 ⇔ 部署形表行 `multiTenant`(= 运维声明 `REQUIRE_PRINCIPAL=true`,[ref] ①)。
|
|
89
87
|
*
|
|
90
88
|
* `evidence` 仍是数组(按词表顺序收**全部**命中):拒因逐字点它们,运维才知道改哪儿;词表是闭集,
|
|
91
89
|
* 形状不随词数变。
|
|
@@ -99,7 +97,19 @@ export declare function hostedEvidenceNote(e: HostedEvidence): string;
|
|
|
99
97
|
export type TaskWriteFaceInput = TaskHostPostureScope & Readonly<Pick<ServiceConfigFlat, "taskWriteFaceEscalation">>;
|
|
100
98
|
/** 任务层宿主姿态声明被拒时的 wire 子码(附录 A 的 `request.` 族)。 */
|
|
101
99
|
export declare const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
|
|
102
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* **射程判据** —— 这台部署认不认「任务层替它声明的宿主姿态」?
|
|
102
|
+
*
|
|
103
|
+
* 两条腿读它,都是**真的开门**的声明 ⇒ 都响亮拒(同码 {@link HOST_POSTURE_REFUSED_CODE}、同状态 422):
|
|
104
|
+
* · 腿② 写容纳面(bypassPermissions 开的写面)—— {@link taskWriteFaceRefusal};
|
|
105
|
+
* · 腿④ [ref] host shell 继承整份用户环境(`inheritEnv:"all"`)—— {@link taskInheritEnvRefusal}。
|
|
106
|
+
* [ref] 前还有腿③(`approverPosture`,忽略 + 留声),随那个请求键一起退役。射程只铸在这一处,同族声明读同一只。
|
|
107
|
+
*
|
|
108
|
+
* 🔴 **device 车道不适用(clay 裁定③ 2026-09-22)**:device 车道上 host 闸防的那个跨租户宿主穿越**结构性不存在**
|
|
109
|
+
* (路径落在**发起者自己的设备**上,归属由 `device_session` 绑定行 + 准入链的 owner 谓词验过),叠加 clay [ref]
|
|
110
|
+
* 「device 零额外审批」⇒ 在那条车道上拿租户声明当判据就是**用错轴**。与 `settings.env` / `cwd` 两键在那条车道上的既有臂同源同形。
|
|
111
|
+
* [ref] 起射程判据 = 部署形表行 `taskHostPostureDeclarations`(device 车道 ∨ 单主;轴列 lane + principal);下面是它读的键集(托管证据 + 车道)。
|
|
112
|
+
*/
|
|
103
113
|
export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceConfigFlat, "remoteExec">>;
|
|
104
114
|
/**
|
|
105
115
|
* **腿②** —— 这条请求要掀开写围栏,这台部署给不给?返回拒因;`undefined` = 放行。
|
|
@@ -109,7 +119,7 @@ export type TaskHostPostureScope = HostedPostureInput & Readonly<Pick<ServiceCon
|
|
|
109
119
|
* governance 的 `overrides.writeFace="roots"` 去压——实测 core 的 `tightenTaskSpec` 在
|
|
110
120
|
* base `open` × override `roots` 上**静默**取 `roots`(该函数零回调形参 ⇒ 没有留痕通道)。
|
|
111
121
|
*
|
|
112
|
-
* 🔴 **射程(含 device 车道那条对位臂)
|
|
122
|
+
* 🔴 **射程(含 device 车道那条对位臂)在部署形表行 `taskHostPostureDeclarations` 上** ——
|
|
113
123
|
* 两条腿同射程、不同处置,射程只有一处答案。
|
|
114
124
|
*/
|
|
115
125
|
export declare function taskWriteFaceRefusal(c: TaskWriteFaceInput): string | undefined;
|
package/dist/hosted-posture.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TASK_WRITE_FACE_ESCALATIONS } from "./config-types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "./deployment-shape.js";
|
|
3
3
|
export const HOSTED_EVIDENCE_WORDS = ["require-principal"];
|
|
4
4
|
export function buildHostedPosture(c) {
|
|
5
5
|
const evidence = [];
|
|
6
|
-
if (c
|
|
6
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.multiTenant.holds(c))
|
|
7
7
|
evidence.push("require-principal");
|
|
8
8
|
return { hosted: evidence.length > 0, evidence };
|
|
9
9
|
}
|
|
@@ -17,11 +17,6 @@ function hostedBecause(facts) {
|
|
|
17
17
|
return facts.evidence.map(hostedEvidenceNote).join("; ");
|
|
18
18
|
}
|
|
19
19
|
export const HOST_POSTURE_REFUSED_CODE = "request.host_posture_refused";
|
|
20
|
-
function hostPostureDeclarationsHonored(c) {
|
|
21
|
-
if (deviceCwdHonored(c))
|
|
22
|
-
return true;
|
|
23
|
-
return !buildHostedPosture(c).hosted;
|
|
24
|
-
}
|
|
25
20
|
export function taskWriteFaceRefusal(c) {
|
|
26
21
|
switch (c.taskWriteFaceEscalation) {
|
|
27
22
|
case "allow":
|
|
@@ -39,7 +34,7 @@ export function taskWriteFaceRefusal(c) {
|
|
|
39
34
|
`Set TASK_WRITE_FACE_ESCALATION to one of ${TASK_WRITE_FACE_ESCALATIONS.join(" | ")}, or unset it to let the deployment posture decide.`);
|
|
40
35
|
}
|
|
41
36
|
}
|
|
42
|
-
if (
|
|
37
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
|
|
43
38
|
return undefined;
|
|
44
39
|
const facts = buildHostedPosture(c);
|
|
45
40
|
return (`permissionMode:"bypassPermissions" opens the WRITE containment face (the engine's bypassPermissions mode writes outside the write roots) — the run could write outside the task root. ` +
|
|
@@ -47,7 +42,7 @@ export function taskWriteFaceRefusal(c) {
|
|
|
47
42
|
`Set TASK_WRITE_FACE_ESCALATION=allow if the DEPLOYMENT permits the task layer to open it, or omit permissionMode:"bypassPermissions".`);
|
|
48
43
|
}
|
|
49
44
|
export function taskInheritEnvRefusal(c) {
|
|
50
|
-
if (
|
|
45
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.taskHostPostureDeclarations.holds(c))
|
|
51
46
|
return undefined;
|
|
52
47
|
const facts = buildHostedPosture(c);
|
|
53
48
|
return (`inheritEnv:"all" hands the model-driven host shell this machine's WHOLE environment (credential-shaped variables included — the host lane scrubs them by default). ` +
|
package/dist/http/admission.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 提交准入(
|
|
2
|
+
* 提交准入([ref] 切片:`http/server.ts` 的 `prepareSpec` 与它的模块级校验词表逐字搬家,正文一字未改)。
|
|
3
3
|
* 读体 → 验型 → 授权 → 建 spec 的**唯一**一条链;tasks / runs / A2A 三个提交面共用它(抄一份 = 抄一份会漂的 400)。
|
|
4
4
|
* ctx 字段 3 只(`deps` / `readJson` / `runnerFor`),机器算(closure-free-vars)与手抄一致。
|
|
5
5
|
*/
|
|
@@ -59,7 +59,7 @@ export interface UserSkillsRefusal {
|
|
|
59
59
|
readonly facts?: LimitFacts;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
|
-
* core 7.41.0
|
|
62
|
+
* core 7.41.0 [ref] —— 顶层技能带 `manifest` 的拒因句(单铸点)。出路只点本服务上**真存在**的旋钮:技能的两只清单
|
|
63
63
|
* (`allowedTools` / `disallowedTools`)、圈工具 = deny 规则(请求 `settings.permissions.deny` / 运维 `APPROVAL_DENY`)或子代定义的
|
|
64
64
|
* `agents[].allowTools`、圈写路径 = 会话规则 `allowDirs`(`PUT /v1/sessions/:id/policy`)。
|
|
65
65
|
*/
|
package/dist/http/admission.js
CHANGED
|
@@ -2,7 +2,7 @@ import { APPROVAL_REACH, MCP_IMAGE_MAX_BASE64, isApprovalReach, isPermissionMode
|
|
|
2
2
|
import { isAtMentionable, matchCatalogModel, refusedCatalogEntry, selectableCatalog } from "../model-select.js";
|
|
3
3
|
import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
|
|
4
4
|
import { HttpError, sessionIdShapeIssue } from "../security.js";
|
|
5
|
-
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
5
|
+
import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, MAX_SETTINGS_ENV_VARS, MAX_SETTINGS_ENV_KEY_CHARS, MAX_SETTINGS_ENV_VALUE_CHARS, PERMISSION_MODE_WORDS, parseTaskSettings, settingsPermissionBucketIssue, skillListingBudgetFractionOk, skillListingMaxDescOk, hooksKeyIssue, stampEntryPermissionMode, taskHooksHonored, taskSettingsKeyIssue } from "../task-settings.js";
|
|
6
6
|
import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
|
|
7
7
|
import { approvalFrameFamiliesIssue } from "../tool-approval.js";
|
|
8
8
|
import { buildEntryModeClampNotice } from "../entry-mode-clamp-notice.js";
|
|
@@ -10,8 +10,8 @@ import { autonomyModeFloor } from "../runtime-governance.js";
|
|
|
10
10
|
import { taskBodyKeyIssue } from "../request-key-closure.js";
|
|
11
11
|
import { FILE_HISTORY_DISABLED_NO_RESTORE, fileHistoryRestoreConflict, fileHistoryRestoreKeysInBody, inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
|
|
12
12
|
import * as facts from "../capability-facts.js";
|
|
13
|
-
import { buildHooksRefusal, parseHooksConfig, hooksMatcherIssue } from "../hooks/hook-runner.js";
|
|
14
|
-
import {
|
|
13
|
+
import { buildHooksRefusal, buildHooksUrlCredentialRefusal, parseHooksConfig, hooksMatcherIssue, hooksUrlCredentialIssue } from "../hooks/hook-runner.js";
|
|
14
|
+
import { judgeFreshRequestWebSearch } from "../plugins/web-search.js";
|
|
15
15
|
import { normalizeApproachNotice, skillToolListOk, unknownTaskAgentModelRef, validateTaskAgents } from "../spec-fields.js";
|
|
16
16
|
import { allowSelectorWarningsOf, skillToolListsOverCap } from "../rule-entry-list.js";
|
|
17
17
|
import { limitFacts, limitRefusal } from "../limit-refusal.js";
|
|
@@ -300,6 +300,21 @@ export function createAdmission(ctx) {
|
|
|
300
300
|
sendError(res, 400, "request.field_invalid", refusal.message, { field: refusal.field, detail: refusal.detail });
|
|
301
301
|
return null;
|
|
302
302
|
}
|
|
303
|
+
{
|
|
304
|
+
const hooksKeys = hooksKeyIssue(st.hooks, hooksParsed.config);
|
|
305
|
+
if (hooksKeys) {
|
|
306
|
+
sendError(res, 400, "request.body_shape", hooksKeys.message, { unknownKeys: hooksKeys.unknownKeys, unsupportedKeys: hooksKeys.unsupportedKeys });
|
|
307
|
+
return null;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
{
|
|
311
|
+
const hookUrl = hooksUrlCredentialIssue(hooksParsed.config);
|
|
312
|
+
if (hookUrl !== undefined) {
|
|
313
|
+
const refusal = buildHooksUrlCredentialRefusal(hookUrl);
|
|
314
|
+
sendError(res, 400, "request.field_invalid", refusal.message, refusal.facts);
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
303
318
|
const toolMatcher = hooksMatcherIssue(hooksParsed.config, taskHooksHonored(deps.config) ? "regex" : "literal");
|
|
304
319
|
if (toolMatcher !== undefined) {
|
|
305
320
|
const refusal = buildHooksRefusal(toolMatcher);
|
|
@@ -308,9 +323,9 @@ export function createAdmission(ctx) {
|
|
|
308
323
|
}
|
|
309
324
|
}
|
|
310
325
|
{
|
|
311
|
-
const webSearchVerdict =
|
|
326
|
+
const webSearchVerdict = judgeFreshRequestWebSearch(st.webSearch);
|
|
312
327
|
if (webSearchVerdict.kind === "malformed") {
|
|
313
|
-
sendError(res, 400, "request.field_invalid", webSearchVerdict.issue);
|
|
328
|
+
sendError(res, 400, "request.field_invalid", webSearchVerdict.issue, webSearchVerdict.facts);
|
|
314
329
|
return null;
|
|
315
330
|
}
|
|
316
331
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 审批扫腿(
|
|
2
|
+
* 审批扫腿([ref] 切片:`http/server.ts` 5196–5488 逐字搬家,正文一字未改)——两条不经 HTTP 路由的赎回口:
|
|
3
3
|
* ①`denyExpiredApprovals`([ref] D-D,SLA 到期的 deny-sweep,main.ts 的 reaper 按拍调);
|
|
4
4
|
* ②`redeemParkedAsk`([ref],live 回决腿的 PARKED 赎回席,装配层接进协调器的晚绑座)。
|
|
5
5
|
* 两者都走 resume 家族的 `resumeCheckpoint`,所以它们的属主是「谁在无 HTTP 请求的情况下替人做决定」这件事,
|
|
@@ -3,7 +3,8 @@ const errText = (e) => redactHead(e instanceof Error ? e.message : String(e), 20
|
|
|
3
3
|
import { findParkOrigin } from "../parked-decide.js";
|
|
4
4
|
import { decodeCheckpointScope } from "../security.js";
|
|
5
5
|
import { hostDecisionFacts } from "../host-decision.js";
|
|
6
|
-
import {
|
|
6
|
+
import {} from "../tool-approval.js";
|
|
7
|
+
import { APPROVAL_GATE_KINDS } from "../approval-content-kind.js";
|
|
7
8
|
import { createWallClockJumpGuard } from "../wall-clock-jump-guard.js";
|
|
8
9
|
import { gatedPrincipal, hasServiceAuth } from "./principal-gate.js";
|
|
9
10
|
import { costQuotaRefusalOf } from "./request-guards.js";
|
|
@@ -223,13 +223,17 @@ export declare function storedBodyReplayAnswer(refusal: StoredBodyReplayRefusal,
|
|
|
223
223
|
* 封签里装的是那个 JSON 值本身,开封逐字还原。字典位上的容器本身不是字典(串 / 数组 / `null` / 封签形对象)⇒ 整只容器当一个值封。
|
|
224
224
|
* 于是落盘形里凭据位上**只有本封口铸的封签**,没有哪个值能「原样存下、续跑时被开成别的东西」(调用方送一只封签形对象 ⇒ 存的是再封一层,
|
|
225
225
|
* 开出来还是那只对象 —— 与新提交腿看到的同一个值)。没有封签器而有值要封 ⇒ 抛 {@link CheckpointCtxUnsealableError}(`no_key_store`,调用方在写之前拒)。
|
|
226
|
-
* · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG`
|
|
227
|
-
*
|
|
226
|
+
* · **读法记号**(与本文件另两只记号同一条「写的人盖章」):封口铸出的每一份落盘形都带 `credentialSeal: CHECKPOINT_CTX_SEAL_ALG` 与
|
|
227
|
+
* `credentialSlotGeneration`(= 这一行里**带值的**凭据位最新的那一代,最小 1)—— 这一行的凭据位全部由本封口封过,且它用到的位不比这一代新。
|
|
228
|
+
* 代数取「用到的」而不取「本版的」:不带新位值的行与上一代的写者写下的同形,回滚到上一代照读;代数比读者新 ⇒ 这一行**一定**带着读者不认识的位 ⇒ 读者整行拒。没有记号的行是 7.134.0 之前的写者写下的:
|
|
229
|
+
* 那时没有任何写者封值,所以它凭据位上的封签形对象只可能是调用方原样送来的,不是封签。代数缺席的带记号行是 7.134.0 的写者写下的 —— 它封的是第 1 代
|
|
230
|
+
* (闭集每行的 `since`);某一位的 `since` 大于这一行封过的代数 ⇒ 那一位上的值不论长什么样都没被封过(一只恰好长成封签形的明文字典也是明文)。
|
|
228
231
|
* 记号只在落盘形上(开口交出的开封形里没有它;写回再封时重新盖)。
|
|
229
232
|
* · **读**:一只开口 {@link openCheckpointCtx},唯一调用方 = 续跑上下文唯一读口 `resume-ctx-read.ts` 的 `readResumeCtx`(读出的 ctx 在任何消费者
|
|
230
|
-
* 看到之前已开封)
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
+
* 看到之前已开封)。逐值判词 = {@link credentialValueReading}(开口与 M28 同一只):行带当前记号、这一位在它封过的那一代里:凭据位上封签 ⇒ 开(开不开 ⇒ 拒);
|
|
234
|
+
* 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)⇒ 拒 `unrecognized_seal`;其余任何值 ⇒ 拒 `plaintext`。这一位比行封过的代数新 ⇒ 任何值 ⇒ 拒 `plaintext`。
|
|
235
|
+
* 行没有记号 ⇒ 凭据位上**任何**值(含封签形对象)⇒ 拒 `plaintext`(更早版本写下、M28 还没扫到);记号认不得(将来的格式)⇒
|
|
236
|
+
* 凭据位上任何值 ⇒ 拒 `unrecognized_seal`,凭据位上没有值的行不论记号照常开;代数认不得(比本版新 / 不是正整数)⇒ **整行**拒 `unrecognized_seal`(`field` = 记号位名),不看已知位上有没有值。
|
|
233
237
|
* **拒** = 读口第四态 `unsealable`(`field` = 哪一个凭据位,`reason` ∈ {@link CHECKPOINT_CTX_UNSEALABLE_REASONS}),各续跑入口答
|
|
234
238
|
* `409 conflict.checkpoint_ctx_unsealable`(`resume-ctx-read.ts` 的 `resumeCtxUnsealableAnswer`)。**没有**明文回落臂、**没有**静默丢键臂。
|
|
235
239
|
* · **装配**:`checkpointStore` 在场而封签器缺席 ⇒ 拒启({@link CHECKPOINT_CTX_SEALING_REQUIRED};`createHttpServer` 与起服第 6 段同一句)。
|
|
@@ -264,33 +268,68 @@ export interface CheckpointCtxSealing extends CheckpointCtxSealer, CheckpointCtx
|
|
|
264
268
|
}
|
|
265
269
|
/**
|
|
266
270
|
* **凭据位闭集**(提交体里值为凭据的位置)。路径段 `*` = 那一格容器的**每一个成员**:数组的每一项、字典的每一个值(一只走法,不分容器种类 —— 字典成员的点名形
|
|
267
|
-
* `field` 是 `.<键>`,数组是 `[<下标>]`)。`map` = 那一格是串值字典,**每一个值**都是凭据(不分哪一键);`value` =
|
|
268
|
-
* 入表判据(一条)
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
271
|
+
* `field` 是 `.<键>`,数组是 `[<下标>]`)。`map` = 那一格是串值字典,**每一个值**都是凭据(不分哪一键);`value` = 那一格本身是凭据(不论是串、数组还是别的形,整只一个值)。
|
|
272
|
+
* 入表判据(一条):本服务替调用方**原样交出去**的配置值 —— **子进程的启动面**(命令行 `command` / `args` 与交给它的 env)、发往对端的**静态请求头**、
|
|
273
|
+
* 请求自带的**搜索后端钥匙**。值是不是秘密不是本层能判的,所以整格封、不判值形(`--token=…` / `-p …` 拆在两个元素里、shell 形的整行,都不靠认形)。
|
|
274
|
+
* · 子进程两座:MCP stdio 传输(`command` / `args` / `env`)与 command hook 条目(`command` / `args`,插件选项 `plugin.options` 的每一个值就是 hook 子进程环境里的
|
|
275
|
+
* `CLAUDE_PLUGIN_OPTION_<KEY>` —— `hooks/command-spawn.ts` 的 `hookPluginEnv`),外加任务 shell 的 `settings.env`。命令行与 env 同判:壳在投影前把 `${user_config.*}`
|
|
276
|
+
* 替成字面值(执行器不做这一替换),参照实现也把 sensitive 选项照样交进子进程,所以命令行里可以就是密钥。`args` 整只数组封成**一只**封签(不逐元素:逐元素判值形是第二只判官)。
|
|
277
|
+
* · 静态头三座:MCP http 传输、A2A 对端〔引擎型注:「e.g. an auth bearer」〕、http hook 条目(契约包的条目形是 `headers: Record<string, string>`、受理面(`parseHooksConfig`)
|
|
278
|
+
* 只判条数与字数、`interpolateHookEnvVars` 只换 `$NAME` 引用而字面值原样上 wire —— 头值可以就是字面的 `Authorization: Bearer …`)。
|
|
279
|
+
* hooks 的形 = 事件名 → 匹配组数组 → 组的 `hooks` 数组 → 条目;只有 `type:"http"` 的条目有 `headers`、只有 command 条目有 `command` / `args` / `plugin.options`,
|
|
280
|
+
* 别的条目在那一段缺席、走法照常不往下走。**不在本表、各归另一条规则**:值是 URL 的字段 —— 带凭据的 URL 在受理口就拒(凭据只许走头位;判官 = 契约包根的 `findUrlCredential`),
|
|
281
|
+
* 所以落盘的 URL 结构上不带凭据;交给模型的文本(目标 / 提示词 / 系统提示)—— 模型看得见的东西本来就进会话记录,封停驻档护不住它。
|
|
282
|
+
* 加一位 = 加一行,读写两侧与一次性迁移 M28 共用 {@link mapCredentialSlots} 一只走法:写侧与读侧立即覆盖;已落盘的行由 M28 补封 ——
|
|
283
|
+
* 新行的 `since` 取下一代:封口铸的落盘形盖「这一行里带值的位最新的那一代」(`credentialSlotGeneration`),读者据它判那一行用到、封过哪几位 —— 代数更早的行上新位的值一律是明文(记号本身不证明它封过新位)。
|
|
284
|
+
* M28 封的是「读口会答 `plaintext` 的每一个值」({@link credentialValueReading}),所以新加的一位上的明文在带记号的行里也被补封(只在 M28 的窗内;窗外加位要另起迁移)。
|
|
274
285
|
*/
|
|
275
286
|
export declare const CHECKPOINT_CTX_CREDENTIAL_SLOTS: readonly [{
|
|
276
287
|
readonly path: readonly ["mcpServers", "*", "transport", "headers"];
|
|
277
288
|
readonly holds: "map";
|
|
289
|
+
readonly since: 1;
|
|
278
290
|
}, {
|
|
279
291
|
readonly path: readonly ["mcpServers", "*", "transport", "env"];
|
|
280
292
|
readonly holds: "map";
|
|
293
|
+
readonly since: 1;
|
|
281
294
|
}, {
|
|
282
295
|
readonly path: readonly ["a2aPeers", "*", "headers"];
|
|
283
296
|
readonly holds: "map";
|
|
297
|
+
readonly since: 1;
|
|
284
298
|
}, {
|
|
285
299
|
readonly path: readonly ["settings", "env"];
|
|
286
300
|
readonly holds: "map";
|
|
301
|
+
readonly since: 1;
|
|
287
302
|
}, {
|
|
288
303
|
readonly path: readonly ["settings", "webSearch", "apiKey"];
|
|
289
304
|
readonly holds: "value";
|
|
305
|
+
readonly since: 1;
|
|
290
306
|
}, {
|
|
291
307
|
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "headers"];
|
|
292
308
|
readonly holds: "map";
|
|
309
|
+
readonly since: 1;
|
|
310
|
+
}, {
|
|
311
|
+
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "plugin", "options"];
|
|
312
|
+
readonly holds: "map";
|
|
313
|
+
readonly since: 2;
|
|
314
|
+
}, {
|
|
315
|
+
readonly path: readonly ["mcpServers", "*", "transport", "command"];
|
|
316
|
+
readonly holds: "value";
|
|
317
|
+
readonly since: 3;
|
|
318
|
+
}, {
|
|
319
|
+
readonly path: readonly ["mcpServers", "*", "transport", "args"];
|
|
320
|
+
readonly holds: "value";
|
|
321
|
+
readonly since: 3;
|
|
322
|
+
}, {
|
|
323
|
+
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "command"];
|
|
324
|
+
readonly holds: "value";
|
|
325
|
+
readonly since: 3;
|
|
326
|
+
}, {
|
|
327
|
+
readonly path: readonly ["settings", "hooks", "*", "*", "hooks", "*", "args"];
|
|
328
|
+
readonly holds: "value";
|
|
329
|
+
readonly since: 3;
|
|
293
330
|
}];
|
|
331
|
+
/** 本版闭集的代数 = 表里最大的 `since`(读者认得的最新一代)。落盘形的 `credentialSlotGeneration` 不大于它;大于它的行是更新的写者带着本版不认识的位写下的。 */
|
|
332
|
+
export declare const CHECKPOINT_CTX_CREDENTIAL_GENERATION: number;
|
|
294
333
|
/** 开不开 / 封不了的成因(闭集):`no_key_store` = 这台副本没有封签器(没有保管店);`key_not_held` = 封它的那把钥匙不在这台副本的保管店里
|
|
295
334
|
* (多副本不共享 `<数据根>/sealed-key/`,或保管目录被换过);`unopenable` = 钥匙在、开不开(密文坏 / 不是这一行封的 / 不是停驻行信封);
|
|
296
335
|
* `plaintext` = 凭据位上是明文(更早版本的写者);`unrecognized_seal` = 带 `sealed` 键却不是本闭集的封签形(含将来的 `alg`)。 */
|
|
@@ -312,6 +351,8 @@ export type StoredCheckpointCtx = Omit<CheckpointCtx, "body"> & {
|
|
|
312
351
|
readonly [key: string]: unknown;
|
|
313
352
|
};
|
|
314
353
|
readonly credentialSeal?: typeof CHECKPOINT_CTX_SEAL_ALG;
|
|
354
|
+
/** 这一行的写者封过的闭集代数(读法记号的另一半;缺席 + 带 `credentialSeal` = 7.134.0 的写者 = 第 1 代)。 */
|
|
355
|
+
readonly credentialSlotGeneration?: number;
|
|
315
356
|
};
|
|
316
357
|
declare const sealedCheckpointCtxBrand: unique symbol;
|
|
317
358
|
/**
|
|
@@ -323,7 +364,7 @@ export type SealedCheckpointCtx = StoredCheckpointCtx & {
|
|
|
323
364
|
readonly [sealedCheckpointCtxBrand]: true;
|
|
324
365
|
};
|
|
325
366
|
/** 装配期拒启的那一句(`createHttpServer` 与起服第 6 段同调;一句、一个出口)。 */
|
|
326
|
-
export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (
|
|
367
|
+
export declare const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (static request headers, the command lines and environment values given to MCP stdio servers and command hooks, settings.env, settings.webSearch.apiKey) in their resume context, and they are stored sealed or not at all \u2014 give the service a sealed-key store for them (this service builds it at boot in checkpoint-ctx-keys/ under the sealed-key custody directory \u2014 SEALED_KEY_DIR, default <data root>/sealed-key/; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning \u2014 make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
|
|
327
368
|
/** 封签形的判官(恰三键、三值皆串、`alg` 是本闭集那一个词)。 */
|
|
328
369
|
export declare function isSealedCheckpointValue(v: unknown): v is SealedCheckpointValue;
|
|
329
370
|
/**
|
|
@@ -343,7 +384,7 @@ export type OpenedCheckpointCtx = {
|
|
|
343
384
|
};
|
|
344
385
|
/**
|
|
345
386
|
* **开口**(读的一侧唯一的一只;唯一调用方 = 续跑上下文读口 `readResumeCtx`):落盘形 ⇒ 开封形。`opener` 缺席 = 这台副本没有保管店(体里有封签就
|
|
346
|
-
* `no_key_store`;没有凭据的行照常开)
|
|
387
|
+
* `no_key_store`;没有凭据的行照常开)。判词见本段头注与 {@link credentialValueReading}。
|
|
347
388
|
*/
|
|
348
389
|
export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: CheckpointCtxOpener | undefined, sessionId: string): OpenedCheckpointCtx;
|
|
349
390
|
/**
|
|
@@ -354,9 +395,13 @@ export declare function openCheckpointCtx(stored: StoredCheckpointCtx, opener: C
|
|
|
354
395
|
export declare function sealedCredentialFieldOf(stored: unknown): string | undefined;
|
|
355
396
|
/**
|
|
356
397
|
* 🔴 **一次性迁移 M28 的行改写**(窗与删法见 `plugins/one-time-migrations.ts` 登记表 M28;编排 = `checkpoint-ctx-seal-m28.ts`):一行存量 ctx
|
|
357
|
-
* (持久化 JSON,不信型面)
|
|
358
|
-
* 与写侧 {@link sealCheckpointCtx}
|
|
359
|
-
*
|
|
398
|
+
* (持久化 JSON,不信型面)凭据位上**读口会答 `plaintext` 的每一个值**({@link credentialValueReading},与开口同一只判词)用同一只封口封好、盖记号 ——
|
|
399
|
+
* 与写侧 {@link sealCheckpointCtx} 同一条规则。两种存量行落在这一条里:
|
|
400
|
+
* · 没有读法记号的行(7.134.0 之前的写者)—— 每一个值都是 `plaintext`(含调用方原样送来的封签形对象)⇒ 全封;
|
|
401
|
+
* · 带当前记号、而某一位比行封过的代数新的行(7.134.0 的写者封第 1 代,没封第 2 代的 `plugin.options`)—— 那一位上的值不论长什么样都是明文 ⇒ 封
|
|
402
|
+
* (恰好长成封签形的选项字典按字典容器整只封,开出来还是那只字典);行封过的那一代里的封签不动。改写后的行盖「带值的位最新的那一代」(与封口同一条)。
|
|
403
|
+
* 读口会答 `seal` / `unrecognized_seal` 的值不动(认不得的留给读口拒);一个值都没封 ⇒ `undefined`(不写:第二跑零命中;记号认不得的行因此一个字节不动);
|
|
404
|
+
* 体不是对象 ⇒ `undefined`(读口自己的形判接住)。其余位(另两只记号、写者版本、非凭据字段)原样。
|
|
360
405
|
*/
|
|
361
406
|
export declare function sealStoredCheckpointCtxM28(stored: object, sealer: CheckpointCtxSealer, sessionId: string): {
|
|
362
407
|
readonly ctx: SealedCheckpointCtx;
|
|
@@ -125,13 +125,19 @@ function storedBodyReplayArmAnswer(refusal, readerVersion) {
|
|
|
125
125
|
}
|
|
126
126
|
export const CHECKPOINT_CTX_SEAL_ALG = "checkpoint-ctx-sealedbox-v1";
|
|
127
127
|
export const CHECKPOINT_CTX_CREDENTIAL_SLOTS = [
|
|
128
|
-
{ path: ["mcpServers", "*", "transport", "headers"], holds: "map" },
|
|
129
|
-
{ path: ["mcpServers", "*", "transport", "env"], holds: "map" },
|
|
130
|
-
{ path: ["a2aPeers", "*", "headers"], holds: "map" },
|
|
131
|
-
{ path: ["settings", "env"], holds: "map" },
|
|
132
|
-
{ path: ["settings", "webSearch", "apiKey"], holds: "value" },
|
|
133
|
-
{ path: ["settings", "hooks", "*", "*", "hooks", "*", "headers"], holds: "map" },
|
|
128
|
+
{ path: ["mcpServers", "*", "transport", "headers"], holds: "map", since: 1 },
|
|
129
|
+
{ path: ["mcpServers", "*", "transport", "env"], holds: "map", since: 1 },
|
|
130
|
+
{ path: ["a2aPeers", "*", "headers"], holds: "map", since: 1 },
|
|
131
|
+
{ path: ["settings", "env"], holds: "map", since: 1 },
|
|
132
|
+
{ path: ["settings", "webSearch", "apiKey"], holds: "value", since: 1 },
|
|
133
|
+
{ path: ["settings", "hooks", "*", "*", "hooks", "*", "headers"], holds: "map", since: 1 },
|
|
134
|
+
{ path: ["settings", "hooks", "*", "*", "hooks", "*", "plugin", "options"], holds: "map", since: 2 },
|
|
135
|
+
{ path: ["mcpServers", "*", "transport", "command"], holds: "value", since: 3 },
|
|
136
|
+
{ path: ["mcpServers", "*", "transport", "args"], holds: "value", since: 3 },
|
|
137
|
+
{ path: ["settings", "hooks", "*", "*", "hooks", "*", "command"], holds: "value", since: 3 },
|
|
138
|
+
{ path: ["settings", "hooks", "*", "*", "hooks", "*", "args"], holds: "value", since: 3 },
|
|
134
139
|
];
|
|
140
|
+
export const CHECKPOINT_CTX_CREDENTIAL_GENERATION = Math.max(...CHECKPOINT_CTX_CREDENTIAL_SLOTS.map((slot) => slot.since));
|
|
135
141
|
export const CHECKPOINT_CTX_UNSEALABLE_REASONS = ["no_key_store", "key_not_held", "unopenable", "plaintext", "unrecognized_seal"];
|
|
136
142
|
export class CheckpointCtxUnsealableError extends Error {
|
|
137
143
|
field;
|
|
@@ -146,7 +152,7 @@ export class CheckpointCtxUnsealableError extends Error {
|
|
|
146
152
|
function mintSealedCheckpointCtx(sealed) {
|
|
147
153
|
return sealed;
|
|
148
154
|
}
|
|
149
|
-
export const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (
|
|
155
|
+
export const CHECKPOINT_CTX_SEALING_REQUIRED = "a durable checkpoint store is wired but checkpointCtxSealing is not: suspended tasks keep the request's credentials (static request headers, the command lines and environment values given to MCP stdio servers and command hooks, settings.env, settings.webSearch.apiKey) in their resume context, and they are stored sealed or not at all — give the service a sealed-key store for them (this service builds it at boot in checkpoint-ctx-keys/ under the sealed-key custody directory — SEALED_KEY_DIR, default <data root>/sealed-key/; a failure there is the earlier checkpoint_ctx_sealing_unavailable warning — make that directory creatable and chmod-able by the service, or repair or remove a key file there whose public and private halves do not belong together), or, when embedding, pass checkpointCtxSealing: await ensureCheckpointCtxSealing(sealedKeyDir); refusing to start rather than write credentials in plaintext";
|
|
150
156
|
const isRecord = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
151
157
|
export function isSealedCheckpointValue(v) {
|
|
152
158
|
if (!isRecord(v))
|
|
@@ -160,7 +166,7 @@ function defineOwn(target, key, value) {
|
|
|
160
166
|
function mapCredentialSlots(body, visit) {
|
|
161
167
|
let out = body;
|
|
162
168
|
for (const slot of CHECKPOINT_CTX_CREDENTIAL_SLOTS)
|
|
163
|
-
out = mapAt(out, slot.path, 0, slot.holds, "", visit);
|
|
169
|
+
out = mapAt(out, slot.path, 0, slot.holds, "", (value, field) => visit(value, field, slot));
|
|
164
170
|
return out;
|
|
165
171
|
}
|
|
166
172
|
function mapAt(node, path, i, holds, field, visit) {
|
|
@@ -213,42 +219,70 @@ function memberField(field, key) {
|
|
|
213
219
|
}
|
|
214
220
|
function sealBody(body, sealer, sessionId) {
|
|
215
221
|
let valuesSealed = 0;
|
|
216
|
-
|
|
222
|
+
let generation = 1;
|
|
223
|
+
const sealed = mapCredentialSlots(body, (value, field, slot) => {
|
|
217
224
|
if (sealer === undefined)
|
|
218
225
|
throw new CheckpointCtxUnsealableError(field, "no_key_store");
|
|
219
226
|
valuesSealed += 1;
|
|
227
|
+
generation = Math.max(generation, slot.since);
|
|
220
228
|
return sealer.seal(value, sessionId);
|
|
221
229
|
});
|
|
222
|
-
return { body: sealed, valuesSealed };
|
|
230
|
+
return { body: sealed, valuesSealed, generation };
|
|
223
231
|
}
|
|
224
232
|
export function sealCheckpointCtx(ctx, sealer, sessionId) {
|
|
225
|
-
const { body } = sealBody(ctx.body, sealer, sessionId);
|
|
226
|
-
return mintSealedCheckpointCtx({ ...ctx, body: body, credentialSeal: CHECKPOINT_CTX_SEAL_ALG });
|
|
233
|
+
const { body, generation } = sealBody(ctx.body, sealer, sessionId);
|
|
234
|
+
return mintSealedCheckpointCtx({ ...ctx, body: body, credentialSeal: CHECKPOINT_CTX_SEAL_ALG, credentialSlotGeneration: generation });
|
|
235
|
+
}
|
|
236
|
+
const CREDENTIAL_GENERATION_FIELD = "credentialSlotGeneration";
|
|
237
|
+
function credentialStampOf(stored) {
|
|
238
|
+
const stamp = stored.credentialSeal;
|
|
239
|
+
const raw = stored.credentialSlotGeneration;
|
|
240
|
+
const generation = raw === undefined ? 1 : Number.isInteger(raw) && raw >= 1 && raw <= CHECKPOINT_CTX_CREDENTIAL_GENERATION ? raw : undefined;
|
|
241
|
+
return { stamp, generation };
|
|
242
|
+
}
|
|
243
|
+
function credentialValueReading(row, slot, value) {
|
|
244
|
+
if (row.stamp === undefined)
|
|
245
|
+
return "plaintext";
|
|
246
|
+
if (row.stamp !== CHECKPOINT_CTX_SEAL_ALG || row.generation === undefined)
|
|
247
|
+
return "unrecognized_seal";
|
|
248
|
+
if (slot.since > row.generation)
|
|
249
|
+
return "plaintext";
|
|
250
|
+
if (isSealedCheckpointValue(value))
|
|
251
|
+
return "seal";
|
|
252
|
+
if (isRecord(value) && Object.hasOwn(value, "sealed"))
|
|
253
|
+
return "unrecognized_seal";
|
|
254
|
+
return "plaintext";
|
|
227
255
|
}
|
|
228
256
|
export function openCheckpointCtx(stored, opener, sessionId) {
|
|
229
|
-
const { credentialSeal, ...rest } = stored;
|
|
230
|
-
const
|
|
257
|
+
const { credentialSeal: _stamp, credentialSlotGeneration: _generation, ...rest } = stored;
|
|
258
|
+
const row = credentialStampOf(stored);
|
|
259
|
+
if (row.stamp === CHECKPOINT_CTX_SEAL_ALG && row.generation === undefined)
|
|
260
|
+
return { kind: "unsealable", field: CREDENTIAL_GENERATION_FIELD, reason: "unrecognized_seal" };
|
|
231
261
|
try {
|
|
232
|
-
const body = mapCredentialSlots(stored.body, (value, field) => {
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
262
|
+
const body = mapCredentialSlots(stored.body, (value, field, slot) => {
|
|
263
|
+
const reading = credentialValueReading(row, slot, value);
|
|
264
|
+
switch (reading) {
|
|
265
|
+
case "plaintext":
|
|
266
|
+
case "unrecognized_seal":
|
|
267
|
+
throw new CheckpointCtxUnsealableError(field, reading);
|
|
268
|
+
case "seal": {
|
|
269
|
+
const sealed = value;
|
|
270
|
+
if (opener === undefined)
|
|
271
|
+
throw new CheckpointCtxUnsealableError(field, "no_key_store");
|
|
272
|
+
if (!opener.holds(sealed.publicKeyId))
|
|
273
|
+
throw new CheckpointCtxUnsealableError(field, "key_not_held");
|
|
274
|
+
try {
|
|
275
|
+
return opener.open(sealed, sessionId);
|
|
276
|
+
}
|
|
277
|
+
catch {
|
|
278
|
+
throw new CheckpointCtxUnsealableError(field, "unopenable");
|
|
279
|
+
}
|
|
244
280
|
}
|
|
245
|
-
|
|
246
|
-
|
|
281
|
+
default: {
|
|
282
|
+
const unreachable = reading;
|
|
283
|
+
return unreachable;
|
|
247
284
|
}
|
|
248
285
|
}
|
|
249
|
-
if (isRecord(value) && Object.hasOwn(value, "sealed"))
|
|
250
|
-
throw new CheckpointCtxUnsealableError(field, "unrecognized_seal");
|
|
251
|
-
throw new CheckpointCtxUnsealableError(field, "plaintext");
|
|
252
286
|
});
|
|
253
287
|
return { kind: "ok", ctx: { ...rest, body: body } };
|
|
254
288
|
}
|
|
@@ -270,12 +304,21 @@ export function sealedCredentialFieldOf(stored) {
|
|
|
270
304
|
return first;
|
|
271
305
|
}
|
|
272
306
|
export function sealStoredCheckpointCtxM28(stored, sealer, sessionId) {
|
|
273
|
-
|
|
274
|
-
return undefined;
|
|
307
|
+
const row = credentialStampOf(stored);
|
|
275
308
|
const body = stored.body;
|
|
276
309
|
if (!isRecord(body))
|
|
277
310
|
return undefined;
|
|
278
|
-
|
|
279
|
-
|
|
311
|
+
let valuesSealed = 0;
|
|
312
|
+
let generation = 1;
|
|
313
|
+
const sealed = mapCredentialSlots(body, (value, _field, slot) => {
|
|
314
|
+
generation = Math.max(generation, slot.since);
|
|
315
|
+
if (credentialValueReading(row, slot, value) !== "plaintext")
|
|
316
|
+
return value;
|
|
317
|
+
valuesSealed += 1;
|
|
318
|
+
return sealer.seal(value, sessionId);
|
|
319
|
+
});
|
|
320
|
+
return valuesSealed === 0
|
|
321
|
+
? undefined
|
|
322
|
+
: { ctx: mintSealedCheckpointCtx({ ...stored, body: sealed, credentialSeal: CHECKPOINT_CTX_SEAL_ALG, credentialSlotGeneration: generation }), valuesSealed };
|
|
280
323
|
}
|
|
281
324
|
//# sourceMappingURL=checkpoint-ctx.js.map
|
package/dist/http/dispatch.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 请求流水线(
|
|
2
|
+
* 请求流水线([ref] 切片:`http/server.ts` 的 `handle()` 与它的模块级词表搬家;[ref] 再把「这是什么路由」
|
|
3
3
|
* 整件事交给 `./route-table.ts`)。
|
|
4
4
|
*
|
|
5
5
|
* 住在这里的是**一条请求从进门到落地**的全过程,一件事一遍:admission 计数 / 附着登记 / CORS / /health /
|
|
6
6
|
* /metrics / 鉴权桥 / 全局服务凭据门 / 无凭据写门 / drain 与 roster-pending 两道 503 / 破坏性会话写门 /
|
|
7
7
|
* 两段分派 / 全局 404。
|
|
8
8
|
*
|
|
9
|
-
* 🔴
|
|
9
|
+
* 🔴 [ref] 之后本文件**不再持有任何一份路由名单**:分派序、门侧、标签、三只门的判据全部读
|
|
10
10
|
* `ROUTES` / `ROUTE_DECLARATIONS`(见 route-table.ts 头注)。三道门也不再「按行号插在 37 只 if 中间」——
|
|
11
11
|
* 它们在门前段与门后段之间**恒定一处**执行,三段代码逐字未动,只是不再被域调用夹着。
|
|
12
12
|
*
|
|
@@ -19,7 +19,7 @@ import type { ServiceConfig } from "../config-types.js";
|
|
|
19
19
|
import type { RouteCtxBase, RunRegistry } from "./route-ctx.js";
|
|
20
20
|
import type { FlatServiceDeps } from "./server.js";
|
|
21
21
|
/**
|
|
22
|
-
* 🔴
|
|
22
|
+
* 🔴 [ref](test T-72 [ref];主会话裁 ①,分诊 [ref])—— 全局服务凭据门**之前**那几族只读路
|
|
23
23
|
* (`route-table.ts` 里 `position: "read-credential"` 的行)的**唯一**鉴权谓词:「服务凭据 ∨ 已验 principal」。
|
|
24
24
|
*
|
|
25
25
|
* 病:这几族(trace-usage / workflows / fleet)排在全局门之前,理由只有一条 —— 只读 `TRACE_TOKEN` 单凭据的调用方
|
package/dist/http/dispatch.js
CHANGED
|
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
|
|
2
2
|
import { setSsoPrincipal, ssoVerifiedPrincipal, setSsoScope, setSsoRole, isDestructiveSessionWrite, PRINCIPAL_TOKEN_HEADER, APPROVAL_MAC_HEADER, APPROVAL_MAC_KID_HEADER } from "../security.js";
|
|
3
3
|
import { publicStoreProbeError } from "../store-live-probe.js";
|
|
4
4
|
import { looksLikeJwt } from "@sema-agent/settings-schema/api/auth-bridge";
|
|
5
|
+
import { admitBridgeIdentity } from "../auth-bridge.js";
|
|
5
6
|
import { ROUTE_METHOD_ORDER } from "./route-ctx.js";
|
|
6
7
|
import { READ_CREDENTIAL_ROUTES, PUBLIC_ROUTES, POST_CREDENTIAL_ROUTES, routeLabel, isBillableSubmitPath, billableKindOf, isCredentialGatedRewrite, isMethodDispatchedSubmitPath, lookupRoute, isProbePath, isSubscriptionRequest } from "./route-table.js";
|
|
7
8
|
import { sendJson, sendError, isSseResponse, endSseWithError } from "./send.js";
|
|
@@ -212,15 +213,14 @@ export function createDispatch(ctx) {
|
|
|
212
213
|
const authz = req.headers.authorization ?? "";
|
|
213
214
|
const rawBearer = /^Bearer\s/i.test(authz) ? authz.replace(/^Bearer\s+/i, "") : "";
|
|
214
215
|
if (rawBearer && looksLikeJwt(rawBearer)) {
|
|
215
|
-
const
|
|
216
|
-
if (
|
|
217
|
-
setSsoPrincipal(req,
|
|
218
|
-
req.headers[deps.config.principalHeader.toLowerCase()] =
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
deps.logger?.info?.("auth_bridge_principal_accepted", { principal: v.identity.principal, ...(v.identity.scope ? { scope: v.identity.scope } : {}) });
|
|
216
|
+
const identity = admitBridgeIdentity(await deps.webAdminJwtVerifier.verify(rawBearer), { logger: deps.logger, metrics: deps.metrics });
|
|
217
|
+
if (identity) {
|
|
218
|
+
setSsoPrincipal(req, identity.principal);
|
|
219
|
+
req.headers[deps.config.principalHeader.toLowerCase()] = identity.principal;
|
|
220
|
+
setSsoScope(req, identity.scope);
|
|
221
|
+
if (identity.role)
|
|
222
|
+
setSsoRole(req, identity.role);
|
|
223
|
+
deps.logger?.info?.("auth_bridge_principal_accepted", { principal: identity.principal, scope: identity.scope });
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -12,6 +12,7 @@ import { recordResourceWindow } from "../resource-window.js";
|
|
|
12
12
|
import { persistSubmitCtx } from "./submit-ctx.js";
|
|
13
13
|
import { releaseClaimedRun } from "./claimed-run.js";
|
|
14
14
|
import { serviceVersion } from "../service-version.js";
|
|
15
|
+
import { headReadOf } from "../session-incarnation.js";
|
|
15
16
|
export async function mintAndDriveDurableRun(ctx, runStore, args) {
|
|
16
17
|
const { deps } = ctx;
|
|
17
18
|
const { inflightRuns, preemptableRuns, steerableRuns } = ctx.registry;
|
|
@@ -59,10 +60,10 @@ export async function mintAndDriveDurableRun(ctx, runStore, args) {
|
|
|
59
60
|
}
|
|
60
61
|
commitSessionInheritEnv(deps, args.prepared.spec.sessionId, args.prepared.body);
|
|
61
62
|
const anchorOwner = args.prepared.auth?.principal ?? null;
|
|
62
|
-
const
|
|
63
|
-
const captureTurnAnchor = deps.resumeAnchorStore &&
|
|
63
|
+
const headOf = headReadOf(deps.sessionStorage);
|
|
64
|
+
const captureTurnAnchor = deps.resumeAnchorStore && headOf
|
|
64
65
|
? async (eventId) => {
|
|
65
|
-
const leaf = await
|
|
66
|
+
const leaf = (await headOf(sessionId))?.leafId;
|
|
66
67
|
if (leaf)
|
|
67
68
|
await deps.resumeAnchorStore.put(sessionId, eventId, leaf, anchorOwner);
|
|
68
69
|
}
|