@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
|
@@ -37,13 +37,19 @@ import type { SessionUnreadable } from "../session-error-wire.js";
|
|
|
37
37
|
* F1 [high] 实测:`DB_BACKEND` 未设时坏账本 ⇒ `{backend: undefined, degraded: true}`,不是拒启)。
|
|
38
38
|
* 收法:**一个基类,一条重抛**。新 File 店的拒启只要 `extends StoreBootRefusalError` 就自动落在正确的
|
|
39
39
|
* 一侧;忘了继承是**可见**的(它是一个必须显式选择的父类),而忘了往 if 链里加一行是不可见的。
|
|
40
|
-
* (core 的 `AdoptionError`
|
|
40
|
+
* (core 的 `AdoptionError` 不在本族:它的标记住在数据根里,而降级臂只对**空 / 不存在**的数据根开(`openStoreBackendWithFallback` 的数据根判据),
|
|
41
|
+
* 它到不了降级那一步 ⇒ 降级臂不为它单开一条。local 形上本族同样先被那条判据兜住;族规仍在,管的是拒句的属主与 SQL 族。)
|
|
41
42
|
*
|
|
42
43
|
* 族的含义是「**确定的拒启表态**」,不限 File 店:SQL `ensureSchema()` 里库带着已退役 schema 的拒启(`RetiredSchemaPresentError`)也属此族。三处读它,读法一致 ——
|
|
43
44
|
* 降级臂不吞(穿过 `mayFallback`)、SQL 开库的等待窗不重试它(`store-open-wait.ts`:再等也等不来另一个答案)、「库打不开」的拒句不改写它(它自己的拒句才是真话)。
|
|
44
45
|
*/
|
|
45
46
|
export declare class StoreBootRefusalError extends Error {
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* 起服对账一族的拒启码(机读;附录 A / 拒启码表的登记名)。含义 = 「本构建读不出 / 建不出的持久形,开始服务之前判」:SQL 列册对账与退役 schema 两道(`schema-consistency.ts`)、
|
|
50
|
+
* 会话部署格旁表建不出(`session-ext-table.ts`)、local 数据根的严格边档对账(`local-session-store.ts`)。码住在族基类旁边:读它的几只模块彼此不必互相 import。
|
|
51
|
+
*/
|
|
52
|
+
export declare const SCHEMA_MISMATCH_ERROR_CODE = "config.schema_mismatch";
|
|
47
53
|
/**
|
|
48
54
|
* 取消便签里的**大脑相位**快照 —— core `BrainStatus` 帧经 `brainStatusEventData` 投影后的五键子集。
|
|
49
55
|
*
|
|
@@ -109,7 +115,10 @@ export interface RunCancelContext {
|
|
|
109
115
|
* (`http/routes/tasks.ts` 的断连臂,立即中止);
|
|
110
116
|
* · `ask_park_grace_exhausted` —— 同一断连臂,但断连那一刻有流内未决 ask、已按窗到期同路转 park,宽限计时器用尽时 park 仍没落成;
|
|
111
117
|
* · `cancel_verb` —— `POST /v1/runs/:id/cancel`:同副本快路、跨副本耐久取消旗的轮询(四条腿的心跳 / 登记追平),
|
|
112
|
-
* 以及 park 中的 run 被它直接终局化(那一形不经 abort,成因照样是这条动词)
|
|
118
|
+
* 以及 park 中的 run 被它直接终局化(那一形不经 abort,成因照样是这条动词);
|
|
119
|
+
* · `stall_verdict` —— 持有者自己的心跳答「这条 run 的行已不在跑」(被观察口 / 认领冲突 / 收割器判死,`run.stalled`):持有者停下自己的腿
|
|
120
|
+
* (四条腿的心跳拍与认领心跳,判法一处 `runs.ts` 的 `beatRunHeartbeat`)。行上的终局是那份死亡判决(这条腿的终局写 CAS 打空),
|
|
121
|
+
* 本成因只落在这条腿自己铸的取消终局上(账本行 / 本连接的流)。
|
|
113
122
|
* **刻意不在表里**(普查过、没有真站点):抢占(`preempt` 是优雅让出,终局是 `paused`,不是取消)、有序关停
|
|
114
123
|
* ([ref] 只把未决卡转 park,从不中止活 run;进程退出后的行由收割器落「持有者死亡」判决,那不是本仓铸的取消终局)、
|
|
115
124
|
* `interrupt`(引擎的 turn 动词,终局 `completed` + `haltedByUser`)、detach 断连(不中止)。
|
|
@@ -118,7 +127,7 @@ export interface RunCancelContext {
|
|
|
118
127
|
* (中止那一刻登记)与 `mintCancelledResult`(终局铸点读它),自铸 wire 值登记 = `trace/self-minted-wire.ts` 的 `abortCause`
|
|
119
128
|
* (`satisfies Record<AbortCause, …>`:加 / 删一个词而登记没跟 ⇒ tsc 红)。
|
|
120
129
|
*/
|
|
121
|
-
export declare const ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb"];
|
|
130
|
+
export declare const ABORT_CAUSES: readonly ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb", "stall_verdict"];
|
|
122
131
|
export type AbortCause = (typeof ABORT_CAUSES)[number];
|
|
123
132
|
/**
|
|
124
133
|
* server 自铸、挂在终局结果上的**侧记键**全集(都描述「server 这一侧发生了什么」,core 那一侧无从知道)。
|
|
@@ -145,8 +154,8 @@ export type PersistedTaskResult = TaskResult & PersistedResultSideKeys;
|
|
|
145
154
|
/**
|
|
146
155
|
* 🔴 run 店「持有它的实例丢了」那一判的**行上落款**([ref] codex r1-F1 提为常量):三只 run 店的 `reapStale` 把心跳过期的 running 行翻成
|
|
147
156
|
* `failed` 并写下这一句。它是 run 店死亡判决留在行上的证据之一(另一只 = {@link RUN_ORPHANED_ERROR})—— 用户输入受理账本的收敛判词
|
|
148
|
-
* ([ref] L8 起两车道同一只)据 {@link isHolderDeathVerdict} 在 reap **之后**仍能判出「写者死了」—— 7.116.0 起判据是同行的机读码 `run.stalled`({@link RUN_HOLDER_DEATH_CODES})
|
|
149
|
-
* (
|
|
157
|
+
* ([ref] L8 起两车道同一只)据 {@link isHolderDeathVerdict} 在 reap **之后**仍能判出「写者死了」—— 7.116.0 起判据是同行的机读码 `run.stalled`({@link RUN_HOLDER_DEATH_CODES}),本句只给人读;三个落判决处(收割器 / 观察口 / 认领冲突)同写句子与码,同一只语句。
|
|
158
|
+
* 两条流的死亡终帧(run 流 `failed`、trace 流 `WORKER_DOWN`)读的是**行上**的这一句,不再各留字面量。
|
|
150
159
|
*/
|
|
151
160
|
export declare const RUN_STALLED_ERROR = "run stalled (instance lost?)";
|
|
152
161
|
/**
|
|
@@ -273,8 +282,8 @@ export interface NewRunMeta {
|
|
|
273
282
|
* `task_id`(调用方自铸的 `body.taskId`)—— 两把钥匙是**同一条律**(资源行上的唯一键),先认 `idem_key` 再认 `task_id`。
|
|
274
283
|
* 这是「原子赢或观察」的**观察**臂:行原样交回,没建新行、没动会话;回执由提交面的唯一回执函数判。
|
|
275
284
|
* · `{ ok: false, activeTaskId }` —— 会话被**别的** run 占着(双发守卫),没建行;
|
|
276
|
-
* · `{ ok: false, sessionAbsent: true }` —— 根会话行不在(SQL
|
|
277
|
-
*
|
|
285
|
+
* · `{ ok: false, sessionAbsent: true }` —— 根会话行不在(受理之后会话被删),没建行、没认领。SQL 孪生 = 认领事务里锁根行读到零行;
|
|
286
|
+
* File 孪生 = 在根行面({@link SessionRootRows},装配 = local 会话店)的锁里判这一行不在。Memory 孪生不接会话店(配它的引擎内存会话店没有根行),不答这一形。
|
|
278
287
|
* 其余几位在每一形上恒 `undefined`(读 `created.existing` / `created.activeTaskId` / `created.sessionAbsent` 不用先窄化,判别仍是穷举的)。
|
|
279
288
|
*/
|
|
280
289
|
export type CreateRunOutcome = {
|
|
@@ -331,6 +340,20 @@ export type FenceLanded = typeof FENCE_LANDED;
|
|
|
331
340
|
export interface InProcessClaimFence {
|
|
332
341
|
whileHoldingClaim(sessionId: string, taskId: string, write: (run: FencedRun) => FenceLanded): boolean;
|
|
333
342
|
}
|
|
343
|
+
/** 认领栅栏的两形(闭集):SQL 孪生一只事务(`SqlRunStore`)/ 进程内同步(File / Memory 孪生)。判的都是「`taskId` 此刻持有 `sessionId` 的认领且在跑」。
|
|
344
|
+
* 两形的判别位 = `db`(SQL 形带它的驱动,进程内形没有):店按 `"db" in fence` 分形,不必为判形去值引用 SQL run 店的类。 */
|
|
345
|
+
export type ClaimFenceStore = import("./run-store-sql.js").SqlRunStore | InProcessClaimFence;
|
|
346
|
+
/**
|
|
347
|
+
* 🔴 [ref] **一笔续跑输入写所凭的那只认领**(检查点店的写口 `putCtx` 交认领的那一形与 `rewriteCtxWhileClaimed` 收它):
|
|
348
|
+
* `fence` = 写者持认领的那只 run 店(栅栏的来源就是认领本身 —— 检查点店不在构造期另绑一份 run 店),`taskId` = 持认领的 run,
|
|
349
|
+
* `legHolds` = 腿判据(在栅栏里对锁住 / 同步段里那一行同步问一次,只读、不许 await)。
|
|
350
|
+
* 装配契约:SQL 检查点店只收同一库上的 SQL run 店(两店出自同一后端;店按判别位 `db` 判 SQL 形且方言同,错形响亮抛),local 检查点店只收进程内栅栏。
|
|
351
|
+
*/
|
|
352
|
+
export interface CtxWriteClaim {
|
|
353
|
+
readonly fence: ClaimFenceStore;
|
|
354
|
+
readonly taskId: string;
|
|
355
|
+
readonly legHolds: (run: FencedRun) => boolean;
|
|
356
|
+
}
|
|
334
357
|
/**
|
|
335
358
|
* `RunRecord["status"]`(= `"running" | TaskStatus`)的**唯一分类表** —— 词表的属主 = 判据的属主,
|
|
336
359
|
* 与类型定义同住一个文件。四个类:
|
|
@@ -376,6 +399,31 @@ export type UnsuccessfulRunStatus = {
|
|
|
376
399
|
export type ParkedRunStatus = {
|
|
377
400
|
[K in RunRecord["status"]]: (typeof RUN_STATUS_CLASS)[K] extends "parked" ? K : never;
|
|
378
401
|
}[RunRecord["status"]];
|
|
402
|
+
/**
|
|
403
|
+
* 🔴 **「这条 run 死了没」的唯一判决**(纯函数,闭集五词)。输入只有行(`status` / `updatedAt`)、时钟、窗(`REAP_RUN_STALE_SEC` × 1000,活配置);
|
|
404
|
+
* 认领、turn 活性、「这一拍有没有新事件」都**不是**输入。按状态类判,类只问词表属主 {@link runStatusClassOf}:
|
|
405
|
+
* · `live` 类:最后一次心跳早于 `nowMs − windowMs` ⇒ `due`(该落死亡判决了),否则 `live`。边界与收割器的 `updated_at < cutoff` 逐字相同;解析不出的时间戳 ⇒ `live`(少动一次);
|
|
406
|
+
* · `parked` 类 ⇒ `parked`(停驻不在心跳判据的射程里);终局两类 ⇒ `settled`;
|
|
407
|
+
* · **表外词 ⇒ `unknown`**(滚动升级里更新副本写下的新状态,`rowToRun` 是裸 cast):不落、不抛、按行原样答 —— 与属主「读不懂就少动」同方向。
|
|
408
|
+
* **只在落判决处用**(三只 run 店:收割器 `reapStale`、观察口 `observeRun`、认领冲突);店外没有任何代码拿心跳去比时钟(源码门 `test/run-liveness-single-source-gate.test.ts`)。
|
|
409
|
+
*/
|
|
410
|
+
export type RunLiveness = "live" | "due" | "parked" | "settled" | "unknown";
|
|
411
|
+
export declare function runLivenessOf(row: Pick<RunRecord, "status" | "updatedAt">, nowMs: number, windowMs: number): RunLiveness;
|
|
412
|
+
/**
|
|
413
|
+
* run 店落死亡判决要的两样(店在构造时拿到,三只店同形):判活窗(getter —— 生产装配读活配置 `runStaleSec`,热发布原地改写的值下一读就见)
|
|
414
|
+
* 与落判决计数(每次落下 n 条:`runs_reaped_total{kind:"stale"}`,收割器 / 观察口 / 认领冲突同一只)。
|
|
415
|
+
*/
|
|
416
|
+
export interface RunStallWiring {
|
|
417
|
+
readonly windowMs: () => number;
|
|
418
|
+
readonly onVerdicts: (landed: number) => void;
|
|
419
|
+
}
|
|
420
|
+
/** 不经后端装配、直接构造的店(测试 / 嵌入方)的缺省:窗 = 配置缺省值,计数不记。生产装配(`store-backend.ts`)一律递活的两样。 */
|
|
421
|
+
export declare const RUN_STALL_DEFAULT_WIRING: RunStallWiring;
|
|
422
|
+
/**
|
|
423
|
+
* 观察口落判决写失败的 F 类标签(行原样交回,收割器下一拍补落;`observability/fail-open.ts` 登记,`docs/FAIL-OPEN-CENSUS.md` 一行)。
|
|
424
|
+
* 三只店与认领冲突臂同一只。
|
|
425
|
+
*/
|
|
426
|
+
export declare const RUN_STALL_VERDICT_UNLANDED_TAG = "server.run-store.stall-verdict-unlanded";
|
|
379
427
|
/**
|
|
380
428
|
* 一个状态词的类;**表里没有的词 ⇒ `undefined`**。
|
|
381
429
|
*
|
|
@@ -492,17 +540,19 @@ export declare function sessionTempoOfRunStatus(lastStatus: string): PeerSession
|
|
|
492
540
|
export declare function runProvenElsewhere(run: {
|
|
493
541
|
instanceId?: string | null;
|
|
494
542
|
}, thisInstanceId: string | undefined): boolean;
|
|
495
|
-
/** One row of the GET /v1/sessions list (CC /resume picker):
|
|
496
|
-
* task_run rows — newest-first by last activity.
|
|
497
|
-
*
|
|
543
|
+
/** One row of the GET /v1/sessions list (CC /resume picker): one session ROW of the session store (the only session lister) with the
|
|
544
|
+
* run-derived half ({@link SessionRunRollup}) joined from its task_run rows — newest-first by last activity. Owner included so a
|
|
545
|
+
* fleet-wide (ops) listing is attributable. */
|
|
498
546
|
export interface SessionSummary {
|
|
499
547
|
sessionId: string;
|
|
500
548
|
owner: string | null;
|
|
501
|
-
/** The
|
|
549
|
+
/** The session row's last-activity time (the keyset sort key) and its creation time. */
|
|
502
550
|
lastActivityAt: string;
|
|
503
551
|
firstActivityAt: string;
|
|
504
552
|
runCount: number;
|
|
505
|
-
/**
|
|
553
|
+
/** [ref]:the most recent run (`created_at DESC, task_id DESC`) whose preview column is a non-empty string (by character length) — that column;
|
|
554
|
+
* no such run ⇒ `null`. The preview is minted when the run row is written (injected blocks stripped → redacted → cut to 120), so the list and
|
|
555
|
+
* `GET /v1/tasks` read ONE column; the session transcript is not read. `lastStatus` stays the LATEST run's (rn=1) — the two are decoupled. */
|
|
506
556
|
objectivePreview: string | null;
|
|
507
557
|
lastStatus: string;
|
|
508
558
|
/** K-5c (shell §K): the LATEST run's task_id — the anchor the shell uses to re-attach the live event tail in ONE
|
|
@@ -513,39 +563,56 @@ export interface SessionSummary {
|
|
|
513
563
|
* wire 半场见 `security.ts SessionListItem.lastTaskRunId`(同名同义)。 */
|
|
514
564
|
lastTaskRunId?: string;
|
|
515
565
|
/** The session's title: the user's (`writeSessionRowCells`; `null` clears it back to automatic) or the auto-titler's
|
|
516
|
-
* (cheap-model one-liner, `setTitleIfNull` — fills NULL only). null = not (yet) titled
|
|
517
|
-
* task_run aggregate / memory twins — honest degrade). Writer order: `src/session-row.ts`. */
|
|
566
|
+
* (cheap-model one-liner, `setTitleIfNull` — fills NULL only). null = not (yet) titled. Writer order: `src/session-row.ts`. */
|
|
518
567
|
title: string | null;
|
|
519
|
-
/** Pinned by the user (`writeSessionRowCells`). Always present, `false` by default
|
|
520
|
-
* twins answer `false` (no session_meta ⇒ nothing there can pin it). */
|
|
568
|
+
/** Pinned by the user (`writeSessionRowCells`). Always present, `false` by default. */
|
|
521
569
|
pinned: boolean;
|
|
522
570
|
/** 行标签(`src/session-row.ts` 的 `sessionRowTagOf`):这一位住客「PATCH 能写的每一格」的单向摘要,present-iff 这一行可被条件写(店有行格写原语 ∧ 行上有化身);
|
|
523
|
-
* 只经店的列表行映射铸(`sessionRowTagKey`)
|
|
571
|
+
* 只经店的列表行映射铸(`sessionRowTagKey`)。wire 半场见 `security.ts SessionListItem.rowTag`(同名同义)。 */
|
|
524
572
|
rowTag?: string;
|
|
525
573
|
/** 这只会话的存档读不出:present-iff 头的叶子读不出(唯一铸点 `session-error-wire.ts` 的 `sessionUnreadableOf`;码与读口同表)。叶子是行上一列的店(SQL 孪生)
|
|
526
|
-
*
|
|
574
|
+
* 恒缺席。wire 半场见 `security.ts SessionListItem.unreadable`(同名同义)。 */
|
|
527
575
|
unreadable?: SessionUnreadable;
|
|
576
|
+
/** fork 谱系:建这一行的那次 fork 的源会话 id(core `SessionMetadata.forkedFrom` 原词)—— present-iff 这一行是 fork 建的、且建于谱系落地之后(更早的 fork 不回填:源已不可知)。
|
|
577
|
+
* 三店从行上读(谱系的唯一读法 `session-incarnation.ts` 的 `forkLineageOfRow`);来源住客(`forkedFromIncarnation`)不上列表行。wire 半场见 `security.ts SessionListItem.forkedFrom`(同名同义)。 */
|
|
578
|
+
forkedFrom?: string;
|
|
528
579
|
}
|
|
529
580
|
/**
|
|
530
|
-
*
|
|
531
|
-
*
|
|
581
|
+
* run 账里「每会话的 run 投影」的五位([ref] 四位 + [ref] 预览位)—— 会话列表行上出自 run 行的那一半:
|
|
582
|
+
* · `runCount` = 这只会话的 run 行数;`lastStatus` / `lastRunId` / `lastTaskRunId` = 最新一条(`created_at DESC, task_id DESC`,rn=1)的状态 / task_id / `result.runId`;
|
|
583
|
+
* · `objectivePreview` = 同一排序下第一条「预览列是串且长度 > 0」的那一列(按字符长度判,不按与 `""` 比较 —— SQL 孪生同一谓词 `CHAR_LENGTH(…) > 0`),没有 ⇒ `null`。
|
|
584
|
+
* 规则在 JS 侧只有一份:`plugins/session-run-rollup.ts` 的 {@link buildSessionRunRollups};SQL 侧是会话店列表投影里的子查询文本(`plugins/session-store-sql.ts`)。
|
|
585
|
+
*/
|
|
586
|
+
export type SessionRunRollup = Pick<SessionSummary, "runCount" | "lastStatus" | "lastRunId" | "lastTaskRunId" | "objectivePreview">;
|
|
587
|
+
/**
|
|
588
|
+
* 会话**枚举面**读 run 账的窄读面([ref] 立、[ref] 改名并加预览位与 `q`):一次读交回「有 run 行的每只会话 → 它的 {@link SessionRunRollup}」。
|
|
532
589
|
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
* 「最新一条是谁」(此前 `runCount` / `lastStatus` 读 run 店、`lastRunId` / `lastTaskRunId` 读进程内座:重启后同一行「有终态词、`lastRunId` 为 null」);
|
|
537
|
-
* 不另造的另一半理由:再造一只 `listBySession` 就要在三个孪生里各落一遍并重新证一遍同口径。
|
|
590
|
+
* 唯一的消费方 = local 会话店(会话身份来自会话仓、不是 run 账):列表 / 单行读 / `?q=` 一次列表一次读(不随会话数 N+1);行上出自 run 行的五位全读这一只,
|
|
591
|
+
* 于是一行里不会出现两个来源各答一遍「最新一条是谁」或「预览是哪一句」。实现 = 文件 / 内存两只 run 店,都调同一只纯函数;SQL 双生不实现它 ——
|
|
592
|
+
* SQL 会话店的列表投影在同一条 SELECT 里 JOIN `task_run`,同一条规则。
|
|
538
593
|
*
|
|
539
|
-
*
|
|
594
|
+
* `q`(路由归一化之后的非空串)在场 ⇒ 只交「有一条 run 行的预览列含 q(大小写不敏感、字面)」的会话 —— 与 SQL 孪生的 `EXISTS` 同一条谓词;缺席 ⇒ 交全部有 run 行的会话。
|
|
595
|
+
* 会话店的 `listSessions` 是唯一的会话 lister;run 店不再列会话([ref] 删除半)。
|
|
540
596
|
*/
|
|
541
597
|
export interface SessionRunRollupSource {
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
}): Promise<
|
|
598
|
+
sessionRunRollups(opts?: {
|
|
599
|
+
readonly q?: string;
|
|
600
|
+
}): Promise<ReadonlyMap<string, SessionRunRollup>>;
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* **根行锁**的窄面(规则 L:改根行在不在 / 住客 / 认领的每个写者,先取根行锁、再碰认领 —— SQL 孪生 = 认领事务里先 `session_meta … FOR UPDATE`,
|
|
604
|
+
* 删除 / 导入的事务内钩在锁根行之后锁定读 `task_active`,全局锁序 根行 → 认领)。`withRootRow` 在这只根的行锁里跑 `body`,交给它**此刻**这一行在不在;
|
|
605
|
+
* 锁里的读数到 `body` 完成都稳定(改行在不在的写者都排在这把锁上)。实现 = local 会话店(这只会话的写锁 + 它的在场读法);唯一的消费方 = 文件 run 店的 `createRun`:
|
|
606
|
+
* 不在 ⇒ `sessionAbsent`,在 ⇒ 锁里再取认领锁。锁不可重入:持着根行锁的节不调 `createRun`。
|
|
607
|
+
*/
|
|
608
|
+
export interface SessionRootRows {
|
|
609
|
+
withRootRow<T>(sessionId: string, body: (present: boolean) => Promise<T>): Promise<T>;
|
|
545
610
|
}
|
|
546
611
|
/**
|
|
547
612
|
* 会话**此刻的 run 认领**(单活槽)的窄读面 —— run 店的 `getActiveTaskId`,同一个问题在 SQL 孪生里是写事务内对 `task_active` 的锁定读。
|
|
548
|
-
* local
|
|
613
|
+
* local 会话店在写锁(= 根行锁,{@link SessionRootRows})内读它:执行席的 `markMirror`(判序与 SQL 孪生同:行不在 / 住客不同 / writer / mirror 先判,认领只拦「absent → mirror」这一笔写)、
|
|
614
|
+
* 导入三写口与删除(判官 `judgeSessionWrite` 与 SQL 事务内钩同一只:先认领后本处写者)、placed 行的 `release`。认领唯一的运行期写者(`createRun`)排在同一把锁后面,
|
|
615
|
+
* 所以锁内读到的认领是稳定的(释放只会让读数更保守)。
|
|
549
616
|
*/
|
|
550
617
|
export interface SessionRunClaimSource {
|
|
551
618
|
getActiveTaskId(sessionId: string): Promise<string | undefined>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { RUN_STALE_SEC_DEFAULT } from "../run-stale-default.js";
|
|
1
2
|
export class StoreBootRefusalError extends Error {
|
|
2
3
|
}
|
|
3
|
-
export const
|
|
4
|
+
export const SCHEMA_MISMATCH_ERROR_CODE = "config.schema_mismatch";
|
|
5
|
+
export const ABORT_CAUSES = ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb", "stall_verdict"];
|
|
4
6
|
export const RUN_STALLED_ERROR = "run stalled (instance lost?)";
|
|
5
7
|
export const RUN_ORPHANED_ERROR = "run orphaned by engine restart";
|
|
6
8
|
export function buildRunOrphanedError(heldBy) {
|
|
@@ -21,6 +23,26 @@ export const RUN_STATUS_CLASS = {
|
|
|
21
23
|
needs_review: "parked",
|
|
22
24
|
};
|
|
23
25
|
const RUN_STATUS_CLASS_LOOKUP = Object.assign(Object.create(null), RUN_STATUS_CLASS);
|
|
26
|
+
export function runLivenessOf(row, nowMs, windowMs) {
|
|
27
|
+
const cls = runStatusClassOf(row.status);
|
|
28
|
+
if (cls === undefined)
|
|
29
|
+
return "unknown";
|
|
30
|
+
switch (cls) {
|
|
31
|
+
case "live":
|
|
32
|
+
return Date.parse(row.updatedAt) < nowMs - windowMs ? "due" : "live";
|
|
33
|
+
case "parked":
|
|
34
|
+
return "parked";
|
|
35
|
+
case "succeeded":
|
|
36
|
+
case "unsuccessful":
|
|
37
|
+
return "settled";
|
|
38
|
+
default: {
|
|
39
|
+
const unhandled = cls;
|
|
40
|
+
throw new Error(`runLivenessOf: unknown run status class ${String(unhandled)}`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export const RUN_STALL_DEFAULT_WIRING = { windowMs: () => RUN_STALE_SEC_DEFAULT * 1000, onVerdicts: () => undefined };
|
|
45
|
+
export const RUN_STALL_VERDICT_UNLANDED_TAG = "server.run-store.stall-verdict-unlanded";
|
|
24
46
|
export function runStatusClassOf(status) {
|
|
25
47
|
return RUN_STATUS_CLASS_LOOKUP[status];
|
|
26
48
|
}
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
export type StoreFaultClass = "corrupt" | "connection" | "deployment" | "unclassified";
|
|
2
|
-
/**
|
|
1
|
+
export type StoreFaultClass = "corrupt" | "connection" | "deployment" | "defect" | "unclassified";
|
|
2
|
+
/**
|
|
3
|
+
* 程序错的识别(闭集按类):运行时自己抛的六只原生错误类之一 —— 运行时为代码缺陷抛的错**从不带 `cause`**;带 `cause` 的原生错误类是某一层把下面的失败
|
|
4
|
+
* 包了一层报上来(undici 的 `fetch failed` 就是 `TypeError` 包着套接字错),说的是被包的那件事,不是这一层的缺陷 ⇒ 不认(落 `unclassified`)——;
|
|
5
|
+
* 或读腿漂移 `SqlJsonColumnError` 的 `not-text`。只看这一只对象,不沿 `cause` 链找。
|
|
6
|
+
*/
|
|
7
|
+
export declare function isCodeDefect(err: unknown): boolean;
|
|
8
|
+
/** 判官本体。纯函数、不抛;只看被抛出的这一只对象(不沿 `cause` 链找)。连接类与部署错配两张识别表互斥,两者之间判序不影响结果(`test/store-fault-judge.test.ts` 钉互斥);
|
|
9
|
+
* 程序错排在它们之后(带那两类归因键的对象按那两类认)。 */
|
|
3
10
|
export declare function storeFaultClassOf(err: unknown): StoreFaultClass;
|
|
11
|
+
/**
|
|
12
|
+
* 判官每个词的**对外句**(闭集 `Record`:判官加一个词而不在这里写出它对外怎么说 = 编译错)。这是本判官唯一的一张「对外怎么说」的表 ——
|
|
13
|
+
* 失败要出 wire 时,调用方只拿**类别**说话,不把驱动的原句(带库用户名 / 主机 / 表名 / 约束名)交出去;驱动原句只进运维日志
|
|
14
|
+
* (`terminal.ts` 的折码处),出口脱敏器是模式脱敏、认不出「这是库账号 / 表名」。每句只说两件事:**坏在哪一类** + **重试有没有用**,不带任何实例化的名字。
|
|
15
|
+
*
|
|
16
|
+
* 🔴 **句子只断言码本身证明得了的事**:判官读到的只有一个码,而同一个码形可以出自库驱动,也可以出自别的系统调用(`ECONNREFUSED` 出自任何一个套接字、`ENOENT` 出自文件系统),
|
|
17
|
+
* 所以 `connection` 说「一条连接」而不说「数据库的连接」;`unclassified` 只说「带了一个本服务不公布的码」。只有 `deployment` 的两类码(缺表、权限拒:`42P01` / `42501` /
|
|
18
|
+
* `ER_NO_SUCH_TABLE` / `ER_TABLEACCESS_DENIED_ERROR`)是库专有的,它才说「数据库」。
|
|
19
|
+
*
|
|
20
|
+
* `corrupt` / `defect` 两句对**只有一个码**的读法(见 {@link storeFaultSentenceOfCode})结构上不会命中(前者要店自己的 {@link StoreCorruptError} 类的实例,后者要原生错误类的实例,
|
|
21
|
+
* 一个 `{ code }` 两者都不是);它们留在表里只为「判官的词与对外句一一对应」—— 将来哪条腿拿真错误对象问判官,这两句就是它们的对外说法。
|
|
22
|
+
*/
|
|
23
|
+
export declare const STORE_FAULT_OUTWARD_SENTENCE: Readonly<Record<StoreFaultClass, string>>;
|
|
24
|
+
/**
|
|
25
|
+
* 一个**失败码**的对外句 —— 终局因由只带码(引擎把错压成 `code` + `message` 两格,类型与 `cause` 链已不在)的那些站点用:判官读 `{ code }`(识别表按 `code` 字符串登记,
|
|
26
|
+
* 数字 `errno` 只是同一件事的另一种写法,这里读不到也不影响:每个登记行都有 `code`),交回的词按 {@link STORE_FAULT_OUTWARD_SENTENCE} 说一句。
|
|
27
|
+
* 判官是整仓一只,这里不第二次认「什么算连接类 / 部署错配类」。
|
|
28
|
+
*/
|
|
29
|
+
export declare function storeFaultSentenceOfCode(code: string): string;
|
|
4
30
|
//# sourceMappingURL=store-fault.d.ts.map
|
|
@@ -1,10 +1,28 @@
|
|
|
1
1
|
import { isConnectionFaultError, isDeploymentFaultError } from "./sql-errors.js";
|
|
2
|
-
import { StoreCorruptError } from "./sql-json-column.js";
|
|
2
|
+
import { SqlJsonColumnError, StoreCorruptError } from "./sql-json-column.js";
|
|
3
|
+
const RUNTIME_DEFECT_CLASSES = [TypeError, ReferenceError, RangeError, SyntaxError, EvalError, URIError];
|
|
4
|
+
export function isCodeDefect(err) {
|
|
5
|
+
if (err instanceof SqlJsonColumnError)
|
|
6
|
+
return err.problem === "not-text";
|
|
7
|
+
return RUNTIME_DEFECT_CLASSES.some((cls) => err instanceof cls) && !Object.hasOwn(err, "cause");
|
|
8
|
+
}
|
|
3
9
|
export function storeFaultClassOf(err) {
|
|
4
10
|
if (err instanceof StoreCorruptError)
|
|
5
11
|
return "corrupt";
|
|
6
12
|
if (isConnectionFaultError(err))
|
|
7
13
|
return "connection";
|
|
8
|
-
|
|
14
|
+
if (isDeploymentFaultError(err))
|
|
15
|
+
return "deployment";
|
|
16
|
+
return isCodeDefect(err) ? "defect" : "unclassified";
|
|
17
|
+
}
|
|
18
|
+
export const STORE_FAULT_OUTWARD_SENTENCE = {
|
|
19
|
+
corrupt: "a stored row could not be read; retrying fails the same way until an operator repairs or deletes the row",
|
|
20
|
+
connection: "a connection failed or the peer is not accepting connections; retrying later may succeed",
|
|
21
|
+
deployment: "a database table is missing or the database account lacks a grant; retrying will not help until an operator fixes it",
|
|
22
|
+
defect: "the service failed on an internal error; retrying fails the same way until the service is fixed",
|
|
23
|
+
unclassified: "the failure carried a code this service does not publish; the operator log carries the original sentence",
|
|
24
|
+
};
|
|
25
|
+
export function storeFaultSentenceOfCode(code) {
|
|
26
|
+
return STORE_FAULT_OUTWARD_SENTENCE[storeFaultClassOf({ code })];
|
|
9
27
|
}
|
|
10
28
|
//# sourceMappingURL=store-fault.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* TaskAttachmentStore —— D-1 通用文件上传的**独立附件 store**(clay 拍 2026-07-27:不复用 fileSnapshot
|
|
3
3
|
* 的 content-addressed blob 面,新建)。TiDB/PG 双方言 + local 文件店(local-task-attachment-store.ts)。
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* 为什么独立而不是骑快照 blob 的索引(snapshot_blob):那套的引用追踪=「本域 manifest 里没有的即 orphan」,
|
|
6
6
|
* 附件不在任何一域的 manifest 里 ⇒ 会被孤儿扫在 1h grace 后误收。生命周期也不同:
|
|
7
7
|
* snapshot blob 跟 session 的工作树;**附件跟 task/session 的绑定**(上传先行、提交时绑定、E21 随会话
|
|
8
8
|
* 级联删、未绑定的按 TTL 收割)。
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* - `owner` = auth principal ?? "default"(单库 tenant 轴;无 principal 部署全 default = 单用户语义)。
|
|
12
12
|
* 读/删门在 SQL WHERE 完成(filter-before-reduce,roster 语义条 1 同姿)——他人行连结果集都不进。
|
|
13
13
|
* - **字节本体在对象存储(clay 裁 2026-07-27:云形态对象存储必配,「现在就接」)**:SQL 只存 meta
|
|
14
|
-
* (索引/owner 门/生命周期),bytes 走 {@link AttachmentBytesStore}(
|
|
15
|
-
*
|
|
14
|
+
* (索引/owner 门/生命周期),bytes 走 {@link AttachmentBytesStore}(字节口 {@link BlobBackend} —— 生产 = 对象存储
|
|
15
|
+
* MinioBlobBackend;读侧的 sha 校验是本店作为索引属主的事:{@link readAtAddress})。对象键=**sha256**(同内容天然去重;跨 owner 共享对象 ⇒ 对象删除必须过
|
|
16
16
|
* 零引用检查)+ **附件专属 keyPrefix**(与快照 blob 命名空间隔离——同 sha 不同生命周期,混用会互删)。
|
|
17
17
|
* 删除次序:meta 先(E21 purge 永不被 MinIO 网络抖动卡死,blob-backend 异步删裁定同旨),对象删
|
|
18
18
|
* =零引用检查后 best-effort(失败只 log:无 meta 的对象经 API 不可达;彻底清收敛作 follow-up 记账)。
|
|
@@ -32,6 +32,7 @@ import type { Pool } from "mysql2/promise";
|
|
|
32
32
|
import type { PgQueryFn } from "./pg-query.js";
|
|
33
33
|
import type { Pool as PgPool } from "pg";
|
|
34
34
|
import { type IndexSpec } from "./ensure-index.js";
|
|
35
|
+
import { type BlobBackend } from "./blob-backend.js";
|
|
35
36
|
/**
|
|
36
37
|
* 一条附件 meta 的**形属主**(整仓唯一那份键集)。
|
|
37
38
|
*
|
|
@@ -67,6 +68,14 @@ export interface TaskAttachmentStore {
|
|
|
67
68
|
* 属主门在店里(owner 不匹配 / 不存在的 id 两边都不出现,无 oracle)。`bound` 按请求序、不重复。
|
|
68
69
|
*/
|
|
69
70
|
bind(owner: string, ids: readonly string[], sessionId: string, boundAtMs: number): Promise<AttachmentStoreBindOutcome>;
|
|
71
|
+
/**
|
|
72
|
+
* 释放字节:给定哈希中**已没有任何行引用**的对象删掉(跨行去重共享 ⇒ 仍被引用的保留;best-effort,不抛 —— 孤儿 GC 兜底)。
|
|
73
|
+
* 回 `failed` = 这次没能核 / 没能删的哈希(调用方决定告不告知:删净会话的收尾逐次告知,店内的行删除口照旧不告知)。
|
|
74
|
+
* 删净会话的收尾调它(`session-erase.ts`:执行体在事务里删了附件行、读出它们的哈希,提交之后交这里)。
|
|
75
|
+
*/
|
|
76
|
+
releaseBytes(shas: readonly string[]): Promise<{
|
|
77
|
+
readonly failed: readonly string[];
|
|
78
|
+
}>;
|
|
70
79
|
/** 物化输入(env 建立时)——按 session 单键查(绑定时已 owner 验过;session uuid 不可枚举)。 */
|
|
71
80
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
72
81
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -79,12 +88,9 @@ export interface TaskAttachmentStore {
|
|
|
79
88
|
sweepOrphanObjects?(graceMs: number, nowMs?: number): Promise<number>;
|
|
80
89
|
}
|
|
81
90
|
export declare const TASK_ATTACHMENT_TABLE = "task_attachment";
|
|
82
|
-
/** 字节面
|
|
91
|
+
/** 字节面 = 字节口 {@link BlobBackend}(sha256 键控;读侧 sha 校验在本店,{@link readAtAddress})+ 对象存储的两只可选读面。`listObjects` 可选
|
|
83
92
|
* (D-1 孤儿对象 GC 的列举面;测试桩/无列举后端缺席=sweep 诚实 0,不装作扫过)。 */
|
|
84
|
-
export interface AttachmentBytesStore {
|
|
85
|
-
putBlob(hash: string, bytes: Uint8Array): Promise<void>;
|
|
86
|
-
getBlob(hash: string): Promise<Uint8Array | undefined>;
|
|
87
|
-
deleteBlobs(hashes: string[]): Promise<number>;
|
|
93
|
+
export interface AttachmentBytesStore extends BlobBackend {
|
|
88
94
|
listObjects?(): AsyncGenerator<{
|
|
89
95
|
hash: string;
|
|
90
96
|
lastModifiedMs: number;
|
|
@@ -236,9 +242,11 @@ export declare class TiDBTaskAttachmentStore implements TaskAttachmentStore {
|
|
|
236
242
|
get(owner: string, id: string): Promise<TaskAttachmentRecord | null>;
|
|
237
243
|
getContent(owner: string, id: string): Promise<Uint8Array | null>;
|
|
238
244
|
/** 零引用对象删除(best-effort):meta 已删后,sha 仍被其他行引用则对象保留(跨行去重共享)。
|
|
239
|
-
*
|
|
245
|
+
* 失败不抛、交回哈希——E21 purge 不被对象存储抖动卡死(blob-backend 异步删裁定同旨);无 meta 的对象
|
|
240
246
|
* 经 API 不可达,彻底清收敛记 follow-up。 */
|
|
241
|
-
|
|
247
|
+
releaseBytes(shas: readonly string[]): Promise<{
|
|
248
|
+
readonly failed: readonly string[];
|
|
249
|
+
}>;
|
|
242
250
|
bind(owner: string, ids: readonly string[], sessionId: string, boundAtMs: number): Promise<AttachmentStoreBindOutcome>;
|
|
243
251
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
244
252
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -266,7 +274,9 @@ export declare class PgTaskAttachmentStore implements TaskAttachmentStore {
|
|
|
266
274
|
}): Promise<void>;
|
|
267
275
|
get(owner: string, id: string): Promise<TaskAttachmentRecord | null>;
|
|
268
276
|
getContent(owner: string, id: string): Promise<Uint8Array | null>;
|
|
269
|
-
|
|
277
|
+
releaseBytes(shas: readonly string[]): Promise<{
|
|
278
|
+
readonly failed: readonly string[];
|
|
279
|
+
}>;
|
|
270
280
|
bind(owner: string, ids: readonly string[], sessionId: string, boundAtMs: number): Promise<AttachmentStoreBindOutcome>;
|
|
271
281
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
272
282
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -4,6 +4,8 @@ import { createHash } from "node:crypto";
|
|
|
4
4
|
import { attachmentKindOf, PROJECT_BUNDLE_MIME } from "../project-bundle.js";
|
|
5
5
|
import { mysqlDriver, pgDriver } from "./sql-driver.js";
|
|
6
6
|
import { isDupKeyError, retryOnDeadlock } from "./sql-errors.js";
|
|
7
|
+
import { countClientWriteOn } from "./session-withdraw-sql.js";
|
|
8
|
+
import { readAtAddress } from "./blob-backend.js";
|
|
7
9
|
export const TaskAttachmentRecordSchema = z.object({
|
|
8
10
|
id: z.string(),
|
|
9
11
|
owner: z.string(),
|
|
@@ -238,7 +240,13 @@ async function bindOnSql(db, owner, ids, sessionId, boundAtMs) {
|
|
|
238
240
|
const q = (mysqlSql, pgSql) => (mysql ? mysqlSql : pgSql);
|
|
239
241
|
const ownRows = (columns, of) => db.query(q(`SELECT ${columns} FROM ${TASK_ATTACHMENT_TABLE} WHERE owner = ? AND id IN (${of.map(() => "?").join(",")})`, `SELECT ${columns} FROM ${TASK_ATTACHMENT_TABLE} WHERE owner = $1 AND id = ANY($2::varchar[])`), mysql ? [owner, ...of] : [owner, of]);
|
|
240
242
|
const kindOf = new Map((await ownRows("id, mime", list)).rows.map((r) => [String(r.id), attachmentKindOf(String(r.mime))]));
|
|
241
|
-
const claim = (of) => retryOnDeadlock(db.dialect, () => inTransaction(db, (conn) =>
|
|
243
|
+
const claim = (of) => retryOnDeadlock(db.dialect, () => inTransaction(db, async (conn) => {
|
|
244
|
+
const root = await conn.query(q("SELECT session_id FROM session_meta WHERE session_id = ? FOR UPDATE", "SELECT session_id FROM session_meta WHERE session_id = $1 FOR UPDATE"), [sessionId]);
|
|
245
|
+
const res = await conn.query(q(`UPDATE ${TASK_ATTACHMENT_TABLE} SET bound_at_ms = CASE WHEN session_id IS NULL THEN ? ELSE bound_at_ms END, session_id = ? WHERE owner = ? AND id IN (${of.map(() => "?").join(",")}) AND (session_id IS NULL OR session_id = ?)`, `UPDATE ${TASK_ATTACHMENT_TABLE} SET bound_at_ms = CASE WHEN session_id IS NULL THEN $2::bigint ELSE bound_at_ms END, session_id = $1::varchar WHERE owner = $3 AND id = ANY($4::varchar[]) AND (session_id IS NULL OR session_id = $1::varchar)`), mysql ? [boundAtMs, sessionId, owner, ...of, sessionId] : [sessionId, boundAtMs, owner, of]);
|
|
246
|
+
if (root.rows.length > 0 && res.affected > 0)
|
|
247
|
+
await countClientWriteOn(conn, db.dialect, sessionId);
|
|
248
|
+
return res;
|
|
249
|
+
}));
|
|
242
250
|
const attachments = list.filter((id) => kindOf.get(id) === "attachment");
|
|
243
251
|
if (attachments.length > 0)
|
|
244
252
|
await claim(attachments);
|
|
@@ -301,7 +309,7 @@ export class TiDBTaskAttachmentStore {
|
|
|
301
309
|
this.db = mysqlDriver(pool);
|
|
302
310
|
}
|
|
303
311
|
async put(rec) {
|
|
304
|
-
await this.bytes.
|
|
312
|
+
await this.bytes.put(rec.sha256, rec.content);
|
|
305
313
|
await this.pool.execute(`INSERT INTO ${TASK_ATTACHMENT_TABLE} (${COLS}) VALUES (?,?,?,?,?,?,?,?,?)`, [rec.id, rec.owner, rec.name, rec.mime, rec.sha256, rec.sizeBytes, rec.sessionId ?? null, rec.createdAtMs, rec.boundAtMs ?? null]);
|
|
306
314
|
}
|
|
307
315
|
async get(owner, id) {
|
|
@@ -312,19 +320,22 @@ export class TiDBTaskAttachmentStore {
|
|
|
312
320
|
const meta = await this.get(owner, id);
|
|
313
321
|
if (!meta)
|
|
314
322
|
return null;
|
|
315
|
-
const b = await this.bytes
|
|
323
|
+
const b = await readAtAddress(this.bytes, meta.sha256);
|
|
316
324
|
return b && b.byteLength === meta.sizeBytes ? b : null;
|
|
317
325
|
}
|
|
318
|
-
async
|
|
326
|
+
async releaseBytes(shas) {
|
|
327
|
+
const failed = [];
|
|
319
328
|
for (const sha of new Set(shas)) {
|
|
320
329
|
try {
|
|
321
330
|
const [cnt] = await this.pool.query(`SELECT COUNT(*) AS n FROM ${TASK_ATTACHMENT_TABLE} WHERE sha256 = ?`, [sha]);
|
|
322
331
|
if (Number(cnt[0].n) === 0)
|
|
323
|
-
await this.bytes.
|
|
332
|
+
await this.bytes.delete([sha]);
|
|
324
333
|
}
|
|
325
334
|
catch {
|
|
335
|
+
failed.push(sha);
|
|
326
336
|
}
|
|
327
337
|
}
|
|
338
|
+
return { failed };
|
|
328
339
|
}
|
|
329
340
|
bind(owner, ids, sessionId, boundAtMs) {
|
|
330
341
|
return bindOnSql(this.db, owner, ids, sessionId, boundAtMs);
|
|
@@ -340,19 +351,19 @@ export class TiDBTaskAttachmentStore {
|
|
|
340
351
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE id = ? AND owner = ?`, [id, owner]);
|
|
341
352
|
if ((res.affectedRows ?? 0) === 0)
|
|
342
353
|
return false;
|
|
343
|
-
await this.
|
|
354
|
+
await this.releaseBytes([meta.sha256]);
|
|
344
355
|
return true;
|
|
345
356
|
}
|
|
346
357
|
async deleteBySession(sessionId) {
|
|
347
358
|
const [rows] = await this.pool.query(`SELECT sha256 FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = ?`, [sessionId]);
|
|
348
359
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = ?`, [sessionId]);
|
|
349
|
-
await this.
|
|
360
|
+
await this.releaseBytes(rows.map((r) => r.sha256));
|
|
350
361
|
return res.affectedRows ?? 0;
|
|
351
362
|
}
|
|
352
363
|
async reapUnbound(olderThanMs) {
|
|
353
364
|
const [rows] = await this.pool.query(`SELECT sha256 FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < ?`, [olderThanMs]);
|
|
354
365
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < ?`, [olderThanMs]);
|
|
355
|
-
await this.
|
|
366
|
+
await this.releaseBytes(rows.map((r) => r.sha256));
|
|
356
367
|
return res.affectedRows ?? 0;
|
|
357
368
|
}
|
|
358
369
|
async sweepOrphanObjects(graceMs, nowMs = Date.now()) {
|
|
@@ -367,8 +378,10 @@ export class TiDBTaskAttachmentStore {
|
|
|
367
378
|
const referenced = await this.referencedShas(batch);
|
|
368
379
|
const orphans = batch.filter((h) => !referenced.has(h));
|
|
369
380
|
const safe = await this.filterStillOrphan(orphans, graceMs, nowMs);
|
|
370
|
-
if (safe.length > 0)
|
|
371
|
-
|
|
381
|
+
if (safe.length > 0) {
|
|
382
|
+
await this.bytes.delete(safe);
|
|
383
|
+
removed += safe.length;
|
|
384
|
+
}
|
|
372
385
|
batch = [];
|
|
373
386
|
};
|
|
374
387
|
for await (const o of lister.listObjects()) {
|
|
@@ -417,7 +430,7 @@ export class PgTaskAttachmentStore {
|
|
|
417
430
|
this.q = async (text, params) => ({ rows: (await pool.query(text, params)).rows });
|
|
418
431
|
}
|
|
419
432
|
async put(rec) {
|
|
420
|
-
await this.bytes.
|
|
433
|
+
await this.bytes.put(rec.sha256, rec.content);
|
|
421
434
|
await this.q(`INSERT INTO ${TASK_ATTACHMENT_TABLE} (${COLS}) VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9)`, [rec.id, rec.owner, rec.name, rec.mime, rec.sha256, rec.sizeBytes, rec.sessionId ?? null, rec.createdAtMs, rec.boundAtMs ?? null]);
|
|
422
435
|
}
|
|
423
436
|
async get(owner, id) {
|
|
@@ -428,19 +441,22 @@ export class PgTaskAttachmentStore {
|
|
|
428
441
|
const meta = await this.get(owner, id);
|
|
429
442
|
if (!meta)
|
|
430
443
|
return null;
|
|
431
|
-
const b = await this.bytes
|
|
444
|
+
const b = await readAtAddress(this.bytes, meta.sha256);
|
|
432
445
|
return b && b.byteLength === meta.sizeBytes ? b : null;
|
|
433
446
|
}
|
|
434
|
-
async
|
|
447
|
+
async releaseBytes(shas) {
|
|
448
|
+
const failed = [];
|
|
435
449
|
for (const sha of new Set(shas)) {
|
|
436
450
|
try {
|
|
437
451
|
const res = await this.q(`SELECT COUNT(*) AS n FROM ${TASK_ATTACHMENT_TABLE} WHERE sha256 = $1`, [sha]);
|
|
438
452
|
if (Number(res.rows[0].n) === 0)
|
|
439
|
-
await this.bytes.
|
|
453
|
+
await this.bytes.delete([sha]);
|
|
440
454
|
}
|
|
441
455
|
catch {
|
|
456
|
+
failed.push(sha);
|
|
442
457
|
}
|
|
443
458
|
}
|
|
459
|
+
return { failed };
|
|
444
460
|
}
|
|
445
461
|
bind(owner, ids, sessionId, boundAtMs) {
|
|
446
462
|
return bindOnSql(this.db, owner, ids, sessionId, boundAtMs);
|
|
@@ -453,17 +469,17 @@ export class PgTaskAttachmentStore {
|
|
|
453
469
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE id = $1 AND owner = $2 RETURNING sha256`, [id, owner]);
|
|
454
470
|
if (res.rows.length === 0)
|
|
455
471
|
return false;
|
|
456
|
-
await this.
|
|
472
|
+
await this.releaseBytes([res.rows[0].sha256]);
|
|
457
473
|
return true;
|
|
458
474
|
}
|
|
459
475
|
async deleteBySession(sessionId) {
|
|
460
476
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = $1 RETURNING sha256`, [sessionId]);
|
|
461
|
-
await this.
|
|
477
|
+
await this.releaseBytes(res.rows.map((r) => r.sha256));
|
|
462
478
|
return res.rows.length;
|
|
463
479
|
}
|
|
464
480
|
async reapUnbound(olderThanMs) {
|
|
465
481
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < $1 RETURNING sha256`, [olderThanMs]);
|
|
466
|
-
await this.
|
|
482
|
+
await this.releaseBytes(res.rows.map((r) => r.sha256));
|
|
467
483
|
return res.rows.length;
|
|
468
484
|
}
|
|
469
485
|
async sweepOrphanObjects(graceMs, nowMs = Date.now()) {
|
|
@@ -478,8 +494,10 @@ export class PgTaskAttachmentStore {
|
|
|
478
494
|
const referenced = await this.referencedShas(batch);
|
|
479
495
|
const orphans = batch.filter((h) => !referenced.has(h));
|
|
480
496
|
const safe = await this.filterStillOrphan(orphans, graceMs, nowMs);
|
|
481
|
-
if (safe.length > 0)
|
|
482
|
-
|
|
497
|
+
if (safe.length > 0) {
|
|
498
|
+
await this.bytes.delete(safe);
|
|
499
|
+
removed += safe.length;
|
|
500
|
+
}
|
|
483
501
|
batch = [];
|
|
484
502
|
};
|
|
485
503
|
for await (const o of lister.listObjects()) {
|
|
@@ -22,7 +22,7 @@ export declare const TASK_LIST_ITEM_TABLE = "task_list_item";
|
|
|
22
22
|
* 同族先例 = `env-facts.ts` 的 `scratchpadSessionSegment`(文件名面)——刻意**不**复用彼此的实现:
|
|
23
23
|
* 一个键空间改了算法不该把另一个键空间的存量行全孤儿化。
|
|
24
24
|
*
|
|
25
|
-
* 🔴 属主在**本文件**(而不是消费它的 boot 车道):留存腿(`retention-
|
|
25
|
+
* 🔴 属主在**本文件**(而不是消费它的 boot 车道):留存腿(`retention-deployment.ts`)按同一派生式
|
|
26
26
|
* 批量删本表的行,两个消费点必须读同一个函数 —— 键派生有两份就是「在线删除删得掉、留存腿删不掉」。
|
|
27
27
|
*/
|
|
28
28
|
export declare function taskListKeyFor(sessionId: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 中央 DDL 用到的**文本列类型的容量**(UTF-8 字节),按方言各一张 —— 「这一列装得下多少字节」这件事实的唯一一处。
|
|
3
|
+
*
|
|
4
|
+
* MySQL 协议(TiDB / MySQL)的 `TEXT` 上限 65,535 字节:严格模式下超长写入抛 `Data too long`,非严格模式静默截断(截断后的 JSON 读侧 parse 失败)。
|
|
5
|
+
* PG 的 `TEXT` 没有每型宽(只有 1 GB 的通用字段上限,不是列型的事实)⇒ 记作无穷。
|
|
6
|
+
*
|
|
7
|
+
* 读者:列属主按自己的类型词查这张表得到列容量(`inbox-payload-column.ts` 的收件 `payload` 预算、`checkpoint-index-columns.ts` 的卡词列容量)。
|
|
8
|
+
* 只登本仓 DDL 真用的类型词:列属主换一个类型词而这里没有 ⇒ tsc 红,由人把那个类型的容量写进来(不在读者那里另抄一个数)。
|
|
9
|
+
*/
|
|
10
|
+
import type { SqlDialect } from "./sql-driver.js";
|
|
11
|
+
export declare const TEXT_COLUMN_TYPE_MAX_BYTES: {
|
|
12
|
+
readonly mysql: {
|
|
13
|
+
readonly TEXT: 65535;
|
|
14
|
+
};
|
|
15
|
+
readonly pg: {
|
|
16
|
+
readonly TEXT: number;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/** 某方言下登记过的文本列类型词。 */
|
|
20
|
+
export type TextColumnType<D extends SqlDialect> = keyof (typeof TEXT_COLUMN_TYPE_MAX_BYTES)[D];
|
|
21
|
+
//# sourceMappingURL=text-column-capacity.d.ts.map
|