@sema-agent/server 7.146.0 → 7.148.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 +1423 -24
- package/README.md +21 -8
- package/README.zh-CN.md +15 -9
- package/USAGE.md +537 -216
- package/deploy/facts/lanes.json +7 -0
- package/deploy/sema-up/README.md +18 -7
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +42 -4
- package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -4
- package/deploy/sema-up/chart/templates/server.yaml +5 -4
- package/deploy/sema-up/chart/values.yaml +4 -3
- package/deploy/sema-up/cluster-up.sh +75 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/flagshape.sh +4 -0
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/lanes.json +2 -5
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +26 -48
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +18 -5
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +25 -3
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +32 -34
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +16 -14
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +17 -9
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +8 -3
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/crash-last.js +2 -1
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/device-lane.js +5 -5
- package/dist/boot/engine-lease.d.ts +12 -11
- package/dist/boot/execution-env.d.ts +19 -8
- package/dist/boot/execution-env.js +80 -62
- package/dist/boot/execution-lane.d.ts +37 -9
- package/dist/boot/execution-lane.js +74 -20
- package/dist/boot/exit-boundary.d.ts +3 -3
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/exit-last.js +2 -1
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/governance-seams.d.ts +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +18 -16
- package/dist/boot/memory-boundary.d.ts +11 -11
- package/dist/boot/memory-boundary.js +3 -3
- package/dist/boot/memory-consolidation.d.ts +50 -53
- package/dist/boot/memory-consolidation.js +11 -18
- package/dist/boot/org-memory.js +4 -3
- package/dist/boot/parked-revive-gate.d.ts +1 -1
- package/dist/boot/parked-revive-gate.js +3 -3
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +20 -17
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +133 -165
- package/dist/boot/retention-lane.d.ts +7 -45
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +17 -7
- package/dist/boot/session-faces.js +122 -96
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.d.ts +1 -1
- package/dist/boot/stage-01-config.js +14 -2
- package/dist/boot/stage-02-web-admin-pull.d.ts +2 -1
- package/dist/boot/stage-02-web-admin-pull.js +15 -8
- package/dist/boot/stage-03-store-backend.d.ts +4 -1
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +3 -1
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +9 -5
- package/dist/boot/stage-05-execution-env.js +5 -5
- package/dist/boot/stage-06-runners.d.ts +13 -15
- package/dist/boot/stage-06-runners.js +24 -18
- package/dist/boot/stage-07-capability-layer.d.ts +14 -11
- package/dist/boot/stage-07-capability-layer.js +9 -12
- package/dist/boot/stage-08-reapers.d.ts +14 -11
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +16 -18
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +16 -18
- package/dist/boot/stage-10-http-server.js +9 -5
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +12 -0
- package/dist/boot/stores.js +39 -17
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +58 -38
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +9 -1
- package/dist/capabilities/center-plugins.js +37 -11
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +3 -2
- package/dist/capabilities/composite-members.js +3 -2
- package/dist/capabilities/execution-lane.d.ts +7 -7
- package/dist/capabilities/execution-lane.js +2 -2
- package/dist/capabilities/hands-lane.d.ts +1 -1
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +38 -33
- package/dist/capabilities/scenarios.js +24 -25
- package/dist/capabilities/settings-contract.d.ts +29 -0
- package/dist/capabilities/settings-contract.js +14 -0
- package/dist/capabilities/skills.d.ts +6 -6
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +69 -4
- package/dist/capability-facts.js +77 -5
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +10 -5
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +68 -61
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +58 -4
- package/dist/config-invariants.js +104 -23
- package/dist/config-lkg.d.ts +24 -2
- package/dist/config-lkg.js +22 -9
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -108
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +215 -202
- package/dist/config.d.ts +69 -14
- package/dist/config.js +188 -96
- package/dist/degenerate-instrument.js +1 -1
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deploy-facts.js +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +51 -16
- package/dist/deployment-shape.js +31 -6
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.d.ts +7 -5
- package/dist/env-facts.js +12 -7
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-config-root.d.ts +5 -5
- package/dist/execution-config-root.js +5 -5
- package/dist/execution-env-purpose.d.ts +14 -0
- package/dist/execution-env-purpose.js +29 -0
- package/dist/execution-lane-caps.d.ts +53 -103
- package/dist/execution-lane-caps.js +51 -83
- package/dist/execution-placement.d.ts +65 -9
- package/dist/execution-placement.js +58 -0
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.d.ts +2 -2
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/drain-entry.d.ts +17 -10
- package/dist/fleet/drain-entry.js +1 -1
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +6 -7
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +42 -0
- package/dist/history-anchor.js +34 -0
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/command-spawn.d.ts +1 -4
- package/dist/hooks/command-spawn.js +0 -11
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +119 -65
- package/dist/hooks/hook-runner.js +415 -217
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +5 -8
- package/dist/http/approval-sweeps.js +55 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/checkpoint-ctx.d.ts +17 -0
- package/dist/http/checkpoint-ctx.js +6 -0
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claim-latency.d.ts +10 -0
- package/dist/http/claim-latency.js +12 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +77 -31
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +18 -12
- package/dist/http/execution-context.d.ts +18 -42
- package/dist/http/execution-context.js +11 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +7 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +3 -3
- package/dist/http/memory-store-refusal-reply.js +6 -0
- package/dist/http/owner-access.d.ts +391 -56
- package/dist/http/owner-access.js +372 -33
- package/dist/http/principal-gate.d.ts +26 -94
- package/dist/http/principal-gate.js +24 -81
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +10 -14
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +24 -24
- package/dist/http/resume-legs.js +260 -171
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/rewind-files-reply.d.ts +34 -0
- package/dist/http/rewind-files-reply.js +36 -0
- package/dist/http/route-ctx.d.ts +56 -47
- package/dist/http/route-table.js +2 -0
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +73 -88
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +23 -20
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +5 -5
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +3 -1
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +12 -20
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +70 -0
- package/dist/http/routes/projects.js +87 -0
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +50 -7
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +148 -233
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +48 -30
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.d.ts +7 -1
- package/dist/http/routes/sessions.js +177 -112
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +144 -122
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +63 -50
- package/dist/http/server.js +52 -16
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +17 -3
- package/dist/http/stored-body-replay.js +11 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +23 -13
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/instruction-source-notice.d.ts +1 -1
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-embedder-reembed.d.ts +38 -0
- package/dist/memory-embedder-reembed.js +20 -0
- package/dist/memory-incident-sink.d.ts +0 -28
- package/dist/memory-incident-sink.js +5 -0
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +31 -4
- package/dist/memory-scope.js +65 -16
- package/dist/memory-store-refusal.d.ts +20 -4
- package/dist/memory-store-refusal.js +1 -1
- package/dist/memory-sync-client.d.ts +5 -2
- package/dist/memory-sync-client.js +19 -14
- package/dist/memory-sync.js +1 -1
- package/dist/model-compat.d.ts +51 -28
- package/dist/model-compat.js +55 -23
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +46 -17
- package/dist/model-entry-refusal.js +47 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +28 -2
- package/dist/namespaced-rule-name.js +10 -1
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +75 -47
- package/dist/observability/fail-open.js +77 -47
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.d.ts +2 -0
- package/dist/observability/metrics.js +5 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/observability/secret-env-scrub.d.ts +30 -4
- package/dist/observability/secret-env-scrub.js +15 -3
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-agent-session-index.d.ts +7 -12
- package/dist/orchestration/workflow-agent-session-index.js +1 -6
- package/dist/orchestration/workflow-completion-inbox.d.ts +29 -9
- package/dist/orchestration/workflow-completion-inbox.js +65 -46
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/org-memory-admission.d.ts +5 -2
- package/dist/org-memory-admission.js +25 -10
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +100 -31
- package/dist/parked-decide.js +162 -48
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +28 -9
- package/dist/plugins/approval-ask-store-file.js +74 -18
- package/dist/plugins/approval-ask-store-memory.d.ts +17 -7
- package/dist/plugins/approval-ask-store-memory.js +35 -12
- package/dist/plugins/approval-ask-store-sql.d.ts +42 -20
- package/dist/plugins/approval-ask-store-sql.js +44 -11
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +40 -195
- package/dist/plugins/blob-backend.js +41 -234
- package/dist/plugins/caching-session-store.d.ts +22 -5
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +33 -6
- package/dist/plugins/checkpoint-index-columns.js +39 -3
- package/dist/plugins/checkpoint-store-face.d.ts +84 -11
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.d.ts +2 -2
- package/dist/plugins/device-store-sql.js +6 -10
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/execution-lane-rename-m40.d.ts +20 -0
- package/dist/plugins/execution-lane-rename-m40.js +10 -0
- package/dist/plugins/execution-placement-sql.d.ts +63 -88
- package/dist/plugins/execution-placement-sql.js +94 -54
- package/dist/plugins/file-run-store.d.ts +89 -35
- package/dist/plugins/file-run-store.js +197 -142
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +19 -10
- package/dist/plugins/imported-layer-root-retirement.js +4 -8
- package/dist/plugins/inbox-payload-column.d.ts +14 -0
- package/dist/plugins/inbox-payload-column.js +13 -0
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +63 -23
- package/dist/plugins/local-checkpoint-store.js +204 -81
- package/dist/plugins/local-data-dir-modes-m39.d.ts +48 -0
- package/dist/plugins/local-data-dir-modes-m39.js +183 -0
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +13 -0
- package/dist/plugins/local-engine-high-water.js +62 -0
- package/dist/plugins/local-session-store.d.ts +442 -143
- package/dist/plugins/local-session-store.js +941 -289
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +20 -1
- package/dist/plugins/local-task-attachment-store.js +32 -12
- package/dist/plugins/memory-embedder-fingerprint.d.ts +33 -10
- package/dist/plugins/memory-embedder-fingerprint.js +52 -12
- package/dist/plugins/memory-embedder.d.ts +1 -1
- package/dist/plugins/memory-embedder.js +11 -9
- package/dist/plugins/memory-engine-pg.d.ts +7 -5
- package/dist/plugins/memory-engine-pg.js +18 -9
- package/dist/plugins/memory-engine-sql-apply.d.ts +21 -8
- package/dist/plugins/memory-engine-sql-apply.js +7 -9
- package/dist/plugins/memory-engine-tidb.d.ts +12 -7
- package/dist/plugins/memory-engine-tidb.js +18 -10
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +325 -74
- package/dist/plugins/one-time-migrations.js +705 -230
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/owner-only-file-mode.d.ts +29 -0
- package/dist/plugins/owner-only-file-mode.js +141 -0
- package/dist/plugins/permission-rule-store-file.d.ts +11 -11
- package/dist/plugins/permission-rule-store-file.js +14 -2
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +3 -32
- package/dist/plugins/pg-pool.js +27 -11
- package/dist/plugins/release-version.d.ts +20 -0
- package/dist/plugins/release-version.js +28 -0
- package/dist/plugins/remote-env-adb.d.ts +20 -4
- package/dist/plugins/remote-env-adb.js +39 -11
- package/dist/plugins/remote-env-e2b.d.ts +19 -28
- package/dist/plugins/remote-env-e2b.js +40 -29
- package/dist/plugins/remote-env-host.d.ts +11 -10
- package/dist/plugins/remote-env-host.js +40 -27
- package/dist/plugins/remote-env-k8s.d.ts +45 -47
- package/dist/plugins/remote-env-k8s.js +122 -62
- package/dist/plugins/remote-env-local-docker.d.ts +152 -15
- package/dist/plugins/remote-env-local-docker.js +370 -75
- package/dist/plugins/remote-env-ssh.d.ts +8 -2
- package/dist/plugins/remote-env-ssh.js +26 -24
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/remote-shell.d.ts +59 -30
- package/dist/plugins/remote-shell.js +175 -62
- package/dist/plugins/retention-declaration.d.ts +37 -0
- package/dist/plugins/retention-declaration.js +9 -0
- package/dist/plugins/retention-deployment.d.ts +158 -0
- package/dist/plugins/retention-deployment.js +119 -0
- package/dist/plugins/retention-lane-store-sql.d.ts +74 -4
- package/dist/plugins/retention-lane-store-sql.js +103 -1
- package/dist/plugins/retention-sql.d.ts +29 -0
- package/dist/plugins/retention-sql.js +8 -0
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -15
- package/dist/plugins/schema-consistency.js +213 -13
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +10 -1
- package/dist/plugins/schema-ensure-legs.js +12 -2
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +98 -0
- package/dist/plugins/session-ext-table.js +134 -0
- package/dist/plugins/session-fork.d.ts +16 -2
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +20 -7
- package/dist/plugins/session-row-sql.js +16 -8
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +157 -0
- package/dist/plugins/session-store-sql.js +398 -0
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/session-workspace-cell.d.ts +2 -2
- package/dist/plugins/session-workspace-cell.js +2 -2
- package/dist/plugins/shared-memory-store-sql.d.ts +10 -69
- package/dist/plugins/shared-memory-store-sql.js +15 -14
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/snapshot-bucket-presence.js +1 -1
- package/dist/plugins/sql-driver.d.ts +24 -8
- package/dist/plugins/sql-driver.js +43 -9
- package/dist/plugins/sql-errors.d.ts +35 -5
- package/dist/plugins/sql-errors.js +55 -3
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +114 -18
- package/dist/plugins/store-backend.js +340 -87
- package/dist/plugins/store-contracts.d.ts +97 -30
- package/dist/plugins/store-contracts.js +23 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +21 -11
- package/dist/plugins/task-attachment-store.js +37 -19
- package/dist/plugins/task-list-store-sql.d.ts +1 -1
- package/dist/plugins/text-column-capacity.d.ts +21 -0
- package/dist/plugins/text-column-capacity.js +5 -0
- package/dist/plugins/tidb-pool.d.ts +3 -2
- package/dist/plugins/tidb-pool.js +42 -39
- package/dist/plugins/user-input-ledger-sql.d.ts +1 -1
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/read-face-posture.d.ts +6 -6
- package/dist/read-face-posture.js +2 -2
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/request-value-closure.d.ts +5 -5
- package/dist/request-value-closure.js +1 -1
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +46 -16
- package/dist/rules-consent.js +102 -53
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +109 -93
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +73 -44
- package/dist/runs.js +65 -43
- package/dist/runtime-caps-resolver.d.ts +36 -14
- package/dist/runtime-caps-resolver.js +31 -14
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -6
- package/dist/sealed-key-layout.js +5 -1
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +116 -26
- package/dist/security.d.ts +133 -161
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +27 -2
- package/dist/server-secret-env.d.ts +23 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/service-version.d.ts +2 -1
- package/dist/service-version.js +2 -2
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +6 -6
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +60 -10
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +29 -47
- package/dist/session-resident-background.js +77 -8
- package/dist/session-row.d.ts +3 -2
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-sync-kernel.d.ts +1 -1
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/session-workspace.d.ts +11 -2
- package/dist/session-workspace.js +5 -0
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +138 -21
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.d.ts +3 -2
- package/dist/stored-request-hooks-m20.js +21 -16
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/blob-index-sql.d.ts +148 -0
- package/dist/stores-sql/blob-index-sql.js +154 -0
- package/dist/stores-sql/checkpoint-store-sql.d.ts +34 -29
- package/dist/stores-sql/checkpoint-store-sql.js +86 -71
- package/dist/{plugins → stores-sql}/file-history-store-sql.d.ts +23 -11
- package/dist/{plugins → stores-sql}/file-history-store-sql.js +23 -18
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/{plugins → stores-sql}/pg-session-storage.d.ts +30 -81
- package/dist/{plugins → stores-sql}/pg-session-storage.js +123 -244
- package/dist/{plugins → stores-sql}/retention-store-sql.d.ts +197 -223
- package/dist/{plugins → stores-sql}/retention-store-sql.js +148 -207
- package/dist/{plugins → stores-sql}/session-event-payload.d.ts +1 -1
- package/dist/{plugins → stores-sql}/session-event-payload.js +1 -1
- package/dist/stores-sql/session-policy-store-sql.d.ts +33 -11
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +65 -0
- package/dist/stores-sql/session-write-hooks.js +2 -0
- package/dist/{plugins → stores-sql}/tidb-session-storage.d.ts +14 -15
- package/dist/{plugins → stores-sql}/tidb-session-storage.js +22 -28
- package/dist/{plugins → stores-sql}/tidb-session-store.d.ts +67 -138
- package/dist/{plugins → stores-sql}/tidb-session-store.js +130 -200
- package/dist/stores-sql/tool-result-store-sql.d.ts +1 -1
- package/dist/stores-sql/tool-result-store-sql.js +1 -1
- package/dist/stores-sql/windowed-session-storage.d.ts +61 -0
- package/dist/stores-sql/windowed-session-storage.js +70 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +7 -1
- package/dist/task-a2a.js +18 -17
- package/dist/task-cwd.d.ts +31 -3
- package/dist/task-cwd.js +25 -1
- package/dist/task-mcp.d.ts +11 -3
- package/dist/task-mcp.js +16 -19
- package/dist/task-settings.d.ts +23 -14
- package/dist/task-settings.js +35 -13
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +152 -137
- package/dist/tool-approval.js +199 -199
- package/dist/trace/core-keyset-guard.d.ts +22 -9
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/engine-notice-wire.d.ts +1 -1
- package/dist/trace/engine-notice-wire.js +2 -0
- package/dist/trace/exit-seat.d.ts +52 -4
- package/dist/trace/exit-seat.js +43 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +88 -58
- package/dist/trace/project.js +64 -28
- package/dist/trace/redact.d.ts +124 -28
- package/dist/trace/redact.js +936 -328
- package/dist/trace/self-minted-wire.d.ts +750 -29
- package/dist/trace/self-minted-wire.js +262 -25
- package/dist/trace/sema-provenance.d.ts +45 -41
- package/dist/trace/sema-provenance.js +81 -10
- package/dist/trace/task-notification-facets.d.ts +70 -2
- package/dist/trace/task-notification-facets.js +71 -1
- package/dist/trace/wire-projection-faces.d.ts +43 -8
- package/dist/trace/wire-projection-faces.js +28 -3
- package/dist/unread-request-members.d.ts +66 -0
- package/dist/unread-request-members.js +41 -0
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +33 -40
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/candidate-gate.d.ts +35 -3
- package/dist/web-admin-client/candidate-gate.js +53 -5
- package/dist/web-admin-client/center-request.d.ts +6 -3
- package/dist/web-admin-client/center-request.js +17 -16
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -2
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/facade.d.ts +1 -1
- package/dist/web-admin-client/http-client.d.ts +2 -1
- package/dist/web-admin-client/http-client.js +40 -13
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +13 -6
- package/dist/web-admin-client/skills-mcp.d.ts +22 -8
- package/dist/web-admin-client/skills-mcp.js +26 -21
- package/dist/web-admin-client/types.d.ts +35 -51
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +16 -12
- package/scripts/drain-check-local.mjs +118 -173
- package/scripts/drain-check.mysql.sql +20 -16
- package/scripts/drain-check.pg.sql +20 -16
- package/wire-changes/server@7.147.0.json +813 -0
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
package/dist/http/sse-log.d.ts
CHANGED
|
@@ -8,13 +8,16 @@
|
|
|
8
8
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
9
9
|
export interface SseLogProvider<E extends {
|
|
10
10
|
seq: number;
|
|
11
|
+
}, R extends {
|
|
12
|
+
status: string;
|
|
13
|
+
} = {
|
|
14
|
+
status: string;
|
|
11
15
|
}> {
|
|
12
|
-
/** The coarse terminality status
|
|
13
|
-
* caller already 404'd existence before opening the stream, so this is the in-flight terminal poll).
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} | null | undefined>;
|
|
16
|
+
/** The log's row as the provider answers it (the coarse terminality status rides on it). Undefined/null ⇒ unknown id (the
|
|
17
|
+
* caller already 404'd existence before opening the stream, so this is the in-flight terminal poll).
|
|
18
|
+
* 🔴 **本泵不看钟**:「这条日志的写者死了没」不是泵的问题 —— 行答 `running` 就接着 tail,行答别的就收尾。run 日志的 provider 交回的是
|
|
19
|
+
* 过了观察口的行(心跳过期 ⇒ 当场落死亡判决,行随之不再 `running`);bake 日志的 provider 在自己这一侧折叠(它的判据是 bake 的,另票收)。 */
|
|
20
|
+
statusOf(id: string): Promise<R | null | undefined>;
|
|
18
21
|
/** Events with seq strictly greater than `after`, ascending. */
|
|
19
22
|
getEvents(id: string, after: number): Promise<E[]>;
|
|
20
23
|
/** Map ONE event to its SSE frame (the `id:`/`event:`/`data:` lines differ per log). */
|
|
@@ -23,11 +26,13 @@ export interface SseLogProvider<E extends {
|
|
|
23
26
|
event: string;
|
|
24
27
|
data: unknown;
|
|
25
28
|
};
|
|
26
|
-
/**
|
|
27
|
-
|
|
29
|
+
/** 这一行账本是不是一帧**终帧**(本连接投过它 ⇒ 收尾时不再合成)。 */
|
|
30
|
+
isTerminalEvent(ev: E): boolean;
|
|
31
|
+
/** 行不再 `running`、剩余事件写完之后的**收尾帧**(从行合成;`deliveredTerminal` = 本连接已投过一帧账本终帧);交回 `undefined` ⇒ 不写。 */
|
|
32
|
+
closingFrameOf(row: R, deliveredTerminal: boolean): {
|
|
28
33
|
event: string;
|
|
29
34
|
data: unknown;
|
|
30
|
-
};
|
|
35
|
+
} | undefined;
|
|
31
36
|
/**
|
|
32
37
|
* [ref] 车3 §5:**开流 preamble** —— 在 `sseHeaders` **之后**、日志 tail **之前**写的
|
|
33
38
|
* 一批**非账本**帧(今天唯一的用户 = 审批未决卡的全量对账基准)。
|
|
@@ -84,6 +89,8 @@ export declare function collectSsePreamble<F>(preamble: (signal: AbortSignal) =>
|
|
|
84
89
|
* 是一句谎。续读语义因此只有一句:投 `seq > from` 的每一行(缺的行就是缺的,不补、不猜)。 */
|
|
85
90
|
export declare function streamSseLog<E extends {
|
|
86
91
|
seq: number;
|
|
87
|
-
}
|
|
92
|
+
}, R extends {
|
|
93
|
+
status: string;
|
|
94
|
+
}>(req: IncomingMessage, res: ServerResponse, provider: SseLogProvider<E, R>, id: string): Promise<void>;
|
|
88
95
|
export declare function sleep(ms: number): Promise<void>;
|
|
89
96
|
//# sourceMappingURL=sse-log.d.ts.map
|
package/dist/http/sse-log.js
CHANGED
|
@@ -31,7 +31,7 @@ export async function collectSsePreamble(preamble, onFailure, timeoutMs = SSE_PR
|
|
|
31
31
|
clearTimeout(timer);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
export async function streamSseLog(req, res, provider, id
|
|
34
|
+
export async function streamSseLog(req, res, provider, id) {
|
|
35
35
|
const lastId = Number(req.headers["last-event-id"] ?? new URL(req.url ?? "", "http://x").searchParams.get("from") ?? 0);
|
|
36
36
|
let from = Number.isFinite(lastId) ? lastId : 0;
|
|
37
37
|
sseHeaders(res);
|
|
@@ -49,11 +49,14 @@ export async function streamSseLog(req, res, provider, id, staleMs) {
|
|
|
49
49
|
}
|
|
50
50
|
const start = Date.now();
|
|
51
51
|
let lastBeat = Date.now();
|
|
52
|
+
let deliveredTerminal = false;
|
|
52
53
|
const write = (events) => {
|
|
53
54
|
for (const ev of events) {
|
|
54
55
|
const f = provider.formatEvent(ev);
|
|
55
56
|
res.write(`id: ${f.id}\nevent: ${f.event}\ndata: ${JSON.stringify(f.data)}\n\n`);
|
|
56
57
|
from = ev.seq;
|
|
58
|
+
if (provider.isTerminalEvent(ev))
|
|
59
|
+
deliveredTerminal = true;
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
while (!closed) {
|
|
@@ -63,12 +66,9 @@ export async function streamSseLog(req, res, provider, id, staleMs) {
|
|
|
63
66
|
break;
|
|
64
67
|
if (row.status !== "running") {
|
|
65
68
|
write(await provider.getEvents(id, from));
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (stale && events.length === 0) {
|
|
70
|
-
const sf = provider.staleFrame();
|
|
71
|
-
res.write(`event: ${sf.event}\ndata: ${JSON.stringify(sf.data)}\n\n`);
|
|
69
|
+
const closing = provider.closingFrameOf(row, deliveredTerminal);
|
|
70
|
+
if (closing)
|
|
71
|
+
res.write(`event: ${closing.event}\ndata: ${JSON.stringify(closing.data)}\n\n`);
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
if (Date.now() - start > SSE_MAX_STREAM_MS) {
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { PermissionMode } from "@sema-agent/core";
|
|
11
11
|
import { type Autonomy } from "../runtime-governance.js";
|
|
12
|
+
import { type InertToolListEntry } from "../rule-entry-list.js";
|
|
12
13
|
import { type ExecutionConfigRootDeployment } from "../execution-config-root.js";
|
|
14
|
+
import { type UnreadMembersDeployment } from "../unread-request-members.js";
|
|
13
15
|
import { type ModelApiKeyEnvTable } from "../server-secret-env.js";
|
|
14
16
|
import { type StoredBodyReplayRefusal } from "./checkpoint-ctx.js";
|
|
15
17
|
import type { CheckpointCtx } from "./route-ctx.js";
|
|
@@ -23,15 +25,27 @@ export declare function permissionModeReadingUnstated(ctx: CheckpointCtx, floor:
|
|
|
23
25
|
floor: PermissionMode;
|
|
24
26
|
} | undefined;
|
|
25
27
|
/**
|
|
26
|
-
*
|
|
28
|
+
* 存体里 `settings.permissions.deny` / `ask`(规则编译器读的收紧表)有永远不生效的条目(名字层:退役名 / 短名 / 铸不出的段 / 近似名;core 的规则文法:括号 / 内容文法 / 主字段……;
|
|
29
|
+
* `~/` 形而这个部署解不出 home),或三桶里 user 层的 `/` 形规则而这个部署读不出执行环境的配置根 —— 拒点是 `applyTaskSettings`(422,在 `resolveSpec` 里),那一拍 plan_review 的一次性 nonce 已烧、终态 steer 的唤醒卡已铸、SLA 拒扫跳不过;所以预判也问一遍。
|
|
30
|
+
* **同一只函数**:拒点调的 `task-settings.ts` `rulePolicyBucketsRefusal`(同一张桶序表 `RULE_POLICY_BUCKETS`、同一张名册、同一句、同一条完整序:名字层 + 文法 → `~/` 要 home)。
|
|
31
|
+
* 两腿的输入差只有**任务根那一集声明给文法的路径基**(拒点有任务根 + home,预判一个也不声明;core 的规则文法对没声明的基不下判词 ⇒ 逐字同句);**home 同源**:`executionLaneHomeDir(config)` 是
|
|
32
|
+
* `resolve-spec.ts` 铸 `pathBases.home` 的那一个函数,预判拿同一份部署配置算(缺席就不铸键);**配置根同源**:`executionConfigRootOf(config)`,两腿都把它声明成配置根那一集的根(同判同句)。命中 ⇒ 码取 `SETTINGS_RULE_REFUSAL_CODE`(拒点 422 体的码,与续跑腿折出来的 `blockedBy` 同一个),句子 = 前缀 + 拒点那一句(逐字),体另带与提交口 422 同一只铸点的 `field` + `detail.problems`。
|
|
33
|
+
* 调用前桶门({@link storedPermissionBucketRefusal})已过:这里读到的桶都是合条目律的数组(纯串或带层条目)、不超帽。
|
|
34
|
+
* **两个调用方**:本文件的存量体重放预判(续跑腿折 409),与新提交的铸前块(`request-form.ts`,422)—— 判据只读请求与部署配置(任务根那一集不声明),
|
|
35
|
+
* 所以新提交在授权器铸会话之前就答得出;要任务根才判得出的那一类留在拒点(装配期,铸点之后)。
|
|
27
36
|
*/
|
|
28
|
-
export
|
|
37
|
+
export declare function ruleTablesRefusalWithoutTaskRoot(body: unknown, deployment: ExecutionConfigRootDeployment): InertToolListEntry | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* 预判读的部署配置:`autonomy`(模式词问的模式词地板)、执行车道的 home 两位(`~/` 形规则那一问)、配置根的几位(user 设置层 `/` 规则那一问)与「请求成员读不出」那一问的
|
|
40
|
+
* 租户轴 / 两只注入闸的否决位。`ServiceConfig` 结构上满足,四个问点传 `deps.config` 整份。
|
|
41
|
+
*/
|
|
42
|
+
export type StoredReplayDeployment = ExecutionConfigRootDeployment & UnreadMembersDeployment & {
|
|
29
43
|
readonly autonomy?: Autonomy | undefined;
|
|
30
44
|
/** 生效配置模型条目 name → `apiKeyEnv`(`settings.env` 凭据判据的名单一臂;缺席 = 没有模型条目,与 `serverCredentialValueSources` 的缺省同读)。 */
|
|
31
45
|
readonly modelApiKeyEnv?: ModelApiKeyEnvTable | undefined;
|
|
32
46
|
};
|
|
33
47
|
/**
|
|
34
|
-
* 四问一只判据:不能重放 ⇒ 返回拒的那条规则;能 ⇒ `undefined`。顺序:allow 读法(体里带非空 `allow` 而写者版本证不出 ≥ 7.117.0;常设,按写者版本)→ 请求设置里的条目表(**与拒点同序**:桶门〔形 / 空串 / 超帽〕→ 工具名清单读成空〔**只问限制方向**:放行方向的存量条目读成空,续跑照旧、只留一行运维 warn〕→ deny / ask 的名字层 + 规则文法)→ 模式词读法记号 → 体里的退役请求键(几问同中时答先中的那一问 ——
|
|
48
|
+
* 四问一只判据:不能重放 ⇒ 返回拒的那条规则;能 ⇒ `undefined`。顺序:allow 读法(体里带非空 `allow` 而写者版本证不出 ≥ 7.117.0;常设,按写者版本)→ 请求设置里的条目表(**与拒点同序**:桶门〔形 / 空串 / 超帽〕→ 工具名清单读成空〔**只问限制方向**:放行方向的存量条目读成空,续跑照旧、只留一行运维 warn〕→ 请求成员读不出〔hooks / env / MCP transport / A2A headers …,判据 `unread-request-members.ts`〕→ deny / ask 的名字层 + 规则文法)→ 模式词读法记号 → 体里的退役请求键(几问同中时答先中的那一问 ——
|
|
35
49
|
* 任一问中都不重放,句子只需一句)。`deployment` = 本部署**此刻**的 `config`(活 config:热改即生效):`autonomy` 的地板由它的唯一属主算,`~/` 形规则的 home 由 `executionLaneHomeDir` 算,问点都不自己算。
|
|
36
50
|
*/
|
|
37
51
|
export declare function storedBodyReplayRefusal(ctx: CheckpointCtx, deployment: StoredReplayDeployment): StoredBodyReplayRefusal | undefined;
|
|
@@ -7,6 +7,8 @@ import { executionLaneHomeDir } from "../execution-lane-caps.js";
|
|
|
7
7
|
import { executionConfigRootOf } from "../execution-config-root.js";
|
|
8
8
|
import { migrationWindowEnd } from "../plugins/one-time-migrations.js";
|
|
9
9
|
import { storedEnvCredentialsDropM38 } from "../stored-request-env-credentials-m38.js";
|
|
10
|
+
import { storedToolAxesRereadM19 } from "../stored-request-tool-axes-m19.js";
|
|
11
|
+
import { MAX_NAMED_MEMBERS, unreadRequestMembers, unreadRequestMembersRefusal } from "../unread-request-members.js";
|
|
10
12
|
import { serverCredentialValueSources } from "../server-secret-env.js";
|
|
11
13
|
import { allowListWriterUnproven, permissionModeReadingStated, retiredRequestKeyOf } from "./checkpoint-ctx.js";
|
|
12
14
|
export function permissionModeReadingUnstated(ctx, floor) {
|
|
@@ -38,7 +40,7 @@ function storedTightenOnlySeatRefusal(body) {
|
|
|
38
40
|
return undefined;
|
|
39
41
|
return replayInertEntry(tightenOnlySeatField(issue.seat), "deny", BUCKET_GATE_CODE, issue.message, { ...issue.fields });
|
|
40
42
|
}
|
|
41
|
-
function
|
|
43
|
+
export function ruleTablesRefusalWithoutTaskRoot(body, deployment) {
|
|
42
44
|
const permissions = storedPermissions(body);
|
|
43
45
|
if (permissions === undefined)
|
|
44
46
|
return undefined;
|
|
@@ -75,7 +77,14 @@ export function storedBodyReplayRefusal(ctx, deployment) {
|
|
|
75
77
|
const envCredential = storedEnvCredentialRefusal(ctx.body, deployment);
|
|
76
78
|
if (envCredential !== undefined)
|
|
77
79
|
return { kind: "settings_env_credential", refusal: envCredential };
|
|
78
|
-
const
|
|
80
|
+
const inert = inertToolListEntryOf(ctx.body, ["deny"]);
|
|
81
|
+
if (inert !== undefined)
|
|
82
|
+
return { kind: "inert_tool_list", entry: inert };
|
|
83
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
84
|
+
const unread = unreadRequestMembers({ settings: ctx.body.settings, mcpServers: ctx.body.mcpServers, a2aPeers: ctx.body.a2aPeers }, deployment, { replay: true, today, storedToolAxes: storedToolAxesRereadM19(today) });
|
|
85
|
+
if (unread.length > 0)
|
|
86
|
+
return { kind: "unread_members", refusal: unreadRequestMembersRefusal(unread), members: unread.slice(0, MAX_NAMED_MEMBERS), memberCount: unread.length };
|
|
87
|
+
const entry = ruleTablesRefusalWithoutTaskRoot(ctx.body, deployment);
|
|
79
88
|
if (entry !== undefined)
|
|
80
89
|
return { kind: "inert_tool_list", entry };
|
|
81
90
|
const mode = permissionModeReadingUnstated(ctx, autonomyModeFloor(deployment.autonomy));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { RunStore } from "../plugins/store-backend.js";
|
|
2
2
|
import type { Logger } from "../observability/logger.js";
|
|
3
3
|
import type { Metrics } from "../observability/metrics.js";
|
|
4
|
+
import { type CtxWriteClaim } from "../plugins/store-contracts.js";
|
|
5
|
+
import type { CtxClaimPut } from "../plugins/checkpoint-store-face.js";
|
|
4
6
|
import { buildCheckpointCtx, type CheckpointCtxSealer, type SealedCheckpointCtx } from "./checkpoint-ctx.js";
|
|
5
7
|
import { type RefusalBody } from "./refusal-body.js";
|
|
6
8
|
import type { CheckpointCtx, PreparedTaskSubmission } from "./route-ctx.js";
|
|
@@ -11,28 +13,34 @@ export interface SubmitCtxRefusal {
|
|
|
11
13
|
readonly status: 413 | 409;
|
|
12
14
|
readonly body: RefusalBody;
|
|
13
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* 栅栏答「认领已失」([ref]):零写;本请求刚认领的那条 run 已被收割判决终局、认领已放 ⇒ 不撤。调用方**当拍**按起跑前复核的同一只三臂答复
|
|
18
|
+
* (`claim-heartbeat.ts` `refusalAfterLostClaim` / `recheckClaimBeforeLaunch`),在任何后续写(workflow 决定落行)与起跑之前。
|
|
19
|
+
*/
|
|
20
|
+
export declare const SUBMIT_CTX_CLAIM_LOST: "claim_lost";
|
|
21
|
+
/** 提交腿的续跑输入写口(检查点店唯一写口的那一面):有认领 ⇒ 交认领、栅栏写;没有 ⇒ 无条件写。 */
|
|
22
|
+
export interface SubmitCtxStore {
|
|
23
|
+
putCtx(sessionId: string, ctx: SealedCheckpointCtx, claim?: CtxWriteClaim): Promise<CtxClaimPut | void>;
|
|
24
|
+
}
|
|
14
25
|
/**
|
|
15
26
|
* 写这一笔(行体经续跑输入的唯一构造口 `buildCheckpointCtx` 铸 —— 新的持久化写都经它,读法记号随之盖上);写不进 ⇒ 撤掉
|
|
16
27
|
* `claim` 指的那条刚认领的 run(无 run 店的部署没有认领 ⇒ `undefined`),再按成因答复(见文件头)。
|
|
17
28
|
* 返回 `undefined` = 写进了,腿照常起跑。
|
|
18
29
|
*/
|
|
19
|
-
export declare function persistSubmitCtx(store: {
|
|
20
|
-
putCtx(sessionId: string, ctx: SealedCheckpointCtx): Promise<void>;
|
|
21
|
-
}, deps: {
|
|
30
|
+
export declare function persistSubmitCtx(store: SubmitCtxStore, deps: {
|
|
22
31
|
readonly logger?: Logger | undefined;
|
|
23
32
|
readonly metrics?: Metrics | undefined;
|
|
24
33
|
readonly checkpointCtxSealing?: CheckpointCtxSealer | undefined;
|
|
34
|
+
readonly instanceId?: string | undefined;
|
|
25
35
|
}, claim: {
|
|
26
36
|
readonly runStore: RunStore;
|
|
27
37
|
readonly taskId: string;
|
|
28
|
-
} | undefined, sessionId: string, fields: Parameters<typeof buildCheckpointCtx>[0]): Promise<SubmitCtxRefusal | undefined>;
|
|
38
|
+
} | undefined, sessionId: string, fields: Parameters<typeof buildCheckpointCtx>[0]): Promise<SubmitCtxRefusal | typeof SUBMIT_CTX_CLAIM_LOST | undefined>;
|
|
29
39
|
/**
|
|
30
40
|
* 提交腿写续跑输入的入口(三个调用点同调这一只):体与标记按受理座提交时交出的那一份定(见文件头「体里的目标按哪一份写」),只写这一笔。
|
|
31
41
|
* 写不进的处置与答复 = {@link persistSubmitCtx}(本函数只定体、不另判)。
|
|
32
42
|
*/
|
|
33
|
-
export declare function persistSubmissionCtx(store: {
|
|
34
|
-
putCtx(sessionId: string, ctx: SealedCheckpointCtx): Promise<void>;
|
|
35
|
-
}, deps: Parameters<typeof persistSubmitCtx>[1], claim: Parameters<typeof persistSubmitCtx>[2], prepared: Pick<PreparedTaskSubmission, "body" | "auth" | "verify" | "acceptance" | "bodyFromScreenedCtx"> & {
|
|
43
|
+
export declare function persistSubmissionCtx(store: SubmitCtxStore, deps: Parameters<typeof persistSubmitCtx>[1], claim: Parameters<typeof persistSubmitCtx>[2], prepared: Pick<PreparedTaskSubmission, "body" | "auth" | "verify" | "acceptance" | "bodyFromScreenedCtx"> & {
|
|
36
44
|
readonly spec: Pick<PreparedTaskSubmission["spec"], "sessionId" | "model">;
|
|
37
|
-
}): Promise<SubmitCtxRefusal | undefined>;
|
|
45
|
+
}): Promise<SubmitCtxRefusal | typeof SUBMIT_CTX_CLAIM_LOST | undefined>;
|
|
38
46
|
//# sourceMappingURL=submit-ctx.d.ts.map
|
package/dist/http/submit-ctx.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { StoreRowTooLargeError } from "../plugins/sql-errors.js";
|
|
2
2
|
import { releaseClaimedRun } from "./claimed-run.js";
|
|
3
|
+
import { runProvenElsewhere } from "../plugins/store-contracts.js";
|
|
3
4
|
import { buildCheckpointCtx, CheckpointCtxUnsealableError } from "./checkpoint-ctx.js";
|
|
4
5
|
import { refusalBody } from "./refusal-body.js";
|
|
5
6
|
import { limitFactsUnmeasured } from "../limit-refusal.js";
|
|
@@ -14,6 +15,7 @@ function withheldBody(body, picked) {
|
|
|
14
15
|
const pin = typeof body.model !== "string" && typeof picked === "string" && picked !== DEFAULT_MODEL_REF ? { model: picked } : {};
|
|
15
16
|
return { ...body, objective: WITHHELD_OBJECTIVE, ...pin };
|
|
16
17
|
}
|
|
18
|
+
export const SUBMIT_CTX_CLAIM_LOST = "claim_lost";
|
|
17
19
|
function unsealableRefusal(e) {
|
|
18
20
|
return {
|
|
19
21
|
status: 409,
|
|
@@ -39,9 +41,10 @@ function rowTooLargeRefusal(tooLarge) {
|
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
export async function persistSubmitCtx(store, deps, claim, sessionId, fields) {
|
|
44
|
+
let landed;
|
|
42
45
|
try {
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
const ctx = buildCheckpointCtx(fields, deps.checkpointCtxSealing, sessionId);
|
|
47
|
+
landed = await store.putCtx(sessionId, ctx, claim === undefined ? undefined : { fence: claim.runStore, taskId: claim.taskId, legHolds: (run) => !runProvenElsewhere(run, deps.instanceId) });
|
|
45
48
|
}
|
|
46
49
|
catch (err) {
|
|
47
50
|
const tooLarge = err instanceof StoreRowTooLargeError ? err : undefined;
|
|
@@ -63,6 +66,7 @@ export async function persistSubmitCtx(store, deps, claim, sessionId, fields) {
|
|
|
63
66
|
deps.logger?.warn("submit_ctx_row_too_large", { sessionId, taskId: claim?.taskId, wall: tooLarge.wall, db: tooLarge.dbMessage });
|
|
64
67
|
return rowTooLargeRefusal(tooLarge);
|
|
65
68
|
}
|
|
69
|
+
return landed === "claim_released" ? SUBMIT_CTX_CLAIM_LOST : undefined;
|
|
66
70
|
}
|
|
67
71
|
export async function persistSubmissionCtx(store, deps, claim, prepared) {
|
|
68
72
|
const sessionId = prepared.spec.sessionId;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* ## 判定(三条,按序;别的一律不放)
|
|
11
11
|
* · 这次提交自带 taskId 而命中的行**不是**那一条(`Idempotency-Key` 指向别的行)⇒ 冲突;
|
|
12
|
-
* · 调用方读不到这一行(属主门 = `
|
|
12
|
+
* · 调用方读不到这一行(属主门 = `qualsOf`,「这个调用方读得到这一行 run 吗」的唯一谓词,经属主存取器 `owner-access.ts` 读)⇒ 冲突;
|
|
13
13
|
* 冲突 ⇒ `409 conflict.run_exists`,体里**不回显**那条行的任何标识(不给跨租户预言机)。先于下一条判:读不到的行不比体。
|
|
14
14
|
* · 这次提交带 `Idempotency-Key`(`caller.idem` 在场)、那一行绑的**就是这把键**,而它记着的请求体指纹与这次不同 ⇒
|
|
15
15
|
* `409 conflict.idempotency_payload_mismatch`(同形 `{ error, errorCode }`,不回显键与那一行);**不**回放首发、不新建、那一行不动。
|
|
@@ -21,29 +21,42 @@
|
|
|
21
21
|
* · `sync`(`POST /v1/tasks`;`/v1/tasks/stream` 把同一份体放进 `done.result`)—— `200 { …首答的信封, replay: true }`:
|
|
22
22
|
* 首答的信封由 `http/sync-submit-body.ts` 铸(`buildSyncSubmitBody`),重放经同文件的 `syncSubmitBodyOfRow` 读行 ——
|
|
23
23
|
* 终局 / 停驻行上有结果 ⇒ 与首答同形(结果的键在顶层,`result` 是串);行上没有结果可交(首投还在跑)⇒ 轮询回执 `{ taskId, sessionId, status }`。
|
|
24
|
-
* `replay: true`
|
|
24
|
+
* `replay: true` 是判别位,经 {@link replayedOutcome} 叠上(不在信封里)。
|
|
25
|
+
*
|
|
26
|
+
* ## `replay` 位(一条律,唯一铸点 {@link replayedOutcome})
|
|
27
|
+
* `replay: true` ⇔ 这是一份 **200** 结局,而它**不是本次请求产出的** —— 两处来路,一个判别位:本函数读行作答(`sync` 形),与在飞合流的跟随方
|
|
28
|
+
* (同一进程里并发的同键同体请求,结局是首发那一次的;`POST /v1/tasks` 与 `/v1/tasks/stream` 两腿同读)。拒绝(非 200)永不带位:拒绝说的是
|
|
29
|
+
* 「这次没受理」,不是另一次提交的结局 —— 本函数的两只 409、流式腿开流之后才判出的拒绝、合流到的首发拒绝都一样。流式腿终帧的 `done.replay`
|
|
30
|
+
* 是结局自己这一只位的投影({@link isReplayedOutcome}),写点不另盖。`durable` 形的 202 回执不是结局,不带位。
|
|
25
31
|
*/
|
|
26
32
|
import type { RunIdemBinding, RunRecord } from "../plugins/store-contracts.js";
|
|
27
33
|
import type { RunStore } from "../plugins/store-backend.js";
|
|
28
34
|
import type { ServiceConfig } from "../config-types.js";
|
|
29
35
|
import type { SubmitOutcome } from "./idempotency.js";
|
|
30
|
-
import type {
|
|
36
|
+
import type { Subject } from "../owner-brands.js";
|
|
31
37
|
/** 提交腿的回执形(闭集;穷举 `switch`,加一形不写这里 = 编译红)。 */
|
|
32
38
|
export type SubmitReplayFace = "durable" | "sync";
|
|
33
39
|
/** 发起这次提交的一方。 */
|
|
34
40
|
export interface ReplayCaller {
|
|
35
|
-
/**
|
|
36
|
-
|
|
41
|
+
/** 已验主体(分区键;`gatedSubject` 的回值,`Subject` 品牌)。 */
|
|
42
|
+
subject: Subject | undefined;
|
|
37
43
|
/** 这次提交自带的 taskId(`body.taskId`;A2A 派生值)。缺席 = 只凭 `Idempotency-Key` 命中。 */
|
|
38
44
|
clientTaskId?: string;
|
|
39
45
|
/** 这次提交的账本绑定(键 + 请求体指纹;`RunIdemBinding`)。`undefined` = 这次提交没带 `Idempotency-Key`(只凭 `body.taskId`)⇒ 不比体。
|
|
40
46
|
* 必填位(值可为 `undefined`):每个调用点都得当面说出它有没有绑定,漏传是编译错误,不是静默不比。 */
|
|
41
47
|
idem: RunIdemBinding | undefined;
|
|
42
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* `replay: true` 的**唯一**铸点(律见文件头「`replay` 位」):200 ⇒ 体上叠位(结局对象的其余键与 `wiringManifest` 回执原样带过);非 200 ⇒ 原样交回。
|
|
51
|
+
* 提交面的 200 体恒是对象(三只铸点:同步腿 `buildSyncSubmitBody`、流式腿的结果、本文件读行);不是对象 ⇒ 原样交回(缺席 = 「没有重放证据」,不是「真跑过」)。
|
|
52
|
+
*/
|
|
53
|
+
export declare function replayedOutcome(outcome: SubmitOutcome): SubmitOutcome;
|
|
54
|
+
/** 这份结局带不带 `replay` 位(读 {@link replayedOutcome} 叠上的那一只;流式腿终帧的 `done.replay` 只读它)。 */
|
|
55
|
+
export declare function isReplayedOutcome(outcome: SubmitOutcome): boolean;
|
|
43
56
|
/** 一份提交回执是不是 {@link replayOfExistingRun} 铸的**冲突**体(判别位 = 机器码;铸点就在下面,码与它同文件)—— 把回执渲成别的协议形的
|
|
44
57
|
* 调用方(A2A)按它分句,不另抄码。 */
|
|
45
58
|
export declare function isRunExistsConflictBody(body: unknown): boolean;
|
|
46
|
-
export declare function replayOfExistingRun(
|
|
59
|
+
export declare function replayOfExistingRun(seen: RunRecord, caller: ReplayCaller, face: SubmitReplayFace, deps: {
|
|
47
60
|
config: ServiceConfig;
|
|
48
61
|
}, runStore: RunStore): Promise<SubmitOutcome>;
|
|
49
62
|
//# sourceMappingURL=submit-replay.d.ts.map
|
|
@@ -1,25 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { runRowAt, seesRunAs } from "./owner-access.js";
|
|
2
|
+
import { claimCallerOf } from "../security.js";
|
|
2
3
|
import { syncSubmitBodyOfRow } from "./sync-submit-body.js";
|
|
3
4
|
import { refusalBody } from "./refusal-body.js";
|
|
5
|
+
export function replayedOutcome(outcome) {
|
|
6
|
+
const body = outcome.body;
|
|
7
|
+
if (outcome.status !== 200 || typeof body !== "object" || body === null || Array.isArray(body))
|
|
8
|
+
return outcome;
|
|
9
|
+
return { ...outcome, body: { ...body, replay: true } };
|
|
10
|
+
}
|
|
11
|
+
export function isReplayedOutcome(outcome) {
|
|
12
|
+
const body = outcome.body;
|
|
13
|
+
return outcome.status === 200 && typeof body === "object" && body !== null && body.replay === true;
|
|
14
|
+
}
|
|
4
15
|
export function isRunExistsConflictBody(body) {
|
|
5
16
|
return typeof body === "object" && body !== null && body.errorCode === "conflict.run_exists";
|
|
6
17
|
}
|
|
7
|
-
export async function replayOfExistingRun(
|
|
8
|
-
const sameRun = caller.clientTaskId === undefined || caller.clientTaskId ===
|
|
9
|
-
if (!sameRun || !
|
|
18
|
+
export async function replayOfExistingRun(seen, caller, face, deps, runStore) {
|
|
19
|
+
const sameRun = caller.clientTaskId === undefined || caller.clientTaskId === seen.taskId;
|
|
20
|
+
if (!sameRun || !seesRunAs("run.replay", claimCallerOf(caller.subject, deps.config), seen.owner)) {
|
|
10
21
|
return { status: 409, body: refusalBody({ errorCode: "conflict.run_exists", message: "a run already exists for this submission's taskId or Idempotency-Key" }) };
|
|
11
22
|
}
|
|
12
23
|
if (caller.idem !== undefined) {
|
|
13
|
-
const held = await runStore.bindIdemBodyFingerprint(
|
|
24
|
+
const held = await runStore.bindIdemBodyFingerprint(seen.taskId, caller.idem);
|
|
14
25
|
if (held !== null && held !== caller.idem.bodyFingerprint) {
|
|
15
26
|
return { status: 409, body: refusalBody({ errorCode: "conflict.idempotency_payload_mismatch", message: "this Idempotency-Key was already used for a different request body — a retry must resend the same body; send a different request with a new Idempotency-Key" }) };
|
|
16
27
|
}
|
|
17
28
|
}
|
|
29
|
+
const row = await runRowAt("run.replay", runStore, seen);
|
|
18
30
|
switch (face) {
|
|
19
31
|
case "durable":
|
|
20
32
|
return { status: 202, body: { taskId: row.taskId, sessionId: row.sessionId, status: row.status } };
|
|
21
33
|
case "sync":
|
|
22
|
-
return { status: 200, body:
|
|
34
|
+
return replayedOutcome({ status: 200, body: syncSubmitBodyOfRow(row) });
|
|
23
35
|
default: {
|
|
24
36
|
const unknown = face;
|
|
25
37
|
throw new Error(`replayOfExistingRun: unknown submit face ${String(unknown)}`);
|
|
@@ -26,7 +26,6 @@
|
|
|
26
26
|
* `failed.nestedPause.token`)因此在进本函数之前就已摘掉,幂等缓存存的正是本函数的产物,重放体同体同脱。
|
|
27
27
|
*/
|
|
28
28
|
import { type ParkedRunStatus, type PersistedTaskResult, type RunRecord } from "../plugins/store-contracts.js";
|
|
29
|
-
import { type RunFaceDeps } from "./run-read-face.js";
|
|
30
29
|
/** 同步 200 体上的 poll 回执三键:一条 run 的 poll 键、会话、对外词。park 体叠在结果之上带它({@link SyncParkReceipt});重放命中一条还没有结果可交的行时,它**就是**整个体({@link syncSubmitBodyOfRow})。 */
|
|
31
30
|
export interface SyncRunReceipt {
|
|
32
31
|
/** 同步腿提交时铸的 durable run id —— `GET /v1/runs/:taskId` 的 poll 键。 */
|
|
@@ -50,11 +49,11 @@ export declare function buildSyncSubmitBody<R extends PersistedTaskResult>(exitR
|
|
|
50
49
|
* (终局 = 结果本身;停驻 = 结果 + 回执三键),与首答的三个 200 出口逐字同形 —— 首答恒 = 「出口封口 + 脱敏后的引擎结果」,那份对象就是落在行上的那一份
|
|
51
50
|
* (调用方铸一次、既落行又进体),重放读到的是它被读入口(同一只 {@link runRowExitResult},`GET /v1/runs/:id` 的 `result` 读的也是它)再封再脱的样子。
|
|
52
51
|
* 行上没有结果可交(首投还在跑、在别的副本上没落定;或终局行的结果已被收割清空)⇒ 首答在这一刻**不存在**,体只剩 {@link SyncRunReceipt} 三键 —— 去 `GET /v1/runs/:taskId` 轮询,
|
|
53
|
-
*
|
|
52
|
+
* 不把「读面」塞进同步体里充首答。交进来的行已过观察口(重放口 `run.replay`):心跳过期的行在那里已落成 `failed`。
|
|
54
53
|
*
|
|
55
54
|
* 首答体上另有两类**本次请求**的附注(`notice` / `warnings`,见 `routes/tasks.ts` 的 `withSyncSubmitKeys`):重放在 `prepareSpec` 之前就答了,
|
|
56
|
-
* 结构上不知道本次请求带没带 verify / cascade、放行侧选择器里有没有空条目 ⇒ 重放体没有它们。判别位 `replay: true`
|
|
55
|
+
* 结构上不知道本次请求带没带 verify / cascade、放行侧选择器里有没有空条目 ⇒ 重放体没有它们。判别位 `replay: true` 由它的唯一铸点(`submit-replay.ts` 的 `replayedOutcome`)叠上,不在信封里。
|
|
57
56
|
* 纯数据 ⇒ `build*` 的近亲;名字取 `…OfRow`(行 → 体的读法),与 `buildSyncSubmitBody` 同文件同铸点。
|
|
58
57
|
*/
|
|
59
|
-
export declare function syncSubmitBodyOfRow(
|
|
58
|
+
export declare function syncSubmitBodyOfRow(row: RunRecord): ReturnType<typeof buildSyncSubmitBody> | SyncRunReceipt;
|
|
60
59
|
//# sourceMappingURL=sync-submit-body.d.ts.map
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { isParkedRunStatus, isTerminalRunStatus } from "../plugins/store-contracts.js";
|
|
2
|
-
import { runRowExitResult
|
|
2
|
+
import { runRowExitResult } from "./run-read-face.js";
|
|
3
3
|
export function buildSyncSubmitBody(exitResult, parkReceipt) {
|
|
4
4
|
return parkReceipt === undefined ? exitResult : { ...exitResult, ...parkReceipt };
|
|
5
5
|
}
|
|
6
|
-
export function syncSubmitBodyOfRow(
|
|
7
|
-
const
|
|
8
|
-
const exit = stale ? undefined : runRowExitResult(row);
|
|
6
|
+
export function syncSubmitBodyOfRow(row) {
|
|
7
|
+
const exit = runRowExitResult(row);
|
|
9
8
|
if (exit !== undefined) {
|
|
10
9
|
if (isTerminalRunStatus(row.status))
|
|
11
10
|
return buildSyncSubmitBody(exit);
|
|
12
11
|
if (isParkedRunStatus(row.status))
|
|
13
12
|
return buildSyncSubmitBody(exit, { taskId: row.taskId, sessionId: row.sessionId, status: row.status });
|
|
14
13
|
}
|
|
15
|
-
return { taskId: row.taskId, sessionId: row.sessionId, status:
|
|
14
|
+
return { taskId: row.taskId, sessionId: row.sessionId, status: row.status };
|
|
16
15
|
}
|
|
17
16
|
//# sourceMappingURL=sync-submit-body.js.map
|
|
@@ -14,7 +14,8 @@ import type { buildSyncSubmitBody } from "./sync-submit-body.js";
|
|
|
14
14
|
import type { EntryProblem } from "../entry-problems.js";
|
|
15
15
|
/**
|
|
16
16
|
* 请求面上的一条技能 = core 的 `SkillSpec` 去掉 `mods`(core 7.56.0 [ref] 的技能座扩展注册:带 `register` 函数的代码对象,不是 wire 数据)。
|
|
17
|
-
*
|
|
17
|
+
* 本型的键集就是两道技能门(顶层 `skills[i]` 与子代 `agents[a].skills[j]`)的**闭合键表**(`spec-fields.ts` 的 `SKILL_FIELD_SHAPES` 按 `keyof RequestSkill` 铸型):
|
|
18
|
+
* 表外的键 400 点名坐标(`mods` / 退役的 `manifest` 各一句,其余一句「不是技能的键」);本服务不编技能 hooks(能力位 `mods.skill_seat` 恒假)。
|
|
18
19
|
* 键集仍由 core 本体派生([ref]:core 加键,本型同批跟上;删 `mods` 是唯一的一处减法)。
|
|
19
20
|
*/
|
|
20
21
|
export type RequestSkill = Omit<SkillSpec, "mods">;
|
|
@@ -46,7 +47,8 @@ export interface TaskRequestBody {
|
|
|
46
47
|
* `scenario_unknown`, a known-but-not-allowed one a typed 400 `scenario_not_allowed`; absent ⇒ the ruling's
|
|
47
48
|
* assigned scenario, else `DEFAULT_SCENARIO` (consumed at `boot/resolve-spec.ts` via `gateScenarioRequest`). A name
|
|
48
49
|
* on that default chain this deployment does not have is NEVER folded to `default`: an assigned one is a typed 503
|
|
49
|
-
* `state.scenario_assignment_unknown`, a dangling `DEFAULT_SCENARIO` refuses to boot.
|
|
50
|
+
* `state.scenario_assignment_unknown`, a dangling `DEFAULT_SCENARIO` refuses to boot. On a center-wired deployment whose
|
|
51
|
+
* center cannot answer for this principal, named or absent alike is a typed 503 `state.scenario_assignment_unavailable`.
|
|
50
52
|
* ⚠️ scenario-SPECIFIC keys (`repo`/`lenses`/`rounds`, read through `ScenarioRequest`'s index signature) are
|
|
51
53
|
* deliberately NOT declared here — they belong to one scenario each, not to the shared submit surface. */
|
|
52
54
|
scenario?: string;
|
|
@@ -146,10 +148,10 @@ export interface TaskRequestBody {
|
|
|
146
148
|
*
|
|
147
149
|
* 🔴 **类型 = core 的 `SkillSpec` 本体,不是它的手抄子集**([ref]):这里曾写死
|
|
148
150
|
* `{ name; description; content }` —— core 闭集六位里的三位,而 `manifest` / `files` / `baseDir`
|
|
149
|
-
* 三位在运行期一直是**收的**(
|
|
151
|
+
* 三位在运行期一直是**收的**(当年的受理门不判未知键 —— 7.148.0 起顶层也是闭合键表,`buildRunSkills` 原样透传到
|
|
150
152
|
* `TaskSpec.skills`)。一份会漂的手抄 = 声明面比真受理面**窄**,SDK 消费方按声明写代码就以为发不了,
|
|
151
153
|
* 而 core 加键(7.20.0 [ref] 的 `baseDir`)时这里连红都不会红。改成 core 本体后,闭集由 tsc 看守。
|
|
152
|
-
* ⚠️ 受理**判据**(
|
|
154
|
+
* ⚠️ 受理**判据**(键集 / 形 / 尺寸)在 `spec-fields.ts` 的 `skillItemIssue`(两道技能门同一只,读 `SKILL_FIELD_SHAPES`)——
|
|
153
155
|
* 类型说「哪些键存在」,门说「值合不合法」,两者不是一件事。
|
|
154
156
|
* (旧注里的「Caps: ≤10 skills, content ≤32KB each」两条帽早已随 [ref] / core 1.293 退役,一并纠正:
|
|
155
157
|
* 今天只剩 `content ≤ 1 MiB` 这一条 core 加载门孪生。) */
|
|
@@ -189,10 +191,12 @@ export interface TaskRequestBody {
|
|
|
189
191
|
* 400 (fail-loud, never silently dropped — the body.model silent-drop bug class). Absent ⇒ core uses the resolved
|
|
190
192
|
* role's default thinking. NEVER `budgetTokens`/`fast_mode` (provider-neutral by omission). */
|
|
191
193
|
reasoningEffort?: string;
|
|
192
|
-
/** Resume-at (shell-host contract E18): the
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
194
|
+
/** Resume-at (shell-host contract E18): the history-anchor handle of the prior message to rewind the conversation to
|
|
195
|
+
* (a message's E2 `eventId`, or a prompt's `taskId` — the anchor map holds both) — core branches the session at
|
|
196
|
+
* that message before running the new objective ("rewind to this message, ask differently"). The service resolves
|
|
197
|
+
* handle → the persisted SessionTreeEntry.id through the ONE anchor reader (`history-anchor.ts`) in resolveSpec; an
|
|
198
|
+
* unknown handle is a 404 `resume_at.unknown_event` (never silently dropped). Requires a session. Absent ⇒ continue
|
|
199
|
+
* from the current leaf. */
|
|
196
200
|
resumeAt?: string;
|
|
197
201
|
/** [ref] rewind exclusive mode (core 1.292 `TaskSpec.resumeAtMode`): qualifies the `resumeAt` target. `"at"`
|
|
198
202
|
* (default when absent — zero regression) keeps the target message in the branched context; `"before"` branches at
|
|
@@ -224,12 +228,18 @@ export interface TaskRequestBody {
|
|
|
224
228
|
* either way. Requires a FileHistoryStore. */
|
|
225
229
|
restoreFiles?: boolean;
|
|
226
230
|
/** DV-15: opt-in tolerance for a PARTIAL file restore (default = loud terminal failure carrying the per-file
|
|
227
|
-
* ledger; `true` = keep going and disclose the same ledger on the result's rewindNotes).
|
|
231
|
+
* ledger; `true` = keep going and disclose the same ledger on the result's rewindNotes). A RUN-seat policy only
|
|
232
|
+
* ("may the agent keep working on a mixed tree"): the out-of-run `POST /v1/sessions/:id/rewind-files` has no such
|
|
233
|
+
* key — the engine's out-of-run rewind has no partial policy and that route answers the ledger as it stands. */
|
|
228
234
|
acceptPartialRestore?: boolean;
|
|
229
235
|
/** R8 code-only rewind (CC "Restore code" mode): converge the TRACKED set to the history boundary at a prior
|
|
230
|
-
* USER message WITHOUT forking the conversation (the session leaf is untouched — only the files move). The
|
|
231
|
-
*
|
|
232
|
-
*
|
|
236
|
+
* USER message WITHOUT forking the conversation (the session leaf is untouched — only the files move). The value is
|
|
237
|
+
* a history-anchor handle, NOT a SessionTreeEntry.id: the prompt's `taskId` (`messages[].taskId` on the session view;
|
|
238
|
+
* the same handle space `resumeAt` reads) — the service resolves it → the entry id through the one anchor reader
|
|
239
|
+
* (unknown ⇒ 404 `rewind_files_to.unknown_event`). Honored ONLY when `resumeAt` is ABSENT (the two modes are mutually
|
|
240
|
+
* exclusive). Requires the anchor map + a FileHistoryStore + the session store's head read (capability
|
|
241
|
+
* `rewindFilesTo`). Its out-of-run twin — no run, no model call — is `POST /v1/sessions/:id/rewind-files` with the same
|
|
242
|
+
* handle in `to` (capability `sessionRewindFiles`). */
|
|
233
243
|
rewindFilesTo?: string;
|
|
234
244
|
/** [ref](core 7.31.0 [ref] `TaskSpec.fileHistory`)—— 请求级的**文件历史关断词**,唯一词 `"disabled"`(core 的拼法,
|
|
235
245
|
* 与 `checkpointStore` 同;没有 `"enabled"` —— 缺席就是「部署说了算」的唯一形,声明只能单向收紧)。`"disabled"` ⇒
|
|
@@ -457,7 +467,7 @@ export interface TaskRequestBody {
|
|
|
457
467
|
* · `"scrub"` —— 缺省清洗(剥凭据形变量),**任何车道、任何部署**都受理(它就是缺省;7.106.0 合并复审 X7)。
|
|
458
468
|
* **缺席 = 缺省清洗**:不带键的请求把本会话的绑定清掉(不继承上一条请求的声明 —— 这一位是「本条请求要什么」,
|
|
459
469
|
* 粘到下一条上就是替一个没说话的请求放宽)。名单形(`string[]`)**不上 wire**(那是嵌入方构造执行环境的选项)。
|
|
460
|
-
* 🔒 **只有 host 车道有消费点**:别的车道(e2b / k8s / local-docker / ssh / adb / device /
|
|
470
|
+
* 🔒 **只有 host 车道有消费点**:别的车道(e2b / k8s / local-docker / ssh / adb / device / none)带 `"all"` ⇒
|
|
461
471
|
* 400 `request.field_invalid`(`reason: lane_not_host`)「applies to the host lane only」,不静默忽略、不映射到别的车道的 env 名单;`"scrub"` 在那些车道上照受理(无消费点,无害)。
|
|
462
472
|
* Rides the persisted body onto resume legs:重放照射程与车道重判(部署由单用户改托管后 revive ⇒ 同一只拒,
|
|
463
473
|
* resume-legs 折成 `409 resume_blocked_by_policy`)。
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* **身份来源闭集 + run 行身份元组** —— 叶子模块(零依赖):凭据门(`http/principal-gate.ts`)、run 店契约(`plugins/store-contracts.ts`)、
|
|
3
|
-
* 三只 run
|
|
3
|
+
* 三只 run 店与 leader run 店(`plugins/leader-run-store-sql.ts`)、中央建表语句(`plugins/tidb-pool.ts` / `plugins/pg-pool.ts`)与 `/health` 自报位读同一份。
|
|
4
4
|
*
|
|
5
5
|
* ## 律(三句;全仓只在这里写一次)
|
|
6
6
|
* 1. **一张表、一个次序**:{@link IDENTITY_SOURCES} 的序 = 凭据门的判定次序(`verifiedIdentitySource` 答表里第一个验得过的词)= `/health.auth.kinds` 的出现序。
|
|
7
7
|
* 出示了部署的 service 凭据就是 `service_token` —— 哪怕同一枚 Bearer 也被鉴权桥验成登录令牌、哪怕运维给这枚凭据起的系统名叫 `sso`;
|
|
8
8
|
* 验不过 service 凭据而鉴权桥挂了身份 ⇒ `sso`;都没有而直连门 principal 令牌验过 ⇒ `direct_door_jwt`。
|
|
9
|
-
* 2. **一只元组、受理时铸一次**:run
|
|
9
|
+
* 2. **一只元组、受理时铸一次**:run 行(`task_run` 与 `leader_run`)的身份元组 {@link RunIdentity}(三列 `identity_source` / `identity_scope` / `identity_principal_inc`)在凭据门上随来源
|
|
10
10
|
* 一起定下(`principal-gate.ts` 的 `admitRunIdentity`,唯一调用点是凭据门),建行处原样写入,之后只读 —— 续跑认领、挂起、终局、重启都不改它,
|
|
11
11
|
* 没有任何读者按当前状态重推它。`RunRecord.source`(系统名 / `"sso"` / null)只作归因,不是认证来源。
|
|
12
12
|
* 3. **缺席一种读法**:`null` = 这一行**没有「属主在受理时验过的凭据」的记录** —— 三列存在之前写下的行、没有任何验过凭据的受理(无鉴权写面
|
|
@@ -23,6 +23,37 @@
|
|
|
23
23
|
/** 验过的身份来源的**闭集**(序 = 判定次序 = `/health.auth.kinds` 的出现序;加一个来源 = 加一个词,读它的各只穷举 `switch` 不接就编译红)。 */
|
|
24
24
|
export declare const IDENTITY_SOURCES: readonly ["service_token", "sso", "direct_door_jwt"];
|
|
25
25
|
export type IdentitySource = (typeof IDENTITY_SOURCES)[number];
|
|
26
|
+
/**
|
|
27
|
+
* 身份来源在**配置**上接没接线的读入形(`ServiceConfig` 结构上满足)。「这台部署能回哪几个身份来源」只读配置、不读装配:鉴权桥的验签器由
|
|
28
|
+
* `boot/stage-09-leader.ts` 按 {@link authBridgeIssuerOf} 的同一个读数建(读得出 issuer ⇔ 建)⇒「验签器在场」≡「配置里有桥」,
|
|
29
|
+
* 起服任一阶段(含先于验签器的一次性迁移段)读到的是同一个答案;验签器与配置里的桥两者不一致的装配(任一方向)在 `createHttpServer` 拒(`http/server.ts`)。
|
|
30
|
+
*/
|
|
31
|
+
export interface IdentitySourceConfig {
|
|
32
|
+
readonly authToken?: string | undefined;
|
|
33
|
+
readonly authTokens?: Readonly<Record<string, string>> | undefined;
|
|
34
|
+
readonly authBridgeIssuer?: string | undefined;
|
|
35
|
+
readonly webAdmin?: {
|
|
36
|
+
readonly baseUrl: string;
|
|
37
|
+
} | undefined;
|
|
38
|
+
readonly directDoorActive: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 鉴权桥 issuer 的**唯一**取值(装配 `boot/stage-09-leader.ts`、caps `centerWiring.issuer`、`/health.center.issuer` 与 {@link configuredIdentitySources} 同读,不各写一份回退):
|
|
42
|
+
* 显式 `AUTH_BRIDGE_ISSUER`(`config.authBridgeIssuer`)恒赢 ⇒ `source:"explicit"`;缺席则回退中心基址 `webAdmin.baseUrl`
|
|
43
|
+
* (配了中心即默认开桥)⇒ `source:"fallback"`;两者都没有 ⇒ `undefined`(桥不装)。
|
|
44
|
+
*/
|
|
45
|
+
export declare function authBridgeIssuerOf(config: Pick<IdentitySourceConfig, "authBridgeIssuer" | "webAdmin">): {
|
|
46
|
+
readonly issuer: string;
|
|
47
|
+
readonly source: "explicit" | "fallback";
|
|
48
|
+
} | undefined;
|
|
49
|
+
/** 「这台部署配了任何一把 service 凭证吗」—— fail-closed 写门族的真值源,也是身份来源 `service_token` 接没接线的那一句。**单一属主**:全局凭据门(`http/dispatch.ts`)、
|
|
50
|
+
* 停驻行的赎回席(`http/approval-sweeps.ts`)、记忆整理阀门的启动期告警(`boot/stage-06-runners.ts`)、以及 {@link configuredIdentitySources} 读同一句(手抄迟早只改一处,而这条判据决定的是「无凭证部署上写口开不开」)。 */
|
|
51
|
+
export declare function hasServiceAuth(config: Pick<IdentitySourceConfig, "authToken" | "authTokens">): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 🔴 **「这台部署能回哪几个身份来源」的唯一读法**({@link IDENTITY_SOURCES} 里配置接了线的那几个词,序同表)。读者:部署形表的 `identity` 轴
|
|
54
|
+
* (`deployment-shape.ts`,「有没有身份边界」那一行由它答)、`/health.auth`(自报位,`http/health-self-report.ts`)、server-as-peer 受众门(`http/server.ts`)。
|
|
55
|
+
*/
|
|
56
|
+
export declare function configuredIdentitySources(config: IdentitySourceConfig): readonly IdentitySource[];
|
|
26
57
|
/**
|
|
27
58
|
* run 行身份元组(受理时铸、持久、之后只读;律见文件头)。三键恒在、与三列一一对应:`scope` / `principalInc` 只随 `sso` 有值 ——
|
|
28
59
|
* service 凭据与直连门令牌不带登录令牌的 scope / 化身号,判别联合让「`service_token` 带 scope」这种形写不出来。
|
|
@@ -56,8 +87,8 @@ export declare function runIdentityClaimOverflow(claim: RunIdentityClaim, value:
|
|
|
56
87
|
readonly max: number;
|
|
57
88
|
} | undefined;
|
|
58
89
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
90
|
+
* 身份元组三列的列定义 —— 两方言各一段,**唯一属主**:`task_run`(中央建表语句 `tidb-pool.ts` / `pg-pool.ts`)与 `leader_run`(`leader-run-store-sql.ts`)的
|
|
91
|
+
* `CREATE TABLE` 内插这同一段;存量库缺列时起服列册对账(`schema-consistency.ts`)拒启,拒句里的 `ALTER TABLE <表> ADD COLUMN …` 由同一份建表语句解析生成 ⇒
|
|
61
92
|
* 「新库建出来的列」与「运维按拒句 / MIGRATION 补上的列」逐字同形。三列都可空(存量行与律 3 的三种成因都是 NULL);PG 钉 `COLLATE "C"`
|
|
62
93
|
* (身份键按字节判等,与 MySQL 协议表级 `utf8mb4_bin` 同形)。
|
|
63
94
|
*/
|
|
@@ -71,7 +102,7 @@ export interface RunIdentityCells {
|
|
|
71
102
|
readonly identityScope: string | null;
|
|
72
103
|
readonly identityPrincipalInc: string | null;
|
|
73
104
|
}
|
|
74
|
-
/** 元组 → 三格(写口;三只 run 店同一只)。 */
|
|
105
|
+
/** 元组 → 三格(写口;三只 run 店与 leader run 店同一只)。 */
|
|
75
106
|
export declare function runIdentityCells(identity: RunIdentity | null): RunIdentityCells;
|
|
76
107
|
/**
|
|
77
108
|
* 三格 → 元组(读口;SQL 两方言的行映射与 File 车道的 run.json 读回同一只)。读不出一只**合形**元组的三格一律读成 `null`(律 3:不合格,fail-closed),
|
package/dist/identity-source.js
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
export const IDENTITY_SOURCES = ["service_token", "sso", "direct_door_jwt"];
|
|
2
|
+
export function authBridgeIssuerOf(config) {
|
|
3
|
+
if (config.authBridgeIssuer !== undefined)
|
|
4
|
+
return { issuer: config.authBridgeIssuer, source: "explicit" };
|
|
5
|
+
if (config.webAdmin !== undefined)
|
|
6
|
+
return { issuer: config.webAdmin.baseUrl, source: "fallback" };
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
export function hasServiceAuth(config) {
|
|
10
|
+
return Boolean(config.authToken) || Object.keys(config.authTokens ?? {}).length > 0;
|
|
11
|
+
}
|
|
12
|
+
function identitySourceConfigured(kind, config) {
|
|
13
|
+
switch (kind) {
|
|
14
|
+
case "service_token":
|
|
15
|
+
return hasServiceAuth(config);
|
|
16
|
+
case "sso":
|
|
17
|
+
return Boolean(authBridgeIssuerOf(config)?.issuer);
|
|
18
|
+
case "direct_door_jwt":
|
|
19
|
+
return config.directDoorActive;
|
|
20
|
+
default: {
|
|
21
|
+
const unknownKind = kind;
|
|
22
|
+
throw new Error(`identity sources: unknown identity source ${String(unknownKind)}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export function configuredIdentitySources(config) {
|
|
27
|
+
return IDENTITY_SOURCES.filter((k) => identitySourceConfigured(k, config));
|
|
28
|
+
}
|
|
2
29
|
export const RUN_IDENTITY_SCOPE_MAX_CHARS = 190;
|
|
3
30
|
export const RUN_IDENTITY_PRINCIPAL_INC_MAX_CHARS = 64;
|
|
4
31
|
export const RUN_IDENTITY_CLAIM_COLUMNS = { scope: RUN_IDENTITY_SCOPE_MAX_CHARS, principalInc: RUN_IDENTITY_PRINCIPAL_INC_MAX_CHARS };
|