@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.
Files changed (328) hide show
  1. package/USAGE.md +22 -5
  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 +2 -0
  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/device-lane.js +2 -0
  29. package/dist/boot/engine-lease.d.ts +4 -4
  30. package/dist/boot/governance-seams.d.ts +5 -5
  31. package/dist/boot/leader.d.ts +5 -5
  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/retention-lane.d.ts +1 -1
  42. package/dist/boot/runner-deps.d.ts +33 -27
  43. package/dist/boot/runner-deps.js +2 -1
  44. package/dist/boot/runtime-caps.d.ts +4 -4
  45. package/dist/boot/session-faces.d.ts +1 -1
  46. package/dist/boot/shutdown.d.ts +10 -10
  47. package/dist/boot/side-query-lane.d.ts +14 -14
  48. package/dist/boot/stores.js +5 -0
  49. package/dist/boot/task-list-lane.d.ts +3 -3
  50. package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
  51. package/dist/boot/workflow-orchestration.d.ts +1 -1
  52. package/dist/bounded-session-map.d.ts +1 -1
  53. package/dist/brain.d.ts +3 -3
  54. package/dist/budget.d.ts +3 -3
  55. package/dist/canonical-json.d.ts +53 -0
  56. package/dist/canonical-json.js +48 -0
  57. package/dist/capabilities/center-prompts.d.ts +13 -13
  58. package/dist/capabilities/collab-workflows.d.ts +1 -1
  59. package/dist/capabilities/hands-lane.d.ts +4 -4
  60. package/dist/capabilities/memory-notice.d.ts +4 -4
  61. package/dist/capabilities/prompt.d.ts +2 -2
  62. package/dist/capabilities/sandbox-file-send.d.ts +2 -2
  63. package/dist/capabilities/scenarios.d.ts +16 -16
  64. package/dist/capabilities/skills.d.ts +1 -1
  65. package/dist/capabilities/team.d.ts +3 -3
  66. package/dist/capabilities/tool-defer.d.ts +6 -6
  67. package/dist/config-catalog.d.ts +139 -0
  68. package/dist/config-catalog.js +556 -0
  69. package/dist/config-center/apply-effective.d.ts +20 -7
  70. package/dist/config-center/apply-effective.js +45 -0
  71. package/dist/config-center/apply-ledger.d.ts +6 -6
  72. package/dist/config-center/facade.d.ts +3 -2
  73. package/dist/config-center/hot-keys-registry.d.ts +2 -2
  74. package/dist/config-center/http-client.d.ts +5 -5
  75. package/dist/config-center/mcp-revocation.d.ts +6 -4
  76. package/dist/config-center/mcp-revocation.js +2 -12
  77. package/dist/config-center/restart-signal.d.ts +11 -1
  78. package/dist/config-center/restart-signal.js +1 -1
  79. package/dist/config-center/skills-mcp.d.ts +2 -2
  80. package/dist/config-center/stage-limits.d.ts +3 -3
  81. package/dist/config-center/types.d.ts +23 -19
  82. package/dist/config-invariants.d.ts +1 -1
  83. package/dist/config-provider.d.ts +2 -2
  84. package/dist/config-types.d.ts +157 -134
  85. package/dist/config.d.ts +32 -24
  86. package/dist/config.js +48 -6
  87. package/dist/degenerate-instrument.d.ts +1 -1
  88. package/dist/deployment-governance.d.ts +13 -13
  89. package/dist/device-store.d.ts +2 -2
  90. package/dist/device-ws-hub.d.ts +6 -4
  91. package/dist/device-ws-hub.js +9 -3
  92. package/dist/device-ws-protocol.d.ts +3 -3
  93. package/dist/digest-form.d.ts +1 -1
  94. package/dist/elicitation.d.ts +1 -1
  95. package/dist/env-facts.d.ts +7 -7
  96. package/dist/execution-lane-caps.d.ts +5 -5
  97. package/dist/fleet/fleet-bus.d.ts +56 -53
  98. package/dist/fleet/fleet-reconciler.d.ts +2 -2
  99. package/dist/fleet/fleet-terminal-window.d.ts +1 -1
  100. package/dist/fleet/subagent-tail-bus.d.ts +3 -3
  101. package/dist/fleet-client.d.ts +3 -3
  102. package/dist/fleet-lease.d.ts +1 -1
  103. package/dist/hooks/branch-transcript.d.ts +2 -2
  104. package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
  105. package/dist/hooks/cc-stop-prompt.d.ts +2 -2
  106. package/dist/hooks/hook-llm.d.ts +1 -1
  107. package/dist/hooks/hook-runner.d.ts +12 -5
  108. package/dist/http/active-run-conflict.d.ts +31 -33
  109. package/dist/http/active-run-conflict.js +4 -2
  110. package/dist/http/route-ctx.d.ts +23 -21
  111. package/dist/http/routes/a2a-serve.d.ts +2 -2
  112. package/dist/http/routes/admin-config-refresh.d.ts +1 -1
  113. package/dist/http/routes/admin-drain.d.ts +4 -4
  114. package/dist/http/routes/admin-memory-optout.d.ts +5 -5
  115. package/dist/http/routes/adoption.d.ts +1 -1
  116. package/dist/http/routes/agents-roster.d.ts +1 -1
  117. package/dist/http/routes/approvals-assistant.d.ts +6 -6
  118. package/dist/http/routes/approvals-assistant.js +4 -1
  119. package/dist/http/routes/capabilities.d.ts +1 -1
  120. package/dist/http/routes/capabilities.js +1 -0
  121. package/dist/http/routes/config-catalog.d.ts +28 -0
  122. package/dist/http/routes/config-catalog.js +42 -0
  123. package/dist/http/routes/diagnostics.d.ts +2 -2
  124. package/dist/http/routes/fleet.d.ts +1 -1
  125. package/dist/http/routes/images.d.ts +1 -1
  126. package/dist/http/routes/leader.d.ts +1 -1
  127. package/dist/http/routes/memory-bundle.d.ts +4 -4
  128. package/dist/http/routes/memory-bundle.js +2 -3
  129. package/dist/http/routes/memory-compliance.d.ts +7 -7
  130. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  131. package/dist/http/routes/memory-origin.d.ts +9 -9
  132. package/dist/http/routes/memory-policy.d.ts +3 -3
  133. package/dist/http/routes/notify-wake.d.ts +1 -1
  134. package/dist/http/routes/observability.d.ts +1 -1
  135. package/dist/http/routes/retention-ops.d.ts +1 -1
  136. package/dist/http/routes/rules.d.ts +3 -3
  137. package/dist/http/routes/run-memory-capture.d.ts +1 -1
  138. package/dist/http/routes/runs.d.ts +3 -3
  139. package/dist/http/routes/runs.js +12 -17
  140. package/dist/http/routes/session-sync.d.ts +2 -2
  141. package/dist/http/routes/sessions-list.d.ts +1 -1
  142. package/dist/http/routes/sessions.d.ts +9 -1
  143. package/dist/http/routes/sessions.js +61 -1
  144. package/dist/http/routes/shared-memory.d.ts +1 -1
  145. package/dist/http/routes/side-query.d.ts +1 -1
  146. package/dist/http/routes/tasks.d.ts +1 -1
  147. package/dist/http/routes/trace-usage.d.ts +1 -1
  148. package/dist/http/routes/workflows.d.ts +1 -1
  149. package/dist/http/run-meta.d.ts +1 -1
  150. package/dist/http/send.d.ts +6 -6
  151. package/dist/http/server.d.ts +84 -67
  152. package/dist/http/server.js +25 -12
  153. package/dist/http/sse-lifecycle.d.ts +1 -1
  154. package/dist/http/sse-log.d.ts +6 -6
  155. package/dist/http/verify-rounds.d.ts +3 -3
  156. package/dist/http/wire-gate.d.ts +2 -2
  157. package/dist/http/wire-types.d.ts +38 -38
  158. package/dist/key-resolver.d.ts +1 -1
  159. package/dist/leader/diffout.d.ts +2 -2
  160. package/dist/leader/diffup.d.ts +1 -1
  161. package/dist/leader/endpoint.d.ts +1 -1
  162. package/dist/leader/fanout.d.ts +6 -6
  163. package/dist/leader/grader-env-factory.d.ts +1 -1
  164. package/dist/leader/leader.d.ts +12 -12
  165. package/dist/leader/merge.d.ts +3 -3
  166. package/dist/leader/planner.d.ts +5 -5
  167. package/dist/leader/repair-oracle.d.ts +1 -1
  168. package/dist/leader/wire.d.ts +9 -9
  169. package/dist/lsp/manager.d.ts +2 -2
  170. package/dist/lsp/types.d.ts +1 -1
  171. package/dist/lsp/ws-transport.d.ts +2 -2
  172. package/dist/main.js +13 -2
  173. package/dist/mcp-content-origin.d.ts +1 -1
  174. package/dist/memory-bundle-engine.d.ts +5 -3
  175. package/dist/memory-bundle-engine.js +2 -2
  176. package/dist/memory-operator-faces.d.ts +41 -11
  177. package/dist/memory-operator-faces.js +12 -0
  178. package/dist/memory-origin-fence.d.ts +20 -35
  179. package/dist/memory-origin-fence.js +41 -1
  180. package/dist/memory-posture.d.ts +6 -6
  181. package/dist/memory-scope.d.ts +7 -7
  182. package/dist/model-select.d.ts +5 -5
  183. package/dist/observability/cost-quota.d.ts +6 -6
  184. package/dist/observability/cost-taxonomy.d.ts +2 -2
  185. package/dist/observability/fail-open.d.ts +1 -5
  186. package/dist/observability/fail-open.js +0 -4
  187. package/dist/observability/metrics.d.ts +1 -1
  188. package/dist/observability/prompt-manifest.d.ts +8 -8
  189. package/dist/observability/rate-limit.d.ts +2 -2
  190. package/dist/observability/secret-env-scrub.d.ts +1 -1
  191. package/dist/observability/tool-trace.d.ts +1 -1
  192. package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
  193. package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
  194. package/dist/orchestration/subagent-steer.d.ts +3 -3
  195. package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
  196. package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
  197. package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
  198. package/dist/parent-watch.d.ts +1 -1
  199. package/dist/parked-decide.d.ts +11 -11
  200. package/dist/plan-cache-probe.d.ts +1 -1
  201. package/dist/plugins/adoption-log-sql.d.ts +4 -4
  202. package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
  203. package/dist/plugins/approval-ask-store-memory.js +12 -0
  204. package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
  205. package/dist/plugins/approval-ask-store-sql.js +23 -6
  206. package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
  207. package/dist/plugins/approval-payload-fingerprint.js +23 -0
  208. package/dist/plugins/background-agent-store-sql.d.ts +8 -8
  209. package/dist/plugins/background-shell-support.d.ts +12 -12
  210. package/dist/plugins/blob-backend.d.ts +3 -3
  211. package/dist/plugins/breaker-state-sql.d.ts +3 -3
  212. package/dist/plugins/caching-session-store.d.ts +6 -6
  213. package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
  214. package/dist/plugins/checkpoint-store-sql.js +76 -33
  215. package/dist/plugins/device-store-sql.d.ts +4 -3
  216. package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
  217. package/dist/plugins/file-history-store-sql.d.ts +9 -8
  218. package/dist/plugins/file-run-store.d.ts +27 -27
  219. package/dist/plugins/fork-routing-session-store.d.ts +9 -9
  220. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  221. package/dist/plugins/image-index-sql.d.ts +2 -2
  222. package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
  223. package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
  224. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  225. package/dist/plugins/local-checkpoint-store.d.ts +26 -17
  226. package/dist/plugins/local-checkpoint-store.js +21 -11
  227. package/dist/plugins/local-session-store.d.ts +5 -5
  228. package/dist/plugins/mailbox-store-sql.d.ts +6 -6
  229. package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
  230. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  231. package/dist/plugins/memory-engine-tidb.d.ts +1 -1
  232. package/dist/plugins/memory-key-guards.d.ts +3 -3
  233. package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
  234. package/dist/plugins/memory-origin-law.d.ts +13 -13
  235. package/dist/plugins/memory-run-store.d.ts +12 -12
  236. package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
  237. package/dist/plugins/permission-rule-store-file.d.ts +3 -3
  238. package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
  239. package/dist/plugins/permission-rule-store-sql.js +7 -12
  240. package/dist/plugins/pg-cost-quota.d.ts +2 -2
  241. package/dist/plugins/pg-pool.js +5 -0
  242. package/dist/plugins/pg-query.d.ts +1 -1
  243. package/dist/plugins/pg-rate-limiter.d.ts +2 -2
  244. package/dist/plugins/pg-session-storage.d.ts +9 -9
  245. package/dist/plugins/remote-env-adb.d.ts +1 -1
  246. package/dist/plugins/remote-env-device.d.ts +2 -2
  247. package/dist/plugins/remote-env-e2b.d.ts +11 -11
  248. package/dist/plugins/remote-env-file-error.d.ts +2 -2
  249. package/dist/plugins/remote-env-host.d.ts +10 -10
  250. package/dist/plugins/remote-env-k8s.d.ts +7 -7
  251. package/dist/plugins/remote-env-local-docker.d.ts +1 -1
  252. package/dist/plugins/remote-env-ssh.d.ts +9 -9
  253. package/dist/plugins/remote-scratchpad.d.ts +1 -1
  254. package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
  255. package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
  256. package/dist/plugins/retention-store-sql.d.ts +11 -11
  257. package/dist/plugins/roster-store-sql.d.ts +5 -5
  258. package/dist/plugins/run-store-sql.d.ts +12 -12
  259. package/dist/plugins/scheduler-support.d.ts +1 -1
  260. package/dist/plugins/send-user-file.d.ts +1 -1
  261. package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
  262. package/dist/plugins/session-capture-record-store-sql.js +110 -0
  263. package/dist/plugins/session-placement.d.ts +1 -1
  264. package/dist/plugins/session-policy-store-sql.d.ts +2 -2
  265. package/dist/plugins/session-store.d.ts +3 -3
  266. package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
  267. package/dist/plugins/sql-driver.d.ts +7 -7
  268. package/dist/plugins/sql-errors.d.ts +2 -2
  269. package/dist/plugins/sql-escape.d.ts +1 -1
  270. package/dist/plugins/sql-row-helpers.d.ts +1 -1
  271. package/dist/plugins/store-backend.d.ts +32 -19
  272. package/dist/plugins/store-backend.js +4 -0
  273. package/dist/plugins/store-contracts.d.ts +9 -9
  274. package/dist/plugins/task-list-store-sql.d.ts +3 -3
  275. package/dist/plugins/tidb-cost-quota.d.ts +3 -3
  276. package/dist/plugins/tidb-pool.js +9 -0
  277. package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
  278. package/dist/plugins/tidb-session-storage.d.ts +2 -2
  279. package/dist/plugins/tidb-session-store.d.ts +11 -11
  280. package/dist/plugins/tool-result-store-sql.d.ts +8 -8
  281. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  282. package/dist/plugins/web-search.d.ts +7 -7
  283. package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
  284. package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
  285. package/dist/plugins/write-behind-counter.d.ts +6 -6
  286. package/dist/principal-jwt.d.ts +2 -2
  287. package/dist/project-memory.d.ts +1 -1
  288. package/dist/prompts-domain-validate.d.ts +8 -8
  289. package/dist/question.d.ts +3 -3
  290. package/dist/resource-suspend.d.ts +4 -4
  291. package/dist/resource-window.d.ts +3 -3
  292. package/dist/router/route-orchestration.d.ts +1 -1
  293. package/dist/rules-consent.d.ts +48 -40
  294. package/dist/run-local.d.ts +5 -5
  295. package/dist/run-local.js +28 -4
  296. package/dist/runs.d.ts +19 -19
  297. package/dist/runtime-caps-resolver.d.ts +6 -6
  298. package/dist/runtime-governance.d.ts +7 -7
  299. package/dist/security.d.ts +13 -13
  300. package/dist/session-leaf-bus.d.ts +1 -1
  301. package/dist/session-sync-content.d.ts +4 -4
  302. package/dist/session-sync-kernel.d.ts +2 -2
  303. package/dist/session-sync.d.ts +13 -13
  304. package/dist/session-titler.d.ts +1 -1
  305. package/dist/session-watch.d.ts +3 -3
  306. package/dist/shared-memory-scope-authorizer.d.ts +4 -4
  307. package/dist/sighup-idle.d.ts +1 -1
  308. package/dist/spec-fields.d.ts +20 -20
  309. package/dist/ssh-host-key.d.ts +5 -5
  310. package/dist/store-live-probe.d.ts +2 -2
  311. package/dist/task-cwd.d.ts +11 -11
  312. package/dist/task-mcp.d.ts +5 -5
  313. package/dist/task-settings.d.ts +35 -35
  314. package/dist/task-workflow.d.ts +3 -3
  315. package/dist/text-bidi.d.ts +1 -1
  316. package/dist/tool-approval.d.ts +171 -160
  317. package/dist/tool-approval.js +33 -28
  318. package/dist/trace/core-keyset-guard.d.ts +21 -7
  319. package/dist/trace/engine-notice-wire.d.ts +6 -6
  320. package/dist/trace/injection-tier.d.ts +2 -2
  321. package/dist/trace/ledger-events.d.ts +3 -3
  322. package/dist/trace/ledger-sink.d.ts +7 -7
  323. package/dist/trace/project.d.ts +35 -30
  324. package/dist/trace/project.js +9 -0
  325. package/dist/turn-activity.d.ts +4 -4
  326. package/dist/usage-analytics.d.ts +1 -1
  327. package/dist/wall-clock-jump-guard.d.ts +3 -3
  328. package/package.json +6 -6
@@ -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; }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Backend-NEUTRAL store contracts (design/158 A3 沉底).
2
+ * Backend-NEUTRAL store contracts ([ref] A3 沉底).
3
3
  *
4
4
  * The record/event/summary shapes (and the pure row-mapping helpers) shared by ALL store backends —
5
5
  * TiDB/MySQL, PostgreSQL, file, memory — plus their non-store consumers (http wire, trace, images,
@@ -30,7 +30,7 @@ export interface RunRecord {
30
30
  /** Which SYSTEM's credential submitted the run (oa/cc-mcp/portal…), derived at the auth gate — never
31
31
  * self-declared. null = legacy single-token deployment (authenticated, no system identity). */
32
32
  source: string | null;
33
- /** The replica currently HOLDING this run — written at createRun and TAKEN OVER by markResuming (S-51: a
33
+ /** The replica currently HOLDING this run — written at createRun and TAKEN OVER by markResuming ([ref]: a
34
34
  * cross-replica resume moves the seat, so a reader comparing it with its own instanceId is asking "is the
35
35
  * live leg here NOW", not "who minted the row"). Lets a preempt/cancel/steer handler tell "this run is on
36
36
  * MY replica" (consult the in-process inflight/steerable map authoritatively) from "held elsewhere" (fall
@@ -46,7 +46,7 @@ export interface RunRecord {
46
46
  * 「这一行已经走到**终局**了吗」——`RunRecord["status"]`(= `"running" | TaskStatus`)的**穷举**判据,
47
47
  * 与类型定义同住一个文件(词表的属主 = 判据的属主)。
48
48
  *
49
- * 🔴 为什么是 `switch` 而不是一张 `ReadonlySet<string>`(2026-08-08,#176 二轮扫描 finding):终局词表
49
+ * 🔴 为什么是 `switch` 而不是一张 `ReadonlySet<string>`(2026-08-08,[ref] 二轮扫描 finding):终局词表
50
50
  * **真变过**(core 5.8.0 把 `"timeout"` 从 `TaskStatus` 里删了)。而集合形的门对象是 `string`,对词表
51
51
  * 两个方向都无钉:
52
52
  * · **增词**(core 新加一个终局态)⇒ 集合不含它 ⇒ 该行被静默判成「非终局」,收敛器会一直等一个
@@ -69,7 +69,7 @@ export declare function isTerminalRunStatus(status: RunRecord["status"]): boolea
69
69
  * resource_limit 门)与 `needs_review`(`plan_review` / dry-run 拦截门,写点 = 各 store 的
70
70
  * `setNeedsReview`)。两者的行为面**完全一致**:行还活着、`task_active` claim 还占着、checkpoint 还能被
71
71
  * 决议。凡是「行是不是还停着」的判断只手抄 `=== "suspended"` 的地方,对 plan_review 腿一律给出**相反**
72
- * 结论 —— 它会被当成终局:取消谎报 "already terminal — no-op"(claim 从此无人释放,正是 [868] 那个把会话
72
+ * 结论 —— 它会被当成终局:取消谎报 "already terminal — no-op"(claim 从此无人释放,正是 [ref] 那个把会话
73
73
  * 锁死的指纹)、trace 面无帧、leader 面不触发 park 反应。这条判据的存在就是为了不再有第三次手抄。
74
74
  *
75
75
  * 未知词的方向与 {@link isTerminalRunStatus} 同向保守:判**不是** park。理由是消费点会据此做**不可逆**
@@ -176,7 +176,7 @@ export interface BakeTerminal {
176
176
  manifestSha?: string | null;
177
177
  tag?: string | null;
178
178
  }
179
- /** Raw SELECT row shape shared by BOTH SQL twins (design/158 S8 归位, A3 沉底 —
179
+ /** Raw SELECT row shape shared by BOTH SQL twins ([ref] S8 归位, A3 沉底 —
180
180
  * node-pg reads BIGINT-ish `exit_code` back as a string, hence `number | string | null`). */
181
181
  export interface BakeRow {
182
182
  bake_id: string;
@@ -207,9 +207,9 @@ export interface BakeRow {
207
207
  created_at: Date | string;
208
208
  updated_at: Date | string;
209
209
  }
210
- /** SELECT row → {@link BakeRecord} — shared by BOTH SQL twins (design/158 S8 归位, A3 沉底). */
210
+ /** SELECT row → {@link BakeRecord} — shared by BOTH SQL twins ([ref] S8 归位, A3 沉底). */
211
211
  export declare function mapBakeRow(r: BakeRow): BakeRecord;
212
- /** Column list mapBakeRow expects — shared by BOTH SQL twins (design/158 S8 归位, A3 沉底). */
212
+ /** Column list mapBakeRow expects — shared by BOTH SQL twins ([ref] S8 归位, A3 沉底). */
213
213
  export declare const BAKE_SELECT_COLS: string;
214
214
  /** Nested-build security posture (the operator console shows rootless vs privileged-dind). */
215
215
  export type ImageNestedBuildMode = "none" | "docker-cli-only" | "rootless-buildkit" | "privileged-dind";
@@ -275,7 +275,7 @@ export interface ImageListFilter extends ImageViewer {
275
275
  /** Opaque keyset cursor from a prior page's `nextCursor`. */
276
276
  cursor?: string;
277
277
  }
278
- /** Raw SELECT row shape shared by BOTH SQL twins (design/158 S8 归位, A3 沉底 —
278
+ /** Raw SELECT row shape shared by BOTH SQL twins ([ref] S8 归位, A3 沉底 —
279
279
  * node-pg reads BIGINT `size_bytes` back as a string, hence `number | string | null`). */
280
280
  export interface ImageRow {
281
281
  id: string;
@@ -300,6 +300,6 @@ export interface ImageRow {
300
300
  created_at: Date | string;
301
301
  updated_at: Date | string;
302
302
  }
303
- /** SELECT row → {@link ImageIndexEntry} — shared by BOTH SQL twins (design/158 S8 归位, A3 沉底). */
303
+ /** SELECT row → {@link ImageIndexEntry} — shared by BOTH SQL twins ([ref] S8 归位, A3 沉底). */
304
304
  export declare function mapImageRow(r: ImageRow): ImageIndexEntry;
305
305
  //# sourceMappingURL=store-contracts.d.ts.map
@@ -4,7 +4,7 @@ import { type TaskListStore } from "@sema-agent/core";
4
4
  export declare const TASK_LIST_META_TABLE = "task_list_meta";
5
5
  export declare const TASK_LIST_ITEM_TABLE = "task_list_item";
6
6
  /**
7
- * #318 `sessionId ↦ 本表的身份键`:`session:<可读前缀>-<sha256(sessionId) 前 16 位>`。
7
+ * [ref] `sessionId ↦ 本表的身份键`:`session:<可读前缀>-<sha256(sessionId) 前 16 位>`。
8
8
  *
9
9
  * 🔴 为什么不直接把 sessionId 当 listKey:sessionId 是**调用方可自报**的不透明串(提交门
10
10
  * `http/server.ts` 只卡 ≤64 **字符** —— [#15] 刻意的宽松提交契约,不卡字节数也不卡字符集)。
@@ -17,7 +17,7 @@ export declare const TASK_LIST_ITEM_TABLE = "task_list_item";
17
17
  * 判据:确定性(同 sessionId 跨副本/跨重启恒同键)、字节安全(纯 ASCII,≤ 8+24+1+16 = 49 字节)、
18
18
  * 抗碰撞(摘要取**全串**,可读前缀只为运维肉眼对账)。
19
19
  *
20
- * `session:` 是**命名空间**位:design/147 §6 D2 的团队共享清单将来若按 team 分区,两族键同表不撞。
20
+ * `session:` 是**命名空间**位:[ref] §6 D2 的团队共享清单将来若按 team 分区,两族键同表不撞。
21
21
  * 同族先例 = `env-facts.ts` 的 `scratchpadSessionSegment`(文件名面)——刻意**不**复用彼此的实现:
22
22
  * 一个键空间改了算法不该把另一个键空间的存量行全孤儿化。
23
23
  *
@@ -28,7 +28,7 @@ export declare function taskListKeyFor(sessionId: string): string;
28
28
  export declare function ensureTiDBTaskListSchema(pool: MySqlPool): Promise<void>;
29
29
  export declare function ensurePgTaskListSchema(q: (text: string, params?: unknown[]) => Promise<unknown>): Promise<void>;
30
30
  /**
31
- * 整份清单删除(#318 / E21 会话删除级联;codex R1-[high] 验真后加)。
31
+ * 整份清单删除([ref] / E21 会话删除级联;codex R1-[high] 验真后加)。
32
32
  *
33
33
  * 语义 = 「这个 listKey 的清单**不存在过**」:item 行 + meta 行(高水位 `next_id` / 插入序
34
34
  * `next_sort`)一并抹掉。⚠️ **meta 行必须一起删**:留着它,同一个 listKey 被重新登记后
@@ -1,15 +1,15 @@
1
1
  /**
2
- * Cross-replica per-key CUMULATIVE cost quota (design/30 P0-1). A thin {@link QuotaTracker} over the
2
+ * Cross-replica per-key CUMULATIVE cost quota ([ref] P0-1). A thin {@link QuotaTracker} over the
3
3
  * shared {@link WriteBehindCounter}: atomic write-behind aggregation, eventually consistent (SOFT
4
4
  * limiting — boundary overspend is bounded by the flush interval and backstopped by the HARD per-task
5
- * `maxCostUsd` gate). `scope_key` is opaque (principal today; team/feature later — design/30 N3).
5
+ * `maxCostUsd` gate). `scope_key` is opaque (principal today; team/feature later — [ref] N3).
6
6
  */
7
7
  import type { Pool } from "mysql2/promise";
8
8
  import type { QuotaDecision, QuotaLimits, QuotaTracker } from "../observability/cost-quota.js";
9
9
  import { type CounterDegradeHook } from "./write-behind-counter.js";
10
10
  export declare class TiDBCostQuota implements QuotaTracker {
11
11
  private readonly counter;
12
- /** #322:限额=比较参数(行里只有花费);窗长换代经 counter.setWindowMs(桶键语义见那里)。 */
12
+ /** [ref]:限额=比较参数(行里只有花费);窗长换代经 counter.setWindowMs(桶键语义见那里)。 */
13
13
  private limitMicroUsd;
14
14
  private refreshRequested;
15
15
  private refreshIntervalMs;
@@ -1,6 +1,7 @@
1
1
  import mysql from "mysql2/promise";
2
2
  import { TIDB_APPROVAL_ASK_STATEMENTS } from "./approval-ask-store-sql.js";
3
3
  import { TIDB_MEMORY_OPTOUT_GRANT_STATEMENTS } from "./memory-optout-grant-store-sql.js";
4
+ import { TIDB_SESSION_CAPTURE_OPTOUT_STATEMENTS } from "./session-capture-record-store-sql.js";
4
5
  import { TIDB_LEADER_RUN_STATEMENTS } from "./leader-run-store-sql.js";
5
6
  import { TIDB_ADOPTION_LOG_STATEMENTS } from "./adoption-log-sql.js";
6
7
  import { TIDB_PERMISSION_RULE_STATEMENTS } from "./permission-rule-store-sql.js";
@@ -258,6 +259,13 @@ export const SCHEMA_STATEMENTS = [
258
259
  -- 可见)+ 基数截断。NULL = 无供给(规则车道没武装 / 命令说不出规则 / 这只 ask 规则清不掉),读口
259
260
  -- 据此省键而不是铸空数组。
260
261
  rule_suggestions TEXT NULL,
262
+ -- has_bidi_controls(S-30① / #356②;core 5.60.0 #438):bidi **在场位** —— core 在 park mint 写在
263
+ -- pendingAction(tool_approval 臂)上的那一位,put() 反范式成列,listPending 据它给 /v1/approvals 与
264
+ -- /v1/approvals/stream 的行铸 hasBidiControls:true(此前耐久运维队列一个位都没有:同一张卡
265
+ -- 「活着看得到告警、park 之后看不到」)。取值 **1 或 NULL、恒不写 0**:core 的契约是 true 或缺席
266
+ -- (缺席 = 没检出 ≠ 干净),一个 0 会把「没检出」谎成「已确认干净」。老行(本列诞生前 park 的)
267
+ -- NULL ⇒ 读口省键。clay 批 2026-07-26 TINYINT(1) 归一先例:布尔列 TiDB 侧 TINYINT(1)。
268
+ has_bidi_controls TINYINT(1) NULL,
261
269
  PRIMARY KEY (token),
262
270
  KEY idx_checkpoint_status_deadline (status, deadline),
263
271
  KEY idx_checkpoint_session_status (session_id, status)
@@ -589,6 +597,7 @@ export const SCHEMA_STATEMENTS = [
589
597
  ) COLLATE utf8mb4_bin`,
590
598
  ...TIDB_APPROVAL_ASK_STATEMENTS,
591
599
  ...TIDB_MEMORY_OPTOUT_GRANT_STATEMENTS,
600
+ ...TIDB_SESSION_CAPTURE_OPTOUT_STATEMENTS,
592
601
  ...TIDB_LEADER_RUN_STATEMENTS,
593
602
  `CREATE TABLE IF NOT EXISTS shared_memory_scope (
594
603
  -- 一个 org scope 一行。行缺席 = 该 org 从未开通 ⇒ 语义等价于 connected 且零 store(不是故障)。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Cross-replica per-key request rate limiter (design/30 P0-2) — a thin {@link RateGate} over the shared
2
+ * Cross-replica per-key request rate limiter ([ref] P0-2) — a thin {@link RateGate} over the shared
3
3
  * {@link WriteBehindCounter}. Like the in-memory {@link RateLimiter}, `check` both COUNTS the request
4
4
  * and decides; here the count is summed fleet-wide via atomic write-behind aggregation.
5
5
  *
@@ -13,7 +13,7 @@ import type { RateDecision, RateGate, RateLimits } from "../observability/rate-l
13
13
  import { type CounterDegradeHook } from "./write-behind-counter.js";
14
14
  export declare class TiDBRateLimiter implements RateGate {
15
15
  private readonly counter;
16
- /** 🔴 #322:限额是比较参数、不是行状态(SQL 腿的行里只有计数),所以换代只动它,库里一行都不用碰。 */
16
+ /** 🔴 [ref]:限额是比较参数、不是行状态(SQL 腿的行里只有计数),所以换代只动它,库里一行都不用碰。 */
17
17
  private limit;
18
18
  /** 装配点表达过的运维意图(「这条腿该有刷新环」)。关断哨兵靠它把环真正停掉/重开 —— 0 态零 SQL。 */
19
19
  private refreshRequested;
@@ -8,7 +8,7 @@ import type { Pool } from "mysql2/promise";
8
8
  * only if the branch leaf is still what the entry was built against. Two stateless runners that both
9
9
  * woke the same session can't silently fork — the loser gets `SessionError("conflict")` (catch with
10
10
  * `isSessionConflict`), with the `(session_id, seq)` primary key as the backstop for a racing writer
11
- * that grabbed the same seq. (A-071 件2 更正:`leaf_seq` **不是**判据 —— 它是无条件的 `SET leaf_seq =
11
+ * that grabbed the same seq. ([ref] 件2 更正:`leaf_seq` **不是**判据 —— 它是无条件的 `SET leaf_seq =
12
12
  * leaf_seq + 1` 计数器,在同一事务内重读出来给事件铸 `seq`,从不进 WHERE。)
13
13
  * - The in-memory base tree is the wake-time snapshot; every write is also mirrored into it so the
14
14
  * live harness keeps reading a consistent view. Wake is **bounded** to `[floor .. leaf]` (F3,
@@ -20,7 +20,7 @@ export declare class TiDBSessionStorage extends BaseSessionStorage {
20
20
  private readonly floorSeq;
21
21
  constructor(pool: Pool, sessionId: string, metadata: SessionMetadata, entries: SessionTreeEntry[], leafId: string | null, floorEntryId?: string | null, floorSeq?: number);
22
22
  /**
23
- * [976] S3 RB-14 pull seam — `SessionStorage.getEpochAnchor?()`: the nearest epoch carrier BELOW the
23
+ * [ref] S3 [ref] pull seam — `SessionStorage.getEpochAnchor?()`: the nearest epoch carrier BELOW the
24
24
  * bounded-wake floor. core's `Session.getPromptEpoch()` (≥1.305) calls this only when the in-window
25
25
  * branch walk finds no carrier — i.e. a rewind/resumeAt cut inside the kept tail, where the compaction
26
26
  * restatement is a DESCENDANT of the cut and the root pin sits under the floor. Semantics per core's