@sema-agent/server 7.131.0 → 7.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +575 -0
- package/README.md +12 -9
- package/README.zh-CN.md +9 -6
- package/USAGE.md +326 -98
- package/deploy/sema-up/README.md +19 -1
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
- package/deploy/sema-up/chart/templates/server.yaml +5 -2
- package/deploy/sema-up/stack/compose.yaml +3 -0
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
- package/dist/adoption/plan.d.ts +3 -2
- package/dist/adoption/plan.js +7 -5
- package/dist/adoption/runner.js +3 -10
- package/dist/adoption/sql.d.ts +3 -2
- package/dist/adoption/sql.js +3 -5
- package/dist/adoption/wire.d.ts +4 -1
- package/dist/adoption/wire.js +1 -0
- package/dist/approval-ask-audit-store.d.ts +31 -13
- package/dist/approval-ask-audit-store.js +272 -74
- package/dist/approval-ask-machine.d.ts +15 -0
- package/dist/approval-ask-machine.js +6 -0
- package/dist/approval-ask-retention.d.ts +136 -0
- package/dist/approval-ask-retention.js +102 -0
- package/dist/approval-card.d.ts +82 -20
- package/dist/approval-card.js +46 -16
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval.d.ts +9 -0
- package/dist/approval.js +24 -3
- package/dist/audit.d.ts +33 -19
- package/dist/audit.js +12 -16
- package/dist/auth-bridge.d.ts +4 -0
- package/dist/auth-bridge.js +10 -11
- package/dist/bake-runner/main.js +3 -2
- package/dist/boot/deferred-sandbox-path-env.js +1 -1
- package/dist/boot/deployment-mods.d.ts +31 -0
- package/dist/boot/deployment-mods.js +26 -0
- package/dist/boot/execution-env.d.ts +1 -1
- package/dist/boot/execution-env.js +27 -12
- package/dist/boot/execution-lane.js +11 -0
- package/dist/boot/leader.js +2 -0
- package/dist/boot/memory-boundary.d.ts +2 -2
- package/dist/boot/memory-boundary.js +2 -2
- package/dist/boot/memory-consolidation.d.ts +5 -4
- package/dist/boot/memory-consolidation.js +7 -6
- package/dist/boot/org-delivery.d.ts +28 -0
- package/dist/boot/org-delivery.js +20 -0
- package/dist/boot/read-deny-anchor-audit.d.ts +17 -0
- package/dist/boot/read-deny-anchor-audit.js +36 -0
- package/dist/boot/reapers.d.ts +3 -0
- package/dist/boot/reapers.js +21 -1
- package/dist/boot/resolve-spec.d.ts +4 -5
- package/dist/boot/resolve-spec.js +74 -123
- package/dist/boot/runner-deps.d.ts +19 -8
- package/dist/boot/runner-deps.js +15 -2
- package/dist/boot/session-faces.d.ts +2 -7
- package/dist/boot/session-faces.js +4 -2
- package/dist/boot/stage-02-web-admin-pull.js +4 -1
- package/dist/boot/stage-03-store-backend.d.ts +1 -1
- package/dist/boot/stage-03-store-backend.js +2 -2
- package/dist/boot/stage-04-stores.d.ts +1 -1
- package/dist/boot/stage-05-execution-env.d.ts +4 -4
- package/dist/boot/stage-05-execution-env.js +7 -10
- package/dist/boot/stage-06-runners.d.ts +4 -2
- package/dist/boot/stage-06-runners.js +11 -7
- package/dist/boot/stage-07-capability-layer.d.ts +4 -2
- package/dist/boot/stage-07-capability-layer.js +27 -6
- package/dist/boot/stage-08-reapers.d.ts +4 -2
- package/dist/boot/stage-08-reapers.js +2 -2
- package/dist/boot/stage-09-leader.d.ts +6 -9
- package/dist/boot/stage-10-http-server.d.ts +6 -9
- package/dist/boot/stage-10-http-server.js +7 -9
- package/dist/boot/stores.d.ts +1 -1
- package/dist/boot/stores.js +7 -8
- package/dist/boot/web-admin.d.ts +4 -3
- package/dist/boot/web-admin.js +186 -98
- package/dist/boot/workflow-orchestration.d.ts +2 -0
- package/dist/boot/workflow-orchestration.js +2 -1
- package/dist/brain.js +25 -25
- package/dist/breaker-key.d.ts +6 -0
- package/dist/breaker-key.js +29 -0
- package/dist/budget.js +5 -4
- package/dist/caller-text-echo.d.ts +23 -0
- package/dist/caller-text-echo.js +21 -0
- package/dist/capabilities/brand-identity.d.ts +26 -0
- package/dist/capabilities/brand-identity.js +27 -0
- package/dist/capabilities/center-plugins.d.ts +7 -0
- package/dist/capabilities/center-plugins.js +1 -1
- package/dist/capabilities/center-prompts.d.ts +32 -59
- package/dist/capabilities/center-prompts.js +18 -32
- package/dist/capabilities/composite-members.d.ts +1 -1
- package/dist/capabilities/composite-members.js +1 -1
- package/dist/capabilities/engine-capabilities.js +2 -1
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +30 -6
- package/dist/capabilities/hands-lane.js +11 -1
- package/dist/capabilities/mcp-probe.d.ts +48 -3
- package/dist/capabilities/mcp-probe.js +47 -135
- package/dist/capabilities/scenarios.d.ts +95 -45
- package/dist/capabilities/scenarios.js +53 -38
- package/dist/capabilities/skills.d.ts +19 -4
- package/dist/capabilities/skills.js +30 -10
- package/dist/capability-facts.d.ts +34 -4
- package/dist/capability-facts.js +28 -2
- package/dist/center-config-tier.d.ts +69 -0
- package/dist/center-config-tier.js +42 -0
- package/dist/checkpoint-identity.d.ts +16 -0
- package/dist/checkpoint-identity.js +19 -0
- package/dist/config-catalog.d.ts +17 -10
- package/dist/config-catalog.js +47 -32
- package/dist/config-d-migration.d.ts +3 -1
- package/dist/config-d-migration.js +2 -2
- package/dist/config-dir-trust.d.ts +114 -0
- package/dist/config-dir-trust.js +388 -0
- package/dist/config-invariants.d.ts +18 -5
- package/dist/config-invariants.js +35 -3
- package/dist/config-lkg.d.ts +9 -9
- package/dist/config-lkg.js +20 -4
- package/dist/config-provider.d.ts +9 -2
- package/dist/config-provider.js +18 -6
- package/dist/config-types.d.ts +75 -20
- package/dist/config-types.js +8 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.js +137 -62
- package/dist/delegated-session-owner.d.ts +185 -0
- package/dist/delegated-session-owner.js +119 -0
- package/dist/device-protocol.d.ts +5 -3
- package/dist/device-protocol.js +1 -1
- package/dist/device-ws-hub.js +21 -2
- package/dist/device-ws-protocol.d.ts +70 -6
- package/dist/device-ws-protocol.js +50 -22
- package/dist/elicitation.js +3 -2
- package/dist/entry-problems.d.ts +34 -0
- package/dist/entry-problems.js +14 -0
- package/dist/env-name-allowlist-knobs.d.ts +12 -2
- package/dist/env-name-allowlist-knobs.js +5 -4
- package/dist/exec-bounds.d.ts +15 -3
- package/dist/exec-bounds.js +4 -0
- package/dist/execution-lane-caps.d.ts +56 -10
- package/dist/execution-lane-caps.js +50 -0
- package/dist/field-conflict.d.ts +43 -0
- package/dist/field-conflict.js +20 -0
- package/dist/fleet/fleet-bus.d.ts +80 -6
- package/dist/fleet/fleet-bus.js +41 -9
- package/dist/hooks/classic-stations.d.ts +91 -0
- package/dist/hooks/classic-stations.js +27 -0
- package/dist/hooks/command-spawn.d.ts +57 -0
- package/dist/hooks/command-spawn.js +139 -0
- package/dist/hooks/hook-llm.d.ts +8 -5
- package/dist/hooks/hook-llm.js +79 -36
- package/dist/hooks/hook-runner.d.ts +349 -95
- package/dist/hooks/hook-runner.js +855 -568
- package/dist/hooks/hook-source.d.ts +44 -0
- package/dist/hooks/hook-source.js +40 -0
- package/dist/http/active-run-conflict.d.ts +5 -13
- package/dist/http/active-run-conflict.js +17 -27
- package/dist/http/admission.d.ts +8 -2
- package/dist/http/admission.js +188 -101
- package/dist/http/approval-sweeps.js +99 -21
- package/dist/http/caller-trust.d.ts +77 -0
- package/dist/http/caller-trust.js +143 -0
- package/dist/http/checkpoint-ctx.d.ts +41 -24
- package/dist/http/checkpoint-ctx.js +23 -16
- package/dist/http/claimed-run.d.ts +14 -0
- package/dist/http/claimed-run.js +15 -0
- package/dist/http/device-placement.d.ts +2 -4
- package/dist/http/device-placement.js +7 -11
- package/dist/http/dispatch.d.ts +0 -4
- package/dist/http/dispatch.js +15 -13
- package/dist/http/durable-run-leg.d.ts +6 -33
- package/dist/http/durable-run-leg.js +36 -10
- package/dist/http/health-self-report.d.ts +7 -5
- package/dist/http/health-self-report.js +4 -18
- package/dist/http/owner-access.d.ts +56 -0
- package/dist/http/owner-access.js +42 -0
- package/dist/http/principal-gate.d.ts +70 -28
- package/dist/http/principal-gate.js +61 -15
- package/dist/http/readiness.d.ts +11 -5
- package/dist/http/readiness.js +10 -3
- package/dist/http/refusal-body.d.ts +21 -0
- package/dist/http/refusal-body.js +4 -0
- package/dist/http/request-guards.d.ts +43 -23
- package/dist/http/request-guards.js +53 -17
- package/dist/http/resume-ctx-read.d.ts +2 -5
- package/dist/http/resume-ctx-read.js +7 -4
- package/dist/http/resume-legs.d.ts +28 -4
- package/dist/http/resume-legs.js +169 -91
- package/dist/http/retired-service-deps.d.ts +43 -0
- package/dist/http/retired-service-deps.js +18 -0
- package/dist/http/route-ctx.d.ts +44 -28
- package/dist/http/route-ctx.js +4 -0
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.js +3 -4
- package/dist/http/routes/admin-config-refresh.js +1 -1
- package/dist/http/routes/admin-drain.js +1 -1
- package/dist/http/routes/admin-memory-optout.js +5 -1
- package/dist/http/routes/adoption.js +2 -9
- package/dist/http/routes/approvals-assistant.js +49 -48
- package/dist/http/routes/background.js +3 -2
- package/dist/http/routes/capabilities.js +21 -5
- package/dist/http/routes/config-catalog.d.ts +3 -3
- package/dist/http/routes/config-catalog.js +1 -1
- package/dist/http/routes/devices.js +3 -17
- package/dist/http/routes/diagnostics.js +6 -2
- package/dist/http/routes/images.js +6 -7
- package/dist/http/routes/leader.js +1 -8
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +3 -2
- package/dist/http/routes/memory-bundle.js +1 -1
- package/dist/http/routes/memory-compliance.js +1 -1
- package/dist/http/routes/memory-consolidation.js +1 -1
- package/dist/http/routes/memory-origin.js +1 -1
- package/dist/http/routes/memory-policy.d.ts +1 -1
- package/dist/http/routes/memory-policy.js +3 -2
- package/dist/http/routes/notify-wake.js +8 -21
- package/dist/http/routes/observability.js +2 -2
- package/dist/http/routes/principal-inbox.d.ts +39 -0
- package/dist/http/routes/principal-inbox.js +76 -0
- package/dist/http/routes/retention-ops.js +2 -9
- package/dist/http/routes/rules.js +5 -18
- package/dist/http/routes/runs.d.ts +5 -0
- package/dist/http/routes/runs.js +34 -107
- package/dist/http/routes/session-sync.js +15 -26
- package/dist/http/routes/sessions.js +30 -40
- package/dist/http/routes/shared-memory.js +2 -13
- package/dist/http/routes/side-query.js +8 -7
- package/dist/http/routes/tasks.js +67 -21
- package/dist/http/routes/workflows.d.ts +351 -0
- package/dist/http/routes/workflows.js +153 -119
- package/dist/http/send.d.ts +33 -10
- package/dist/http/send.js +21 -4
- package/dist/http/server.d.ts +27 -18
- package/dist/http/server.js +34 -6
- package/dist/http/stored-body-replay.js +17 -4
- package/dist/http/submit-ctx.d.ts +25 -0
- package/dist/http/submit-ctx.js +40 -0
- package/dist/http/submit-replay.d.ts +4 -3
- package/dist/http/submit-replay.js +5 -4
- package/dist/http/wire-types.d.ts +11 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -2
- package/dist/lane-home-probe.d.ts +112 -0
- package/dist/lane-home-probe.js +101 -0
- package/dist/leader/endpoint.d.ts +4 -1
- package/dist/leader/endpoint.js +11 -10
- package/dist/limit-refusal.d.ts +59 -0
- package/dist/limit-refusal.js +15 -0
- package/dist/main.js +1 -1
- package/dist/mcp-assertion-header.d.ts +32 -19
- package/dist/mcp-assertion-header.js +10 -9
- package/dist/mcp-tool-faces.d.ts +5 -0
- package/dist/mcp-tool-faces.js +6 -4
- package/dist/memory-project-layer.d.ts +37 -0
- package/dist/memory-project-layer.js +46 -0
- package/dist/memory-scope.d.ts +24 -17
- package/dist/memory-scope.js +24 -8
- package/dist/memory-sync-client.d.ts +27 -13
- package/dist/memory-sync-client.js +107 -18
- package/dist/model-entry-refusal.d.ts +9 -1
- package/dist/model-entry-refusal.js +6 -1
- package/dist/model-plane-face.d.ts +51 -0
- package/dist/model-plane-face.js +24 -0
- package/dist/model-provider.d.ts +44 -12
- package/dist/model-provider.js +21 -2
- package/dist/model-route-endpoint.d.ts +9 -12
- package/dist/model-route-endpoint.js +8 -11
- package/dist/model-route-env.d.ts +22 -0
- package/dist/model-route-env.js +2 -0
- package/dist/model-route-gap.d.ts +60 -30
- package/dist/model-route-gap.js +21 -15
- package/dist/observability/corrupt-read-seat.d.ts +7 -0
- package/dist/observability/corrupt-read-seat.js +9 -0
- package/dist/observability/cost-taxonomy.d.ts +7 -7
- package/dist/observability/err-text.d.ts +6 -0
- package/dist/observability/err-text.js +18 -4
- package/dist/observability/fail-open.d.ts +76 -14
- package/dist/observability/fail-open.js +76 -14
- package/dist/observability/metrics.js +4 -1
- package/dist/observability/prompt-manifest.d.ts +33 -82
- package/dist/observability/prompt-manifest.js +122 -17
- package/dist/observability/run-terminal.js +14 -6
- package/dist/observability/secret-env-scrub.d.ts +13 -1
- package/dist/observability/secret-env-scrub.js +13 -1
- package/dist/observability/tool-trace.d.ts +16 -21
- package/dist/observability/tool-trace.js +58 -49
- package/dist/operator-ask.d.ts +10 -0
- package/dist/operator-ask.js +3 -0
- package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
- package/dist/orchestration/workflow-agent-session-index.js +9 -13
- package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
- package/dist/orchestration/workflow-completion-inbox.js +13 -0
- package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
- package/dist/orchestration/workflow-notify-journal.js +27 -34
- package/dist/orchestration/workflow-park-decision.d.ts +89 -0
- package/dist/orchestration/workflow-park-decision.js +118 -0
- package/dist/org-delivery-gate.d.ts +81 -0
- package/dist/org-delivery-gate.js +59 -0
- package/dist/panel-tool-names.d.ts +23 -0
- package/dist/panel-tool-names.js +8 -0
- package/dist/parked-decide.d.ts +39 -6
- package/dist/parked-decide.js +98 -51
- package/dist/parked-revive-surface.d.ts +9 -2
- package/dist/parked-revive-surface.js +11 -8
- package/dist/per-task-image.d.ts +7 -1
- package/dist/per-task-image.js +3 -3
- package/dist/permission-rule-list.d.ts +1 -1
- package/dist/permission-rule-list.js +2 -2
- package/dist/plain-string-record.d.ts +25 -0
- package/dist/plain-string-record.js +32 -0
- package/dist/plugins/approval-ask-store-file.d.ts +16 -1
- package/dist/plugins/approval-ask-store-file.js +21 -0
- package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
- package/dist/plugins/approval-ask-store-memory.js +34 -2
- package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
- package/dist/plugins/approval-ask-store-sql.js +37 -1
- package/dist/plugins/blob-backend.d.ts +83 -15
- package/dist/plugins/blob-backend.js +68 -15
- package/dist/plugins/breaker-state-sql.d.ts +2 -2
- package/dist/plugins/breaker-state-sql.js +4 -4
- package/dist/plugins/caching-session-store.d.ts +3 -0
- package/dist/plugins/caching-session-store.js +3 -0
- package/dist/plugins/checkpoint-store-sql.d.ts +28 -4
- package/dist/plugins/checkpoint-store-sql.js +59 -28
- package/dist/plugins/file-history-store-sql.d.ts +5 -2
- package/dist/plugins/file-history-store-sql.js +3 -1
- package/dist/plugins/file-run-store.d.ts +5 -13
- package/dist/plugins/file-run-store.js +9 -0
- package/dist/plugins/fork-routing-session-store.d.ts +9 -1
- package/dist/plugins/fork-routing-session-store.js +12 -1
- package/dist/plugins/host-platform.d.ts +2 -0
- package/dist/plugins/host-platform.js +2 -1
- package/dist/plugins/k8s-bg-scripts.d.ts +11 -0
- package/dist/plugins/k8s-bg-scripts.js +22 -0
- package/dist/plugins/local-checkpoint-store.d.ts +2 -0
- package/dist/plugins/local-checkpoint-store.js +11 -3
- package/dist/plugins/local-session-store.d.ts +1 -1
- package/dist/plugins/local-session-store.js +1 -1
- package/dist/plugins/local-session-window.d.ts +39 -0
- package/dist/plugins/local-session-window.js +54 -0
- package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
- package/dist/plugins/mailbox-store-sql.d.ts +30 -48
- package/dist/plugins/mailbox-store-sql.js +77 -52
- package/dist/plugins/memory-embedder-fingerprint.js +2 -1
- package/dist/plugins/memory-run-store.d.ts +5 -13
- package/dist/plugins/memory-run-store.js +8 -0
- package/dist/plugins/one-time-migrations.d.ts +245 -93
- package/dist/plugins/one-time-migrations.js +668 -207
- package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
- package/dist/plugins/org-delivery-quota-store.js +228 -0
- package/dist/plugins/permission-rule-store-sql.d.ts +13 -7
- package/dist/plugins/permission-rule-store-sql.js +4 -18
- package/dist/plugins/pg-pool.js +39 -7
- package/dist/plugins/pg-session-storage.d.ts +20 -8
- package/dist/plugins/pg-session-storage.js +34 -21
- package/dist/plugins/remote-env-adb.d.ts +12 -12
- package/dist/plugins/remote-env-adb.js +21 -6
- package/dist/plugins/remote-env-device.js +3 -0
- package/dist/plugins/remote-env-e2b.d.ts +1 -1
- package/dist/plugins/remote-env-e2b.js +21 -9
- package/dist/plugins/remote-env-host.d.ts +9 -9
- package/dist/plugins/remote-env-host.js +10 -32
- package/dist/plugins/remote-env-k8s.d.ts +103 -38
- package/dist/plugins/remote-env-k8s.js +288 -95
- package/dist/plugins/remote-env-local-docker.d.ts +27 -13
- package/dist/plugins/remote-env-local-docker.js +82 -11
- package/dist/plugins/remote-env-ssh.d.ts +21 -12
- package/dist/plugins/remote-env-ssh.js +117 -5
- package/dist/plugins/remote-shell.d.ts +0 -1
- package/dist/plugins/remote-shell.js +1 -2
- package/dist/plugins/retention-store-sql.js +6 -2
- package/dist/plugins/run-store-sql.d.ts +16 -14
- package/dist/plugins/run-store-sql.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +54 -0
- package/dist/plugins/schema-consistency.js +52 -0
- package/dist/plugins/schema-indexes.js +2 -0
- package/dist/plugins/send-user-file.js +2 -2
- package/dist/plugins/session-epoch-anchor.d.ts +39 -0
- package/dist/plugins/session-epoch-anchor.js +22 -0
- package/dist/plugins/session-store.d.ts +18 -8
- package/dist/plugins/session-store.js +15 -4
- package/dist/plugins/shared-memory-store-sql.d.ts +9 -3
- package/dist/plugins/shared-memory-store-sql.js +5 -16
- package/dist/plugins/sql-driver.d.ts +205 -1
- package/dist/plugins/sql-driver.js +325 -13
- package/dist/plugins/sql-errors.d.ts +64 -0
- package/dist/plugins/sql-errors.js +57 -0
- package/dist/plugins/store-backend.d.ts +36 -1
- package/dist/plugins/store-backend.js +42 -15
- package/dist/plugins/store-contracts.d.ts +42 -0
- package/dist/plugins/store-contracts.js +1 -0
- package/dist/plugins/tidb-pool.d.ts +6 -1
- package/dist/plugins/tidb-pool.js +44 -10
- package/dist/plugins/tidb-session-storage.d.ts +8 -11
- package/dist/plugins/tidb-session-storage.js +6 -16
- package/dist/plugins/tidb-session-store.d.ts +24 -4
- package/dist/plugins/tidb-session-store.js +29 -5
- package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
- package/dist/plugins/workflow-journal-store-sql.js +19 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
- package/dist/plugins/workflow-run-store-sql.js +50 -9
- package/dist/posture-source.d.ts +18 -10
- package/dist/posture-source.js +4 -1
- package/dist/project-identity.d.ts +45 -6
- package/dist/project-identity.js +162 -8
- package/dist/project-layer-key.d.ts +28 -0
- package/dist/project-layer-key.js +29 -0
- package/dist/prompts-domain-validate.d.ts +17 -61
- package/dist/prompts-domain-validate.js +9 -119
- package/dist/question.js +3 -2
- package/dist/read-deny-entry.d.ts +25 -0
- package/dist/read-deny-entry.js +12 -0
- package/dist/read-face-posture.d.ts +37 -11
- package/dist/read-face-posture.js +32 -3
- package/dist/request-key-closure.d.ts +9 -2
- package/dist/request-key-closure.js +11 -5
- package/dist/request-value-closure.d.ts +5 -0
- package/dist/request-value-closure.js +11 -3
- package/dist/rule-entry-list.d.ts +38 -11
- package/dist/rule-entry-list.js +106 -30
- package/dist/rules-consent.js +3 -4
- package/dist/run-acceptance.d.ts +19 -3
- package/dist/run-acceptance.js +13 -1
- package/dist/run-local.js +54 -24
- package/dist/runs.d.ts +15 -8
- package/dist/runs.js +35 -1
- package/dist/runtime-caps-resolver.d.ts +16 -6
- package/dist/runtime-caps-resolver.js +18 -5
- package/dist/sandbox-pkg-source.d.ts +19 -1
- package/dist/sandbox-pkg-source.js +29 -7
- package/dist/security.d.ts +87 -9
- package/dist/security.js +52 -9
- package/dist/server-secret-env.d.ts +44 -18
- package/dist/server-secret-env.js +49 -8
- package/dist/session-error-wire.d.ts +19 -2
- package/dist/session-error-wire.js +5 -1
- package/dist/session-incarnation.d.ts +15 -5
- package/dist/session-incarnation.js +16 -9
- package/dist/session-titled-frame.d.ts +33 -0
- package/dist/session-titled-frame.js +4 -0
- package/dist/session-titler.d.ts +9 -1
- package/dist/session-titler.js +27 -6
- package/dist/spec-fields.d.ts +28 -16
- package/dist/spec-fields.js +66 -54
- package/dist/sql-engine-posture.d.ts +31 -4
- package/dist/sql-engine-posture.js +36 -1
- package/dist/stored-request-tool-axes-m19.d.ts +19 -4
- package/dist/stored-request-tool-axes-m19.js +30 -2
- package/dist/task-a2a.d.ts +9 -1
- package/dist/task-a2a.js +73 -47
- package/dist/task-cwd.d.ts +1 -1
- package/dist/task-mcp.d.ts +46 -58
- package/dist/task-mcp.js +82 -107
- package/dist/task-settings.d.ts +95 -108
- package/dist/task-settings.js +77 -98
- package/dist/text-bidi.d.ts +1 -48
- package/dist/text-bidi.js +3 -5
- package/dist/tighten-only-seats.d.ts +150 -0
- package/dist/tighten-only-seats.js +196 -0
- package/dist/tool-approval.d.ts +304 -88
- package/dist/tool-approval.js +623 -239
- package/dist/trace/core-keyset-guard.d.ts +122 -20
- package/dist/trace/engine-notice-wire.d.ts +11 -3
- package/dist/trace/engine-notice-wire.js +8 -1
- package/dist/trace/exit-seat.d.ts +28 -0
- package/dist/trace/exit-seat.js +76 -0
- package/dist/trace/ledger-events.d.ts +6 -3
- package/dist/trace/ledger-sink.js +4 -1
- package/dist/trace/model-segment.js +1 -1
- package/dist/trace/project.d.ts +98 -17
- package/dist/trace/project.js +98 -50
- package/dist/trace/projection-table.d.ts +100 -0
- package/dist/trace/projection-table.js +130 -0
- package/dist/trace/redact.d.ts +54 -0
- package/dist/trace/redact.js +778 -152
- package/dist/trace/self-minted-wire.d.ts +345 -1
- package/dist/trace/self-minted-wire.js +117 -1
- package/dist/trace/wire-projection-faces.d.ts +377 -3
- package/dist/trace/wire-projection-faces.js +164 -1
- package/dist/url-refusal.js +2 -0
- package/dist/web-admin-client/apply-effective.d.ts +12 -0
- package/dist/web-admin-client/apply-effective.js +56 -5
- package/dist/web-admin-client/candidate-gate.d.ts +6 -6
- package/dist/web-admin-client/candidate-gate.js +3 -3
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/facade.js +1 -1
- package/dist/web-admin-client/http-client.js +0 -6
- package/dist/web-admin-client/read-face.js +5 -9
- package/dist/web-admin-client/read-warnings.d.ts +13 -0
- package/dist/web-admin-client/read-warnings.js +10 -0
- package/dist/web-admin-client/skills-mcp.d.ts +3 -0
- package/dist/web-admin-client/skills-mcp.js +11 -9
- package/dist/web-admin-client/types.d.ts +2 -3
- package/dist/workspace-cache.d.ts +35 -0
- package/dist/workspace-cache.js +36 -0
- package/dist/workspace-space.d.ts +3 -2
- package/dist/workspace-space.js +2 -0
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +65 -10
- package/package.json +8 -4
- package/scripts/drain-check-local.mjs +34 -1
- package/scripts/drain-check.mysql.sql +30 -2
- package/scripts/drain-check.pg.sql +29 -2
- package/dist/capabilities/memory-notice.d.ts +0 -138
- package/dist/capabilities/memory-notice.js +0 -64
- package/dist/capabilities/prompt.d.ts +0 -17
- package/dist/capabilities/prompt.js +0 -6
- package/dist/mcp-content-origin.d.ts +0 -34
- package/dist/mcp-content-origin.js +0 -10
- package/dist/tool-axis-words.d.ts +0 -27
- package/dist/tool-axis-words.js +0 -9
- package/dist/wire-name-bound.d.ts +0 -14
- package/dist/wire-name-bound.js +0 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { timingSafeEqual } from "node:crypto";
|
|
2
|
-
import { PRINCIPAL_TOKEN_HEADER, verifiedPrincipal, ssoVerifiedPrincipal } from "../security.js";
|
|
2
|
+
import { PRINCIPAL_TOKEN_HEADER, verifiedPrincipal, ssoVerifiedPrincipal, ownerlessRowOpen, mintPrincipal } from "../security.js";
|
|
3
3
|
import { sendError } from "./send.js";
|
|
4
4
|
export function headerStr(v) {
|
|
5
5
|
return Array.isArray(v) ? v[0] : v;
|
|
@@ -50,7 +50,8 @@ export function verifiedIdentitySource(req, config) {
|
|
|
50
50
|
export function gatedPrincipal(req, config) {
|
|
51
51
|
if (bearerPresentedButUnverified(req, config))
|
|
52
52
|
return undefined;
|
|
53
|
-
|
|
53
|
+
const verified = verifiedPrincipal(req, config);
|
|
54
|
+
return verified === undefined ? undefined : mintPrincipal(verified);
|
|
54
55
|
}
|
|
55
56
|
export function principalTokenPresentedButUnverified(req, config) {
|
|
56
57
|
if (!config.directDoorActive)
|
|
@@ -86,29 +87,74 @@ export function sendUnauthorized(res, face) {
|
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
}
|
|
90
|
+
function sameIdentity(principal, owner) {
|
|
91
|
+
return principal === owner;
|
|
92
|
+
}
|
|
89
93
|
export function runOwnerReadable(principal, owner, config) {
|
|
90
94
|
if (owner === null)
|
|
91
95
|
return true;
|
|
92
|
-
if (principal
|
|
96
|
+
if (principal !== undefined && sameIdentity(principal, owner))
|
|
93
97
|
return true;
|
|
94
98
|
return !config.requirePrincipal && owner === "anon:shell-live" && principal === undefined;
|
|
95
99
|
}
|
|
96
|
-
export function
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
export function hasServiceAuth(config) {
|
|
101
|
+
return Boolean(config.authToken) || Object.keys(config.authTokens ?? {}).length > 0;
|
|
102
|
+
}
|
|
103
|
+
function identitySourceWired(kind, w) {
|
|
104
|
+
switch (kind) {
|
|
105
|
+
case "service_token":
|
|
106
|
+
return hasServiceAuth(w.config);
|
|
107
|
+
case "sso":
|
|
108
|
+
return w.webAdminJwtVerifier !== undefined;
|
|
109
|
+
case "direct_door_jwt":
|
|
110
|
+
return w.config.directDoorActive;
|
|
111
|
+
default: {
|
|
112
|
+
const unknownKind = kind;
|
|
113
|
+
throw new Error(`identity sources: unknown identity source ${String(unknownKind)}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
99
116
|
}
|
|
100
|
-
export function
|
|
101
|
-
return
|
|
117
|
+
export function wiredIdentitySources(w) {
|
|
118
|
+
return IDENTITY_SOURCES.filter((k) => identitySourceWired(k, w));
|
|
102
119
|
}
|
|
103
|
-
export function
|
|
104
|
-
return
|
|
120
|
+
export function devOpenDeployment(w) {
|
|
121
|
+
return wiredIdentitySources(w).length === 0 && !w.config.traceToken && !w.config.requirePrincipal;
|
|
105
122
|
}
|
|
106
|
-
export function
|
|
107
|
-
|
|
123
|
+
export function sessionCallerOf(req, w) {
|
|
124
|
+
const principal = gatedPrincipal(req, w.config);
|
|
125
|
+
return { principal, fleet: devOpenDeployment(w) || (principal === undefined && systemFor(req, w.config) !== undefined) };
|
|
126
|
+
}
|
|
127
|
+
export function sessionOwnerReadable(caller, cell, w) {
|
|
128
|
+
if (devOpenDeployment(w))
|
|
129
|
+
return true;
|
|
130
|
+
if (cell.owner === null)
|
|
131
|
+
return ownerlessRowOpen(cell, caller);
|
|
132
|
+
return runOwnerReadable(caller.principal, cell.owner, w.config);
|
|
108
133
|
}
|
|
109
|
-
export function
|
|
110
|
-
if (
|
|
134
|
+
export function explicitOperatorOk(principal, roster) {
|
|
135
|
+
if (roster.operatorSingleUser === true)
|
|
111
136
|
return true;
|
|
112
|
-
return principal !== undefined && operatorPrincipals.includes(principal);
|
|
137
|
+
return roster.operatorPrincipals.length > 0 && principal !== undefined && roster.operatorPrincipals.includes(principal);
|
|
138
|
+
}
|
|
139
|
+
export function operatorRosterPresent(roster) {
|
|
140
|
+
return roster.operatorSingleUser === true || roster.operatorPrincipals.length > 0;
|
|
141
|
+
}
|
|
142
|
+
export function buildOperatorUndeclaredNotice(config, approvalFaceWired) {
|
|
143
|
+
if (config.requirePrincipal === true || operatorRosterPresent(config) || !approvalFaceWired)
|
|
144
|
+
return undefined;
|
|
145
|
+
return {
|
|
146
|
+
event: "operator_undeclared_single_user",
|
|
147
|
+
fields: {
|
|
148
|
+
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 none) and ignore ?owner=. " +
|
|
150
|
+
"To act as this deployment's operator, add one line: OPERATOR_SINGLE_USER=true",
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
export function sendOperatorPrincipalsRequired(res) {
|
|
155
|
+
sendError(res, 501, "capability.operator_principals_required", `this endpoint is operator-only and this deployment has no operator roster (OPERATOR_PRINCIPALS is empty and OPERATOR_SINGLE_USER is not declared), so no caller can be an operator; ${buildOperatorRosterWayOut()}`);
|
|
156
|
+
}
|
|
157
|
+
export function buildOperatorRosterWayOut() {
|
|
158
|
+
return "configure OPERATOR_PRINCIPALS with the named operator principals, or — on a single-user deployment (REQUIRE_PRINCIPAL off) — declare OPERATOR_SINGLE_USER=true";
|
|
113
159
|
}
|
|
114
160
|
//# sourceMappingURL=principal-gate.js.map
|
package/dist/http/readiness.d.ts
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
import type { ServerResponse } from "node:http";
|
|
25
25
|
import type { ServingLeaseView } from "../fleet/engine-signal.js";
|
|
26
|
+
import { type RefusalBody } from "./refusal-body.js";
|
|
26
27
|
/**
|
|
27
28
|
* 就绪原因闭集,**数组序 = 优先序**:`/health.readyReason` 取首条的句、计费门取首条的拒绝码。
|
|
28
29
|
* draining 在前 —— 一台正在下线的副本「去找替补」(Retry-After 15)比「稍后重试本机」(5)更对。
|
|
@@ -86,11 +87,8 @@ export declare function admissionRefusalOf(verdict: ReadinessVerdict, lease: Ser
|
|
|
86
87
|
* `{status, body}` 的赎回席只取体(它的路由刻意不带头,见 `approval-sweeps.ts` 该臂注)。 */
|
|
87
88
|
export interface BillableRefusal {
|
|
88
89
|
readonly status: 503;
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
readonly errorCode: string;
|
|
92
|
-
readonly message: string;
|
|
93
|
-
};
|
|
90
|
+
/** `error` 是冻结的词(`draining` / `model_roster_pending` / `lease_expired`),`message` 是给人读的句子(机读事实里的一键)。 */
|
|
91
|
+
readonly body: RefusalBody;
|
|
94
92
|
readonly retryAfterSec: 15 | 5 | 60;
|
|
95
93
|
}
|
|
96
94
|
/**
|
|
@@ -100,6 +98,14 @@ export interface BillableRefusal {
|
|
|
100
98
|
* 停机因由声明口一起退役(排空口的体改成契约 `DrainRequest`,没有因由字段);`lease_expired` 一臂新增。
|
|
101
99
|
*/
|
|
102
100
|
export declare function billableRefusalOf(reason: AdmissionRefusal): BillableRefusal;
|
|
101
|
+
/**
|
|
102
|
+
* 订阅面终帧要的 `{ errorCode, message }` —— 与提交面 503 体**同一只铸点**的产物:`errorCode` 是体的码,`message` 是体里 `message` 键的那句话(`error` 是冻结的词,
|
|
103
|
+
* 句子在 `message`)。从体里读,不另抄一份;体里没有那句话是铸点坏了 ⇒ 响亮抛(不静默发一帧没有句子的终帧)。
|
|
104
|
+
*/
|
|
105
|
+
export declare function billableRefusalFrame(refusal: BillableRefusal): {
|
|
106
|
+
readonly errorCode: string;
|
|
107
|
+
readonly message: string;
|
|
108
|
+
};
|
|
103
109
|
/** 发送形:`Retry-After` + 体(`dispatch.ts` 的 billable 门与 a2a `message/send` 同调)。走 `sendError` —— errorCode
|
|
104
110
|
* 是它的必填位置参(对抗复审 #3:修前这里是 `sendJson(res, r.status, r.body)`,与 leader 口的豁免行逐字同文,
|
|
105
111
|
* 在 error-code-key-gate 上借了别人的豁免过门);体键序与修前逐字同(`error, errorCode, message, reason?`)。 */
|
package/dist/http/readiness.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { sendJson, sendError } from "./send.js";
|
|
2
|
+
import { refusalBody } from "./refusal-body.js";
|
|
2
3
|
export const READINESS_REASONS = ["draining", "model_roster_pending"];
|
|
3
4
|
export function readinessOf(deps) {
|
|
4
5
|
const [first, ...rest] = READINESS_REASONS.filter((r) => holds(r, deps));
|
|
@@ -60,17 +61,23 @@ export function admissionRefusalOf(verdict, lease, kind) {
|
|
|
60
61
|
export function billableRefusalOf(reason) {
|
|
61
62
|
switch (reason) {
|
|
62
63
|
case "draining":
|
|
63
|
-
return { status: 503, body: {
|
|
64
|
+
return { status: 503, body: refusalBody({ errorCode: "draining", message: "draining", facts: { message: "this instance is draining for shutdown/upgrade — retry against the replacement instance" } }), retryAfterSec: 15 };
|
|
64
65
|
case "model_roster_pending":
|
|
65
|
-
return { status: 503, body: {
|
|
66
|
+
return { status: 503, body: refusalBody({ errorCode: "state.model_roster_pending", message: "model_roster_pending", facts: { message: "this worker has no model yet (waiting for the first effective-config pull to land the roster) — retry shortly" } }), retryAfterSec: 5 };
|
|
66
67
|
case "lease_expired":
|
|
67
|
-
return { status: 503, body: {
|
|
68
|
+
return { status: 503, body: refusalBody({ errorCode: "state.lease_expired", message: "lease_expired", facts: { message: "this instance has not renewed its serving lease with the fleet center for longer than its outage limit — it takes no new work; cancel, approvals, resume and reads stay open here — retry new work against another instance" } }), retryAfterSec: 60 };
|
|
68
69
|
default: {
|
|
69
70
|
const unhandled = reason;
|
|
70
71
|
throw new Error(`admission refusal without a billable refusal: ${String(unhandled)}`);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
}
|
|
75
|
+
export function billableRefusalFrame(refusal) {
|
|
76
|
+
const message = refusal.body["message"];
|
|
77
|
+
if (typeof message !== "string")
|
|
78
|
+
throw new Error(`billable refusal body without its message sentence: ${refusal.body.errorCode}`);
|
|
79
|
+
return { errorCode: refusal.body.errorCode, message };
|
|
80
|
+
}
|
|
74
81
|
export function sendBillableRefusal(res, refusal) {
|
|
75
82
|
const { error, errorCode, ...extra } = refusal.body;
|
|
76
83
|
res.setHeader("retry-after", String(refusal.retryAfterSec));
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **全仓唯一的拒体组句器**(零依赖叶子模块 —— `http/checkpoint-ctx.ts` 的续跑折叠也读它,而那个模块经编译产物进随包排空脚本,闭包只许 node 内建 / 引擎包根)。
|
|
3
|
+
*
|
|
4
|
+
* 一只拒 = 三件事:机读码、给人读的句子、拒的机读事实(`field` / `reason` / `count` / `cap` / `detail` …;缺席 = 没有可机读的事实)。
|
|
5
|
+
* 拒体 = `{ error, errorCode, ...facts }`(机读事实原样随体、排在最后)。整面拒(`http/send.ts` 的 `sendError` / `sendHttpError`)、把同一只拒当**数据**带进 200 体的面板
|
|
6
|
+
* (`GET /v1/sessions/:id/mcp` 的 `scenarioRefusal`)、续跑把一只拒折成 409 的 `resume_blocked_by_policy`(`http/checkpoint-ctx.ts`)读的都是它 —— 同一只拒在几处渲出的成员逐字同。
|
|
7
|
+
* 判据只交这份数据,不自己拼体。
|
|
8
|
+
*/
|
|
9
|
+
export interface Refusal {
|
|
10
|
+
readonly errorCode: string;
|
|
11
|
+
readonly message: string;
|
|
12
|
+
readonly facts?: Readonly<Record<string, unknown>>;
|
|
13
|
+
}
|
|
14
|
+
/** {@link refusalBody} 的产物形:`error` + `errorCode` 恒在,机读事实随后。 */
|
|
15
|
+
export type RefusalBody = {
|
|
16
|
+
readonly error: string;
|
|
17
|
+
readonly errorCode: string;
|
|
18
|
+
} & Record<string, unknown>;
|
|
19
|
+
/** 拒体:`{ error, errorCode, ...facts }`。 */
|
|
20
|
+
export declare function refusalBody(r: Refusal): RefusalBody;
|
|
21
|
+
//# sourceMappingURL=refusal-body.d.ts.map
|
|
@@ -4,21 +4,52 @@
|
|
|
4
4
|
* ctx 字段 1 只(`deps`):本族对外围的耦合就这一格,它也是这一族的可测性读数。
|
|
5
5
|
*/
|
|
6
6
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
7
|
+
import { type SessionOwnerCell } from "../security.js";
|
|
8
|
+
import { type RefusalBody } from "./refusal-body.js";
|
|
7
9
|
import type { FlatServiceDeps } from "./server.js";
|
|
8
10
|
import type { LeaseRefusalAdmission } from "../fleet-lease.js";
|
|
9
11
|
import { type QuotaDecision } from "../observability/cost-quota.js";
|
|
12
|
+
import { type SqlWallSource, type SqlWallsReading } from "../plugins/sql-driver.js";
|
|
13
|
+
/**
|
|
14
|
+
* 受理口对一份提交体的库墙判决:被哪一堵墙拒、量到多少、门限多少。提交体要整只落进库 —— 会话日志的用户消息、durable 审批部署上的续跑输入 ——
|
|
15
|
+
* 所以每堵墙各量各的、**量的是店真正发出去的东西**,`null` 的墙不参与(PG 两堵都是 `null`;InnoDB 的行墙是 `null`、包墙在;TiDB 两堵都在):
|
|
16
|
+
* · `row` —— 行里存的是体的**原字节**(不转义):体的 JSON 字节 ≤ `rowWallPayloadBytes(行墙, "json")`(行墙 − JSON 行的行内余量);
|
|
17
|
+
* · `packet` —— 体经 mysql2 以一只字符串字面进语句,`" ' \` 与控制字符各多一个反斜杠字节:**转义后的语句字节**
|
|
18
|
+
* (`escapedStatementBytes`,镜像被钉在 mysql2 自己的 `escape` 上)≤ `packetWallStatementBytes(包墙)`(包墙 − 语句余量)。提交体按原样进语句、
|
|
19
|
+
* 没有 blob 十六进制字面的 2× 膨胀,所以不折半;但引号 / 反斜杠密集的体会比自己的字节数长(至多 2×),这正是不能量原字节的原因。
|
|
20
|
+
* 两腿的折算与 SQL 快照 blob 的缺省帽读同一份(`plugins/sql-driver.ts`,余量各只在那里定义一次)。两腿都拒时报行墙那条(行墙句逐字沿用)。
|
|
21
|
+
* 入参是**已判好的墙**(`sql-driver.ts` `sqlWallsOf` —— 事实缺席时的落点只在那里定义,与 blob 帽同一只判官、同一个方向);本函数不读事实、不判缺席,
|
|
22
|
+
* 墙从哪来(`sources` 里**被拒的那一堵**的出处)原样带进判决(`wallSource`),拒句按它分两形:库报的墙点名库的上限与旋钮,假定的墙(事实还没建立,或事实在场但这一堵读失败、退了文档缺省)只说「库的这个上限没读到、按最保守的墙拒」。
|
|
23
|
+
*
|
|
24
|
+
* 🔴 **包墙腿是同一只规则的提前一跑,不是第二套规则**(S-1746 主会话裁定):包墙是物理连接的事实(会话值,连接建立时从全局拷一份、此后不变),
|
|
25
|
+
* 终判在将要执行写入的那条连接上 —— 那是库自己(续跑输入那一笔被拒 ⇒ 店的带码拒 ⇒ 同一个 413;会话日志那一笔走它既有的失败面);SQL 快照 blob 则由
|
|
26
|
+
* `blob-backend.ts` 经 `connectJudged` 在写入连接上判。受理时手里没有那条连接,判官 `sqlWallsOf` 读的 `facts` 是池里**最近一次初始化**的那条连接的读数
|
|
27
|
+
* (`SqlDriver.facts`:池见过的最新读数,只在有连接初始化时才更新),同一个折算 `packetWallStatementBytes`:拒 ⇒ 413 在任何副作用之前;收 ⇒ 写入那条连接上的判决仍是终判。
|
|
28
|
+
* 这个读数是**缓存**,DBA 调了全局值之后、下一条连接初始化之前,它与库此刻的值两个方向都可能不一致:调大 ⇒ 受理口仍按旧的小值拒(新墙本装得下的体也 413,
|
|
29
|
+
* 直到有连接按新值初始化 —— 快照 blob 的旧连接自换就会带来一条);调小 ⇒ 受理口按旧的大值放行,写入那条连接上的库再拒(续跑输入那一笔 = 同一个 413)。
|
|
30
|
+
* 两堵墙都不存在(PG / 没有 SQL 后端)⇒ `null`。一堵墙「够不着」(行墙门限 ≥ 请求体上限;包墙门限 ≥ 请求体上限的 2×,即转义上界也到不了)时那一腿不量,
|
|
31
|
+
* 两腿都够不着就连 `JSON.stringify` 都不调 —— 默认的 PG / MySQL 8(包墙 64 MiB)/ 无 SQL 后端部署零额外开销。
|
|
32
|
+
* 受理口(`admission.ts` `prepareSpec`)按它答 413 `request.payload_too_large`,句子按 `by` × `wallSource` 点名真正拒绝的那堵墙;两位都是闭集,加一臂 = 编译红。
|
|
33
|
+
*/
|
|
34
|
+
export interface SubmitBodyRefusal {
|
|
35
|
+
readonly by: "row" | "packet";
|
|
36
|
+
/** 这一腿量到的字节:`row` = 体的 JSON 字节;`packet` = 转义后的语句字节。 */
|
|
37
|
+
readonly bytes: number;
|
|
38
|
+
/** 这一腿的门限(同单位)。 */
|
|
39
|
+
readonly limitBytes: number;
|
|
40
|
+
/** 拒它的那堵墙(`maxRowBytes` / `maxPacketBytes`),进句子。 */
|
|
41
|
+
readonly wallBytes: number;
|
|
42
|
+
/** 拒它的那堵墙从哪来(`sqlWallsOf` 读数 `sources` 里同一堵的出处;上 wire 为拒体的 `wallSource`):`reported` = 库自己报的;`assumed` = 不是库报的(事实还没建立,或这一堵读失败、退了文档缺省)。 */
|
|
43
|
+
readonly wallSource: SqlWallSource;
|
|
44
|
+
}
|
|
45
|
+
export declare function refuseSubmitBody(walls: SqlWallsReading, body: unknown): SubmitBodyRefusal | null;
|
|
10
46
|
/**
|
|
11
47
|
* S-866 ③ —— 租约拒绝的应答形({@link leaseRefusalOf} 的产物;`{status, body}` 交回形 + 镜像头用的 `retryAfterSec`)。
|
|
12
|
-
*
|
|
48
|
+
* 体经唯一组句器铸(键序 `error, errorCode, …机读位`;冻结门 `FROZEN_RESULT_BODY` 读 `refusalBody({ errorCode, message, … })` 这一形)。
|
|
13
49
|
*/
|
|
14
50
|
export interface LeaseRefusal {
|
|
15
51
|
readonly status: 429 | 503;
|
|
16
|
-
readonly body:
|
|
17
|
-
readonly error: string;
|
|
18
|
-
readonly errorCode: string;
|
|
19
|
-
readonly retryAfterSec: number;
|
|
20
|
-
readonly [extra: string]: unknown;
|
|
21
|
-
};
|
|
52
|
+
readonly body: RefusalBody;
|
|
22
53
|
readonly retryAfterSec: number;
|
|
23
54
|
}
|
|
24
55
|
/**
|
|
@@ -33,20 +64,13 @@ export interface LeaseRefusal {
|
|
|
33
64
|
export declare function leaseRefusalOf(adm: LeaseRefusalAdmission): LeaseRefusal;
|
|
34
65
|
/**
|
|
35
66
|
* 成本配额越顶 → 429 `limit.cost_quota_exceeded` 的**唯一**体铸点(三只门同调:路由门 `quotaExceeded`、属主门
|
|
36
|
-
* `ownerCostQuotaDenied`、赎回席 `approval-sweeps.ts`;修前三份手抄)
|
|
37
|
-
* `FROZEN_RESULT_BODY`
|
|
67
|
+
* `ownerCostQuotaDenied`、赎回席 `approval-sweeps.ts`;修前三份手抄)。体经唯一组句器铸(键序 `error, errorCode, …机读位`;冻结门
|
|
68
|
+
* `FROZEN_RESULT_BODY` 读 `refusalBody({ errorCode, message, … })` 这一形)。`retryAfterSec` 与 `windowResetsAt` 同源于决策的 `windowEndsAtMs`
|
|
38
69
|
* (同一次读钟),`Retry-After` 头由各发送点从体里的 `retryAfterSec` 镜像。
|
|
39
70
|
*/
|
|
40
71
|
export declare function costQuotaRefusalOf(d: QuotaDecision): {
|
|
41
72
|
status: 429;
|
|
42
|
-
body:
|
|
43
|
-
error: string;
|
|
44
|
-
errorCode: string;
|
|
45
|
-
usedMicroUsd: number;
|
|
46
|
-
limitMicroUsd: number;
|
|
47
|
-
retryAfterSec: number;
|
|
48
|
-
windowResetsAt: string;
|
|
49
|
-
};
|
|
73
|
+
body: RefusalBody;
|
|
50
74
|
};
|
|
51
75
|
export declare function createRequestGuards(ctx: {
|
|
52
76
|
deps: FlatServiceDeps;
|
|
@@ -65,11 +89,7 @@ export declare function createRequestGuards(ctx: {
|
|
|
65
89
|
leaseDenied: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
66
90
|
usageWindowDenialFor: (key: string) => Promise<{
|
|
67
91
|
status: number;
|
|
68
|
-
body:
|
|
69
|
-
error: string;
|
|
70
|
-
errorCode: string;
|
|
71
|
-
retryAfterSec: number;
|
|
72
|
-
};
|
|
92
|
+
body: RefusalBody;
|
|
73
93
|
retryAfterSec: number;
|
|
74
94
|
} | undefined>;
|
|
75
95
|
usageWindowDenied: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
|
|
@@ -85,7 +105,7 @@ export declare function createRequestGuards(ctx: {
|
|
|
85
105
|
gateOwner: string | null;
|
|
86
106
|
};
|
|
87
107
|
runOwnerOk: (req: IncomingMessage, res: ServerResponse, owner: string | null) => boolean;
|
|
88
|
-
sessionOwnerOk: (req: IncomingMessage, res: ServerResponse,
|
|
108
|
+
sessionOwnerOk: (req: IncomingMessage, res: ServerResponse, cell: SessionOwnerCell) => boolean;
|
|
89
109
|
runSessionAcceptOk: (req: IncomingMessage, res: ServerResponse, run: {
|
|
90
110
|
sessionId: string | null;
|
|
91
111
|
}, face: string, notFoundError?: string) => boolean;
|
|
@@ -1,18 +1,46 @@
|
|
|
1
1
|
import { GLOBAL_USAGE_KEY, usageRetryAfterMs } from "@sema-agent/core";
|
|
2
|
-
import {
|
|
2
|
+
import { createCodedHttpError, principalFrom } from "../security.js";
|
|
3
3
|
import { RUN_NOT_FOUND_MESSAGE, SESSION_NOT_FOUND_MESSAGE } from "./route-ctx.js";
|
|
4
|
-
import { sendError } from "./send.js";
|
|
5
|
-
import {
|
|
4
|
+
import { invalidJsonError, sendError } from "./send.js";
|
|
5
|
+
import { refusalBody } from "./refusal-body.js";
|
|
6
|
+
import { limitFactsUnmeasured } from "../limit-refusal.js";
|
|
7
|
+
import { authorized, systemFor, gatedPrincipal, explicitOperatorOk, sessionOwnerReadable, sessionCallerOf, devOpenDeployment, sendPrincipalRefusal } from "./principal-gate.js";
|
|
8
|
+
import { runRowReadable } from "./owner-access.js";
|
|
6
9
|
import { quotaWindowResetsAt } from "../observability/cost-quota.js";
|
|
10
|
+
import { escapedStatementBytes, packetWallStatementBytes, rowWallPayloadBytes } from "../plugins/sql-driver.js";
|
|
7
11
|
const MAX_BODY = 8 * 1024 * 1024;
|
|
12
|
+
export function refuseSubmitBody(walls, body) {
|
|
13
|
+
const rowWall = walls.maxRowBytes;
|
|
14
|
+
const packetWall = walls.maxPacketBytes;
|
|
15
|
+
const row = rowWall === null ? null : { wallBytes: rowWall, limitBytes: rowWallPayloadBytes(rowWall, "json") };
|
|
16
|
+
const packet = packetWall === null ? null : { wallBytes: packetWall, limitBytes: packetWallStatementBytes(packetWall) };
|
|
17
|
+
const liveRow = row !== null && row.limitBytes < MAX_BODY ? row : null;
|
|
18
|
+
const livePacket = packet !== null && packet.limitBytes < 2 * MAX_BODY ? packet : null;
|
|
19
|
+
if (liveRow === null && livePacket === null)
|
|
20
|
+
return null;
|
|
21
|
+
const json = JSON.stringify(body);
|
|
22
|
+
const jsonBytes = Buffer.byteLength(json, "utf8");
|
|
23
|
+
if (liveRow !== null && jsonBytes > liveRow.limitBytes)
|
|
24
|
+
return { by: "row", bytes: jsonBytes, ...liveRow, wallSource: walls.sources.maxRowBytes };
|
|
25
|
+
if (livePacket !== null && jsonBytes * 2 > livePacket.limitBytes) {
|
|
26
|
+
const sentBytes = escapedStatementBytes(json);
|
|
27
|
+
if (sentBytes > livePacket.limitBytes)
|
|
28
|
+
return { by: "packet", bytes: sentBytes, ...livePacket, wallSource: walls.sources.maxPacketBytes };
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
8
32
|
export function leaseRefusalOf(adm) {
|
|
9
33
|
switch (adm.reason) {
|
|
10
34
|
case "budget_exhausted":
|
|
11
|
-
return { status: 429, body: {
|
|
35
|
+
return { status: 429, body: refusalBody({ errorCode: "quota_exhausted", message: "budget exhausted (quota lease)", facts: { retryAfterSec: adm.retryAfterSec, ...(adm.detail ?? {}) } }), retryAfterSec: adm.retryAfterSec };
|
|
12
36
|
case "lease_unavailable":
|
|
13
37
|
return {
|
|
14
38
|
status: 503,
|
|
15
|
-
body: {
|
|
39
|
+
body: refusalBody({
|
|
40
|
+
errorCode: "fleet.lease_unavailable",
|
|
41
|
+
message: "quota lease unavailable — this deployment enforces budgets fail-closed and could not confirm this caller's budget with the quota center, so nothing was run; retry after retryAfterSec seconds",
|
|
42
|
+
facts: { reason: adm.cause, retryAfterSec: adm.retryAfterSec },
|
|
43
|
+
}),
|
|
16
44
|
retryAfterSec: adm.retryAfterSec,
|
|
17
45
|
};
|
|
18
46
|
default: {
|
|
@@ -24,9 +52,16 @@ export function leaseRefusalOf(adm) {
|
|
|
24
52
|
export function costQuotaRefusalOf(d) {
|
|
25
53
|
return {
|
|
26
54
|
status: 429,
|
|
27
|
-
body: {
|
|
55
|
+
body: refusalBody({
|
|
56
|
+
errorCode: "limit.cost_quota_exceeded",
|
|
57
|
+
message: "cost quota exceeded",
|
|
58
|
+
facts: { usedMicroUsd: d.usedMicroUsd, limitMicroUsd: d.limitMicroUsd, retryAfterSec: d.retryAfterSec, windowResetsAt: quotaWindowResetsAt(d) },
|
|
59
|
+
}),
|
|
28
60
|
};
|
|
29
61
|
}
|
|
62
|
+
function bodyTooLargeError(message, cap) {
|
|
63
|
+
return createCodedHttpError(413, "request.payload_too_large", message, limitFactsUnmeasured("body", "bytes", cap));
|
|
64
|
+
}
|
|
30
65
|
function sendLeaseRefusal(res, refusal) {
|
|
31
66
|
const { error, errorCode, ...extra } = refusal.body;
|
|
32
67
|
res.setHeader("retry-after", String(refusal.retryAfterSec));
|
|
@@ -46,7 +81,7 @@ export function createRequestGuards(ctx) {
|
|
|
46
81
|
deps.metrics?.inc("cost_quota_rejected_total");
|
|
47
82
|
const { status, body } = costQuotaRefusalOf(d);
|
|
48
83
|
const { error, errorCode, ...extra } = body;
|
|
49
|
-
res.setHeader("retry-after", String(
|
|
84
|
+
res.setHeader("retry-after", String(d.retryAfterSec));
|
|
50
85
|
sendError(res, status, errorCode, error, extra);
|
|
51
86
|
return true;
|
|
52
87
|
}
|
|
@@ -119,7 +154,7 @@ export function createRequestGuards(ctx) {
|
|
|
119
154
|
deps.metrics?.inc("usage_window_rejected_total");
|
|
120
155
|
deps.logger?.info?.("usage_window_exhausted", { hasPrincipal: key !== GLOBAL_USAGE_KEY, retryAfterMs });
|
|
121
156
|
const retryAfterSec = Math.max(1, Math.ceil(retryAfterMs / 1000));
|
|
122
|
-
return { status: 429, body: {
|
|
157
|
+
return { status: 429, body: refusalBody({ errorCode: "usage.window_exhausted", message: "usage window exhausted (deployment token governance)", facts: { retryAfterSec } }), retryAfterSec };
|
|
123
158
|
}
|
|
124
159
|
async function usageWindowDenied(req, res) {
|
|
125
160
|
const denial = await usageWindowDenialFor(gatedPrincipal(req, deps.config) || GLOBAL_USAGE_KEY);
|
|
@@ -151,7 +186,7 @@ export function createRequestGuards(ctx) {
|
|
|
151
186
|
}
|
|
152
187
|
function isFleetWide(req) {
|
|
153
188
|
const tt = deps.config.traceToken;
|
|
154
|
-
return devOpenDeployment(deps
|
|
189
|
+
return devOpenDeployment(deps) || systemFor(req, deps.config) !== undefined || (!!tt && authorized(req, tt));
|
|
155
190
|
}
|
|
156
191
|
function sessionOwnerScope(req) {
|
|
157
192
|
const fleetWide = isFleetWide(req);
|
|
@@ -159,7 +194,7 @@ export function createRequestGuards(ctx) {
|
|
|
159
194
|
return { fleetWide, gateOwner };
|
|
160
195
|
}
|
|
161
196
|
function sessionOwnerScopeForWrite(req) {
|
|
162
|
-
const fleetWide = devOpenDeployment(deps
|
|
197
|
+
const fleetWide = devOpenDeployment(deps) || systemFor(req, deps.config) !== undefined;
|
|
163
198
|
const gateOwner = fleetWide ? null : (gatedPrincipal(req, deps.config) || null);
|
|
164
199
|
return { fleetWide, gateOwner };
|
|
165
200
|
}
|
|
@@ -176,10 +211,11 @@ export function createRequestGuards(ctx) {
|
|
|
176
211
|
return true;
|
|
177
212
|
}
|
|
178
213
|
function runOwnerOk(req, res, owner) {
|
|
179
|
-
return ownerGate(req, res, (principal) =>
|
|
214
|
+
return ownerGate(req, res, (principal) => runRowReadable(deps.config, principal, owner, "owner"), () => sendError(res, 404, "not_found.run", RUN_NOT_FOUND_MESSAGE));
|
|
180
215
|
}
|
|
181
|
-
function sessionOwnerOk(req, res,
|
|
182
|
-
|
|
216
|
+
function sessionOwnerOk(req, res, cell) {
|
|
217
|
+
const caller = sessionCallerOf(req, deps);
|
|
218
|
+
return ownerGate(req, res, () => sessionOwnerReadable(caller, cell, deps), () => sendError(res, 404, "not_found.session", SESSION_NOT_FOUND_MESSAGE));
|
|
183
219
|
}
|
|
184
220
|
const sessionAssertAbsentWarned = new Set();
|
|
185
221
|
function runSessionAcceptOk(req, res, run, face, notFoundError = RUN_NOT_FOUND_MESSAGE) {
|
|
@@ -195,7 +231,7 @@ export function createRequestGuards(ctx) {
|
|
|
195
231
|
}
|
|
196
232
|
if (asserted === run.sessionId)
|
|
197
233
|
return true;
|
|
198
|
-
if (explicitOperatorOk(gatedPrincipal(req, deps.config), deps.config
|
|
234
|
+
if (explicitOperatorOk(gatedPrincipal(req, deps.config), deps.config))
|
|
199
235
|
return true;
|
|
200
236
|
sendError(res, 404, "not_found.run", notFoundError);
|
|
201
237
|
return false;
|
|
@@ -206,7 +242,7 @@ export function createRequestGuards(ctx) {
|
|
|
206
242
|
for await (const c of req) {
|
|
207
243
|
size += c.length;
|
|
208
244
|
if (size > MAX_BODY)
|
|
209
|
-
throw
|
|
245
|
+
throw bodyTooLargeError("request body too large", MAX_BODY);
|
|
210
246
|
chunks.push(c);
|
|
211
247
|
}
|
|
212
248
|
if (chunks.length === 0)
|
|
@@ -215,7 +251,7 @@ export function createRequestGuards(ctx) {
|
|
|
215
251
|
return JSON.parse(Buffer.concat(chunks).toString("utf8")) ?? {};
|
|
216
252
|
}
|
|
217
253
|
catch {
|
|
218
|
-
throw
|
|
254
|
+
throw invalidJsonError("not_json");
|
|
219
255
|
}
|
|
220
256
|
}
|
|
221
257
|
async function readRawBody(req, max) {
|
|
@@ -224,7 +260,7 @@ export function createRequestGuards(ctx) {
|
|
|
224
260
|
for await (const c of req) {
|
|
225
261
|
size += c.length;
|
|
226
262
|
if (size > max)
|
|
227
|
-
throw
|
|
263
|
+
throw bodyTooLargeError("blob too large", max);
|
|
228
264
|
chunks.push(c);
|
|
229
265
|
}
|
|
230
266
|
return Buffer.concat(chunks);
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* 恰好没折码,把列错误漏了出来 = 巧合式正确)。两条车道现在同一份拒绝契约,本口只认它。
|
|
24
24
|
*/
|
|
25
25
|
import type { CheckpointCtx } from "./route-ctx.js";
|
|
26
|
+
import { type RefusalBody } from "./refusal-body.js";
|
|
26
27
|
export type ResumeCtxRead = {
|
|
27
28
|
readonly kind: "ok";
|
|
28
29
|
readonly ctx: CheckpointCtx;
|
|
@@ -37,10 +38,6 @@ export declare function readResumeCtx(load: Promise<CheckpointCtx | null>): Prom
|
|
|
37
38
|
* 文案只说「哪一行读不出来 + 该找谁」,不把店层 detail 拼上 wire(内部机件不上 wire,S-376 同律)。 */
|
|
38
39
|
export declare function resumeCtxCorruptAnswer(where: string): {
|
|
39
40
|
status: number;
|
|
40
|
-
body:
|
|
41
|
-
error: string;
|
|
42
|
-
errorCode: string;
|
|
43
|
-
where: string;
|
|
44
|
-
};
|
|
41
|
+
body: RefusalBody;
|
|
45
42
|
};
|
|
46
43
|
//# sourceMappingURL=resume-ctx-read.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SqlJsonColumnError, StoreCorruptError } from "../plugins/sql-json-column.js";
|
|
2
|
+
import { refusalBody } from "./refusal-body.js";
|
|
2
3
|
export async function readResumeCtx(load) {
|
|
3
4
|
try {
|
|
4
5
|
const ctx = await load;
|
|
@@ -15,11 +16,13 @@ export async function readResumeCtx(load) {
|
|
|
15
16
|
export function resumeCtxCorruptAnswer(where) {
|
|
16
17
|
return {
|
|
17
18
|
status: 500,
|
|
18
|
-
body: {
|
|
19
|
-
error: "the stored resume context for this session cannot be read — nothing was decided and nothing was resumed. Ask whoever operates this deployment to look at the row named in `where`: it has to be repaired or removed before this session can resume.",
|
|
19
|
+
body: refusalBody({
|
|
20
20
|
errorCode: "corrupt",
|
|
21
|
-
where,
|
|
22
|
-
|
|
21
|
+
message: "the stored resume context for this session cannot be read — nothing was decided and nothing was resumed. Ask whoever operates this deployment to look at the row named in `where`: it has to be repaired or removed before this session can resume.",
|
|
22
|
+
facts: {
|
|
23
|
+
where,
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
23
26
|
};
|
|
24
27
|
}
|
|
25
28
|
//# sourceMappingURL=resume-ctx-read.js.map
|
|
@@ -17,17 +17,41 @@ import type { DecideBinding } from "./wire-types.js";
|
|
|
17
17
|
import type { CheckpointStoreFull } from "../plugins/store-backend.js";
|
|
18
18
|
import type { HostDecision } from "../host-decision.js";
|
|
19
19
|
import { type PlanApprovePermissionModeAfter } from "../task-settings.js";
|
|
20
|
-
import type { RouteCtxBase, DriveResumeArgs, HostLegOutcome, PreparedPlanReview, ResumeLegOutcome } from "./route-ctx.js";
|
|
21
|
-
import { type TrustedRunInternals } from "./durable-run-leg.js";
|
|
20
|
+
import type { RouteCtxBase, DriveResumeArgs, HostLegOutcome, PreparedPlanReview, ResumeLegOutcome, WorkflowDecisionDelivery } from "./route-ctx.js";
|
|
22
21
|
import type { RunRegistry, RouteHelpers, RouteLegs } from "./route-ctx.js";
|
|
23
22
|
import type { createRequestGuards } from "./request-guards.js";
|
|
24
23
|
import type { FlatServiceDeps } from "./server.js";
|
|
24
|
+
import { type ResumeRefusalAnswer } from "./checkpoint-ctx.js";
|
|
25
25
|
/**
|
|
26
26
|
* 🔴 **一次 `CheckpointError` 拒的处置 —— 唯一读口**:{@link CHECKPOINT_ERROR_DISPOSITION} 的读法(doctrine 在那张表头)。resume 腿的 catch 臂只调它一次,
|
|
27
27
|
* 行的落点与 wire 的 `retriable` 都读这一个结果。纯函数,钉直接调。运行期遇到表外的码(装树 core 比本二进制多一个码的版本偏斜 —— 型面上拼不出来)
|
|
28
28
|
* ⇒ `"terminal"`:与 `by_reason` 认不得的词同一条 fail-closed 方向(不宽容默认成可重试),也与修前手列串的缺省逐字相同。
|
|
29
29
|
*/
|
|
30
30
|
export declare function resumeRefusalDisposition(e: CheckpointError): "cancelled" | "retriable" | "terminal";
|
|
31
|
+
/**
|
|
32
|
+
* 🔴 **引擎拒一次续跑(`CheckpointError`)的 HTTP 答复 —— 唯一组句器**(S-1690 / S-1692,core 7.52.0;五条续跑腿〔`/decide` · `/resume` · `/wake` · `plan_review` ·
|
|
33
|
+
* workflow 决定在宿主会话上起的新一跑〕同经 `driveResumeLeg` 的 catch 臂到这里,SLA 拒扫腿与 PARKED 赎回席经 `resumeCheckpoint` 同得)。
|
|
34
|
+
*
|
|
35
|
+
* 规则(一条):**一次拒 = 一个答复形,与「谁发现的」无关**。引擎在认领前 / CAS 前拒的,与本服务在重放存量体之前自己拒的(`resume_blocked_by_policy`,
|
|
36
|
+
* `checkpoint-ctx.ts` `resumeBlockedByPolicyAnswer`;续跑入口上卡仍 pending ⇒ 同样带 `retriable:true`)读同一组机读键;体经拒体组句器 `refusalBody` 铸,
|
|
37
|
+
* `retriable` 经续跑家族的唯一写点 `resumeRefusalWithCard` 追加。
|
|
38
|
+
* 一处如实例外:后台停驻子代的 parked 赎回不经本函数 —— 引擎的赎回回执只交成因词,`parked-decide.ts` 答 `422 parked_resume.startup_failed`,体只带 `cause`:
|
|
39
|
+
* · `errorCode` —— 引擎码的原码镜像(`checkpoint.invalid_outcome` 按决断成因改铸,{@link decisionRefusalCauseOf});
|
|
40
|
+
* · 引擎 `detail` 的三个机读判别位原样过境,键名与 `resume_blocked_by_policy` 同义:`detail.code` ⇒ `blockedBy`(挡住它的准入码 = 同一份坏配置在新跑上报的 `errorCode`;
|
|
41
|
+
* 今天只有 `checkpoint.config_refused` 带它)· `detail.field` ⇒ `field`(哪一侧 / 哪一格)· `detail.reason` ⇒ `reason`(同码多臂时哪一臂,闭集 `CheckpointErrorReason`)。
|
|
42
|
+
* 缺席不造键(引擎没给就是没给)。`detail` 的其余成员(`requires` / `differs`)不在这组判别位里,不上 wire;`retryAfterMs` 折成族口径的 `retryAfterSec`(下面);
|
|
43
|
+
* · `retriable` —— 只在处置读口答 `retriable` 时在场(卡仍 pending、行重新 park;**不是**「原样重试会成功」—— 契约附录 A.1 注那一个意思,壳按它决定卡还挂不挂着)。
|
|
44
|
+
* 出路(改那一格再决 / 只能在停它的那一版 worker 上跑完或取消 / 等一会)由 `errorCode` + `field` + `blockedBy` + `reason` 与引擎的句子说;
|
|
45
|
+
* · `error` —— 引擎的句子原样(它点名条目、哪一臂与出路);本层不另铸第二句;
|
|
46
|
+
* · `taskId`(抢到行才在)/ `retryAfterSec`(两码闭集)/ 两版本键(只在 `checkpoint.unsupported_version`:调用方按那一码交 `buildCheckpointVersionKeys` 的产物,本函数原样铺)—— 键律照旧。
|
|
47
|
+
* 纯函数(钉直接调)。`retriable` 由调用方传入 —— 行的落点与 wire 的 `retriable` 读同一次求值(catch 臂一处),本函数不另判。
|
|
48
|
+
*/
|
|
49
|
+
export declare function checkpointRefusalAnswer(e: CheckpointError, at: {
|
|
50
|
+
readonly gate: string;
|
|
51
|
+
readonly retriable: boolean;
|
|
52
|
+
readonly taskId?: string;
|
|
53
|
+
readonly versionKeys: Readonly<Record<string, string>>;
|
|
54
|
+
}): ResumeRefusalAnswer;
|
|
31
55
|
export declare function createResumeLegs(ctx: {
|
|
32
56
|
deps: FlatServiceDeps;
|
|
33
57
|
runnerFor: FlatServiceDeps["runnerFor"];
|
|
@@ -56,8 +80,8 @@ export declare function createResumeLegs(ctx: {
|
|
|
56
80
|
status: number;
|
|
57
81
|
body: object;
|
|
58
82
|
}>;
|
|
59
|
-
startFreshHostTurn: (sessionId: string, objective: string, principal: string | undefined, req: IncomingMessage,
|
|
60
|
-
resumeWake: (sessionId: string, message: string | undefined, caller: string | undefined, req: IncomingMessage | undefined, acceptEarly?: boolean,
|
|
83
|
+
startFreshHostTurn: (sessionId: string, objective: string, principal: string | undefined, req: IncomingMessage, workflowDecision: WorkflowDecisionDelivery, runId: string) => Promise<HostLegOutcome>;
|
|
84
|
+
resumeWake: (sessionId: string, message: string | undefined, caller: string | undefined, req: IncomingMessage | undefined, acceptEarly?: boolean, workflowDecision?: WorkflowDecisionDelivery, ownerLeaseAdmittedFor?: string) => Promise<HostLegOutcome>;
|
|
61
85
|
preparePlanReview: (sessionId: string, log?: {
|
|
62
86
|
taskId?: string;
|
|
63
87
|
principalPresent?: boolean;
|