@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
|
@@ -11,7 +11,7 @@ export const DRAIN_CAUSE_COUNTS_AS_FIRST_STOP_SIGNAL = {
|
|
|
11
11
|
"self-exit:attachment": false,
|
|
12
12
|
};
|
|
13
13
|
export function blockingInflightOf(b) {
|
|
14
|
-
return b.http + b.leader;
|
|
14
|
+
return b.http + b.leader + b.backgroundAgents;
|
|
15
15
|
}
|
|
16
16
|
export function inflightTotal(b) {
|
|
17
17
|
return blockingInflightOf(b) + b.sessionResident;
|
|
@@ -47,6 +47,19 @@ export interface FleetTaskRow {
|
|
|
47
47
|
* 改写成同一串;出生点校验过的字符集里也没有可脱敏的形。残余(已披露)= 有人把真凭据当队友名写进
|
|
48
48
|
* `Agent({name})`,那一串原样上 fleet 面。展示名 `name` 照旧脱敏。 */
|
|
49
49
|
agentName?: string;
|
|
50
|
+
/** 这一行**跑在哪个模型上** —— core `BackgroundChildEvent.model`(spawn / tick 帧述它)**逐字**过境:引擎在 spawn 判定点解析出的
|
|
51
|
+
* 模型(per-call / agent 定义 / 继承;能解析到服务目录的就是服务那个目录 id)。它**不是**同一子代 `task_progress.model`
|
|
52
|
+
* (那条腿自己 prepare 出的 id)—— 后者才是权威读数,本键是行级便利位:父 run 的活流结束后只剩 fleet 行的消费端,
|
|
53
|
+
* 从这里读得到,不必另存一份副本(一个事实一个源)。
|
|
54
|
+
* 🔴 **缺席是事实,不是缺口**:引擎没述(委派链上没有任何一处点名模型 ⇒ 子代跑 `subagent` 角色、具体 id 到它自己 prepare 才定;
|
|
55
|
+
* 留存账本的唤醒腿帧不带;老引擎)⇒ 键**不发** —— 不铸、不回落(不拿别处读到的值顶,空串也不补;**空串视同没述**)。
|
|
56
|
+
* 🔴 **一个事实一个源 = 帧本身 + 总线的 MERGE 底座**,发布方不私存副本:start 与 tick 帧述它;terminal 帧本身不述(core 7.66.0),
|
|
57
|
+
* finish 行带的是总线上这一行**已有**的值 —— 与 `name` / `agentType` 同一个底座,所以行已离场之后才到的终态帧(陈述级退场后)是稀疏底座,
|
|
58
|
+
* 三者同缺席。复活(同 id 再 spawn)是新的一代:行已随终态离场,新一代的值只来自这一代引擎说过的话。前代迟到的 tick 被总线的判代闸
|
|
59
|
+
* 整帧丢掉,连同它带的 `model`。
|
|
60
|
+
* 未署名行(无 `sessionId`)在 `?session=` 降权投影里被擦(别的会话的子代跑什么模型 = 会话内容,与 `agentType` 同判)。
|
|
61
|
+
* ADDITIVE / tolerate-absent。 */
|
|
62
|
+
model?: string;
|
|
50
63
|
/** Owning principal (= the run's scope). The `/v1/fleet/stream` route filters to the caller's scope (owner-gated)
|
|
51
64
|
* unless the caller is fleet-wide (operator / trace-token). NOT rendered — a tenant-isolation field. */
|
|
52
65
|
scope?: string;
|
|
@@ -134,8 +147,10 @@ export interface FleetTaskRow {
|
|
|
134
147
|
* (`${runId} ${childTaskId}`)。此形只在**没有 BCE 真行**的前台 delegation 上保留(同步腿委派的
|
|
135
148
|
* 子代不过 background-child registry ⇒ 不让位就没有行);tick 点名的是 BCE 真行(后台子代的 tick 带它的行 id;workflow agent 的
|
|
136
149
|
* tick 带会话 id、经让位登记簿换成行 id),本车道**让位不铸**(双生行退役)。
|
|
137
|
-
*
|
|
138
|
-
*
|
|
150
|
+
* 🔴 **这是契约形,不是过渡形**:引擎的契约是前台(同步)委派的子代 —— plain 与 fork 两腿 —— 不登 background-child registry、
|
|
151
|
+
* 没有 BCE 帧,它在舰队上的身份就是宿主由 `task_progress` 派生的这一行(`taskId` = 子会话 id)。一个子代恰一个行写者,由 id 形决定:
|
|
152
|
+
* 带 `sourceLane:"run-leg"` 的行与 a\* 行**不会**同时描述同一个 agent(偏离记录:引擎加「前台 → 后台移交」动词那一天,前台子代改登 registry 行,
|
|
153
|
+
* 本车道随之退役)。消费端不需要再自己发明「复合 id 首段==parentId 且撞 (parentId,name)」那类集合级判据(cli 侧的防御税)。
|
|
139
154
|
* ADDITIVE / tolerate-absent。 */
|
|
140
155
|
sourceLane?: "run-leg";
|
|
141
156
|
/**
|
|
@@ -713,7 +728,10 @@ export declare function fleetRunResiduals(result: {
|
|
|
713
728
|
toolCalls?: number;
|
|
714
729
|
costMicroUsd?: number;
|
|
715
730
|
};
|
|
716
|
-
} | null | undefined
|
|
731
|
+
} | null | undefined,
|
|
732
|
+
/** 这条 run 的失败码 —— 调用方手上的那一份:run 行喂入的 = 行的码列(`RunRecord.errorCode`,唯一读法;收割 / 判决行的 `result` 是空的,码只在列上),
|
|
733
|
+
* 活结果喂入的 = `failureCodeOf(result.terminal)`。本函数不再从 blob 读码。 */
|
|
734
|
+
errorCode: string | null | undefined): FleetRunResiduals;
|
|
717
735
|
/**
|
|
718
736
|
* [ref]-B (core 1.240.0) — the PROCESS-LEVEL background-child fleet publisher, wired once
|
|
719
737
|
* onto `RunnerDeps.onBackgroundChildEvent`. Unlike {@link fleetRunPublisher} (per-leg: dies at leg settle —
|
package/dist/fleet/fleet-bus.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { EventEmitter } from "node:events";
|
|
2
2
|
import { DURABLE_AGENT_HANDLE_RE, deriveAgentDisplayStatus, runParkedOf } from "@sema-agent/core";
|
|
3
|
-
import { persistedPlaneOf } from "../terminal.js";
|
|
4
3
|
import { takeWorkspaceSnapshotFailure } from "./workspace-snapshot-residual.js";
|
|
5
4
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
6
5
|
import { redactSecrets } from "../trace/redact.js";
|
|
@@ -280,6 +279,30 @@ export function fleetRunPublisher(bus, run) {
|
|
|
280
279
|
return u.totalTokens;
|
|
281
280
|
return (u.totalInputTokens ?? 0) + (u.outputTokens ?? 0);
|
|
282
281
|
};
|
|
282
|
+
const mintRunLegRow = (taskId, ev, parentId) => {
|
|
283
|
+
const cid = childId(taskId);
|
|
284
|
+
if (yieldToBackgroundChildLane(taskId, cid, ev.name))
|
|
285
|
+
return;
|
|
286
|
+
children.add(cid);
|
|
287
|
+
const childName = ev.name !== undefined ? redactSecrets(ev.name) : undefined;
|
|
288
|
+
if (!childStartedAt.has(cid))
|
|
289
|
+
childStartedAt.set(cid, Date.now());
|
|
290
|
+
const toolUses = toolUsesOf(ev.usage);
|
|
291
|
+
bus.publishTask({
|
|
292
|
+
id: cid,
|
|
293
|
+
sourceLane: "run-leg",
|
|
294
|
+
...(childName !== undefined ? { name: childName, agentType: childName } : {}),
|
|
295
|
+
parentId,
|
|
296
|
+
scope: run.scope,
|
|
297
|
+
...sessionField,
|
|
298
|
+
...workflowRunIdField(ev),
|
|
299
|
+
status: tickStatus(ev.status),
|
|
300
|
+
tokens: sumTokens(ev.usage),
|
|
301
|
+
...(typeof ev.seq === "number" ? { cycleSeq: ev.seq } : {}),
|
|
302
|
+
...(toolUses !== undefined ? { toolUses } : {}),
|
|
303
|
+
elapsedMs: Date.now() - childStartedAt.get(cid),
|
|
304
|
+
});
|
|
305
|
+
};
|
|
283
306
|
return {
|
|
284
307
|
onStart() {
|
|
285
308
|
bus.publishTask({ id: run.runId, ...(run.name !== undefined ? { name: run.name } : {}), ...(run.description ? { description: run.description } : {}), scope: run.scope, ...sessionField, status: "running", tokens: 0, elapsedMs: 0 });
|
|
@@ -299,14 +322,7 @@ export function fleetRunPublisher(bus, run) {
|
|
|
299
322
|
bus.publishTask({ id: run.runId, tokens, elapsedMs: Date.now() - startedAt });
|
|
300
323
|
}
|
|
301
324
|
else if (ev.type === "task_progress" && ev.taskId) {
|
|
302
|
-
|
|
303
|
-
if (yieldToBackgroundChildLane(ev.taskId, cid, ev.name))
|
|
304
|
-
return;
|
|
305
|
-
children.add(cid);
|
|
306
|
-
const childName = ev.name !== undefined ? redactSecrets(ev.name) : undefined;
|
|
307
|
-
if (!childStartedAt.has(cid))
|
|
308
|
-
childStartedAt.set(cid, Date.now());
|
|
309
|
-
bus.publishTask({ id: cid, sourceLane: "run-leg", ...(childName !== undefined ? { name: childName, agentType: childName } : {}), parentId: run.runId, scope: run.scope, ...sessionField, ...workflowRunIdField(ev), status: tickStatus(ev.status), tokens: sumTokens(ev.usage), ...(typeof ev.seq === "number" ? { cycleSeq: ev.seq } : {}), ...(() => { const t = toolUsesOf(ev.usage); return t !== undefined ? { toolUses: t } : {}; })(), elapsedMs: Date.now() - childStartedAt.get(cid) });
|
|
325
|
+
mintRunLegRow(ev.taskId, ev, run.runId);
|
|
310
326
|
}
|
|
311
327
|
else if (ev.type === "tool_start" && ev.toolName) {
|
|
312
328
|
bus.publishTask({ id: run.runId, description: ev.toolName });
|
|
@@ -317,15 +333,7 @@ export function fleetRunPublisher(bus, run) {
|
|
|
317
333
|
return;
|
|
318
334
|
if (ev.type !== "task_progress" || !ev.taskId)
|
|
319
335
|
return;
|
|
320
|
-
|
|
321
|
-
if (yieldToBackgroundChildLane(ev.taskId, cid, ev.name))
|
|
322
|
-
return;
|
|
323
|
-
children.add(cid);
|
|
324
|
-
const parentId = ev.parentTaskId && ev.parentTaskId !== run.rootTaskId ? (backgroundRowOf(ev.parentTaskId) ?? childId(ev.parentTaskId)) : run.runId;
|
|
325
|
-
const fwdName = ev.name !== undefined ? redactSecrets(ev.name) : undefined;
|
|
326
|
-
if (!childStartedAt.has(cid))
|
|
327
|
-
childStartedAt.set(cid, Date.now());
|
|
328
|
-
bus.publishTask({ id: cid, sourceLane: "run-leg", ...(fwdName !== undefined ? { name: fwdName, agentType: fwdName } : {}), parentId, scope: run.scope, ...sessionField, ...workflowRunIdField(ev), status: tickStatus(ev.status), tokens: sumTokens(ev.usage), ...(typeof ev.seq === "number" ? { cycleSeq: ev.seq } : {}), ...(() => { const t = toolUsesOf(ev.usage); return t !== undefined ? { toolUses: t } : {}; })(), elapsedMs: Date.now() - childStartedAt.get(cid) });
|
|
336
|
+
mintRunLegRow(ev.taskId, ev, ev.parentTaskId && ev.parentTaskId !== run.rootTaskId ? (backgroundRowOf(ev.parentTaskId) ?? childId(ev.parentTaskId)) : run.runId);
|
|
329
337
|
},
|
|
330
338
|
onTerminal(status, residuals) {
|
|
331
339
|
settledLeg = true;
|
|
@@ -350,9 +358,10 @@ export function fleetRunPublisher(bus, run) {
|
|
|
350
358
|
},
|
|
351
359
|
};
|
|
352
360
|
}
|
|
353
|
-
export function fleetRunResiduals(result) {
|
|
361
|
+
export function fleetRunResiduals(result, errorCode) {
|
|
362
|
+
const stoppedBy = errorCode === "cancelled" ? { stoppedBy: "user" } : {};
|
|
354
363
|
if (!result)
|
|
355
|
-
return
|
|
364
|
+
return stoppedBy;
|
|
356
365
|
const s = result.stats;
|
|
357
366
|
const usage = s
|
|
358
367
|
? {
|
|
@@ -364,7 +373,7 @@ export function fleetRunResiduals(result) {
|
|
|
364
373
|
: {};
|
|
365
374
|
return {
|
|
366
375
|
...(Object.keys(usage).length > 0 ? { usage } : {}),
|
|
367
|
-
...
|
|
376
|
+
...stoppedBy,
|
|
368
377
|
...(result.sessionId ? { transcriptId: result.sessionId } : {}),
|
|
369
378
|
...(takeWorkspaceSnapshotFailure(result.sessionId) ? { workspaceSnapshot: "failed" } : {}),
|
|
370
379
|
};
|
|
@@ -426,7 +435,7 @@ export function fleetBackgroundChildPublisher(bus, log) {
|
|
|
426
435
|
}
|
|
427
436
|
return match !== undefined ? { id: match, resolved: true } : { id: parentInput, resolved: false };
|
|
428
437
|
};
|
|
429
|
-
const rowTags = (m) => {
|
|
438
|
+
const rowTags = (m, e) => {
|
|
430
439
|
let parentId;
|
|
431
440
|
const parentInput = m.parentTaskId ?? m.parentSessionLink;
|
|
432
441
|
if (parentInput) {
|
|
@@ -447,6 +456,7 @@ export function fleetBackgroundChildPublisher(bus, log) {
|
|
|
447
456
|
...(parentId !== undefined ? { parentId } : {}),
|
|
448
457
|
...(m.workflowRunId !== undefined ? { workflowRunId: m.workflowRunId } : {}),
|
|
449
458
|
...(m.parentToolCallId !== undefined ? { parentToolCallId: m.parentToolCallId } : {}),
|
|
459
|
+
...(e.model ? { model: e.model } : {}),
|
|
450
460
|
...(m.spawnedAt !== undefined ? { startedAt: m.spawnedAt, elapsedMs: Date.now() - m.spawnedAt } : {}),
|
|
451
461
|
};
|
|
452
462
|
};
|
|
@@ -485,7 +495,7 @@ export function fleetBackgroundChildPublisher(bus, log) {
|
|
|
485
495
|
remember(e.taskId, m);
|
|
486
496
|
joinWorkflowAgentNames(e, m);
|
|
487
497
|
const displayName = e.description ?? e.name;
|
|
488
|
-
bus.publishTask({ id: e.taskId, ...(displayName !== undefined ? { name: redactSecrets(displayName) } : {}), ...(e.agentType ? { agentType: redactSecrets(e.agentType) } : {}), ...(e.spawnName ? { agentName: e.spawnName } : {}), ...rowTags(m), status: "running", tokens: 0, ...(typeof e.seq === "number" ? { cycleSeq: e.seq } : {}), ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
|
|
498
|
+
bus.publishTask({ id: e.taskId, ...(displayName !== undefined ? { name: redactSecrets(displayName) } : {}), ...(e.agentType ? { agentType: redactSecrets(e.agentType) } : {}), ...(e.spawnName ? { agentName: e.spawnName } : {}), ...rowTags(m, e), status: "running", tokens: 0, ...(typeof e.seq === "number" ? { cycleSeq: e.seq } : {}), ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
|
|
489
499
|
dlog("bg_child_event", { kind: "spawn", taskId: e.taskId, sessionScoped: e.sessionScoped, scope: m.tenantScope, hostSessionId: m.hostSessionId ?? null, parentTaskId: m.parentTaskId ?? null });
|
|
490
500
|
};
|
|
491
501
|
const handleTick = (e, m) => {
|
|
@@ -498,12 +508,12 @@ export function fleetBackgroundChildPublisher(bus, log) {
|
|
|
498
508
|
const currentTool = e.currentTool
|
|
499
509
|
? { toolName: e.currentTool.toolName, ...(e.currentTool.target !== undefined ? { target: redactSecrets(e.currentTool.target).slice(0, 300) } : {}) }
|
|
500
510
|
: undefined;
|
|
501
|
-
bus.publishTask({ id: e.taskId, ...rowTags(m), status: "running", ...(tokens !== undefined ? { tokens } : {}), ...(name ? { name } : {}), ...(agentType ? { agentType } : {}), ...(agentName ? { agentName } : {}), ...(currentAction ? { currentAction } : {}), ...(currentTool ? { currentTool } : {}), ...(typeof e.seq === "number" ? { cycleSeq: e.seq } : {}), ...(e.usage?.toolUses !== undefined ? { toolUses: e.usage.toolUses } : {}), ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
|
|
511
|
+
bus.publishTask({ id: e.taskId, ...rowTags(m, e), status: "running", ...(tokens !== undefined ? { tokens } : {}), ...(name ? { name } : {}), ...(agentType ? { agentType } : {}), ...(agentName ? { agentName } : {}), ...(currentAction ? { currentAction } : {}), ...(currentTool ? { currentTool } : {}), ...(typeof e.seq === "number" ? { cycleSeq: e.seq } : {}), ...(e.usage?.toolUses !== undefined ? { toolUses: e.usage.toolUses } : {}), ...(e.transcriptId ? { transcriptId: e.transcriptId } : {}) });
|
|
502
512
|
};
|
|
503
513
|
const handleTerminal = (e, m) => {
|
|
504
514
|
const status = e.status === "completed" ? "completed" : e.status === "killed" ? "killed" : "failed";
|
|
505
515
|
bus.publishTask({
|
|
506
|
-
id: e.taskId, ...rowTags(m), status,
|
|
516
|
+
id: e.taskId, ...rowTags(m, e), status,
|
|
507
517
|
...(e.spawnName ? { agentName: e.spawnName } : {}),
|
|
508
518
|
...(typeof e.seq === "number" ? { cycleSeq: e.seq } : {}),
|
|
509
519
|
...(e.stoppedBy ? { stoppedBy: e.stoppedBy } : {}),
|
|
@@ -48,7 +48,7 @@ export function createFleetReconciler(deps) {
|
|
|
48
48
|
const upgradeWatched = (id, w, rec, trigger) => {
|
|
49
49
|
if (!watch.delete(id))
|
|
50
50
|
return false;
|
|
51
|
-
deps.bus.publishTask({ ...w.row, status: runStatusToFleet(rec.status), retiredBy: "reconcile", ...fleetRunResiduals(rec.result) });
|
|
51
|
+
deps.bus.publishTask({ ...w.row, status: runStatusToFleet(rec.status), retiredBy: "reconcile", ...fleetRunResiduals(rec.result, rec.errorCode) });
|
|
52
52
|
deps.bus.removeTask(id, { ...(w.row.cycleSeq !== undefined ? { cycleSeq: w.row.cycleSeq } : {}) });
|
|
53
53
|
lastFrameAt.delete(id);
|
|
54
54
|
deps.metrics?.inc("fleet_rows_reconciled_total", { disposition: "retired_deferred", trigger });
|
|
@@ -159,7 +159,7 @@ export function createFleetReconciler(deps) {
|
|
|
159
159
|
id: row.id,
|
|
160
160
|
status: runStatusToFleet(rec.status),
|
|
161
161
|
retiredBy: "reconcile",
|
|
162
|
-
...fleetRunResiduals(rec.result),
|
|
162
|
+
...fleetRunResiduals(rec.result, rec.errorCode),
|
|
163
163
|
});
|
|
164
164
|
parentsOnBus.delete(row.id);
|
|
165
165
|
deps.bus.removeTask(row.id, { ...(row.cycleSeq !== undefined ? { cycleSeq: row.cycleSeq } : {}) });
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { readFileSync,
|
|
1
|
+
import { readFileSync, rmSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { atomicWriteFileSync } from "../plugins/owner-only-file-mode.js";
|
|
3
4
|
import { SERVING_LEASE_TTL_DEFAULT_MS, readServingLeaseResponse } from "@sema-agent/settings-schema/fleet";
|
|
4
5
|
import { centerFetch } from "../web-admin-client/center-request.js";
|
|
5
6
|
import { recordFailOpen } from "../observability/fail-open.js";
|
|
6
7
|
import { leaseDrainActionId } from "./drain-entry.js";
|
|
8
|
+
import { readUpstreamJson } from "../upstream-body.js";
|
|
7
9
|
export const SERVING_LEASE_FETCH_TIMEOUT_MS = 5_000;
|
|
8
10
|
export const SERVING_LEASE_DENIED_FILE = "fleet-serving-lease-denied.json";
|
|
9
11
|
const RENEW_MIN_INTERVAL_MS = 1_000;
|
|
@@ -37,7 +39,6 @@ function denialLeadOf(d) {
|
|
|
37
39
|
export function createServingLeaseClient(o) {
|
|
38
40
|
const mono = o.clock?.mono ?? (() => performance.now());
|
|
39
41
|
const epoch = o.clock?.epoch ?? Date.now;
|
|
40
|
-
const f = o.fetchImpl ?? fetch;
|
|
41
42
|
const stickyPath = o.dataRoot === undefined ? undefined : join(o.dataRoot, SERVING_LEASE_DENIED_FILE);
|
|
42
43
|
let capability;
|
|
43
44
|
const enabled = () => capability?.announced === true;
|
|
@@ -66,10 +67,8 @@ export function createServingLeaseClient(o) {
|
|
|
66
67
|
return false;
|
|
67
68
|
}
|
|
68
69
|
const record = { worker: o.center.worker, generation: o.generation, reason, at: epoch() };
|
|
69
|
-
const tmp = `${stickyPath}.tmp-${process.pid}`;
|
|
70
70
|
try {
|
|
71
|
-
|
|
72
|
-
renameSync(tmp, stickyPath);
|
|
71
|
+
atomicWriteFileSync(stickyPath, `${JSON.stringify(record)}\n`, { durability: "best-effort" });
|
|
73
72
|
return true;
|
|
74
73
|
}
|
|
75
74
|
catch (err) {
|
|
@@ -105,9 +104,9 @@ export function createServingLeaseClient(o) {
|
|
|
105
104
|
let reading;
|
|
106
105
|
let why = "";
|
|
107
106
|
try {
|
|
108
|
-
const { res } = await centerFetch(o.center, { kind: "fleet-serving-lease" }, { method: "POST", json: request, timeoutMs: SERVING_LEASE_FETCH_TIMEOUT_MS, fetchImpl:
|
|
107
|
+
const { res } = await centerFetch(o.center, { kind: "fleet-serving-lease" }, { method: "POST", json: request, timeoutMs: SERVING_LEASE_FETCH_TIMEOUT_MS, fetchImpl: o.fetchImpl });
|
|
109
108
|
if (res.ok) {
|
|
110
|
-
reading = readServingLeaseResponse(await res
|
|
109
|
+
reading = readServingLeaseResponse(await readUpstreamJson(res).catch(() => undefined));
|
|
111
110
|
if (reading === undefined)
|
|
112
111
|
why = "reply is not a serving-lease verdict";
|
|
113
112
|
}
|
package/dist/fleet-client.js
CHANGED
|
@@ -4,6 +4,7 @@ import { centerFetch, centerLaneConfigured } from "./web-admin-client/center-req
|
|
|
4
4
|
import { recordFailOpen } from "./observability/fail-open.js";
|
|
5
5
|
import { createIdentityBins, pinAccountingIdentity } from "./center-credential.js";
|
|
6
6
|
import { WEB_ADMIN_ENV } from "@sema-agent/settings-schema";
|
|
7
|
+
import { readUpstreamJson } from "./upstream-body.js";
|
|
7
8
|
export const FLEET_USAGE_KEY_CAP = 1024;
|
|
8
9
|
export const FLEET_CLIENT_FETCH_TIMEOUT_MS = 5000;
|
|
9
10
|
export class FleetUsageAccumulator {
|
|
@@ -94,7 +95,7 @@ async function rejectionSnippet(res) {
|
|
|
94
95
|
async function capabilityReadingOf(res) {
|
|
95
96
|
let body;
|
|
96
97
|
try {
|
|
97
|
-
body = await res
|
|
98
|
+
body = await readUpstreamJson(res);
|
|
98
99
|
}
|
|
99
100
|
catch (err) {
|
|
100
101
|
return { kind: "unreadable", why: "body", detail: err instanceof Error ? err.message : String(err) };
|
|
@@ -102,10 +103,9 @@ async function capabilityReadingOf(res) {
|
|
|
102
103
|
return readCapabilityReading(body);
|
|
103
104
|
}
|
|
104
105
|
export function startFleetClient(opts) {
|
|
105
|
-
const f = opts.fetchImpl ?? fetch;
|
|
106
106
|
const heartbeatMs = opts.heartbeatMs ?? DEFAULT_HEARTBEAT_MS;
|
|
107
107
|
const usageWindowMs = opts.usageWindowMs ?? 60_000;
|
|
108
|
-
const send = (route, method, json, center = opts.center) => centerFetch(center, { kind: route }, { method, json, timeoutMs: FLEET_CLIENT_FETCH_TIMEOUT_MS, fetchImpl:
|
|
108
|
+
const send = (route, method, json, center = opts.center) => centerFetch(center, { kind: route }, { method, json, timeoutMs: FLEET_CLIENT_FETCH_TIMEOUT_MS, fetchImpl: opts.fetchImpl });
|
|
109
109
|
let stopped = false;
|
|
110
110
|
let failStreak = 0;
|
|
111
111
|
let unreadableStreak = 0;
|
package/dist/fleet-lease.d.ts
CHANGED
|
@@ -89,7 +89,6 @@ export declare class FleetLeaseManager {
|
|
|
89
89
|
private readonly opts;
|
|
90
90
|
/** 记账身份的那一箱(惰建;分箱规则只有 `createIdentityBins` 一只,取箱口 `accounting`)。 */
|
|
91
91
|
private readonly binNow;
|
|
92
|
-
private readonly f;
|
|
93
92
|
private readonly now;
|
|
94
93
|
private failStreak;
|
|
95
94
|
/** [ref] ②:最近一次谈判的收尾({@link LeaseAdmitOutcome})。只在 `issueOrRenewInner` 的各收尾点写。 */
|
package/dist/fleet-lease.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QuotaLease, leaseExhausted, shouldRenewLease } from "@sema-agent/settings-schema/fleet";
|
|
2
2
|
import { CenterCredentialUnavailableError, createIdentityBins, pinAccountingIdentity } from "./center-credential.js";
|
|
3
3
|
import { centerFetch, centerLaneConfigured } from "./web-admin-client/center-request.js";
|
|
4
|
+
import { readUpstreamJson } from "./upstream-body.js";
|
|
4
5
|
export const NOT_LEASE_TTL_MS = 10 * 60 * 1000;
|
|
5
6
|
export const EXHAUSTED_RETRY_MS = 30 * 1000;
|
|
6
7
|
export const LEASE_PRINCIPAL_CAP = 4096;
|
|
@@ -24,14 +25,12 @@ const LEASE_HEALTH_BY_OUTCOME = {
|
|
|
24
25
|
export class FleetLeaseManager {
|
|
25
26
|
opts;
|
|
26
27
|
binNow;
|
|
27
|
-
f;
|
|
28
28
|
now;
|
|
29
29
|
failStreak = 0;
|
|
30
30
|
lastAdmit = "none";
|
|
31
31
|
failMode;
|
|
32
32
|
constructor(opts) {
|
|
33
33
|
this.opts = opts;
|
|
34
|
-
this.f = opts.fetchImpl ?? fetch;
|
|
35
34
|
this.now = opts.now ?? Date.now;
|
|
36
35
|
this.failMode = opts.failMode;
|
|
37
36
|
this.binNow = createIdentityBins(opts.center.credential, (pinned) => ({
|
|
@@ -127,10 +126,10 @@ export class FleetLeaseManager {
|
|
|
127
126
|
method: "POST",
|
|
128
127
|
json: { principal, worker: this.opts.center.worker },
|
|
129
128
|
timeoutMs: LEASE_FETCH_TIMEOUT_MS,
|
|
130
|
-
fetchImpl: this.
|
|
129
|
+
fetchImpl: this.opts.fetchImpl,
|
|
131
130
|
});
|
|
132
131
|
if (res.status === 200) {
|
|
133
|
-
const body = (await res
|
|
132
|
+
const body = (await readUpstreamJson(res));
|
|
134
133
|
const lease = QuotaLease.parse(body.lease);
|
|
135
134
|
this.set(bin, principal, { kind: "lease", lease });
|
|
136
135
|
if (this.failStreak > 0)
|
|
@@ -142,7 +141,7 @@ export class FleetLeaseManager {
|
|
|
142
141
|
}
|
|
143
142
|
if (res.status === 409) {
|
|
144
143
|
this.lastAdmit = "ok";
|
|
145
|
-
const body = (await res
|
|
144
|
+
const body = (await readUpstreamJson(res).catch(() => ({})));
|
|
146
145
|
if (body.code === "quota_exhausted") {
|
|
147
146
|
const until = this.now() + EXHAUSTED_RETRY_MS;
|
|
148
147
|
const detail = {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { readVisibleRun, type Entry, type OwnerAccessWiring } from "./http/owner-access.js";
|
|
2
|
+
import type { Caller } from "./owner-faces.js";
|
|
3
|
+
import type { ResumeAnchorStore } from "./plugins/store-backend.js";
|
|
4
|
+
import type { IncomingMessage } from "node:http";
|
|
5
|
+
/**
|
|
6
|
+
* 手柄翻译读的两只店(一个值,两位读者:提交面阶段③ 与 run 外回退口同递):
|
|
7
|
+
* · `anchors` —— 手柄 → entry id 的唯一一张表;
|
|
8
|
+
* · `runs` —— 只在手柄**未知**时经属主存取器读一次 run 行(`readVisibleRun`,型取自它的 run 店形参),只为 404 选成因半句。
|
|
9
|
+
*/
|
|
10
|
+
export interface HistoryAnchorReaders {
|
|
11
|
+
readonly anchors: Pick<ResumeAnchorStore, "resolve">;
|
|
12
|
+
readonly runs: Parameters<typeof readVisibleRun>[1];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 成因半句的读者(唯一铸法;提交面阶段③、run 外回退口与钉同铸):口 = 面表 `run.anchor` —— 属主 / 无主,不放运维、不放 fleet,登 raw(这一读只为选句、
|
|
16
|
+
* 不答 run 的状态 ⇒ 不过观察口,不替任何一条行落判决)。调用方由调用点按自己的身份读法铸好交来:提交面 = 提交挂接的 `claimCallerOf`(该面不放运维 / fleet,
|
|
17
|
+
* 两格恒缺不漏判),run 外口 = 请求调用方(运维代人回退时这半句不点名那位属主的提问 —— 只少一句说明,不说不成立的话)。
|
|
18
|
+
*/
|
|
19
|
+
export declare function anchorReaderOf(req: IncomingMessage, w: OwnerAccessWiring, caller: Caller): Entry;
|
|
20
|
+
/** 两族:码与句尾(出路)。键 = 族名;加一族 = 加一行(两只调用方按族名取,不手写码)。 */
|
|
21
|
+
declare const HISTORY_ANCHOR_FAMILIES: {
|
|
22
|
+
/** 分叉式回卷(会话在那条消息处分叉)。 */
|
|
23
|
+
readonly resumeAt: {
|
|
24
|
+
readonly code: "resume_at.unknown_event";
|
|
25
|
+
readonly wayOut: "give an explicit resumeAt";
|
|
26
|
+
};
|
|
27
|
+
/** 只恢复代码(提交体 `rewindFilesTo` 与 run 外口的 `to` 同族同码)。 */
|
|
28
|
+
readonly rewindFilesTo: {
|
|
29
|
+
readonly code: "rewind_files_to.unknown_event";
|
|
30
|
+
readonly wayOut: "name another prompt";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export type HistoryAnchorFamily = keyof typeof HISTORY_ANCHOR_FAMILIES;
|
|
34
|
+
/**
|
|
35
|
+
* 手柄 → entry id;未知 ⇒ 抛 404(族码 + 成因半句 + 族的出路)。`owner` = 锚行的属主键(锚店的 null-safe 属主守卫):提交面传提交者,run 外口传会话属主
|
|
36
|
+
* (门已证调用方读得到这只会话;锚由这只会话的提交落下,属主键就是会话属主 —— 运维代人回退读的是同一把键)。`reader` = 收到这句 404 的那位调用方的存取器入口
|
|
37
|
+
* (只给成因半句的 run 行读用,见 {@link unknownAnchorCause}),由 {@link anchorReaderOf} 铸。
|
|
38
|
+
* `field` = 句首点名的请求字段。
|
|
39
|
+
*/
|
|
40
|
+
export declare function resolveHistoryAnchor(family: HistoryAnchorFamily, readers: HistoryAnchorReaders, reader: Entry | undefined, sessionId: string, handle: string, owner: string | null, field: string): Promise<string>;
|
|
41
|
+
export {};
|
|
42
|
+
//# sourceMappingURL=history-anchor.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { HttpError } from "./security.js";
|
|
2
|
+
import { recordFailOpen } from "./observability/fail-open.js";
|
|
3
|
+
import { protocolEntry, readVisibleRun } from "./http/owner-access.js";
|
|
4
|
+
const NO_ANCHOR = "no rewind anchor is recorded under that handle";
|
|
5
|
+
const PROMPT_WITHOUT_ANCHOR = `${NO_ANCHOR}: it names a prompt of this session that recorded none (a prompt that carried attachments records none when its attachment frames were interrupted or their count did not match)`;
|
|
6
|
+
export function anchorReaderOf(req, w, caller) {
|
|
7
|
+
return protocolEntry(req, w, "run.anchor", caller);
|
|
8
|
+
}
|
|
9
|
+
async function unknownAnchorCause(readers, reader, sessionId, handle) {
|
|
10
|
+
if (reader === undefined)
|
|
11
|
+
return NO_ANCHOR;
|
|
12
|
+
try {
|
|
13
|
+
const run = await readVisibleRun(reader, readers.runs, handle);
|
|
14
|
+
if (run === undefined || run.sessionId !== sessionId)
|
|
15
|
+
return NO_ANCHOR;
|
|
16
|
+
return (await readers.anchors.resolve(sessionId, handle, run.owner)) === undefined ? PROMPT_WITHOUT_ANCHOR : NO_ANCHOR;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
recordFailOpen("server.resume-anchor.cause-read-failed", `error=${err instanceof Error ? err.name : typeof err}`);
|
|
20
|
+
return NO_ANCHOR;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const HISTORY_ANCHOR_FAMILIES = {
|
|
24
|
+
resumeAt: { code: "resume_at.unknown_event", wayOut: "give an explicit resumeAt" },
|
|
25
|
+
rewindFilesTo: { code: "rewind_files_to.unknown_event", wayOut: "name another prompt" },
|
|
26
|
+
};
|
|
27
|
+
export async function resolveHistoryAnchor(family, readers, reader, sessionId, handle, owner, field) {
|
|
28
|
+
const entryId = await readers.anchors.resolve(sessionId, handle, owner);
|
|
29
|
+
if (entryId !== undefined)
|
|
30
|
+
return entryId;
|
|
31
|
+
const { code, wayOut } = HISTORY_ANCHOR_FAMILIES[family];
|
|
32
|
+
throw new HttpError(404, `${field}: no such message in this session (${code}) — ${await unknownAnchorCause(readers, reader, sessionId, handle)}; ${wayOut}`, { code });
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=history-anchor.js.map
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 人在环帧(问题 / 表单 / 审批三族)的**投递律** —— 全仓唯一属主。
|
|
3
|
+
*
|
|
4
|
+
* 一条律:经腿的协调器上下文投出的人在环帧(开帧、收帧、撤卡帧),在有账本的腿上**先落本 run 账本、再写直写面**;账本落不下 ⇒
|
|
5
|
+
* 这一帧不上直写面。一只帧「送到」= 账本在这一次投递的 sink 集里 ⇒ 看账本那一笔;否则看直写那一笔。三族、三条腿共用:
|
|
6
|
+
* · {@link createHitlTransport} —— 一条腿**一只**传输(无状态;不记谁接下过什么);
|
|
7
|
+
* · {@link createHitlOpenRace} —— 一只开帧的竞速机:开帧投递(可以是多个目标)与该族的结算谁先;收帧只投给接下过开帧的 sink、
|
|
8
|
+
* 排在该目标的开帧之后(**配对只此一处**);
|
|
9
|
+
* · {@link deliverHitlNotice} —— 无配对的通知帧(批级撤卡)。
|
|
10
|
+
*
|
|
11
|
+
* 族只写自己的挂点(投前判、送到 / 没送到 / 悬着之后的记账与结算词);律与配对不在族里。
|
|
12
|
+
*
|
|
13
|
+
* 「先账本后直写」与 sync 腿引擎帧同一形(引擎帧先 `await ledgerSink.onEvent(ev)` 再直写),只是更软:人在环帧落不下只让这一次
|
|
14
|
+
* 投递失败,不让腿死。连接级对账帧(开流 preamble 与它的订阅消卡帧)不经腿的上下文、不进账本,不在本律射程。
|
|
15
|
+
*/
|
|
16
|
+
import type { QuestionFrame } from "./question.js";
|
|
17
|
+
import type { ElicitationFrame } from "./elicitation.js";
|
|
18
|
+
import type { ApprovalCardLegFrame, ApprovalRevokeFrame } from "./approval-card.js";
|
|
19
|
+
import type { ToolApprovalFrame } from "./tool-approval.js";
|
|
20
|
+
import type { LedgerEventType } from "./trace/ledger-events.js";
|
|
21
|
+
/** 三族的人在环帧(开 / 收 / 撤)。九个帧型全在账本闭集里(下面那条编译期断言)。 */
|
|
22
|
+
export type HitlFrame = QuestionFrame | ElicitationFrame | ApprovalCardLegFrame | ApprovalRevokeFrame | ToolApprovalFrame;
|
|
23
|
+
/**
|
|
24
|
+
* 一次投递在各只 sink 上的接下与否 —— **只有这一次投递涉及的 sink 才有键**(不在场 / 不在 `onto` 里的没有键)。
|
|
25
|
+
* 也是 {@link HitlTransport.deliver} 的 `onto` 入参形:值为 `true` 的 sink 才写。
|
|
26
|
+
*/
|
|
27
|
+
export interface HitlSinks {
|
|
28
|
+
readonly ledger?: boolean;
|
|
29
|
+
readonly live?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 一条腿的传输(无状态)。`deliver` 与 `reachable` 是**属性**(不是方法签名)—— 帧型参数因此逆变。腿上装出的那一只是全族型(`HitlTransport<HitlFrame>`,
|
|
33
|
+
* 一腿一只、三族共用);**窄化发生在装进族上下文那一步**:审批上下文的判别联合把传输型钉到本族帧(呈卡族收不进旧族帧),竞速机的目标从族上下文取
|
|
34
|
+
* ⇒ 混族的 (transport, frame) 对编译不过。直接拿全族型传输喂竞速机的代码不受这道型约束(三只协调器都从族上下文取,`P14` 编译期钉)。
|
|
35
|
+
*/
|
|
36
|
+
export interface HitlTransport<F extends HitlFrame> {
|
|
37
|
+
/**
|
|
38
|
+
* 投一帧:`onto` 缺省 = 在场的全部 sink。① 账本在 `onto` 里 ⇒ 先等账本;落不下 ⇒ 直写不写,返回。② 直写在 `onto` 里 ∧ 活着 ⇒ 写;
|
|
39
|
+
* 写抛 / 已死 ⇒ 直写没接下(不碰死连接)。③ 交回每只涉及的 sink 接下与否。**永不 reject。**
|
|
40
|
+
*/
|
|
41
|
+
readonly deliver: (frame: F, onto?: HitlSinks) => Promise<HitlSinks>;
|
|
42
|
+
/** 判决面谓词:有直写 ⇒ 直写此刻活着;只有账本 ⇒ 恒真(账本 tail 随时可被接上)。谓词读不出 ⇒ 假(判决面 fail-closed 到停驻)。 */
|
|
43
|
+
readonly reachable: () => boolean;
|
|
44
|
+
}
|
|
45
|
+
/** 直写面:一个具名帧写 + 「此刻还活着吗」。 */
|
|
46
|
+
export interface HitlLiveSink<F extends HitlFrame> {
|
|
47
|
+
readonly write: (frame: F) => void;
|
|
48
|
+
readonly alive: () => boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 一条腿的传输。sink 组合闭集:`{ledger}`(后台 / 续跑腿)、`{ledger, live}`(sync 流腿有 durable run 行)、`{live}`(sync 流腿无 durable run 行);
|
|
52
|
+
* 两只都缺 = 装配错,构造即抛。账本 sink = 该腿账本的串行追加口(seq 由它那条链铸);直写 sink = 该连接的具名帧写。
|
|
53
|
+
*/
|
|
54
|
+
export declare function createHitlTransport<F extends HitlFrame = HitlFrame>(sinks: {
|
|
55
|
+
readonly ledger?: (type: LedgerEventType, data: unknown) => Promise<void>;
|
|
56
|
+
readonly live?: HitlLiveSink<F>;
|
|
57
|
+
}): HitlTransport<F>;
|
|
58
|
+
/** 开帧竞速的相:全部目标落定的聚合(任一送到 ⇒ `delivered`)先到,或该族的结算先到(`stalled`)。 */
|
|
59
|
+
export type HitlPhase = "delivered" | "undelivered" | "stalled";
|
|
60
|
+
/** 一只开帧的竞速机(一次登记一只)。 */
|
|
61
|
+
export interface HitlOpenRace<F extends HitlFrame> {
|
|
62
|
+
/** 「全部目标落定」的聚合与结算谁先。 */
|
|
63
|
+
readonly phase: Promise<HitlPhase>;
|
|
64
|
+
/** 全部目标落定后的聚合(`stalled` 之后迟到的那一判;零目标 ⇒ `undelivered`)。 */
|
|
65
|
+
readonly landing: Promise<"delivered" | "undelivered">;
|
|
66
|
+
/** 第 `target` 个目标的直写 sink 接下过开帧没有(preamble 订阅的让位判据)。 */
|
|
67
|
+
readonly acceptedLive: (target: number) => Promise<boolean>;
|
|
68
|
+
/**
|
|
69
|
+
* 收帧:逐目标逐 sink,只投接下过开帧的 sink、排在该目标的开帧之后;账本那只落不下 ⇒ 同目标直写不写。
|
|
70
|
+
* 一个目标的收帧没送到 ⇒ 记一次 `server.hitl.close-frame-dropped`。没接下过开帧的目标不收(不留孤儿收帧)。
|
|
71
|
+
*/
|
|
72
|
+
readonly close: (frame: F) => void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 开帧竞速机 —— 开帧投递与结算的竞速、迟到判与逐 sink 配对的唯一属主。
|
|
76
|
+
*
|
|
77
|
+
* 先登记后投(族在建它之前已把这一问登记好,快答不漏)。聚合等**全部**目标落定:任一送到 ⇒ `delivered`,全没送到 ⇒ `undelivered`
|
|
78
|
+
* (审批广播的「全部落定」语义;问题 / 表单单目标,任一 = 全部)。帧型与传输型同一个 `F`:传输型已窄到一族时(族上下文里取的那只),混族目标编译不过。
|
|
79
|
+
*/
|
|
80
|
+
export declare function createHitlOpenRace<F extends HitlFrame>(args: {
|
|
81
|
+
readonly targets: ReadonlyArray<{
|
|
82
|
+
readonly transport: HitlTransport<F>;
|
|
83
|
+
readonly frame: F;
|
|
84
|
+
}>;
|
|
85
|
+
/** 该族的结算(答 / 窗 / 中止 / 清扫 —— 永不 reject)。 */
|
|
86
|
+
readonly settled: Promise<unknown>;
|
|
87
|
+
}): HitlOpenRace<F>;
|
|
88
|
+
/** 无配对的通知帧(批级撤卡):同一只传输、同一条律;没送到 ⇒ 记一次 `server.hitl.close-frame-dropped`。永不 reject。 */
|
|
89
|
+
export declare function deliverHitlNotice<F extends HitlFrame>(transport: HitlTransport<F>, frame: F): Promise<void>;
|
|
90
|
+
//# sourceMappingURL=hitl-delivery.d.ts.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { recordFailOpen } from "./observability/fail-open.js";
|
|
2
|
+
import { createLogger } from "./observability/logger.js";
|
|
3
|
+
import { errorKindOf } from "./observability/err-text.js";
|
|
4
|
+
const logger = createLogger();
|
|
5
|
+
const _hitlTypesAreLedgerTypes = true;
|
|
6
|
+
void _hitlTypesAreLedgerTypes;
|
|
7
|
+
function landed(accepted) {
|
|
8
|
+
return accepted.ledger !== undefined ? accepted.ledger : accepted.live === true;
|
|
9
|
+
}
|
|
10
|
+
function frameKey(frame) {
|
|
11
|
+
switch (frame.type) {
|
|
12
|
+
case "question":
|
|
13
|
+
case "question_complete":
|
|
14
|
+
return `question=${frame.questionId}`;
|
|
15
|
+
case "elicitation":
|
|
16
|
+
case "elicitation_complete":
|
|
17
|
+
return `elicitation=${frame.elicitationId}`;
|
|
18
|
+
case "approval_request":
|
|
19
|
+
case "approval_complete":
|
|
20
|
+
case "tool_approval":
|
|
21
|
+
case "tool_approval_complete":
|
|
22
|
+
return `approval=${frame.approvalId}`;
|
|
23
|
+
case "approval_revoke":
|
|
24
|
+
return `batch=${frame.batchId}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function liveAlive(live) {
|
|
28
|
+
try {
|
|
29
|
+
return live.alive();
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
logger.warn("hitl_live_alive_unreadable", { errKind: errorKindOf(err) });
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export function createHitlTransport(sinks) {
|
|
37
|
+
const { ledger, live } = sinks;
|
|
38
|
+
if (ledger === undefined && live === undefined)
|
|
39
|
+
throw new Error("createHitlTransport: a leg's HITL transport needs a ledger sink, a live sink, or both");
|
|
40
|
+
const noteFailed = (frame, sink, err) => logger.warn("hitl_sink_write_failed", { frame: frame.type, key: frameKey(frame), sink, errKind: errorKindOf(err) });
|
|
41
|
+
const deliver = async (frame, onto) => {
|
|
42
|
+
const liveSink = live !== undefined && (onto === undefined || onto.live === true) ? live : undefined;
|
|
43
|
+
let ledgerAccepted;
|
|
44
|
+
if (ledger !== undefined && (onto === undefined || onto.ledger === true)) {
|
|
45
|
+
const { type, ...data } = frame;
|
|
46
|
+
try {
|
|
47
|
+
await ledger(type, data);
|
|
48
|
+
ledgerAccepted = true;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
noteFailed(frame, "ledger", err);
|
|
52
|
+
return liveSink !== undefined ? { ledger: false, live: false } : { ledger: false };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (liveSink === undefined)
|
|
56
|
+
return ledgerAccepted !== undefined ? { ledger: ledgerAccepted } : {};
|
|
57
|
+
let liveAccepted = false;
|
|
58
|
+
if (liveAlive(liveSink)) {
|
|
59
|
+
try {
|
|
60
|
+
liveSink.write(frame);
|
|
61
|
+
liveAccepted = true;
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
noteFailed(frame, "live", err);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return ledgerAccepted !== undefined ? { ledger: ledgerAccepted, live: liveAccepted } : { live: liveAccepted };
|
|
68
|
+
};
|
|
69
|
+
return { deliver, reachable: () => live === undefined || liveAlive(live) };
|
|
70
|
+
}
|
|
71
|
+
export function createHitlOpenRace(args) {
|
|
72
|
+
const opens = args.targets.map((t) => t.transport.deliver(t.frame));
|
|
73
|
+
const landing = Promise.all(opens).then((all) => (all.some(landed) ? "delivered" : "undelivered"));
|
|
74
|
+
const phase = Promise.race([landing, args.settled.then(() => "stalled")]);
|
|
75
|
+
const acceptedLive = (target) => {
|
|
76
|
+
const open = opens[target];
|
|
77
|
+
if (open === undefined)
|
|
78
|
+
throw new RangeError(`createHitlOpenRace: no target #${target}`);
|
|
79
|
+
return open.then((a) => a.live === true);
|
|
80
|
+
};
|
|
81
|
+
const close = (frame) => {
|
|
82
|
+
args.targets.forEach((t, i) => {
|
|
83
|
+
void opens[i].then(async (opened) => {
|
|
84
|
+
const onto = { ...(opened.ledger === true ? { ledger: true } : {}), ...(opened.live === true ? { live: true } : {}) };
|
|
85
|
+
if (onto.ledger !== true && onto.live !== true)
|
|
86
|
+
return;
|
|
87
|
+
if (!landed(await t.transport.deliver(frame, onto)))
|
|
88
|
+
recordFailOpen("server.hitl.close-frame-dropped", `frame=${frame.type} ${frameKey(frame)}`);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
return { phase, landing, acceptedLive, close };
|
|
93
|
+
}
|
|
94
|
+
export async function deliverHitlNotice(transport, frame) {
|
|
95
|
+
if (!landed(await transport.deliver(frame)))
|
|
96
|
+
recordFailOpen("server.hitl.close-frame-dropped", `frame=${frame.type} ${frameKey(frame)}`);
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=hitl-delivery.js.map
|