@sema-agent/server 7.147.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 +1039 -24
- package/README.md +20 -7
- package/README.zh-CN.md +14 -8
- package/USAGE.md +380 -163
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -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/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/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 +14 -39
- 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 +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- 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 +28 -30
- 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 +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- 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 +5 -2
- 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/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +37 -31
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +55 -67
- package/dist/boot/retention-lane.d.ts +4 -4
- 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 +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.js +9 -1
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
- package/dist/boot/stage-02-web-admin-pull.js +6 -1
- package/dist/boot/stage-03-store-backend.d.ts +3 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +2 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +7 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +10 -12
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +11 -8
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +11 -8
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +12 -15
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +12 -15
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +3 -0
- package/dist/boot/stores.js +21 -10
- 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 +55 -35
- 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 +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +38 -11
- package/dist/capability-facts.js +47 -8
- 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 +7 -3
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +62 -56
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +42 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +26 -17
- package/dist/config.d.ts +8 -16
- package/dist/config.js +113 -47
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +30 -4
- package/dist/deployment-shape.js +7 -0
- 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.js +2 -1
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +5 -18
- package/dist/execution-lane-caps.js +0 -22
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- 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.js +1 -0
- 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 +3 -3
- 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 +23 -3
- package/dist/history-anchor.js +24 -4
- 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/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +67 -57
- package/dist/hooks/hook-runner.js +260 -186
- 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 +3 -3
- package/dist/http/approval-sweeps.js +54 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +76 -30
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +17 -12
- package/dist/http/execution-context.d.ts +17 -43
- package/dist/http/execution-context.js +7 -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 +4 -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 +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +391 -67
- package/dist/http/owner-access.js +371 -35
- package/dist/http/principal-gate.d.ts +24 -81
- package/dist/http/principal-gate.js +24 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- 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 +21 -18
- package/dist/http/resume-legs.js +189 -129
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +25 -32
- 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 +70 -65
- 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 +15 -18
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- 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 +2 -0
- 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 +10 -19
- 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 +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- 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 +146 -231
- 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 +21 -20
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +136 -120
- 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 +39 -40
- package/dist/http/server.js +36 -11
- 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 +12 -0
- package/dist/http/stored-body-replay.js +2 -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 +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +29 -2
- package/dist/memory-scope.js +64 -15
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +6 -3
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- 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 +35 -16
- package/dist/model-entry-refusal.js +40 -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 +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- 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 +58 -38
- package/dist/observability/fail-open.js +60 -38
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +3 -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/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-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- 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 +67 -5
- package/dist/parked-decide.js +127 -5
- 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 +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
- package/dist/plugins/approval-ask-store-sql.js +41 -10
- 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 +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- 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/file-run-store.d.ts +63 -23
- package/dist/plugins/file-run-store.js +138 -83
- 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 +2 -2
- 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 +58 -23
- package/dist/plugins/local-checkpoint-store.js +195 -76
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- 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 +4 -2
- package/dist/plugins/local-engine-high-water.js +4 -1
- package/dist/plugins/local-session-store.d.ts +358 -125
- package/dist/plugins/local-session-store.js +824 -251
- 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 +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- 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 +186 -45
- package/dist/plugins/one-time-migrations.js +442 -119
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- 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 +1 -31
- package/dist/plugins/pg-pool.js +16 -7
- package/dist/plugins/remote-env-e2b.d.ts +7 -25
- package/dist/plugins/remote-env-e2b.js +34 -25
- package/dist/plugins/remote-env-host.d.ts +2 -9
- package/dist/plugins/remote-env-host.js +34 -22
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +107 -58
- package/dist/plugins/remote-env-local-docker.d.ts +148 -14
- package/dist/plugins/remote-env-local-docker.js +367 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- 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 -9
- package/dist/plugins/schema-consistency.js +212 -11
- 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 +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- 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 +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- 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 +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- 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 +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- 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/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- 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 +84 -15
- package/dist/plugins/store-backend.js +186 -55
- package/dist/plugins/store-contracts.d.ts +90 -30
- package/dist/plugins/store-contracts.js +22 -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 +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.js +23 -8
- 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/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/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 +5 -3
- package/dist/rules-consent.js +1 -0
- 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 +92 -80
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +26 -15
- package/dist/runs.js +39 -27
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +21 -5
- package/dist/server-secret-env.js +14 -4
- 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 +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- 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 +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +136 -20
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- 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/checkpoint-store-sql.d.ts +33 -28
- package/dist/stores-sql/checkpoint-store-sql.js +75 -44
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-a2a.js +3 -3
- package/dist/task-cwd.d.ts +20 -0
- package/dist/task-cwd.js +8 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-mcp.js +3 -3
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +18 -7
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +131 -129
- package/dist/tool-approval.js +189 -193
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -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 +55 -42
- package/dist/trace/project.js +52 -19
- package/dist/trace/redact.d.ts +123 -27
- package/dist/trace/redact.js +880 -260
- package/dist/trace/self-minted-wire.d.ts +487 -19
- package/dist/trace/self-minted-wire.js +172 -23
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- 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 +13 -16
- 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/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- 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/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- 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 +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +6 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- 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
|
@@ -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">;
|
|
@@ -147,10 +148,10 @@ export interface TaskRequestBody {
|
|
|
147
148
|
*
|
|
148
149
|
* 🔴 **类型 = core 的 `SkillSpec` 本体,不是它的手抄子集**([ref]):这里曾写死
|
|
149
150
|
* `{ name; description; content }` —— core 闭集六位里的三位,而 `manifest` / `files` / `baseDir`
|
|
150
|
-
* 三位在运行期一直是**收的**(
|
|
151
|
+
* 三位在运行期一直是**收的**(当年的受理门不判未知键 —— 7.148.0 起顶层也是闭合键表,`buildRunSkills` 原样透传到
|
|
151
152
|
* `TaskSpec.skills`)。一份会漂的手抄 = 声明面比真受理面**窄**,SDK 消费方按声明写代码就以为发不了,
|
|
152
153
|
* 而 core 加键(7.20.0 [ref] 的 `baseDir`)时这里连红都不会红。改成 core 本体后,闭集由 tsc 看守。
|
|
153
|
-
* ⚠️ 受理**判据**(
|
|
154
|
+
* ⚠️ 受理**判据**(键集 / 形 / 尺寸)在 `spec-fields.ts` 的 `skillItemIssue`(两道技能门同一只,读 `SKILL_FIELD_SHAPES`)——
|
|
154
155
|
* 类型说「哪些键存在」,门说「值合不合法」,两者不是一件事。
|
|
155
156
|
* (旧注里的「Caps: ≤10 skills, content ≤32KB each」两条帽早已随 [ref] / core 1.293 退役,一并纠正:
|
|
156
157
|
* 今天只剩 `content ≤ 1 MiB` 这一条 core 加载门孪生。) */
|
|
@@ -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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { loadConfig, type ServiceConfig } from "./config.js";
|
|
2
|
+
export { declareServerWithheldEnv } from "./server-secret-env.js";
|
|
2
3
|
export { composeExecutionLane, assertExecutionLaneInvariants, HTTP_SERVICE_LANE_ENTRY, type ExecutionLaneComposeCtx, type ExecutionLaneEntry } from "./boot/execution-lane.js";
|
|
3
4
|
export { createBrain } from "./brain.js";
|
|
4
5
|
export { createSessionStore } from "./plugins/session-store.js";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { loadConfig } from "./config.js";
|
|
2
|
+
export { declareServerWithheldEnv } from "./server-secret-env.js";
|
|
2
3
|
export { composeExecutionLane, assertExecutionLaneInvariants, HTTP_SERVICE_LANE_ENTRY } from "./boot/execution-lane.js";
|
|
3
4
|
export { createBrain } from "./brain.js";
|
|
4
5
|
export { createSessionStore } from "./plugins/session-store.js";
|
package/dist/key-resolver.d.ts
CHANGED
|
@@ -84,6 +84,38 @@ export type ModelKeyRef = Pick<Model, "name">;
|
|
|
84
84
|
export declare function createKeyResolver(modelApiKeyEnv: Record<string, string>, env?: NodeJS.ProcessEnv, modelApiKeys?: Record<string, string | SealedCustodyPoison>): ((model: ModelKeyRef) => Promise<{
|
|
85
85
|
apiKey: string;
|
|
86
86
|
} | undefined>) | undefined;
|
|
87
|
+
/** 两张 per-model 钥匙表(`config.modelApiKeyEnv` / `config.modelApiKeys` 的形;缺席读作空表)。 */
|
|
88
|
+
export interface ModelKeyTables {
|
|
89
|
+
readonly modelApiKeyEnv?: Readonly<Record<string, string>>;
|
|
90
|
+
readonly modelApiKeys?: Readonly<Record<string, string | SealedCustodyPoison>>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* 一只模型的**凭据身份**(不是值):它声明的钥匙来源是谁。
|
|
94
|
+
* · `sealed` —— 托管密钥的解封产物(明文,或解不开时的毒丸;与 `config.modelApiKeys` 的值同型)。本进程的托管店 boot 只读一次,同一密文恒解出同一产物 ⇒
|
|
95
|
+
* 持有产物就是持有那一代的身份;重贴 = 新身份。
|
|
96
|
+
* · `apiKeyEnv` —— 目录给它配的 env 变量**名**;值在取值那一刻按名读(同名轮换是同一身份)。
|
|
97
|
+
* 没有自有凭据 ⇒ `{}`。两张表至多一个条目有效(托管压过 env 引用,registry-core 互斥)。
|
|
98
|
+
*/
|
|
99
|
+
export interface CredentialIdentity {
|
|
100
|
+
readonly apiKeyEnv?: string;
|
|
101
|
+
readonly sealed?: string | SealedCustodyPoison;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 凭据身份的**唯一读法** —— key 链({@link resolveModelApiKey} / {@link modelKeyPoisonOf} / {@link createKeyResolver})取值前先问它,
|
|
105
|
+
* boot 焊死模型的两只座(降级壳焊住的目标、记忆整理席解到的条目)冻结的也是它的读数:**焊死的 Model 与它的凭据身份同一代**,
|
|
106
|
+
* 目录把两者一起换掉之后、重启之前,座仍打焊死的端点、带焊死那一代的身份(值按身份现取:env 引用同名轮换仍热)。身份变了 ⇒ 那只座的重启片签
|
|
107
|
+
* (指纹读 {@link credentialIdentityFingerprint})。
|
|
108
|
+
*/
|
|
109
|
+
export declare function credentialIdentityOf(tables: ModelKeyTables, modelName: string): CredentialIdentity;
|
|
110
|
+
/**
|
|
111
|
+
* 凭据身份的**非明文**读数 —— 重启片两侧读数里凭据那一位的唯一铸法(明文是活秘密:只取摘要,绝不进日志 / 序列化面)。
|
|
112
|
+
* `apiKeyEnv` = 变量名(值热、同名轮换不签);`sealedKey`:缺席 ⇒ `null`;毒丸 ⇒ `{ poisoned, reason }`(不含检测时刻 —— 每次 apply 都会重铸);
|
|
113
|
+
* 明文 ⇒ `{ digest }`(sha256 前 16 位十六进制;同一明文重封一次 = 同一把 key ⇒ 不签)。
|
|
114
|
+
*/
|
|
115
|
+
export declare function credentialIdentityFingerprint(identity: CredentialIdentity): {
|
|
116
|
+
readonly apiKeyEnv: string | null;
|
|
117
|
+
readonly sealedKey: unknown;
|
|
118
|
+
};
|
|
87
119
|
/** 「这只模型声明的钥匙来源今天拿不到」⇒ 那一只毒丸;拿得到 / 没声明 ⇒ `undefined`。能力面的配对标注据它答 `"unknown"`(判别,不是 catch)。 */
|
|
88
120
|
export declare function modelKeyPoisonOf(modelName: string, modelApiKeyEnv: Record<string, string>, env?: NodeJS.ProcessEnv, modelApiKeys?: Record<string, string | SealedCustodyPoison>): ModelKeyPoison | undefined;
|
|
89
121
|
/**
|
package/dist/key-resolver.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
export function modelKeyPoison(p) {
|
|
2
3
|
const at = new Date().toISOString();
|
|
3
4
|
if (p.source === "sealed")
|
|
@@ -50,16 +51,29 @@ export function createKeyResolver(modelApiKeyEnv, env = process.env, modelApiKey
|
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
function chainLookup(modelName, modelApiKeyEnv, env, modelApiKeys) {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
return { kind: "poison", poison: sealed };
|
|
56
|
-
if (
|
|
57
|
-
return { kind: "key", key: sealed };
|
|
58
|
-
const envName = modelApiKeyEnv[modelName];
|
|
59
|
-
if (!envName)
|
|
54
|
+
const identity = credentialIdentityOf({ modelApiKeyEnv, modelApiKeys }, modelName);
|
|
55
|
+
if (identity.sealed !== undefined)
|
|
56
|
+
return isModelKeyPoison(identity.sealed) ? { kind: "poison", poison: identity.sealed } : { kind: "key", key: identity.sealed };
|
|
57
|
+
if (identity.apiKeyEnv === undefined)
|
|
60
58
|
return { kind: "undeclared" };
|
|
61
|
-
const value = env[
|
|
62
|
-
return value ? { kind: "key", key: value } : { kind: "poison", poison: modelKeyPoison({ source: "env", reason: "env_missing", apiKeyEnv:
|
|
59
|
+
const value = env[identity.apiKeyEnv];
|
|
60
|
+
return value ? { kind: "key", key: value } : { kind: "poison", poison: modelKeyPoison({ source: "env", reason: "env_missing", apiKeyEnv: identity.apiKeyEnv }) };
|
|
61
|
+
}
|
|
62
|
+
export function credentialIdentityOf(tables, modelName) {
|
|
63
|
+
const sealed = tables.modelApiKeys !== undefined && Object.hasOwn(tables.modelApiKeys, modelName) ? tables.modelApiKeys[modelName] : undefined;
|
|
64
|
+
if (isModelKeyPoison(sealed) || typeof sealed === "string" && sealed !== "")
|
|
65
|
+
return { sealed };
|
|
66
|
+
const apiKeyEnv = tables.modelApiKeyEnv !== undefined && Object.hasOwn(tables.modelApiKeyEnv, modelName) ? tables.modelApiKeyEnv[modelName] : undefined;
|
|
67
|
+
return typeof apiKeyEnv === "string" && apiKeyEnv !== "" ? { apiKeyEnv } : {};
|
|
68
|
+
}
|
|
69
|
+
export function credentialIdentityFingerprint(identity) {
|
|
70
|
+
const sealed = identity.sealed;
|
|
71
|
+
const sealedKey = sealed === undefined
|
|
72
|
+
? null
|
|
73
|
+
: isModelKeyPoison(sealed)
|
|
74
|
+
? { poisoned: modelKeyPoisonIdentity(sealed), reason: sealed.reason }
|
|
75
|
+
: { digest: createHash("sha256").update(sealed, "utf8").digest("hex").slice(0, 16) };
|
|
76
|
+
return { apiKeyEnv: identity.apiKeyEnv ?? null, sealedKey };
|
|
63
77
|
}
|
|
64
78
|
export function modelKeyPoisonOf(modelName, modelApiKeyEnv, env = process.env, modelApiKeys = {}) {
|
|
65
79
|
const r = chainLookup(modelName, modelApiKeyEnv, env, modelApiKeys);
|
package/dist/leader/diffup.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { safeRev, DEFAULT_MAX_DIFF_BYTES } from "./diffout.js";
|
|
2
2
|
import { OBJECT_STORE_IO_TIMEOUT_MS } from "../plugins/blob-backend.js";
|
|
3
|
+
import { createEgressFetch } from "../egress-redirect.js";
|
|
3
4
|
export function buildUploadScript(p) {
|
|
4
5
|
if (!safeRev(p.baseSha))
|
|
5
6
|
throw new Error(`buildUploadScript: unsafe baseSha ${JSON.stringify(p.baseSha)}`);
|
|
@@ -114,7 +115,7 @@ export function buildUploadLoopScript(p) {
|
|
|
114
115
|
}
|
|
115
116
|
export async function fetchUploadedDiff(getUrl, opts = {}) {
|
|
116
117
|
const maxBytes = opts.maxBytes ?? DEFAULT_MAX_DIFF_BYTES;
|
|
117
|
-
const f = opts.fetchImpl
|
|
118
|
+
const f = createEgressFetch("declare the final object-store address as MINIO_ENDPOINT / S3_ENDPOINT", opts.fetchImpl);
|
|
118
119
|
let res;
|
|
119
120
|
try {
|
|
120
121
|
res = await f(getUrl, { signal: AbortSignal.timeout(OBJECT_STORE_IO_TIMEOUT_MS) });
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { LeaderResult } from "./leader.js";
|
|
2
2
|
import { type LeaderRunRecord, type LeaderRunStatus, type NewLeaderRun, type LeaderRunTerminal } from "../plugins/leader-run-store-sql.js";
|
|
3
3
|
import { type IdemCaller } from "../http/idempotency.js";
|
|
4
|
+
import type { Subject } from "../owner-brands.js";
|
|
5
|
+
import type { RunIdentity } from "../identity-source.js";
|
|
6
|
+
import type { LeaderParkExpiry } from "./wire.js";
|
|
4
7
|
/**
|
|
5
8
|
* endpoint 消费的 store 面(结构型,不是 nominal union):真实现是 `SqlLeaderRunStore` 的两个方言孪生,
|
|
6
9
|
* 测试用进程内假件。窄到只有 endpoint 真调的三个方法 —— 端点不该看见店的其余口。
|
|
@@ -14,6 +17,8 @@ export interface LeaderRunStore {
|
|
|
14
17
|
/** 按提交幂等键(已 scope 的定宽 hash)读行 —— `GET /v1/leader?idempotencyKey=` 的读口。 */
|
|
15
18
|
getByIdem(idemKey: string): Promise<LeaderRunRecord | undefined>;
|
|
16
19
|
finishRun(id: string, patch: LeaderRunTerminal): Promise<boolean>;
|
|
20
|
+
/** 翻耐久取消旗(只翻 `running` 行;回执 = 翻没翻)。驱动副本经 `getRun` 读它(一次读拿到状态 + 旗)。 */
|
|
21
|
+
requestCancel(id: string): Promise<boolean>;
|
|
17
22
|
}
|
|
18
23
|
export interface LeaderRequestBody {
|
|
19
24
|
/** The task to decompose + execute (the Planner turns it into N disjoint sub-tasks). */
|
|
@@ -36,6 +41,10 @@ export interface LeaderRun {
|
|
|
36
41
|
/** BL-4: the principal that submitted this run (null = anonymous/single-tenant). The GET is owner-checked so
|
|
37
42
|
* an owned run is visible ONLY to its owner (404 to others — no existence oracle), like GET /v1/runs/:id. */
|
|
38
43
|
owner?: string | null;
|
|
44
|
+
/** 降级臂的取消旗(店在场时以库上的旗为准,本地这一格只服务降级臂的读面)。 */
|
|
45
|
+
cancelRequested: boolean;
|
|
46
|
+
/** 取消口停下的终局带 `cancelled`。 */
|
|
47
|
+
errorCode?: LeaderRunTerminal["errorCode"];
|
|
39
48
|
}
|
|
40
49
|
export interface LeaderEndpoint {
|
|
41
50
|
/** Returns a {status,body} to send, or null if the (method,url) is not a leader route. Kicks the background
|
|
@@ -45,7 +54,9 @@ export interface LeaderEndpoint {
|
|
|
45
54
|
* header; `GET /v1/leader`: the `idempotencyKey` query — the read port "which leader run did this key create"; scoped by the
|
|
46
55
|
* caller's identity bit `principal ?? source` before it reaches the store — the one key minter `idemKeyOf(raw, caller, "leader")`).
|
|
47
56
|
* ASYNC because the durable arm reads/writes SQL. */
|
|
48
|
-
handle(method: string, url: string, body: unknown, caller?: IdemCaller, idempotencyKey?: string | null
|
|
57
|
+
handle(method: string, url: string, body: unknown, caller?: IdemCaller, idempotencyKey?: string | null,
|
|
58
|
+
/** POST 受理时的身份元组(路由经 `runIdentityOf` 铸;缺席 = `null` = 不合格)。只写进行,不上 wire。 */
|
|
59
|
+
identity?: RunIdentity | null): Promise<{
|
|
49
60
|
status: number;
|
|
50
61
|
body: object;
|
|
51
62
|
} | null>;
|
|
@@ -59,7 +70,9 @@ export interface LeaderEndpoint {
|
|
|
59
70
|
* With a store in place this Map holds only the runs THIS replica is driving. Exposed for tests. */
|
|
60
71
|
runs: Map<string, LeaderRun>;
|
|
61
72
|
}
|
|
62
|
-
|
|
73
|
+
/** 取消终局的 `error` 句(机读位是 `errorCode: "cancelled"`)。 */
|
|
74
|
+
export declare const LEADER_RUN_CANCELLED_ERROR = "leader run cancelled (POST /v1/leader/:id/cancel): it stopped at an abort checkpoint before any push";
|
|
75
|
+
export declare function createLeaderEndpoint(runLeader: (body: LeaderRequestBody, signal: AbortSignal) => Promise<LeaderResult>, opts: {
|
|
63
76
|
logger?: {
|
|
64
77
|
info?: (m: string, x?: Record<string, unknown>) => void;
|
|
65
78
|
error?: (m: string, x?: Record<string, unknown>) => void;
|
|
@@ -73,8 +86,16 @@ export declare function createLeaderEndpoint(runLeader: (body: LeaderRequestBody
|
|
|
73
86
|
requiredFields?: readonly string[];
|
|
74
87
|
/** [ref] 车4 件1:durable 登记表。缺席 ⇒ 显式的单副本内存降级臂(见文件头注)。 */
|
|
75
88
|
store?: LeaderRunStore;
|
|
76
|
-
/** [ref] RH-3:「这个调用方读得到这一行 leader run 吗」—— 属主存取器的判官形(`http/owner-access.ts` 的 `
|
|
77
|
-
* 必填:本模块不自判属主(修前手抄 `owner == null || owner === requester`,缺 [ref] C8 窄互认臂而注称 mirrors
|
|
78
|
-
ownerVisible: (
|
|
89
|
+
/** [ref] RH-3:「这个调用方读得到这一行 leader run 吗」—— 属主存取器的判官形(`http/owner-access.ts` 的 `seesRunAs("run.leader")`,boot 装一次)。
|
|
90
|
+
* 必填:本模块不自判属主(修前手抄 `owner == null || owner === requester`,缺 [ref] C8 窄互认臂而注称 mirrors admitRunRow),读面与幂等重放同读它。 */
|
|
91
|
+
ownerVisible: (subject: Subject | null | undefined, owner: string | null | undefined) => boolean;
|
|
92
|
+
/** 过期一组 worker 会话的待决停驻(`wire.ts` 的 `createLeaderParkExpirer`,boot 在有 checkpoint 店时递)。缺席 = 本部署没有 checkpoint 店 ⇒
|
|
93
|
+
* worker 由构造即不可能停驻(durable spec 要那只店),没有可过期的东西。 */
|
|
94
|
+
expireWorkerParks?: (workers: ReadonlyArray<{
|
|
95
|
+
readonly workerId: string;
|
|
96
|
+
readonly sessionId: string;
|
|
97
|
+
}>) => Promise<LeaderParkExpiry>;
|
|
98
|
+
/** 旗读拍距(ms)。缺席 = `LIVENESS_HEARTBEAT_MS`(与 run 心跳同一个数);测试注入短拍。 */
|
|
99
|
+
cancelPollMs?: number;
|
|
79
100
|
}): LeaderEndpoint;
|
|
80
101
|
//# sourceMappingURL=endpoint.d.ts.map
|