@sema-agent/server 7.133.0 → 7.135.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 +221 -0
- package/README.md +2 -2
- package/README.zh-CN.md +2 -2
- package/USAGE.md +222 -36
- package/deploy/sema-up/README.md +16 -0
- package/deploy/sema-up/chart/Chart.yaml +1 -1
- package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
- package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
- package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
- package/deploy/sema-up/chart/templates/server.yaml +14 -0
- package/deploy/sema-up/chart/values-full-single.yaml +5 -1
- package/deploy/sema-up/chart/values.yaml +34 -0
- package/dist/adoption/plan.d.ts +1 -1
- package/dist/approval-ask-audit-store.d.ts +25 -25
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +66 -154
- package/dist/approval-card.js +33 -52
- package/dist/approval-content-kind.d.ts +26 -6
- package/dist/approval-content-kind.js +23 -3
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-gate-currency.d.ts +91 -0
- package/dist/approval-gate-currency.js +120 -0
- 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 +14 -8
- package/dist/approval.js +35 -16
- package/dist/auth-bridge.d.ts +1 -1
- 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/coordinators.d.ts +7 -2
- package/dist/boot/coordinators.js +8 -5
- 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 +2 -0
- package/dist/boot/leader.js +2 -1
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-consolidation.d.ts +15 -15
- package/dist/boot/parked-revive-gate.d.ts +3 -3
- package/dist/boot/parked-revive-gate.js +3 -2
- package/dist/boot/read-deny-anchor-audit.js +2 -2
- package/dist/boot/reapers.d.ts +4 -4
- package/dist/boot/resolve-spec.d.ts +1 -1
- package/dist/boot/resolve-spec.js +28 -24
- package/dist/boot/runner-deps.d.ts +29 -16
- package/dist/boot/runner-deps.js +12 -2
- 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-05-execution-env.js +4 -4
- package/dist/boot/stage-06-runners.d.ts +4 -3
- package/dist/boot/stage-06-runners.js +15 -4
- package/dist/boot/stage-07-capability-layer.d.ts +2 -1
- package/dist/boot/stage-08-reapers.d.ts +2 -1
- package/dist/boot/stage-09-leader.d.ts +2 -1
- package/dist/boot/stage-09-leader.js +2 -2
- package/dist/boot/stage-10-http-server.d.ts +2 -1
- package/dist/boot/stage-10-http-server.js +2 -1
- package/dist/boot/stores.d.ts +8 -0
- package/dist/boot/stores.js +10 -13
- package/dist/boot/web-admin.d.ts +21 -15
- package/dist/boot/web-admin.js +16 -12
- package/dist/boot/workflow-orchestration.js +2 -9
- package/dist/brain.d.ts +11 -11
- package/dist/budget.d.ts +4 -4
- package/dist/budget.js +5 -1
- package/dist/caller-text-echo.d.ts +2 -0
- package/dist/caller-text-echo.js +2 -1
- package/dist/canonical-json.d.ts +2 -41
- package/dist/canonical-json.js +2 -13
- 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 +2 -2
- package/dist/capabilities/composite-members.js +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 +10 -7
- package/dist/capabilities/mcp-probe.js +2 -2
- 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 +27 -24
- package/dist/capability-facts.js +18 -20
- package/dist/center-config-tier.d.ts +1 -1
- package/dist/center-credential.d.ts +4 -4
- package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
- package/dist/checkpoint-ctx-seal-m28.js +19 -0
- 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-invariants.d.ts +4 -4
- package/dist/config-invariants.js +3 -2
- package/dist/config-lkg.d.ts +1 -1
- package/dist/config-provider.d.ts +13 -13
- package/dist/config-provider.js +2 -1
- package/dist/config-types.d.ts +83 -83
- package/dist/config.d.ts +26 -24
- package/dist/config.js +12 -10
- 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/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/field-conflict.d.ts +2 -1
- package/dist/field-conflict.js +1 -0
- package/dist/file-history-capture.d.ts +9 -9
- package/dist/file-history-disclosure.d.ts +50 -9
- package/dist/file-history-disclosure.js +8 -13
- package/dist/fleet/drain-entry.d.ts +2 -2
- package/dist/fleet/fleet-bus.d.ts +26 -14
- package/dist/fleet/fleet-bus.js +6 -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 +13 -13
- package/dist/fleet-lease.d.ts +16 -16
- package/dist/governance-http-status.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +7 -7
- package/dist/hooks/hook-runner.d.ts +57 -30
- package/dist/hooks/hook-runner.js +38 -20
- 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 +28 -5
- package/dist/http/approval-sweeps.d.ts +1 -1
- package/dist/http/approval-sweeps.js +5 -2
- package/dist/http/checkpoint-ctx.d.ts +183 -2
- package/dist/http/checkpoint-ctx.js +197 -2
- package/dist/http/dispatch.d.ts +3 -3
- package/dist/http/dispatch.js +3 -3
- package/dist/http/durable-run-leg.js +7 -5
- package/dist/http/idempotency.d.ts +4 -4
- package/dist/http/idempotency.js +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 +39 -13
- package/dist/http/principal-gate.js +30 -6
- package/dist/http/readiness.d.ts +1 -1
- package/dist/http/refusal-body.d.ts +12 -0
- package/dist/http/refusal-body.js +11 -0
- package/dist/http/request-guards.d.ts +4 -13
- package/dist/http/request-guards.js +4 -17
- package/dist/http/resume-ctx-read.d.ts +53 -6
- package/dist/http/resume-ctx-read.js +26 -3
- package/dist/http/resume-legs.d.ts +5 -4
- package/dist/http/resume-legs.js +47 -29
- package/dist/http/route-ctx.d.ts +29 -38
- package/dist/http/route-table.d.ts +9 -9
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/agents-roster.js +2 -3
- package/dist/http/routes/approvals-assistant.d.ts +5 -5
- package/dist/http/routes/approvals-assistant.js +91 -17
- 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 +6 -6
- package/dist/http/routes/diagnostics.js +1 -1
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/fleet.js +5 -4
- 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/memory-origin.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/rules.js +4 -4
- package/dist/http/routes/runs.js +44 -11
- package/dist/http/routes/session-sync.d.ts +3 -2
- package/dist/http/routes/session-sync.js +109 -62
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions-list.js +4 -5
- package/dist/http/routes/sessions.js +34 -48
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/tasks.js +21 -16
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/trace-usage.js +7 -9
- 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 +39 -33
- package/dist/http/server.js +5 -2
- 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.d.ts +4 -3
- package/dist/http/submit-ctx.js +19 -3
- 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 +35 -24
- package/dist/index.d.ts +2 -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 +9 -5
- package/dist/leader/wire.js +8 -7
- package/dist/list-entry-display.d.ts +1 -1
- package/dist/lsp-evict.d.ts +1 -1
- package/dist/main.js +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-origin-fence.js +2 -2
- 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-compat.d.ts +1 -1
- 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-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/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 +12 -8
- package/dist/observability/fail-open.js +12 -8
- package/dist/observability/metrics.d.ts +3 -3
- package/dist/observability/prompt-manifest.d.ts +19 -8
- package/dist/observability/prompt-manifest.js +9 -8
- 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/observability/tool-trace.js +8 -9
- 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/orchestration/workflow-park-decision.d.ts +1 -1
- package/dist/orchestration/workflow-park-decision.js +1 -0
- package/dist/outbound-dispatcher.d.ts +4 -4
- package/dist/parent-watch.d.ts +4 -4
- package/dist/parked-decide.d.ts +20 -20
- package/dist/parked-decide.js +8 -5
- package/dist/parked-revive-surface.d.ts +7 -7
- package/dist/parked-revive-surface.js +2 -3
- package/dist/peer-directory.d.ts +3 -3
- package/dist/peer-directory.js +1 -1
- package/dist/permission-rule-list.d.ts +10 -1
- package/dist/permission-rule-list.js +7 -5
- package/dist/permission-rule-vocab.d.ts +3 -25
- package/dist/permission-rule-vocab.js +0 -13
- 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 +34 -15
- package/dist/plugins/approval-ask-store-sql.js +18 -5
- package/dist/plugins/approval-exemption-store.d.ts +3 -3
- package/dist/plugins/approval-nonce-store.d.ts +3 -3
- package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
- package/dist/plugins/approval-payload-fingerprint.js +1 -1
- 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/caching-session-store.d.ts +24 -33
- package/dist/plugins/caching-session-store.js +8 -19
- package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
- package/dist/plugins/checkpoint-index-columns.js +62 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +66 -67
- package/dist/plugins/checkpoint-store-sql.js +100 -103
- 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 +9 -7
- package/dist/plugins/file-history-store-sql.js +27 -15
- 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 +23 -12
- package/dist/plugins/local-checkpoint-store.js +29 -4
- package/dist/plugins/local-session-store.d.ts +44 -45
- package/dist/plugins/local-session-store.js +42 -52
- package/dist/plugins/local-session-window.d.ts +12 -6
- package/dist/plugins/local-session-window.js +1 -17
- 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 +76 -39
- package/dist/plugins/one-time-migrations.js +127 -34
- 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 +16 -19
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
- package/dist/plugins/permission-rule-store-sql.js +74 -31
- 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 +9 -21
- package/dist/plugins/pg-session-storage.js +51 -42
- package/dist/plugins/remote-env-adb.d.ts +10 -10
- package/dist/plugins/remote-env-device.d.ts +22 -14
- package/dist/plugins/remote-env-device.js +28 -16
- 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 +8 -8
- 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/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.d.ts +11 -0
- package/dist/plugins/session-ownership.js +11 -0
- package/dist/plugins/session-placement.d.ts +12 -14
- package/dist/plugins/session-placement.js +2 -15
- 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/sql-driver.d.ts +8 -8
- package/dist/plugins/sql-errors.d.ts +1 -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/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 +9 -2
- package/dist/plugins/tidb-session-store.d.ts +17 -27
- package/dist/plugins/tidb-session-store.js +52 -42
- 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 +19 -4
- 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-key-closure.d.ts +1 -1
- package/dist/request-key-closure.js +1 -1
- package/dist/request-tool-axes.d.ts +12 -0
- package/dist/request-tool-axes.js +20 -0
- 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/run-local.js +1 -0
- package/dist/runs.d.ts +15 -12
- package/dist/runs.js +19 -4
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +9 -9
- package/dist/sandbox-pkg-source.d.ts +9 -31
- package/dist/sandbox-pkg-source.js +14 -8
- package/dist/sealed-key.d.ts +34 -2
- package/dist/sealed-key.js +55 -1
- package/dist/security.d.ts +31 -32
- 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 +19 -12
- package/dist/session-error-wire.js +4 -1
- package/dist/session-incarnation.d.ts +52 -35
- package/dist/session-incarnation.js +23 -8
- 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-sync-kernel.d.ts +38 -11
- package/dist/session-sync-kernel.js +10 -0
- package/dist/session-sync.d.ts +49 -6
- package/dist/session-sync.js +52 -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 +3 -1
- package/dist/task-a2a.js +38 -5
- package/dist/task-cwd.d.ts +7 -88
- package/dist/task-cwd.js +2 -15
- package/dist/task-mcp.d.ts +14 -10
- package/dist/task-mcp.js +39 -12
- package/dist/task-settings.d.ts +34 -18
- package/dist/task-settings.js +34 -4
- 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 +273 -228
- package/dist/tool-approval.js +125 -47
- package/dist/tool-rule-names.d.ts +7 -1
- package/dist/trace/core-keyset-guard.d.ts +15 -9
- 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 +40 -1
- package/dist/trace/exit-seat.js +46 -14
- package/dist/trace/ledger-events.d.ts +6 -4
- package/dist/trace/ledger-sink.d.ts +1 -1
- package/dist/trace/model-segment.d.ts +3 -3
- package/dist/trace/project.d.ts +65 -46
- package/dist/trace/project.js +49 -5
- package/dist/trace/redact.d.ts +44 -27
- package/dist/trace/redact.js +343 -73
- package/dist/trace/self-minted-wire.d.ts +39 -14
- package/dist/trace/self-minted-wire.js +9 -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 +9 -3
- package/dist/trace/wire-projection-faces.js +7 -1
- package/dist/unattended-permission-mode.d.ts +5 -5
- package/dist/url-credential.d.ts +52 -0
- package/dist/url-credential.js +49 -0
- package/dist/url-refusal.d.ts +6 -2
- package/dist/url-refusal.js +8 -1
- 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 +29 -4
- package/dist/web-admin-client/skills-mcp.js +31 -4
- package/dist/web-admin-client/types.d.ts +17 -10
- package/dist/workspace-space.d.ts +5 -3
- package/dist/write-protection.d.ts +2 -2
- package/package.json +4 -3
- package/scripts/drain-check-local.mjs +35 -2
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/skills/loop.md +1 -1
- package/dist/mcp-tool-faces.d.ts +0 -69
- package/dist/mcp-tool-faces.js +0 -104
- package/dist/orchestration/workflow-journal-entry.js +0 -27
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] —— 记忆合规面(抹除 / 出处)上 core **已分类拒**的**唯一** HTTP 映射。两面同调:
|
|
3
3
|
* · operator 面 `routes/memory-compliance.ts`(`POST /v1/memory/erase` · `GET /v1/memory/entries/:entryId/provenance`);
|
|
4
4
|
* · 会话所有者自助抹除面 `routes/sessions.ts`(`POST /v1/sessions/:id/memory/erase`)。
|
|
5
5
|
*
|
|
6
|
-
* ## 病(sdk 车 SH 黑盒实证,
|
|
6
|
+
* ## 病(sdk 车 SH 黑盒实证,[ref])
|
|
7
7
|
* 修前自助面在路由里自写了一份更窄的分类:只认 `config.memory_erasure_request`(400)与 `memory.target_outside_store`(409),
|
|
8
8
|
* core 的另外三只 409 与 `ControlPlaneCorruptError` 全落 500 `internal.error` —— 「同一个 requestId 拿去抹另一个会话」这种**调用方自己
|
|
9
9
|
* 能改**的错被说成服务器坏了。两份分类 = 两个判官,少的那份恒是静默的一份。现在**码与状态**只在这里判一次,两面同读。
|
|
10
10
|
*
|
|
11
11
|
* ## 规则(三层,与 operator 面既有层序逐字同序)
|
|
12
12
|
* ① core 的**本口专属**码(闭集穷举 `switch`,见 {@link sentCoreCode})—— 码与状态两面同;文案按受众(下一节,一条规则);
|
|
13
|
-
* ② **店形拒**两码 `memory.target_outside_store`(core 7.31.1
|
|
13
|
+
* ② **店形拒**两码 `memory.target_outside_store`(core 7.31.1 [ref])/ `memory.scope_home_not_directory`(core 7.44.0 [ref])—— 跨面 store 状态码,409、码原样
|
|
14
14
|
* (判据 `memory-store-refusal.ts` 一只;运维行 `memory_store_form_refused { code, path?, form? }` 两受众同一只铸点,路径只在那里);
|
|
15
15
|
* ③ `ControlPlaneCorruptError` —— typed 500 `internal.memory_control_plane_corrupt`(fail-closed 信号,一码两义见下);
|
|
16
16
|
* 其余 ⇒ `false`(未分类,调用方发它自己那句 500 且**不回显**内部文本)。
|
|
@@ -30,7 +30,7 @@ import type { ServerResponse } from "node:http";
|
|
|
30
30
|
import type { Logger } from "../observability/logger.js";
|
|
31
31
|
/**
|
|
32
32
|
* 已分类拒 → HTTP 状态的**唯一**码表 = 自铸 wire 值登记处的 `sessionMemoryEraseStatus` 集(F3:wire 变更清单从同一张表 diff,状态改一处、
|
|
33
|
-
* 清单跟着列)。两面同读(
|
|
33
|
+
* 清单跟着列)。两面同读([ref]:码与状态只判一次)。键写错 ⇒ tsc 红(索引的是 `as const` 表的键)。
|
|
34
34
|
*/
|
|
35
35
|
/** 读这张映射的受众(闭集)。会话所有者受众必须交一只 `withheld` —— 被换成固定句的 core 原句落到那里(运维材料不许丢)。 */
|
|
36
36
|
export type MemoryComplianceAudience = {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 🔴 **属主存取器**(
|
|
2
|
+
* 🔴 **属主存取器**([ref] RH-3 第一期)——「这个调用方读得到这一行 run / 会话吗」的行只经这里取得。
|
|
3
3
|
*
|
|
4
4
|
* ## 律(一条)
|
|
5
5
|
* 判官只有一只:run 行 = `principal-gate.ts` 的 `runOwnerReadable`(三条放行臂,含 [ref] C8 窄互认),会话行 = `sessionOwnerReadable`
|
|
@@ -39,14 +39,12 @@ export declare function readOwnedRun(config: OwnerAccessConfig, runStore: {
|
|
|
39
39
|
getRun(taskId: string): Promise<RunRecord | undefined>;
|
|
40
40
|
}, principal: Principal | undefined, taskId: string, arm: OwnerArm): Promise<RunRecord | undefined>;
|
|
41
41
|
/**
|
|
42
|
-
* 会话行读口:属主一读 + 无主时 placement 一格(`sessionOwnerCellOf`,
|
|
43
|
-
*
|
|
42
|
+
* 会话行读口:属主一读(会话店唯一的按 id 读 `headOf(id)?.owner`)+ 无主时 placement 一格(`sessionOwnerCellOf`,[ref])+ 会话面判官。
|
|
43
|
+
* `undefined` = 没有这只会话(头读答 `undefined`)≡ 读不到。读回的那一格交给调用点(要按属主作答的口用它)。店的读失败照常抛(500,绝不当成「读不到」或「读得到」)。
|
|
44
44
|
*/
|
|
45
45
|
export declare function readOwnedSession(w: IdentityWiring & {
|
|
46
46
|
readonly config: OwnerAccessConfig;
|
|
47
|
-
}, store: Pick<OwnerAwareSessionStore, "placementOf"> &
|
|
48
|
-
ownerOf(sessionId: string): Promise<string | null | undefined>;
|
|
49
|
-
}, caller: SessionCaller, sessionId: string, arm: OwnerArm): Promise<SessionOwnerCell | undefined>;
|
|
47
|
+
}, store: Pick<OwnerAwareSessionStore, "placementOf"> & Required<Pick<OwnerAwareSessionStore, "headOf">>, caller: SessionCaller, sessionId: string, arm: OwnerArm): Promise<SessionOwnerCell | undefined>;
|
|
50
48
|
/**
|
|
51
49
|
* leader 登记表的判官形(boot 装配一次,`createLeaderEndpoint` 的必填席)—— leader 模块不再自判属主(修前它手抄 `owner == null || owner === requester`,
|
|
52
50
|
* 缺 C8 窄互认臂而注称 mirrors runOwnerOk)。leader 腿的调用方身份经幂等身份结构(`IdemCaller.principal`,即 `gatedPrincipal` 的回值)转手而来,
|
|
@@ -30,7 +30,7 @@ export async function readOwnedRun(config, runStore, principal, taskId, arm) {
|
|
|
30
30
|
return row !== undefined && runRowReadable(config, principal, row.owner, arm) ? row : undefined;
|
|
31
31
|
}
|
|
32
32
|
export async function readOwnedSession(w, store, caller, sessionId, arm) {
|
|
33
|
-
const owner = await store.
|
|
33
|
+
const owner = (await store.headOf(sessionId))?.owner;
|
|
34
34
|
if (owner === undefined)
|
|
35
35
|
return undefined;
|
|
36
36
|
const cell = await sessionOwnerCellOf(store, sessionId, owner);
|
|
@@ -12,6 +12,9 @@ export declare function systemFor(req: IncomingMessage, config: ServiceConfig):
|
|
|
12
12
|
/** "presented credentials must verify":Authorization 带 Bearer/token scheme 且三路全验不过 → true。
|
|
13
13
|
* 其他 scheme(Basic 等,非我方凭证空间)不管——由原有门语义处置,避免误伤未知代理注头。 */
|
|
14
14
|
export declare function bearerPresentedButUnverified(req: IncomingMessage, config: ServiceConfig): boolean;
|
|
15
|
+
/** 「这次请求出示了这台部署的只读 trace 凭据(`TRACE_TOKEN`)」—— 一句,三处读:凭据验不过判({@link bearerPresentedButUnverified})、门前读路谓词
|
|
16
|
+
* (`dispatch.ts` 的 `readCredentialOk`)、fleet 读档的只读臂({@link fleetViewOf})。没配 ⇒ 恒 false。 */
|
|
17
|
+
export declare function traceTokenPresented(req: IncomingMessage, config: ServiceConfig): boolean;
|
|
15
18
|
/** loopback 三形(IPv4 / IPv6 / IPv4-mapped)—— 一处定义,diagnostics 门与任何「本机自用」判据同吃。缺席 ⇒ false(fail-closed)。 */
|
|
16
19
|
export declare function isLoopbackAddress(addr: string | undefined): boolean;
|
|
17
20
|
/**
|
|
@@ -39,7 +42,7 @@ export declare function gatedPrincipal(req: IncomingMessage, config: ServiceConf
|
|
|
39
42
|
*/
|
|
40
43
|
export declare function principalTokenPresentedButUnverified(req: IncomingMessage, config: ServiceConfig): boolean;
|
|
41
44
|
/**
|
|
42
|
-
* 🔴 **`requirePrincipal` 部署上「这次请求没有可用身份」的唯一 401 铸点**(
|
|
45
|
+
* 🔴 **`requirePrincipal` 部署上「这次请求没有可用身份」的唯一 401 铸点**([ref],7.76.2)。
|
|
43
46
|
*
|
|
44
47
|
* 此前 45 个路由各自手抄同一行 `sendError(res, 401, "auth.principal_required", …)`,于是直连门上
|
|
45
48
|
* 「JWT 出示了但过期/签不上」与「什么头都没带」在 wire 上**同形**(黑盒实测:plan_review 带过期 JWT
|
|
@@ -53,7 +56,7 @@ export declare function principalTokenPresentedButUnverified(req: IncomingMessag
|
|
|
53
56
|
*/
|
|
54
57
|
export declare function sendPrincipalRefusal(res: ServerResponse, req: IncomingMessage, config: ServiceConfig): void;
|
|
55
58
|
/**
|
|
56
|
-
* 🔴 **`401 auth.unauthorized` 的唯一铸点**(
|
|
59
|
+
* 🔴 **`401 auth.unauthorized` 的唯一铸点**([ref],7.104.0;test [ref] QA 7a C15)。
|
|
57
60
|
*
|
|
58
61
|
* 病:十六处路由(9 个文件)各自手抄同一个 401 —— 码 `auth.unauthorized`、message 就一个词 `unauthorized`。照 sema-up 部署、壳接上
|
|
59
62
|
* 引擎后,第一句就撞上它,不说要哪份凭据、放哪、去哪拿。
|
|
@@ -62,8 +65,8 @@ export declare function sendPrincipalRefusal(res: ServerResponse, req: IncomingM
|
|
|
62
65
|
* 每面一句模块级常量(冻结门按常量解引用逐字钉)。三句都**不含任何值**(令牌 / 头名 / 路径实参一概不回显),且**不区分**
|
|
63
66
|
* 「没带」与「带错」—— 同一道门上两者逐字同体,区分就是探测面。
|
|
64
67
|
* · `credential` —— 全局凭据门(`dispatch.ts`):部署配了 service token,请求没带或带的不认(registry 登录令牌验不过同属此面);
|
|
65
|
-
* · `operator` —— 只给运维凭据开的口(`/metrics*` 与 `GET /v1/tasks/source-summary`)
|
|
66
|
-
* `METRICS_TOKEN`(
|
|
68
|
+
* · `operator` —— 只给运维凭据开的口(`/metrics*` 与 `GET /v1/tasks/source-summary`):不带主体头的 service token 开得了(带主体头的是那位主体,
|
|
69
|
+
* {@link actsForDeployment}),指标口另认只读的 `METRICS_TOKEN`、`source-summary` 另认只读的 `TRACE_TOKEN`(都在全局门之前判);
|
|
67
70
|
* · `identity` —— 过了凭据门(或这台部署没配 service token)、但这一口要一个**验过的调用方身份**:属主寻址的读 / 写面、规则面、
|
|
68
71
|
* 记忆面。在配了 service token 的部署上,「带 service token 却没身份」只会落在只认身份的口(规则 / 记忆 / 会话策略)上 ——
|
|
69
72
|
* 这时再叫调用方「去带 service token」是假出路,所以这一面的句子只讲身份。
|
|
@@ -71,11 +74,11 @@ export declare function sendPrincipalRefusal(res: ServerResponse, req: IncomingM
|
|
|
71
74
|
*/
|
|
72
75
|
export type UnauthorizedFace = "credential" | "operator" | "identity";
|
|
73
76
|
export declare const UNAUTHORIZED_CREDENTIAL = "unauthorized \u2014 the request carries no credential this deployment accepts: send the deployment's service token as a Bearer token in the Authorization header (its operator set it as SERVICE_AUTH_TOKEN or SERVICE_AUTH_TOKENS; a sema-up deployment keeps SERVICE_AUTH_TOKEN in ~/.sema-up/<project>/.env on the machine that ran sema-up)";
|
|
74
|
-
export declare const UNAUTHORIZED_OPERATOR = "unauthorized \u2014 this endpoint is for the deployment's operators and the request carries no operator credential: send the deployment's service token as a Bearer token in the Authorization header (
|
|
77
|
+
export declare const UNAUTHORIZED_OPERATOR = "unauthorized \u2014 this endpoint is for the deployment's operators and the request carries no operator credential: send the deployment's service token as a Bearer token in the Authorization header without a principal header (a service-token request that names a principal acts for that principal, not for the deployment), or a read-only token this endpoint accepts (METRICS_TOKEN for the metrics endpoints, TRACE_TOKEN for the task source summary)";
|
|
75
78
|
export declare const UNAUTHORIZED_IDENTITY = "unauthorized \u2014 this endpoint acts for a named caller and the request carries no caller identity this deployment verifies: identify the caller the way this deployment does (a registry sign-in token as the Bearer token, a signed principal token on a direct-door deployment, or the principal header set by a trusted front end)";
|
|
76
79
|
export declare function sendUnauthorized(res: ServerResponse, face: UnauthorizedFace): void;
|
|
77
80
|
/**
|
|
78
|
-
* 🔴 **「这个调用方读得到这一行 run 吗」的唯一谓词**(
|
|
81
|
+
* 🔴 **「这个调用方读得到这一行 run 吗」的唯一谓词**([ref] 抽取;此前只活在 `server.ts runOwnerOk` 的
|
|
79
82
|
* 函数体里,而 `runOwnerOk` 把**判断**与**404 怎么发**焊在一起 —— 于是任何需要同一条判断但不想 404 的
|
|
80
83
|
* 读面(如 `/mcp` 面板的 `lastLegMcp`:非属主就不投这个键、面板照常 200)只能手抄一份,而手抄那份必然
|
|
81
84
|
* 漏掉下面这条窄互认臂:`explicitOperatorOk` 顶注已经为同族的病写过「SINGLE mint point,不要再造兄弟」)。
|
|
@@ -109,23 +112,46 @@ export interface IdentityWiring {
|
|
|
109
112
|
*/
|
|
110
113
|
export declare function wiredIdentitySources(w: IdentityWiring): readonly IdentitySource[];
|
|
111
114
|
/**
|
|
112
|
-
* 🔴 **「这台部署有没有身份边界」的唯一判据**(
|
|
115
|
+
* 🔴 **「这台部署有没有身份边界」的唯一判据**([ref];[ref] 改读身份来源)。dev-open = 装配**没接任何身份来源**({@link wiredIdentitySources} 为空:
|
|
113
116
|
* 没配 service token、没装鉴权桥、没开直连门)、**也没声明**只读 trace token 或 `REQUIRE_PRINCIPAL`:请求里没有任何东西替主体头作保,头是谁都能自报的
|
|
114
117
|
* **标签**(过滤 / 展示用),不是身份。装了鉴权桥的部署(SSO 单开)带登录令牌的调用方是验过的身份 ⇒ 不是 dev-open(修前只看 token / `REQUIRE_PRINCIPAL`,
|
|
115
118
|
* 这一形被读成 dev-open,任何人 fleet-wide 读全部会话)。
|
|
116
|
-
*
|
|
119
|
+
* 三处读它、不各写一份:fleet 调用方的第一臂({@link sessionCallerOf} —— fleet 面的 {@link fleetViewOf} 与会话行属主门都经它)、
|
|
117
120
|
* 会话面的属主谓词({@link sessionOwnerReadable})、`/metrics` 族的免凭据臂(`dispatch.ts`)—— 于是「调用方是谁」在列表、单会话面与指标面上只有一只读法。
|
|
118
121
|
*/
|
|
119
122
|
export declare function devOpenDeployment(w: IdentityWiring): boolean;
|
|
120
|
-
/**
|
|
121
|
-
*
|
|
123
|
+
/**
|
|
124
|
+
* service 凭据**代部署本身**说话:出示了这台部署的 service 凭据({@link systemFor}),且不代任何验过的主体。带主体头的 service 凭据请求是前端(BFF)
|
|
125
|
+
* 代那位主体发的 —— 它读那位主体,不读全舰队;部署姿态(单用户 / 多租)不改这一句(单用户形上的主体头同样是「这次请求为谁」)。
|
|
126
|
+
* 两处读它:fleet 调用方的凭据臂({@link sessionCallerOf})与 `/metrics` 族的 service 臂(`dispatch.ts`)。先判凭据、后取主体:`principal` 只在出示了
|
|
127
|
+
* service 凭据时才求值(调用点那一次 {@link gatedPrincipal}),没带凭据的请求不因主体头的形而改答。
|
|
128
|
+
*/
|
|
129
|
+
export declare function actsForDeployment(req: IncomingMessage, config: ServiceConfig, principal: () => Principal | undefined): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* 🔴 **「这个调用方是不是 fleet 调用方(看得到所有租户)」的唯一铸点**({@link SessionCaller}):验过的主体 + 是不是 fleet —— {@link devOpenDeployment} 上的任何
|
|
132
|
+
* 调用方,或 {@link actsForDeployment}(出示 service 凭据、不报主体)。带主体头的是那位主体,不是 fleet;只读 trace token 不是 service 凭据;operator 不在这里
|
|
133
|
+
* (运维口各自读 {@link explicitOperatorOk})。读者:会话行属主门(无主 placed 行的放行臂)与 fleet 面的 {@link fleetViewOf} —— 同一问一只读法。
|
|
134
|
+
*/
|
|
122
135
|
export declare function sessionCallerOf(req: IncomingMessage, w: IdentityWiring): SessionCaller;
|
|
136
|
+
/** fleet 面的两档(闭集):`read` = 只读面,只读 trace 凭据在这一档也是 fleet;`write` = 写面,只认 {@link sessionCallerOf}(读凭据不能变成跨租户写权)。 */
|
|
137
|
+
export type FleetFace = "read" | "write";
|
|
138
|
+
/** 一次 fleet 面判定的读数:`fleetWide` = 看全舰队(不钉人);否则 `gateOwner` = 钉住的那位验过的主体,`null` = 没有可用身份(调用点答 401 identity)。 */
|
|
139
|
+
export interface FleetView {
|
|
140
|
+
readonly fleetWide: boolean;
|
|
141
|
+
readonly gateOwner: Principal | null;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* 🔴 **fleet 面「看全舰队,还是钉住一位主体」的唯一读法**。fleet 判据只有一个来源 —— {@link sessionCallerOf};本函数只把它投成 fleet 面要的两格,
|
|
145
|
+
* 并按档并上只读 trace 凭据(读档)。读者 —— 读档:舰队流、会话列表、发件链接列表、后台名册、trace 五口、用量三口、`/v1/tasks/source-summary`;
|
|
146
|
+
* 写档:删除、fork、同步族(拉取与推送同门)。
|
|
147
|
+
*/
|
|
148
|
+
export declare function fleetViewOf(req: IncomingMessage, w: IdentityWiring, face: FleetFace): FleetView;
|
|
123
149
|
/**
|
|
124
150
|
* **「这个调用方能不能动这只会话」的唯一谓词**(会话面:视图 / head / 事件流 / 记忆状态与自助抹除 / 改名置顶 / 后台任务 / MCP 重连 /
|
|
125
151
|
* 面板的上一腿 MCP 投影)。没有身份边界的部署({@link devOpenDeployment})上不钉任何人(与会话列表同读,列表把这只会话列给谁,谁就读得到它);
|
|
126
152
|
* 有身份边界的部署上:
|
|
127
153
|
* · **无主的行**经无主臂的唯一判据 `ownerlessRowOpen`(`security.ts`):普通会话照旧对任何调用方开放;委派子代的 placed 行只对 fleet 调用方
|
|
128
|
-
* ({@link sessionCallerOf})开放 —— 任何具名主体、没有 service 凭据的无身份调用方都与别人的行同体(调用点答 404)(
|
|
154
|
+
* ({@link sessionCallerOf})开放 —— 任何具名主体、没有 service 凭据的无身份调用方都与别人的行同体(调用点答 404)([ref])。
|
|
129
155
|
* 代价如实:属主还没定下的子代行连它将来的属主也暂时读不到(由一次性迁移 M23 / 那一行的下一次停驻定下);
|
|
130
156
|
* · 有主的行就是 run 面那一条谓词({@link runOwnerReadable}),一字不变。
|
|
131
157
|
* run 面(poll / events / cancel …)不读本谓词 —— 那是 run 资源的门,另一只。
|
|
@@ -137,7 +163,7 @@ export declare function sessionOwnerReadable(caller: SessionCaller, cell: Sessio
|
|
|
137
163
|
*/
|
|
138
164
|
export type OperatorRoster = Pick<ServiceConfig, "operatorPrincipals" | "operatorSingleUser">;
|
|
139
165
|
/**
|
|
140
|
-
* 🔴 **「谁是 operator」的唯一读法**(
|
|
166
|
+
* 🔴 **「谁是 operator」的唯一读法**([ref],[ref] ① 裁 A;IMAGE-API-DESIGN.md §P2.4a MUST-FIX 的那一只门)。
|
|
141
167
|
* · 名单为空 ⇒ **没人是**(没有任何形把「空名单」读成「人人是」—— 那条读法 `isOperator` 已删);
|
|
142
168
|
* · 名单非空 ⇒ 验过的主体在名单里才是;
|
|
143
169
|
* · 单用户形显式声明 `OPERATOR_SINGLE_USER=true` ⇒ 这台部署的**每个调用方**都是(单用户形只有一位用户,能到这台部署的就是他;边界是部署自己的
|
|
@@ -149,7 +175,7 @@ export declare function explicitOperatorOk(principal: string | undefined, roster
|
|
|
149
175
|
/** 「这台部署**有没有**运维」的唯一读法(名单非空 ∨ 单用户声明在场)—— 能力事实 `operatorLane`、整理阀门的可达性告警、起服提示同读这一只。 */
|
|
150
176
|
export declare function operatorRosterPresent(roster: OperatorRoster): boolean;
|
|
151
177
|
/**
|
|
152
|
-
* 起服提示(
|
|
178
|
+
* 起服提示([ref]):单用户形(`REQUIRE_PRINCIPAL` 未开)+ 没有运维名册 + 这台部署有审批底座 ⇒ 一行 warn。这一形在「空名单 = 人人是」那条读法退役之后
|
|
153
179
|
* 丢的东西就是审批队列的运维视图(跨 scope 列表 / `?owner=` / 无主体调用方的整个队列),补回它只要一行配置 —— 不拒启:升级那一拍打掉一台今天跑得好好的
|
|
154
180
|
* 单用户机器比一条提示重。多租形不提示(它另有拒启不变量);没有审批底座的形什么都没少。
|
|
155
181
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
2
3
|
import { PRINCIPAL_TOKEN_HEADER, verifiedPrincipal, ssoVerifiedPrincipal, ownerlessRowOpen, mintPrincipal } from "../security.js";
|
|
3
4
|
import { sendError } from "./send.js";
|
|
4
5
|
export function headerStr(v) {
|
|
@@ -30,10 +31,13 @@ export function bearerPresentedButUnverified(req, config) {
|
|
|
30
31
|
return false;
|
|
31
32
|
if (systemFor(req, config) !== undefined)
|
|
32
33
|
return false;
|
|
33
|
-
if (
|
|
34
|
+
if (traceTokenPresented(req, config))
|
|
34
35
|
return false;
|
|
35
36
|
return true;
|
|
36
37
|
}
|
|
38
|
+
export function traceTokenPresented(req, config) {
|
|
39
|
+
return !!config.traceToken && authorized(req, config.traceToken);
|
|
40
|
+
}
|
|
37
41
|
export function isLoopbackAddress(addr) {
|
|
38
42
|
return addr === "127.0.0.1" || addr === "::1" || addr === "::ffff:127.0.0.1";
|
|
39
43
|
}
|
|
@@ -68,7 +72,7 @@ export function sendPrincipalRefusal(res, req, config) {
|
|
|
68
72
|
sendError(res, 401, "auth.principal_required", `missing principal header '${config.principalHeader}'`);
|
|
69
73
|
}
|
|
70
74
|
export const UNAUTHORIZED_CREDENTIAL = "unauthorized — the request carries no credential this deployment accepts: send the deployment's service token as a Bearer token in the Authorization header (its operator set it as SERVICE_AUTH_TOKEN or SERVICE_AUTH_TOKENS; a sema-up deployment keeps SERVICE_AUTH_TOKEN in ~/.sema-up/<project>/.env on the machine that ran sema-up)";
|
|
71
|
-
export const UNAUTHORIZED_OPERATOR = "unauthorized — this endpoint is for the deployment's operators and the request carries no operator credential: send the deployment's service token as a Bearer token in the Authorization header (
|
|
75
|
+
export const UNAUTHORIZED_OPERATOR = "unauthorized — this endpoint is for the deployment's operators and the request carries no operator credential: send the deployment's service token as a Bearer token in the Authorization header without a principal header (a service-token request that names a principal acts for that principal, not for the deployment), or a read-only token this endpoint accepts (METRICS_TOKEN for the metrics endpoints, TRACE_TOKEN for the task source summary)";
|
|
72
76
|
export const UNAUTHORIZED_IDENTITY = "unauthorized — this endpoint acts for a named caller and the request carries no caller identity this deployment verifies: identify the caller the way this deployment does (a registry sign-in token as the Bearer token, a signed principal token on a direct-door deployment, or the principal header set by a trusted front end)";
|
|
73
77
|
export function sendUnauthorized(res, face) {
|
|
74
78
|
switch (face) {
|
|
@@ -95,7 +99,7 @@ export function runOwnerReadable(principal, owner, config) {
|
|
|
95
99
|
return true;
|
|
96
100
|
if (principal !== undefined && sameIdentity(principal, owner))
|
|
97
101
|
return true;
|
|
98
|
-
return !config
|
|
102
|
+
return !DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(config) && owner === "anon:shell-live" && principal === undefined;
|
|
99
103
|
}
|
|
100
104
|
export function hasServiceAuth(config) {
|
|
101
105
|
return Boolean(config.authToken) || Object.keys(config.authTokens ?? {}).length > 0;
|
|
@@ -118,11 +122,31 @@ export function wiredIdentitySources(w) {
|
|
|
118
122
|
return IDENTITY_SOURCES.filter((k) => identitySourceWired(k, w));
|
|
119
123
|
}
|
|
120
124
|
export function devOpenDeployment(w) {
|
|
121
|
-
return wiredIdentitySources(w).length === 0 && !w.config.traceToken && !w.config
|
|
125
|
+
return wiredIdentitySources(w).length === 0 && !w.config.traceToken && !DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(w.config);
|
|
126
|
+
}
|
|
127
|
+
export function actsForDeployment(req, config, principal) {
|
|
128
|
+
return systemFor(req, config) !== undefined && principal() === undefined;
|
|
122
129
|
}
|
|
123
130
|
export function sessionCallerOf(req, w) {
|
|
124
131
|
const principal = gatedPrincipal(req, w.config);
|
|
125
|
-
return { principal, fleet: devOpenDeployment(w) || (
|
|
132
|
+
return { principal, fleet: devOpenDeployment(w) || actsForDeployment(req, w.config, () => principal) };
|
|
133
|
+
}
|
|
134
|
+
export function fleetViewOf(req, w, face) {
|
|
135
|
+
const caller = sessionCallerOf(req, w);
|
|
136
|
+
const fleetWide = caller.fleet || readOnlyFleetCredential(req, w.config, face);
|
|
137
|
+
return { fleetWide, gateOwner: fleetWide ? null : caller.principal || null };
|
|
138
|
+
}
|
|
139
|
+
function readOnlyFleetCredential(req, config, face) {
|
|
140
|
+
switch (face) {
|
|
141
|
+
case "read":
|
|
142
|
+
return traceTokenPresented(req, config);
|
|
143
|
+
case "write":
|
|
144
|
+
return false;
|
|
145
|
+
default: {
|
|
146
|
+
const unknownFace = face;
|
|
147
|
+
throw new Error(`fleetViewOf: unknown fleet face ${String(unknownFace)}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
126
150
|
}
|
|
127
151
|
export function sessionOwnerReadable(caller, cell, w) {
|
|
128
152
|
if (devOpenDeployment(w))
|
|
@@ -146,7 +170,7 @@ export function buildOperatorUndeclaredNotice(config, approvalFaceWired) {
|
|
|
146
170
|
event: "operator_undeclared_single_user",
|
|
147
171
|
fields: {
|
|
148
172
|
detail: "this single-user deployment declares no operator: OPERATOR_PRINCIPALS is empty and OPERATOR_SINGLE_USER is not set, so no caller is an operator — " +
|
|
149
|
-
"GET /v1/approvals, its stream, /v1/assistant/inbox and /v1/assistant/tasks show each caller only its own pending approvals (a caller that sends no principal sees
|
|
173
|
+
"GET /v1/approvals, its stream, /v1/assistant/inbox and /v1/assistant/tasks show each caller only its own pending approvals (a caller that sends no principal sees only the anonymous ones - the cards and tasks that were submitted without a principal - never a named principal's) and ignore ?owner=. " +
|
|
150
174
|
"To act as this deployment's operator, add one line: OPERATOR_SINGLE_USER=true",
|
|
151
175
|
},
|
|
152
176
|
};
|
package/dist/http/readiness.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* [ref] / [ref](车OE,7.102.0):**就绪判的唯一属主** —— 一只谓词 {@link readinessOf},全部读点经它:
|
|
3
3
|
*
|
|
4
4
|
* ① `GET /readyz`(`dispatch.ts`,凭据门之前,与 `/health` 同位):200 `{ready:true}` / 503 `{ready:false, reasons}` ——
|
|
5
5
|
* 给**摘流**语义的探针(k8s readinessProbe / LB 健康检查);**重启**语义的探针(Docker HEALTHCHECK、k8s livenessProbe)
|
|
@@ -18,4 +18,16 @@ export type RefusalBody = {
|
|
|
18
18
|
} & Record<string, unknown>;
|
|
19
19
|
/** 拒体:`{ error, errorCode, ...facts }`。 */
|
|
20
20
|
export declare function refusalBody(r: Refusal): RefusalBody;
|
|
21
|
+
/**
|
|
22
|
+
* 引擎拒一次续跑时的**三个机读判别位** → 拒体的同名事实键(唯一读法;续跑家族的每一只拒答都读它):
|
|
23
|
+
* `detail.code` ⇒ `blockedBy`(挡住它的准入码)· `detail.field` ⇒ `field`(哪一侧 / 哪一格)· `detail.reason` ⇒ `reason`(同码多臂时哪一臂)。
|
|
24
|
+
* 一员在场 ⇔ 它是非空串;其余(缺席、非串、空串)一律不铸键 —— 引擎没说就是没说,本层不编值,也不把一个非串原样推上 wire。
|
|
25
|
+
* 载体有两种,读法同一只:同步腿的 `CheckpointError.detail`(`http/resume-legs.ts` `checkpointRefusalAnswer`),与后台停驻子代赎回回执的
|
|
26
|
+
* `details.detail`(`parked-decide.ts` 的 422 `parked_resume.startup_failed`;引擎 7.54.0 起它把认领前那只失败的同三位交到回执上)。
|
|
27
|
+
*/
|
|
28
|
+
export declare function resumeRefusalFacts(detail: unknown): {
|
|
29
|
+
blockedBy?: string;
|
|
30
|
+
field?: string;
|
|
31
|
+
reason?: string;
|
|
32
|
+
};
|
|
21
33
|
//# sourceMappingURL=refusal-body.d.ts.map
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
export function refusalBody(r) {
|
|
2
2
|
return { error: r.message, errorCode: r.errorCode, ...r.facts };
|
|
3
3
|
}
|
|
4
|
+
export function resumeRefusalFacts(detail) {
|
|
5
|
+
if (typeof detail !== "object" || detail === null)
|
|
6
|
+
return {};
|
|
7
|
+
const d = detail;
|
|
8
|
+
const word = (v) => typeof v === "string" && v !== "";
|
|
9
|
+
return {
|
|
10
|
+
...(word(d.code) ? { blockedBy: d.code } : {}),
|
|
11
|
+
...(word(d.field) ? { field: d.field } : {}),
|
|
12
|
+
...(word(d.reason) ? { reason: d.reason } : {}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
4
15
|
//# sourceMappingURL=refusal-body.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 请求守门族(
|
|
2
|
+
* 请求守门族([ref] 切片:`http/server.ts` 4837–5195 + `MAX_BODY` 逐字搬家,正文一字未改)。
|
|
3
3
|
* 配额 / 租约 / 用量窗 / 限流 / owner-scope / 体读取 —— 每只守门的判据与它自己的头注原位随行。
|
|
4
4
|
* ctx 字段 1 只(`deps`):本族对外围的耦合就这一格,它也是这一族的可测性读数。
|
|
5
5
|
*/
|
|
@@ -21,7 +21,7 @@ import { type SqlWallSource, type SqlWallsReading } from "../plugins/sql-driver.
|
|
|
21
21
|
* 入参是**已判好的墙**(`sql-driver.ts` `sqlWallsOf` —— 事实缺席时的落点只在那里定义,与 blob 帽同一只判官、同一个方向);本函数不读事实、不判缺席,
|
|
22
22
|
* 墙从哪来(`sources` 里**被拒的那一堵**的出处)原样带进判决(`wallSource`),拒句按它分两形:库报的墙点名库的上限与旋钮,假定的墙(事实还没建立,或事实在场但这一堵读失败、退了文档缺省)只说「库的这个上限没读到、按最保守的墙拒」。
|
|
23
23
|
*
|
|
24
|
-
* 🔴 **包墙腿是同一只规则的提前一跑,不是第二套规则**(
|
|
24
|
+
* 🔴 **包墙腿是同一只规则的提前一跑,不是第二套规则**([ref] 主会话裁定):包墙是物理连接的事实(会话值,连接建立时从全局拷一份、此后不变),
|
|
25
25
|
* 终判在将要执行写入的那条连接上 —— 那是库自己(续跑输入那一笔被拒 ⇒ 店的带码拒 ⇒ 同一个 413;会话日志那一笔走它既有的失败面);SQL 快照 blob 则由
|
|
26
26
|
* `blob-backend.ts` 经 `connectJudged` 在写入连接上判。受理时手里没有那条连接,判官 `sqlWallsOf` 读的 `facts` 是池里**最近一次初始化**的那条连接的读数
|
|
27
27
|
* (`SqlDriver.facts`:池见过的最新读数,只在有连接初始化时才更新),同一个折算 `packetWallStatementBytes`:拒 ⇒ 413 在任何副作用之前;收 ⇒ 写入那条连接上的判决仍是终判。
|
|
@@ -44,7 +44,7 @@ export interface SubmitBodyRefusal {
|
|
|
44
44
|
}
|
|
45
45
|
export declare function refuseSubmitBody(walls: SqlWallsReading, body: unknown): SubmitBodyRefusal | null;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
47
|
+
* [ref] ③ —— 租约拒绝的应答形({@link leaseRefusalOf} 的产物;`{status, body}` 交回形 + 镜像头用的 `retryAfterSec`)。
|
|
48
48
|
* 体经唯一组句器铸(键序 `error, errorCode, …机读位`;冻结门 `FROZEN_RESULT_BODY` 读 `refusalBody({ errorCode, message, … })` 这一形)。
|
|
49
49
|
*/
|
|
50
50
|
export interface LeaseRefusal {
|
|
@@ -53,7 +53,7 @@ export interface LeaseRefusal {
|
|
|
53
53
|
readonly retryAfterSec: number;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* [ref] ③ —— 一次被拒的租约准入 → HTTP 应答的**唯一**映射(三只门 {@link createRequestGuards} 里的 `leaseDenied` /
|
|
57
57
|
* `ownerLeaseDenied` / `ownerFleetLeaseDenied` 同调它;12 个调用点零改)。按拒因穷举(加一臂 = 编译红):
|
|
58
58
|
* · `budget_exhausted` ⇒ **429 `quota_exhausted`**(字节同 7.105.0 的路由发送形:`retryAfterSec` + 中心 E4 结构化字段逐字透传);
|
|
59
59
|
* · `lease_unavailable` ⇒ **503 `fleet.lease_unavailable`**(只在 `FLEET_LEASE_FAIL_CLOSED` 生效时出现):体 `{reason, retryAfterSec}`,
|
|
@@ -95,15 +95,6 @@ export declare function createRequestGuards(ctx: {
|
|
|
95
95
|
usageWindowDenied: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
96
96
|
rateLimited: (req: IncomingMessage, res: ServerResponse) => boolean;
|
|
97
97
|
safeDecode: (seg: string) => string | null;
|
|
98
|
-
isFleetWide: (req: IncomingMessage) => boolean;
|
|
99
|
-
sessionOwnerScope: (req: IncomingMessage) => {
|
|
100
|
-
fleetWide: boolean;
|
|
101
|
-
gateOwner: string | null;
|
|
102
|
-
};
|
|
103
|
-
sessionOwnerScopeForWrite: (req: IncomingMessage) => {
|
|
104
|
-
fleetWide: boolean;
|
|
105
|
-
gateOwner: string | null;
|
|
106
|
-
};
|
|
107
98
|
runOwnerOk: (req: IncomingMessage, res: ServerResponse, owner: string | null) => boolean;
|
|
108
99
|
sessionOwnerOk: (req: IncomingMessage, res: ServerResponse, cell: SessionOwnerCell) => boolean;
|
|
109
100
|
runSessionAcceptOk: (req: IncomingMessage, res: ServerResponse, run: {
|
|
@@ -4,8 +4,9 @@ import { RUN_NOT_FOUND_MESSAGE, SESSION_NOT_FOUND_MESSAGE } from "./route-ctx.js
|
|
|
4
4
|
import { invalidJsonError, sendError } from "./send.js";
|
|
5
5
|
import { refusalBody } from "./refusal-body.js";
|
|
6
6
|
import { limitFactsUnmeasured } from "../limit-refusal.js";
|
|
7
|
-
import {
|
|
7
|
+
import { gatedPrincipal, explicitOperatorOk, sessionOwnerReadable, sessionCallerOf, sendPrincipalRefusal } from "./principal-gate.js";
|
|
8
8
|
import { runRowReadable } from "./owner-access.js";
|
|
9
|
+
import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
|
|
9
10
|
import { quotaWindowResetsAt } from "../observability/cost-quota.js";
|
|
10
11
|
import { escapedStatementBytes, packetWallStatementBytes, rowWallPayloadBytes } from "../plugins/sql-driver.js";
|
|
11
12
|
const MAX_BODY = 8 * 1024 * 1024;
|
|
@@ -184,23 +185,9 @@ export function createRequestGuards(ctx) {
|
|
|
184
185
|
return null;
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
|
-
function isFleetWide(req) {
|
|
188
|
-
const tt = deps.config.traceToken;
|
|
189
|
-
return devOpenDeployment(deps) || systemFor(req, deps.config) !== undefined || (!!tt && authorized(req, tt));
|
|
190
|
-
}
|
|
191
|
-
function sessionOwnerScope(req) {
|
|
192
|
-
const fleetWide = isFleetWide(req);
|
|
193
|
-
const gateOwner = fleetWide ? null : (gatedPrincipal(req, deps.config) || null);
|
|
194
|
-
return { fleetWide, gateOwner };
|
|
195
|
-
}
|
|
196
|
-
function sessionOwnerScopeForWrite(req) {
|
|
197
|
-
const fleetWide = devOpenDeployment(deps) || systemFor(req, deps.config) !== undefined;
|
|
198
|
-
const gateOwner = fleetWide ? null : (gatedPrincipal(req, deps.config) || null);
|
|
199
|
-
return { fleetWide, gateOwner };
|
|
200
|
-
}
|
|
201
188
|
function ownerGate(req, res, readable, notFound) {
|
|
202
189
|
const principal = gatedPrincipal(req, deps.config);
|
|
203
|
-
if (deps.config
|
|
190
|
+
if (DEPLOYMENT_SHAPE_PREDICATES.principalRequired.holds(deps.config) && !principal) {
|
|
204
191
|
sendPrincipalRefusal(res, req, deps.config);
|
|
205
192
|
return false;
|
|
206
193
|
}
|
|
@@ -265,6 +252,6 @@ export function createRequestGuards(ctx) {
|
|
|
265
252
|
}
|
|
266
253
|
return Buffer.concat(chunks);
|
|
267
254
|
}
|
|
268
|
-
return { quotaExceeded, ownerCostQuotaDenied, ownerFleetLeaseDenied, ownerLeaseDenied, ownerQuotaDenied, leaseDenied, usageWindowDenialFor, usageWindowDenied, rateLimited, safeDecode,
|
|
255
|
+
return { quotaExceeded, ownerCostQuotaDenied, ownerFleetLeaseDenied, ownerLeaseDenied, ownerQuotaDenied, leaseDenied, usageWindowDenialFor, usageWindowDenied, rateLimited, safeDecode, runOwnerOk, sessionOwnerOk, runSessionAcceptOk, readJson, readRawBody };
|
|
269
256
|
}
|
|
270
257
|
//# sourceMappingURL=request-guards.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **续跑上下文这一次读的结局**(
|
|
2
|
+
* **续跑上下文这一次读的结局**([ref] 第二半,7.94.0)—— 属主模块,所有消费腿共用这一只读口。
|
|
3
3
|
*
|
|
4
4
|
* 🔴 **为什么必须有这只铸点**:此前各消费腿各写一句 `.catch(() => null)`(还有一处把异常文案拼上 wire),
|
|
5
|
-
* 于是店层在
|
|
5
|
+
* 于是店层在 [ref] 里把坏体从「答缺席」改成「响亮拒」之后,那些 `catch` 会把那次拒**原样吞回缺席** ——
|
|
6
6
|
* 机制上「坏体不再与缺席同答」成立,**用户面上不成立**(用户拿到的还是同一个 409)。判据要钉用户实际
|
|
7
7
|
* 拿到的码,这只铸点就是让那句判据有地方落(test [ref] 的判据订正,当拍采纳)。
|
|
8
8
|
*
|
|
@@ -16,13 +16,25 @@
|
|
|
16
16
|
* ⚠️ `not-text`(投影漂 = 我方的码病)**刻意不进这一态**,原样上抛、响亮成 500 —— 不许伪装成
|
|
17
17
|
* 「数据坏了」,更不许折成缺席(那会让一次代码漂看起来像「这条会话没有上下文」)。
|
|
18
18
|
*
|
|
19
|
-
* 🔴 **按「店的拒绝形」分类,不按「列错误类」**(
|
|
19
|
+
* 🔴 **按「店的拒绝形」分类,不按「列错误类」**([ref],7.95.1:这一句此前反了,整整一版)。修前本口
|
|
20
20
|
* 认的是属主谓词 `isJsonColumnBodyProblem`(= 一只 `SqlJsonColumnError`),而 SQL 两孪生的 `refusing()`
|
|
21
21
|
* 早把列错误**折**成了一只普通 `Error` ⇒ 折后的错落进下面那条「店抖动 ⇒ 当缺席」臂,坏体与缺席在
|
|
22
|
-
* 用户面上仍然同答 409 —— 正是
|
|
22
|
+
* 用户面上仍然同答 409 —— 正是 [ref] 第二半要修的那个病,只是它当时只在 local 车道上修成了(那一侧
|
|
23
23
|
* 恰好没折码,把列错误漏了出来 = 巧合式正确)。两条车道现在同一份拒绝契约,本口只认它。
|
|
24
|
+
*
|
|
25
|
+
* 🔴 **第四态 `unsealable`([ref],7.134.0):读出来了,但凭据位上的封签开不开**。店交出的是**落盘形**(凭据位上是封签,`StoredCheckpointCtx`);
|
|
26
|
+
* 本口在任何消费者看到之前经**唯一**开口 `openCheckpointCtx` 开封(规则属主 = `checkpoint-ctx.ts` 末段「凭据位密封」)—— 所以 `ok` 交出的恒是开封形,
|
|
27
|
+
* 没有哪条腿拿着封签去重建 spec。开不开(没有保管店 / 钥匙不在本副本 / 密文坏或不是本行封的 / 明文 / 认不出的封签)⇒ `unsealable`(`field` + `reason`),
|
|
28
|
+
* 各续跑入口答 {@link resumeCtxUnsealableAnswer}(409 `conflict.checkpoint_ctx_unsealable`)。**不折成缺席**(出路不同:缺席 = 重提;开不开 = 看 `reason`
|
|
29
|
+
* —— `key_not_held` 多半是多副本没共享保管目录,运维修好之后同一个决定原样重发即可),**不明文回落、不丢键**。
|
|
30
|
+
* 开封要知道这一行的会话(封签绑会话)与开口(`ServiceDeps.checkpointCtxSealing`;缺席 = 本副本没有保管店):两件一起交({@link CheckpointCtxOpening})。
|
|
31
|
+
*
|
|
32
|
+
* **两种读法,一只读口**(第二个实参):① 开封形({@link CheckpointCtxOpening})—— 续跑重建 spec 的每一条腿;② {@link KEEP_SEALED}「信封原样留着」——
|
|
33
|
+
* 只读**非凭据字段**的读者(今天 = inbox 的展示位 `objective`):不开封、不判凭据位(活凭据不为展示进内存),交回落盘形 `StoredCheckpointCtx`,
|
|
34
|
+
* 结局里没有 `unsealable` 这一态(型面就没有;店边界的三态与开封形逐字同一段)。凭据位上的值在这种读法里仍是封签 —— 谁要用它们就必须走读法 ①。
|
|
24
35
|
*/
|
|
25
36
|
import type { CheckpointCtx } from "./route-ctx.js";
|
|
37
|
+
import { type CheckpointCtxOpener, type CheckpointCtxUnsealableReason, type StoredCheckpointCtx } from "./checkpoint-ctx.js";
|
|
26
38
|
import { type RefusalBody } from "./refusal-body.js";
|
|
27
39
|
export type ResumeCtxRead = {
|
|
28
40
|
readonly kind: "ok";
|
|
@@ -32,10 +44,45 @@ export type ResumeCtxRead = {
|
|
|
32
44
|
} | {
|
|
33
45
|
readonly kind: "corrupt";
|
|
34
46
|
readonly where: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "unsealable";
|
|
49
|
+
readonly field: string;
|
|
50
|
+
readonly reason: CheckpointCtxUnsealableReason;
|
|
51
|
+
};
|
|
52
|
+
/** 读法 ② 的结局:店边界的三态,`ok` 交落盘形(凭据位上仍是封签)。 */
|
|
53
|
+
export type SealedResumeCtxRead = {
|
|
54
|
+
readonly kind: "ok";
|
|
55
|
+
readonly ctx: StoredCheckpointCtx;
|
|
56
|
+
} | {
|
|
57
|
+
readonly kind: "absent";
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: "corrupt";
|
|
60
|
+
readonly where: string;
|
|
61
|
+
};
|
|
62
|
+
/** 开封的两件:这一行的会话(= 交给店 `getCtx` 的那一个)与开口(缺席 = 本副本没有保管店)。 */
|
|
63
|
+
export interface CheckpointCtxOpening {
|
|
64
|
+
readonly sessionId: string;
|
|
65
|
+
readonly opener: CheckpointCtxOpener | undefined;
|
|
66
|
+
}
|
|
67
|
+
/** 读法 ② 的词:信封原样留着(只读非凭据字段)。 */
|
|
68
|
+
export declare const KEEP_SEALED = "keep_sealed";
|
|
69
|
+
export declare function readResumeCtx(load: Promise<StoredCheckpointCtx | null>, opening: CheckpointCtxOpening): Promise<ResumeCtxRead>;
|
|
70
|
+
export declare function readResumeCtx(load: Promise<StoredCheckpointCtx | null>, opening: typeof KEEP_SEALED): Promise<SealedResumeCtxRead>;
|
|
71
|
+
/**
|
|
72
|
+
* 开不开的对外答复([ref])—— 409 `conflict.checkpoint_ctx_unsealable`,机读 `field`(哪一个凭据位,提交体路径;键名不是秘密,值从不进来)+ `reason`
|
|
73
|
+
* (闭集 `CHECKPOINT_CTX_UNSEALABLE_REASONS`)。句子说「这条任务的续跑上下文里带的凭据本服务开不开」、五种成因与出路(按 `reason` 修好保管目录后原样重发,
|
|
74
|
+
* 或作为新任务重提、仍停驻的先取消)。拒在任何状态改动之前:卡仍待决、行字节不动、`plan_review` 的一次性 nonce 未烧。
|
|
75
|
+
* 🔴 形是给冻结门看的(与 {@link resumeCtxCorruptAnswer} 同一条):`status: <三位数>, body: refusalBody({ errorCode: "<码>", message: "<整句双引号字面>"`,中间只许有空白。
|
|
76
|
+
*/
|
|
77
|
+
export declare function resumeCtxUnsealableAnswer(read: {
|
|
78
|
+
readonly field: string;
|
|
79
|
+
readonly reason: CheckpointCtxUnsealableReason;
|
|
80
|
+
}): {
|
|
81
|
+
status: number;
|
|
82
|
+
body: RefusalBody;
|
|
35
83
|
};
|
|
36
|
-
export declare function readResumeCtx(load: Promise<CheckpointCtx | null>): Promise<ResumeCtxRead>;
|
|
37
84
|
/** 坏体的对外答复 —— 与会话策略面**同码**(`session-policy-wire.ts` 的 `corrupt` ⇒ 500),不铸新词。
|
|
38
|
-
* 文案只说「哪一行读不出来 + 该找谁」,不把店层 detail 拼上 wire(内部机件不上 wire,
|
|
85
|
+
* 文案只说「哪一行读不出来 + 该找谁」,不把店层 detail 拼上 wire(内部机件不上 wire,[ref] 同律)。 */
|
|
39
86
|
export declare function resumeCtxCorruptAnswer(where: string): {
|
|
40
87
|
status: number;
|
|
41
88
|
body: RefusalBody;
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { openCheckpointCtx } from "./checkpoint-ctx.js";
|
|
1
2
|
import { SqlJsonColumnError, StoreCorruptError } from "../plugins/sql-json-column.js";
|
|
2
3
|
import { refusalBody } from "./refusal-body.js";
|
|
3
|
-
export
|
|
4
|
+
export const KEEP_SEALED = "keep_sealed";
|
|
5
|
+
export async function readResumeCtx(load, opening) {
|
|
6
|
+
const read = await readStoredCtx(load);
|
|
7
|
+
if (read.kind !== "ok" || opening === KEEP_SEALED)
|
|
8
|
+
return read;
|
|
9
|
+
const opened = openCheckpointCtx(read.ctx, opening.opener, opening.sessionId);
|
|
10
|
+
return opened.kind === "ok" ? { kind: "ok", ctx: opened.ctx } : { kind: "unsealable", field: opened.field, reason: opened.reason };
|
|
11
|
+
}
|
|
12
|
+
async function readStoredCtx(load) {
|
|
13
|
+
let stored;
|
|
4
14
|
try {
|
|
5
|
-
|
|
6
|
-
return ctx == null ? { kind: "absent" } : { kind: "ok", ctx };
|
|
15
|
+
stored = await load;
|
|
7
16
|
}
|
|
8
17
|
catch (e) {
|
|
9
18
|
if (e instanceof StoreCorruptError)
|
|
@@ -12,6 +21,20 @@ export async function readResumeCtx(load) {
|
|
|
12
21
|
throw e;
|
|
13
22
|
return { kind: "absent" };
|
|
14
23
|
}
|
|
24
|
+
return stored == null ? { kind: "absent" } : { kind: "ok", ctx: stored };
|
|
25
|
+
}
|
|
26
|
+
export function resumeCtxUnsealableAnswer(read) {
|
|
27
|
+
return {
|
|
28
|
+
status: 409,
|
|
29
|
+
body: refusalBody({
|
|
30
|
+
errorCode: "conflict.checkpoint_ctx_unsealable",
|
|
31
|
+
message: "this task's stored resume context holds credentials from its request (MCP / A2A headers or env values, settings.env, settings.webSearch.apiKey, http hook headers, or command hook plugin options) that this server cannot unseal — reason says why: no_key_store (this server has no sealed-key store), key_not_held (they were sealed with a key this server does not hold: another replica's, or a replaced sealed-key directory), unopenable (the sealed value is damaged or belongs to another session), plaintext (an older server version stored them unsealed), unrecognized_seal (a seal format this version does not know). Nothing was decided and nothing was resumed. If whoever operates this deployment restores the sealed-key directory that sealed them and restarts this server (it reads its keys only at startup), the same request can be sent again; otherwise submit the work again as a new task, and if this task is still suspended cancel it first (POST /v1/runs/:id/cancel).",
|
|
32
|
+
facts: {
|
|
33
|
+
field: read.field,
|
|
34
|
+
reason: read.reason,
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
};
|
|
15
38
|
}
|
|
16
39
|
export function resumeCtxCorruptAnswer(where) {
|
|
17
40
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 续跑腿家族 + 路由 ctx 的装配(
|
|
2
|
+
* 续跑腿家族 + 路由 ctx 的装配([ref] 切片:`http/server.ts` 2378–4804 与 1119–1128 逐字搬家,正文一字未改)。
|
|
3
3
|
*
|
|
4
4
|
* 🔴 为什么 `routeCtxBase` 住在这个文件里而不是组合根:`startFreshHostTurn` 把**整只** ctx 交给
|
|
5
5
|
* `mintAndDriveDurableRun`,而 `ctx.legs` 装的正是本文件这几条腿 —— 两者是一个结。拆开只有两条路:
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* 腿是提升的函数声明、ctx 是文件尾的 `const`,谁也不会在工厂执行期读到对方。
|
|
9
9
|
*
|
|
10
10
|
* ctx 字段 27 只(registry 6 + helpers 14 + deps/runnerFor/prepareSpec/finalizeTaskResult + 三只配额/租约/用量窗
|
|
11
|
-
* 判据;
|
|
11
|
+
* 判据;[ref] 删 `cancelledViaVerb` 旁表后 28 → 27,与 `test/split-ctx-parity.test.ts` 的读数同)—— 这是**如实披露**的耦合读数(设计稿 §9:把它变小是波 3 的事,本刀不承诺)。型一律从既有型派生
|
|
12
12
|
* (`RunRegistry` / `RouteHelpers` / `RouteLegs` / `ReturnType<typeof createRequestGuards>`),不手抄签名 ⇒ 不会漂。
|
|
13
13
|
*/
|
|
14
14
|
import type { IncomingMessage } from "node:http";
|
|
@@ -29,13 +29,14 @@ import { type ResumeRefusalAnswer } from "./checkpoint-ctx.js";
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function resumeRefusalDisposition(e: CheckpointError): "cancelled" | "retriable" | "terminal";
|
|
31
31
|
/**
|
|
32
|
-
* 🔴 **引擎拒一次续跑(`CheckpointError`)的 HTTP 答复 —— 唯一组句器**(
|
|
32
|
+
* 🔴 **引擎拒一次续跑(`CheckpointError`)的 HTTP 答复 —— 唯一组句器**([ref] / [ref],core 7.52.0;五条续跑腿〔`/decide` · `/resume` · `/wake` · `plan_review` ·
|
|
33
33
|
* workflow 决定在宿主会话上起的新一跑〕同经 `driveResumeLeg` 的 catch 臂到这里,SLA 拒扫腿与 PARKED 赎回席经 `resumeCheckpoint` 同得)。
|
|
34
34
|
*
|
|
35
35
|
* 规则(一条):**一次拒 = 一个答复形,与「谁发现的」无关**。引擎在认领前 / CAS 前拒的,与本服务在重放存量体之前自己拒的(`resume_blocked_by_policy`,
|
|
36
36
|
* `checkpoint-ctx.ts` `resumeBlockedByPolicyAnswer`;续跑入口上卡仍 pending ⇒ 同样带 `retriable:true`)读同一组机读键;体经拒体组句器 `refusalBody` 铸,
|
|
37
37
|
* `retriable` 经续跑家族的唯一写点 `resumeRefusalWithCard` 追加。
|
|
38
|
-
*
|
|
38
|
+
* 后台停驻子代的 parked 赎回不经本函数(引擎交的是赎回回执,不是 `CheckpointError`):`parked-decide.ts` 答 `422 parked_resume.startup_failed`,体带成因词 `cause`,
|
|
39
|
+
* 引擎 7.54.0 起回执的 `details.detail` 交出同三位判别位,经**同一只**读法 `resumeRefusalFacts` 落成同名三键(下面第二条)。键律:
|
|
39
40
|
* · `errorCode` —— 引擎码的原码镜像(`checkpoint.invalid_outcome` 按决断成因改铸,{@link decisionRefusalCauseOf});
|
|
40
41
|
* · 引擎 `detail` 的三个机读判别位原样过境,键名与 `resume_blocked_by_policy` 同义:`detail.code` ⇒ `blockedBy`(挡住它的准入码 = 同一份坏配置在新跑上报的 `errorCode`;
|
|
41
42
|
* 今天只有 `checkpoint.config_refused` 带它)· `detail.field` ⇒ `field`(哪一侧 / 哪一格)· `detail.reason` ⇒ `reason`(同码多臂时哪一臂,闭集 `CheckpointErrorReason`)。
|