@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
@@ -1,5 +1,5 @@
1
1
  import { type Checkpoint, type CheckpointSummary, type CheckpointToken, type PendingSteerInput, type ReopenReason, type ResolveExpectation, type ResumeOutcome, type StoreDurability, type StoreFidelity } from "@sema-agent/core";
2
- import { type DecidedApprovalRecord, type PendingCheckpoint } from "./checkpoint-store-sql.js";
2
+ import { type DecidedApprovalRecord, type PendingCheckpoint, type PendingRowBinding } from "./checkpoint-store-sql.js";
3
3
  export interface LocalCheckpointStoreOptions {
4
4
  /** taskId join for the pending card (the local FileRunStore's `getActiveTaskId`). Absent ⇒ `taskId: null`. */
5
5
  getActiveTaskId?: (sessionId: string) => Promise<string | undefined>;
@@ -8,11 +8,11 @@ export interface LocalCheckpointStoreOptions {
8
8
  ownerOf?: (sessionId: string) => Promise<string | null | undefined>;
9
9
  }
10
10
  export declare class LocalCheckpointStore {
11
- /** #270 车1:托管留存声明 —— **诚实的 none**(与 local session 店同一条判据:本店的行没有按期删除的腿;
11
+ /** [ref] 车1:托管留存声明 —— **诚实的 none**(与 local session 店同一条判据:本店的行没有按期删除的腿;
12
12
  * 留存三方法只实现在 SQL 聚合店上)。locked policy + 本店 ⇒ core 的门拒启,那是契约的正确行为。 */
13
13
  readonly retention: import("@sema-agent/core").RetentionDeclaration;
14
14
  /**
15
- * `CheckpointStore.durability` 声明(#167 欠账,#168 件5)——**如实按内核判**:本类的内核是 core 的
15
+ * `CheckpointStore.durability` 声明([ref] 欠账,[ref] 件5)——**如实按内核判**:本类的内核是 core 的
16
16
  * `FileCheckpointStore`(crash-safe ledger + snapshot,自身声明 `"durable"`),本地 scope 注册表也落
17
17
  * 在同一个盘上目录里 ⇒ 进程重启后 park 全部还在、还赎得回,`"durable"` 是诚实读数而不是抬举。
18
18
  *
@@ -21,17 +21,17 @@ export declare class LocalCheckpointStore {
21
21
  */
22
22
  readonly durability: StoreDurability;
23
23
  /**
24
- * `CheckpointStore.fidelity` 声明(core 5.17.0 [3052] 提货批 #172)——**如实按内核判**,与 durability
24
+ * `CheckpointStore.fidelity` 声明(core 5.17.0 [ref] 提货批 [ref])——**如实按内核判**,与 durability
25
25
  * 同一条判据:本类的读写内核是 core 的 `FileCheckpointStore`,它自己声明 `"json"`(盘上是 JSON 行),
26
26
  * 包装层只加 scope/session 索引与 ctx 附属文件,不改这条 round-trip 的宽度 ⇒ 抄内核的读数是诚实的。
27
27
  *
28
28
  * ⚠️ 包装类**不继承**被包装者的声明(本类是委派不是子类),所以这一格必须自己写。它与内核那一格
29
- * 是否仍然一致由测试盯着(`wiring-governance-operator.test.ts` 的 #172 组直接读内核那一格对表)——
29
+ * 是否仍然一致由测试盯着(`wiring-governance-operator.test.ts` 的 [ref] 组直接读内核那一格对表)——
30
30
  * 内核哪天改宽度,包装层的声明会被那条钉当场揪出来,而不是靠人记得同步。
31
31
  */
32
32
  readonly fidelity: StoreFidelity;
33
33
  /**
34
- * `CheckpointStore.redecision` 声明(core 5.22.0 F-012 L2/L3;[3342] clay 裁放行)——**如实按内核判**,
34
+ * `CheckpointStore.redecision` 声明(core 5.22.0 F-012 L2/L3;[ref] clay 裁放行)——**如实按内核判**,
35
35
  * 与 durability/fidelity 同一条判据:内核 core `FileCheckpointStore` **自己**声明 `{ reopen: true }`,
36
36
  * 本类的 {@link LocalCheckpointStore.reopen} 纯委派给它 ⇒ 抄内核的读数是诚实的。包装类**不继承**被
37
37
  * 包装者的声明(委派不是子类),所以这一格必须自己写。`validatingLease` 不声明(内核也没声明)。
@@ -46,7 +46,7 @@ export declare class LocalCheckpointStore {
46
46
  private readonly ctxDir;
47
47
  private readonly tmpDir;
48
48
  private readonly scopes;
49
- /** [868] sessionId → every token ever put for it — the service-side index that stands in for the SQL twins'
49
+ /** [ref] sessionId → every token ever put for it — the service-side index that stands in for the SQL twins'
50
50
  * `WHERE checkpoint.session_id = ?` on NON-pending rows (core's File store enumerates pending only via
51
51
  * listByScope; get(token) is the sole read for resolved/expired rows, so cross-status session queries need
52
52
  * this registry). Registered BEFORE the inner put (same crash direction as the scopes registry: a stale
@@ -63,7 +63,7 @@ export declare class LocalCheckpointStore {
63
63
  get(token: CheckpointToken): Promise<Checkpoint | null>;
64
64
  resolve(token: CheckpointToken, scope: string, outcome: ResumeOutcome, expect?: ResolveExpectation): Promise<boolean>;
65
65
  reopen(token: CheckpointToken, scope: string, reason: ReopenReason): Promise<boolean>;
66
- /** core 5.14.0(#147):入参是 `PendingSteerInput`(text/trusted + 可选 actor/inputId/priority),不是
66
+ /** core 5.14.0([ref]):入参是 `PendingSteerInput`(text/trusted + 可选 actor/inputId/priority),不是
67
67
  * 两键单座 —— 形参窄成 `{text,trusted}` 会**静默丢掉**署名与幂等键(TS 的方法参数是双变的,窄形不
68
68
  * 报错,只是把三个可选键从类型上抹掉,调用点再也传不进来)。队列语义与边界全在被包的 core
69
69
  * `FileCheckpointStore` 里,本 wrapper 只做转发。 */
@@ -81,21 +81,29 @@ export declare class LocalCheckpointStore {
81
81
  private pendings;
82
82
  /** Operator approval queue — the same NON-secret card as the SQL twins (never the token). */
83
83
  listPending(scope?: string): Promise<PendingCheckpoint[]>;
84
- findPendingTokenBySession(sessionId: string, scope?: string): Promise<CheckpointToken | null>;
85
- /** [868] read-only probe face: does this session have an EXPIRED checkpoint row? The local twin of the SQL
84
+ /**
85
+ * [ref]:与 SQL 孪生**同判**的 session 键读口 —— `binding.gateKinds` 过滤门型、序恒「最新优先,token 兜平局」
86
+ * ({@link pendingRowPrecedes} 是两 twin 共用的判据;语义全文见 SQL 侧 `PendingRowBinding` 顶注)。
87
+ * 修前是「扫描序里第一条 sessionId 相等的」:`pendings()` 按 scope 注册表 + `listByScope` 顺序走,同
88
+ * session 两条 pending 时答哪条取决于 sidecar 里 scope 的插入序 —— 与 SQL 无序 `LIMIT 1` 同病。
89
+ */
90
+ findPendingTokenBySession(sessionId: string, scope?: string, binding?: PendingRowBinding): Promise<CheckpointToken | null>;
91
+ /** [ref]:候选集 → 读口该答的那一条(过滤 sessionId + 门型,再取「最新优先」)。 */
92
+ private pickPendingRow;
93
+ /** [ref] read-only probe face: does this session have an EXPIRED checkpoint row? The local twin of the SQL
86
94
  * `EXISTS (SELECT 1 FROM checkpoint ce WHERE ce.session_id = ? AND ce.status = 'expired')` that drives the
87
95
  * run stores' failSuspendedWithExpiredCheckpoint. Scans the session→token index (get(token) is the only
88
96
  * cross-status read core's File store offers); an index entry whose inner row vanished is pruned lazily.
89
97
  * Backed by a persisted registry, so it stays honest — never a guessed "true".
90
98
  * ⚠️ 存量限制(codex M2,如实):索引随 put 增量建立,无升级迁移——本版本部署前已存在的 checkpoint 不在
91
99
  * 索引里,其 expired 对本探针不可见(core File store 的 listByScope 是 pending-only,无法枚举历史行回填)。
92
- * 旧存量锁死的恢复把手 = cancel verb([868]①,不依赖本索引);增量行全覆盖。 */
100
+ * 旧存量锁死的恢复把手 = cancel verb([ref]①,不依赖本索引);增量行全覆盖。 */
93
101
  hasExpiredBySession(sessionId: string): Promise<boolean>;
94
102
  /**
95
- * #368 件1 —— SQL 孪生 `findDecidedApprovalsForBinding` 的本地形(判据、词表、失败方向逐条同源;
103
+ * [ref] 件1 —— SQL 孪生 `findDecidedApprovalsForBinding` 的本地形(判据、词表、失败方向逐条同源;
96
104
  * 那处顶注是唯一真源,这里只记两处**本地形自己的**差别)。
97
105
  *
98
- * · 枚举面走 [868] 的 `sessionTokens` 索引 —— 与 `hasExpiredBySession` 同一条路(core 的 File store
106
+ * · 枚举面走 [ref] 的 `sessionTokens` 索引 —— 与 `hasExpiredBySession` 同一条路(core 的 File store
99
107
  * 只能 pending-only 枚举,跨态读只有 `get(token)`),所以它那条**存量限制**在这里逐字同样成立:
100
108
  * 索引建立之前 park 的老行对本口不可见 ⇒ 回放判别不出 ⇒ 调用方逐字回落 404(保守方向)。
101
109
  * · **没有排序**:本口交出全部命中行,由调用方按「判词一致才回放」判(理由见 SQL 孪生顶注的
@@ -104,16 +112,17 @@ export declare class LocalCheckpointStore {
104
112
  * 投了就是「SQL 车道有、local 车道没有」的键集分岔。
105
113
  */
106
114
  findDecidedApprovalsForBinding(sessionId: string, boundCallId: string): Promise<DecidedApprovalRecord[]>;
107
- /** `undefined` = no pending row; else the owner scope (local scopes are always strings — never null). */
108
- peekPendingScope(sessionId: string): Promise<string | null | undefined>;
115
+ /** `undefined` = no pending row; else the owner scope (local scopes are always strings — never null).
116
+ * [ref]:与 `findPendingTokenBySession` 同一个 {@link pickPendingRow}(同 binding ⇒ 同一行)。 */
117
+ peekPendingScope(sessionId: string, binding?: PendingRowBinding): Promise<string | null | undefined>;
109
118
  /**
110
- * design/80 D-D global expiry sweep — same kind-split as the TiDB twin: the deadline branch abort-expires
119
+ * [ref] D-D global expiry sweep — same kind-split as the TiDB twin: the deadline branch abort-expires
111
120
  * every kind EXCEPT a human/irreversible_ask approval gate (those get the graceful resolve-DENY via
112
121
  * listExpiredApprovalGates), with the AskUserQuestion carve-back (denying a question is incoherent → expire);
113
122
  * the terminal_at_ms branch (derived read-time via the SAME formula the TiDB put stamps) abort-expires ANY kind.
114
123
  */
115
124
  reapExpired(cutoff: number): Promise<number>;
116
- /** design/80 D-D SLA deny-sweep input — pending human/irreversible_ask gates past deadline (excl. AskUserQuestion). */
125
+ /** [ref] D-D SLA deny-sweep input — pending human/irreversible_ask gates past deadline (excl. AskUserQuestion). */
117
126
  listExpiredApprovalGates(cutoff: number, limit?: number): Promise<Array<{
118
127
  sessionId: string;
119
128
  scope: string;
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, readdirSync, renameSync, unlinkSync, mkdirSyn
3
3
  import { join } from "node:path";
4
4
  import { isApprovalGateKind } from "../tool-approval.js";
5
5
  import { FileCheckpointStore, atomicWriteFile, sanitizePathComponent, } from "@sema-agent/core";
6
- import { approvalDecisionOfWinner, approvalPayloadFingerprint, boundedRuleOffers, boundedToolInput, TERMINAL_BACKSTOP_MS, TERMINAL_GRACE_MS } from "./checkpoint-store-sql.js";
6
+ import { approvalDecisionOfWinner, approvalPayloadFingerprint, boundedRuleOffers, boundedToolInput, pendingRowPrecedes, TERMINAL_BACKSTOP_MS, TERMINAL_GRACE_MS } from "./checkpoint-store-sql.js";
7
7
  import { UNMANAGED_RETENTION } from "./retention-store-sql.js";
8
8
  function terminalAtOf(cp) {
9
9
  return Math.max(cp.createdAt + TERMINAL_BACKSTOP_MS, (cp.deadline ?? 0) + TERMINAL_GRACE_MS);
@@ -159,15 +159,28 @@ export class LocalCheckpointStore {
159
159
  const rs = boundedRuleOffers(pa?.ruleOffers);
160
160
  return rs !== undefined ? { ruleOffers: rs } : {};
161
161
  })(),
162
+ ...(pa?.hasBidiControls === true ? { hasBidiControls: true } : {}),
162
163
  });
163
164
  }
164
165
  return rows.sort((a, b) => (b.riskDescriptor?.severity ?? 0) - (a.riskDescriptor?.severity ?? 0) || a.createdAt - b.createdAt);
165
166
  }
166
- async findPendingTokenBySession(sessionId, scope) {
167
- for (const { token, cp } of await this.pendings(scope))
168
- if (cp.sessionId === sessionId)
169
- return token;
170
- return null;
167
+ async findPendingTokenBySession(sessionId, scope, binding) {
168
+ return this.pickPendingRow(await this.pendings(scope || undefined), sessionId, binding)?.token ?? null;
169
+ }
170
+ pickPendingRow(rows, sessionId, binding) {
171
+ let best;
172
+ for (const row of rows) {
173
+ if (row.cp.sessionId !== sessionId)
174
+ continue;
175
+ if (binding?.gateKinds !== undefined) {
176
+ const kind = row.cp.gate?.kind;
177
+ if (kind === undefined || !binding.gateKinds.includes(kind))
178
+ continue;
179
+ }
180
+ if (best === undefined || pendingRowPrecedes({ createdAt: row.cp.createdAt, token: row.token }, { createdAt: best.cp.createdAt, token: best.token }, binding?.pick))
181
+ best = row;
182
+ }
183
+ return best;
171
184
  }
172
185
  async hasExpiredBySession(sessionId) {
173
186
  const tokens = this.sessionTokens.get(sessionId);
@@ -216,11 +229,8 @@ export class LocalCheckpointStore {
216
229
  }
217
230
  return out;
218
231
  }
219
- async peekPendingScope(sessionId) {
220
- for (const { cp } of await this.pendings())
221
- if (cp.sessionId === sessionId)
222
- return cp.scope;
223
- return undefined;
232
+ async peekPendingScope(sessionId, binding) {
233
+ return this.pickPendingRow(await this.pendings(), sessionId, binding)?.cp.scope;
224
234
  }
225
235
  async reapExpired(cutoff) {
226
236
  let n = 0;
@@ -3,7 +3,7 @@ import type { SessionSummary } from "./store-contracts.js";
3
3
  import { type StagingHandle } from "../session-sync-kernel.js";
4
4
  export declare class LocalSessionStore implements SessionStore {
5
5
  private readonly repo;
6
- /** #270 车1:托管留存声明 —— **诚实的 none**。本店的行没有任何按期删除的腿(留存 lane 的三方法只实现在
6
+ /** [ref] 车1:托管留存声明 —— **诚实的 none**。本店的行没有任何按期删除的腿(留存 lane 的三方法只实现在
7
7
  * SQL 聚合店上),所以 locked policy + 本店 ⇒ core 的 `assertRetentionCapability` 拒启,这是契约的
8
8
  * **正确行为**不是缺口(要留存治理先上 DB 后端;设计稿 §1「不做清单」逐字)。缺席也会被读成 none,
9
9
  * 显式写出来是文档义务:沉默表达不出「我核对过我的介质就是删不了」。 */
@@ -53,7 +53,7 @@ export declare class LocalSessionStore implements SessionStore {
53
53
  * lastActivity sidecar ON PURPOSE (that format is a #10 clobber area); titles are write-once + ultra-low-rate
54
54
  * (one per session, ever), so a plain read-modify-write with tmp+rename per write is enough — no debounce.
55
55
  *
56
- * 🔴 CROSS-INSTANCE (fixed 2026-07-25, blackboard [1684] — core's "per-instance state" defect class):
56
+ * 🔴 CROSS-INSTANCE (fixed 2026-07-25, blackboard [ref] — core's "per-instance state" defect class):
57
57
  * these three used to be INSTANCE fields, which is exactly the shape core described — «the backend is shared
58
58
  * more widely than the object, but the state and the lock hang off the object». Two `LocalSessionStore`s over
59
59
  * the SAME dataDir each held their own `titles` map and their own write chain, so a real concurrency probe
@@ -124,7 +124,7 @@ export declare class LocalSessionStore implements SessionStore {
124
124
  * 现在 Map miss 时探 repo:盘上在 ⇒ 按 load() 两处懒回填早已写下的同一判据回填 `null`(registered
125
125
  * ownerless);repo 真没有才 `undefined`。SQL 孪生无此形(owner 在 session_meta 行,重启无损)。 */
126
126
  ownerOf(sessionId: string): Promise<string | null | undefined>;
127
- /** [1196] 六轮复审:owner+leafId 原子快照——单线程 JS 内两同步/顺序读之间无 await 打断 owner 判定
127
+ /** [ref] 六轮复审:owner+leafId 原子快照——单线程 JS 内两同步/顺序读之间无 await 打断 owner 判定
128
128
  * (owner 先取快照,leaf 读后 owner 复核,变了=undefined 视作删除中,调用方按删处理)。 */
129
129
  getHead(sessionId: string): Promise<{
130
130
  owner: string | null;
@@ -161,7 +161,7 @@ export declare class LocalSessionStore implements SessionStore {
161
161
  */
162
162
  listSessions(opts: {
163
163
  owner?: string;
164
- /** [4198] 窄互认第二臂的第三条件(SQL 孪生里是 `owner IS NULL` 谓词;此处是同义的 `owner === null` 放行)。 */
164
+ /** [ref] 窄互认第二臂的第三条件(SQL 孪生里是 `owner IS NULL` 谓词;此处是同义的 `owner === null` 放行)。 */
165
165
  includeUnowned?: boolean;
166
166
  cursor?: {
167
167
  lastActivityAt: string;
@@ -173,7 +173,7 @@ export declare class LocalSessionStore implements SessionStore {
173
173
  /** K-5c (core 1.155 SessionStore seam): core's Runner calls this at runTask START with the run's taskId, so the
174
174
  * latest run surfaces as `lastRunId` on listSessions even while it is still running/suspended (the local backend
175
175
  * has no runs ledger to derive it from, unlike the TiDB/PG twins). In-memory, last-write-wins per session.
176
- * #499(core 5.65 增量批,**有意缓议**):core 的第三参 engine runId 在此**尚未消费**——它唯一的
176
+ * [ref](core 5.65 增量批,**有意缓议**):core 的第三参 engine runId 在此**尚未消费**——它唯一的
177
177
  * 合法出口是 listSessions 行上的 `lastTaskRunId`,而 `SessionSummary` 是 canonical spec 的**闭集**
178
178
  * (sema-sdk spec/openapi.yaml `additionalProperties:false`,producer-contract sessionsList 格咬着),
179
179
  * 加键是跨仓 spec 节拍的事。spec 开键那一批再落:map 值扩成 `{taskId, runId?}` + 两座同动清座语义
@@ -1,9 +1,9 @@
1
1
  /**
2
- * MailboxStore SQL twins(design/151 S3c server pg 半场,[1530] 提货单①)——core teammate 信箱
2
+ * MailboxStore SQL twins([ref] S3c server pg 半场,[ref] 提货单①)——core teammate 信箱
3
3
  * (SendMessage 链)的 TiDB/PG 双方言实现。挂载缝 = S3c 行为车的 `RunnerDeps.mailboxStore`(core
4
- * 命名预告,[1530]§三);本文件先就绪 store 半场,行为车到货接线。
4
+ * 命名预告,[ref]§三);本文件先就绪 store 半场,行为车到货接线。
5
5
  *
6
- * 语义真源 = core `InMemoryMailboxStore`(dist/core/mailbox-store.js)+ [1530] 定谳(core 1.372
6
+ * 语义真源 = core `InMemoryMailboxStore`(dist/core/mailbox-store.js)+ [ref] 定谳(core 1.372
7
7
  * 终版文本,conformance 无两可):
8
8
  * 1. **同主重 claim = 续期 + 纳新**(crash-retry 正形):活 lease 只挡**别的** owner;同 owner 任意
9
9
  * 时刻重 claim 重设 TTL 并拿到当前全部未 ack 消息(maxSeq 随最新行走)。
@@ -13,12 +13,12 @@
13
13
  * 时顺带清 lease(全量 ack = 释放)。
14
14
  * 4. **lease 过期判 = 严格 `expiresAt > now` 才挡**;`releaseLease` 只在 owner 匹配时清。
15
15
  * 5. `peekCount` 含已 lease 消息(可见性 ≠ lease 态);空盒 claim = null(box 行在而消息 0 也 null)。
16
- * 6. **reap = SQL 全量真扫**(core File 实现只扫已加载盒 = 进程内 backstop,[1530] 确认 SQL 是全量
16
+ * 6. **reap = SQL 全量真扫**(core File 实现只扫已加载盒 = 进程内 backstop,[ref] 确认 SQL 是全量
17
17
  * 真扫的正确层):`maxAgeMs` 缺省 → 0;按盒 newest `sentAt < now - maxAgeMs` 删整盒;空盒(有
18
18
  * box 行无消息)不删(InMemory 同形——`newest === undefined` 不删)。
19
19
  *
20
20
  * 键列 = 字节等价(TiDB VARBINARY / PG COLLATE "C",roster F2 案):scope/handle/lease_owner 的
21
- * `=` 必须纯字节——PAD SPACE 近撞不得穿隔离/抢别人 lease。PG unstorable bytes([1439] 三层定谳):
21
+ * `=` 必须纯字节——PAD SPACE 近撞不得穿隔离/抢别人 lease。PG unstorable bytes([ref] 三层定谳):
22
22
  * `content` 是消息**内容面**(收件人将读到、注入对话)→ 与 PG 转录 payload 同族 lossy(pgSanitizeText,
23
23
  * U+FFFD 标记,内容不失行);**身份键 scope/handle/owner/from 拒绝式**(pgHasUnstorable →
24
24
  * PgUnstorableError fail-loud——attribution/路由键清洗形变 = 行与查询键错位,协议数据同向)。TiDB
@@ -61,7 +61,7 @@ export declare class PgMailboxStore implements MailboxStore {
61
61
  private readonly pool;
62
62
  constructor(pool: PgPool);
63
63
  private tx;
64
- /** 身份键拒绝式([1439] 协议纪律):scope/handle/owner/from 清洗形变 = 路由/attribution 错位。 */
64
+ /** 身份键拒绝式([ref] 协议纪律):scope/handle/owner/from 清洗形变 = 路由/attribution 错位。 */
65
65
  private assertIdentity;
66
66
  append(scope: string, handle: string, msg: MailboxAppendMessage): Promise<number>;
67
67
  claimLease(scope: string, handle: string, owner: string, ttlMs: number, now?: number): Promise<MailboxLease | null>;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/234 —— embedder **指纹门**(清空重建形,clay 终裁 [3647]⑤ 方向;稿=sema-internal
2
+ * [ref] —— embedder **指纹门**(清空重建形,clay 终裁 [ref]⑤ 方向;稿=sema-internal
3
3
  * `server/design/design-234-embedder-fingerprint-20260812.md` v1+v2)。
4
4
  *
5
5
  * ## 病灶
@@ -71,7 +71,7 @@
71
71
  * 主动回填件(清空后不回填,行被 patch 时自然重嵌)/ 行级 embedder 记账列(结构性根治滚动窗)/
72
72
  * pgvector 接线件的列 dim 校验 / TiDB 向量面(v1 lexical only)。
73
73
  *
74
- * 🔴 **不回填的真代价(#234 定界车 2026-08-14 实测更正,稿 §4/§V3 说轻了一档)**:稿把代价写成「那些行
74
+ * 🔴 **不回填的真代价([ref] 定界车 2026-08-14 实测更正,稿 §4/§V3 说轻了一档)**:稿把代价写成「那些行
75
75
  * 长期停留 lexical 档」,读起来像**排序退化**;真码是**可达性悬崖**——`memory-engine-pg.ts` 的进程内腿
76
76
  * 对无向量行落 `jaccardDistance`,core 的该函数在**零词交集**时返回 `null`,`search` 当场 `continue`,
77
77
  * 行被**丢出结果集**;仍有向量的行则走余弦、不被这道门丢(前提是查询侧也嵌得出来——embedder 故障那一
@@ -50,7 +50,7 @@ export declare class PgMemoryEngineBackend implements MemoryBackend {
50
50
  private readonly history?;
51
51
  /** Cumulative lost-row count — audit-line breakage must itself be auditable. */
52
52
  private historyRowsLost;
53
- /** design/81 rung indicator — same semantics as PgMemoryStore.vectorMode. */
53
+ /** [ref] rung indicator — same semantics as PgMemoryStore.vectorMode. */
54
54
  get vectorMode(): "native" | "portable" | "lexical";
55
55
  constructor(query: PgQueryFn, opts?: PgMemoryEngineBackendOptions);
56
56
  /** The embed/search haystack — BYTE-EQUAL to FileBackend's lexical haystack (file-backend search). */
@@ -38,7 +38,7 @@ export declare class TiDBMemoryEngineBackend implements MemoryBackend {
38
38
  private readonly history?;
39
39
  /** Cumulative lost-row count — audit-line breakage must itself be auditable. */
40
40
  private historyRowsLost;
41
- /** design/81 rung indicator — TiDB v1 sits on the lexical floor (Pg twin parity surface). */
41
+ /** [ref] rung indicator — TiDB v1 sits on the lexical floor (Pg twin parity surface). */
42
42
  get vectorMode(): "lexical";
43
43
  constructor(pool: Pool, opts?: TiDBMemoryEngineBackendOptions);
44
44
  private selectRows;
@@ -1,11 +1,11 @@
1
- /** R5(车A [3191] 欠账,批γ 落地;#271 件1 补齐写口):memory 面的键宽写前守卫。
1
+ /** R5(车A [ref] 欠账,批γ 落地;[ref] 件1 补齐写口):memory 面的键宽写前守卫。
2
2
  * 列宽收窄后,模型/调用方可控的键(条目名 slug、租户盘 scope)超宽此前落裸 SQL 错(PG
3
3
  * `value too long`)或非严格 MySQL 静默截断(截断=两个不同的键折叠成同一行=**条目互串 / 两个租户
4
4
  * 的盘塌成一个**,最危险形)。写前响亮拒,错误可分类。
5
5
  * 列宽同源门=test/key-width-guards.test.ts(守卫常量 vs 两方言 DDL 逐字对表);写口在场门=同文件
6
- * 「#271 件1」组(超宽键一条写语句都不许发出 seam)。
6
+ * 「[ref] 件1」组(超宽键一条写语句都不许发出 seam)。
7
7
  *
8
- * **本文件是这两个宽度的唯一属主**(#271 件1):scope 守卫此前住在 `src/memory-scope.ts`,只被
8
+ * **本文件是这两个宽度的唯一属主**([ref] 件1):scope 守卫此前住在 `src/memory-scope.ts`,只被
9
9
  * `memoryScopeFor` 的产出处消费,而 store 写口全无——同一个列宽有两个居所、两半消费面,正是
10
10
  * 「守卫在位≠写口接上」那类缺口的温床。`memory-scope.ts` 现在只**再导出**本文件的这两个符号
11
11
  * (旧 import 路径逐字不变)。 */
@@ -1,11 +1,11 @@
1
1
  /**
2
- * design/383 §3.1 / S-50 §一(S-49 S-2)—— per-principal **memory-capture opt-out 授权表**
2
+ * [ref] §3.1 / [ref] §一([ref] S-2)—— per-principal **memory-capture opt-out 授权表**
3
3
  * `memory_optout_grant`:`RuntimeCaps.allowMemoryOptOut` 的本地 verdict 源 + operator 管理面的持久层。
4
- * SINGLE-FILE DUAL-DIALECT(design/158 A12 形,照 approval-ask-store-sql.ts:一个 `SqlMemoryOptOutGrantStore`
4
+ * SINGLE-FILE DUAL-DIALECT([ref] A12 形,照 approval-ask-store-sql.ts:一个 `SqlMemoryOptOutGrantStore`
5
5
  * 接 `SqlDriver`,两个薄 ctor 子类落方言绑定)。
6
6
  *
7
- * ── 数据形(S-50 §1.1 的施工形;**稿偏离如实记**)────────────────────────────────────────────────
8
- * S-50 稿写的是 `PRIMARY KEY (org_id, principal)` + `principal=''` 为 org 级缺省哨兵行。亲读本仓
7
+ * ── 数据形([ref] §1.1 的施工形;**稿偏离如实记**)────────────────────────────────────────────────
8
+ * [ref] 稿写的是 `PRIMARY KEY (org_id, principal)` + `principal=''` 为 org 级缺省哨兵行。亲读本仓
9
9
  * (侦察 2026-08-30):server **没有 org 身份维** —— 租户维 = 单 `principal`(`gatedPrincipal` 供给),
10
10
  * `org` 只是记忆 scope 目录里的一个词(`org-memory-admission.ts`:授权目录三态,不是 principal 的属性),
11
11
  * 任何 SQL 表都没有 `org_id` 列。给表铸一根没人能填的 `org_id` 就是编数据(「不编」律)。所以:
@@ -21,7 +21,7 @@
21
21
  * updated_at_ms BIGINT NOT NULL 审计:何时
22
22
  * updated_by VARCHAR(190) 审计:谁改的(operator principal,恒在场 —— 四端点都过 operator 门)
23
23
  * note VARCHAR(500) NULL 审计:为何(可缺席,不编)
24
- * 审计**行内**,不另建审计表(S-50 §1.3 v1 体量裁定;变更史需求真出现再升 retention 面同族表)。
24
+ * 审计**行内**,不另建审计表([ref] §1.3 v1 体量裁定;变更史需求真出现再升 retention 面同族表)。
25
25
  *
26
26
  * ── 方言差异(显式写在调用点,A12 doctrine)──────────────────────────────────────────────────────
27
27
  * · `?` vs `$n` 占位符;
@@ -31,7 +31,7 @@
31
31
  * 本键最怕的方向)。
32
32
  *
33
33
  * ── 缓存姿态 ────────────────────────────────────────────────────────────────────────────────────
34
- * **零缓存直读**(S-50 §1.4 撤销窗:server 只保证 resolver 下一次读到新 verdict)。core 每任务 prepare 调
34
+ * **零缓存直读**([ref] §1.4 撤销窗:server 只保证 resolver 下一次读到新 verdict)。core 每任务 prepare 调
35
35
  * 一次 resolver;本表两行以内的 PK 点查在任何 SQL 后端都是亚毫秒级,加缓存 = 为不存在的负载引入一致性窗
36
36
  * (若未来实测成压力源,升级形 = TTL ≤ 60s 且写穿,稿已裁)。
37
37
  */
@@ -41,9 +41,9 @@ import type { PgQueryFn } from "./pg-query.js";
41
41
  import { type SqlDriver, type SqlDialect } from "./sql-driver.js";
42
42
  import type { MemoryOptOutVerdictSource } from "../runtime-caps-resolver.js";
43
43
  export declare const MEMORY_OPTOUT_GRANT_TABLE = "memory_optout_grant";
44
- /** 部署缺省哨兵行的 principal 值(S-50 §1.1;'' 是**真值**不是缺席 —— NOT NULL PK)。 */
44
+ /** 部署缺省哨兵行的 principal 值([ref] §1.1;'' 是**真值**不是缺席 —— NOT NULL PK)。 */
45
45
  export declare const MEMORY_OPTOUT_DEFAULT_PRINCIPAL = "";
46
- /** 一行的读投影(wire 形逐字:S-50 §1.3 的 `{principal, allow, updatedAtMs, updatedBy, note?}`)。 */
46
+ /** 一行的读投影(wire 形逐字:[ref] §1.3 的 `{principal, allow, updatedAtMs, updatedBy, note?}`)。 */
47
47
  export interface MemoryOptOutGrantRow {
48
48
  principal: string;
49
49
  allow: boolean;
@@ -59,7 +59,7 @@ export interface MemoryOptOutGrantFoldRow {
59
59
  }
60
60
  export type MemoryOptOutVerdictSourceKind = "principal" | "deployment-default" | "code-default";
61
61
  /**
62
- * S-50 §1.1 **F6 折叠律**(纯函数,`build*`:产纯数据):per-principal 行 → 部署缺省哨兵行 → 代码缺省 allow。
62
+ * [ref] §1.1 **F6 折叠律**(纯函数,`build*`:产纯数据):per-principal 行 → 部署缺省哨兵行 → 代码缺省 allow。
63
63
  * 三层折叠后**恒能给显式 verdict**。`principal` 缺席(匿名/系统 run)只看缺省行 —— 别人的覆盖行绝不算到
64
64
  * 匿名头上。rows 里不相干的 principal 行被忽略(SQL 层已按 `IN (?, '')` 收窄,这里再判一次是让纯函数对
65
65
  * 任意输入都正确,不依赖调用方的查询形)。
@@ -68,7 +68,7 @@ export declare function buildMemoryOptOutVerdict(rows: readonly MemoryOptOutGran
68
68
  allow: boolean;
69
69
  source: MemoryOptOutVerdictSourceKind;
70
70
  };
71
- /** 管理面(S-50 §1.3 四端点)+ resolver 面(S-1)共用的店接口。 */
71
+ /** 管理面([ref] §1.3 四端点)+ resolver 面(S-1)共用的店接口。 */
72
72
  export interface MemoryOptOutGrantStore extends MemoryOptOutVerdictSource {
73
73
  /** 全表读投影:缺省行(缺席 ⇒ null,不编)+ 全部覆盖行(按 principal 升序,稳定)。 */
74
74
  list(): Promise<{
@@ -1,19 +1,19 @@
1
1
  /**
2
- * #307 件6(core 5.46.0 提货批,design/336 §2.3-2)—— **external-origin 标记不可变律**的 SQL 孪生实现。
2
+ * [ref] 件6(core 5.46.0 提货批,[ref] §2.3-2)—— **external-origin 标记不可变律**的 SQL 孪生实现。
3
3
  *
4
4
  * ## 这条法是什么、为什么落在本仓
5
5
  *
6
- * design/336 slice 1 给「已暴露会话」的普通记忆写打上引擎铸的 `frontmatter.origin` 标记(taint +
7
- * 成因闭集 + 铸造时刻),取代 design/178 那种「整条隔离」的全禁。标记的全部价值来自**不可洗白**:
6
+ * [ref] slice 1 给「已暴露会话」的普通记忆写打上引擎铸的 `frontmatter.origin` 标记(taint +
7
+ * 成因闭集 + 铸造时刻),取代 [ref] 那种「整条隔离」的全禁。标记的全部价值来自**不可洗白**:
8
8
  * 一旦某个 id 的**已提交**状态带了标记,之后**任何**写法(update / 裸 add / `guard:"absent"` add /
9
9
  * 同批 delete+re-add)都必须把它 DEEP-EQUAL 地带下去,否则拒绝。合法出口只有一个 —— **已提交的**
10
10
  * 墓碑(上一批真的 delete 掉了),那之后这个 id 开始一段未标记的新生命。
11
11
  *
12
12
  * core 5.46.0 把这条法写进了**记忆后端契约试剂盒**
13
13
  * (`dist/core/memory-engine/memory-backend-contract.js`,新增一条必跑条目),而该契约**压在本仓身上**:
14
- * core 只养 File backend,Pg / TiDB 两方言归 server。提货当天真双库实跑的红读数(A-002.21 教训的
14
+ * core 只养 File backend,Pg / TiDB 两方言归 server。提货当天真双库实跑的红读数([ref] 教训的
15
15
  * 直接兑现,不是自我声明「本批无 SQL 面」):
16
- * `[engine=tidb] contract case "design/336: origin marker round-trips; …":
16
+ * `[engine=tidb] contract case "[ref]: origin marker round-trips; …":
17
17
  * an origin-stripping update must not apply — 1 !== 0`
18
18
  * ⇒ 两只 SQL 孪生此前**没有**这条法:一条被标记为外部来源的记忆条目,可以被后续一次普通 update
19
19
  * 悄悄抹掉标记(洗白),而 File backend 会拒。这是安全轴上的真缺口,不是「新契约还没接」。
@@ -38,7 +38,7 @@
38
38
  */
39
39
  import { type MemoryEntryFrontmatter, type MemoryEntryHeader } from "@sema-agent/core";
40
40
  /**
41
- * #319 增量(sema-comms [4768] 勘误 + core 仓 `1a5ebaa1`,conformance 30→31)—— **歧义 origin 表示**
41
+ * [ref] 增量(sema-comms [ref] 勘误 + core 仓 `1a5ebaa1`,conformance 30→31)—— **歧义 origin 表示**
42
42
  * 的拒绝门,与不可变律同批、同一个写路径上。
43
43
  *
44
44
  * ## 病
@@ -58,8 +58,8 @@ import { type MemoryEntryFrontmatter, type MemoryEntryHeader } from "@sema-agent
58
58
  * ## 判据禁手抄
59
59
  *
60
60
  * 谓词一律用 core 导出的 {@link ambiguousOriginRepresentation}:它要解 `extra` 里的 origin 形块
61
- * (跨块字段组合、解析期块重排都算歧义),自己写一份近似的等于给洗白开口子 —— 这条在 #307 就写死过。
62
- * core 5.47.0 起该谓词进公开导出面([4698] 请托兑现),本仓的「撤除条件钉」也因此在 5.47 提货当天
61
+ * (跨块字段组合、解析期块重排都算歧义),自己写一份近似的等于给洗白开口子 —— 这条在 [ref] 就写死过。
62
+ * core 5.47.0 起该谓词进公开导出面([ref] 请托兑现),本仓的「撤除条件钉」也因此在 5.47 提货当天
63
63
  * 准时翻红,本批就是那条钉指定的兑现动作。
64
64
  *
65
65
  * ## 文案与 File 逐字同
@@ -75,7 +75,7 @@ import { type MemoryEntryFrontmatter, type MemoryEntryHeader } from "@sema-agent
75
75
  */
76
76
  export declare function ambiguousOriginRefusal(fm: MemoryEntryFrontmatter): string | undefined;
77
77
  /**
78
- * #319(core 5.47/5.48 契约冻结面,design/336 §5.2)—— **头面 exposure 事实**的同一份归一化。
78
+ * [ref](core 5.47/5.48 契约冻结面,[ref] §5.2)—— **头面 exposure 事实**的同一份归一化。
79
79
  *
80
80
  * 契约逐字:`listHeaders` 与 `search` 两个头面都要携带 `exposure`,且**同一条归一化**
81
81
  * (`committedOriginOf`:typed `frontmatter.origin` 与 legacy 的 `extra` origin 形字节块两种承载,
@@ -109,7 +109,7 @@ export declare function originMarkedSqlPredicate(column: string): string;
109
109
  /**
110
110
  * 本批次的「已提交 frontmatter」基线:id → 本批**第一次**触碰它时库里那一份(无行 ⇒ `undefined`)。
111
111
  *
112
- * #337(core 5.55.0 conformance c35-c40,design/339)从「只记 origin」升为记**整份** committed
112
+ * [ref](core 5.55.0 conformance c35-c40,[ref])从「只记 origin」升为记**整份** committed
113
113
  * frontmatter:origin 不可变律与 distilled 不可变律读的是同一份基线,将来第三个不可变 frontmatter
114
114
  * 字段进契约时零基线改动 —— 两只平行 Map 就是 F1a(姊妹腿)的温床,一只忘了在 delete 腿记账,
115
115
  * 那一律的「同批 delete+re-add 拒」就静默失效。
@@ -136,14 +136,14 @@ export declare function rememberBatchCommitted(baseline: BatchCommittedBaseline,
136
136
  *
137
137
  * 今日可达性(如实):本仓唯一的调用点 `src/memory-sync.ts` 自己铸 op(基线有 ⇒ update、无 ⇒ add),
138
138
  * 词表外的值到不了。所以这条是**加固**而不是在修一次已发生的事故 —— 但它落在安全轴(白洗守卫的
139
- * 有效性完全依赖「op 只有三种」这个未被检查的前提),按 CLAUDE.md #157「闭集 + 不可避免的运行期
139
+ * 有效性完全依赖「op 只有三种」这个未被检查的前提),按 CLAUDE.md [ref]「闭集 + 不可避免的运行期
140
140
  * miss 臂必须说出来」补一道显式拒绝:未知 op **零写**,报 `malformed patch refused`(与本仓既有的
141
141
  * id-mismatch 拒绝同族文案,消费方按同一条正则分类)。
142
142
  */
143
143
  export declare function unknownPatchOpRefusal(op: string): string | undefined;
144
144
  export declare function originWhitewashRefusal(op: "add" | "update", committedFm: MemoryEntryFrontmatter | undefined, next: MemoryEntryFrontmatter): string | undefined;
145
145
  /**
146
- * #337(core 5.55.0 conformance c36/c37,design/339)—— **distilled 血统不可变律**的判据,与 origin
146
+ * [ref](core 5.55.0 conformance c36/c37,[ref])—— **distilled 血统不可变律**的判据,与 origin
147
147
  * 律同族同基线同判位:一旦某 id 的已提交状态带 `frontmatter.distilled` 块(consolidation 蒸馏产物的
148
148
  * 血统:planId/at/carrierRev/inputs),任何 update / 裸 add / guard add / 同批 delete+re-add 都必须把
149
149
  * 它 DEEP-EQUAL 地带下去,否则拒 —— 合法出口只有已提交的墓碑(c36 逐字)。判序:**先于 rev CAS**
@@ -153,7 +153,7 @@ export declare function originWhitewashRefusal(op: "add" | "update", committedFm
153
153
  */
154
154
  export declare function distilledWhitewashRefusal(op: "add" | "update", committedFm: MemoryEntryFrontmatter | undefined, next: MemoryEntryFrontmatter): string | undefined;
155
155
  /**
156
- * #337(conformance c38)—— **distilled 事实的头面携带**,与 {@link exposureCarriage} 同住同因:
156
+ * [ref](conformance c38)—— **distilled 事实的头面携带**,与 {@link exposureCarriage} 同住同因:
157
157
  * `listHeaders` 与 `search` 两个头面都携带 `{ carrierRev, supersedes }` 投影(supersedes = inputs 中
158
158
  * `superseded === true` 的行,形状与 core File backend 的 header 投影逐字同);无块条目两面都不携带。
159
159
  * 蒸馏产物的「取代了哪些输入行」必须在检索面可见,否则被取代的旧行与蒸馏产物在读侧无从判序。
@@ -15,13 +15,13 @@ import type { TaskResult, TaskStatus } from "@sema-agent/core";
15
15
  import type { RunRecord, SessionSummary, RunEvent } from "./store-contracts.js";
16
16
  import type { LedgerEventType } from "../trace/ledger-events.js";
17
17
  /**
18
- * [868] P0 — the local lane's stand-in for the SQL twins' checkpoint-table JOIN. The file/memory run stores
18
+ * [ref] P0 — the local lane's stand-in for the SQL twins' checkpoint-table JOIN. The file/memory run stores
19
19
  * cannot JOIN `checkpoint` (separate store, separate files), so the suspended-run reapers were NO-OPs — which
20
20
  * left a durable HITL park whose approval was never answered holding the task_active claim FOREVER (the
21
21
  * "suspended run locks the session" incident: every later submit 409s and no reaper path releases it).
22
22
  * The backend assembly (store-backend.ts local lane, where checkpoint + run store are built side by side)
23
23
  * injects this probe so the reapers get the SAME two predicates the SQL twins express as EXISTS subqueries:
24
- * - hasPending = EXISTS (checkpoint c WHERE c.session_id = ? AND c.status = 'pending') — the design/80 D-D
24
+ * - hasPending = EXISTS (checkpoint c WHERE c.session_id = ? AND c.status = 'pending') — the [ref] D-D
25
25
  * NOT-EXISTS-pending guard: a row whose checkpoint is STILL pending is owned by the checkpoint-state-driven
26
26
  * sweeps and must NEVER be time-reaped (else two-runs-one-session, see run-store-sql.ts reapSuspended doc).
27
27
  * - hasExpired = EXISTS (checkpoint ce WHERE ce.session_id = ? AND ce.status = 'expired') — the
@@ -39,9 +39,9 @@ export declare class MemoryRunStore {
39
39
  private readonly active;
40
40
  /** taskId → events (kept seq-sorted on read). */
41
41
  private readonly events;
42
- /** [868] the checkpoint-table stand-in (see {@link RunStoreCheckpointProbe}); absent ⇒ reapers NO-OP. */
42
+ /** [ref] the checkpoint-table stand-in (see {@link RunStoreCheckpointProbe}); absent ⇒ reapers NO-OP. */
43
43
  private checkpointProbe?;
44
- /** [868] wire the checkpoint probe (backend assembly, where checkpoint + run store are built together). */
44
+ /** [ref] wire the checkpoint probe (backend assembly, where checkpoint + run store are built together). */
45
45
  setCheckpointProbe(probe: RunStoreCheckpointProbe): void;
46
46
  private toRecord;
47
47
  /** Create a run iff the session has no active run (the task_active unique-key claim). */
@@ -64,15 +64,15 @@ export declare class MemoryRunStore {
64
64
  maxSeq(taskId: string): Promise<number>;
65
65
  retainedFrom(taskId: string): Promise<number>;
66
66
  getEvents(taskId: string, afterSeq: number): Promise<RunEvent[]>;
67
- /** [888] FIRST terminal writer wins(SQL 孪生同款正向 CAS on running/suspended/needs_review,
67
+ /** [ref] FIRST terminal writer wins(SQL 孪生同款正向 CAS on running/suspended/needs_review,
68
68
  * [1.207 codex M1] 负向形漏 blocked/timeout);claim 释放保持无条件(幂等)。 */
69
69
  setTerminal(taskId: string, status: TaskStatus, result: TaskResult | null, error: string | null): Promise<void>;
70
70
  /** Durable F4: park NON-terminal `suspended`, KEEP the task_active claim. CAS on running/suspended (reaper-revert guard). */
71
71
  setSuspended(taskId: string): Promise<void>;
72
- /** design/80 D-B: park NON-terminal `needs_review`, KEEP the claim. CAS on running/needs_review. */
72
+ /** [ref] D-B: park NON-terminal `needs_review`, KEEP the claim. CAS on running/needs_review. */
73
73
  setNeedsReview(taskId: string): Promise<void>;
74
74
  /** Durable F4 resume: flip suspended/needs_review → running (CAS) + reset cancel/preempt flags.
75
- * S-51(codex R1 [medium]):认领 = 接管 `instanceId`(= 当前持有副本;SQL 孪生同注)。CAS 输不改。 */
75
+ * [ref](codex R1 [medium]):认领 = 接管 `instanceId`(= 当前持有副本;SQL 孪生同注)。CAS 输不改。 */
76
76
  markResuming(taskId: string, instanceId: string): Promise<boolean>;
77
77
  getActiveTaskId(sessionId: string): Promise<string | undefined>;
78
78
  getRun(taskId: string): Promise<RunRecord | undefined>;
@@ -130,25 +130,25 @@ export declare class MemoryRunStore {
130
130
  }>>;
131
131
  /** Fail stale `running` rows (crashed-run backstop) + release task_active for any now-terminal row. */
132
132
  reapStale(olderThanMs: number): Promise<number>;
133
- /** [868] shared tail of both suspended-run reapers: flip one parked row → failed('approval.expired'), the
133
+ /** [ref] shared tail of both suspended-run reapers: flip one parked row → failed('approval.expired'), the
134
134
  * in-memory twin of the SQL UPDATE (`error`/`error_code` set directly — no result blob to derive from). */
135
135
  private failExpiredPark;
136
136
  /** Release the claim for TERMINAL rows only — suspended/needs_review keep it (the `DELETE ta … WHERE tr.status
137
- * NOT IN ('running','suspended','needs_review')` twin, shared by reapStale + the [868] suspended reapers). */
137
+ * NOT IN ('running','suspended','needs_review')` twin, shared by reapStale + the [ref] suspended reapers). */
138
138
  private releaseTerminalClaims;
139
139
  /**
140
- * [868] Durable F4 expiry — the local twin of TiDBRunStore.reapSuspended, driven by the injected checkpoint
140
+ * [ref] Durable F4 expiry — the local twin of TiDBRunStore.reapSuspended, driven by the injected checkpoint
141
141
  * probe instead of a SQL JOIN (formerly a NO-OP, which was one of the five closed doors in the "suspended run
142
142
  * locks the session forever" incident). Semantics verbatim from the SQL twin: suspended ∧ updatedAt < cutoff
143
143
  * ∧ NOT probe.hasPending(session) → failed 'approval expired before decision' / error_code 'approval.expired'
144
- * + release the task_active claim. The NOT-pending clause is the design/80 D-D blocker guard
144
+ * + release the task_active claim. The NOT-pending clause is the [ref] D-D blocker guard
145
145
  * (SQL 孪生现在的真身:`run-store-sql.ts` 的 `reapSuspended`;`tidb-run-store.ts` 该壳文件已删(5.0.0)): a row whose checkpoint is STILL pending belongs to the checkpoint-state
146
146
  * sweeps (SLA deny-sweep / failSuspendedWithExpiredCheckpoint) — time-reaping it here would orphan a model
147
147
  * leg on a now-unlocked session. Probe absent ⇒ honest NO-OP (never kill a park without the guard).
148
148
  */
149
149
  reapSuspended(olderThanMs: number): Promise<number>;
150
150
  /**
151
- * [868] design/80 §3 inv#3 crash-safe backstop — the local twin of TiDBRunStore.failSuspendedWithExpiredCheckpoint
151
+ * [ref] [ref] §3 inv#3 crash-safe backstop — the local twin of TiDBRunStore.failSuspendedWithExpiredCheckpoint
152
152
  * (checkpoint-STATE-driven, not time-driven; runs UNCONDITIONALLY every reaper tick, no APPROVAL_TIMEOUT_SEC gate).
153
153
  * Semantics verbatim from the SQL twin: (suspended ∨ needs_review) ∧ probe.hasExpired(session) ∧ NOT
154
154
  * probe.hasPending(session) → same fail + claim release. The NOT-pending clause covers a re-suspended session
@@ -49,7 +49,7 @@ export interface TaskOutcome {
49
49
  signatureInputs: SignatureInputs;
50
50
  mechanical: MechanicalOutcome;
51
51
  llmAssisted?: LlmAssistedOutcome;
52
- /** design/73 §1 consumption: the VERBATIM core `TaskOutcome` fact this row was derived from (status/
52
+ /** [ref] §1 consumption: the VERBATIM core `TaskOutcome` fact this row was derived from (status/
53
53
  * errorCode/oracleHadRedRun/oracle blob — fields the v1 columns predate). Stored as-is in `core_outcome`
54
54
  * so red-line ② (`oracleHadRedRun`) and the free-form oracle survive lossless; the mapped mechanical
55
55
  * columns stay the aggregate/query surface. */
@@ -67,7 +67,7 @@ export declare function taskSignature(s: SignatureInputs): string;
67
67
  */
68
68
  export declare function deriveOutcome(m: MechanicalOutcome, runStatus?: RunStatus): "pass" | "partial" | "fail" | "aborted";
69
69
  /**
70
- * design/73 §1 → §7 bridge: project one CORE `TaskOutcome` fact (the `RunnerDeps.onTaskOutcome` seam,
70
+ * [ref] §1 → §7 bridge: project one CORE `TaskOutcome` fact (the `RunnerDeps.onTaskOutcome` seam,
71
71
  * core 1.226) onto a v1 ledger row. Lossless: the verbatim fact rides `core` → the `core_outcome` JSON
72
72
  * column (red-line ② `oracleHadRedRun` + the free-form oracle blob have no v1 columns); the mapped
73
73
  * mechanical fields keep the existing aggregate surface working. Mapping rules:
@@ -103,7 +103,7 @@ export declare class SqlOutcomeLedger {
103
103
  private json;
104
104
  /** Record one graded task run. Idempotent only by row id; callers pass distinct runs. */
105
105
  record(o: TaskOutcome): Promise<string>;
106
- /** design/73 §1 seam consumption: record one CORE outcome fact (see {@link coreOutcomeToLedgerRow}). */
106
+ /** [ref] §1 seam consumption: record one CORE outcome fact (see {@link coreOutcomeToLedgerRow}). */
107
107
  recordCore(o: CoreTaskOutcome): Promise<void>;
108
108
  /**
109
109
  * Read-only aggregate for the dashboard / offline backtest: pass-rate + mean cost per (signature, model).
@@ -58,12 +58,12 @@ export declare class FileRuleImportTicketStore {
58
58
  * (理由逐字见 SQL 侧 `release` 的头注:承诺一次必然兑现不了的重试比不承诺更坏)。
59
59
  * `claimId` = A7 的认领围栏(R1-F1):被顶替的旧持有者动不了现持有者的认领。 */
60
60
  release(ticketId: string, principal: string, claimId: string, mustRemainValidMs?: number, opts?: RuleTicketDecisionClock): Promise<boolean>;
61
- /** #265 A7 CLAIMED → **SETTLED**。判据与 SQL 孪生逐字同源(持有**这一代**认领 ∧ 未落定;过期
61
+ /** [ref] A7 CLAIMED → **SETTLED**。判据与 SQL 孪生逐字同源(持有**这一代**认领 ∧ 未落定;过期
62
62
  * **刻意不设门** —— 理由逐字见 SQL 侧 `settle` 的头注:拒绝记录一件已经发生的事只会把真相丢掉)。 */
63
63
  settle(ticketId: string, principal: string, claimId: string, outcome: unknown): Promise<boolean>;
64
- /** #265 A7 三态快照。属主门与车道门同源(别人的票 / 别条车道的票 / 不存在的票一律 `undefined`)。 */
64
+ /** [ref] A7 三态快照。属主门与车道门同源(别人的票 / 别条车道的票 / 不存在的票一律 `undefined`)。 */
65
65
  peek(ticketId: string, principal: string, purpose: RuleTicketPurpose): Promise<RuleTicketSnapshot | undefined>;
66
- /** #265 A7 崩溃窗恢复:抢过一次**可证陈旧**的认领(判据与 SQL 孪生逐字同源 —— 含"过期刻意不设门"
66
+ /** [ref] A7 崩溃窗恢复:抢过一次**可证陈旧**的认领(判据与 SQL 孪生逐字同源 —— 含"过期刻意不设门"
67
67
  * 那一条:过期只挡开始一次兑付,不挡做完一次已经开始的)。抢到之后**换一代认领**。 */
68
68
  reclaim(ticketId: string, principal: string, purpose: RuleTicketPurpose, minClaimAgeMs: number): Promise<RuleTicketReclaimResult>;
69
69
  }