@sema-agent/server 7.52.0 → 7.53.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/USAGE.md +22 -5
- package/dist/adoption/plan.d.ts +3 -3
- package/dist/adoption/quiesce.d.ts +1 -1
- package/dist/adoption/sql.d.ts +2 -2
- package/dist/adoption/wire.d.ts +1 -1
- package/dist/approval-ask-machine.d.ts +2 -2
- package/dist/approval-card.d.ts +18 -18
- package/dist/approval-deny-reasons.d.ts +1 -1
- package/dist/approval-hmac.d.ts +2 -2
- package/dist/approval-reconciler.d.ts +14 -14
- package/dist/approval.d.ts +2 -2
- package/dist/audit.d.ts +4 -4
- package/dist/auth-keys.d.ts +6 -6
- package/dist/bench/l8/artifact.d.ts +6 -1
- package/dist/bench/l8/artifact.js +2 -27
- package/dist/bench/l8/escape.d.ts +3 -3
- package/dist/bench/l8/index.d.ts +1 -1
- package/dist/bench/s1/arms.d.ts +3 -3
- package/dist/bench/s1/oracle.d.ts +2 -2
- package/dist/bench/s1/reviewer.d.ts +1 -1
- package/dist/bench/s1/row.d.ts +5 -5
- package/dist/bench/s1/runner-ctx.d.ts +3 -3
- package/dist/boot/config-center.d.ts +14 -7
- package/dist/boot/config-center.js +2 -0
- package/dist/boot/coordinators.d.ts +4 -4
- package/dist/boot/crash-last.d.ts +1 -1
- package/dist/boot/device-lane.d.ts +3 -3
- package/dist/boot/device-lane.js +2 -0
- package/dist/boot/engine-lease.d.ts +4 -4
- package/dist/boot/governance-seams.d.ts +5 -5
- package/dist/boot/leader.d.ts +5 -5
- package/dist/boot/limit-sync.d.ts +1 -1
- package/dist/boot/memory-boundary.d.ts +5 -5
- package/dist/boot/memory-consolidation.d.ts +8 -2
- package/dist/boot/memory-consolidation.js +1 -0
- package/dist/boot/org-memory.d.ts +5 -5
- package/dist/boot/parked-revive-gate.d.ts +6 -6
- package/dist/boot/permission-rules-audit.d.ts +2 -2
- package/dist/boot/reapers.d.ts +8 -8
- package/dist/boot/resolve-spec.d.ts +4 -4
- package/dist/boot/retention-lane.d.ts +1 -1
- package/dist/boot/runner-deps.d.ts +33 -27
- package/dist/boot/runner-deps.js +2 -1
- package/dist/boot/runtime-caps.d.ts +4 -4
- package/dist/boot/session-faces.d.ts +1 -1
- package/dist/boot/shutdown.d.ts +10 -10
- package/dist/boot/side-query-lane.d.ts +14 -14
- package/dist/boot/stores.js +5 -0
- package/dist/boot/task-list-lane.d.ts +3 -3
- package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
- package/dist/boot/workflow-orchestration.d.ts +1 -1
- package/dist/bounded-session-map.d.ts +1 -1
- package/dist/brain.d.ts +3 -3
- package/dist/budget.d.ts +3 -3
- package/dist/canonical-json.d.ts +53 -0
- package/dist/canonical-json.js +48 -0
- package/dist/capabilities/center-prompts.d.ts +13 -13
- package/dist/capabilities/collab-workflows.d.ts +1 -1
- package/dist/capabilities/hands-lane.d.ts +4 -4
- package/dist/capabilities/memory-notice.d.ts +4 -4
- package/dist/capabilities/prompt.d.ts +2 -2
- package/dist/capabilities/sandbox-file-send.d.ts +2 -2
- package/dist/capabilities/scenarios.d.ts +16 -16
- package/dist/capabilities/skills.d.ts +1 -1
- package/dist/capabilities/team.d.ts +3 -3
- package/dist/capabilities/tool-defer.d.ts +6 -6
- package/dist/config-catalog.d.ts +139 -0
- package/dist/config-catalog.js +556 -0
- package/dist/config-center/apply-effective.d.ts +20 -7
- package/dist/config-center/apply-effective.js +45 -0
- package/dist/config-center/apply-ledger.d.ts +6 -6
- package/dist/config-center/facade.d.ts +3 -2
- package/dist/config-center/hot-keys-registry.d.ts +2 -2
- package/dist/config-center/http-client.d.ts +5 -5
- package/dist/config-center/mcp-revocation.d.ts +6 -4
- package/dist/config-center/mcp-revocation.js +2 -12
- package/dist/config-center/restart-signal.d.ts +11 -1
- package/dist/config-center/restart-signal.js +1 -1
- package/dist/config-center/skills-mcp.d.ts +2 -2
- package/dist/config-center/stage-limits.d.ts +3 -3
- package/dist/config-center/types.d.ts +23 -19
- package/dist/config-invariants.d.ts +1 -1
- package/dist/config-provider.d.ts +2 -2
- package/dist/config-types.d.ts +157 -134
- package/dist/config.d.ts +32 -24
- package/dist/config.js +48 -6
- package/dist/degenerate-instrument.d.ts +1 -1
- package/dist/deployment-governance.d.ts +13 -13
- package/dist/device-store.d.ts +2 -2
- package/dist/device-ws-hub.d.ts +6 -4
- package/dist/device-ws-hub.js +9 -3
- package/dist/device-ws-protocol.d.ts +3 -3
- package/dist/digest-form.d.ts +1 -1
- package/dist/elicitation.d.ts +1 -1
- package/dist/env-facts.d.ts +7 -7
- package/dist/execution-lane-caps.d.ts +5 -5
- package/dist/fleet/fleet-bus.d.ts +56 -53
- package/dist/fleet/fleet-reconciler.d.ts +2 -2
- package/dist/fleet/fleet-terminal-window.d.ts +1 -1
- package/dist/fleet/subagent-tail-bus.d.ts +3 -3
- package/dist/fleet-client.d.ts +3 -3
- package/dist/fleet-lease.d.ts +1 -1
- package/dist/hooks/branch-transcript.d.ts +2 -2
- package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
- package/dist/hooks/cc-stop-prompt.d.ts +2 -2
- package/dist/hooks/hook-llm.d.ts +1 -1
- package/dist/hooks/hook-runner.d.ts +12 -5
- package/dist/http/active-run-conflict.d.ts +31 -33
- package/dist/http/active-run-conflict.js +4 -2
- package/dist/http/route-ctx.d.ts +23 -21
- package/dist/http/routes/a2a-serve.d.ts +2 -2
- package/dist/http/routes/admin-config-refresh.d.ts +1 -1
- package/dist/http/routes/admin-drain.d.ts +4 -4
- package/dist/http/routes/admin-memory-optout.d.ts +5 -5
- package/dist/http/routes/adoption.d.ts +1 -1
- package/dist/http/routes/agents-roster.d.ts +1 -1
- package/dist/http/routes/approvals-assistant.d.ts +6 -6
- package/dist/http/routes/approvals-assistant.js +4 -1
- package/dist/http/routes/capabilities.d.ts +1 -1
- package/dist/http/routes/capabilities.js +1 -0
- package/dist/http/routes/config-catalog.d.ts +28 -0
- package/dist/http/routes/config-catalog.js +42 -0
- package/dist/http/routes/diagnostics.d.ts +2 -2
- package/dist/http/routes/fleet.d.ts +1 -1
- package/dist/http/routes/images.d.ts +1 -1
- package/dist/http/routes/leader.d.ts +1 -1
- package/dist/http/routes/memory-bundle.d.ts +4 -4
- package/dist/http/routes/memory-bundle.js +2 -3
- package/dist/http/routes/memory-compliance.d.ts +7 -7
- package/dist/http/routes/memory-consolidation.d.ts +1 -1
- package/dist/http/routes/memory-origin.d.ts +9 -9
- package/dist/http/routes/memory-policy.d.ts +3 -3
- package/dist/http/routes/notify-wake.d.ts +1 -1
- package/dist/http/routes/observability.d.ts +1 -1
- package/dist/http/routes/retention-ops.d.ts +1 -1
- package/dist/http/routes/rules.d.ts +3 -3
- package/dist/http/routes/run-memory-capture.d.ts +1 -1
- package/dist/http/routes/runs.d.ts +3 -3
- package/dist/http/routes/runs.js +12 -17
- package/dist/http/routes/session-sync.d.ts +2 -2
- package/dist/http/routes/sessions-list.d.ts +1 -1
- package/dist/http/routes/sessions.d.ts +9 -1
- package/dist/http/routes/sessions.js +61 -1
- package/dist/http/routes/shared-memory.d.ts +1 -1
- package/dist/http/routes/side-query.d.ts +1 -1
- package/dist/http/routes/tasks.d.ts +1 -1
- package/dist/http/routes/trace-usage.d.ts +1 -1
- package/dist/http/routes/workflows.d.ts +1 -1
- package/dist/http/run-meta.d.ts +1 -1
- package/dist/http/send.d.ts +6 -6
- package/dist/http/server.d.ts +84 -67
- package/dist/http/server.js +25 -12
- package/dist/http/sse-lifecycle.d.ts +1 -1
- package/dist/http/sse-log.d.ts +6 -6
- package/dist/http/verify-rounds.d.ts +3 -3
- package/dist/http/wire-gate.d.ts +2 -2
- package/dist/http/wire-types.d.ts +38 -38
- package/dist/key-resolver.d.ts +1 -1
- package/dist/leader/diffout.d.ts +2 -2
- package/dist/leader/diffup.d.ts +1 -1
- package/dist/leader/endpoint.d.ts +1 -1
- package/dist/leader/fanout.d.ts +6 -6
- package/dist/leader/grader-env-factory.d.ts +1 -1
- package/dist/leader/leader.d.ts +12 -12
- package/dist/leader/merge.d.ts +3 -3
- package/dist/leader/planner.d.ts +5 -5
- package/dist/leader/repair-oracle.d.ts +1 -1
- package/dist/leader/wire.d.ts +9 -9
- package/dist/lsp/manager.d.ts +2 -2
- package/dist/lsp/types.d.ts +1 -1
- package/dist/lsp/ws-transport.d.ts +2 -2
- package/dist/main.js +13 -2
- package/dist/mcp-content-origin.d.ts +1 -1
- package/dist/memory-bundle-engine.d.ts +5 -3
- package/dist/memory-bundle-engine.js +2 -2
- package/dist/memory-operator-faces.d.ts +41 -11
- package/dist/memory-operator-faces.js +12 -0
- package/dist/memory-origin-fence.d.ts +20 -35
- package/dist/memory-origin-fence.js +41 -1
- package/dist/memory-posture.d.ts +6 -6
- package/dist/memory-scope.d.ts +7 -7
- package/dist/model-select.d.ts +5 -5
- package/dist/observability/cost-quota.d.ts +6 -6
- package/dist/observability/cost-taxonomy.d.ts +2 -2
- package/dist/observability/fail-open.d.ts +1 -5
- package/dist/observability/fail-open.js +0 -4
- package/dist/observability/metrics.d.ts +1 -1
- package/dist/observability/prompt-manifest.d.ts +8 -8
- package/dist/observability/rate-limit.d.ts +2 -2
- package/dist/observability/secret-env-scrub.d.ts +1 -1
- package/dist/observability/tool-trace.d.ts +1 -1
- package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
- package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
- package/dist/orchestration/subagent-steer.d.ts +3 -3
- package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
- package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
- package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
- package/dist/parent-watch.d.ts +1 -1
- package/dist/parked-decide.d.ts +11 -11
- package/dist/plan-cache-probe.d.ts +1 -1
- package/dist/plugins/adoption-log-sql.d.ts +4 -4
- package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
- package/dist/plugins/approval-ask-store-memory.js +12 -0
- package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
- package/dist/plugins/approval-ask-store-sql.js +23 -6
- package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
- package/dist/plugins/approval-payload-fingerprint.js +23 -0
- package/dist/plugins/background-agent-store-sql.d.ts +8 -8
- package/dist/plugins/background-shell-support.d.ts +12 -12
- package/dist/plugins/blob-backend.d.ts +3 -3
- package/dist/plugins/breaker-state-sql.d.ts +3 -3
- package/dist/plugins/caching-session-store.d.ts +6 -6
- package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
- package/dist/plugins/checkpoint-store-sql.js +76 -33
- package/dist/plugins/device-store-sql.d.ts +4 -3
- package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
- package/dist/plugins/file-history-store-sql.d.ts +9 -8
- package/dist/plugins/file-run-store.d.ts +27 -27
- package/dist/plugins/fork-routing-session-store.d.ts +9 -9
- package/dist/plugins/image-bake-store-sql.d.ts +1 -1
- package/dist/plugins/image-index-sql.d.ts +2 -2
- package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
- package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
- package/dist/plugins/leader-run-store-sql.d.ts +1 -1
- package/dist/plugins/local-checkpoint-store.d.ts +26 -17
- package/dist/plugins/local-checkpoint-store.js +21 -11
- package/dist/plugins/local-session-store.d.ts +5 -5
- package/dist/plugins/mailbox-store-sql.d.ts +6 -6
- package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
- package/dist/plugins/memory-engine-pg.d.ts +1 -1
- package/dist/plugins/memory-engine-tidb.d.ts +1 -1
- package/dist/plugins/memory-key-guards.d.ts +3 -3
- package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
- package/dist/plugins/memory-origin-law.d.ts +13 -13
- package/dist/plugins/memory-run-store.d.ts +12 -12
- package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
- package/dist/plugins/permission-rule-store-file.d.ts +3 -3
- package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
- package/dist/plugins/permission-rule-store-sql.js +7 -12
- package/dist/plugins/pg-cost-quota.d.ts +2 -2
- package/dist/plugins/pg-pool.js +5 -0
- package/dist/plugins/pg-query.d.ts +1 -1
- package/dist/plugins/pg-rate-limiter.d.ts +2 -2
- package/dist/plugins/pg-session-storage.d.ts +9 -9
- package/dist/plugins/remote-env-adb.d.ts +1 -1
- package/dist/plugins/remote-env-device.d.ts +2 -2
- package/dist/plugins/remote-env-e2b.d.ts +11 -11
- package/dist/plugins/remote-env-file-error.d.ts +2 -2
- package/dist/plugins/remote-env-host.d.ts +10 -10
- package/dist/plugins/remote-env-k8s.d.ts +7 -7
- package/dist/plugins/remote-env-local-docker.d.ts +1 -1
- package/dist/plugins/remote-env-ssh.d.ts +9 -9
- package/dist/plugins/remote-scratchpad.d.ts +1 -1
- package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
- package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
- package/dist/plugins/retention-store-sql.d.ts +11 -11
- package/dist/plugins/roster-store-sql.d.ts +5 -5
- package/dist/plugins/run-store-sql.d.ts +12 -12
- package/dist/plugins/scheduler-support.d.ts +1 -1
- package/dist/plugins/send-user-file.d.ts +1 -1
- package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
- package/dist/plugins/session-capture-record-store-sql.js +110 -0
- package/dist/plugins/session-placement.d.ts +1 -1
- package/dist/plugins/session-policy-store-sql.d.ts +2 -2
- package/dist/plugins/session-store.d.ts +3 -3
- package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
- package/dist/plugins/sql-driver.d.ts +7 -7
- package/dist/plugins/sql-errors.d.ts +2 -2
- package/dist/plugins/sql-escape.d.ts +1 -1
- package/dist/plugins/sql-row-helpers.d.ts +1 -1
- package/dist/plugins/store-backend.d.ts +32 -19
- package/dist/plugins/store-backend.js +4 -0
- package/dist/plugins/store-contracts.d.ts +9 -9
- package/dist/plugins/task-list-store-sql.d.ts +3 -3
- package/dist/plugins/tidb-cost-quota.d.ts +3 -3
- package/dist/plugins/tidb-pool.js +9 -0
- package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
- package/dist/plugins/tidb-session-storage.d.ts +2 -2
- package/dist/plugins/tidb-session-store.d.ts +11 -11
- package/dist/plugins/tool-result-store-sql.d.ts +8 -8
- package/dist/plugins/usage-window-store-sql.d.ts +3 -3
- package/dist/plugins/web-search.d.ts +7 -7
- package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
- package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
- package/dist/plugins/write-behind-counter.d.ts +6 -6
- package/dist/principal-jwt.d.ts +2 -2
- package/dist/project-memory.d.ts +1 -1
- package/dist/prompts-domain-validate.d.ts +8 -8
- package/dist/question.d.ts +3 -3
- package/dist/resource-suspend.d.ts +4 -4
- package/dist/resource-window.d.ts +3 -3
- package/dist/router/route-orchestration.d.ts +1 -1
- package/dist/rules-consent.d.ts +48 -40
- package/dist/run-local.d.ts +5 -5
- package/dist/run-local.js +28 -4
- package/dist/runs.d.ts +19 -19
- package/dist/runtime-caps-resolver.d.ts +6 -6
- package/dist/runtime-governance.d.ts +7 -7
- package/dist/security.d.ts +13 -13
- package/dist/session-leaf-bus.d.ts +1 -1
- package/dist/session-sync-content.d.ts +4 -4
- package/dist/session-sync-kernel.d.ts +2 -2
- package/dist/session-sync.d.ts +13 -13
- package/dist/session-titler.d.ts +1 -1
- package/dist/session-watch.d.ts +3 -3
- package/dist/shared-memory-scope-authorizer.d.ts +4 -4
- package/dist/sighup-idle.d.ts +1 -1
- package/dist/spec-fields.d.ts +20 -20
- package/dist/ssh-host-key.d.ts +5 -5
- package/dist/store-live-probe.d.ts +2 -2
- package/dist/task-cwd.d.ts +11 -11
- package/dist/task-mcp.d.ts +5 -5
- package/dist/task-settings.d.ts +35 -35
- package/dist/task-workflow.d.ts +3 -3
- package/dist/text-bidi.d.ts +1 -1
- package/dist/tool-approval.d.ts +171 -160
- package/dist/tool-approval.js +33 -28
- package/dist/trace/core-keyset-guard.d.ts +21 -7
- package/dist/trace/engine-notice-wire.d.ts +6 -6
- package/dist/trace/injection-tier.d.ts +2 -2
- package/dist/trace/ledger-events.d.ts +3 -3
- package/dist/trace/ledger-sink.d.ts +7 -7
- package/dist/trace/project.d.ts +35 -30
- package/dist/trace/project.js +9 -0
- package/dist/turn-activity.d.ts +4 -4
- package/dist/usage-analytics.d.ts +1 -1
- package/dist/wall-clock-jump-guard.d.ts +3 -3
- package/package.json +6 -6
|
@@ -35,7 +35,7 @@ export interface K8sEnvConfig {
|
|
|
35
35
|
backoffMs?: number;
|
|
36
36
|
};
|
|
37
37
|
/**
|
|
38
|
-
* Workspace-snapshot store (
|
|
38
|
+
* Workspace-snapshot store ([ref] §5 WorkspaceHandle/SnapshotId). When set, the Kata pod
|
|
39
39
|
* gains a DURABLE workspace across suspend/resume: `suspendVM` tars the workspace and uploads it to S3, then
|
|
40
40
|
* deletes the pod; `resumeVM` provisions a fresh pod and restores the tar. This raises `capabilities.suspendable`
|
|
41
41
|
* to `true` — but only the *workspace* is durable (files restored byte-for-byte); in-VM process/memory state
|
|
@@ -43,7 +43,7 @@ export interface K8sEnvConfig {
|
|
|
43
43
|
* tolerate. Unset → `suspendable:false` (the original checkpoint + cold-rebuild degrade).
|
|
44
44
|
*
|
|
45
45
|
* 🔴 Credentials are ADAPTER-HELD: the sandbox only ever receives a short-lived, single-object PRESIGNED URL
|
|
46
|
-
* (never the access/secret key) — a credential reaching code that runs untrusted work is the
|
|
46
|
+
* (never the access/secret key) — a credential reaching code that runs untrusted work is the [ref] lethal
|
|
47
47
|
* trifecta. The presigned URL is used only inside an adapter-issued exec at suspend/resume time, so it never
|
|
48
48
|
* reaches an agent turn.
|
|
49
49
|
*/
|
|
@@ -60,7 +60,7 @@ export interface K8sEnvConfig {
|
|
|
60
60
|
sessionId?: string;
|
|
61
61
|
/**
|
|
62
62
|
* 🔴 ADDITIVE pod-spec patch (a SERVICE-side adapter seam, NOT a core seam: the K8s pod shape is
|
|
63
|
-
* provider-specific, so it stays in the adapter per
|
|
63
|
+
* provider-specific, so it stays in the adapter per [ref]). A deployment supplies extra volumes / volumeMounts
|
|
64
64
|
* / securityContext so the pod can carry e.g. a REAL read-only oracle mount (the RSI L8 immutable-mount probe) or
|
|
65
65
|
* a hardened grader env (the graderEnvFactory). DEFAULT absent ⇒ the pod is byte-identical. The patch is TRUSTED
|
|
66
66
|
* deployment config (like the rest of K8sEnvConfig) AND is STRUCTURALLY CONFINED: {@link applyPodSpecPatch} can
|
|
@@ -90,7 +90,7 @@ export interface ExecSocket {
|
|
|
90
90
|
terminate?(): void;
|
|
91
91
|
}
|
|
92
92
|
/**
|
|
93
|
-
* Test seam (
|
|
93
|
+
* Test seam ([ref] §9.3 fault-injection): inject the REST `request` and/or the exec-socket factory, so pod
|
|
94
94
|
* lifecycle, retry policy, channel framing and liveness are deterministically testable without a cluster.
|
|
95
95
|
*/
|
|
96
96
|
export interface K8sEnvDeps {
|
|
@@ -183,7 +183,7 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
183
183
|
* provision a pod, then download + untar the snapshot into the workspace. A missing object (empty/plan-only
|
|
184
184
|
* snapshot) resumes as a clean workspace.
|
|
185
185
|
*
|
|
186
|
-
* [
|
|
186
|
+
* [ref]①(priorHandle 根保真)——k8s 走**诚实臂**而非绑定臂:pod 的 workspace volume 挂在**当前**
|
|
187
187
|
* 配置根(cfg.mountPath),往 priorHandle.mountPath 绑=往容器 rootfs untar 大工作区,ephemeral-storage
|
|
188
188
|
* 触顶即 pod 驱逐(恢复中途死,比「根变了 fail-closed reopen」更糟)。所以 untar 落当前根、handle 回报
|
|
189
189
|
* 真生效根(core 契约明许:「做不到就诚实返回实际 mountPath,勿回显未兑现值」);跨 K8S_MOUNT_PATH
|
|
@@ -191,7 +191,7 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
191
191
|
*/
|
|
192
192
|
resumeVM(snapshotId: SnapshotId, options?: VmLifecycleOptions): Promise<ConnectResult>;
|
|
193
193
|
/**
|
|
194
|
-
* Honest post-resume consistency (
|
|
194
|
+
* Honest post-resume consistency ([ref] §5 council #8): the workspace FILES are restored byte-for-byte
|
|
195
195
|
* from the snapshot, so read-before-edit hashing already lines up — there's nothing to re-fetch. In-VM
|
|
196
196
|
* process state (a language server) is gone by design; core/the LSP manager re-establishes it lazily. So
|
|
197
197
|
* this is a successful no-op rather than the previous `unsupported` (which forced a cold rebuild).
|
|
@@ -224,7 +224,7 @@ export declare class RemoteK8sExecutionEnv implements RemoteExecutionEnv, Backgr
|
|
|
224
224
|
};
|
|
225
225
|
}, ExecutionError>>;
|
|
226
226
|
/**
|
|
227
|
-
* LSP surface (lsp/manager.ts `isLspCapable` duck-type,
|
|
227
|
+
* LSP surface (lsp/manager.ts `isLspCapable` duck-type, [ref] §13.1): cluster-internal address for a
|
|
228
228
|
* port on the sandbox pod. The E2B counterpart returns a public proxy host; a pod has none — the WORKER
|
|
229
229
|
* must be able to reach pod IPs (in-cluster deployment, or on-node), and the transport is plain `ws://`
|
|
230
230
|
* (cluster network, no TLS — the per-session bridge token still gates access like on E2B).
|
|
@@ -182,7 +182,7 @@ export declare class RemoteLocalDockerExecutionEnv implements RemoteExecutionEnv
|
|
|
182
182
|
/** Spawn the docker binary with argv; collect stdout/stderr (+ raw bytes when binary), bound by timeout/abort. */
|
|
183
183
|
private docker;
|
|
184
184
|
/** Lazy connect for an exec path → ExecutionError on failure (fail closed, never throws). */
|
|
185
|
-
/** S1([
|
|
185
|
+
/** S1([ref]):容器内**用户命令**的 shell。缺省 /bin/sh;首次连接后探测一次 `command -v bash`,
|
|
186
186
|
* 有则切 bash(TB 实测 dash 三病:$'\t' 静默错字节/[[ ]] 127/进程替换)。镜像无 bash(alpine 裸底)
|
|
187
187
|
* ⇒ 保 sh(修前字节形,诚实降级);探测自身失败同。容器**创建**引导命令(mkdir && tail)不走
|
|
188
188
|
* 本 shell——无 bash 语法且探测尚不可能。 */
|
|
@@ -5,7 +5,7 @@ export interface SshEnvConfig {
|
|
|
5
5
|
host: string;
|
|
6
6
|
port?: number;
|
|
7
7
|
username: string;
|
|
8
|
-
/** PEM private key — from the adapter-held secret env (NEVER the workspace).
|
|
8
|
+
/** PEM private key — from the adapter-held secret env (NEVER the workspace). [ref] §5 #2. */
|
|
9
9
|
privateKey: string;
|
|
10
10
|
passphrase?: string;
|
|
11
11
|
/** Workspace root; relative paths resolve against it. Default "." (the login dir). */
|
|
@@ -15,7 +15,7 @@ export interface SshEnvConfig {
|
|
|
15
15
|
/**
|
|
16
16
|
* Per-command wall-clock bound (ms) when the caller gives none — NOT the connection lifetime.
|
|
17
17
|
*
|
|
18
|
-
* ⚠️ **值与孪生腿不一致,原因未成文**(2026-08-08
|
|
18
|
+
* ⚠️ **值与孪生腿不一致,原因未成文**(2026-08-08,[ref] 二轮扫描 finding,**候裁**):本腿默认
|
|
19
19
|
* `5 * 60_000`(见构造处),而同判据的另外两条腿 —— `remote-env-host.ts` / `remote-env-local-docker.ts`
|
|
20
20
|
* 的 `DEFAULT_COMMAND_TIMEOUT_MS` —— 都是 `30 * 60_000`,JSDoc 措辞还逐字同源。三处无共享常量、无对表
|
|
21
21
|
* 钉,ssh 这一处也没有任何注释说明 5min 是刻意收紧(git 史是 history-free snapshot,「30min 是后来调
|
|
@@ -28,12 +28,12 @@ export interface SshEnvConfig {
|
|
|
28
28
|
commandTimeoutMs?: number;
|
|
29
29
|
/** File-transfer (sftp) bound (ms). */
|
|
30
30
|
dataTimeoutMs?: number;
|
|
31
|
-
/** connect retry (idempotent establishment only — withRetry,
|
|
31
|
+
/** connect retry (idempotent establishment only — withRetry, [ref] §2A). */
|
|
32
32
|
retry?: {
|
|
33
33
|
maxAttempts?: number;
|
|
34
34
|
backoffMs?: number;
|
|
35
35
|
};
|
|
36
|
-
/**
|
|
36
|
+
/** [ref] / [ref]:主机密钥校验策略(两旋钮,语义见 {@link SshHostKeyPolicy});缺席 = 两旋钮都没配。 */
|
|
37
37
|
hostKey?: SshHostKeyPolicy;
|
|
38
38
|
}
|
|
39
39
|
type ConnectResult = {
|
|
@@ -44,7 +44,7 @@ type ConnectResult = {
|
|
|
44
44
|
error: RemoteExecutionError;
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
|
-
* Test seam (
|
|
47
|
+
* Test seam ([ref] §9.3 fault-injection): inject a `connectOnce` that replays an error sequence, so the
|
|
48
48
|
* retry policy (retryable codes / maxAttempts / "first fail → second success") is deterministically testable
|
|
49
49
|
* without a live host.
|
|
50
50
|
*/
|
|
@@ -61,12 +61,12 @@ export declare class RemoteSshExecutionEnv implements RemoteExecutionEnv {
|
|
|
61
61
|
private conn?;
|
|
62
62
|
private sftpPromise?;
|
|
63
63
|
private destroyed;
|
|
64
|
-
/** [
|
|
64
|
+
/** [ref] 代际闸:destroy/reconnect 各自 +1。逻辑连接操作(startConnect)起飞时抓拍一次并贯穿全部
|
|
65
65
|
* 重试轮(四轮复审:抓拍若在 connectOnce 内,被顶替代的下一轮重试会抓到**新**代际混进新代)——
|
|
66
66
|
* 每轮起跳先查代际/destroyed(陈旧=不再开 socket),ready 到达再查一次(在飞握手 late-ready=end
|
|
67
67
|
* 不赋 conn)。关死「A 在飞→reconnect 起 B→A 竞后抢占/成孤儿活连接」的全部竞窗。 */
|
|
68
68
|
private connEpoch;
|
|
69
|
-
/** [
|
|
69
|
+
/** [ref] 四轮复审 single-flight:connect()/reconnect()/懒连接三路共用一条代际键在飞记录——任何一路
|
|
70
70
|
* 在飞时其余路 join 同一 promise(同代际),绝不并起两条连接;settle 时按记录身份清(旧败诺清不掉
|
|
71
71
|
* 新记录)。五轮复审:①记录带 kind——并发 reconnect join 已在飞的 replace 记录(不再各自 bump 代际
|
|
72
72
|
* =重连风暴);②共享尝试**不携带任何 caller 信号**(首创者的 pre-abort 不得毒化 joiner;单 caller
|
|
@@ -86,11 +86,11 @@ export declare class RemoteSshExecutionEnv implements RemoteExecutionEnv {
|
|
|
86
86
|
}>;
|
|
87
87
|
/** 五轮复审:per-caller 可中止等待(共享诺不动,只退本 caller)。 */
|
|
88
88
|
private raceConnAbort;
|
|
89
|
-
/** [
|
|
89
|
+
/** [ref] 四轮复审:三路(connect/reconnect/懒连接)唯一的连接发起点——同代际在飞记录 join,settle
|
|
90
90
|
* 身份清;代际抓拍一次贯穿全部重试轮,每轮起跳先查(陈旧/destroyed=不再开 socket,用不可重试的
|
|
91
91
|
* aborted 码即刻收敛 withRetry)。五轮复审:共享尝试零 caller 信号(取消面全在 per-caller race)。 */
|
|
92
92
|
private startConnect;
|
|
93
|
-
/** [
|
|
93
|
+
/** [ref] exec/execStream/sftp 共用的懒连接入口。已连=零开销直过;未连=走完整 connect()(含重试策略)。
|
|
94
94
|
* caller 的 signal 只中止**它自己的等待**(共享在飞尝试继续伺服其他等待者;彻底取消归 destroy 的代际
|
|
95
95
|
* 闸管,handshake 余命 ≤ readyTimeout 有界)。 */
|
|
96
96
|
private ensureConnected;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* [
|
|
2
|
+
* [ref] remote scratchpad(server 半场)— the REMOTE sandbox lanes' session scratchpad convention.
|
|
3
3
|
*
|
|
4
4
|
* host lane already has one (env-facts.ts ensureScratchpadDir, worker-local under localDataRoot). The remote
|
|
5
5
|
* lanes (e2b/k8s/local-docker/ssh) run their hands OFF this box, so a worker-local dir would be a lie — the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Durable resume-at anchor map (E18) — SINGLE-FILE DUAL-DIALECT (
|
|
2
|
+
* Durable resume-at anchor map (E18) — SINGLE-FILE DUAL-DIALECT ([ref] A12 收编). The service-owned
|
|
3
3
|
* eventId→entryId translation: the shell holds the live E2 `eventId` (core never persists it); core's
|
|
4
4
|
* `TaskSpec.resumeAt` takes a persisted `SessionTreeEntry.id`. Keyed (session_id, event_id) so `resolve`
|
|
5
5
|
* is a PK point-lookup. `owner` is the single-DB-fleet null-safe defense-in-depth guard, the data-layer
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 托管留存执行面的**非破坏性 SQL 半场** —— SINGLE-FILE DUAL-DIALECT(
|
|
3
|
-
* `retention-store-sql.ts` 本身)
|
|
2
|
+
* 托管留存执行面的**非破坏性 SQL 半场** —— SINGLE-FILE DUAL-DIALECT([ref] A12;先例 =
|
|
3
|
+
* `retention-store-sql.ts` 本身)。[ref] 车2,设计稿 `docs/DESIGN-270-retention-lane.md` v1.3。
|
|
4
4
|
*
|
|
5
5
|
* ── 为什么与车1 的 `retention-store-sql.ts` 分家(而不是往那只店上再挂三组方法)────────────────────
|
|
6
6
|
* 车1 那只店是 core `ManagedRetentionCapability` 的**实现体**:它的每一个公开方法都是一次**破坏性**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 托管留存(managed retention)执行面的 **store 半场** —— SINGLE-FILE DUAL-DIALECT(
|
|
3
|
-
* 先例 = `leader-run-store-sql.ts` / `checkpoint-store-sql.ts`)
|
|
2
|
+
* 托管留存(managed retention)执行面的 **store 半场** —— SINGLE-FILE DUAL-DIALECT([ref] A12 定型半场;
|
|
3
|
+
* 先例 = `leader-run-store-sql.ts` / `checkpoint-store-sql.ts`)。[ref] 车1,设计稿
|
|
4
4
|
* `docs/DESIGN-270-retention-lane.md` v1.2。上游契约真源 = `@sema-agent/core` 的
|
|
5
5
|
* `core/retention.d.ts`(`ManagedRetentionCapability` / `RetentionReceipt` / `RetentionDeclaration`)。
|
|
6
6
|
*
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
* - schema 属主:MySQL DDL 由本文件导出、展开进 `tidb-pool.ts` 的 `SCHEMA_STATEMENTS`;PG DDL 由本文件的
|
|
40
40
|
* `ensurePgRetentionSchema` 导出、由 `pg-pool.ts` 的中央 `ensurePgSchema` 组合(与 leader-run 同姿势)。
|
|
41
41
|
*
|
|
42
|
-
* ── 命名(
|
|
42
|
+
* ── 命名([ref] 纪律,与设计稿的复数写法的**有意**偏离)────────────────────────────────────────────
|
|
43
43
|
* 设计稿 §5/§2 写的是 `retention_holds` / `retention_tombstones`;本仓的表名闭集词表是**单数**制且由
|
|
44
44
|
* `test/schema-naming-invariants.test.ts` 机器执法(「一张表是一类行的集合,表名说的是『一行是什么』」)。
|
|
45
45
|
* ⇒ 落库名一律单数:`retention_audit` / `retention_hold` / `retention_lease` / `retention_tombstone`。
|
|
@@ -136,7 +136,7 @@ export interface SqlRetentionStoreOptions {
|
|
|
136
136
|
*/
|
|
137
137
|
taskAttachmentTable: boolean;
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* [ref] `task_list_meta` / `task_list_item` 两表是否在场。**必填,没有默认值**(与
|
|
140
140
|
* `taskAttachmentTable` 同一条理由:盲发 DELETE 会在没建表的库上把整轮 sweep 打红)。
|
|
141
141
|
* 生产上 `boot/task-list-lane.ts` 在**任何 SQL 后端**都无条件 ensure 这两张表 ⇒ 装配层照实传 true;
|
|
142
142
|
* 纯内存/local 车道压根没有 SQL 留存腿。
|
|
@@ -282,17 +282,17 @@ export declare class SqlRetentionStore implements ManagedRetentionCapability {
|
|
|
282
282
|
* COMMIT,一个并发的 PUT hold 在此期间提交不了(它抢同一把锁)——一段恒真的"复核"比没有更坏。
|
|
283
283
|
*
|
|
284
284
|
* 视界判据**两条臂都写出来**:`deadline` 在场按 deadline,缺席按 `created_at_ms`。少了后一条臂,一条
|
|
285
|
-
* 没有审批 TTL 的 pending 行就永远过不了期(
|
|
285
|
+
* 没有审批 TTL 的 pending 行就永远过不了期([ref] §3 inv#3 的 terminal_at_ms 要挡的正是这种永久泄漏)。
|
|
286
286
|
*
|
|
287
|
-
* 🔴 **pin 释放 = 本方法的 `pending → expired` 翻转本身**(core [
|
|
288
|
-
* 「AND release the associated session pins」是真意,[
|
|
287
|
+
* 🔴 **pin 释放 = 本方法的 `pending → expired` 翻转本身**(core [ref] 定谳:retention.ts 契约那句
|
|
288
|
+
* 「AND release the associated session pins」是真意,[ref] 引错了对象——它引的是引擎 live-path reap
|
|
289
289
|
* 的 JSDoc)。本仓 SQL 后端**没有独立的 pin 存储**:钉住 session 的正是 `checkpoint.status='pending'`
|
|
290
290
|
* 这一状态(它是 deleteExpiredSessions 活引用四腿之一,见下方 lineage 注 :79x),所以状态翻转 = 引用
|
|
291
|
-
* 解除 = pin 释放——不需要第二个写操作,而幂等(重跑对已 expired 行零命中)恰好满足 [
|
|
292
|
-
* 「释放已释放 pin=no-op」要求。单写者不变式按 [
|
|
291
|
+
* 解除 = pin 释放——不需要第二个写操作,而幂等(重跑对已 expired 行零命中)恰好满足 [ref] 的
|
|
292
|
+
* 「释放已释放 pin=no-op」要求。单写者不变式按 [ref] 改述:**每行的 pin 恰好释放一次,由终局该行
|
|
293
293
|
* 的车道执行**——live 行归 reaper,retention 行归本方法,两行集不交(下一段的 live-pin skip 正是
|
|
294
294
|
* 「不交」的执行判据)。
|
|
295
|
-
* 边界形([
|
|
295
|
+
* 边界形([ref] 建议,[ref] 确认仍成立):**live-pinned 且已过视界**的行(`task_active` 还占着这条
|
|
296
296
|
* 会话)⇒ skip 计数、不动那行 —— 不在一条活会话脚下抽掉它的 resume 坐标,与 legal-hold 的 skip 同形。
|
|
297
297
|
*
|
|
298
298
|
* receipt 口径:`deleted` = **本次 CAS 赢下的行数**(过期销毁的是那道 pending 门,行本身按设计留在库里
|
|
@@ -304,7 +304,7 @@ export declare class SqlRetentionStore implements ManagedRetentionCapability {
|
|
|
304
304
|
* 抽成一处是因为它同时被「可过期候选」与「被 pin 的计数」两条查询用,手抄两份必分家。
|
|
305
305
|
*/
|
|
306
306
|
private horizonArms;
|
|
307
|
-
/** 「这条 checkpoint 的会话被一次活跑占着」= [
|
|
307
|
+
/** 「这条 checkpoint 的会话被一次活跑占着」= [ref] 的 live-pinned 判据(SQL 谓词形,两方言同文本)。 */
|
|
308
308
|
private static readonly PINNED_EXISTS;
|
|
309
309
|
/**
|
|
310
310
|
* **可过期**的候选 token(保护谓词写在 SQL 里、扣在 `LIMIT` **之前**)。
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* RosterStore SQL twins(agent-team S1 server 半场,[
|
|
2
|
+
* RosterStore SQL twins(agent-team S1 server 半场,[ref]① 提货单)——core `RunnerDeps.rosterStore`
|
|
3
3
|
* 的 TiDB/PG 双方言实现:具名子 agent 的持久名册(具名 spawn advisory 写入;SendMessage 活注册表
|
|
4
4
|
* miss 后咨询;v1=诚实指针 roster_only,非跨 run resume)。
|
|
5
5
|
*
|
|
6
|
-
* 语义三条([
|
|
6
|
+
* 语义三条([ref]① 必守,与 core roster-store.js 参考实现字节对齐):
|
|
7
7
|
* 1. resolve **查询内** filter-before-reduce:access 轴在 SQL WHERE 完成(scope 先拒 → owner 匹配 →
|
|
8
8
|
* sessionScoped 显式位才认 session 匹配),绝不先取全集再内存过滤(跨租户行连查询结果都不进);
|
|
9
9
|
* 2. 同 `(normalizedName, owner, scope)` 域 upsert(core upsertKey 同键);
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* spawn 可共享毫秒、多副本时钟可偏斜,无第三键的 LIMIT 1 非确定)。诚实记账:同毫秒并写时选择=
|
|
16
16
|
* agent_id 字典序最大,与 core 单进程的「后遍历者赢」可能不同——多副本本就无全序,确定性优先。
|
|
17
17
|
*
|
|
18
|
-
* normalize 私拷已回收(2026-07-19):core 公共出口落地(黑板 [
|
|
18
|
+
* normalize 私拷已回收(2026-07-19):core 公共出口落地(黑板 [ref]① 所请的 additive 导出),按
|
|
19
19
|
* 头注预案换回单行 import。⚠️ 语义仍是**存储键**:DB 行按 normalize 后的键写入——core 若改语义,
|
|
20
20
|
* 存量行查不回;test/roster-store-db-integration.test.ts 的 golden corpus 钉守这条(非私拷漂移钉,
|
|
21
21
|
* 是「core 变语义必须先过迁移裁量」的告警钉)。
|
|
@@ -35,7 +35,7 @@ export declare class TiDBRosterStore implements RosterStore {
|
|
|
35
35
|
resolve(name: string, access: RosterAccess): Promise<RosterEntry | undefined>;
|
|
36
36
|
list(): Promise<RosterEntry[]>;
|
|
37
37
|
releaseAgent(agentId: string): Promise<void>;
|
|
38
|
-
/** [
|
|
38
|
+
/** [ref] MED2(server 扩展,非 core 接口;core [ref]②③ 派给部署的清理半场):TTL 清理——
|
|
39
39
|
* task-scoped 具名 spawn 的 owner=宿主 taskId=每 run 一新行,无清理=线性无界。按 recorded_at_ms
|
|
40
40
|
* (最后一次 upsert 触碰)删,latest 语义不受影响(活跃名恒被新 spawn 刷新)。 */
|
|
41
41
|
reapOlderThan(cutoffMs: number): Promise<number>;
|
|
@@ -48,7 +48,7 @@ export declare class PgRosterStore implements RosterStore {
|
|
|
48
48
|
resolve(name: string, access: RosterAccess): Promise<RosterEntry | undefined>;
|
|
49
49
|
list(): Promise<RosterEntry[]>;
|
|
50
50
|
releaseAgent(agentId: string): Promise<void>;
|
|
51
|
-
/** [
|
|
51
|
+
/** [ref] MED2(TiDB twin 同案注)。 */
|
|
52
52
|
reapOlderThan(cutoffMs: number): Promise<number>;
|
|
53
53
|
}
|
|
54
54
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Async run registry (S1) + replayable event log (S2) — SINGLE-FILE DUAL-DIALECT (
|
|
2
|
+
* Async run registry (S1) + replayable event log (S2) — SINGLE-FILE DUAL-DIALECT ([ref] A12 定型半场).
|
|
3
3
|
* ONE implementation, TWO dialects; the historical `TiDBRunStore` / `PgRunStore` class names survive as thin
|
|
4
4
|
* ctor subclasses so every consumer (store-backend.ts, the run/reaper/session/usage suites) is untouched.
|
|
5
5
|
*
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
* - `?` placeholders vs `$n` (transaction control itself is normalized by `SqlDriver`/`SqlTxConn` —
|
|
16
16
|
* mysql2's native begin/commit/rollback vs PG's statement form; see sql-driver.ts)
|
|
17
17
|
* - dup-key classification (createRun's task_active claim race) — the PREDICATE has a single owner
|
|
18
|
-
* (`sql-errors.ts`,
|
|
18
|
+
* (`sql-errors.ts`, [ref] P1-①); only the dialect DISPATCH is visible here
|
|
19
19
|
*
|
|
20
20
|
* ⚠️ The run ACTIVE-status word list written out in the `status IN (…)` / `NOT IN (…)` fragments below
|
|
21
21
|
* is the closed set owned by `store-contracts.ts` (`isTerminalRunStatus` / `isParkedRunStatus`). The SQL
|
|
22
22
|
* text stays literal ON PURPOSE (A12: both dialects readable side by side), so the tie is a PARITY GATE:
|
|
23
|
-
* `test/source-hygiene-gate.test.ts` → "
|
|
23
|
+
* `test/source-hygiene-gate.test.ts` → "[ref] P1-② run 活状态 SQL 字面 ↔ store-contracts 闭集属主 parity".
|
|
24
24
|
* core adding a TaskStatus member turns that gate red on every fragment here — update them in the same batch.
|
|
25
25
|
* - null-safe owner compare: `<=>` (TiDB) vs `IS NOT DISTINCT FROM` (PG) — a null-owner run still matches
|
|
26
26
|
* `owner=null` on both, single-DB-fleet defense-in-depth (see {@link requestCancel})
|
|
@@ -51,7 +51,7 @@ export declare class SqlRunStore {
|
|
|
51
51
|
constructor(db: SqlDriver);
|
|
52
52
|
/** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
|
|
53
53
|
private q;
|
|
54
|
-
/** Dup-key classification — single owner in `sql-errors.ts` (
|
|
54
|
+
/** Dup-key classification — single owner in `sql-errors.ts` ([ref] P1-①; the old local form read
|
|
55
55
|
* only mysql2's string `code`, so an error carrying just `errno` fell through the claim-race arm). */
|
|
56
56
|
private isDupKey;
|
|
57
57
|
/** JSON column binding: TiDB stores the string verbatim; PG goes through the protocol-safe envelope
|
|
@@ -88,7 +88,7 @@ export declare class SqlRunStore {
|
|
|
88
88
|
/** Whether a cancel has been requested for this run (polled by the owning instance's heartbeat tick).
|
|
89
89
|
* `owner` is the single-DB-fleet null-safe owner guard (see {@link requestCancel}). */
|
|
90
90
|
isCancelRequested(taskId: string, owner: string | null): Promise<boolean>;
|
|
91
|
-
/**
|
|
91
|
+
/** [ref] seam #2: request PREEMPT (graceful durable yield, ≠ cancel's kill) of a RUNNING run — durable +
|
|
92
92
|
* cross-replica. Sets the flag the owning instance's heartbeat tick polls (it then aborts its preemptSignal →
|
|
93
93
|
* the task suspends at the next clean turn boundary, gate resource_limit/reason preempt); a same-replica caller
|
|
94
94
|
* additionally aborts the in-flight preempt controller for instant effect. Only flags a `running` row
|
|
@@ -112,7 +112,7 @@ export declare class SqlRunStore {
|
|
|
112
112
|
* colliding on the (task_id, seq) PK. */
|
|
113
113
|
maxSeq(taskId: string): Promise<number>;
|
|
114
114
|
/** Mark terminal AND release the single-active-run claim atomically — if the DELETE were a separate
|
|
115
|
-
* statement that failed, the session would stay permanently locked. [
|
|
115
|
+
* statement that failed, the session would stay permanently locked. [ref] FIRST terminal writer wins:
|
|
116
116
|
* the UPDATE is CAS'd POSITIVELY on the live statuses (running/suspended/needs_review) — every call site
|
|
117
117
|
* is a settle-once flow whose backstops may double-fire (cancel × leg-throw × reaper), and an
|
|
118
118
|
* unconditional write let the LAST racer overwrite errorCode (a `cancelled` row flipping to a generic
|
|
@@ -121,18 +121,18 @@ export declare class SqlRunStore {
|
|
|
121
121
|
* unconditional (idempotent; the first writer already released it). */
|
|
122
122
|
setTerminal(taskId: string, status: TaskStatus, result: TaskResult | null, error: string | null): Promise<void>;
|
|
123
123
|
/**
|
|
124
|
-
* Durable F4 (
|
|
124
|
+
* Durable F4 ([ref]): a task suspended on a policy `ask`. Sets the run NON-terminal `suspended` and
|
|
125
125
|
* KEEPS the `task_active` claim — the session stays locked (no new run) until an operator resumes it to a
|
|
126
126
|
* terminal state or the reaper expires it. The token-bearing result is NOT stored (the submitter polling
|
|
127
127
|
* this row must never receive the capability token); only the status flips.
|
|
128
128
|
*/
|
|
129
129
|
setSuspended(taskId: string): Promise<void>;
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* [ref] D-B: PARK a run that paused on a REVIEW gate — a `needs_review` result (a dry-run diff review OR a
|
|
132
132
|
* pre-action `plan_review`; core assemble-result slot 8.6). Like {@link setSuspended} this is a NON-terminal park
|
|
133
133
|
* that KEEPS the `task_active` session claim (it does NOT delete it — only {@link setTerminal} does), so the
|
|
134
134
|
* resume path (`getActiveTaskId` → `markResuming`) can find + claim the row. core treats a review pause "like a
|
|
135
|
-
* suspend, an INTENTIONAL durable pause" (
|
|
135
|
+
* suspend, an INTENTIONAL durable pause" ([ref] §2.5) — the service MUST park it the same way, else the run is
|
|
136
136
|
* terminalized + its lock released and the plan_review/dry_run_review resume can never run (it gets
|
|
137
137
|
* taskId=undefined and drives the model unprotected on an unlocked session). CAS on `running`/`needs_review`
|
|
138
138
|
* (reaper-revert guard, mirrors setSuspended). The park→resume→claim invariant is pinned on BOTH REAL engines by
|
|
@@ -153,7 +153,7 @@ export declare class SqlRunStore {
|
|
|
153
153
|
* crosses the TTL is marked `failed` mid-run and its session lock (`task_active`) is released. Returns true
|
|
154
154
|
* if it claimed the flip (false ⇒ the reaper already expired it, or it isn't suspended).
|
|
155
155
|
*
|
|
156
|
-
*
|
|
156
|
+
* [ref](codex R1 [medium],红先双库证):认领 = **接管 `instance_id`**。此前该列只在 createRun 铸、此处不动,
|
|
157
157
|
* 于是 A 创建、C 认领 resume 的行永远记 A —— 而 steer/interrupt 的「他副本」臂与 sendHandleMiss 都拿这列当
|
|
158
158
|
* 「当前持有者」证据:verify 形 resume 腿(不登记 steerable)在 C 上跑时,C 读到 A≠C 就谎报「run 在别的副本」。
|
|
159
159
|
* 语义自此成文:`instance_id` = **当前持有副本**(createRun 铸、markResuming 认领接管);CAS 输不改列
|
|
@@ -286,7 +286,7 @@ export declare class SqlRunStore {
|
|
|
286
286
|
* the run + RELEASE its task_active (unlock the session). Mirrors the checkpoint reaper's CAS-expire (≈ deny);
|
|
287
287
|
* idempotent across replicas. Returns count.
|
|
288
288
|
*
|
|
289
|
-
* 🔴
|
|
289
|
+
* 🔴 [ref] D-D (blocker fix): SKIPS any row whose checkpoint is STILL pending — that row is
|
|
290
290
|
* owned by a checkpoint-state-driven sweep (the SLA deny-sweep for human/irreversible_ask, or
|
|
291
291
|
* failSuspendedWithExpiredCheckpoint once the checkpoint is expired). Without this guard, this time-based
|
|
292
292
|
* UPDATE fired at the SAME instant as the deny-sweep (deadline == createdAt + ttl, both keyed on the TTL),
|
|
@@ -302,7 +302,7 @@ export declare class SqlRunStore {
|
|
|
302
302
|
*/
|
|
303
303
|
reapSuspended(olderThanMs: number): Promise<number>;
|
|
304
304
|
/**
|
|
305
|
-
*
|
|
305
|
+
* [ref] §3 inv#3 (crash-safe backstop — the run-row half of the checkpoint `terminal_at_ms` sweep): fail a
|
|
306
306
|
* suspended run whose durable checkpoint was ALREADY EXPIRED by `reapExpired` (past its `deadline` or its
|
|
307
307
|
* absolute `terminal_at_ms`), and release its task_active (unlock the session). Runs UNCONDITIONALLY (no
|
|
308
308
|
* approval-TTL gate), CHECKPOINT-STATE-driven not time-driven, so it aligns EXACTLY with the per-row
|
|
@@ -10,7 +10,7 @@ type Result<T, E> = {
|
|
|
10
10
|
ok: false;
|
|
11
11
|
error: E;
|
|
12
12
|
};
|
|
13
|
-
/** Default caps (fail-closed bounds;
|
|
13
|
+
/** Default caps (fail-closed bounds; [ref] §3.9). Override per deployment. */
|
|
14
14
|
export declare const DEFAULT_SCHEDULER_CAPS: {
|
|
15
15
|
readonly supported: true;
|
|
16
16
|
readonly maxScheduledPerScope: 32;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** SigV4 physical ceiling (AWS: X-Amz-Expires max 604800s = 7 days). */
|
|
2
2
|
export declare const PRESIGN_MAX_TTL_SEC = 604800;
|
|
3
3
|
/**
|
|
4
|
-
* Multi-tenant governance (clay ruling 2026-07-14, blackboard [
|
|
4
|
+
* Multi-tenant governance (clay ruling 2026-07-14, blackboard [ref]② variant a with a HASHED segment): every
|
|
5
5
|
* object key carries a per-tenant SCOPE SEGMENT so tenants can be listed/revoked by prefix on the store itself,
|
|
6
6
|
* WITHOUT leaking the principal into the (user-visible, forwardable) URL. The segment is
|
|
7
7
|
* `HMAC-SHA256(secretKey, "sendfile-scope:" + scope)` hex, truncated to 32 chars:
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* [ref] seam②([ref] §2.1b,core 7.0.2 [ref] 件2;黑板 [ref]/[ref]/[ref] 键形对齐)——
|
|
3
|
+
* **会话 capture opt-out 记录的 SQL 载体** `session_capture_optout`:core `SessionCaptureRecordStore`
|
|
4
|
+
* 的 Promise 形实现。SINGLE-FILE DUAL-DIALECT([ref] A12 形,照 memory-optout-grant-store-sql.ts:
|
|
5
|
+
* 一个 `SqlSessionCaptureRecordStore` 接 `SqlDriver`,两个薄 ctor 子类落方言绑定)。
|
|
6
|
+
*
|
|
7
|
+
* ── 为什么要这只店(core layout.d.ts §2.1b 原文方向)────────────────────────────────────────────
|
|
8
|
+
* core 缺省载体 = 控制面文件三腿(`fileSessionCaptureRecordStore`)。无状态多副本部署上文件形对 resume
|
|
9
|
+
* 副本不可见 ——「record not found」恰好朝**继续采集**的方向坏(server F1 点名的形)。SQL 载体让一条
|
|
10
|
+
* 一次性隐私记录跨副本存活;供给它同时是 §2.1b 的能力信号:远端车道的 `capture:"off"` 声明从
|
|
11
|
+
* 409 `config.memory_capture_unsupported` 稳态转为真持久([ref] 前的稳态自此解除)。
|
|
12
|
+
*
|
|
13
|
+
* ── 三腿逐腿失败法(core 契约,dist layout.d.ts + 文件三腿实现逐字亲读;引擎消费点 engine.js 亲读)──
|
|
14
|
+
* · `mark` **create-only / first-record-wins,恒不 reject**:dup-key ⇒ `"existed"`(幂等重宣告,
|
|
15
|
+
* 第一条记录赢 —— 恒不 UPDATE);其余任何失败(断连/超时/超宽键)⇒ `"unpersisted"`
|
|
16
|
+
* (383 §2.8:只存在于进程内的 opt-out 会被第一次 resume 打破,「没落住」是具名拒绝,调用方必须
|
|
17
|
+
* 拒跑 —— 永不静默降级)。引擎侧对 rejection 也折 `"unpersisted"`(engine.js mark 的 `.then(settle,
|
|
18
|
+
* () => "unpersisted")`),本店仍自行 catch:契约写在店上,不赖调用方兜底。
|
|
19
|
+
* · `read` **fail-closed**:行在而解不出 ⇒ 返回**合成记录**(句式与 core 文件腿逐字同形 ——
|
|
20
|
+
* 损坏不许把一条隐私请求洗回采集);无行 ⇒ `undefined`(缺席才是「采集开」);存在性本身不可立
|
|
21
|
+
* (SQL 故障)⇒ **reject**(引擎 catch 折 INDETERMINATE fault 轴:故障永不谎报成「用户请求过」,
|
|
22
|
+
* 也永不谎报成「没有记录」)。
|
|
23
|
+
* · `list` 枚举失败 ⇒ **reject**(读不出的名册不是空名册 —— consolidation 资格臂据此 fail-closed 拒整理,
|
|
24
|
+
* engine.consolidationEligibility 亲读);单行解不出 ⇒ 合成记录(绝不静默漏行:漏一行 = 蒸馏器放大
|
|
25
|
+
* 一条作者要求扣留的内容)。
|
|
26
|
+
*
|
|
27
|
+
* ── 键形法:**编码规范形**(codex R2-[high] 验真后改形;grant 店的「形状拒」在这里是错的)────────
|
|
28
|
+
* 提交面把 sessionId 定为**任意不透明串**(server.ts submit 门:「LENGTH-ONLY — NOT a uuidv7 shape
|
|
29
|
+
* check」,≤64 字符,run-local `--session` / 匿名分享 id 等都合法)——带空白/控制字符的 id 是**在契约内**
|
|
30
|
+
* 的真会话,店若按字节形状拒它,后果=该会话在 SQL 部署上「opt-out 永远落不住(unpersisted)+ 采集态
|
|
31
|
+
* 永远 indeterminate(commits 全抑制)」,是部署契约不兼容,不是输入加固。所以键列**不存生字节**,存
|
|
32
|
+
* `encodeURIComponent(sessionId)` 规范形 —— 与 **core 文件三腿给文件名做的编码逐字同源**(layout.js
|
|
33
|
+
* `captureOptOutPath` 亲读),两载体一个键法:
|
|
34
|
+
* · 编码字母表(`A-Za-z0-9-_.!~*'()%`)天然**无空白无控制字符** ⇒ TiDB utf8mb4_bin 的 PAD SPACE
|
|
35
|
+
* 尾空格折行隐患在字母表层面消灭,任意合法 id 字节精确、互不串行;
|
|
36
|
+
* · 64 字符 id 编码上界 192 ⇒ 列宽 255 恒容;编码后超 255 的 id(>64 字符,提交面本就拒)在 `mark`
|
|
37
|
+
* 上答 `"unpersisted"`、在 `read` 上答 `undefined` —— 后者是**可证明的缺席**(本店写腿从不落这种键,
|
|
38
|
+
* 列宽也物理放不下),不是 indeterminate;
|
|
39
|
+
* · `list` 逐行做**规范形往返校验**(decode 失败 / re-encode ≠ 原字节 ⇒ 整名册 **reject**):带外/损坏
|
|
40
|
+
* 写入的非规范键(如生尾空格 "s1 ")若被静默放行,roster 键与 lineage 贡献者键精确比对不上 ⇒
|
|
41
|
+
* consolidation 资格臂**漏排除** opt-out 会话 = 蒸馏放大被扣留内容(codex R2-[medium] 验真);
|
|
42
|
+
* reject 让资格臂 fail-closed 拒整理(`memory.consolidation_governance_unreadable`),方向正确。
|
|
43
|
+
*
|
|
44
|
+
* ── 列 ──────────────────────────────────────────────────────────────────────────────────────────
|
|
45
|
+
* session_id VARCHAR(255) PK 会话 id 的 encodeURIComponent 规范形(见上;宽=64 字符 id 的编码上界)
|
|
46
|
+
* at_ms BIGINT NOT NULL 记录时刻(core `SessionCaptureOptOutRecord.at`,恒引擎钟)
|
|
47
|
+
* reason TEXT NOT NULL 自由文本(verb 的 reason ≤500 由 wire 验;声明腿/SDK 直连宿主不设上限
|
|
48
|
+
* —— TEXT 而不是 VARCHAR(500):列溢出会把一条隐私请求变成 "unpersisted",
|
|
49
|
+
* 为省字节引入那个失败向不值)
|
|
50
|
+
* 刻意**无** updated_* 审计列:记录是一次性单向的(first-record-wins,恒不改写),`at_ms` 就是全部时间事实。
|
|
51
|
+
*
|
|
52
|
+
* ── 方言差异(显式写在调用点,A12 doctrine)──────────────────────────────────────────────────────
|
|
53
|
+
* · `?` vs `$n` 占位符;
|
|
54
|
+
* · create-only:两方言都走**裸 INSERT + dup-key 判**(`sql-errors.ts` 的 `isDupKeyError` 单一登记谓词)
|
|
55
|
+
* 而不是 `INSERT IGNORE` / `ON CONFLICT DO NOTHING` —— IGNORE 在 MySQL 协议下连带吞掉溢出/截断类
|
|
56
|
+
* 错误(把「没落住」洗成「落了」),DO NOTHING 则要靠 affected==0 反推 dup(与「没插但也没错」不可
|
|
57
|
+
* 判别)。裸 INSERT 让三种结局(插入成功/键已在/真失败)各有各的信号,恰是 mark 三态要的判别度。
|
|
58
|
+
* · BIGINT 读回:TiDB number,PG string —— `readAtMs` 两形都认,其余按行级损坏折合成记录(见 read 法)。
|
|
59
|
+
*/
|
|
60
|
+
import type { Pool as MySqlPool } from "mysql2/promise";
|
|
61
|
+
import type { Pool as PgPool } from "pg";
|
|
62
|
+
import type { SessionCaptureOptOutMarkOutcome, SessionCaptureOptOutRecord, SessionCaptureRecordStore } from "@sema-agent/core";
|
|
63
|
+
import type { PgQueryFn } from "./pg-query.js";
|
|
64
|
+
import { type SqlDriver, type SqlDialect } from "./sql-driver.js";
|
|
65
|
+
export declare const SESSION_CAPTURE_OPTOUT_TABLE = "session_capture_optout";
|
|
66
|
+
/** 键列宽(64 字符 id 的 encodeURIComponent 上界 192 ≤ 255;DDL 与守卫同源此常量)。 */
|
|
67
|
+
export declare const SESSION_CAPTURE_KEY_WIDTH = 255;
|
|
68
|
+
/** 键的规范形 = core 文件三腿给文件名做的同一只编码(layout.js `captureOptOutPath` 亲读)。 */
|
|
69
|
+
export declare function encodeSessionCaptureKey(sessionId: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* `list` 的规范形往返校验(codex R2-[medium]):表里的键必须恰是某个 id 的 `encodeURIComponent` 输出。
|
|
72
|
+
* decode 失败 ⇒ **抛**具名错(原错随 `cause` 上交,不折默认值 —— [ref] 门② SHAPE C:catch 不许只 return
|
|
73
|
+
* 默认值);re-encode ≠ 原字节(如带外写入的生尾空格键、小写十六进制)⇒ 返回 `undefined`;两形调用方都
|
|
74
|
+
* **拒整本名册**(fail-closed:一个比对不上 lineage 贡献者的键 = 资格臂漏排除 = 蒸馏放大被扣留内容)。
|
|
75
|
+
*/
|
|
76
|
+
export declare function decodeCanonicalSessionCaptureKey(raw: string): string | undefined;
|
|
77
|
+
/** 双方言 SessionCaptureRecordStore(Promise 形三腿)。见文件头的逐腿失败法。 */
|
|
78
|
+
export declare class SqlSessionCaptureRecordStore implements SessionCaptureRecordStore {
|
|
79
|
+
private readonly driver;
|
|
80
|
+
private readonly dialect;
|
|
81
|
+
constructor(driver: SqlDriver, dialect: SqlDialect);
|
|
82
|
+
/** create-only / first-record-wins;**恒不 reject**(任何失败 ⇒ `"unpersisted"`,调用方必须拒跑)。 */
|
|
83
|
+
mark(sessionId: string, record: SessionCaptureOptOutRecord): Promise<SessionCaptureOptOutMarkOutcome>;
|
|
84
|
+
/** fail-closed 读:无行 ⇒ undefined;行在解不出 ⇒ 合成记录;SQL 故障 ⇒ reject(引擎折 fault 轴)。 */
|
|
85
|
+
read(sessionId: string): Promise<SessionCaptureOptOutRecord | undefined>;
|
|
86
|
+
/** 全名册。枚举失败 ⇒ reject(读不出的名册不是空名册);值列损坏 ⇒ 合成记录,绝不静默漏行;
|
|
87
|
+
* **键**非规范形 ⇒ reject 整本(codex R2-[medium]:一个比对不上 lineage 贡献者的键若被静默放行,
|
|
88
|
+
* 资格臂就漏排除该会话 = 蒸馏放大被扣留内容;拒整本让 consolidation fail-closed 拒整理)。 */
|
|
89
|
+
list(): Promise<Record<string, SessionCaptureOptOutRecord>>;
|
|
90
|
+
}
|
|
91
|
+
export declare class TiDBSessionCaptureRecordStore extends SqlSessionCaptureRecordStore {
|
|
92
|
+
constructor(pool: MySqlPool);
|
|
93
|
+
}
|
|
94
|
+
export declare class PgSessionCaptureRecordStore extends SqlSessionCaptureRecordStore {
|
|
95
|
+
constructor(pool: PgPool);
|
|
96
|
+
}
|
|
97
|
+
export declare const TIDB_SESSION_CAPTURE_OPTOUT_STATEMENTS: readonly string[];
|
|
98
|
+
export declare function ensurePgSessionCaptureOptOutSchema(q: PgQueryFn): Promise<void>;
|
|
99
|
+
//# sourceMappingURL=session-capture-record-store-sql.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { mysqlDriver, pgDriver } from "./sql-driver.js";
|
|
2
|
+
import { isDupKeyError } from "./sql-errors.js";
|
|
3
|
+
export const SESSION_CAPTURE_OPTOUT_TABLE = "session_capture_optout";
|
|
4
|
+
const UNREADABLE_RECORD_REASON = "capture opt-out record present but unreadable (kept fail-closed)";
|
|
5
|
+
export const SESSION_CAPTURE_KEY_WIDTH = 255;
|
|
6
|
+
export function encodeSessionCaptureKey(sessionId) {
|
|
7
|
+
return encodeURIComponent(sessionId);
|
|
8
|
+
}
|
|
9
|
+
export function decodeCanonicalSessionCaptureKey(raw) {
|
|
10
|
+
let decoded;
|
|
11
|
+
try {
|
|
12
|
+
decoded = decodeURIComponent(raw);
|
|
13
|
+
}
|
|
14
|
+
catch (err) {
|
|
15
|
+
throw new Error(`session capture opt-out roster holds a non-canonical key (undecodable: ${err instanceof Error ? err.message : String(err)}) — refusing the enumeration fail-closed`, { cause: err });
|
|
16
|
+
}
|
|
17
|
+
return encodeURIComponent(decoded) === raw ? decoded : undefined;
|
|
18
|
+
}
|
|
19
|
+
function ph(dialect, n) {
|
|
20
|
+
return dialect === "pg" ? `$${n}` : "?";
|
|
21
|
+
}
|
|
22
|
+
function readAtMs(v) {
|
|
23
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
24
|
+
return v;
|
|
25
|
+
if (typeof v === "string" && /^\d+$/.test(v))
|
|
26
|
+
return Number(v);
|
|
27
|
+
if (typeof v === "bigint")
|
|
28
|
+
return Number(v);
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
function toRecord(r) {
|
|
32
|
+
const at = readAtMs(r.at_ms);
|
|
33
|
+
const reason = r.reason;
|
|
34
|
+
if (at === undefined || typeof reason !== "string")
|
|
35
|
+
return { at: 0, reason: UNREADABLE_RECORD_REASON };
|
|
36
|
+
return { at, reason };
|
|
37
|
+
}
|
|
38
|
+
export class SqlSessionCaptureRecordStore {
|
|
39
|
+
driver;
|
|
40
|
+
dialect;
|
|
41
|
+
constructor(driver, dialect) {
|
|
42
|
+
this.driver = driver;
|
|
43
|
+
this.dialect = dialect;
|
|
44
|
+
}
|
|
45
|
+
async mark(sessionId, record) {
|
|
46
|
+
const key = encodeSessionCaptureKey(sessionId);
|
|
47
|
+
if (key.length > SESSION_CAPTURE_KEY_WIDTH)
|
|
48
|
+
return "unpersisted";
|
|
49
|
+
const d = this.dialect;
|
|
50
|
+
try {
|
|
51
|
+
await this.driver.query(`INSERT INTO ${SESSION_CAPTURE_OPTOUT_TABLE} (session_id, at_ms, reason) VALUES (${ph(d, 1)}, ${ph(d, 2)}, ${ph(d, 3)})`, [key, record.at, record.reason]);
|
|
52
|
+
return "created";
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
if (isDupKeyError(d, err))
|
|
56
|
+
return "existed";
|
|
57
|
+
return "unpersisted";
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async read(sessionId) {
|
|
61
|
+
const key = encodeSessionCaptureKey(sessionId);
|
|
62
|
+
if (key.length > SESSION_CAPTURE_KEY_WIDTH)
|
|
63
|
+
return undefined;
|
|
64
|
+
const res = await this.driver.query(`SELECT at_ms, reason FROM ${SESSION_CAPTURE_OPTOUT_TABLE} WHERE session_id = ${ph(this.dialect, 1)}`, [key]);
|
|
65
|
+
const row = res.rows[0];
|
|
66
|
+
if (row === undefined)
|
|
67
|
+
return undefined;
|
|
68
|
+
return toRecord(row);
|
|
69
|
+
}
|
|
70
|
+
async list() {
|
|
71
|
+
const res = await this.driver.query(`SELECT session_id, at_ms, reason FROM ${SESSION_CAPTURE_OPTOUT_TABLE} ORDER BY session_id ASC`);
|
|
72
|
+
const out = Object.create(null);
|
|
73
|
+
for (const r of res.rows) {
|
|
74
|
+
const raw = r.session_id;
|
|
75
|
+
const decoded = typeof raw === "string" ? decodeCanonicalSessionCaptureKey(raw) : undefined;
|
|
76
|
+
if (decoded === undefined) {
|
|
77
|
+
throw new Error(`session capture opt-out roster holds a non-canonical key (out-of-band or corrupted row) — refusing the whole enumeration fail-closed: a key that cannot round-trip the canonical encoding cannot be matched against lineage contributors, and a silently passed-through one would let consolidation amplify withheld content`);
|
|
78
|
+
}
|
|
79
|
+
out[decoded] = toRecord(r);
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export class TiDBSessionCaptureRecordStore extends SqlSessionCaptureRecordStore {
|
|
85
|
+
constructor(pool) {
|
|
86
|
+
super(mysqlDriver(pool), "tidb");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export class PgSessionCaptureRecordStore extends SqlSessionCaptureRecordStore {
|
|
90
|
+
constructor(pool) {
|
|
91
|
+
super(pgDriver(pool), "pg");
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export const TIDB_SESSION_CAPTURE_OPTOUT_STATEMENTS = [
|
|
95
|
+
`CREATE TABLE IF NOT EXISTS ${SESSION_CAPTURE_OPTOUT_TABLE} (
|
|
96
|
+
session_id VARCHAR(255) NOT NULL,
|
|
97
|
+
at_ms BIGINT NOT NULL,
|
|
98
|
+
reason TEXT NOT NULL,
|
|
99
|
+
PRIMARY KEY (session_id)
|
|
100
|
+
) COLLATE utf8mb4_bin`,
|
|
101
|
+
];
|
|
102
|
+
export async function ensurePgSessionCaptureOptOutSchema(q) {
|
|
103
|
+
await q(`CREATE TABLE IF NOT EXISTS ${SESSION_CAPTURE_OPTOUT_TABLE} (
|
|
104
|
+
session_id VARCHAR(255) COLLATE "C" NOT NULL,
|
|
105
|
+
at_ms BIGINT NOT NULL,
|
|
106
|
+
reason TEXT COLLATE "C" NOT NULL,
|
|
107
|
+
PRIMARY KEY (session_id)
|
|
108
|
+
)`);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=session-capture-record-store-sql.js.map
|