@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
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export type Labels = Record<string, string>;
|
|
2
|
+
/** 认领时延直方图的名字(注册在 {@link createMetrics};计时口径与 `step` 闭集的属主是 `http/claim-latency.ts`,它引这个常量 —— 名字只此一处)。 */
|
|
3
|
+
export declare const EXECUTION_CLAIM_METRIC = "execution_claim_duration_seconds";
|
|
2
4
|
export declare class Metrics {
|
|
3
5
|
private counters;
|
|
4
6
|
private gauges;
|
|
@@ -2,6 +2,7 @@ import { DENIED_BY_VALUES } from "@sema-agent/core";
|
|
|
2
2
|
import { buildPermissionRuleEventsHelp } from "./permission-rule-events.js";
|
|
3
3
|
import { MCP_PROBE_OUTCOMES } from "../capabilities/mcp-probe.js";
|
|
4
4
|
const DEFAULT_BUCKETS = [0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30, 60];
|
|
5
|
+
export const EXECUTION_CLAIM_METRIC = "execution_claim_duration_seconds";
|
|
5
6
|
function labelKey(labels) {
|
|
6
7
|
return Object.keys(labels)
|
|
7
8
|
.sort()
|
|
@@ -214,6 +215,7 @@ export function createMetrics() {
|
|
|
214
215
|
m.counter("http_requests_total", "HTTP requests by route/method/status");
|
|
215
216
|
m.histogram("http_request_duration_seconds", "HTTP request duration");
|
|
216
217
|
m.counter("rate_limited_total", "Requests rejected by the rate limiter");
|
|
218
|
+
m.counter("submission_exit_total", "Submission exit closes by end word (accepted|record|refused) and verdict (withdrawn | kept_<word>): what happened to the session a submission minted when it ended — withdrawn = a refused submission's fresh session removed before the terminal answer; kept_upgrade_pending = the database has no withdraw mark yet (an earlier-version replica may still be serving); kept_withdraw_failed = the withdraw threw and the session stayed (see the fail-open tag)");
|
|
217
219
|
m.counter("brain_echo_dropped_total", "Provider echo fields (response request-id header / reported model name) the engine's brain dropped at write time for failing the echo shape (visible ASCII, 1-128 chars), by field (requestId|responseModel|apiErrorCode — the last is the provider's own refusal word on a 4xx, core 7.38.0); non-zero = the endpoint or a gateway in front of it echoes out-of-shape bytes");
|
|
218
220
|
m.counter("mcp_probe_total", `No-run MCP status face outcomes by outcome (${MCP_PROBE_OUTCOMES.join("/")} — see src/capabilities/mcp-probe.ts MCP_PROBE_OUTCOMES; rate_limited has TWO causes: the per-identity fixed window AND the replica-wide in-flight cap, which can refuse caller B because of caller A)`);
|
|
219
221
|
m.counter("tasks_total", "Finished tasks by terminal status");
|
|
@@ -239,6 +241,7 @@ export function createMetrics() {
|
|
|
239
241
|
m.counter("deny_sweep_policy_blocked_expired_total", "approvals the SLA deny-sweep expired because the resume leg refused them for an admission-policy reason (resume_blocked_by_policy: the stored request is refused in this version for good, so the model-continuing deny cannot be delivered; counted once per card, only when this sweep won the settle)");
|
|
240
242
|
m.counter("submit_ctx_run_release_failed_total", "Submissions whose resume-input write failed AND whose just-claimed run could not be released, by step (terminal|idem_key); the session stays held until REAP_RUN_STALE_SEC (one submit_ctx_run_release_failed warn per failure)");
|
|
241
243
|
m.counter("deny_sweep_list_failed_total", "SLA deny-sweep ticks whose read of the expired approvals failed (that tick denies nothing; one deny_sweep_list_failed warn per failure)");
|
|
244
|
+
m.counter("deny_sweep_row_failed_total", "SLA deny-sweep rows whose stored request could not be read this tick (a projection-drift throw); that row is not resumed this tick, the rest of the page is swept (one deny_sweep_row_failed warn per failure)");
|
|
242
245
|
m.counter("degraded_total", "Tasks degraded to a cheaper model (1.40), by reason (budget/rate_limit/breaker_open)");
|
|
243
246
|
m.counter("task_model_not_allowlisted_resume_total", "Resumed legs whose model/compactionModel is outside the @-mention allowlist (allowed to keep running by design — the allowlist gates fresh picks only)");
|
|
244
247
|
m.counter("task_model_unavailable_fallback_total", "Resumed legs whose explicit model pick names a catalog entry that is unavailable on this deployment (no brain mounted for its provider / entry fails its schema) — the leg runs on the default model; fresh submits get 400 request.model_unavailable");
|
|
@@ -271,10 +274,6 @@ export function createMetrics() {
|
|
|
271
274
|
m.counter("brain_calls_total", "Brain calls by provider/model (S18); provider=unknown = unrecognized routing fallthrough");
|
|
272
275
|
m.gauge("fleet_counter_bucket_skew_ms", "DB clock minus local clock in ms (S10) — skew splits cross-replica counter windows");
|
|
273
276
|
m.gauge("fleet_clock_probe_ok", "1 = last DB clock probe succeeded, 0 = failing (skew gauge is stale while 0)");
|
|
274
|
-
m.counter("lsp_bridge_start_total", "LSP sandbox bridge (re)starts attempted, by provider and generation");
|
|
275
|
-
m.counter("lsp_bridge_dead_total", "LSP sandbox bridge generations that died, by reason (the word IS the model-facing unavailableReason)");
|
|
276
|
-
m.counter("lsp_session_open_total", "LSP session opens, by language and outcome (ok/failed)");
|
|
277
|
-
m.counter("lsp_session_heal_total", "LSP session heals (dead-transport reopen), by outcome (ok/failed)");
|
|
278
277
|
m.gauge("snapshot_blob_backend", "1 on the active snapshot-blob backend series (S21), by backend (minio|sql)");
|
|
279
278
|
m.counter("memory_embed_failed_total", "Memory embedding calls that failed at runtime (S22), by backend (the memory-engine dialect that owns the embedder)");
|
|
280
279
|
m.counter("memory_knn_query_failed_total", "Memory KNN searchScored queries that failed at runtime (S22)");
|
|
@@ -302,8 +301,10 @@ export function createMetrics() {
|
|
|
302
301
|
m.counter("remote_env_file_timeout_total", "Remote-env file-op timeouts, by provider");
|
|
303
302
|
m.counter("remote_env_rpc_timeout_total", "Remote-env RPC timeouts, by provider");
|
|
304
303
|
m.counter("sandbox_pods_reaped_total", "Sandbox pods deleted by the k8s lane's pod reaper, by reason (containers_ended: every container finished; run_ended_past_hold: the pod's run ended longer ago than the hold)");
|
|
304
|
+
m.counter("local_docker_containers_reaped_total", "Containers deleted by the local-docker lane's orphan-container reaper, by reason (run_ended: the container's run row is terminal — nothing can use its workspace any more)");
|
|
305
305
|
m.counter("task_outcomes_total", "Task outcome-ledger rows recorded, by status and oracle green flag");
|
|
306
306
|
m.counter("workflow_runs_total", "Self-orchestration workflow runs, by status");
|
|
307
|
+
m.histogram(EXECUTION_CLAIM_METRIC, "Execution-claim round-trip latency by step (run_claim: RunStore.createRun incl. the SQL root-session row lock; placement_commit: the one post-claim execution-placement write)", [0.001, 0.005, 0.02, 0.1, 0.5, 2, 10]);
|
|
307
308
|
m.histogram("auth_bridge_verify_seconds", "Registry SSO JWT verify latency (hot path sub-ms; cold path includes a JWKS fetch)", [0.001, 0.005, 0.02, 0.1, 0.5, 2, 10]);
|
|
308
309
|
return m;
|
|
309
310
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { recordFailOpen } from "./fail-open.js";
|
|
2
|
+
import { createEgressFetch } from "../egress-redirect.js";
|
|
2
3
|
const CUMULATIVE = 2;
|
|
3
4
|
const nano = (ms) => (BigInt(ms) * 1000000n).toString();
|
|
4
5
|
const attrs = (labels) => Object.entries(labels).map(([key, v]) => ({ key, value: { stringValue: String(v) } }));
|
|
@@ -61,7 +62,7 @@ export function buildOtlpPayload(snap, opts) {
|
|
|
61
62
|
export function startOtlpExporter(metrics, opts) {
|
|
62
63
|
const startMs = Date.now();
|
|
63
64
|
const url = `${opts.endpoint}/v1/metrics`;
|
|
64
|
-
const fetchImpl = opts.fetchImpl
|
|
65
|
+
const fetchImpl = createEgressFetch("declare the final collector address as OTEL_EXPORTER_OTLP_ENDPOINT", opts.fetchImpl);
|
|
65
66
|
let inFlight = false;
|
|
66
67
|
const exportOnce = async () => {
|
|
67
68
|
if (inFlight)
|
|
@@ -6,12 +6,19 @@
|
|
|
6
6
|
* call still reads the originating principal. Absent store = unattributed (dev / no principal).
|
|
7
7
|
*/
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
9
|
-
|
|
10
|
-
/**
|
|
9
|
+
import { type Person, type Subject } from "../owner-brands.js";
|
|
10
|
+
/**
|
|
11
|
+
* 场景子命名空间:ALS 带**主体**(分区键),不带人 —— 读者有两种:记账三写口(成本 / 用量批报 / 租约)读人({@link currentPerson} = `personOf(主体)`),
|
|
12
|
+
* leader 子任务的 spec 读分区(`leader/wire.ts` 经引擎交界一处铸身份格)。只带人会让 leader 子任务丢分区;只带主体、人现解码,两种读者各取一格。
|
|
13
|
+
*/
|
|
14
|
+
export declare const principalContext: AsyncLocalStorage<Subject>;
|
|
15
|
+
/** 这次执行的记账身份钉表;不在任何 {@link withSubject} 作用域里 ⇒ `undefined`(记账按此刻身份)。 */
|
|
11
16
|
export declare function currentExecutionPins(): Map<object, string> | undefined;
|
|
12
|
-
/** Run `fn` with `
|
|
13
|
-
*
|
|
14
|
-
export declare function
|
|
15
|
-
/** The
|
|
16
|
-
export declare function
|
|
17
|
+
/** Run `fn` with `subject` as the ambient context (a no-op wrapper when the subject is undefined — the outer
|
|
18
|
+
* subject, if any, stays). [ref]: also opens the execution's accounting-pin scope when none is open yet (nested calls share it). */
|
|
19
|
+
export declare function withSubject<T>(subject: Subject | undefined, fn: () => T): T;
|
|
20
|
+
/** The subject (partition key) the current async execution runs in, if any. */
|
|
21
|
+
export declare function currentSubject(): Subject | undefined;
|
|
22
|
+
/** The person the current async execution is attributed to (cost / usage / lease accounting) = the person behind {@link currentSubject}. */
|
|
23
|
+
export declare function currentPerson(): Person | undefined;
|
|
17
24
|
//# sourceMappingURL=principal-context.d.ts.map
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { personOf } from "../owner-brands.js";
|
|
2
3
|
export const principalContext = new AsyncLocalStorage();
|
|
3
4
|
const executionPins = new AsyncLocalStorage();
|
|
4
5
|
export function currentExecutionPins() {
|
|
5
6
|
return executionPins.getStore();
|
|
6
7
|
}
|
|
7
|
-
export function
|
|
8
|
-
const run = () => (
|
|
8
|
+
export function withSubject(subject, fn) {
|
|
9
|
+
const run = () => (subject ? principalContext.run(subject, fn) : fn());
|
|
9
10
|
return executionPins.getStore() !== undefined ? run() : executionPins.run(new Map(), run);
|
|
10
11
|
}
|
|
11
|
-
export function
|
|
12
|
+
export function currentSubject() {
|
|
12
13
|
return principalContext.getStore();
|
|
13
14
|
}
|
|
15
|
+
export function currentPerson() {
|
|
16
|
+
const subject = principalContext.getStore();
|
|
17
|
+
return subject === undefined ? undefined : personOf(subject);
|
|
18
|
+
}
|
|
14
19
|
//# sourceMappingURL=principal-context.js.map
|
|
@@ -86,7 +86,6 @@ export declare function notifyRunTerminal(rec: RunTerminalRecord): void;
|
|
|
86
86
|
* 不抛**:脱敏失败 ⇒ 落固定占位 `«redacted:oversized»`(绝不落原文,也绝不阻断终态翻转),并走既有 fail-open 遥测 tag。
|
|
87
87
|
* 🔴 [ref] 之后这条 throw 臂**照留**(结构性兜底,不依赖「脱敏器今天抛不抛」):它守的是「终态翻转不被一次脱敏异常拦下」,
|
|
88
88
|
* 而脱敏器是一张会长新臂的表 —— 计数 `server.run-terminal.redact-threw` 恒零是证据,不归零就是新形,运维按 detail 回溯。 */
|
|
89
|
-
export declare const OVERSIZED_REDACTION_PLACEHOLDER = "\u00ABredacted:oversized\u00BB";
|
|
90
89
|
/** [ref] 窄范围重扫 [medium]:`redactSecrets` 对 PEM 起始栅栏密集的多 MB 文案**不抛但慢**(实测 1MB 1.4s / 8MB 7.9s 同步阻塞
|
|
91
90
|
* 事件循环),而终态座每次写要扫两遍(appendEvent + setTerminal 入口)、每次读再扫一遍。超过本上限的自由文本**整段**换占位
|
|
92
91
|
* (fail-closed:不截断——截断会把密钥切成半截,[ref] 的病;不扫——O(1)),取证面丢的是「>256KB 的错误文案」这一档。 */
|
|
@@ -263,6 +262,13 @@ export declare function redactTerminalResult<T extends object | null | undefined
|
|
|
263
262
|
* 本函数是**写入口**(结果第一次落盘 ⇒ 折码运维线索 `at=exit`);读面读存量行用 {@link sealStoredRunRowResult}(读座必填)。
|
|
264
263
|
*/
|
|
265
264
|
export declare function sealRunRowResult(result: PersistedTaskResult | null): PersistedTaskResult | null;
|
|
265
|
+
/**
|
|
266
|
+
* run 行 `error_code` 列的**写律**(三只 run 店、写 `result` 的三个写口 —— `setTerminal` / `setSuspended` / `setNeedsReview` —— 同一只):
|
|
267
|
+
* 列 = 落在行上的那份结果(已过 {@link sealRunRowResult})的对外码(core 的唯一派生 `outwardPlane`);没有结果 ⇒ `null`。
|
|
268
|
+
* 列是 run 的 `errorCode` 的**唯一读法**(读面、A2A、审批对账、fleet 都读它),所以停驻行的 `review.pending` 也落在列上。
|
|
269
|
+
* 其余迁移(续跑认领 / 收割 / 接管)把 `result` 写空的同时写自己的码或空,不经本函数。
|
|
270
|
+
*/
|
|
271
|
+
export declare function runRowErrorCodeOf(sealed: PersistedTaskResult | null): string | null;
|
|
266
272
|
/**
|
|
267
273
|
* {@link sealRunRowResult} 的**读入口**(`GET /v1/runs/:id` 的非终态臂读停驻行):同一套封口 + 同一只汇点,只差折码运维线索的观看点 ——
|
|
268
274
|
* 读座必填({@link StoredResultReadSeat}),再观看走 fail-open 纪律(见 `terminal.ts` 的 `sealStoredResult`)。
|
|
@@ -3,8 +3,9 @@ import { redactSecrets } from "../trace/redact.js";
|
|
|
3
3
|
import { isProviderEchoShape } from "@sema-agent/core";
|
|
4
4
|
import { isModelTextLedgerEventType, isParkLedgerEventType } from "../trace/ledger-events.js";
|
|
5
5
|
import { isUnsuccessfulRunStatus } from "../plugins/store-contracts.js";
|
|
6
|
-
import { mapPauseSeats, PAUSE_SEATS, sealResultForExit, sealStoredResult } from "../terminal.js";
|
|
6
|
+
import { mapPauseSeats, outwardPlane, PAUSE_SEATS, sealResultForExit, sealStoredResult } from "../terminal.js";
|
|
7
7
|
import { errorText } from "./err-text.js";
|
|
8
|
+
import { OVERSIZED_REDACTION_PLACEHOLDER } from "../trace/exit-seat.js";
|
|
8
9
|
import { recordFailOpen } from "./fail-open.js";
|
|
9
10
|
import { toolEndMediaAsDescriptors } from "../trace/tool-output-media.js";
|
|
10
11
|
const MESSAGE_CAP = 1024;
|
|
@@ -53,7 +54,6 @@ export function notifyRunTerminal(rec) {
|
|
|
53
54
|
...(rec.elapsedMs !== undefined ? { elapsedMs: rec.elapsedMs } : {}),
|
|
54
55
|
});
|
|
55
56
|
}
|
|
56
|
-
export const OVERSIZED_REDACTION_PLACEHOLDER = "«redacted:oversized»";
|
|
57
57
|
export const REDACT_INPUT_CAP = 65_536;
|
|
58
58
|
export const REDACT_OUTPUT_MAX_BYTES = 65_000;
|
|
59
59
|
const OUTPUT_TRUNCATED_MARK = "…[truncated: exceeds store column]";
|
|
@@ -436,6 +436,9 @@ function redactLegacyPlaneLeaves(result) {
|
|
|
436
436
|
export function sealRunRowResult(result) {
|
|
437
437
|
return result === null ? null : redactTerminalResult(sealResultForExit(result));
|
|
438
438
|
}
|
|
439
|
+
export function runRowErrorCodeOf(sealed) {
|
|
440
|
+
return sealed === null ? null : (outwardPlane(sealed.terminal).errorCode ?? null);
|
|
441
|
+
}
|
|
439
442
|
export function sealStoredRunRowResult(result, seat) {
|
|
440
443
|
return result === null ? null : redactTerminalResult(sealStoredResult(result, seat));
|
|
441
444
|
}
|
|
@@ -17,6 +17,12 @@
|
|
|
17
17
|
* 有部署级出路的现场([ref]:`server.lsp.spawn-env`;7.103.0 起 + `server.bake-runner.spawn-env`)升 `warn`,并带当前放行名单与出路句
|
|
18
18
|
* —— 规则见 `SecretEnvScrubSiteSpec`。
|
|
19
19
|
* 不是「每 site 一次」:一个**新**的密钥形 key 后来才出现(部署加了一个凭证)时,那才是最该看见的一行。
|
|
20
|
+
* 🔴 **名字只有一个读者**:披露行回答「这条腿扣了哪些名字」。引擎自己读执行环境的那条腿(模型可驱动的 host shell:引擎每个会话读执行环境的必填答
|
|
21
|
+
* `ExecutionEnv.withheldEnv`、铸 `inherit_env.names_withheld`,本仓的通告转发体把它落成结构化 `engine_notice` 行并上会话流)已经在说同一批名字 ⇒ 那一格登记
|
|
22
|
+
* `told:"engine-notice"`:本座只记计数(`secret_env_scrubbed_total`,不带名字 —— 每条规则扣了几次是另一个事实),不写披露行。引擎没有读者的腿
|
|
23
|
+
* (git / 语言服务器 / bake-runner / hooks / docker / adb,以及 host 适配器类里本服务自己的 git worktree 基环境 —— 它从不交给引擎)本服务是唯一的读者,登记
|
|
24
|
+
* `told:"log"`,披露行照旧。哪一格是哪一种不手抄:车道适配器里 `get withheldEnv()` 有真读者的那几只 = `told:"engine-notice"` 的那几格
|
|
25
|
+
* (`test/withheld-names-one-reading.test.ts` 闭集互推);同一个类里不交给引擎的那条腿另立现场(按腿命名,不按类)。
|
|
20
26
|
* findings 全部是 core 的 `SecretEnvFinding`(7.129.0 / core 7.51.1 起只有引擎一只写手,经 `server-secret-env.ts` 的唯一组合):形状臂的五词
|
|
21
27
|
* `exact-name` / `prefix-rule`(`OTEL_*`)/ `namespace-rule`(`SEMA_` 命名空间)/ `name-rule`(名字形状)/ `value-rule`(值里带凭据),加
|
|
22
28
|
* `own-credential`(本进程起服声明的自有凭据名 —— 配置目录 secret 名 ∪ 名单型旋钮名 —— 被形状臂漏下、由声明臂扣的;`all` 词下也扣)。
|
|
@@ -46,49 +52,69 @@ import type { Metrics } from "./metrics.js";
|
|
|
46
52
|
* 一个剥除现场的登记:`note` = 这条腿上泄漏意味着什么;`remedy` = 部署方能不能自己把某个被剥的键放回来。
|
|
47
53
|
*
|
|
48
54
|
* 🔴 [ref]:`remedy` 在场与否决定披露行的**级别**,规则一句 —— **有出路的现场用 warn,并把出路句与当前放行名单写进同一行**;
|
|
49
|
-
* 没有出路的现场是纯保护留痕,照旧 info。理由:没有出路的剥除(
|
|
55
|
+
* 没有出路的现场是纯保护留痕,照旧 info。理由:没有出路的剥除(git 钩子、CLI 腿)是本服务替部署方做的决定,
|
|
50
56
|
* 读者只需要知道它生效了;有出路的剥除(语言服务器)可能让一件功能静默变差(补全 / 诊断缺了私有 registry 的依赖),
|
|
51
57
|
* 那是部署方要自己决定的事 —— 看不见 = 无从归因。出路句不带任何值。
|
|
58
|
+
*
|
|
59
|
+
* `told` 说**谁把这条腿扣下的名字告诉人**(一个事实一个读者,见文件头):`"log"` = 本座的披露行(有 `note`);`"engine-notice"` = 引擎读这条腿的执行环境并铸
|
|
60
|
+
* `inherit_env.names_withheld`,本座不再写第二遍名字(无披露行 ⇒ 无 `note`、无出路句;计数照记)。
|
|
52
61
|
*/
|
|
53
|
-
export
|
|
62
|
+
export type SecretEnvScrubSiteSpec = {
|
|
63
|
+
readonly told: "log";
|
|
54
64
|
readonly note: string;
|
|
55
65
|
readonly remedy: string | null;
|
|
56
|
-
}
|
|
66
|
+
} | {
|
|
67
|
+
readonly told: "engine-notice";
|
|
68
|
+
readonly remedy: null;
|
|
69
|
+
};
|
|
57
70
|
/** 登记过的剥除现场。闭集:未登记的 site 传不进 {@link recordSecretEnvScrub}(编译期拒,同 FAIL_OPEN_TAGS 纪律)。 */
|
|
58
71
|
export declare const SECRET_ENV_SCRUB_SITES: {
|
|
59
72
|
readonly "server.remote-env-host.spawn-env": {
|
|
60
|
-
readonly
|
|
73
|
+
readonly told: "engine-notice";
|
|
74
|
+
readonly remedy: null;
|
|
75
|
+
};
|
|
76
|
+
readonly "server.remote-env-host.git-base": {
|
|
77
|
+
readonly told: "log";
|
|
78
|
+
readonly note: "本服务自己的 git worktree 基环境(host 车道 worktree 隔离:`git worktree add / remove / prune`)交给 git 与它拉起的 hook / credential helper 的 env —— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据交给仓里的 hook";
|
|
61
79
|
readonly remedy: null;
|
|
62
80
|
};
|
|
63
81
|
readonly "server.remote-env-local-docker.spawn-env": {
|
|
82
|
+
readonly told: "log";
|
|
64
83
|
readonly note: "local-docker 车道交给宿主 `docker` CLI 的 env(它拉起的凭据助手 / CLI 插件同读)—— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据交给宿主上的第三方助手";
|
|
65
84
|
readonly remedy: null;
|
|
66
85
|
};
|
|
67
86
|
readonly "server.remote-env-adb.spawn-env": {
|
|
87
|
+
readonly told: "log";
|
|
68
88
|
readonly note: "adb 车道交给宿主 `adb` CLI 的 env(首次调用起的常驻 adb server 继承同一份并一直活着)—— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据留在一只常驻进程的环境里";
|
|
69
89
|
readonly remedy: null;
|
|
70
90
|
};
|
|
71
91
|
readonly "server.hooks.spawn-env": {
|
|
92
|
+
readonly told: "log";
|
|
72
93
|
readonly note: "settings hooks 的命令腿(请求带来的命令跑在宿主上)的 env —— 严格名单(`PATH` / `HOME` / 终端 / locale 等十二名)经引擎的 `hostChildEnv` 组合:名单外一律不交,本服务自有凭据任何情况都不交;请求的有效环境层(`settings.env`)作授予叠在上面;请求给工具 shell 的继承词对它不作用";
|
|
73
94
|
readonly remedy: null;
|
|
74
95
|
};
|
|
75
96
|
readonly "server.project-memory.git-subprocess": {
|
|
97
|
+
readonly told: "log";
|
|
76
98
|
readonly note: "project-memory 读仓叙事时的 git 子进程 env —— 仓内的钩子/凭证助手会以本进程身份运行";
|
|
77
99
|
readonly remedy: null;
|
|
78
100
|
};
|
|
79
101
|
readonly "server.lsp.spawn-env": {
|
|
102
|
+
readonly told: "log";
|
|
80
103
|
readonly note: "宿主车道本地语言服务器子进程 env(core 7.30.1 #1073 的 `NodeLspManagerOptions.env`)—— 语言服务器会执行仓里的代码(构建脚本/插件/工作区配置),一次泄漏等于把本进程的凭据交给仓";
|
|
81
104
|
readonly remedy: `LSP_ENV_ALLOW=NAME,NAME \u70B9\u540D\u653E\u884C(\u539F\u6837\u4EA4\u7ED9\u8BED\u8A00\u670D\u52A1\u5668,\u90E8\u7F72\u65B9\u663E\u5F0F\u627F\u62C5;${string});\u503C\u4E0D\u8FDB\u65E5\u5FD7`;
|
|
82
105
|
};
|
|
83
106
|
readonly "server.center-plugins.git-clone": {
|
|
107
|
+
readonly told: "log";
|
|
84
108
|
readonly note: "center 下发插件的 git clone / fetch 子进程 env —— 克隆的是 center 声明里的第三方仓,git 与它拉起的 transport / askpass 以本进程身份运行";
|
|
85
109
|
readonly remedy: null;
|
|
86
110
|
};
|
|
87
111
|
readonly "server.leader.git-push": {
|
|
112
|
+
readonly told: "log";
|
|
88
113
|
readonly note: "leader 控制面把集成结果推回 durable remote 的 git 子进程 env —— 这条腿保留宿主 git 配置(写凭据可能走宿主 credential helper),helper / hook 以本进程身份运行";
|
|
89
114
|
readonly remedy: null;
|
|
90
115
|
};
|
|
91
116
|
readonly "server.bake-runner.spawn-env": {
|
|
117
|
+
readonly told: "log";
|
|
92
118
|
readonly note: "bake-runner(构建宿主守护进程)交给 build.sh 与主机命令(git fetch / docker push / docker image inspect / df)的 env —— 配方脚本在构建宿主上以 runner 身份运行,一次泄漏等于把 runner 的 BAKE_RUNNER_TOKEN 交给配方";
|
|
93
119
|
readonly remedy: "BAKE_ENV_ALLOW=NAME,NAME 点名放行(原样交给 build.sh 与主机命令,部署方显式承担;bake-runner 进程的旋钮,没有多租户姿态);值不进日志";
|
|
94
120
|
};
|
|
@@ -2,39 +2,49 @@ import { summarizeRedactions } from "@sema-agent/core";
|
|
|
2
2
|
import { describeAllowlistPostures } from "../env-name-allowlist-knobs.js";
|
|
3
3
|
import { createLogger } from "./logger.js";
|
|
4
4
|
export const SECRET_ENV_SCRUB_SITES = {
|
|
5
|
-
"server.remote-env-host.spawn-env": {
|
|
6
|
-
|
|
5
|
+
"server.remote-env-host.spawn-env": { told: "engine-notice", remedy: null },
|
|
6
|
+
"server.remote-env-host.git-base": {
|
|
7
|
+
told: "log",
|
|
8
|
+
note: "本服务自己的 git worktree 基环境(host 车道 worktree 隔离:`git worktree add / remove / prune`)交给 git 与它拉起的 hook / credential helper 的 env —— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据交给仓里的 hook",
|
|
7
9
|
remedy: null,
|
|
8
10
|
},
|
|
9
11
|
"server.remote-env-local-docker.spawn-env": {
|
|
12
|
+
told: "log",
|
|
10
13
|
note: "local-docker 车道交给宿主 `docker` CLI 的 env(它拉起的凭据助手 / CLI 插件同读)—— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据交给宿主上的第三方助手",
|
|
11
14
|
remedy: null,
|
|
12
15
|
},
|
|
13
16
|
"server.remote-env-adb.spawn-env": {
|
|
17
|
+
told: "log",
|
|
14
18
|
note: "adb 车道交给宿主 `adb` CLI 的 env(首次调用起的常驻 adb server 继承同一份并一直活着)—— 继承词 `\"all\"`,扣的只有本服务自己的凭据;一次泄漏等于把本服务凭据留在一只常驻进程的环境里",
|
|
15
19
|
remedy: null,
|
|
16
20
|
},
|
|
17
21
|
"server.hooks.spawn-env": {
|
|
22
|
+
told: "log",
|
|
18
23
|
note: "settings hooks 的命令腿(请求带来的命令跑在宿主上)的 env —— 严格名单(`PATH` / `HOME` / 终端 / locale 等十二名)经引擎的 `hostChildEnv` 组合:名单外一律不交,本服务自有凭据任何情况都不交;请求的有效环境层(`settings.env`)作授予叠在上面;请求给工具 shell 的继承词对它不作用",
|
|
19
24
|
remedy: null,
|
|
20
25
|
},
|
|
21
26
|
"server.project-memory.git-subprocess": {
|
|
27
|
+
told: "log",
|
|
22
28
|
note: "project-memory 读仓叙事时的 git 子进程 env —— 仓内的钩子/凭证助手会以本进程身份运行",
|
|
23
29
|
remedy: null,
|
|
24
30
|
},
|
|
25
31
|
"server.lsp.spawn-env": {
|
|
32
|
+
told: "log",
|
|
26
33
|
note: "宿主车道本地语言服务器子进程 env(core 7.30.1 #1073 的 `NodeLspManagerOptions.env`)—— 语言服务器会执行仓里的代码(构建脚本/插件/工作区配置),一次泄漏等于把本进程的凭据交给仓",
|
|
27
34
|
remedy: `LSP_ENV_ALLOW=NAME,NAME 点名放行(原样交给语言服务器,部署方显式承担;${describeAllowlistPostures()});值不进日志`,
|
|
28
35
|
},
|
|
29
36
|
"server.center-plugins.git-clone": {
|
|
37
|
+
told: "log",
|
|
30
38
|
note: "center 下发插件的 git clone / fetch 子进程 env —— 克隆的是 center 声明里的第三方仓,git 与它拉起的 transport / askpass 以本进程身份运行",
|
|
31
39
|
remedy: null,
|
|
32
40
|
},
|
|
33
41
|
"server.leader.git-push": {
|
|
42
|
+
told: "log",
|
|
34
43
|
note: "leader 控制面把集成结果推回 durable remote 的 git 子进程 env —— 这条腿保留宿主 git 配置(写凭据可能走宿主 credential helper),helper / hook 以本进程身份运行",
|
|
35
44
|
remedy: null,
|
|
36
45
|
},
|
|
37
46
|
"server.bake-runner.spawn-env": {
|
|
47
|
+
told: "log",
|
|
38
48
|
note: "bake-runner(构建宿主守护进程)交给 build.sh 与主机命令(git fetch / docker push / docker image inspect / df)的 env —— 配方脚本在构建宿主上以 runner 身份运行,一次泄漏等于把 runner 的 BAKE_RUNNER_TOKEN 交给配方",
|
|
39
49
|
remedy: "BAKE_ENV_ALLOW=NAME,NAME 点名放行(原样交给 build.sh 与主机命令,部署方显式承担;bake-runner 进程的旋钮,没有多租户姿态);值不进日志",
|
|
40
50
|
},
|
|
@@ -77,6 +87,9 @@ export function recordSecretEnvScrub(site, findings, allowed) {
|
|
|
77
87
|
counts.set(k, (counts.get(k) ?? 0) + 1);
|
|
78
88
|
}
|
|
79
89
|
drainToMetrics();
|
|
90
|
+
const spec = SECRET_ENV_SCRUB_SITES[site];
|
|
91
|
+
if (spec.told === "engine-notice")
|
|
92
|
+
return;
|
|
80
93
|
const logger = sink.logger;
|
|
81
94
|
if (logger === undefined)
|
|
82
95
|
return;
|
|
@@ -86,7 +99,6 @@ export function recordSecretEnvScrub(site, findings, allowed) {
|
|
|
86
99
|
const fresh = findings.filter((f) => !disclosed.has(`${site}${SEP}${f.key}`)).slice(0, room);
|
|
87
100
|
if (fresh.length === 0)
|
|
88
101
|
return;
|
|
89
|
-
const spec = SECRET_ENV_SCRUB_SITES[site];
|
|
90
102
|
const fields = {
|
|
91
103
|
site,
|
|
92
104
|
note: spec.note,
|
|
@@ -98,6 +98,7 @@ export declare function isScriptRealmRejection(promise: unknown): boolean;
|
|
|
98
98
|
* message channel for a rejection nobody awaited does not exist anyway.
|
|
99
99
|
*/
|
|
100
100
|
export declare function describeRejectionReason(reason: unknown): string;
|
|
101
|
+
export declare function installScriptRejectionReport(report: (summary: string) => void): void;
|
|
101
102
|
export declare function installScriptRealmRejectionGuard(): void;
|
|
102
103
|
/**
|
|
103
104
|
* The membrane handed to a surface's `buildGlobals` callback to construct the CONTEXT-LOCAL bindings the
|
|
@@ -55,17 +55,23 @@ export function describeRejectionReason(reason) {
|
|
|
55
55
|
return `<unknown typeof ${typeof reason}>`;
|
|
56
56
|
}
|
|
57
57
|
let rejectionGuardInstalled = false;
|
|
58
|
+
let scriptRejectionReport;
|
|
59
|
+
export function installScriptRejectionReport(report) {
|
|
60
|
+
scriptRejectionReport = report;
|
|
61
|
+
}
|
|
58
62
|
export function installScriptRealmRejectionGuard() {
|
|
59
63
|
if (rejectionGuardInstalled)
|
|
60
64
|
return;
|
|
61
65
|
rejectionGuardInstalled = true;
|
|
62
66
|
process.on("unhandledRejection", (reason, promise) => {
|
|
63
67
|
if (isScriptRealmRejection(promise)) {
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const report = scriptRejectionReport;
|
|
69
|
+
if (report !== undefined) {
|
|
70
|
+
try {
|
|
71
|
+
report(describeRejectionReason(reason));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
@@ -1,18 +1,4 @@
|
|
|
1
1
|
import { type WorkflowScriptRunner } from "@sema-agent/core";
|
|
2
2
|
import { type HardenedVmLimits } from "./hardened-vm-runner.js";
|
|
3
|
-
/**
|
|
4
|
-
* Worker-isolated S8 hard runner ([ref] v2). Runs the hardened-vm membrane inside a `worker_thread`, adding
|
|
5
|
-
* RESOURCE isolation on top of the in-process {@link import("./hardened-vm-runner.js").createHardenedVmRunner}'s
|
|
6
|
-
* BOUNDARY isolation:
|
|
7
|
-
* - HEAP cap (`resourceLimits.maxOldGenerationSizeMb`): a runaway-allocation script OOMs the WORKER (an `error`
|
|
8
|
-
* event), never the shared main process — closes the in-process resource-exhaustion gap.
|
|
9
|
-
* - `terminate()` on wall-clock timeout / abort: kills a MICROTASK-starvation loop (`while(true){await null}`)
|
|
10
|
-
* the in-process wall-clock race cannot pre-empt (it starves its own event loop).
|
|
11
|
-
* - credential isolation: the worker gets only the script + args; `agent`/`log` IPC to the main thread (which
|
|
12
|
-
* holds the real Runner/DB/keys); a (validated-impossible) boundary crossing lands in a credential-free isolate.
|
|
13
|
-
*
|
|
14
|
-
* `safeForUntrustedScripts: true` — the membrane it runs is the conformance-validated + robustness-tested one. Use
|
|
15
|
-
* this (over the in-process runner) for genuinely-untrusted multi-tenant scripts where resource isolation matters.
|
|
16
|
-
*/
|
|
17
3
|
export declare function createWorkerHardenedVmRunner(limits?: HardenedVmLimits): WorkflowScriptRunner;
|
|
18
4
|
//# sourceMappingURL=hardened-vm-worker-runner.d.ts.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Worker } from "node:worker_threads";
|
|
2
2
|
import { WorkflowScriptError } from "@sema-agent/core";
|
|
3
3
|
import { scopedPhaseGate, workflowTotalTimeoutMsDefault } from "./hardened-vm-runner.js";
|
|
4
|
+
import { createLogger } from "../observability/logger.js";
|
|
4
5
|
const DEFAULTS = { totalTimeoutMs: workflowTotalTimeoutMsDefault(), syncTimeoutMs: 5_000, maxAgents: 1000, concurrency: 12, maxHeapMb: 128 };
|
|
5
6
|
const IS_TS = import.meta.url.endsWith(".ts");
|
|
6
7
|
const WORKER_URL = new URL(IS_TS ? "./hardened-vm-worker.ts" : "./hardened-vm-worker.js", import.meta.url);
|
|
7
8
|
const WORKER_EXEC_ARGV = IS_TS ? ["--import", "tsx/esm"] : undefined;
|
|
9
|
+
const containedLog = createLogger();
|
|
8
10
|
export function createWorkerHardenedVmRunner(limits = {}) {
|
|
9
11
|
const cfg = { ...DEFAULTS, ...limits };
|
|
10
12
|
return {
|
|
@@ -60,6 +62,9 @@ export function createWorkerHardenedVmRunner(limits = {}) {
|
|
|
60
62
|
else if (msg.type === "log") {
|
|
61
63
|
primitives.log(String(msg.msg));
|
|
62
64
|
}
|
|
65
|
+
else if (msg.type === "scriptRejectionContained") {
|
|
66
|
+
containedLog.warn("unhandled_rejection_script_realm_contained", { reason: String(msg.reason) });
|
|
67
|
+
}
|
|
63
68
|
else if (msg.type === "done") {
|
|
64
69
|
finish(() => resolve({ result: msg.result, meta: (msg.meta ?? { name: "workflow", description: "" }) }));
|
|
65
70
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parentPort, workerData } from "node:worker_threads";
|
|
2
2
|
import { splitWorkflowMeta } from "@sema-agent/core";
|
|
3
3
|
const ext = import.meta.url.endsWith(".ts") ? "ts" : "js";
|
|
4
|
-
const { runInHardenedVm, orchestrationGlobals } = (await import(`./hardened-vm-runner.${ext}`));
|
|
4
|
+
const { runInHardenedVm, orchestrationGlobals, installScriptRejectionReport } = (await import(`./hardened-vm-runner.${ext}`));
|
|
5
5
|
const port = parentPort;
|
|
6
6
|
if (!port)
|
|
7
7
|
throw new Error("hardened-vm-worker must run inside a worker_thread");
|
|
@@ -26,6 +26,7 @@ port.on("message", (msg) => {
|
|
|
26
26
|
p.rej(e);
|
|
27
27
|
}
|
|
28
28
|
});
|
|
29
|
+
installScriptRejectionReport((summary) => port.postMessage({ type: "scriptRejectionContained", reason: summary }));
|
|
29
30
|
const ipcCall = (type, extra) => new Promise((res, rej) => {
|
|
30
31
|
const id = nextId++;
|
|
31
32
|
pending.set(id, { res, rej });
|
|
@@ -39,14 +39,14 @@ export type WorkflowRunParkKey = NonNullable<WorkflowRun["parks"]>[number];
|
|
|
39
39
|
* · 这一位**在场却不是数组** ⇒ 读不出(`undefined`):记录说了话、说的不是一份列表;
|
|
40
40
|
* · 每条四个身份位必须是非空串;`originUnconfirmed` 只认字面 `true`(core 从不写 `false`);
|
|
41
41
|
* · **持有者两成员同进同出**(core 7.44.0 逐字:both or neither):`parkedBy` 非空串、`generation` 非负安全整数;只有其一、或任一形坏
|
|
42
|
-
* ⇒ 坏条目。两者皆无 =
|
|
42
|
+
* ⇒ 坏条目。两者皆无 = 引擎 7.43 及以前写的条目(不持有任何东西),照读;
|
|
43
43
|
* · **任一条目形坏 ⇒ 整只读不出来**(整档成败制):core 对同一形整条拒 resume(`park_binding_broken`);「丢掉坏的、留下好的」会静默
|
|
44
44
|
* 铸出一份**比真相少几条 park** 的集合,而这只读者的消费面正是 park 的路由与赎回。
|
|
45
45
|
*/
|
|
46
46
|
export declare function readRunParks(run: unknown): WorkflowRunParkKey[] | undefined;
|
|
47
47
|
/**
|
|
48
48
|
* 🔴 **「这条记录的 run 持有这条停驻」的唯一读法**(core 7.44.0 [ref] 逐字):`entry.parkedBy === record.id`。
|
|
49
|
-
* 继承来、本跑还没走到的条目带上一跑的 id
|
|
49
|
+
* 继承来、本跑还没走到的条目带上一跑的 id;引擎 7.43 及以前写的条目两成员皆无 —— 两者都不是本记录持有的。
|
|
50
50
|
*/
|
|
51
51
|
export declare function heldParksOf(recordId: string, parks: readonly WorkflowRunParkKey[]): WorkflowRunParkKey[];
|
|
52
52
|
/**
|
|
@@ -62,12 +62,11 @@ export declare function buildParkSessionRows(runId: string, run: {
|
|
|
62
62
|
* 一次路由的判决(闭集):
|
|
63
63
|
* · `held` —— 持有这个子会话的记录里最高代次**恰一条**:`park` = 它持有的那一条条目(赎回键在条目上);
|
|
64
64
|
* · `forked` —— 最高代次上不止一条记录(同一条 run 先后被续跑两次,两支都走到了这里):`runIds` 升序;
|
|
65
|
-
* · `unproven` ——
|
|
66
|
-
* `
|
|
67
|
-
* `readableHolderRunId` 只在 `unreadable` 上可能在场 —— **其余可读候选里**持有它的最高代次**恰一条**记录(规则 ②,与 `held` 同一只判);没有 / 并列 ⇒ 缺席。
|
|
65
|
+
* · `unproven` —— 没有任何记录持有它,而这件事证不了:某一条候选记录的 `parks[]` 读不出(它可能就是持有者);`runId` = 读不出的那几条里 id 最小的;
|
|
66
|
+
* `readableHolderRunId` —— **其余可读候选里**持有它的最高代次**恰一条**记录(规则 ②,与 `held` 同一只判);没有 / 并列 ⇒ 缺席。
|
|
68
67
|
* 它不改判决(任一读不出 ⇒ 整卡拒不变),只让拒体多给一条线索:读不出的那条引擎往往恰拒续跑,而健康的持有者就在旁边(工作可从它续上;
|
|
69
68
|
* 读不出的那条的指针仍在候选里,续跑它之后这张卡照旧整卡拒,直到那条记录被修好);
|
|
70
|
-
* · `none` ——
|
|
69
|
+
* · `none` —— 候选全部读得出、没有任何记录持有它(含点名它的条目没有持有者位的存量记录 —— 引擎 7.43 及以前写下)⇒ 诚实 miss。
|
|
71
70
|
*/
|
|
72
71
|
export type WorkflowParkRoute = {
|
|
73
72
|
readonly kind: "held";
|
|
@@ -79,7 +78,6 @@ export type WorkflowParkRoute = {
|
|
|
79
78
|
readonly runIds: readonly string[];
|
|
80
79
|
} | {
|
|
81
80
|
readonly kind: "unproven";
|
|
82
|
-
readonly cause: "unreadable" | "older_engine";
|
|
83
81
|
readonly runId: string;
|
|
84
82
|
readonly run: WorkflowRun;
|
|
85
83
|
readonly readableHolderRunId?: string;
|
|
@@ -90,14 +88,11 @@ export type WorkflowParkRoute = {
|
|
|
90
88
|
* 🔴 **路由与赎回的唯一判决**(纯函数;输入 = 点名这个子会话的每一条记录,读不到的记录 —— 已被收割 —— 由调用方先剔掉)。
|
|
91
89
|
*
|
|
92
90
|
* 一条规则,按序:
|
|
93
|
-
* ① 任一候选的 `parks[]` 读不出 ⇒ `unproven
|
|
91
|
+
* ① 任一候选的 `parks[]` 读不出 ⇒ `unproven`(它可能正是最高代次的持有者;宁可不投,绝不投错 —— 引擎对条目形坏的记录整条拒续跑);
|
|
94
92
|
* 其余可读候选按下一条判出的持有者(恰一条)带进 `readableHolderRunId`(只给出路,不改判决);
|
|
95
93
|
* ② 其余候选里,持有这个子会话({@link heldParksOf})的条目取最高 `generation`:恰一条记录 ⇒ `held`;多于一条 ⇒ `forked`;
|
|
96
|
-
* ③
|
|
97
|
-
* 写下自己的代次 0 行);否则 `none`。
|
|
94
|
+
* ③ 没有持有者 ⇒ `none`(点名它的条目没有持有者位的存量记录同判:那种条目不持有任何东西)。
|
|
98
95
|
* 判决不看写序、不看 `agents[]`、不看 `originRunId`(core:那一位说的是「材料在哪条 run 的 journal 里」,不是「谁站在上面」)。
|
|
99
|
-
*
|
|
100
|
-
* 🔴 **窗与删码**:规则 ③ 的 `older_engine` 读臂是一次性迁移 M9 的读侧半场(升级那一刻还停驻着的存量记录)。窗口与删码清单见 `plugins/one-time-migrations.ts` 登记表 M9 一行,随 M9 一起删;这里不写第二份窗。
|
|
101
96
|
*/
|
|
102
97
|
export declare function routeWorkflowPark(sessionId: string, candidates: readonly WorkflowRun[]): WorkflowParkRoute;
|
|
103
98
|
/** 账本一行的**内域形**:一条 run 当时的整份指针快照(`{runId, rows}`;同一条 run 后写的一行整份覆盖先写的 —— 本仓只增不删,所以后一行恒是前一行的超集)。 */
|
|
@@ -57,17 +57,12 @@ export function routeWorkflowPark(sessionId, candidates) {
|
|
|
57
57
|
const top = highestHolders(sessionId, readable);
|
|
58
58
|
if (firstUnreadable !== undefined) {
|
|
59
59
|
const holder = top.length === 1 ? top[0].run.id : undefined;
|
|
60
|
-
return { kind: "unproven",
|
|
60
|
+
return { kind: "unproven", runId: firstUnreadable.id, run: firstUnreadable, ...(holder !== undefined ? { readableHolderRunId: holder } : {}) };
|
|
61
61
|
}
|
|
62
62
|
if (top.length === 1)
|
|
63
63
|
return { kind: "held", runId: top[0].run.id, run: top[0].run, park: top[0].park };
|
|
64
64
|
if (top.length > 1)
|
|
65
65
|
return { kind: "forked", runIds: top.map((t) => t.run.id) };
|
|
66
|
-
const older = readable.filter(({ parks }) => parks.some((p) => p.sessionId === sessionId && p.parkedBy === undefined));
|
|
67
|
-
if (older.length > 0) {
|
|
68
|
-
const latest = older.reduce((a, b) => (b.run.createdAt > a.run.createdAt || (b.run.createdAt === a.run.createdAt && b.run.id > a.run.id) ? b : a));
|
|
69
|
-
return { kind: "unproven", cause: "older_engine", runId: latest.run.id, run: latest.run };
|
|
70
|
-
}
|
|
71
66
|
return { kind: "none" };
|
|
72
67
|
}
|
|
73
68
|
function highestHolders(sessionId, readable) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SemaProvenanceInput } from "../trace/sema-provenance.js";
|
|
2
1
|
import { type SystemInjectionPriority, type TaskNotificationPayload } from "@sema-agent/core";
|
|
3
2
|
import type { LedgerEventType } from "../trace/ledger-events.js";
|
|
4
3
|
/** One pending completion, scoped to the session that must be told about it. `summary` is ALREADY
|
|
@@ -17,11 +16,12 @@ export interface WorkflowCompletionInboxEntry {
|
|
|
17
16
|
* originating leg was IDLE (core's in-process injection had no harness to steer — the durable half
|
|
18
17
|
* is the deployment's job). `runId` then holds the core task_id (disjoint id spaces). */
|
|
19
18
|
kind?: "workflow_complete" | "task_notification";
|
|
20
|
-
/** The per-kind extras as a JSON text — bounded + redacted AT ENQUEUE (the store carries only egress-safe bytes)
|
|
19
|
+
/** The per-kind extras as a JSON text — bounded + redacted AT ENQUEUE (the store carries only egress-safe bytes) and judged against
|
|
20
|
+
* the entry byte budget by {@link encodeInboxBody}, the only minter of {@link InboxPayload}.
|
|
21
21
|
* `task_notification`: {task_type, toolUseId?, result?, output_file?, …}. `workflow_complete`: at most `{"completionId": …, "diagnostics": …}`
|
|
22
|
-
* (see {@link buildWorkflowCompleteInboxEntry}; each key absent when the engine minted none).
|
|
23
|
-
* column carries it verbatim for both kinds — no DDL. */
|
|
24
|
-
payload?:
|
|
22
|
+
* (see {@link buildWorkflowCompleteInboxEntry}; each key absent when the engine minted none). Over budget, either kind carries its minimal
|
|
23
|
+
* form instead (stream-key fields + `_sema_provenance` when it fits + `payloadTruncated`). The SQL stores' existing `payload` column carries it verbatim for both kinds — no DDL. */
|
|
24
|
+
payload?: InboxPayload;
|
|
25
25
|
}
|
|
26
26
|
/** Session-keyed queue of finished-workflow completions awaiting a push to the originating session.
|
|
27
27
|
* Two-phase delivery (1.80, closes the 1.77-review "drained-but-append-failed" at-most-once window): `pending`
|
|
@@ -199,11 +199,26 @@ export declare class FileWorkflowCompletionInbox extends InMemoryWorkflowComplet
|
|
|
199
199
|
/** Close the ledger fd (shutdown). */
|
|
200
200
|
close(): void;
|
|
201
201
|
}
|
|
202
|
+
/** 品牌键:模块私有的 `unique symbol` —— 别处写不出一个 {@link InboxPayload} 字面量。 */
|
|
203
|
+
declare const INBOX_PAYLOAD: unique symbol;
|
|
204
|
+
/** 判过条目字节预算的 `payload` 文本(JSON)。`string` 的子型:读者零改;条目的 `payload` 位只收 {@link encodeInboxBody} 铸的值 ⇒ 绕过预算座是 tsc 红。
|
|
205
|
+
* 读侧(SQL 店把列读回来、File 店重放账本)单跳收窄:那些字节只可能是本座写下的(或预算立座之前的存量行,drain 照读)。 */
|
|
206
|
+
export type InboxPayload = string & {
|
|
207
|
+
readonly [INBOX_PAYLOAD]: true;
|
|
208
|
+
};
|
|
209
|
+
/** 被裁条目在 payload(与 drain 出的补投帧)上的点名:`droppedKeys` = 全形里被丢的成员名(全形键序;末尾的 `summary` = 摘要原句被扣下、帧上的 `summary`
|
|
210
|
+
* 是 {@link INBOX_SUMMARY_WITHHELD}),`bytes` = 全形的 UTF-8 字节数。 */
|
|
211
|
+
export interface PayloadTruncated {
|
|
212
|
+
droppedKeys: string[];
|
|
213
|
+
bytes: number;
|
|
214
|
+
}
|
|
215
|
+
/** 摘要原句因失去归因被扣下时,帧上 `summary` 换成的**本服务铸**的一句(受信、不含任何对端字节)。 */
|
|
216
|
+
export declare const INBOX_SUMMARY_WITHHELD = "[payload over budget: summary withheld; see payloadTruncated]";
|
|
202
217
|
/**
|
|
203
218
|
* 一次 workflow 完成 → 入箱条目(`workflow_complete` 家族;启动期投递闭包的**唯一**构造点)。`summary` 在 core 的 notifier seam 上已脱敏 + 限长,这里原样入箱;
|
|
204
219
|
* `completionId`(引擎铸,`WorkflowCompletionPayload` 上在场 iff 引擎给了)逐字落进 `payload` 列 —— 同一次完成的补投帧与 live 帧同一个相关 id,本服务零自铸。
|
|
205
|
-
* `diagnostics`(引擎铸的诊断教学文本,在场 iff 引擎给了)是自由文本:**这里**过出口座(`
|
|
206
|
-
*
|
|
220
|
+
* `diagnostics`(引擎铸的诊断教学文本,在场 iff 引擎给了)是自由文本:**这里**过出口座(`completion-diagnostics-text` 行 —— 与 live `task_notification.diagnostics` **同一行**:同一份脱敏、同一份界、
|
|
221
|
+
* 读者是人的档在行上声明)再落 `payload` 列,drain 逐字带出;店里不放未洗的字节。引擎 notifier seam 递来的已是抹过的文本,座再读一遍是恒等(档的不动点)—— 补投帧与 live 帧的一致不靠上游记得抹。
|
|
207
222
|
*/
|
|
208
223
|
export declare function buildWorkflowCompleteInboxEntry(route: {
|
|
209
224
|
sessionId: string;
|
|
@@ -225,7 +240,7 @@ export declare function buildWorkflowCompleteInboxEntry(route: {
|
|
|
225
240
|
* deterministic `WorkflowStatus` poll is the floor); at-least-once — the shell dedups by runId (two legs racing
|
|
226
241
|
* the same session may double-emit; same contract).
|
|
227
242
|
*
|
|
228
|
-
* 🔒 Tenancy (defence-in-depth over the authorizer's sessionId→owner gate): only entries whose stamped
|
|
243
|
+
* 🔒 Tenancy (defence-in-depth over the authorizer's sessionId→owner gate; the face `inbox.drain` in `owner-faces.ts`): only entries whose stamped
|
|
229
244
|
* `owner` matches `callerPrincipal` are EMITTED — a session deleted-then-reclaimed by a different tenant
|
|
230
245
|
* (which rotates the sessionId→owner binding) can't surface the prior owner's completions. `owner: null`
|
|
231
246
|
* (single-user turnkey) has no tenancy boundary → always emitted. A non-matching entry is a DELIBERATE drop —
|
|
@@ -286,7 +301,12 @@ export type EngineNotificationParkInput = ParkedNotificationFields & {
|
|
|
286
301
|
from: string;
|
|
287
302
|
body: string;
|
|
288
303
|
};
|
|
289
|
-
_sema_provenance?:
|
|
304
|
+
_sema_provenance?: unknown;
|
|
305
|
+
/** [ref]:会话箱车道的三只载体 —— 判据与 live 腿同一只(`trace/task-notification-facets.ts`,入参按 `unknown` 收)。park 腿**真的会**收到它们:
|
|
306
|
+
* 会话箱 drain 的注入先经本服务的 `onTaskNotification` 观察者,sync 腿的停驻判据含「客户端已断开」(run 未收束的窗里一次轮界 drain 就走到这里)。 */
|
|
307
|
+
crossSessionMessage?: unknown;
|
|
308
|
+
crossSessionNotice?: unknown;
|
|
309
|
+
inboxNotice?: unknown;
|
|
290
310
|
/** [ref](core 7.30.0 [ref] S1 / [ref] / [ref]):委派终态帧三枚 facet + 重供两键 —— 判据与 live 腿同一只
|
|
291
311
|
* (`trace/task-notification-facets.ts`,入参按 `unknown` 收、判过形才成 typed)。 */
|
|
292
312
|
spawnName?: string;
|