@sema-agent/server 7.52.1 → 7.54.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.
Files changed (342) hide show
  1. package/USAGE.md +7 -1
  2. package/dist/adoption/plan.d.ts +3 -3
  3. package/dist/adoption/quiesce.d.ts +1 -1
  4. package/dist/adoption/sql.d.ts +2 -2
  5. package/dist/adoption/wire.d.ts +1 -1
  6. package/dist/approval-ask-machine.d.ts +2 -2
  7. package/dist/approval-card.d.ts +18 -18
  8. package/dist/approval-deny-reasons.d.ts +1 -1
  9. package/dist/approval-hmac.d.ts +2 -2
  10. package/dist/approval-reconciler.d.ts +14 -14
  11. package/dist/approval.d.ts +2 -2
  12. package/dist/audit.d.ts +4 -4
  13. package/dist/auth-keys.d.ts +6 -6
  14. package/dist/bench/l8/artifact.d.ts +6 -1
  15. package/dist/bench/l8/artifact.js +2 -27
  16. package/dist/bench/l8/escape.d.ts +3 -3
  17. package/dist/bench/l8/index.d.ts +1 -1
  18. package/dist/bench/s1/arms.d.ts +3 -3
  19. package/dist/bench/s1/oracle.d.ts +2 -2
  20. package/dist/bench/s1/reviewer.d.ts +1 -1
  21. package/dist/bench/s1/row.d.ts +5 -5
  22. package/dist/bench/s1/runner-ctx.d.ts +3 -3
  23. package/dist/boot/config-center.d.ts +14 -7
  24. package/dist/boot/config-center.js +4 -2
  25. package/dist/boot/coordinators.d.ts +4 -4
  26. package/dist/boot/crash-last.d.ts +1 -1
  27. package/dist/boot/device-lane.d.ts +3 -3
  28. package/dist/boot/engine-lease.d.ts +4 -4
  29. package/dist/boot/governance-seams.d.ts +5 -5
  30. package/dist/boot/leader.d.ts +5 -5
  31. package/dist/boot/leader.js +2 -0
  32. package/dist/boot/limit-sync.d.ts +1 -1
  33. package/dist/boot/memory-boundary.d.ts +5 -5
  34. package/dist/boot/memory-consolidation.d.ts +8 -2
  35. package/dist/boot/memory-consolidation.js +1 -0
  36. package/dist/boot/org-memory.d.ts +5 -5
  37. package/dist/boot/parked-revive-gate.d.ts +6 -6
  38. package/dist/boot/permission-rules-audit.d.ts +2 -2
  39. package/dist/boot/reapers.d.ts +8 -8
  40. package/dist/boot/resolve-spec.d.ts +4 -4
  41. package/dist/boot/resolve-spec.js +1 -3
  42. package/dist/boot/retention-lane.d.ts +1 -1
  43. package/dist/boot/runner-deps.d.ts +53 -27
  44. package/dist/boot/runner-deps.js +16 -9
  45. package/dist/boot/runtime-caps.d.ts +4 -4
  46. package/dist/boot/session-faces.d.ts +1 -1
  47. package/dist/boot/shutdown.d.ts +10 -10
  48. package/dist/boot/shutdown.js +1 -1
  49. package/dist/boot/side-query-lane.d.ts +14 -14
  50. package/dist/boot/stores.js +5 -0
  51. package/dist/boot/task-list-lane.d.ts +3 -3
  52. package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
  53. package/dist/boot/workflow-orchestration.d.ts +1 -1
  54. package/dist/bounded-session-map.d.ts +1 -1
  55. package/dist/brain.d.ts +3 -3
  56. package/dist/budget.d.ts +3 -3
  57. package/dist/canonical-json.d.ts +53 -0
  58. package/dist/canonical-json.js +48 -0
  59. package/dist/capabilities/center-prompts.d.ts +13 -13
  60. package/dist/capabilities/collab-workflows.d.ts +1 -1
  61. package/dist/capabilities/hands-lane.d.ts +4 -4
  62. package/dist/capabilities/memory-notice.d.ts +4 -4
  63. package/dist/capabilities/prompt.d.ts +2 -2
  64. package/dist/capabilities/sandbox-file-send.d.ts +2 -2
  65. package/dist/capabilities/scenarios.d.ts +16 -16
  66. package/dist/capabilities/skills.d.ts +1 -1
  67. package/dist/capabilities/team.d.ts +13 -12
  68. package/dist/capabilities/tool-defer.d.ts +6 -6
  69. package/dist/config-catalog.d.ts +139 -0
  70. package/dist/config-catalog.js +556 -0
  71. package/dist/config-center/apply-effective.d.ts +42 -30
  72. package/dist/config-center/apply-effective.js +69 -62
  73. package/dist/config-center/apply-ledger.d.ts +6 -6
  74. package/dist/config-center/effective-keys.d.ts +30 -0
  75. package/dist/config-center/effective-keys.js +49 -0
  76. package/dist/config-center/facade.d.ts +6 -5
  77. package/dist/config-center/facade.js +1 -1
  78. package/dist/config-center/hot-keys-registry.d.ts +2 -2
  79. package/dist/config-center/http-client.d.ts +5 -5
  80. package/dist/config-center/mcp-revocation.d.ts +6 -4
  81. package/dist/config-center/mcp-revocation.js +2 -12
  82. package/dist/config-center/restart-signal.d.ts +11 -1
  83. package/dist/config-center/restart-signal.js +4 -10
  84. package/dist/config-center/skills-mcp.d.ts +2 -2
  85. package/dist/config-center/stage-limits.d.ts +3 -3
  86. package/dist/config-center/types.d.ts +42 -59
  87. package/dist/config-invariants.d.ts +1 -1
  88. package/dist/config-lkg.js +7 -1
  89. package/dist/config-provider.d.ts +2 -2
  90. package/dist/config-provider.js +1 -1
  91. package/dist/config-types.d.ts +140 -132
  92. package/dist/config.d.ts +22 -22
  93. package/dist/config.js +2 -1
  94. package/dist/degenerate-instrument.d.ts +1 -1
  95. package/dist/deployment-governance.d.ts +13 -13
  96. package/dist/device-enrollment.d.ts +5 -3
  97. package/dist/device-store.d.ts +17 -3
  98. package/dist/device-store.js +2 -0
  99. package/dist/device-ws-hub.d.ts +10 -5
  100. package/dist/device-ws-hub.js +25 -5
  101. package/dist/device-ws-protocol.d.ts +3 -3
  102. package/dist/digest-form.d.ts +1 -1
  103. package/dist/elicitation.d.ts +1 -1
  104. package/dist/env-facts.d.ts +7 -7
  105. package/dist/execution-lane-caps.d.ts +5 -5
  106. package/dist/fleet/fleet-bus.d.ts +53 -53
  107. package/dist/fleet/fleet-reconciler.d.ts +2 -2
  108. package/dist/fleet/fleet-terminal-window.d.ts +1 -1
  109. package/dist/fleet/subagent-tail-bus.d.ts +3 -3
  110. package/dist/fleet-client.d.ts +3 -3
  111. package/dist/fleet-lease.d.ts +1 -1
  112. package/dist/hooks/branch-transcript.d.ts +2 -2
  113. package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
  114. package/dist/hooks/cc-stop-prompt.d.ts +2 -2
  115. package/dist/hooks/hook-llm.d.ts +1 -1
  116. package/dist/hooks/hook-runner.d.ts +5 -5
  117. package/dist/http/active-run-conflict.d.ts +31 -33
  118. package/dist/http/active-run-conflict.js +4 -2
  119. package/dist/http/route-ctx.d.ts +22 -22
  120. package/dist/http/routes/a2a-serve.d.ts +2 -2
  121. package/dist/http/routes/admin-config-refresh.d.ts +1 -1
  122. package/dist/http/routes/admin-drain.d.ts +4 -4
  123. package/dist/http/routes/admin-memory-optout.d.ts +5 -5
  124. package/dist/http/routes/adoption.d.ts +1 -1
  125. package/dist/http/routes/agents-roster.d.ts +1 -1
  126. package/dist/http/routes/approvals-assistant.d.ts +6 -6
  127. package/dist/http/routes/approvals-assistant.js +4 -1
  128. package/dist/http/routes/capabilities.d.ts +1 -1
  129. package/dist/http/routes/capabilities.js +1 -0
  130. package/dist/http/routes/config-catalog.d.ts +28 -0
  131. package/dist/http/routes/config-catalog.js +42 -0
  132. package/dist/http/routes/diagnostics.d.ts +2 -2
  133. package/dist/http/routes/fleet.d.ts +1 -1
  134. package/dist/http/routes/images.d.ts +1 -1
  135. package/dist/http/routes/leader.d.ts +1 -1
  136. package/dist/http/routes/memory-bundle.d.ts +4 -4
  137. package/dist/http/routes/memory-compliance.d.ts +7 -7
  138. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  139. package/dist/http/routes/memory-origin.d.ts +9 -9
  140. package/dist/http/routes/memory-policy.d.ts +3 -3
  141. package/dist/http/routes/notify-wake.d.ts +1 -1
  142. package/dist/http/routes/observability.d.ts +1 -1
  143. package/dist/http/routes/retention-ops.d.ts +1 -1
  144. package/dist/http/routes/rules.d.ts +3 -3
  145. package/dist/http/routes/run-memory-capture.d.ts +1 -1
  146. package/dist/http/routes/runs.d.ts +3 -3
  147. package/dist/http/routes/runs.js +12 -17
  148. package/dist/http/routes/session-sync.d.ts +2 -2
  149. package/dist/http/routes/sessions-list.d.ts +1 -1
  150. package/dist/http/routes/sessions.d.ts +9 -1
  151. package/dist/http/routes/sessions.js +60 -0
  152. package/dist/http/routes/shared-memory.d.ts +1 -1
  153. package/dist/http/routes/side-query.d.ts +1 -1
  154. package/dist/http/routes/tasks.d.ts +1 -1
  155. package/dist/http/routes/trace-usage.d.ts +1 -1
  156. package/dist/http/routes/workflows.d.ts +1 -1
  157. package/dist/http/run-meta.d.ts +1 -1
  158. package/dist/http/send.d.ts +6 -6
  159. package/dist/http/server.d.ts +84 -67
  160. package/dist/http/server.js +39 -10
  161. package/dist/http/sse-lifecycle.d.ts +1 -1
  162. package/dist/http/sse-log.d.ts +6 -6
  163. package/dist/http/verify-rounds.d.ts +3 -3
  164. package/dist/http/wire-gate.d.ts +2 -2
  165. package/dist/http/wire-types.d.ts +57 -38
  166. package/dist/key-resolver.d.ts +1 -1
  167. package/dist/leader/diffout.d.ts +2 -2
  168. package/dist/leader/diffup.d.ts +1 -1
  169. package/dist/leader/endpoint.d.ts +1 -1
  170. package/dist/leader/fanout.d.ts +6 -6
  171. package/dist/leader/grader-env-factory.d.ts +1 -1
  172. package/dist/leader/leader.d.ts +12 -12
  173. package/dist/leader/merge.d.ts +3 -3
  174. package/dist/leader/planner.d.ts +5 -5
  175. package/dist/leader/repair-oracle.d.ts +1 -1
  176. package/dist/leader/wire.d.ts +21 -9
  177. package/dist/leader/wire.js +6 -5
  178. package/dist/lsp/manager.d.ts +2 -2
  179. package/dist/lsp/types.d.ts +1 -1
  180. package/dist/lsp/ws-transport.d.ts +2 -2
  181. package/dist/main.js +12 -2
  182. package/dist/mcp-content-origin.d.ts +1 -1
  183. package/dist/memory-bundle-engine.d.ts +5 -3
  184. package/dist/memory-bundle-engine.js +2 -2
  185. package/dist/memory-operator-faces.d.ts +41 -11
  186. package/dist/memory-operator-faces.js +12 -0
  187. package/dist/memory-origin-fence.d.ts +1 -1
  188. package/dist/memory-origin-fence.js +2 -13
  189. package/dist/memory-posture.d.ts +6 -6
  190. package/dist/memory-scope.d.ts +7 -7
  191. package/dist/model-select.d.ts +5 -5
  192. package/dist/observability/cost-quota.d.ts +6 -6
  193. package/dist/observability/cost-taxonomy.d.ts +2 -2
  194. package/dist/observability/fail-open.d.ts +17 -5
  195. package/dist/observability/fail-open.js +16 -4
  196. package/dist/observability/metrics.d.ts +1 -1
  197. package/dist/observability/prompt-manifest.d.ts +8 -8
  198. package/dist/observability/rate-limit.d.ts +2 -2
  199. package/dist/observability/secret-env-scrub.d.ts +1 -1
  200. package/dist/observability/tool-trace.d.ts +1 -1
  201. package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
  202. package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
  203. package/dist/orchestration/subagent-steer.d.ts +3 -3
  204. package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
  205. package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
  206. package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
  207. package/dist/parent-watch.d.ts +1 -1
  208. package/dist/parked-decide.d.ts +11 -11
  209. package/dist/plan-cache-probe.d.ts +1 -1
  210. package/dist/plugins/adoption-log-sql.d.ts +4 -4
  211. package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
  212. package/dist/plugins/approval-ask-store-memory.js +12 -0
  213. package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
  214. package/dist/plugins/approval-ask-store-sql.js +23 -6
  215. package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
  216. package/dist/plugins/approval-payload-fingerprint.js +23 -0
  217. package/dist/plugins/background-agent-store-sql.d.ts +8 -8
  218. package/dist/plugins/background-shell-support.d.ts +12 -12
  219. package/dist/plugins/blob-backend.d.ts +3 -3
  220. package/dist/plugins/breaker-state-sql.d.ts +3 -3
  221. package/dist/plugins/caching-session-store.d.ts +6 -6
  222. package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
  223. package/dist/plugins/checkpoint-store-sql.js +76 -33
  224. package/dist/plugins/device-store-sql.d.ts +4 -3
  225. package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
  226. package/dist/plugins/file-history-store-sql.d.ts +9 -8
  227. package/dist/plugins/file-run-store.d.ts +27 -27
  228. package/dist/plugins/fork-routing-session-store.d.ts +9 -9
  229. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  230. package/dist/plugins/image-index-sql.d.ts +2 -2
  231. package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
  232. package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
  233. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  234. package/dist/plugins/local-checkpoint-store.d.ts +26 -17
  235. package/dist/plugins/local-checkpoint-store.js +21 -11
  236. package/dist/plugins/local-session-store.d.ts +5 -5
  237. package/dist/plugins/mailbox-store-sql.d.ts +6 -6
  238. package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
  239. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  240. package/dist/plugins/memory-engine-tidb.d.ts +1 -1
  241. package/dist/plugins/memory-key-guards.d.ts +3 -3
  242. package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
  243. package/dist/plugins/memory-origin-law.d.ts +13 -13
  244. package/dist/plugins/memory-run-store.d.ts +12 -12
  245. package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
  246. package/dist/plugins/permission-rule-store-file.d.ts +3 -3
  247. package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
  248. package/dist/plugins/permission-rule-store-sql.js +7 -12
  249. package/dist/plugins/pg-cost-quota.d.ts +2 -2
  250. package/dist/plugins/pg-pool.d.ts +29 -2
  251. package/dist/plugins/pg-pool.js +50 -2
  252. package/dist/plugins/pg-query.d.ts +1 -1
  253. package/dist/plugins/pg-rate-limiter.d.ts +2 -2
  254. package/dist/plugins/pg-session-storage.d.ts +9 -9
  255. package/dist/plugins/remote-env-adb.d.ts +1 -1
  256. package/dist/plugins/remote-env-device.d.ts +6 -4
  257. package/dist/plugins/remote-env-device.js +4 -1
  258. package/dist/plugins/remote-env-e2b.d.ts +11 -11
  259. package/dist/plugins/remote-env-file-error.d.ts +2 -2
  260. package/dist/plugins/remote-env-host.d.ts +10 -10
  261. package/dist/plugins/remote-env-k8s.d.ts +7 -7
  262. package/dist/plugins/remote-env-local-docker.d.ts +1 -1
  263. package/dist/plugins/remote-env-ssh.d.ts +9 -9
  264. package/dist/plugins/remote-scratchpad.d.ts +1 -1
  265. package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
  266. package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
  267. package/dist/plugins/retention-store-sql.d.ts +11 -11
  268. package/dist/plugins/roster-store-sql.d.ts +6 -8
  269. package/dist/plugins/run-store-sql.d.ts +12 -12
  270. package/dist/plugins/scheduler-support.d.ts +1 -1
  271. package/dist/plugins/send-user-file.d.ts +1 -1
  272. package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
  273. package/dist/plugins/session-capture-record-store-sql.js +110 -0
  274. package/dist/plugins/session-placement.d.ts +1 -1
  275. package/dist/plugins/session-policy-store-sql.d.ts +2 -2
  276. package/dist/plugins/session-store.d.ts +3 -3
  277. package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
  278. package/dist/plugins/sql-driver.d.ts +7 -7
  279. package/dist/plugins/sql-errors.d.ts +2 -2
  280. package/dist/plugins/sql-escape.d.ts +1 -1
  281. package/dist/plugins/sql-row-helpers.d.ts +1 -1
  282. package/dist/plugins/store-backend.d.ts +32 -19
  283. package/dist/plugins/store-backend.js +5 -1
  284. package/dist/plugins/store-contracts.d.ts +9 -9
  285. package/dist/plugins/task-list-store-sql.d.ts +3 -3
  286. package/dist/plugins/tidb-cost-quota.d.ts +3 -3
  287. package/dist/plugins/tidb-pool.d.ts +13 -0
  288. package/dist/plugins/tidb-pool.js +9 -0
  289. package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
  290. package/dist/plugins/tidb-session-storage.d.ts +2 -2
  291. package/dist/plugins/tidb-session-store.d.ts +11 -11
  292. package/dist/plugins/tool-result-store-sql.d.ts +8 -8
  293. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  294. package/dist/plugins/web-search.d.ts +7 -7
  295. package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
  296. package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
  297. package/dist/plugins/write-behind-counter.d.ts +6 -6
  298. package/dist/principal-jwt.d.ts +2 -2
  299. package/dist/project-memory.d.ts +1 -1
  300. package/dist/prompts-domain-validate.d.ts +8 -8
  301. package/dist/question.d.ts +3 -3
  302. package/dist/resource-suspend.d.ts +4 -4
  303. package/dist/resource-window.d.ts +3 -3
  304. package/dist/router/route-orchestration.d.ts +1 -1
  305. package/dist/rules-consent.d.ts +48 -40
  306. package/dist/run-local.d.ts +5 -5
  307. package/dist/runs.d.ts +19 -19
  308. package/dist/runtime-caps-resolver.d.ts +6 -6
  309. package/dist/runtime-governance.d.ts +11 -7
  310. package/dist/runtime-governance.js +23 -1
  311. package/dist/security.d.ts +13 -13
  312. package/dist/session-leaf-bus.d.ts +1 -1
  313. package/dist/session-sync-content.d.ts +4 -4
  314. package/dist/session-sync-kernel.d.ts +2 -2
  315. package/dist/session-sync.d.ts +13 -13
  316. package/dist/session-titler.d.ts +1 -1
  317. package/dist/session-watch.d.ts +3 -3
  318. package/dist/shared-memory-scope-authorizer.d.ts +4 -4
  319. package/dist/sighup-idle.d.ts +1 -1
  320. package/dist/spec-fields.d.ts +20 -20
  321. package/dist/ssh-host-key.d.ts +5 -5
  322. package/dist/store-live-probe.d.ts +2 -2
  323. package/dist/task-cwd.d.ts +11 -11
  324. package/dist/task-mcp.d.ts +5 -5
  325. package/dist/task-settings.d.ts +35 -35
  326. package/dist/task-workflow.d.ts +3 -3
  327. package/dist/text-bidi.d.ts +1 -1
  328. package/dist/tool-approval.d.ts +186 -182
  329. package/dist/tool-approval.js +247 -120
  330. package/dist/trace/core-keyset-guard.d.ts +19 -5
  331. package/dist/trace/engine-notice-wire.d.ts +7 -7
  332. package/dist/trace/engine-notice-wire.js +2 -0
  333. package/dist/trace/injection-tier.d.ts +11 -21
  334. package/dist/trace/injection-tier.js +3 -4
  335. package/dist/trace/ledger-events.d.ts +3 -3
  336. package/dist/trace/ledger-sink.d.ts +7 -7
  337. package/dist/trace/project.d.ts +31 -30
  338. package/dist/trace/project.js +1 -0
  339. package/dist/turn-activity.d.ts +4 -4
  340. package/dist/usage-analytics.d.ts +1 -1
  341. package/dist/wall-clock-jump-guard.d.ts +3 -3
  342. package/package.json +6 -6
@@ -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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * #292 C18(core 5.48.0 design/323「不造新店」提货批,黑板 [4743] 点名义务)——**subagent 转录持久化**
2
+ * [ref] C18(core 5.48.0 [ref]「不造新店」提货批,黑板 [ref] 点名义务)——**subagent 转录持久化**
3
3
  * 的 placement 语义,SQL 孪生共用的一份判据。
4
4
  *
5
5
  * ## 这是什么
@@ -4,7 +4,7 @@ import type { Pool as PgPool } from "pg";
4
4
  import { type SqlDriver } from "./sql-driver.js";
5
5
  /** `session_policy.policy_key` 的**唯一铸造点**(core 复合键的 sha256)。
6
6
  *
7
- * 🔴 导出而不是让收编腿再抄一份(clay 宪法「schema 单一属主禁复制」):design/183 form b 的身份重绑要
7
+ * 🔴 导出而不是让收编腿再抄一份(clay 宪法「schema 单一属主禁复制」):[ref] form b 的身份重绑要
8
8
  * 逐行重算这把键(身份在 hash 的**原像**里,等值 UPDATE 够不着)。两处各写一遍 sha256 表达式的下场是
9
9
  * 某天有人在这里改了 key 公式而收编腿还在按旧式算 —— 迁完的行从此谁也读不到,且**静默**。 */
10
10
  export declare const policyKeyFor: (sessionId: string, principal: string | undefined) => string;
@@ -14,7 +14,7 @@ export declare class SqlSessionPolicyStore implements SessionPolicyStore {
14
14
  constructor(db: SqlDriver);
15
15
  /** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
16
16
  private q;
17
- /** 判据属主 = `sql-errors.ts`(A-032 P1-①;本站点旧形已是并集形,收编后语义不变)。 */
17
+ /** 判据属主 = `sql-errors.ts`([ref] P1-①;本站点旧形已是并集形,收编后语义不变)。 */
18
18
  private isDupKey;
19
19
  /** Read the stored rules for (session, principal-owner); null when none (parity with InMemory). */
20
20
  getRules(sessionId: string, principal?: string): Promise<StoredSessionRules | null>;
@@ -14,7 +14,7 @@ export declare function createSessionStore(config: ServiceConfig, backend?: Stor
14
14
  inc(name: string, labels?: Record<string, string>, n?: number): void;
15
15
  }): SessionStore;
16
16
  /**
17
- * core 1.382(design/153,[1561] 提货单①②)`SubagentToolOptions.background.ensureChildSessionDurable`
17
+ * core 1.382([ref],[ref] 提货单①②)`SubagentToolOptions.background.ensureChildSessionDurable`
18
18
  * 的实现体——从 main.ts 装配点抽出为可独立测试的纯函数(main.ts 里的其余装配闭包历来无单测覆盖,
19
19
  * 这条因为承载真实的 park/veto 裁决,拆出来直接钉)。
20
20
  *
@@ -27,7 +27,7 @@ export declare function createSessionStore(config: ServiceConfig, backend?: Stor
27
27
  * (F-7 案:让"真会话在 transient"赢过"host 店里的同 id 空壳"),会把"只在 transient 店有真内容"误判成
28
28
  * "host 店已经有了"。这里要问的是纯粹"host 店本身是否已经有这份真内容",必须绕开那层路由。
29
29
  *
30
- * 🔴 [1575] F3(cli 复查抓获,真红确认)调用方前提——**本函数假设 `hostStore.release()` 是"归还租约"
30
+ * 🔴 [ref] F3(cli 复查抓获,真红确认)调用方前提——**本函数假设 `hostStore.release()` 是"归还租约"
31
31
  * 语义(不销毁内容)**,这对 core `TiDBSessionStore` 成立(`release()` 逐字注释「Durable history is
32
32
  * retained; just drop any in-flight cache entry」),但对无 repo 构造的 `TtlSessionStore`(`createSessionStore`
33
33
  * 在 `SESSION_BACKEND !== "tidb"` 时返回的那种)**不成立**——那个店形的 `release()` 是整删会话
@@ -39,7 +39,7 @@ export declare function createSessionStore(config: ServiceConfig, backend?: Stor
39
39
  */
40
40
  export declare function ensureSessionDurable(hostStore: SessionStore, sessionId: string): Promise<void>;
41
41
  /**
42
- * [1593] 主动晋升版 ensureChildSessionDurable(cli TiDB 真机撞获:1.263 的只查不迁形在拆店生产形下
42
+ * [ref] 主动晋升版 ensureChildSessionDurable(cli TiDB 真机撞获:1.263 的只查不迁形在拆店生产形下
43
43
  * 恒否决 park——bg 子会话住 subRunner 私有 TTL 店、从不在 host 店,core 收 veto 即 expire checkpoint
44
44
  * (14ms~2s)+ settle failed,赎回窗口不存在):
45
45
  * 1. 快路:已在 host 店且有真内容 → 直接通过(幂等/重入)。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/177 — the SQL `SharedMemoryStoreProvider`: the deployment's ORG-scoped shared memory libraries
2
+ * [ref] — the SQL `SharedMemoryStoreProvider`: the deployment's ORG-scoped shared memory libraries
3
3
  * (`memory_list` / `memory_read`), served out of the durable store instead of a BYOM host callback.
4
4
  *
5
5
  * ─────────────────────────────────────────────────────────────────────────────────────────────────
@@ -12,7 +12,7 @@
12
12
  * is the DEPLOYMENT's admin plane (migrations, an import job, an operator face) and is deliberately
13
13
  * NOT reachable from any model-facing surface in this repo.
14
14
  *
15
- * 🔴 ORG PLANE ≠ THE LOCAL MEMORY CHAIN (设计 182 §13). `agent_memory_engine_*` (the design/138
15
+ * 🔴 ORG PLANE ≠ THE LOCAL MEMORY CHAIN (设计 182 §13). `agent_memory_engine_*` (the [ref]
16
16
  * MemoryEngine) and these three tables share NOTHING: no join, no view, no shared row, no shared
17
17
  * scope registry. The local chain is an entry-transactional index injection with a write path; this
18
18
  * one is a read-only document library. Bridging them in EITHER direction would let harvested private
@@ -135,7 +135,7 @@ export declare function assertScopeKey(scopeKey: string): void;
135
135
  export declare function assertDocumentPath(path: string): void;
136
136
  /**
137
137
  * The dual-dialect implementation. Every statement is written out in BOTH texts at its call site
138
- * (design/158 A12 判据:方言差异必须显式) — the `q(tidbSql, pgSql)` helper never builds one text.
138
+ * ([ref] A12 判据:方言差异必须显式) — the `q(tidbSql, pgSql)` helper never builds one text.
139
139
  */
140
140
  export declare class SqlSharedMemoryStore implements SharedMemoryStoreProvider {
141
141
  private readonly db;
@@ -156,7 +156,7 @@ export declare class SqlSharedMemoryStore implements SharedMemoryStoreProvider {
156
156
  /**
157
157
  * 盘状态 + 库登记,**一个事务一个快照**(轮2 F3 修)。
158
158
  *
159
- * 🔴 A-010.11(两臂不对称,验真后修):此前 PG 臂显式抬隔离级别、**MySQL 臂只靠服务端默认值**,
159
+ * 🔴 [ref](两臂不对称,验真后修):此前 PG 臂显式抬隔离级别、**MySQL 臂只靠服务端默认值**,
160
160
  * 注里写的是「MySQL/TiDB 的默认隔离级别就是 REPEATABLE READ ⇒ 天然同快照」。那句话对**默认配置**
161
161
  * 为真,但 `transaction_isolation` 是可设的服务端/会话变量:一台跑 READ COMMITTED 的实例(托管
162
162
  * MySQL 的厂商默认、中间层代理、运维手改)会把「一个事务一个快照」悄悄降成「每条语句各自取快照」,
@@ -203,7 +203,7 @@ export declare class SqlSharedMemoryStore implements SharedMemoryStoreProvider {
203
203
  * Remove one document. Scope-fenced like {@link putDocument} (a stale delete must not reach a
204
204
  * successor tenant's library). Returns whether a row was actually there.
205
205
  *
206
- * 🔴 A-010.14(验真后修):此前围栏是**两条独立语句** —— `assertOwnedBy()` 先查一次登记表,然后另
206
+ * 🔴 [ref](验真后修):此前围栏是**两条独立语句** —— `assertOwnedBy()` 先查一次登记表,然后另
207
207
  * 起一条 DELETE。它自称与 `putDocument` 对齐,但 `putDocument` 的检查与写是**同事务同行锁**
208
208
  * (`FOR UPDATE`),而这里的两条语句之间有一道真窗:登记检查通过之后、DELETE 发出之前,另一个 org
209
209
  * 完成 `deleteStore` + `putStore` 的 id 复用,这条 DELETE 就落进**继任租户**的库里删掉他们的文档。
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Backend-NEUTRAL SQL exec/transaction seam for the "single-file dual-dialect" store collapses
3
- * (design/158 A12 定型半场). Sibling of `sql-escape.ts` / `sql-row-helpers.ts` / `store-contracts.ts`:
3
+ * ([ref] A12 定型半场). Sibling of `sql-escape.ts` / `sql-row-helpers.ts` / `store-contracts.ts`:
4
4
  * a leaf module with ZERO store logic, so a collapsed pair never has to load the other dialect's
5
5
  * adapter to reach a driver call.
6
6
  *
@@ -19,7 +19,7 @@
19
19
  * - WHICH unique key collided (mysql2 `sqlMessage` text vs pg `err.constraint`) — that lives with
20
20
  * the store that needs it, because the attribution rule is store-specific, not driver-generic.
21
21
  * ⚠️ The dup-key predicate ITSELF is NOT store-specific and no longer lives at the call sites:
22
- * `sql-errors.ts` owns it (A-032 P1-①; 7+ hand-rolled copies had drifted into three different
22
+ * `sql-errors.ts` owns it ([ref] P1-①; 7+ hand-rolled copies had drifted into three different
23
23
  * recognition sets, so the same driver error got opposite verdicts in different stores).
24
24
  * - per-query timeouts: mysql2 takes `{sql, timeout}` while node-pg takes a `QueryConfig` with
25
25
  * `query_timeout`. The counter family (write-behind-counter.ts) needs those and keeps its own
@@ -31,7 +31,7 @@
31
31
  * divergence is visible rather than hidden inside `begin()`.
32
32
  *
33
33
  * ─────────────────────────────────────────────────────────────────────────────────────────────────
34
- * REPLICATION PLAYBOOK — collapsing the remaining tidb-/pg- twin pairs (design/158 A12)
34
+ * REPLICATION PLAYBOOK — collapsing the remaining tidb-/pg- twin pairs ([ref] A12)
35
35
  * ─────────────────────────────────────────────────────────────────────────────────────────────────
36
36
  * Reference collapses: image-bake-store-sql.ts (class + transactions) and checkpoint-store-sql.ts
37
37
  * (class, no transactions). Function-style stores follow task-list-store-sql.ts instead (inline
@@ -64,7 +64,7 @@
64
64
  * (sqlMessage vs err.constraint; the dup-key predicate itself = `sql-errors.ts`) · PG-only protocol-byte handling
65
65
  * (pgSafeJsonStringify / pgProtocolJsonStringify / pgSanitizeText / pgHasUnstorable) · DDL. Each arm's
66
66
  * BEHAVIOR (what pgSafeJsonStringify/pgProtocolJsonStringify actually do to the bytes) stays written out
67
- * in `pg-safe-json.ts`, untouched — `dialectJsonEncoder`/`dialectProtocolJsonEncoder` below (design/158
67
+ * in `pg-safe-json.ts`, untouched — `dialectJsonEncoder`/`dialectProtocolJsonEncoder` below ([ref]
68
68
  * redesign①) only collect the identical `dialect === "tidb" ? JSON.stringify(v) : pgSafe…(v)` DISPATCH
69
69
  * ternary that five call sites duplicated verbatim; they are not a new abstraction over the encodings
70
70
  * themselves, so this does not violate the rule above.
@@ -94,7 +94,7 @@ export interface SqlTxConn extends SqlExec {
94
94
  /** TiDB: `BEGIN PESSIMISTIC` (current-read txn). PG: plain `BEGIN`. */
95
95
  beginPessimistic(): Promise<void>;
96
96
  /**
97
- * Open a transaction whose reads are pinned to ONE snapshot (A-010.11).
97
+ * Open a transaction whose reads are pinned to ONE snapshot ([ref]).
98
98
  *
99
99
  * 🔴 Why this is a named verb and not "just `begin()` — MySQL defaults to REPEATABLE READ anyway":
100
100
  * a *server default* is not a structural guarantee. `transaction_isolation` is a settable
@@ -125,13 +125,13 @@ export interface SqlDriver extends SqlExec {
125
125
  export declare function mysqlDriver(pool: MySqlPool): SqlDriver;
126
126
  /** PostgreSQL driver. Transaction control is issued as STATEMENTS (node-pg has no native verbs). */
127
127
  export declare function pgDriver(pool: PgPool): SqlDriver;
128
- /** design/158 redesign① — the "safe" JSON-column encoder DISPATCH (run-store/outcome-ledger's identical
128
+ /** [ref] redesign① — the "safe" JSON-column encoder DISPATCH (run-store/outcome-ledger's identical
129
129
  * ternary, collected): TiDB stores `JSON.stringify` verbatim; PG goes through `pgSafeJsonStringify`'s
130
130
  * protocol-byte defenses (a raw NUL/lone-surrogate would otherwise throw mid-write). Returns a 1-arg
131
131
  * encoder; call sites invoke `dialectJsonEncoder(this.db.dialect)(value)` inline — the dispatch is the
132
132
  * collected thing, not a cached field. */
133
133
  export declare const dialectJsonEncoder: (dialect: SqlDialect) => ((v: unknown) => string);
134
- /** design/158 redesign① — the "protocol" JSON-column encoder DISPATCH (approval-store/checkpoint-store's
134
+ /** [ref] redesign① — the "protocol" JSON-column encoder DISPATCH (approval-store/checkpoint-store's
135
135
  * identical ternary, collected): TiDB stores `JSON.stringify` verbatim (the `label` arg is ignored on that
136
136
  * arm — TiDB has no protocol-byte envelope to name); PG goes through `pgProtocolJsonStringify(v, label)`,
137
137
  * whose `label` names the field in its error text on an unstorable-byte reject. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * SQL 驱动错误的**方言判别**——「这是不是唯一键冲突」的单一属主(A-032 P1-①,病族
2
+ * SQL 驱动错误的**方言判别**——「这是不是唯一键冲突」的单一属主([ref] P1-①,病族
3
3
  * single-semantic-multi-site-drift)。`sql-escape.ts` / `sql-row-helpers.ts` / `store-contracts.ts`
4
4
  * 的同级叶子:零 store 逻辑、零驱动依赖(不 import mysql2/pg),纯谓词。
5
5
  *
@@ -50,7 +50,7 @@ export declare const MYSQL_ER_BAD_FIELD_CODE = "ER_BAD_FIELD_ERROR";
50
50
  * 🔴 单一属主的理由与 {@link isDupKeyError} 逐字同源(本文件顶注的 single-semantic-multi-site-drift):
51
51
  * 判据一旦复制,两处的识别集就会各自漂,而这条谓词的错判方向**特别贵** —— 它守的是一句**破坏性**的
52
52
  * 错误指路(「去 DROP TABLE」)。超时、连接重置、取消、资源不足、列级权限被拒、表整个不存在,每一种
53
- * 都会让探针抛错;把它们诊断成「删表重建」比它要挡的缺陷更贵(#340 codex 交叉复审 round2/round3
53
+ * 都会让探针抛错;把它们诊断成「删表重建」比它要挡的缺陷更贵([ref] codex 交叉复审 round2/round3
54
54
  * [high] 两轮收窄后的终形)。认不出的一律**不是**缺列(fail-safe:宁可把一次真缺列报成原始错误)。
55
55
  *
56
56
  * MySQL 侧两个归因键都认(mysql2 的 `code`/`errno` 是同一件事的两种写法),与 dup-key 那条同姿势。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Backend-NEUTRAL SQL string escaping (design/158 A3 沉底).
2
+ * Backend-NEUTRAL SQL string escaping ([ref] A3 沉底).
3
3
  *
4
4
  * Lives in its own leaf so no adapter has to load another dialect's adapter module to get a pure
5
5
  * string transform (the PG stores used to runtime-import the TiDB tool-result store for exactly
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Shared pure row-mapping helpers for the SQL store twins (design/158 S8 纯 helper 归位).
2
+ * Shared pure row-mapping helpers for the SQL store twins ([ref] S8 纯 helper 归位).
3
3
  *
4
4
  * These were duplicated verbatim across the pg-/tidb- store twin pairs; each store imports the flavor
5
5
  * it was written against (usually under its historical local alias, e.g. `parseJsonStrict as
@@ -1,6 +1,6 @@
1
1
  import type { Pool as MysqlPool } from "mysql2/promise";
2
2
  import type { Pool as PgPool } from "pg";
3
- import type { SessionStore, SessionPolicyStore, FileHistoryStore, WorkflowJournalStore, ToolResultStore } from "@sema-agent/core";
3
+ import type { SessionStore, SessionPolicyStore, FileHistoryStore, WorkflowJournalStore, ToolResultStore, SessionCaptureRecordStore } from "@sema-agent/core";
4
4
  import { type OutcomeSink } from "./file-outcome-sink.js";
5
5
  import { type InboxWarn } from "./workflow-run-store-sql.js";
6
6
  import { FileRunStore } from "./file-run-store.js";
@@ -38,16 +38,16 @@ export type RunStore = TiDBRunStore | PgRunStore | FileRunStore;
38
38
  * FileResumeAnchorStore is the FILE-backed local twin (P0.5 variant-1; survives restart). */
39
39
  export type ResumeAnchorStore = TiDBResumeAnchorStore | PgResumeAnchorStore | FileResumeAnchorStore;
40
40
  export type { ApprovalExemptionStore } from "./approval-exemption-store.js";
41
- /** #151(design/172 v3.1 §3.0-§3.2 流内审批协议持久层):`ApprovalAskStore` 接口 + 行/补丁类型。
41
+ /** [ref]([ref] v3.1 §3.0-§3.2 流内审批协议持久层):`ApprovalAskStore` 接口 + 行/补丁类型。
42
42
  * 车3 刀 3a 起 `StoreBackend.approvalAsk()` 已在(见接口体的那条注)。 */
43
43
  export type { ApprovalAskStore, AskRow, NewAskRow, AskTransitionPatch, DecideAskInput, DecideResult, ExpireResult, BindGateInput, BatchRow, AskDecision } from "./approval-ask-store-sql.js";
44
44
  /** E6 SessionPolicyStore — core's interface PLUS the service `deleteBySession` (E21 purge; only the durable twins carry
45
45
  * it, core's InMemory omits it → optional). tidb/pg = durable twins; local = core's InMemorySessionPolicyStore (works
46
46
  * local — rules need no cloud-only infra). The shared env-gated equivalence suite keeps the twins byte-matched to InMemory. */
47
47
  export type ServiceSessionPolicyStore = SessionPolicyStore;
48
- /** S-15 per-edited-file rewind FileHistoryStore — core's interface PLUS the service extras only the SQL twins
48
+ /** [ref] per-edited-file rewind FileHistoryStore — core's interface PLUS the service extras only the SQL twins
49
49
  * carry (optional so the local lane's core `FileFileHistoryStore` still fits). Replaces the retired E19
50
- * whole-tree `ServiceFileSnapshotStore` (design/381: the boundary covers the TRACKED set only — files this
50
+ * whole-tree `ServiceFileSnapshotStore` ([ref]: the boundary covers the TRACKED set only — files this
51
51
  * session edited; there is no whole-tree manifest anymore). Also the 2c history-transfer store
52
52
  * (exportHistory/importHistory + the blob negotiation faces below). */
53
53
  export type ServiceFileHistoryStore = FileHistoryStore & {
@@ -92,7 +92,7 @@ export type ServiceWorkflowJournalStore = WorkflowJournalStore & {
92
92
  };
93
93
  export type ImageIndex = TiDBImageIndex | PgImageIndex;
94
94
  export type ImageBake = TiDBImageBake | PgImageBake;
95
- /** #193 车4 件1:durable leader-run 登记表的双方言孪生(union 同族——TS 私有字段让具体类名义上不同)。 */
95
+ /** [ref] 车4 件1:durable leader-run 登记表的双方言孪生(union 同族——TS 私有字段让具体类名义上不同)。 */
96
96
  export type LeaderRunStore = TiDBLeaderRunStore | PgLeaderRunStore;
97
97
  /** The FULL checkpoint store (core CheckpointStore + the service operator-queue/ctx methods listPending/
98
98
  * listByScope/findPendingTokenBySession/peekPendingScope/putCtx/getCtx/reapCtx) — the SQL twins carry them,
@@ -129,7 +129,7 @@ export interface StoreBackend {
129
129
  /** Per-session per-toolName approval exemption ("本会话不再询问") — an approval MEMORY the F4
130
130
  * ask-gate consults after deny/neverAuto. REQUIRED on all backends (works local, like resumeAnchor). */
131
131
  approvalExemption(): ApprovalExemptionStore;
132
- /** #151(design/172 §3.0-§3.2)流内审批协议持久层:每个流内工具调用一行的 ask 状态机 + 批行。
132
+ /** [ref]([ref] §3.0-§3.2)流内审批协议持久层:每个流内工具调用一行的 ask 状态机 + 批行。
133
133
  * REQUIRED on all backends — tidb/pg = SQL 双方言 twin;local = {@link InMemoryApprovalAskStore}。
134
134
  *
135
135
  * 🔴 local 形的代价必须在这里说清楚(而不是留给读者自己发现):InMemory 的 STREAM_PENDING/DECIDED/
@@ -144,7 +144,7 @@ export interface StoreBackend {
144
144
  * D1 逐字现行为(store 缺席 = 现行 `tool_approval` 活卡腿一字不变)。 */
145
145
  approvalAsk(): ApprovalAskStoreType;
146
146
  /**
147
- * #154 车二(core 5.18.0 design/179 + 5.22.0 design/182):**持久化权限规则店**(「不再询问」车道)
147
+ * [ref] 车二(core 5.18.0 [ref] + 5.22.0 [ref]):**持久化权限规则店**(「不再询问」车道)
148
148
  * 三面 —— 规则桶 provider / durable 审批记录 / server 自铸的 CC 导入票。
149
149
  *
150
150
  * 🔴 **可选**(与上面那些 REQUIRED 家族不同),缺席是一个真答案:core 的 `RunnerDeps.permissionRuleStore`
@@ -153,7 +153,7 @@ export interface StoreBackend {
153
153
  *
154
154
  * `local` 车道**刻意不给 in-memory twin**:一条规则是「人授权过的持久事实」,进程内 Map 形会在重启时
155
155
  * 静默丢掉那份授权,而消费端(下一次同命令的 ask)读到的是「没有规则」——那是**放宽面**上的静默降级。
156
- * ✅ **#203 §1 已落 File 形**(那条注写下的解除条件逐字是「先落 File 形,core 现成
156
+ * ✅ **[ref] §1 已落 File 形**(那条注写下的解除条件逐字是「先落 File 形,core 现成
157
157
  * `FilePermissionRuleStoreProvider` 即可当模子」——本车照办):`local` 现在返回一个**跨重启存活**的
158
158
  * 三面束,storeWired 在单机车道上真为 true。in-memory twin 的禁令不变,它禁的是「会遗忘的店」,
159
159
  * 不是「单机的店」。
@@ -165,11 +165,11 @@ export interface StoreBackend {
165
165
  /** E6 durable SessionPolicyStore (operator-tightened per-session tool rules). REQUIRED on all backends — works local
166
166
  * (local = core's InMemorySessionPolicyStore), like resumeAnchor. Backs core's RunnerDeps.sessionPolicyStore. */
167
167
  sessionPolicy(): ServiceSessionPolicyStore;
168
- /** S-15 per-edited-file rewind FileHistoryStore (trackEdit/annulTrack/snapshot/restore over the tracked set;
168
+ /** [ref] per-edited-file rewind FileHistoryStore (trackEdit/annulTrack/snapshot/restore over the tracked set;
169
169
  * also the 2c history-transfer store). REQUIRED on all backends (local = core's file-backed
170
170
  * `FileFileHistoryStore` under the data root). Backs core's RunnerDeps.fileHistoryStore. */
171
171
  fileHistory(): ServiceFileHistoryStore;
172
- /** design/383 §3.1 / S-50 §一(S-49 S-2):per-principal **memory-capture opt-out 授权表**
172
+ /** [ref] §3.1 / [ref] §一([ref] S-2):per-principal **memory-capture opt-out 授权表**
173
173
  * (`memory_optout_grant`)—— `RuntimeCaps.allowMemoryOptOut` 的本地 verdict 源(三层折叠:per-principal
174
174
  * 行 → 部署缺省哨兵行 → 代码缺省 allow)+ `/v1/admin/memory-optout` 四端点的持久层。
175
175
  *
@@ -181,6 +181,19 @@ export interface StoreBackend {
181
181
  * 「没有行 ⇒ 代码缺省 allow」—— 那是**放宽面**上的静默降级(permissionRule 那条禁令的同一理由)。
182
182
  * File 形候真实的 local+governed 部署需求出现再落(候需求档)。 */
183
183
  memoryOptOutGrant(): MemoryOptOutGrantStore | undefined;
184
+ /** [ref]②([ref] §2.1b,core 7.0.2 [ref] 件2):会话 capture opt-out **记录**的 SQL 载体
185
+ * (`session_capture_optout`)—— core `RunnerDeps.memoryCaptureRecordStore` /
186
+ * `MemoryEngineOptions.captureRecordStore` 的持久层(Promise 形三腿)。与 §3.1 的**授权表**不是一个轴:
187
+ * 那张管「谁**可以** opt-out」(operator 写的 verdict),这张管「谁**已经** opt-out」(用户写的一次性
188
+ * 单向记录)。
189
+ *
190
+ * 🔴 **可选**(与 memoryOptOutGrant 同族):SQL 后端 = 双方言 twin;`local` 车道 **undefined**,且缺席是
191
+ * 一个真答案 —— 缺席时 core 用它的控制面文件三腿(`fileSessionCaptureRecordStore`),单机部署上那正是
192
+ * 重启可存活的正确载体(383 §2.1b:「absent = 文件三腿,单进程/单机字节不变」)。SQL 载体要解决的病
193
+ * 只在无状态多副本形:文件记录对 resume 副本不可见,「record not found」恰朝**继续采集**方向坏。
194
+ * 刻意不给 local 一个 SQL/内存 twin:内存形会在重启时把一条隐私记录静默丢掉(比文件三腿严格更差),
195
+ * 文件形 core 已自带。 */
196
+ sessionCaptureRecords(): SessionCaptureRecordStore | undefined;
184
197
  /** S-1 legacy-epoch discriminant (core `RunnerDeps.legacyRewindBoundaryProbe`): does the RETIRED whole-tree
185
198
  * snapshot epoch hold a boundary for (sessionId, entryId)? Reads the legacy `snapshot_manifest` table.
186
199
  * SQL backends only (local never had a whole-tree epoch table). Diagnostic input on the refusal path —
@@ -207,9 +220,9 @@ export interface StoreBackend {
207
220
  * run_workflow tool deps (`dist/orchestration/run-workflow-tool.d.ts:65`), and the boot chain consumes it
208
221
  * end-to-end: built in `boot/workflow-orchestration.ts` (`const workflowJournalStore = …backend.workflowJournal()`),
209
222
  * threaded into RunnerDeps (`boot/runner-deps.ts` 的 `workflowJournalStore`), reaped on the maintenance tick
210
- * (`boot/reapers.ts` 同名字段), and read by `GET /v1/workflows/:id/journal` (`http/routes/workflows.ts`, [1402]). */
223
+ * (`boot/reapers.ts` 同名字段), and read by `GET /v1/workflows/:id/journal` (`http/routes/workflows.ts`, [ref]). */
211
224
  workflowJournal(): ServiceWorkflowJournalStore;
212
- /** design/73 §1 consumption sink for `RunnerDeps.onTaskOutcome` facts. REQUIRED on all backends:
225
+ /** [ref] §1 consumption sink for `RunnerDeps.onTaskOutcome` facts. REQUIRED on all backends:
213
226
  * tidb/pg = the outcome-ledger twins (SQL rows, mapped via coreOutcomeToLedgerRow + verbatim core_outcome
214
227
  * JSON); local = an owner-only JSONL File sink. Read-only v1 — records facts, drives no policy. */
215
228
  outcomeSink(): OutcomeSink;
@@ -224,7 +237,7 @@ export interface StoreBackend {
224
237
  /** Cloud-only stores below are OPTIONAL: the `local` (in-memory/file) backend omits them (it has no core
225
238
  * in-memory twin carrying the service extras, and these are fleet/multi-replica concepts), so a local HTTP
226
239
  * service degrades EXACTLY like today's no-DB env (the consumers gate on `backend?.X?.()`). TiDB/PG provide all. */
227
- /** design/177 —— org 共享记忆库的供给面(core `RunnerDeps.sharedMemoryStores` + `/v1/shared-memory/*`
240
+ /** [ref] —— org 共享记忆库的供给面(core `RunnerDeps.sharedMemoryStores` + `/v1/shared-memory/*`
228
241
  * 只读面)。授权折叠**注入**:谁属于哪个 org 归 server 的目录面判,持久层只按判决出的 scope 集查表。
229
242
  *
230
243
  * 🔴 local 车道诚实缺席(不是"待补"):这个面的全部意义是**跨用户**共享一个团队库,而 local 后端是
@@ -239,7 +252,7 @@ export interface StoreBackend {
239
252
  imageIndex?(): ImageIndex;
240
253
  imageBake?(): ImageBake;
241
254
  /**
242
- * #193 车4 件1(台账 P1-9):durable leader-run 登记表。**SQL 后端专有**,`local` 刻意省略。
255
+ * [ref] 车4 件1(台账 P1-9):durable leader-run 登记表。**SQL 后端专有**,`local` 刻意省略。
243
256
  *
244
257
  * 🔴 local 缺席不是欠账、也不是「以后补个 File 形」:leader run 是 N worker fan-out + 真 git push,
245
258
  * 而 config 层已经把「LEADER_ENABLED=true 且无外部 SQL 店」整个组合**拒启**了(件2 门②)——
@@ -256,7 +269,7 @@ export interface StoreBackend {
256
269
  */
257
270
  device?(): DeviceStore;
258
271
  /**
259
- * #270 —— 托管留存的**破坏性**三方法(core `ManagedRetentionCapability` 的 server 侧真身)。
272
+ * [ref] —— 托管留存的**破坏性**三方法(core `ManagedRetentionCapability` 的 server 侧真身)。
260
273
  * **SQL 后端专有**,`local` 刻意省略:那三条腿是跨十余张表的单事务级联,file/in-memory 形没有事务面
261
274
  * 也没有那些表,所以它诚实声明 `retention:"none"`(见 `local-session-store.ts` 的同款注)。
262
275
  *
@@ -266,7 +279,7 @@ export interface StoreBackend {
266
279
  */
267
280
  retention?(opts: SqlRetentionStoreOptions): SqlRetentionStore;
268
281
  /**
269
- * #270 车2 —— 留存执行面的**非破坏性**半场:sweep 租约、legal-hold 的放置/解除、审计表的读与
282
+ * [ref] 车2 —— 留存执行面的**非破坏性**半场:sweep 租约、legal-hold 的放置/解除、审计表的读与
270
283
  * 非破坏行的写。同样 SQL 专有(它写的三张表只在 SQL schema 里)。
271
284
  *
272
285
  * 🔴 与上一格**分家**是有意的:拿到本对象的消费方(operator 路由)结构上删不掉任何业务数据。
@@ -285,7 +298,7 @@ export interface StoreBackend {
285
298
  /** S3-TOB(设计 §1.4):the raw PG pool for the memory-engine DB backend's PgQueryFn binding (mirror of
286
299
  * mysqlPool). undefined on non-PG backends. */
287
300
  pgPool(): PgPool | undefined;
288
- /** design/183 form b(纯身份重绑)的 SQL 收编日志。**SQL 后端专有**(mysql/pg),`local` 刻意省略:
301
+ /** [ref] form b(纯身份重绑)的 SQL 收编日志。**SQL 后端专有**(mysql/pg),`local` 刻意省略:
289
302
  * 收编重绑的是**多租身份轴**,而 local 后端整个数据根就属那一个用户、库里没有 owner/scope 分区面
290
303
  * ——在那儿开这道口只会让一个够不到任何东西的动作看起来可用。消费点按 `backend?.adoptionLog?.()`
291
304
  * 缺席即 501(诚实拒绝),与其它云专有 store 同姿势。 */
@@ -295,7 +308,7 @@ export interface StoreBackend {
295
308
  * splits a fleet window into disjoint buckets = soft-limit leak). OPTIONAL: local backend omits (no fleet). */
296
309
  dbNowMs?(): Promise<number>;
297
310
  }
298
- /** (c)(clay 拍 a+c,2026-07-27;S-15 换店后域=file_history_blob,门与旋钮名不变)云形 blob 姿势门——
311
+ /** (c)(clay 拍 a+c,2026-07-27;[ref] 换店后域=file_history_blob,门与旋钮名不变)云形 blob 姿势门——
299
312
  * boot 时调用(boot/stores.ts),纯函数可单测。SQL 后端(mysql|pg)把 blob 字节落单行的形已被两役
300
313
  * 实证撞 mysql-协议包墙(D-1 附件 → 对象存储裁定):大字节归对象存储。per-file 历史的 blob=单文件
301
314
  * 字节,同一堵墙(>6MiB 的被 track 文件在 TiDB 上落不进 SQL 行 ⇒ trackEdit 拒 ⇒ 默认 DV-14 下该次
@@ -319,7 +332,7 @@ export declare function counterStoreLabel(store: unknown, kind: string | undefin
319
332
  * reachability probe is the caller's first `ensureSchema`). Returns undefined when no DB is configured.
320
333
  *
321
334
  * `onWarn` (additive, optional) is the boot-time warning sink the LOCAL backend needs for core's
322
- * permission-rule DISCLOSURE face (#203 §1): an unreadable / checksum-mismatched / symlinked rule file
335
+ * permission-rule DISCLOSURE face ([ref] §1): an unreadable / checksum-mismatched / symlinked rule file
323
336
  * answers ZERO rules and says so — swallowing that turns a fail-closed degrade into a silent one.
324
337
  * `onError` (additive, optional; F-D) is the **error-level** twin of that seat — 件6 的
325
338
  * `file_run_store_hydrate_unreadable` 按成文承诺是 error 级,warn 座满足不了那句话。两座都是**加项**:
@@ -13,6 +13,7 @@ import { TiDBApprovalExemptionStore, PgApprovalExemptionStore, FileApprovalExemp
13
13
  import { TiDBApprovalAskStore, PgApprovalAskStore } from "./approval-ask-store-sql.js";
14
14
  import { InMemoryApprovalAskStore } from "./approval-ask-store-memory.js";
15
15
  import { TiDBMemoryOptOutGrantStore, PgMemoryOptOutGrantStore } from "./memory-optout-grant-store-sql.js";
16
+ import { TiDBSessionCaptureRecordStore, PgSessionCaptureRecordStore } from "./session-capture-record-store-sql.js";
16
17
  import { TiDBSendFileLedger, PgSendFileLedger, FileSendFileLedger } from "./send-file-ledger.js";
17
18
  import { TiDBResumeAnchorStore, PgResumeAnchorStore } from "./resume-anchor-store-sql.js";
18
19
  import { TiDBSessionPolicyStore, PgSessionPolicyStore } from "./session-policy-store-sql.js";
@@ -135,6 +136,7 @@ class TiDBBackend {
135
136
  sessionPolicy() { return new TiDBSessionPolicyStore(this.pool); }
136
137
  fileHistory() { return new TiDBFileHistoryStore(this.pool, historyBlobBackend(this.config, "tidb", this.pool), this.config.fileHistory); }
137
138
  memoryOptOutGrant() { return new TiDBMemoryOptOutGrantStore(this.pool); }
139
+ sessionCaptureRecords() { return new TiDBSessionCaptureRecordStore(this.pool); }
138
140
  legacyRewindBoundaryProbe(query) { return legacyProbeImpl("tidb", this.pool, query); }
139
141
  legacySnapshotBlobSweep() { return legacySweepImpl(this.config, "tidb", this.pool); }
140
142
  legacySnapshotPurge(sessionId) { return legacyPurgeImpl("tidb", this.pool, sessionId); }
@@ -180,6 +182,7 @@ class PgBackend {
180
182
  sessionPolicy() { return new PgSessionPolicyStore(this.pool); }
181
183
  fileHistory() { return new PgFileHistoryStore(this.pool, historyBlobBackend(this.config, "pg", this.pool), this.config.fileHistory); }
182
184
  memoryOptOutGrant() { return new PgMemoryOptOutGrantStore(this.pool); }
185
+ sessionCaptureRecords() { return new PgSessionCaptureRecordStore(this.pool); }
183
186
  legacyRewindBoundaryProbe(query) { return legacyProbeImpl("pg", this.pool, query); }
184
187
  legacySnapshotBlobSweep() { return legacySweepImpl(this.config, "pg", this.pool); }
185
188
  legacySnapshotPurge(sessionId) { return legacyPurgeImpl("pg", this.pool, sessionId); }
@@ -299,6 +302,7 @@ class LocalBackend {
299
302
  sessionPolicy() { return this.fileBackend.sessionPolicyStore; }
300
303
  fileHistory() { return this.fileBackend.fileHistoryStore; }
301
304
  memoryOptOutGrant() { return undefined; }
305
+ sessionCaptureRecords() { return undefined; }
302
306
  workflowJournal() { return this.workflowJournalStore; }
303
307
  outcomeSink() { return this.outcomeSinkInst; }
304
308
  session() { return this.sessionStore; }
@@ -315,7 +319,7 @@ export function createStoreBackend(config, onWarn, onError) {
315
319
  if (config.dbBackend === "pg") {
316
320
  if (!config.pg)
317
321
  return undefined;
318
- const pool = createPgPool(pgPoolOptions(config.pg, config.dbQueryTimeoutMs));
322
+ const pool = createPgPool(pgPoolOptions(config.pg, config.dbQueryTimeoutMs), onWarn);
319
323
  return new PgBackend(pool, config);
320
324
  }
321
325
  if (!config.tidb)