@sema-agent/server 7.147.0 → 7.148.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/MIGRATION.md +1039 -24
- package/README.md +20 -7
- package/README.zh-CN.md +14 -8
- package/USAGE.md +380 -163
- package/deploy/sema-up/README.md +16 -5
- package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
- package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
- package/deploy/sema-up/chart/values.yaml +3 -2
- package/deploy/sema-up/cluster-up.sh +74 -176
- package/deploy/sema-up/kube-up.sh +29 -49
- package/deploy/sema-up/lib/chart-run.sh +23 -0
- package/deploy/sema-up/lib/dataroot.sh +3 -3
- package/deploy/sema-up/lib/health.sh +62 -13
- package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
- package/deploy/sema-up/lib/helm-values-kube.py +35 -0
- package/deploy/sema-up/lib/regcred.py +8 -0
- package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
- package/deploy/sema-up/lib/remote/image-import.sh +6 -0
- package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
- package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
- package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
- package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
- package/deploy/sema-up/lib/render-stack.py +17 -0
- package/deploy/sema-up/lib/shell-text.sh +87 -0
- package/deploy/sema-up/lib/usage-flags.txt +10 -0
- package/deploy/sema-up/lib/usage-head.txt +1 -0
- package/deploy/sema-up/lib/usage-tail.txt +13 -0
- package/deploy/sema-up/preflight.sh +10 -8
- package/deploy/sema-up/sema-up.sh +14 -39
- package/deploy/sema-up/smoke.sh +7 -6
- package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
- package/deploy/sema-up/stack/compose.yaml +13 -1
- package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
- package/dist/adoption/plan.d.ts +24 -0
- package/dist/adoption/plan.js +53 -1
- package/dist/adoption/runner.d.ts +10 -1
- package/dist/adoption/runner.js +36 -16
- package/dist/adoption/wire.d.ts +3 -3
- package/dist/approval-card.d.ts +28 -30
- package/dist/approval-gate-currency.js +3 -2
- package/dist/approval-reconciler.d.ts +4 -13
- package/dist/approval-reconciler.js +2 -2
- package/dist/approval.d.ts +13 -11
- package/dist/approval.js +3 -3
- package/dist/audit.d.ts +10 -3
- package/dist/audit.js +15 -7
- package/dist/auth-bridge.d.ts +0 -14
- package/dist/auth-bridge.js +0 -7
- package/dist/auto-mode-face.d.ts +10 -7
- package/dist/auto-mode-face.js +7 -4
- package/dist/background-agent-name.d.ts +19 -1
- package/dist/background-agent-name.js +12 -2
- package/dist/background-session-reap.d.ts +1 -1
- package/dist/bake-runner/main.js +9 -6
- package/dist/bench/s1/arms.js +6 -5
- package/dist/bench/s1/live-deps.js +5 -2
- package/dist/bench/s1/run-firm.js +6 -5
- package/dist/bind-host.d.ts +25 -0
- package/dist/bind-host.js +25 -0
- package/dist/boot/adoption.d.ts +3 -0
- package/dist/boot/adoption.js +1 -0
- package/dist/boot/deployment-mods.d.ts +1 -1
- package/dist/boot/execution-env.d.ts +17 -7
- package/dist/boot/execution-env.js +37 -31
- package/dist/boot/exit-boundary.d.ts +2 -2
- package/dist/boot/exit-boundary.js +6 -5
- package/dist/boot/fatal-exit.d.ts +3 -5
- package/dist/boot/fatal-exit.js +2 -2
- package/dist/boot/leader.d.ts +15 -0
- package/dist/boot/leader.js +17 -15
- package/dist/boot/memory-consolidation.d.ts +37 -29
- package/dist/boot/memory-consolidation.js +11 -5
- package/dist/boot/org-memory.js +1 -1
- package/dist/boot/parked-revive-gate.js +2 -2
- package/dist/boot/reapers.d.ts +4 -3
- package/dist/boot/reapers.js +19 -16
- package/dist/boot/resolve-spec.d.ts +5 -3
- package/dist/boot/resolve-spec.js +55 -67
- package/dist/boot/retention-lane.d.ts +4 -4
- package/dist/boot/retention-lane.js +2 -2
- package/dist/boot/runner-deps.d.ts +28 -7
- package/dist/boot/runner-deps.js +11 -4
- package/dist/boot/runtime-caps.d.ts +2 -2
- package/dist/boot/runtime-caps.js +16 -2
- package/dist/boot/session-faces.d.ts +16 -7
- package/dist/boot/session-faces.js +114 -94
- package/dist/boot/shutdown.d.ts +5 -4
- package/dist/boot/shutdown.js +6 -4
- package/dist/boot/stage-01-config.js +9 -1
- package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
- package/dist/boot/stage-02-web-admin-pull.js +6 -1
- package/dist/boot/stage-03-store-backend.d.ts +3 -0
- package/dist/boot/stage-03-store-backend.js +4 -3
- package/dist/boot/stage-04-stores.d.ts +2 -0
- package/dist/boot/stage-04-stores.js +2 -2
- package/dist/boot/stage-05-execution-env.d.ts +7 -3
- package/dist/boot/stage-05-execution-env.js +2 -2
- package/dist/boot/stage-06-runners.d.ts +10 -12
- package/dist/boot/stage-06-runners.js +23 -15
- package/dist/boot/stage-07-capability-layer.d.ts +11 -8
- package/dist/boot/stage-07-capability-layer.js +5 -3
- package/dist/boot/stage-08-reapers.d.ts +11 -8
- package/dist/boot/stage-08-reapers.js +3 -3
- package/dist/boot/stage-09-leader.d.ts +12 -15
- package/dist/boot/stage-09-leader.js +12 -4
- package/dist/boot/stage-10-http-server.d.ts +12 -15
- package/dist/boot/stage-10-http-server.js +7 -4
- package/dist/boot/store-evidence.d.ts +20 -0
- package/dist/boot/store-evidence.js +13 -0
- package/dist/boot/stores.d.ts +3 -0
- package/dist/boot/stores.js +21 -10
- package/dist/boot/task-list-lane.d.ts +4 -4
- package/dist/boot/web-admin.d.ts +4 -2
- package/dist/boot/web-admin.js +55 -35
- package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
- package/dist/boot-reclaim.d.ts +3 -1
- package/dist/boot-reclaim.js +1 -1
- package/dist/brain.d.ts +7 -18
- package/dist/brain.js +5 -17
- package/dist/budget.js +6 -6
- package/dist/capabilities/center-plugins.d.ts +7 -1
- package/dist/capabilities/center-plugins.js +32 -10
- package/dist/capabilities/center-wiring.js +1 -1
- package/dist/capabilities/composite-members.d.ts +2 -2
- package/dist/capabilities/composite-members.js +2 -2
- package/dist/capabilities/repo-tools.d.ts +2 -0
- package/dist/capabilities/repo-tools.js +14 -12
- package/dist/capabilities/scenarios.d.ts +6 -15
- package/dist/capabilities/scenarios.js +11 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/tool-defer.d.ts +1 -1
- package/dist/capability-facts.d.ts +38 -11
- package/dist/capability-facts.js +47 -8
- package/dist/card-void.d.ts +4 -4
- package/dist/card-void.js +1 -1
- package/dist/center-credential-renewer.d.ts +6 -2
- package/dist/center-credential-renewer.js +7 -3
- package/dist/config-catalog.d.ts +16 -1
- package/dist/config-catalog.js +62 -56
- package/dist/config-dir-trust.d.ts +37 -4
- package/dist/config-dir-trust.js +88 -44
- package/dist/config-invariants.d.ts +42 -3
- package/dist/config-invariants.js +69 -5
- package/dist/config-lkg.d.ts +23 -1
- package/dist/config-lkg.js +17 -3
- package/dist/config-provider.d.ts +9 -9
- package/dist/config-provider.js +25 -110
- package/dist/config-pull-failure.d.ts +50 -0
- package/dist/config-pull-failure.js +48 -0
- package/dist/config-types.d.ts +26 -17
- package/dist/config.d.ts +8 -16
- package/dist/config.js +113 -47
- package/dist/delegated-session-owner.d.ts +1 -1
- package/dist/deleted-session-ids.d.ts +3 -2
- package/dist/deployment-governance.d.ts +3 -3
- package/dist/deployment-shape.d.ts +30 -4
- package/dist/deployment-shape.js +7 -0
- package/dist/egress-redirect.d.ts +25 -7
- package/dist/egress-redirect.js +20 -2
- package/dist/elicitation.d.ts +6 -5
- package/dist/elicitation.js +23 -22
- package/dist/engine-identity.d.ts +28 -0
- package/dist/engine-identity.js +10 -0
- package/dist/entry-problems.d.ts +5 -7
- package/dist/entry-problems.js +1 -1
- package/dist/env-facts.js +2 -1
- package/dist/env-witness.d.ts +7 -0
- package/dist/env-witness.js +16 -0
- package/dist/execution-lane-caps.d.ts +5 -18
- package/dist/execution-lane-caps.js +0 -22
- package/dist/execution-placement.d.ts +58 -18
- package/dist/execution-placement.js +41 -2
- package/dist/field-conflict.d.ts +7 -11
- package/dist/field-conflict.js +3 -3
- package/dist/file-history-capture.d.ts +3 -3
- package/dist/file-history-disclosure.js +1 -0
- package/dist/fleet/fleet-bus.d.ts +21 -3
- package/dist/fleet/fleet-bus.js +35 -25
- package/dist/fleet/fleet-reconciler.js +2 -2
- package/dist/fleet/serving-lease.js +3 -3
- package/dist/fleet-client.js +3 -3
- package/dist/fleet-lease.d.ts +0 -1
- package/dist/fleet-lease.js +4 -5
- package/dist/history-anchor.d.ts +23 -3
- package/dist/history-anchor.js +24 -4
- package/dist/hitl-delivery.d.ts +90 -0
- package/dist/hitl-delivery.js +98 -0
- package/dist/hooks/classic-stations.d.ts +8 -11
- package/dist/hooks/classic-stations.js +0 -7
- package/dist/hooks/hook-llm.d.ts +5 -1
- package/dist/hooks/hook-llm.js +24 -15
- package/dist/hooks/hook-runner.d.ts +67 -57
- package/dist/hooks/hook-runner.js +260 -186
- package/dist/host-lsp-manager.d.ts +22 -8
- package/dist/host-lsp-manager.js +4 -1
- package/dist/http/active-run-conflict.d.ts +2 -43
- package/dist/http/active-run-conflict.js +3 -7
- package/dist/http/admission.d.ts +4 -18
- package/dist/http/admission.js +75 -78
- package/dist/http/approval-sweeps.d.ts +3 -3
- package/dist/http/approval-sweeps.js +54 -30
- package/dist/http/caller-trust.d.ts +8 -10
- package/dist/http/caller-trust.js +1 -2
- package/dist/http/claim-heartbeat.d.ts +49 -0
- package/dist/http/claim-heartbeat.js +46 -0
- package/dist/http/claimed-run.d.ts +4 -3
- package/dist/http/dispatch.d.ts +8 -1
- package/dist/http/dispatch.js +76 -30
- package/dist/http/durable-run-leg.d.ts +3 -3
- package/dist/http/durable-run-leg.js +17 -12
- package/dist/http/execution-context.d.ts +17 -43
- package/dist/http/execution-context.js +7 -5
- package/dist/http/health-reader.d.ts +36 -0
- package/dist/http/health-reader.js +21 -0
- package/dist/http/health-self-report.d.ts +9 -9
- package/dist/http/health-self-report.js +4 -4
- package/dist/http/idempotency.d.ts +9 -5
- package/dist/http/idempotency.js +4 -4
- package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
- package/dist/http/memory-compliance-failure-reply.js +4 -2
- package/dist/http/memory-face-fault-reply.d.ts +67 -0
- package/dist/http/memory-face-fault-reply.js +71 -0
- package/dist/http/memory-store-refusal-reply.d.ts +1 -1
- package/dist/http/memory-store-refusal-reply.js +3 -0
- package/dist/http/owner-access.d.ts +391 -67
- package/dist/http/owner-access.js +371 -35
- package/dist/http/principal-gate.d.ts +24 -81
- package/dist/http/principal-gate.js +24 -68
- package/dist/http/refusal-body.d.ts +35 -2
- package/dist/http/refusal-body.js +34 -0
- package/dist/http/request-guards.d.ts +9 -13
- package/dist/http/request-guards.js +34 -68
- package/dist/http/resume-composition.d.ts +37 -0
- package/dist/http/resume-composition.js +18 -0
- package/dist/http/resume-ctx-read.d.ts +35 -12
- package/dist/http/resume-ctx-read.js +25 -6
- package/dist/http/resume-legs.d.ts +21 -18
- package/dist/http/resume-legs.js +189 -129
- package/dist/http/retired-skill-manifest.d.ts +1 -1
- package/dist/http/route-ctx.d.ts +25 -32
- package/dist/http/routes/a2a-serve.d.ts +43 -5
- package/dist/http/routes/a2a-serve.js +58 -37
- package/dist/http/routes/admin-config-refresh.js +2 -2
- package/dist/http/routes/admin-drain.js +2 -2
- package/dist/http/routes/admin-memory-optout.js +4 -3
- package/dist/http/routes/adoption.d.ts +3 -0
- package/dist/http/routes/adoption.js +17 -10
- package/dist/http/routes/agents-roster.js +13 -7
- package/dist/http/routes/approvals-assistant.js +70 -65
- package/dist/http/routes/attachments.js +2 -2
- package/dist/http/routes/background.d.ts +3 -3
- package/dist/http/routes/background.js +9 -17
- package/dist/http/routes/capabilities.js +15 -18
- package/dist/http/routes/config-catalog.js +2 -2
- package/dist/http/routes/devices.d.ts +3 -3
- package/dist/http/routes/devices.js +4 -4
- package/dist/http/routes/diagnostics.d.ts +27 -3
- package/dist/http/routes/diagnostics.js +27 -21
- package/dist/http/routes/engine.js +2 -2
- package/dist/http/routes/fleet.js +5 -3
- package/dist/http/routes/images.js +10 -6
- package/dist/http/routes/leader.d.ts +7 -2
- package/dist/http/routes/leader.js +12 -3
- package/dist/http/routes/mcp-reconnect.d.ts +1 -1
- package/dist/http/routes/mcp-reconnect.js +7 -15
- package/dist/http/routes/memory-bundle.js +4 -7
- package/dist/http/routes/memory-compliance.js +4 -4
- package/dist/http/routes/memory-consolidation.js +6 -9
- package/dist/http/routes/memory-origin.d.ts +2 -0
- package/dist/http/routes/memory-origin.js +7 -8
- package/dist/http/routes/memory-policy.js +17 -12
- package/dist/http/routes/notify-wake.js +10 -19
- package/dist/http/routes/observability.js +3 -3
- package/dist/http/routes/principal-inbox.d.ts +1 -1
- package/dist/http/routes/principal-inbox.js +2 -2
- package/dist/http/routes/projects.d.ts +1 -1
- package/dist/http/routes/projects.js +3 -2
- package/dist/http/routes/retention-ops.js +6 -9
- package/dist/http/routes/rules.js +20 -5
- package/dist/http/routes/run-memory-capture.d.ts +2 -2
- package/dist/http/routes/run-memory-capture.js +6 -12
- package/dist/http/routes/run-permission-mode.d.ts +2 -2
- package/dist/http/routes/run-permission-mode.js +10 -17
- package/dist/http/routes/runs.js +146 -231
- package/dist/http/routes/session-memory-sync.d.ts +2 -2
- package/dist/http/routes/session-memory-sync.js +7 -13
- package/dist/http/routes/session-sync.d.ts +4 -2
- package/dist/http/routes/session-sync.js +21 -20
- package/dist/http/routes/sessions-list.d.ts +3 -3
- package/dist/http/routes/sessions-list.js +9 -9
- package/dist/http/routes/sessions.js +87 -124
- package/dist/http/routes/shared-memory.js +6 -6
- package/dist/http/routes/side-query.js +2 -2
- package/dist/http/routes/tasks.js +136 -120
- package/dist/http/routes/trace-usage.d.ts +0 -12
- package/dist/http/routes/trace-usage.js +40 -46
- package/dist/http/routes/workflows.d.ts +39 -4
- package/dist/http/routes/workflows.js +42 -14
- package/dist/http/run-concurrency-cap.d.ts +20 -12
- package/dist/http/run-concurrency-cap.js +39 -26
- package/dist/http/run-read-face.d.ts +3 -5
- package/dist/http/run-read-face.js +8 -13
- package/dist/http/send.d.ts +12 -3
- package/dist/http/send.js +42 -6
- package/dist/http/server.d.ts +39 -40
- package/dist/http/server.js +36 -11
- package/dist/http/sse-log.d.ts +17 -10
- package/dist/http/sse-log.js +7 -7
- package/dist/http/stored-body-replay.d.ts +12 -0
- package/dist/http/stored-body-replay.js +2 -2
- package/dist/http/submit-ctx.d.ts +16 -8
- package/dist/http/submit-ctx.js +6 -2
- package/dist/http/submit-replay.d.ts +19 -6
- package/dist/http/submit-replay.js +18 -6
- package/dist/http/sync-submit-body.d.ts +3 -4
- package/dist/http/sync-submit-body.js +4 -5
- package/dist/http/wire-types.d.ts +4 -3
- package/dist/identity-source.d.ts +36 -5
- package/dist/identity-source.js +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/key-resolver.d.ts +32 -0
- package/dist/key-resolver.js +23 -9
- package/dist/leader/diffup.js +2 -1
- package/dist/leader/endpoint.d.ts +26 -5
- package/dist/leader/endpoint.js +154 -14
- package/dist/leader/fanout.d.ts +3 -0
- package/dist/leader/fanout.js +78 -63
- package/dist/leader/leader.d.ts +16 -0
- package/dist/leader/leader.js +43 -3
- package/dist/leader/merge.d.ts +9 -1
- package/dist/leader/merge.js +16 -1
- package/dist/leader/repair-wire.js +1 -1
- package/dist/leader/wire.d.ts +36 -3
- package/dist/leader/wire.js +59 -18
- package/dist/lsp-evict.d.ts +6 -4
- package/dist/lsp-evict.js +2 -3
- package/dist/memory-operator-faces.d.ts +5 -4
- package/dist/memory-operator-faces.js +1 -1
- package/dist/memory-scope.d.ts +29 -2
- package/dist/memory-scope.js +64 -15
- package/dist/memory-store-refusal.d.ts +5 -2
- package/dist/memory-sync-client.d.ts +3 -2
- package/dist/memory-sync-client.js +6 -3
- package/dist/model-compat.d.ts +17 -8
- package/dist/model-compat.js +6 -2
- package/dist/model-context-window.d.ts +18 -0
- package/dist/model-context-window.js +2 -0
- package/dist/model-entry-headers.d.ts +46 -4
- package/dist/model-entry-headers.js +2 -2
- package/dist/model-entry-refusal.d.ts +35 -16
- package/dist/model-entry-refusal.js +40 -27
- package/dist/model-plane-face.d.ts +19 -11
- package/dist/model-plane-face.js +9 -1
- package/dist/model-plane-probe.d.ts +2 -0
- package/dist/model-plane-probe.js +17 -0
- package/dist/model-provider.d.ts +3 -3
- package/dist/model-route-endpoint.d.ts +9 -5
- package/dist/model-route-endpoint.js +29 -7
- package/dist/model-select.d.ts +16 -0
- package/dist/model-select.js +4 -0
- package/dist/mountinfo.d.ts +37 -0
- package/dist/mountinfo.js +47 -0
- package/dist/namespaced-rule-name.d.ts +23 -14
- package/dist/namespaced-rule-name.js +8 -11
- package/dist/net-address.d.ts +1 -1
- package/dist/observability/corrupt-read-seat.d.ts +4 -4
- package/dist/observability/corrupt-read-seat.js +5 -3
- package/dist/observability/fail-open.d.ts +58 -38
- package/dist/observability/fail-open.js +60 -38
- package/dist/observability/logger.d.ts +22 -1
- package/dist/observability/logger.js +89 -12
- package/dist/observability/metrics.js +3 -4
- package/dist/observability/otel-exporter.js +2 -1
- package/dist/observability/principal-context.d.ts +14 -7
- package/dist/observability/principal-context.js +8 -3
- package/dist/observability/run-terminal.d.ts +7 -1
- package/dist/observability/run-terminal.js +5 -2
- package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
- package/dist/orchestration/hardened-vm-runner.js +11 -5
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
- package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
- package/dist/orchestration/hardened-vm-worker.js +2 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
- package/dist/orchestration/workflow-completion-inbox.js +3 -2
- package/dist/org-delivery-gate.d.ts +5 -4
- package/dist/org-delivery-gate.js +7 -6
- package/dist/outbound-dispatcher.d.ts +1 -1
- package/dist/outbound-dispatcher.js +6 -12
- package/dist/owner-brands.d.ts +81 -0
- package/dist/owner-brands.js +42 -0
- package/dist/owner-faces.d.ts +531 -0
- package/dist/owner-faces.js +126 -0
- package/dist/parked-decide.d.ts +67 -5
- package/dist/parked-decide.js +127 -5
- package/dist/parked-revive-surface.d.ts +14 -4
- package/dist/parked-revive-surface.js +5 -4
- package/dist/peer-directory.d.ts +6 -8
- package/dist/peer-directory.js +3 -2
- package/dist/permission-rule-vocab.d.ts +53 -8
- package/dist/permission-rule-vocab.js +30 -2
- package/dist/plugins/adoption-log-sql.d.ts +0 -22
- package/dist/plugins/adoption-log-sql.js +5 -3
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
- package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
- package/dist/plugins/approval-ask-store-file.d.ts +18 -7
- package/dist/plugins/approval-ask-store-file.js +37 -14
- package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
- package/dist/plugins/approval-ask-store-memory.js +24 -10
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
- package/dist/plugins/approval-ask-store-sql.js +41 -10
- package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
- package/dist/plugins/approval-exemption-skill-m46.js +25 -0
- package/dist/plugins/approval-exemption-store.d.ts +6 -1
- package/dist/plugins/approval-exemption-store.js +14 -0
- package/dist/plugins/approval-nonce-store.d.ts +39 -12
- package/dist/plugins/approval-nonce-store.js +72 -23
- package/dist/plugins/blob-backend.d.ts +2 -0
- package/dist/plugins/blob-backend.js +9 -6
- package/dist/plugins/caching-session-store.d.ts +13 -1
- package/dist/plugins/caching-session-store.js +43 -4
- package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
- package/dist/plugins/checkpoint-index-columns.js +36 -1
- package/dist/plugins/checkpoint-store-face.d.ts +83 -10
- package/dist/plugins/checkpoint-store-face.js +18 -1
- package/dist/plugins/device-store-sql.js +1 -0
- package/dist/plugins/ensure-index.d.ts +13 -1
- package/dist/plugins/ensure-index.js +154 -21
- package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
- package/dist/plugins/ensure-schema-lock-policy.js +3 -2
- package/dist/plugins/file-run-store.d.ts +63 -23
- package/dist/plugins/file-run-store.js +138 -83
- package/dist/plugins/host-platform.d.ts +24 -3
- package/dist/plugins/host-platform.js +15 -1
- package/dist/plugins/image-bake-store-sql.js +2 -0
- package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
- package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
- package/dist/plugins/k8s-pod-reaper.js +0 -1
- package/dist/plugins/leader-run-store-sql.d.ts +22 -0
- package/dist/plugins/leader-run-store-sql.js +34 -4
- package/dist/plugins/local-checkpoint-store.d.ts +58 -23
- package/dist/plugins/local-checkpoint-store.js +195 -76
- package/dist/plugins/local-data-dir-modes-m39.js +2 -1
- package/dist/plugins/local-docker-capacity.d.ts +93 -0
- package/dist/plugins/local-docker-capacity.js +194 -0
- package/dist/plugins/local-docker-reaper.d.ts +92 -0
- package/dist/plugins/local-docker-reaper.js +102 -0
- package/dist/plugins/local-engine-high-water.d.ts +4 -2
- package/dist/plugins/local-engine-high-water.js +4 -1
- package/dist/plugins/local-session-store.d.ts +358 -125
- package/dist/plugins/local-session-store.js +824 -251
- package/dist/plugins/local-session-window.d.ts +3 -2
- package/dist/plugins/local-session-window.js +3 -2
- package/dist/plugins/local-sidecar-quarantine.js +3 -2
- package/dist/plugins/local-task-attachment-store.d.ts +18 -1
- package/dist/plugins/local-task-attachment-store.js +22 -1
- package/dist/plugins/memory-embedder.js +9 -7
- package/dist/plugins/memory-engine-pg.d.ts +3 -2
- package/dist/plugins/memory-engine-pg.js +14 -5
- package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
- package/dist/plugins/memory-engine-sql-apply.js +6 -8
- package/dist/plugins/memory-engine-tidb.d.ts +4 -2
- package/dist/plugins/memory-engine-tidb.js +11 -2
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
- package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
- package/dist/plugins/memory-run-store.d.ts +39 -27
- package/dist/plugins/memory-run-store.js +72 -70
- package/dist/plugins/one-time-migration-marker.d.ts +10 -0
- package/dist/plugins/one-time-migration-marker.js +7 -0
- package/dist/plugins/one-time-migrations.d.ts +186 -45
- package/dist/plugins/one-time-migrations.js +442 -119
- package/dist/plugins/org-delivery-quota-store.js +2 -1
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
- package/dist/plugins/permission-rule-store-sql.js +6 -86
- package/dist/plugins/pg-pool.d.ts +1 -31
- package/dist/plugins/pg-pool.js +16 -7
- package/dist/plugins/remote-env-e2b.d.ts +7 -25
- package/dist/plugins/remote-env-e2b.js +34 -25
- package/dist/plugins/remote-env-host.d.ts +2 -9
- package/dist/plugins/remote-env-host.js +34 -22
- package/dist/plugins/remote-env-k8s.d.ts +40 -45
- package/dist/plugins/remote-env-k8s.js +107 -58
- package/dist/plugins/remote-env-local-docker.d.ts +148 -14
- package/dist/plugins/remote-env-local-docker.js +367 -72
- package/dist/plugins/remote-scratchpad.js +4 -0
- package/dist/plugins/retention-deployment.d.ts +49 -17
- package/dist/plugins/retention-deployment.js +39 -8
- package/dist/plugins/run-preview-m45.d.ts +11 -0
- package/dist/plugins/run-preview-m45.js +19 -0
- package/dist/plugins/run-store-sql.d.ts +56 -68
- package/dist/plugins/run-store-sql.js +127 -116
- package/dist/plugins/s3-answer.d.ts +2 -1
- package/dist/plugins/sandbox-reaper.d.ts +26 -0
- package/dist/plugins/sandbox-reaper.js +2 -0
- package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
- package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
- package/dist/plugins/scheduler-support.d.ts +16 -1
- package/dist/plugins/scheduler-support.js +22 -2
- package/dist/plugins/schema-consistency.d.ts +42 -9
- package/dist/plugins/schema-consistency.js +212 -11
- package/dist/plugins/schema-drift-sentence.d.ts +4 -1
- package/dist/plugins/schema-drift-sentence.js +4 -4
- package/dist/plugins/schema-ensure-legs.d.ts +9 -0
- package/dist/plugins/schema-ensure-legs.js +1 -1
- package/dist/plugins/schema-indexes.js +3 -0
- package/dist/plugins/schema-live-columns.d.ts +14 -5
- package/dist/plugins/schema-live-columns.js +10 -10
- package/dist/plugins/send-user-file.js +2 -1
- package/dist/plugins/session-birth.d.ts +37 -0
- package/dist/plugins/session-birth.js +38 -0
- package/dist/plugins/session-epoch-anchor.d.ts +40 -12
- package/dist/plugins/session-epoch-anchor.js +33 -11
- package/dist/plugins/session-ext-table.d.ts +27 -3
- package/dist/plugins/session-ext-table.js +19 -6
- package/dist/plugins/session-fork.d.ts +15 -1
- package/dist/plugins/session-fork.js +3 -0
- package/dist/plugins/session-ownership.d.ts +1 -1
- package/dist/plugins/session-placement.d.ts +22 -16
- package/dist/plugins/session-placement.js +15 -12
- package/dist/plugins/session-row-sql.d.ts +12 -0
- package/dist/plugins/session-row-sql.js +3 -3
- package/dist/plugins/session-run-rollup.d.ts +29 -0
- package/dist/plugins/session-run-rollup.js +40 -0
- package/dist/plugins/session-store-sql.d.ts +38 -12
- package/dist/plugins/session-store-sql.js +130 -30
- package/dist/plugins/session-withdraw-sql.d.ts +36 -0
- package/dist/plugins/session-withdraw-sql.js +42 -0
- package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
- package/dist/plugins/shared-memory-store-sql.js +2 -1
- package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
- package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
- package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
- package/dist/plugins/sql-driver.d.ts +1 -1
- package/dist/plugins/sql-driver.js +2 -1
- package/dist/plugins/sql-errors.d.ts +32 -5
- package/dist/plugins/sql-errors.js +55 -7
- package/dist/plugins/sql-json-column.d.ts +8 -7
- package/dist/plugins/sql-json-column.js +10 -6
- package/dist/plugins/store-backend.d.ts +84 -15
- package/dist/plugins/store-backend.js +186 -55
- package/dist/plugins/store-contracts.d.ts +90 -30
- package/dist/plugins/store-contracts.js +22 -1
- package/dist/plugins/store-fault.d.ts +28 -2
- package/dist/plugins/store-fault.js +20 -2
- package/dist/plugins/task-attachment-store.d.ts +15 -3
- package/dist/plugins/task-attachment-store.js +22 -9
- package/dist/plugins/tidb-pool.js +23 -8
- package/dist/plugins/web-search.js +5 -3
- package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
- package/dist/plugins/workflow-run-store-sql.js +11 -5
- package/dist/principal-jwt.d.ts +4 -4
- package/dist/principal-jwt.js +20 -5
- package/dist/principal-shape.d.ts +41 -0
- package/dist/principal-shape.js +19 -0
- package/dist/question.d.ts +13 -23
- package/dist/question.js +21 -39
- package/dist/request-declaration-refusal.d.ts +35 -12
- package/dist/request-declaration-refusal.js +21 -9
- package/dist/request-form.d.ts +58 -0
- package/dist/request-form.js +72 -0
- package/dist/request-image-urls.d.ts +8 -2
- package/dist/request-image-urls.js +2 -1
- package/dist/request-images.d.ts +20 -0
- package/dist/request-images.js +59 -0
- package/dist/request-key-closure.d.ts +6 -7
- package/dist/request-key-closure.js +15 -2
- package/dist/resource-suspend.d.ts +7 -16
- package/dist/resource-suspend.js +1 -1
- package/dist/retired-name-host-notice.d.ts +21 -0
- package/dist/retired-name-host-notice.js +12 -0
- package/dist/rule-entry-list.d.ts +2 -2
- package/dist/rule-entry-list.js +3 -4
- package/dist/rule-issue-reading.d.ts +58 -0
- package/dist/rule-issue-reading.js +14 -0
- package/dist/rules-consent.d.ts +5 -3
- package/dist/rules-consent.js +1 -0
- package/dist/run-acceptance.d.ts +3 -1
- package/dist/run-acceptance.js +3 -0
- package/dist/run-local.d.ts +14 -6
- package/dist/run-local.js +92 -80
- package/dist/run-stale-default.d.ts +7 -0
- package/dist/run-stale-default.js +2 -0
- package/dist/runs.d.ts +26 -15
- package/dist/runs.js +39 -27
- package/dist/runtime-caps-resolver.d.ts +21 -6
- package/dist/runtime-caps-resolver.js +17 -4
- package/dist/runtime-governance.d.ts +2 -2
- package/dist/runtime-governance.js +5 -3
- package/dist/sealed-key-layout.d.ts +12 -5
- package/dist/sealed-key-layout.js +5 -0
- package/dist/sealed-key.d.ts +12 -2
- package/dist/sealed-key.js +115 -27
- package/dist/security.d.ts +128 -158
- package/dist/security.js +163 -59
- package/dist/sema-config-dir.d.ts +20 -0
- package/dist/sema-config-dir.js +25 -0
- package/dist/server-secret-env.d.ts +21 -5
- package/dist/server-secret-env.js +14 -4
- package/dist/session-children-retire.d.ts +7 -5
- package/dist/session-children-retire.js +7 -2
- package/dist/session-deletion.d.ts +88 -0
- package/dist/session-deletion.js +8 -0
- package/dist/session-erase.d.ts +145 -0
- package/dist/session-erase.js +115 -0
- package/dist/session-error-wire.d.ts +5 -5
- package/dist/session-error-wire.js +1 -1
- package/dist/session-incarnation.d.ts +52 -5
- package/dist/session-incarnation.js +19 -2
- package/dist/session-policy-wire.d.ts +6 -3
- package/dist/session-policy-wire.js +11 -1
- package/dist/session-resident-background.d.ts +0 -71
- package/dist/session-resident-background.js +4 -3
- package/dist/session-row.d.ts +2 -1
- package/dist/session-rules-seat.d.ts +12 -0
- package/dist/session-rules-seat.js +19 -0
- package/dist/session-titler.d.ts +7 -15
- package/dist/session-titler.js +1 -1
- package/dist/spec-fields.d.ts +57 -3
- package/dist/spec-fields.js +72 -51
- package/dist/store-posture.d.ts +136 -20
- package/dist/store-posture.js +188 -3
- package/dist/stored-request-hooks-m20.js +2 -2
- package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
- package/dist/stores-sql/background-agent-store-sql.js +73 -20
- package/dist/stores-sql/checkpoint-store-sql.d.ts +33 -28
- package/dist/stores-sql/checkpoint-store-sql.js +75 -44
- package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
- package/dist/stores-sql/mailbox-store-sql.js +31 -32
- package/dist/stores-sql/pg-session-storage.d.ts +7 -5
- package/dist/stores-sql/pg-session-storage.js +54 -46
- package/dist/stores-sql/retention-store-sql.d.ts +87 -19
- package/dist/stores-sql/retention-store-sql.js +92 -27
- package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
- package/dist/stores-sql/session-policy-store-sql.js +44 -36
- package/dist/stores-sql/session-write-hooks.d.ts +12 -6
- package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
- package/dist/stores-sql/tidb-session-storage.js +13 -8
- package/dist/stores-sql/tidb-session-store.d.ts +36 -17
- package/dist/stores-sql/tidb-session-store.js +69 -39
- package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
- package/dist/stores-sql/windowed-session-storage.js +9 -0
- package/dist/submission-exit.d.ts +50 -0
- package/dist/submission-exit.js +108 -0
- package/dist/task-a2a.d.ts +1 -1
- package/dist/task-a2a.js +3 -3
- package/dist/task-cwd.d.ts +20 -0
- package/dist/task-cwd.js +8 -0
- package/dist/task-mcp.d.ts +1 -1
- package/dist/task-mcp.js +3 -3
- package/dist/task-settings.d.ts +14 -10
- package/dist/task-settings.js +18 -7
- package/dist/terminal.d.ts +25 -43
- package/dist/terminal.js +31 -11
- package/dist/tool-approval.d.ts +131 -129
- package/dist/tool-approval.js +189 -193
- package/dist/trace/core-keyset-guard.d.ts +13 -6
- package/dist/trace/core-vocab-wire.d.ts +95 -0
- package/dist/trace/core-vocab-wire.js +15 -0
- package/dist/trace/exit-seat.d.ts +30 -4
- package/dist/trace/exit-seat.js +40 -36
- package/dist/trace/extension-call-face.d.ts +3 -2
- package/dist/trace/extension-call-face.js +3 -1
- package/dist/trace/ledger-events.d.ts +4 -7
- package/dist/trace/ledger-sink.d.ts +1 -30
- package/dist/trace/ledger-sink.js +0 -11
- package/dist/trace/model-segment.d.ts +5 -5
- package/dist/trace/model-segment.js +5 -5
- package/dist/trace/project.d.ts +55 -42
- package/dist/trace/project.js +52 -19
- package/dist/trace/redact.d.ts +123 -27
- package/dist/trace/redact.js +880 -260
- package/dist/trace/self-minted-wire.d.ts +487 -19
- package/dist/trace/self-minted-wire.js +172 -23
- package/dist/trace/wire-projection-faces.d.ts +5 -6
- package/dist/trace/wire-projection-faces.js +2 -2
- package/dist/upstream-body.d.ts +23 -0
- package/dist/upstream-body.js +16 -0
- package/dist/url-refusal.d.ts +3 -3
- package/dist/url-refusal.js +11 -4
- package/dist/user-authored-text.d.ts +1 -1
- package/dist/user-input-ledger.d.ts +7 -8
- package/dist/user-input-ledger.js +1 -1
- package/dist/web-admin-client/apply-effective.d.ts +6 -3
- package/dist/web-admin-client/apply-effective.js +13 -16
- package/dist/web-admin-client/apply-ledger.d.ts +16 -7
- package/dist/web-admin-client/apply-ledger.js +5 -2
- package/dist/web-admin-client/center-request.d.ts +2 -2
- package/dist/web-admin-client/center-request.js +15 -15
- package/dist/web-admin-client/effective-keys.d.ts +1 -1
- package/dist/web-admin-client/effective-keys.js +1 -1
- package/dist/web-admin-client/entry-metadata.d.ts +8 -0
- package/dist/web-admin-client/entry-metadata.js +13 -0
- package/dist/web-admin-client/http-client.d.ts +1 -1
- package/dist/web-admin-client/http-client.js +23 -4
- package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
- package/dist/web-admin-client/mcp-revocation.js +2 -1
- package/dist/web-admin-client/read-warnings.d.ts +1 -0
- package/dist/web-admin-client/read-warnings.js +1 -0
- package/dist/web-admin-client/restart-signal.js +8 -4
- package/dist/web-admin-client/skills-mcp.d.ts +2 -2
- package/dist/web-admin-client/types.d.ts +1 -2
- package/dist/workspace-space.d.ts +3 -2
- package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
- package/package.json +6 -3
- package/scripts/drain-check-local.mjs +118 -147
- package/scripts/drain-check.mysql.sql +22 -2
- package/scripts/drain-check.pg.sql +22 -2
- package/wire-changes/server@7.148.0.json +1517 -0
- package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
- package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
- package/dist/http/memory-layer-reply.d.ts +0 -30
- package/dist/http/memory-layer-reply.js +0 -24
- package/dist/lsp/e2b-bridge.d.ts +0 -57
- package/dist/lsp/e2b-bridge.js +0 -139
- package/dist/lsp/e2b-manager.d.ts +0 -93
- package/dist/lsp/e2b-manager.js +0 -178
- package/dist/lsp/lsp-frames.d.ts +0 -14
- package/dist/lsp/lsp-frames.js +0 -25
- package/dist/lsp/manager.d.ts +0 -129
- package/dist/lsp/manager.js +0 -127
- package/dist/lsp/types.d.ts +0 -12
- package/dist/lsp/types.js +0 -2
- package/dist/lsp/ws-transport.d.ts +0 -40
- package/dist/lsp/ws-transport.js +0 -210
|
@@ -115,7 +115,10 @@ export interface RunCancelContext {
|
|
|
115
115
|
* (`http/routes/tasks.ts` 的断连臂,立即中止);
|
|
116
116
|
* · `ask_park_grace_exhausted` —— 同一断连臂,但断连那一刻有流内未决 ask、已按窗到期同路转 park,宽限计时器用尽时 park 仍没落成;
|
|
117
117
|
* · `cancel_verb` —— `POST /v1/runs/:id/cancel`:同副本快路、跨副本耐久取消旗的轮询(四条腿的心跳 / 登记追平),
|
|
118
|
-
* 以及 park 中的 run 被它直接终局化(那一形不经 abort,成因照样是这条动词)
|
|
118
|
+
* 以及 park 中的 run 被它直接终局化(那一形不经 abort,成因照样是这条动词);
|
|
119
|
+
* · `stall_verdict` —— 持有者自己的心跳答「这条 run 的行已不在跑」(被观察口 / 认领冲突 / 收割器判死,`run.stalled`):持有者停下自己的腿
|
|
120
|
+
* (四条腿的心跳拍与认领心跳,判法一处 `runs.ts` 的 `beatRunHeartbeat`)。行上的终局是那份死亡判决(这条腿的终局写 CAS 打空),
|
|
121
|
+
* 本成因只落在这条腿自己铸的取消终局上(账本行 / 本连接的流)。
|
|
119
122
|
* **刻意不在表里**(普查过、没有真站点):抢占(`preempt` 是优雅让出,终局是 `paused`,不是取消)、有序关停
|
|
120
123
|
* ([ref] 只把未决卡转 park,从不中止活 run;进程退出后的行由收割器落「持有者死亡」判决,那不是本仓铸的取消终局)、
|
|
121
124
|
* `interrupt`(引擎的 turn 动词,终局 `completed` + `haltedByUser`)、detach 断连(不中止)。
|
|
@@ -124,7 +127,7 @@ export interface RunCancelContext {
|
|
|
124
127
|
* (中止那一刻登记)与 `mintCancelledResult`(终局铸点读它),自铸 wire 值登记 = `trace/self-minted-wire.ts` 的 `abortCause`
|
|
125
128
|
* (`satisfies Record<AbortCause, …>`:加 / 删一个词而登记没跟 ⇒ tsc 红)。
|
|
126
129
|
*/
|
|
127
|
-
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"];
|
|
128
131
|
export type AbortCause = (typeof ABORT_CAUSES)[number];
|
|
129
132
|
/**
|
|
130
133
|
* server 自铸、挂在终局结果上的**侧记键**全集(都描述「server 这一侧发生了什么」,core 那一侧无从知道)。
|
|
@@ -151,8 +154,8 @@ export type PersistedTaskResult = TaskResult & PersistedResultSideKeys;
|
|
|
151
154
|
/**
|
|
152
155
|
* 🔴 run 店「持有它的实例丢了」那一判的**行上落款**([ref] codex r1-F1 提为常量):三只 run 店的 `reapStale` 把心跳过期的 running 行翻成
|
|
153
156
|
* `failed` 并写下这一句。它是 run 店死亡判决留在行上的证据之一(另一只 = {@link RUN_ORPHANED_ERROR})—— 用户输入受理账本的收敛判词
|
|
154
|
-
* ([ref] L8 起两车道同一只)据 {@link isHolderDeathVerdict} 在 reap **之后**仍能判出「写者死了」—— 7.116.0 起判据是同行的机读码 `run.stalled`({@link RUN_HOLDER_DEATH_CODES})
|
|
155
|
-
* (
|
|
157
|
+
* ([ref] L8 起两车道同一只)据 {@link isHolderDeathVerdict} 在 reap **之后**仍能判出「写者死了」—— 7.116.0 起判据是同行的机读码 `run.stalled`({@link RUN_HOLDER_DEATH_CODES}),本句只给人读;三个落判决处(收割器 / 观察口 / 认领冲突)同写句子与码,同一只语句。
|
|
158
|
+
* 两条流的死亡终帧(run 流 `failed`、trace 流 `WORKER_DOWN`)读的是**行上**的这一句,不再各留字面量。
|
|
156
159
|
*/
|
|
157
160
|
export declare const RUN_STALLED_ERROR = "run stalled (instance lost?)";
|
|
158
161
|
/**
|
|
@@ -279,8 +282,8 @@ export interface NewRunMeta {
|
|
|
279
282
|
* `task_id`(调用方自铸的 `body.taskId`)—— 两把钥匙是**同一条律**(资源行上的唯一键),先认 `idem_key` 再认 `task_id`。
|
|
280
283
|
* 这是「原子赢或观察」的**观察**臂:行原样交回,没建新行、没动会话;回执由提交面的唯一回执函数判。
|
|
281
284
|
* · `{ ok: false, activeTaskId }` —— 会话被**别的** run 占着(双发守卫),没建行;
|
|
282
|
-
* · `{ ok: false, sessionAbsent: true }` —— 根会话行不在(SQL
|
|
283
|
-
*
|
|
285
|
+
* · `{ ok: false, sessionAbsent: true }` —— 根会话行不在(受理之后会话被删),没建行、没认领。SQL 孪生 = 认领事务里锁根行读到零行;
|
|
286
|
+
* File 孪生 = 在根行面({@link SessionRootRows},装配 = local 会话店)的锁里判这一行不在。Memory 孪生不接会话店(配它的引擎内存会话店没有根行),不答这一形。
|
|
284
287
|
* 其余几位在每一形上恒 `undefined`(读 `created.existing` / `created.activeTaskId` / `created.sessionAbsent` 不用先窄化,判别仍是穷举的)。
|
|
285
288
|
*/
|
|
286
289
|
export type CreateRunOutcome = {
|
|
@@ -337,6 +340,20 @@ export type FenceLanded = typeof FENCE_LANDED;
|
|
|
337
340
|
export interface InProcessClaimFence {
|
|
338
341
|
whileHoldingClaim(sessionId: string, taskId: string, write: (run: FencedRun) => FenceLanded): boolean;
|
|
339
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
|
+
}
|
|
340
357
|
/**
|
|
341
358
|
* `RunRecord["status"]`(= `"running" | TaskStatus`)的**唯一分类表** —— 词表的属主 = 判据的属主,
|
|
342
359
|
* 与类型定义同住一个文件。四个类:
|
|
@@ -382,6 +399,31 @@ export type UnsuccessfulRunStatus = {
|
|
|
382
399
|
export type ParkedRunStatus = {
|
|
383
400
|
[K in RunRecord["status"]]: (typeof RUN_STATUS_CLASS)[K] extends "parked" ? K : never;
|
|
384
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";
|
|
385
427
|
/**
|
|
386
428
|
* 一个状态词的类;**表里没有的词 ⇒ `undefined`**。
|
|
387
429
|
*
|
|
@@ -498,17 +540,19 @@ export declare function sessionTempoOfRunStatus(lastStatus: string): PeerSession
|
|
|
498
540
|
export declare function runProvenElsewhere(run: {
|
|
499
541
|
instanceId?: string | null;
|
|
500
542
|
}, thisInstanceId: string | undefined): boolean;
|
|
501
|
-
/** One row of the GET /v1/sessions list (CC /resume picker):
|
|
502
|
-
* task_run rows — newest-first by last activity.
|
|
503
|
-
*
|
|
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. */
|
|
504
546
|
export interface SessionSummary {
|
|
505
547
|
sessionId: string;
|
|
506
548
|
owner: string | null;
|
|
507
|
-
/** The
|
|
549
|
+
/** The session row's last-activity time (the keyset sort key) and its creation time. */
|
|
508
550
|
lastActivityAt: string;
|
|
509
551
|
firstActivityAt: string;
|
|
510
552
|
runCount: number;
|
|
511
|
-
/**
|
|
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. */
|
|
512
556
|
objectivePreview: string | null;
|
|
513
557
|
lastStatus: string;
|
|
514
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
|
|
@@ -519,40 +563,56 @@ export interface SessionSummary {
|
|
|
519
563
|
* wire 半场见 `security.ts SessionListItem.lastTaskRunId`(同名同义)。 */
|
|
520
564
|
lastTaskRunId?: string;
|
|
521
565
|
/** The session's title: the user's (`writeSessionRowCells`; `null` clears it back to automatic) or the auto-titler's
|
|
522
|
-
* (cheap-model one-liner, `setTitleIfNull` — fills NULL only). null = not (yet) titled
|
|
523
|
-
* 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`. */
|
|
524
567
|
title: string | null;
|
|
525
|
-
/** Pinned by the user (`writeSessionRowCells`). Always present, `false` by default
|
|
526
|
-
* twins answer `false` (no session_meta ⇒ nothing there can pin it). */
|
|
568
|
+
/** Pinned by the user (`writeSessionRowCells`). Always present, `false` by default. */
|
|
527
569
|
pinned: boolean;
|
|
528
570
|
/** 行标签(`src/session-row.ts` 的 `sessionRowTagOf`):这一位住客「PATCH 能写的每一格」的单向摘要,present-iff 这一行可被条件写(店有行格写原语 ∧ 行上有化身);
|
|
529
|
-
* 只经店的列表行映射铸(`sessionRowTagKey`)
|
|
571
|
+
* 只经店的列表行映射铸(`sessionRowTagKey`)。wire 半场见 `security.ts SessionListItem.rowTag`(同名同义)。 */
|
|
530
572
|
rowTag?: string;
|
|
531
573
|
/** 这只会话的存档读不出:present-iff 头的叶子读不出(唯一铸点 `session-error-wire.ts` 的 `sessionUnreadableOf`;码与读口同表)。叶子是行上一列的店(SQL 孪生)
|
|
532
|
-
*
|
|
574
|
+
* 恒缺席。wire 半场见 `security.ts SessionListItem.unreadable`(同名同义)。 */
|
|
533
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;
|
|
534
579
|
}
|
|
535
580
|
/**
|
|
536
|
-
*
|
|
537
|
-
*
|
|
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}」。
|
|
538
589
|
*
|
|
539
|
-
*
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
* 「最新一条是谁」(此前 `runCount` / `lastStatus` 读 run 店、`lastRunId` / `lastTaskRunId` 读进程内座:重启后同一行「有终态词、`lastRunId` 为 null」);
|
|
543
|
-
* 不另造的另一半理由:再造一只 `listBySession` 就要在三个孪生里各落一遍并重新证一遍同口径。
|
|
590
|
+
* 唯一的消费方 = local 会话店(会话身份来自会话仓、不是 run 账):列表 / 单行读 / `?q=` 一次列表一次读(不随会话数 N+1);行上出自 run 行的五位全读这一只,
|
|
591
|
+
* 于是一行里不会出现两个来源各答一遍「最新一条是谁」或「预览是哪一句」。实现 = 文件 / 内存两只 run 店,都调同一只纯函数;SQL 双生不实现它 ——
|
|
592
|
+
* SQL 会话店的列表投影在同一条 SELECT 里 JOIN `task_run`,同一条规则。
|
|
544
593
|
*
|
|
545
|
-
*
|
|
594
|
+
* `q`(路由归一化之后的非空串)在场 ⇒ 只交「有一条 run 行的预览列含 q(大小写不敏感、字面)」的会话 —— 与 SQL 孪生的 `EXISTS` 同一条谓词;缺席 ⇒ 交全部有 run 行的会话。
|
|
595
|
+
* 会话店的 `listSessions` 是唯一的会话 lister;run 店不再列会话([ref] 删除半)。
|
|
546
596
|
*/
|
|
547
597
|
export interface SessionRunRollupSource {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}): 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>;
|
|
551
610
|
}
|
|
552
611
|
/**
|
|
553
612
|
* 会话**此刻的 run 认领**(单活槽)的窄读面 —— run 店的 `getActiveTaskId`,同一个问题在 SQL 孪生里是写事务内对 `task_active` 的锁定读。
|
|
554
|
-
* local
|
|
555
|
-
*
|
|
613
|
+
* local 会话店在写锁(= 根行锁,{@link SessionRootRows})内读它:执行席的 `markMirror`(判序与 SQL 孪生同:行不在 / 住客不同 / writer / mirror 先判,认领只拦「absent → mirror」这一笔写)、
|
|
614
|
+
* 导入三写口与删除(判官 `judgeSessionWrite` 与 SQL 事务内钩同一只:先认领后本处写者)、placed 行的 `release`。认领唯一的运行期写者(`createRun`)排在同一把锁后面,
|
|
615
|
+
* 所以锁内读到的认领是稳定的(释放只会让读数更保守)。
|
|
556
616
|
*/
|
|
557
617
|
export interface SessionRunClaimSource {
|
|
558
618
|
getActiveTaskId(sessionId: string): Promise<string | undefined>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { RUN_STALE_SEC_DEFAULT } from "../run-stale-default.js";
|
|
1
2
|
export class StoreBootRefusalError extends Error {
|
|
2
3
|
}
|
|
3
4
|
export const SCHEMA_MISMATCH_ERROR_CODE = "config.schema_mismatch";
|
|
4
|
-
export const ABORT_CAUSES = ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb"];
|
|
5
|
+
export const ABORT_CAUSES = ["client_disconnected", "ask_park_grace_exhausted", "cancel_verb", "stall_verdict"];
|
|
5
6
|
export const RUN_STALLED_ERROR = "run stalled (instance lost?)";
|
|
6
7
|
export const RUN_ORPHANED_ERROR = "run orphaned by engine restart";
|
|
7
8
|
export function buildRunOrphanedError(heldBy) {
|
|
@@ -22,6 +23,26 @@ export const RUN_STATUS_CLASS = {
|
|
|
22
23
|
needs_review: "parked",
|
|
23
24
|
};
|
|
24
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";
|
|
25
46
|
export function runStatusClassOf(status) {
|
|
26
47
|
return RUN_STATUS_CLASS_LOOKUP[status];
|
|
27
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
|
|
@@ -68,6 +68,14 @@ export interface TaskAttachmentStore {
|
|
|
68
68
|
* 属主门在店里(owner 不匹配 / 不存在的 id 两边都不出现,无 oracle)。`bound` 按请求序、不重复。
|
|
69
69
|
*/
|
|
70
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
|
+
}>;
|
|
71
79
|
/** 物化输入(env 建立时)——按 session 单键查(绑定时已 owner 验过;session uuid 不可枚举)。 */
|
|
72
80
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
73
81
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -234,9 +242,11 @@ export declare class TiDBTaskAttachmentStore implements TaskAttachmentStore {
|
|
|
234
242
|
get(owner: string, id: string): Promise<TaskAttachmentRecord | null>;
|
|
235
243
|
getContent(owner: string, id: string): Promise<Uint8Array | null>;
|
|
236
244
|
/** 零引用对象删除(best-effort):meta 已删后,sha 仍被其他行引用则对象保留(跨行去重共享)。
|
|
237
|
-
*
|
|
245
|
+
* 失败不抛、交回哈希——E21 purge 不被对象存储抖动卡死(blob-backend 异步删裁定同旨);无 meta 的对象
|
|
238
246
|
* 经 API 不可达,彻底清收敛记 follow-up。 */
|
|
239
|
-
|
|
247
|
+
releaseBytes(shas: readonly string[]): Promise<{
|
|
248
|
+
readonly failed: readonly string[];
|
|
249
|
+
}>;
|
|
240
250
|
bind(owner: string, ids: readonly string[], sessionId: string, boundAtMs: number): Promise<AttachmentStoreBindOutcome>;
|
|
241
251
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
242
252
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -264,7 +274,9 @@ export declare class PgTaskAttachmentStore implements TaskAttachmentStore {
|
|
|
264
274
|
}): Promise<void>;
|
|
265
275
|
get(owner: string, id: string): Promise<TaskAttachmentRecord | null>;
|
|
266
276
|
getContent(owner: string, id: string): Promise<Uint8Array | null>;
|
|
267
|
-
|
|
277
|
+
releaseBytes(shas: readonly string[]): Promise<{
|
|
278
|
+
readonly failed: readonly string[];
|
|
279
|
+
}>;
|
|
268
280
|
bind(owner: string, ids: readonly string[], sessionId: string, boundAtMs: number): Promise<AttachmentStoreBindOutcome>;
|
|
269
281
|
listBySession(sessionId: string): Promise<TaskAttachmentRecord[]>;
|
|
270
282
|
delete(owner: string, id: string): Promise<boolean>;
|
|
@@ -4,6 +4,7 @@ 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";
|
|
7
8
|
import { readAtAddress } from "./blob-backend.js";
|
|
8
9
|
export const TaskAttachmentRecordSchema = z.object({
|
|
9
10
|
id: z.string(),
|
|
@@ -239,7 +240,13 @@ async function bindOnSql(db, owner, ids, sessionId, boundAtMs) {
|
|
|
239
240
|
const q = (mysqlSql, pgSql) => (mysql ? mysqlSql : pgSql);
|
|
240
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]);
|
|
241
242
|
const kindOf = new Map((await ownRows("id, mime", list)).rows.map((r) => [String(r.id), attachmentKindOf(String(r.mime))]));
|
|
242
|
-
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
|
+
}));
|
|
243
250
|
const attachments = list.filter((id) => kindOf.get(id) === "attachment");
|
|
244
251
|
if (attachments.length > 0)
|
|
245
252
|
await claim(attachments);
|
|
@@ -316,7 +323,8 @@ export class TiDBTaskAttachmentStore {
|
|
|
316
323
|
const b = await readAtAddress(this.bytes, meta.sha256);
|
|
317
324
|
return b && b.byteLength === meta.sizeBytes ? b : null;
|
|
318
325
|
}
|
|
319
|
-
async
|
|
326
|
+
async releaseBytes(shas) {
|
|
327
|
+
const failed = [];
|
|
320
328
|
for (const sha of new Set(shas)) {
|
|
321
329
|
try {
|
|
322
330
|
const [cnt] = await this.pool.query(`SELECT COUNT(*) AS n FROM ${TASK_ATTACHMENT_TABLE} WHERE sha256 = ?`, [sha]);
|
|
@@ -324,8 +332,10 @@ export class TiDBTaskAttachmentStore {
|
|
|
324
332
|
await this.bytes.delete([sha]);
|
|
325
333
|
}
|
|
326
334
|
catch {
|
|
335
|
+
failed.push(sha);
|
|
327
336
|
}
|
|
328
337
|
}
|
|
338
|
+
return { failed };
|
|
329
339
|
}
|
|
330
340
|
bind(owner, ids, sessionId, boundAtMs) {
|
|
331
341
|
return bindOnSql(this.db, owner, ids, sessionId, boundAtMs);
|
|
@@ -341,19 +351,19 @@ export class TiDBTaskAttachmentStore {
|
|
|
341
351
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE id = ? AND owner = ?`, [id, owner]);
|
|
342
352
|
if ((res.affectedRows ?? 0) === 0)
|
|
343
353
|
return false;
|
|
344
|
-
await this.
|
|
354
|
+
await this.releaseBytes([meta.sha256]);
|
|
345
355
|
return true;
|
|
346
356
|
}
|
|
347
357
|
async deleteBySession(sessionId) {
|
|
348
358
|
const [rows] = await this.pool.query(`SELECT sha256 FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = ?`, [sessionId]);
|
|
349
359
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = ?`, [sessionId]);
|
|
350
|
-
await this.
|
|
360
|
+
await this.releaseBytes(rows.map((r) => r.sha256));
|
|
351
361
|
return res.affectedRows ?? 0;
|
|
352
362
|
}
|
|
353
363
|
async reapUnbound(olderThanMs) {
|
|
354
364
|
const [rows] = await this.pool.query(`SELECT sha256 FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < ?`, [olderThanMs]);
|
|
355
365
|
const [res] = await this.pool.query(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < ?`, [olderThanMs]);
|
|
356
|
-
await this.
|
|
366
|
+
await this.releaseBytes(rows.map((r) => r.sha256));
|
|
357
367
|
return res.affectedRows ?? 0;
|
|
358
368
|
}
|
|
359
369
|
async sweepOrphanObjects(graceMs, nowMs = Date.now()) {
|
|
@@ -434,7 +444,8 @@ export class PgTaskAttachmentStore {
|
|
|
434
444
|
const b = await readAtAddress(this.bytes, meta.sha256);
|
|
435
445
|
return b && b.byteLength === meta.sizeBytes ? b : null;
|
|
436
446
|
}
|
|
437
|
-
async
|
|
447
|
+
async releaseBytes(shas) {
|
|
448
|
+
const failed = [];
|
|
438
449
|
for (const sha of new Set(shas)) {
|
|
439
450
|
try {
|
|
440
451
|
const res = await this.q(`SELECT COUNT(*) AS n FROM ${TASK_ATTACHMENT_TABLE} WHERE sha256 = $1`, [sha]);
|
|
@@ -442,8 +453,10 @@ export class PgTaskAttachmentStore {
|
|
|
442
453
|
await this.bytes.delete([sha]);
|
|
443
454
|
}
|
|
444
455
|
catch {
|
|
456
|
+
failed.push(sha);
|
|
445
457
|
}
|
|
446
458
|
}
|
|
459
|
+
return { failed };
|
|
447
460
|
}
|
|
448
461
|
bind(owner, ids, sessionId, boundAtMs) {
|
|
449
462
|
return bindOnSql(this.db, owner, ids, sessionId, boundAtMs);
|
|
@@ -456,17 +469,17 @@ export class PgTaskAttachmentStore {
|
|
|
456
469
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE id = $1 AND owner = $2 RETURNING sha256`, [id, owner]);
|
|
457
470
|
if (res.rows.length === 0)
|
|
458
471
|
return false;
|
|
459
|
-
await this.
|
|
472
|
+
await this.releaseBytes([res.rows[0].sha256]);
|
|
460
473
|
return true;
|
|
461
474
|
}
|
|
462
475
|
async deleteBySession(sessionId) {
|
|
463
476
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id = $1 RETURNING sha256`, [sessionId]);
|
|
464
|
-
await this.
|
|
477
|
+
await this.releaseBytes(res.rows.map((r) => r.sha256));
|
|
465
478
|
return res.rows.length;
|
|
466
479
|
}
|
|
467
480
|
async reapUnbound(olderThanMs) {
|
|
468
481
|
const res = await this.q(`DELETE FROM ${TASK_ATTACHMENT_TABLE} WHERE session_id IS NULL AND created_at_ms < $1 RETURNING sha256`, [olderThanMs]);
|
|
469
|
-
await this.
|
|
482
|
+
await this.releaseBytes(res.rows.map((r) => r.sha256));
|
|
470
483
|
return res.rows.length;
|
|
471
484
|
}
|
|
472
485
|
async sweepOrphanObjects(graceMs, nowMs = Date.now()) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { writeLogText } from "../observability/logger.js";
|
|
1
2
|
import mysql from "mysql2/promise";
|
|
2
3
|
import { TIDB_APPROVAL_ASK_STATEMENTS } from "./approval-ask-store-sql.js";
|
|
3
4
|
import { TIDB_MEMORY_OPTOUT_GRANT_STATEMENTS } from "./memory-optout-grant-store-sql.js";
|
|
@@ -7,12 +8,13 @@ import { TIDB_ADOPTION_LOG_STATEMENTS } from "./adoption-log-sql.js";
|
|
|
7
8
|
import { TIDB_PERMISSION_RULE_STATEMENTS } from "./permission-rule-store-sql.js";
|
|
8
9
|
import { TIDB_RETENTION_TOMBSTONE_STATEMENTS } from "../stores-sql/retention-store-sql.js";
|
|
9
10
|
import { TIDB_RETENTION_LANE_STATEMENTS } from "./retention-lane-store-sql.js";
|
|
10
|
-
import { SESSION_META_INCARNATION_COLUMN } from "../session-incarnation.js";
|
|
11
|
+
import { SESSION_META_INCARNATION_COLUMN, SESSION_META_LINEAGE_COLUMNS } from "../session-incarnation.js";
|
|
11
12
|
import { ensureSessionExtTableMysql } from "./session-ext-table.js";
|
|
13
|
+
import { CHECKPOINT_HOST_SESSION_COLUMN } from "./checkpoint-index-columns.js";
|
|
12
14
|
import { RUN_IDENTITY_COLUMNS } from "../identity-source.js";
|
|
13
15
|
import { SESSION_RULES_COLUMN } from "./session-rules-column.js";
|
|
14
16
|
import { INBOX_PAYLOAD_COLUMN } from "./inbox-payload-column.js";
|
|
15
|
-
import {
|
|
17
|
+
import { PRINCIPAL_MAX_BYTES } from "../principal-shape.js";
|
|
16
18
|
import { ensureIndexes } from "./ensure-index.js";
|
|
17
19
|
import { CENTRAL_SCHEMA_INDEXES } from "./schema-indexes.js";
|
|
18
20
|
import { SESSION_INDEXES } from "../stores-sql/pg-session-storage.js";
|
|
@@ -83,6 +85,9 @@ export const SCHEMA_STATEMENTS = [
|
|
|
83
85
|
-- src/session-incarnation.ts 的 SESSION_META_INCARNATION_COLUMN(存量库缺这一列 ⇒ 起服列册对账拒启,拒句里的 ALTER 由本建表语句生成)。
|
|
84
86
|
-- 不上 wire、不进模型上下文、日志只打前 8 位。
|
|
85
87
|
${SESSION_META_INCARNATION_COLUMN.mysql},
|
|
88
|
+
-- fork 谱系(建这一行的那次 fork 的源会话 id + 源行那一刻的住客令牌;只由 fork 的建行写,core forkRowCells 铸):NULL = 不是 fork 建的行,
|
|
89
|
+
-- 或这两列落地之前建的 fork(源已不可知,不回填)。列定义的唯一属主 = src/session-incarnation.ts 的 SESSION_META_LINEAGE_COLUMNS。
|
|
90
|
+
${SESSION_META_LINEAGE_COLUMNS.mysql},
|
|
86
91
|
PRIMARY KEY (session_id),
|
|
87
92
|
KEY idx_session_meta_owner (owner),
|
|
88
93
|
-- listPlaced 的检索腿(kind + 租户 + 年龄升序);普通会话这三列全 NULL ⇒ 不占索引选择性。
|
|
@@ -349,9 +354,14 @@ export const SCHEMA_STATEMENTS = [
|
|
|
349
354
|
-- 两列同生同灭(stamp 在场 ⇔ 记录在场);reopen 见到记录即拒(已结算的动作不可重开)。
|
|
350
355
|
execution_outcome JSON NULL,
|
|
351
356
|
execution_at_ms BIGINT NULL,
|
|
357
|
+
-- host_session_id:这张卡**归在哪只会话上**(兑现它的那条 run 的会话;cascade 的级上卡 = 调用方的会话,其余 = session_id)。写口 put 由
|
|
358
|
+
-- plugins/checkpoint-index-columns.ts 的 hostSessionOf 求值一次;存量行由一次性迁移 M49 自 session_id 回填。按会话找卡的读口(决断 / 取消 / 收割 /
|
|
359
|
+
-- 续跑输入回收 / 运维队列行)只读它;session_id 只答「这是哪段对话」。列定义的唯一属主 = 同模块的 CHECKPOINT_HOST_SESSION_COLUMN。
|
|
360
|
+
${CHECKPOINT_HOST_SESSION_COLUMN.mysql},
|
|
352
361
|
PRIMARY KEY (token),
|
|
353
362
|
KEY idx_checkpoint_status_deadline (status, deadline),
|
|
354
|
-
KEY idx_checkpoint_session_status (session_id, status)
|
|
363
|
+
KEY idx_checkpoint_session_status (session_id, status),
|
|
364
|
+
KEY idx_checkpoint_host_session_status (host_session_id, status)
|
|
355
365
|
) COLLATE utf8mb4_bin`,
|
|
356
366
|
`CREATE TABLE IF NOT EXISTS checkpoint_ctx (
|
|
357
367
|
session_id VARCHAR(190) NOT NULL,
|
|
@@ -382,22 +392,27 @@ export const SCHEMA_STATEMENTS = [
|
|
|
382
392
|
expires_at_ms BIGINT NOT NULL,
|
|
383
393
|
PRIMARY KEY (session_id, nonce),
|
|
384
394
|
KEY idx_approval_nonce_expires (expires_at_ms)
|
|
395
|
+
) COLLATE utf8mb4_bin`,
|
|
396
|
+
`CREATE TABLE IF NOT EXISTS approval_nonce_floor (
|
|
397
|
+
singleton CHAR(1) NOT NULL DEFAULT 'x',
|
|
398
|
+
floor_ms BIGINT NOT NULL,
|
|
399
|
+
PRIMARY KEY (singleton)
|
|
385
400
|
) COLLATE utf8mb4_bin`,
|
|
386
401
|
`CREATE TABLE IF NOT EXISTS org_delivery_sender_quota (
|
|
387
|
-
from_scope VARBINARY(${
|
|
402
|
+
from_scope VARBINARY(${PRINCIPAL_MAX_BYTES}) NOT NULL,
|
|
388
403
|
window_start_ms BIGINT NOT NULL,
|
|
389
404
|
attempts INT NOT NULL,
|
|
390
405
|
PRIMARY KEY (from_scope)
|
|
391
406
|
) COLLATE utf8mb4_bin`,
|
|
392
407
|
`CREATE TABLE IF NOT EXISTS org_delivery_recipient_quota (
|
|
393
|
-
to_scope VARBINARY(${
|
|
408
|
+
to_scope VARBINARY(${PRINCIPAL_MAX_BYTES}) NOT NULL,
|
|
394
409
|
window_start_ms BIGINT NOT NULL,
|
|
395
410
|
delivered INT NOT NULL,
|
|
396
411
|
PRIMARY KEY (to_scope)
|
|
397
412
|
) COLLATE utf8mb4_bin`,
|
|
398
413
|
`CREATE TABLE IF NOT EXISTS org_delivery_pair_quota (
|
|
399
|
-
to_scope VARBINARY(${
|
|
400
|
-
from_scope VARBINARY(${
|
|
414
|
+
to_scope VARBINARY(${PRINCIPAL_MAX_BYTES}) NOT NULL,
|
|
415
|
+
from_scope VARBINARY(${PRINCIPAL_MAX_BYTES}) NOT NULL,
|
|
401
416
|
window_start_ms BIGINT NOT NULL,
|
|
402
417
|
delivered INT NOT NULL,
|
|
403
418
|
PRIMARY KEY (to_scope, from_scope)
|
|
@@ -813,7 +828,7 @@ export async function releaseEnsureSchemaLock(conn, tag = "ensureSchema") {
|
|
|
813
828
|
await conn.query("SELECT RELEASE_LOCK(?)", [ENSURE_SCHEMA_LOCK]);
|
|
814
829
|
}
|
|
815
830
|
catch (err) {
|
|
816
|
-
|
|
831
|
+
writeLogText("stderr", `[${tag}] RELEASE_LOCK('${ENSURE_SCHEMA_LOCK}') failed (lock auto-frees on connection close):`, err);
|
|
817
832
|
}
|
|
818
833
|
}
|
|
819
834
|
export const SCHEMA_INDEXES = [
|
|
@@ -2,7 +2,9 @@ import { validateHeaderValue } from "node:http";
|
|
|
2
2
|
import { createSearxngSearchBackend } from "@sema-agent/core";
|
|
3
3
|
import { findUrlCredential, findUrlUserinfo, isHierarchicalUrl } from "@sema-agent/settings-schema";
|
|
4
4
|
import { redactSecrets } from "../trace/redact.js";
|
|
5
|
+
import { createEgressFetch } from "../egress-redirect.js";
|
|
5
6
|
import { buildRequestUrlCredentialRefusal, urlCredentialFacts } from "../url-credential-refusal.js";
|
|
7
|
+
import { readUpstreamJson } from "../upstream-body.js";
|
|
6
8
|
export const WEB_SEARCH_PROVIDERS = ["brave", "tavily", "searxng"];
|
|
7
9
|
function isWebSearchProvider(word) {
|
|
8
10
|
return WEB_SEARCH_PROVIDERS.includes(word);
|
|
@@ -99,7 +101,7 @@ async function braveSearch(fetchImpl, cfg, query, max, signal) {
|
|
|
99
101
|
const res = await fetchImpl(url, { headers: { Accept: "application/json", "X-Subscription-Token": token }, signal });
|
|
100
102
|
if (!res.ok)
|
|
101
103
|
throw await httpFailure("brave", res);
|
|
102
|
-
const data = (await res
|
|
104
|
+
const data = (await readUpstreamJson(res));
|
|
103
105
|
return normalize(data.web?.results, (r) => ({ title: r.title, url: r.url, snippet: r.description }), max, "brave");
|
|
104
106
|
}
|
|
105
107
|
async function tavilySearch(fetchImpl, cfg, query, max, signal, opts) {
|
|
@@ -117,7 +119,7 @@ async function tavilySearch(fetchImpl, cfg, query, max, signal, opts) {
|
|
|
117
119
|
});
|
|
118
120
|
if (!res.ok)
|
|
119
121
|
throw await httpFailure("tavily", res);
|
|
120
|
-
const data = (await res
|
|
122
|
+
const data = (await readUpstreamJson(res));
|
|
121
123
|
return normalize(data.results, (r) => ({ title: r.title, url: r.url, snippet: r.content }), max, "tavily");
|
|
122
124
|
}
|
|
123
125
|
async function searxngSearch(fetchImpl, cfg, query, max, signal, timeoutMs, opts) {
|
|
@@ -151,7 +153,7 @@ function redactedBackendFailure(e) {
|
|
|
151
153
|
return safe === text ? e : new Error(safe);
|
|
152
154
|
}
|
|
153
155
|
export function createWebSearchBackend(cfg) {
|
|
154
|
-
const fetchImpl = cfg.fetchImpl
|
|
156
|
+
const fetchImpl = createEgressFetch("declare the final search address as WEB_SEARCH_ENDPOINT", cfg.fetchImpl);
|
|
155
157
|
const maxResults = Math.max(1, Math.min(20, cfg.maxResults ?? DEFAULT_MAX_RESULTS));
|
|
156
158
|
const timeoutMs = Math.max(1000, cfg.timeoutMs ?? DEFAULT_TIMEOUT_MS);
|
|
157
159
|
const search = async (query, signal, opts) => {
|
|
@@ -62,7 +62,7 @@ import type { WorkflowNotifyJournalStore, WorkflowNotifyJournalEntry } from "../
|
|
|
62
62
|
import { type WorkflowAgentSessionIndex, type WorkflowAgentSessionRow } from "../orchestration/workflow-agent-session-index.js";
|
|
63
63
|
import { type WorkflowParkDecision, type WorkflowParkDecisionStore } from "../orchestration/workflow-park-decision.js";
|
|
64
64
|
import type { SqlRunStore } from "./run-store-sql.js";
|
|
65
|
-
import { type SqlDriver } from "./sql-driver.js";
|
|
65
|
+
import { type SqlDialect, type SqlDriver, type SqlExec } from "./sql-driver.js";
|
|
66
66
|
type WorkflowRun = Parameters<WorkflowRunStore["put"]>[1];
|
|
67
67
|
/** Row cap guard: a run blob beyond this is NOT stored on update (the prior revision stays) — TiDB's
|
|
68
68
|
* ~6 MiB txn-entry limit would otherwise throw the (best-effort) progress write into the workflow loop.
|
|
@@ -148,6 +148,11 @@ export declare class SqlWorkflowRunStore implements WorkflowRunStore {
|
|
|
148
148
|
keep?: number;
|
|
149
149
|
}): Promise<number>;
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* 立一只会话的**清除围栏**(session 全宽,`run_id = ''`;窗 = `PURGE_FENCE_MS`):此后同属主的 enqueue 落空(`purgedOwner` 缺席 = 属主未知 ⇒ 围全部)。
|
|
153
|
+
* 语句源唯一:信箱自己的 `purge` 与删净会话的执行体(`retention-deployment.ts` 的部署行,在执行体那一个事务里)同调。Upsert = 再清一次刷新窗。
|
|
154
|
+
*/
|
|
155
|
+
export declare function writeInboxPurgeFenceOn(exec: SqlExec, dialect: SqlDialect, sessionId: string, purgedOwner: string | null | undefined, now: number): Promise<void>;
|
|
151
156
|
/** Dual-dialect `WorkflowCompletionInbox`. See the file header for the dialect-delta ledger. */
|
|
152
157
|
export declare class SqlWorkflowCompletionInbox implements WorkflowCompletionInbox {
|
|
153
158
|
protected readonly db: SqlDriver;
|