@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
@@ -17,12 +17,12 @@ import { type PlacementAcquireOpts } from "./session-placement.js";
17
17
  import { type StagingHandle } from "../session-sync-kernel.js";
18
18
  export declare class TiDBSessionStore implements SessionStore {
19
19
  private readonly pool;
20
- /** #270 车1:托管留存声明。读法与「为什么 SQL 店答 managed 而实现体在别处」逐字见
20
+ /** [ref] 车1:托管留存声明。读法与「为什么 SQL 店答 managed 而实现体在别处」逐字见
21
21
  * `retention-store-sql.ts` 的 {@link MANAGED_RETENTION}。 */
22
22
  readonly retention: import("@sema-agent/core").RetentionDeclaration;
23
- /** #292 C18(core 5.48.0 design/323):placement **声明**。六条义务的实装点逐条见
23
+ /** [ref] C18(core 5.48.0 [ref]):placement **声明**。六条义务的实装点逐条见
24
24
  * {@link SQL_SESSION_PLACEMENTS} 顶注与本类的 acquire / listSessions / release / listPlaced /
25
- * placementOf 各处的 `#292` 注。 */
25
+ * placementOf 各处的 `[ref]` 注。 */
26
26
  readonly placements: {
27
27
  readonly subagent: {
28
28
  readonly durability: "durable";
@@ -34,16 +34,16 @@ export declare class TiDBSessionStore implements SessionStore {
34
34
  acquire(sessionId?: string, opts?: PlacementAcquireOpts): Promise<AcquiredSession>;
35
35
  private load;
36
36
  /** Idempotently create a session_meta row with an owner. Existing owner is never overwritten.
37
- * #292:`placement` 在场时与行同一条 INSERT 落六列;ON DUPLICATE 臂是 no-op ⇒ 已存在的行的元组
37
+ * [ref]:`placement` 在场时与行同一条 INSERT 落六列;ON DUPLICATE 臂是 no-op ⇒ 已存在的行的元组
38
38
  * **永不被重写**(first-write 不可变,义务 5 的写侧半场)。 */
39
39
  register(sessionId: string, owner: string | null, placement?: SessionPlacement): Promise<void>;
40
40
  /**
41
- * #292 义务 6 的廉价探针 —— 一行 PK SELECT:`undefined` = 普通会话或无此行。
41
+ * [ref] 义务 6 的廉价探针 —— 一行 PK SELECT:`undefined` = 普通会话或无此行。
42
42
  * (release 的冷缓存腿、包装店的暖命中准入判、诊断面共用这一只。)
43
43
  */
44
44
  placementOf(sessionId: string): Promise<SessionPlacementRecord | undefined>;
45
45
  /**
46
- * #292 义务 5 —— placed 分区的**自有枚举**(联合 reap 的分区腿输入)。
46
+ * [ref] 义务 5 —— placed 分区的**自有枚举**(联合 reap 的分区腿输入)。
47
47
  *
48
48
  * 年龄锚 = `COALESCE(updated_at, placed_at)`:`updated_at` 是本店的「最后活动」标记(register 时置、
49
49
  * 每次 append/touch 推进),取不到才回落 `placed_at` —— 与 core File 店「mtime 优先、placedAt 回落」
@@ -62,7 +62,7 @@ export declare class TiDBSessionStore implements SessionStore {
62
62
  * an acquire lease) and cache-bypassing (the resume-at turn-capture reads it without touching the warm session).
63
63
  * Returns the leaf id, or null when the session has none / no such session. */
64
64
  getLeafId(sessionId: string): Promise<string | null>;
65
- /** [1196] 六轮复审:owner+leafId **单行原子快照**(SSE watch 探针的租户围栏读)——两独立 SELECT 在
65
+ /** [ref] 六轮复审:owner+leafId **单行原子快照**(SSE watch 探针的租户围栏读)——两独立 SELECT 在
66
66
  * delete/reclaim 缝里可拼出「旧 owner+新 leaf」混世代组合;单 SELECT 单行=天然一致。undefined=无此会话。 */
67
67
  getHead(sessionId: string): Promise<{
68
68
  owner: string | null;
@@ -71,7 +71,7 @@ export declare class TiDBSessionStore implements SessionStore {
71
71
  /**
72
72
  * Durable history is retained; just drop any in-flight cache entry.
73
73
  *
74
- * 🔴 #292 义务 4 —— **placed 会话例外:release 是真删除**(durable 史一并)。联合 reap 先按 rev 条件删
74
+ * 🔴 [ref] 义务 4 —— **placed 会话例外:release 是真删除**(durable 史一并)。联合 reap 先按 rev 条件删
75
75
  * 掉 agent 行、赢了才调本方法终结转录;若这里还按「归还租约」走,一条 30 天的转录就会失去属主行地
76
76
  * 悬着(正是这条义务要关死的 strand)。判据取**持久化元组**(冷缓存/重启后照样成立,不依赖任何进程
77
77
  * 内状态);删除本身是 ABA 安全的**条件删**(`placement_kind IS NOT NULL`)——探针与删除之间若真有
@@ -82,9 +82,9 @@ export declare class TiDBSessionStore implements SessionStore {
82
82
  release(sessionId: string): Promise<void>;
83
83
  /**
84
84
  * core B-17 的 `forget` 面 —— **丢引用,不动 durable 史**(与 {@link release} 的分工:release 是
85
- * 生命周期终结口,forget 是「我用完了这只句柄」)。#292 之后这条分工是承重的:release 对 placed
85
+ * 生命周期终结口,forget 是「我用完了这只句柄」)。[ref] 之后这条分工是承重的:release 对 placed
86
86
  * 会话已是真删除,于是每一处「只为验存在 / 写完收工」的收尾都必须落在 forget 上(preflight 纪律,
87
- * [4743] 义务①)。本店的进程内状态只有 in-flight 去重表,故实现就是丢那一格。
87
+ * [ref] 义务①)。本店的进程内状态只有 in-flight 去重表,故实现就是丢那一格。
88
88
  */
89
89
  forget(sessionId: string): void;
90
90
  /** 真删除一只 placed 会话的两张表(条件删门在 `placement_kind IS NOT NULL`;事务内 meta 先删=提交点,
@@ -205,7 +205,7 @@ export declare class TiDBSessionStore implements SessionStore {
205
205
  * atomic swap) or aborts. No row is touched here — the handle is a stateless cursor over this pool.
206
206
  */
207
207
  beginImportStaging(realSessionId: string, token: string): StagingHandle;
208
- /** #292:「这个 id 是 placed ⇒ 该写路径不适用」的共用拒绝(session-sync 的两条换装腿共用)。 */
208
+ /** [ref]:「这个 id 是 placed ⇒ 该写路径不适用」的共用拒绝(session-sync 的两条换装腿共用)。 */
209
209
  private assertNotPlaced;
210
210
  /**
211
211
  * 2c session-sync P1d-β (staged-row inspection) — read the rows STAGED under `stagingId` (NO session_meta probe — a
@@ -9,7 +9,7 @@ export declare const PG_TOOL_RESULT_SCHEMA: string[];
9
9
  /** Idempotent schema apply for the tool_result table (for the integration test to call). */
10
10
  export declare function ensureSchema(pool: PgPool | PgPoolClient): Promise<void>;
11
11
  /**
12
- * #119 升级前置断言 —— **拒启**,不是 warn(codex 复审 [high],已核真)。
12
+ * [ref] 升级前置断言 —— **拒启**,不是 warn(codex 复审 [high],已核真)。
13
13
  *
14
14
  * 病:本仓不发 `ALTER TABLE` 迁移(标准裁定:改列就改 CREATE + 删库重建)。于是一台**没删表**就升上来的
15
15
  * 部署,`CREATE TABLE IF NOT EXISTS` 对它是空操作,旧表既没有出处两列也只有 `VARCHAR(190)` 的 ref 列。
@@ -26,25 +26,25 @@ export declare function assertToolResultProvenanceSchema(query: (sql: string) =>
26
26
  /** Dual-dialect durable ToolResultStore. See the file header for the dialect-delta ledger. */
27
27
  export declare class SqlToolResultStore implements ToolResultStore {
28
28
  protected readonly db: SqlDriver;
29
- /** #270 车1:托管留存声明。读法与「为什么 SQL 店答 managed 而三方法的实现体在 `retention-store-sql.ts`」
29
+ /** [ref] 车1:托管留存声明。读法与「为什么 SQL 店答 managed 而三方法的实现体在 `retention-store-sql.ts`」
30
30
  * 逐字见 {@link MANAGED_RETENTION}(本店的 `tool_result` 行由那只聚合店按期清:随会话树删 + 孤儿腿)。 */
31
31
  readonly retention: import("@sema-agent/core").RetentionDeclaration;
32
32
  constructor(db: SqlDriver);
33
33
  /** Pick the dialect's SQL text. Both statements stay written out at the call site ON PURPOSE. */
34
34
  private q;
35
- /** D1(试剂盒揪出,RB-266 语义):ref 是主键,而 `deleteBySession` 只认**记录下来的出处**与单射的
35
+ /** D1(试剂盒揪出,[ref] 语义):ref 是主键,而 `deleteBySession` 只认**记录下来的出处**与单射的
36
36
  * `tr_<sid>~` 前缀(重扫二轮起;旧注写的 `tr_<sid>_%` 前缀清理已作废,理由见该方法顶注)——
37
37
  * 不合规 ref 的行既进不来、也就谈不上被 session 删除清掉,只能等 TTL。
38
38
  *
39
39
  * 🔴 判定**单源**:直调 core 的 `assertSafeToolResultRef`(core 2.8.0 起入公共面)。
40
- * 在此之前这里是那 6 个判别条件的**本地镜像** —— 我在 [2159] 主动交出过这条裂缝:镜像是第二真源,
40
+ * 在此之前这里是那 6 个判别条件的**本地镜像** —— 我在 [ref] 主动交出过这条裂缝:镜像是第二真源,
41
41
  * core 哪天收紧一格(加 Windows 保留名、长度上限……)我方不会跟着动,而**试剂盒会继续绿**
42
42
  * (它测的是「拒不拒」,不是「按同一张表拒」)。core 按请求追加了导出,镜像随之删除,裂缝闭合。
43
43
  * 抛错文案与 core 逐字相同,所以 wire 与既有钉都不变。 */
44
44
  private isUnsafeRef;
45
45
  private assertSafeRef;
46
46
  /**
47
- * #119(core 5.26.0)—— 出处的**写面**。语义一律取 core 单源(`assertToolResultProvenanceMatch`),
47
+ * [ref](core 5.26.0)—— 出处的**写面**。语义一律取 core 单源(`assertToolResultProvenanceMatch`),
48
48
  * 本方法只负责把它落到 SQL 上:
49
49
  * · **写一次选举同时定属主** —— 内容与属主是同一条 INSERT,不存在「内容写进去了属主还没跟上」的窗口
50
50
  * (core 头注允许 file 双对象后端出现这个窗口,单行后端没有,别自造);
@@ -58,7 +58,7 @@ export declare class SqlToolResultStore implements ToolResultStore {
58
58
  * 条 SELECT —— 分两次问会重新引入它要消灭的那个窗口。 */
59
59
  private readOwner;
60
60
  /**
61
- * #119 —— 出处的**读面**。未知 ref 与「存了但无属主」两种情况都答 `undefined`:读面对二者一视同仁
61
+ * [ref] —— 出处的**读面**。未知 ref 与「存了但无属主」两种情况都答 `undefined`:读面对二者一视同仁
62
62
  * (fail-closed,谁都没被授权),所以这里也不必把它们分开报。
63
63
  */
64
64
  ownerOf(ref: string): Promise<ToolResultProvenance | undefined>;
@@ -76,14 +76,14 @@ export declare class SqlToolResultStore implements ToolResultStore {
76
76
  reapOlderThan(cutoffMs: number): Promise<number>;
77
77
  /**
78
78
  * E21 (§0.5 session delete) — purge offloaded tool results for one session. Selection is by the row's
79
- * **recorded provenance** (`owner_session_id`, the #119 column `put` writes in the same statement as the
79
+ * **recorded provenance** (`owner_session_id`, the [ref] column `put` writes in the same statement as the
80
80
  * content) and by NOTHING else — **zero ref-derived arms**(codex R1-[high] 收窄:连单射新前缀也不作
81
81
  * 属主证据,理由在方法体内逐字引 core 顶注)。Returns `{deleted, unattributable}`; why NO prefix
82
82
  * (legacy `_` or injective `~`) is a deletion selector is inline below.
83
83
  *
84
84
  * ⚠️ 旧注两处已作废(重扫二轮更正,留档防复辟):① 「core namespaces every ref as `tr_<sid>_<callId>`」——
85
85
  * 5.26.0 起是 `~` 分隔的单射四段形,`_` 形只剩存量;② 「there is no `session_id` (or `owner`) column to
86
- * guard on」—— #119 起**有**(`owner_session_id` / `owner_task_id`,boot 期还有拒启断言把没升级的表挡在
86
+ * guard on」—— [ref] 起**有**(`owner_session_id` / `owner_task_id`,boot 期还有拒启断言把没升级的表挡在
87
87
  * 外面),所以「按出处选行」不再是「awkward ref-correlated EXISTS」,它就是本方法现在的主选择器。
88
88
  *
89
89
  * 路由侧的 owner 门照旧在(DELETE 路由先 `ownerOf` 对属主、同一协调器里先跑 owner-guarded 的 run 账本
@@ -1,5 +1,5 @@
1
1
  /**
2
- * UsageWindowStore SQL twins(design/166-T1)——core 5.8.0 部署级 token 治理窗
2
+ * UsageWindowStore SQL twins([ref]-T1)——core 5.8.0 部署级 token 治理窗
3
3
  * (`RunnerDeps.usageWindows` + `usageWindowStore`)的 TiDB/PG 双方言实现。
4
4
  *
5
5
  * 语义单源 = core 纯函数(`chargeUsageRecord`/`readUsageRecord`,dist/core/usage-window-store.js):
@@ -7,7 +7,7 @@
7
7
  * first-use bucket lapsed 即弃)完全由 core 纯函数执行——SQL 层零窗语义。
8
8
  *
9
9
  * 并发正确性(本 store 的靶心;两副本同 key 并发 charge 绝不能丢账——丢账方向=治理窗漏放):
10
- * - **ensure-first + 行锁**(mailbox twin 正字先例,design/166 复审靶1):事务内先幂等
10
+ * - **ensure-first + 行锁**(mailbox twin 正字先例,[ref] 复审靶1):事务内先幂等
11
11
  * INSERT IGNORE / ON CONFLICT DO NOTHING 建空行 ⇒ SELECT ... FOR UPDATE 时行恒在,
12
12
  * 「无行 FOR UPDATE + INSERT」的并发死锁(InnoDB gap-lock)/dup 撞车形整个消掉。
13
13
  * - charge 频率低(core 只在任务进场/turn 边界/收尾 delta 提交),悲观锁简单正确,不用乐观 CAS。
@@ -18,7 +18,7 @@
18
18
  * background-agent LONGTEXT 同案);PG TEXT 不限长。key 列 VARCHAR(190)(principal 或
19
19
  * GLOBAL_USAGE_KEY,均为受控标识,无字节等价诉求——不是用户可写身份键)。
20
20
  *
21
- * residue(design/166 04 §复审处置在档):不再被 charge 的 key 行永存(单行成本可忽略);
21
+ * residue([ref] 04 §复审处置在档):不再被 charge 的 key 行永存(单行成本可忽略);
22
22
  * GLOBAL 单行=并发 charge 串一把行锁的吞吐热点(出现瓶颈再分片)。
23
23
  */
24
24
  import type { Pool as MySqlPool } from "mysql2/promise";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/102 (K-8 CC full-body) — the WebSearch BACKEND (BRAIN / model-service leg) that core leaves
2
+ * [ref] (K-8 CC full-body) — the WebSearch BACKEND (BRAIN / model-service leg) that core leaves
3
3
  * deployment-injected (`WebSearchConfig.search`; core ships NONE, the same boundary as the model gateway). Wiring a
4
4
  * backend here is what makes `assembleFullBodyTools({ webSearch })` actually mount the WebSearch tool.
5
5
  *
@@ -13,7 +13,7 @@
13
13
  * not a correctness requirement (a backend MAY ignore it). The API key comes from deployment env — it never enters
14
14
  * the model prompt or the tool args. `effect:"read"` (idempotent) is core's concern; this is just the transport.
15
15
  *
16
- * ── 立案:装配层四条缺口([2176] 我方认领,2026-08-01 调研,**尚未实施**)────────────────────
16
+ * ── 立案:装配层四条缺口([ref] 我方认领,2026-08-01 调研,**尚未实施**)────────────────────
17
17
  *
18
18
  * ① **`opts` 仍有 brave 腿不消费**(只剩 `brave` 的 switch 分支不传 `opts`;`searxng` 腿已随 ② 的
19
19
  * 还债改动接住 `opts` 并透传给 core 的 adapter,由它把 `allowedDomains` 原生下推成 `site:` 前缀。
@@ -26,7 +26,7 @@
26
26
  * ⚠️ 判据留痕:我第一轮把这条判成了「约束被静默丢弃」的安全缺口,是**亲读 core 结果侧代码**
27
27
  * 才推翻的。「别处已经处理了」这种声明必须验证 —— 这次它是真的,但真假只能靠读。
28
28
  *
29
- * ② ~~**searxng 腿是自铸的第二真源**~~ —— ✅ **已还(2026-08-01,[2229] 裁定 searxng 为国内可达性
29
+ * ② ~~**searxng 腿是自铸的第二真源**~~ —— ✅ **已还(2026-08-01,[ref] 裁定 searxng 为国内可达性
30
30
  * 主路线之后)**:本腿改为消费 core 的 `createSearxngSearchBackend`,外层保住 maxResults 截断 /
31
31
  * 统一形状 / 坏 payload 观测器三样(各有红先钉 + 变异实测),白得 `site:` 原生下推、`extraParams`、
32
32
  * 自带 timeout。以下为原始立案文本,留档:
@@ -34,7 +34,7 @@
34
34
  * (+`SearxngBackendOptions`),而且比本文件的实现多三样:`allowedDomains` 拼 `site:` 原生下推、
35
35
  * `extraParams`(实例特定的 `engines=`/`language=` 等)、**自带 timeout**
36
36
  * (`AbortSignal.any([signal, timeout])`;本文件的 searxng 腿只吃外部 signal)。
37
- * 我在黑板 [2190] 已公开表态「按 core 的接、不再自铸第二真源」—— 这条是待兑现的债。
37
+ * 我在黑板 [ref] 已公开表态「按 core 的接、不再自铸第二真源」—— 这条是待兑现的债。
38
38
  * 换的时候要核对的等价点:本文件的 `normalize()` 统一形状 + `max` 截断 +
39
39
  * `setWebSearchBadPayloadObserver` 观测器,core 的 adapter 都没有,得在外层补回来。
40
40
  *
@@ -96,8 +96,8 @@ export declare function createWebSearchBackend(cfg: WebSearchBackendConfig): Web
96
96
  * `WEB_SEARCH_SEARXNG_PARAMS` / `settings.webSearch.searxngParams` 的解析 —— SearXNG 实例侧参数
97
97
  * (`engines=` / `language=` 等)。
98
98
  *
99
- * 🔴 [2240] cli 逐串直证:3.18.0 我加了 `searxngParams` 字段和消费点,**却没开任何配置入口** ——
100
- * 两条门都没有位置填它,于是我在 [2239] 说的「这条是给你们的」是句空话。单测直接构造
99
+ * 🔴 [ref] cli 逐串直证:3.18.0 我加了 `searxngParams` 字段和消费点,**却没开任何配置入口** ——
100
+ * 两条门都没有位置填它,于是我在 [ref] 说的「这条是给你们的」是句空话。单测直接构造
101
101
  * `WebSearchBackendConfig` 传进去,**天然跳过了配置入口这一层**,于是「能力在」与「配得进」之间
102
102
  * 断开,而两边的绿都是真的。判据:**按消费端实际能填的那个入口验,不是按自己构造的对象验。**
103
103
  *
@@ -124,7 +124,7 @@ export declare function webSearchConfigFromEnv(env?: NodeJS.ProcessEnv): WebSear
124
124
  * maxResults?}`) into a backend config. Returns `undefined` for a missing/invalid provider — NEVER throws, so a bad
125
125
  * per-request config falls back to the deployment-env backend rather than failing the task. 🔒 The CALLER gates this to
126
126
  * the single-user host lane (a per-request `endpoint`/`apiKey` is a capability config; on multi-tenant a tenant could
127
- * point `searxng` at an internal URL = SSRF, so multi-tenant uses ONLY the deployment-env backend — design/107 axis).
127
+ * point `searxng` at an internal URL = SSRF, so multi-tenant uses ONLY the deployment-env backend — [ref] axis).
128
128
  */
129
129
  export declare function webSearchConfigFromSettings(raw: unknown): WebSearchBackendConfig | undefined;
130
130
  //# sourceMappingURL=web-search.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Durable {@link WorkflowJournalStore} (SVC-2, core CORE-7) — SINGLE-FILE DUAL-DIALECT (design/158 A12
2
+ * Durable {@link WorkflowJournalStore} (SVC-2, core CORE-7) — SINGLE-FILE DUAL-DIALECT ([ref] A12
3
3
  * 定型半场). ONE implementation, TWO dialects; the historical `TiDBWorkflowJournalStore` / `PgWorkflowJournalStore`
4
4
  * class names survive as thin ctor subclasses so every consumer (store-backend.ts, the extreme/integration/
5
5
  * resume-fork-probe suites) is untouched.
@@ -39,9 +39,9 @@ import type { Pool as PgPool } from "pg";
39
39
  import { type WorkflowJournalEntry, type WorkflowJournalStore } from "@sema-agent/core";
40
40
  import { type SqlDriver } from "./sql-driver.js";
41
41
  /** Dual-dialect durable WorkflowJournalStore. See the file header for the dialect-delta ledger. */
42
- /** RB-242 租约旋钮。TTL 只是**崩溃兜底**(engine 终态 finally 显式释放;[1981]/[1984] 两层分工:
42
+ /** [ref] 租约旋钮。TTL 只是**崩溃兜底**(engine 终态 finally 显式释放;[ref]/[ref] 两层分工:
43
43
  * engine 崩了没释放 ⇒ 陈旧 claim 可被接管)。
44
- * 🔴 缺省 1h,与 core file 参考实现同值([1984] :284)——**租约无心跳**(claimed_at_ms 在授予时刻定格,
44
+ * 🔴 缺省 1h,与 core file 参考实现同值([ref] :284)——**租约无心跳**(claimed_at_ms 在授予时刻定格,
45
45
  * 运行期间不刷新),所以 TTL 必须盖过最长合法 run 时长:取小了(我初版 15min)会在一次 >TTL 的活跑
46
46
  * 中把 claim 判陈旧、放另一副本进来接管——恰是本缝要防的双跑。要更短的接管等待,先给 engine 半场
47
47
  * 加心跳刷新,再谈调小。 */
@@ -64,8 +64,8 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
64
64
  * runId resolves to an empty journal (resume safely diverges to live, never discloses another tenant's results).
65
65
  * Each row's `result` is the persisted JSON.stringify(TaskResult) → JSON.parse back. Throws on failure (LOAD-BEARING). */
66
66
  load(runId: string, scope: string): Promise<WorkflowJournalEntry[]>;
67
- /** [1412] locator 云形(core 1.353 WorkflowJournalStore.locator additive):SQL 店的 journal 坐标=
68
- * [1402] HTTP 读面路由(file 店返 jsonl 路径=CC 本地形;此处返云形,core 铸 diagnostics 教句时单源引用)。 */
67
+ /** [ref] locator 云形(core 1.353 WorkflowJournalStore.locator additive):SQL 店的 journal 坐标=
68
+ * [ref] HTTP 读面路由(file 店返 jsonl 路径=CC 本地形;此处返云形,core 铸 diagnostics 教句时单源引用)。 */
69
69
  locator(runId: string, _scope: string): string;
70
70
  /** codex R1-H2:分页投影读——LIMIT/OFFSET 界行数,字节门界单行字节(超限行不取 result 全文,只回字节数;
71
71
  * 读面标 truncated)。ORDER BY ordinal 与 load 同轴。
@@ -84,7 +84,7 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
84
84
  /** GC — purge ALL journal entries for a run (the run reaper calls this once the run is terminal + retained). Scoped
85
85
  * by run_id alone; idempotent (affected-row count). Mirrors the resume-anchor store's deleteBySession. */
86
86
  deleteByRun(runId: string): Promise<number>;
87
- /** RB-242 / WF2([1981] core 拍板 a 形,签名逐字)—— cross-replica resume admission lease。
87
+ /** [ref] / WF2([ref] core 拍板 a 形,签名逐字)—— cross-replica resume admission lease。
88
88
  *
89
89
  * 语义(bake-store `idem_key UNIQUE` 先例):PK (source_run_id, scope) 上的原子赢或观察。四步,每步
90
90
  * 单语句原子,并发交叉在任一步都收敛到「恰一个持有者」:
@@ -1,5 +1,5 @@
1
1
  /**
2
- * P1 (fleet failover correctness, clay 2026-07-05) — SINGLE-FILE DUAL-DIALECT (design/158 A12 定型半场).
2
+ * P1 (fleet failover correctness, clay 2026-07-05) — SINGLE-FILE DUAL-DIALECT ([ref] A12 定型半场).
3
3
  * ONE implementation, TWO dialects; the historical `TiDBWorkflowRunStore`/`PgWorkflowRunStore`,
4
4
  * `TiDBWorkflowCompletionInbox`/`PgWorkflowCompletionInbox`, `TiDBWorkflowNotifyJournalStore`/
5
5
  * `PgWorkflowNotifyJournalStore` class names survive as thin ctor subclasses so every consumer
@@ -3,7 +3,7 @@
3
3
  * and the rate limiter (P0-2), on BOTH dialects. Both are additive per-key counters over an aligned fixed
4
4
  * window, so the shared store uses an ATOMIC INCREMENT (`val = val + delta`), never last-writer-wins.
5
5
  *
6
- * design/158 A12 C1b: this file used to be MySQL-hardwired and the PG lane carried TWO inline copies of the
6
+ * [ref] A12 C1b: this file used to be MySQL-hardwired and the PG lane carried TWO inline copies of the
7
7
  * same 150-line class (pg-cost-quota.ts's private `PgWriteBehindCounter` + pg-rate-limiter.ts's exported one).
8
8
  * They are now ONE dialect-parameterized implementation; `WriteBehindCounter` (mysql2) and
9
9
  * `PgWriteBehindCounter` (node-pg) remain as ctor subclasses so every call site and test keeps its shape.
@@ -60,7 +60,7 @@ export declare class SqlWriteBehindCounter {
60
60
  private readonly dialect;
61
61
  private readonly pool;
62
62
  private readonly t;
63
- /** 🔴 不再 `readonly`(#322):`costQuotaWindowSec` 热更新经 {@link setWindowMs} 换代,语义见那里。 */
63
+ /** 🔴 不再 `readonly`([ref]):`costQuotaWindowSec` 热更新经 {@link setWindowMs} 换代,语义见那里。 */
64
64
  private windowMs;
65
65
  private readonly now;
66
66
  private readonly onDegraded?;
@@ -72,7 +72,7 @@ export declare class SqlWriteBehindCounter {
72
72
  private flushStartedAt;
73
73
  private failStreak;
74
74
  constructor(dialect: CounterDialect, pool: MySqlPool | PgPool, t: CounterTable,
75
- /** 🔴 不再 `readonly`(#322):`costQuotaWindowSec` 热更新经 {@link setWindowMs} 换代,语义见那里。 */
75
+ /** 🔴 不再 `readonly`([ref]):`costQuotaWindowSec` 热更新经 {@link setWindowMs} 换代,语义见那里。 */
76
76
  windowMs: number, now?: () => number, onDegraded?: CounterDegradeHook | undefined, // S9: observability tap — never affects counting
77
77
  queryTimeoutMs?: number);
78
78
  /** The ONLY place the two drivers' query shapes diverge. Returns {rows, affected}. */
@@ -97,7 +97,7 @@ export declare class SqlWriteBehindCounter {
97
97
  /**
98
98
  * Delete expired window buckets to bound the table.
99
99
  *
100
- * 🔴 失败**必须留痕**(#192 codex 复审 round2 修):这里原先是裸 `catch { return 0 }` —— 一个只影响
100
+ * 🔴 失败**必须留痕**([ref] codex 复审 round2 修):这里原先是裸 `catch { return 0 }` —— 一个只影响
101
101
  * DELETE 的故障(权限被收回、引擎单独拒 DELETE)会被吞成"删了 0 行",而 flush/refresh 两条腿照常成功
102
102
  * ⇒ 健康遥测全绿,同时 rate_limit / cost_quota 的历史桶无界增长。那正是本仓禁止的静默 fail-open。
103
103
  * 处置是**留痕不改失败方向**:清理是 best-effort,失败仍返回 0(把一次运维层面的清理失败升级成业务
@@ -106,10 +106,10 @@ export declare class SqlWriteBehindCounter {
106
106
  reap(): Promise<number>;
107
107
  startRefresh(intervalMs?: number): this;
108
108
  stop(): void;
109
- /** #322:刷新环是否在跑(关断哨兵的判据:off 态必须**零 SQL**,含这条后台环)。 */
109
+ /** [ref]:刷新环是否在跑(关断哨兵的判据:off 态必须**零 SQL**,含这条后台环)。 */
110
110
  refreshRunning(): boolean;
111
111
  /**
112
- * #322 批1:窗长换代(`costQuotaWindowSec` 热更新)。
112
+ * [ref] 批1:窗长换代(`costQuotaWindowSec` 热更新)。
113
113
  *
114
114
  * 🔴 如实语义:窗长是**桶键的一部分**(`floor(now/windowMs)`),不是行里的一个可改字段。换窗长 ⇒ 当代
115
115
  * 桶重算 ⇒ 本副本对「当前窗已用多少」的读数从新桶起算(旧桶的行还在库里,按它自己的窗长归属)。
@@ -1,6 +1,6 @@
1
1
  import type { ApprovalHmacKey, PrincipalJwtKey } from "./auth-keys.js";
2
2
  /**
3
- * design/80 D-G: verify a compact JWS principal token. Returns the crypto-verified principal (`sub`) + the
3
+ * [ref] D-G: verify a compact JWS principal token. Returns the crypto-verified principal (`sub`) + the
4
4
  * channel-binding (`bnd`) on success, or `null` on ANY failure (caller fail-closes — NEVER falls back to a header).
5
5
  * 🔴 Hardening: the JWS header `alg` MUST equal the kid's PINNED alg (rejects `alg:none`, symmetric, downgrade);
6
6
  * the kid MUST resolve to a configured key; iss/aud/exp/nbf (with a small skew) are enforced; `sub` MUST be present.
@@ -24,7 +24,7 @@ export declare function approvalBnd(env: {
24
24
  boundInputHash?: string | null;
25
25
  }): string;
26
26
  /**
27
- * design/80 D-G: verify the WHOLE direct-door proof for one /decide — the signed principal JWT (identity) + its
27
+ * [ref] D-G: verify the WHOLE direct-door proof for one /decide — the signed principal JWT (identity) + its
28
28
  * cnf.bnd channel-binding + the HMAC envelope (integrity) — and return the CRYPTO-VERIFIED principal, or a typed
29
29
  * reject. 🔴 Fail-closed: every failure rejects (the caller must NOT fall back to the trusted header). Order:
30
30
  * verify principal → bind → mac-present → mac-valid (so a non-operator never gets a MAC oracle, an unverified
@@ -18,7 +18,7 @@ interface ProjectMemoryCtx {
18
18
  * Session snapshot cache (S-2): keyed on ctx.sessionId — a session keeps ONE stable instruction snapshot
19
19
  * (mid-run file edits surface via the probe as tail attachments, never a silently re-rendered prefix).
20
20
  * `phase: "post-compact"` forces a re-read (core re-renders the prefix there anyway). No entry for
21
- * sessionless one-shot runs. (post-clear never arrives from core — RB-9 — so it is not a cache key here.)
21
+ * sessionless one-shot runs. (post-clear never arrives from core — [ref] — so it is not a cache key here.)
22
22
  */
23
23
  export declare function makeLoadProjectMemory(opts: {
24
24
  logger?: {
@@ -1,10 +1,10 @@
1
1
  import { type PromptTextDeclaration, type PublishedPromptArtifactEnvelope } from "@sema-agent/core";
2
- /** [1057]⓪ 下发形(remote effective 的 additive key,JSON verbatim 面——不经 registry-core parse,所以
2
+ /** [ref]⓪ 下发形(remote effective 的 additive key,JSON verbatim 面——不经 registry-core parse,所以
3
3
  * cli 补位前 center 发的 `contentHash` 也原样到达)。 */
4
4
  export interface EffectiveCenterPrompts {
5
5
  /** `center:<contentDigest 前 12>` — 纯内容寻址(同内容重发布=同 packId,epoch 不误重 pin)。 */
6
6
  packId: string;
7
- /** canonical JSON 全量 sha256(非盐化,operator 对账位 [1050]②)。 */
7
+ /** canonical JSON 全量 sha256(非盐化,operator 对账位 [ref]②)。 */
8
8
  contentDigest: string;
9
9
  /** covering 已在 center 走完的基线终形(层信息不下发,worker 零解析义务)。 */
10
10
  sections: PromptTextDeclaration[];
@@ -36,17 +36,17 @@ export interface PromptsDomainFaces {
36
36
  catalog?: PublishedPromptArtifactEnvelope;
37
37
  /** 采用去重键:两轴 digest 拼接(轴缺席记 "-")。 */
38
38
  identity: string;
39
- /** 观测面([985]a §3:`center_prompts_adopted` 增 axes,看两轴共存窗)。 */
39
+ /** 观测面([ref]a §3:`center_prompts_adopted` 增 axes,看两轴共存窗)。 */
40
40
  axes: Array<"declarations" | "catalog">;
41
41
  }
42
42
  /**
43
43
  * prompts 域候选门 v2(validateCenterPrompts 的双轴升级;整拒语义不变=任一在场轴坏形 ⇒ 整个 prompts
44
44
  * 面拒绝采用,LKG/内置继续服务)。唯一认可形=`{schemaVersion:1, declarations?, catalog?}`
45
- * (registry-core `EffectivePromptsWire`)至少一轴。[2373]B-9(5.0.0):legacy 平铺兼容窗到期删——
45
+ * (registry-core `EffectivePromptsWire`)至少一轴。[ref]B-9(5.0.0):legacy 平铺兼容窗到期删——
46
46
  * 0.13.0 起 EffectivePromptsWire 首字段是 `schemaVersion: z.ZodLiteral<1>`,与 server 共用 ^0.13.0 的
47
47
  * 合规 center 不可能再发平铺;非合规体=响亮拒绝(整拒落 LKG/内置),不再静默吸收。
48
48
  * catalog 轴的语义权威=core `verifyPromptArtifact`(形/digest 逐位复算/ARTIFACT_LIMITS/compatibleCore
49
- * range 全在 core 一处——[1242]③ a 解,上限单真源永不漂)。
49
+ * range 全在 core 一处——[ref]③ a 解,上限单真源永不漂)。
50
50
  */
51
51
  export declare function validatePromptsDomain(raw: unknown): {
52
52
  ok: true;
@@ -55,11 +55,11 @@ export declare function validatePromptsDomain(raw: unknown): {
55
55
  ok: false;
56
56
  error: string;
57
57
  };
58
- /** #100(docs/R100-PROMPTS-LANE-FIX.md §V2-B)worker 腿 effective 上 `prompts` 键的**形-肯定**判别:
58
+ /** [ref](docs/R100-PROMPTS-LANE-FIX.md §V2-B)worker 腿 effective 上 `prompts` 键的**形-肯定**判别:
59
59
  * 消费形特征(v2 `schemaVersion` 键,或 legacy 三键 packId/contentDigest/sections)⇒ 原样返回交
60
- * {@link validatePromptsDomain}(收或拒,方向不变);其余=center 存储原文(global lane [1057]①e 下发
60
+ * {@link validatePromptsDomain}(收或拒,方向不变);其余=center 存储原文(global lane [ref]①e 下发
61
61
  * 存储形是合法输入)——catalog 在场则投影 `{schemaVersion:1, catalog}`(config-provider 本地腿先例),
62
- * 否则视为「center 未发」⇒ undefined。null=有意 cleared 语义(#100 前 null 走拒,方向为宽是设计变更,
62
+ * 否则视为「center 未发」⇒ undefined。null=有意 cleared 语义([ref] 前 null 走拒,方向为宽是设计变更,
63
63
  * 留痕于设计档)。垃圾标量原样返回(fail-loud 归 validate)。
64
64
  * 属主放本中立叶:config-lkg 与 boot/refresh 同吃,capabilities 层会重开 S6 刚消的反向依赖边。 */
65
65
  export declare function centerPromptsFromEffective(eff: unknown): unknown | undefined;
@@ -11,10 +11,10 @@ export interface QuestionFrame {
11
11
  /** "question_complete" only: whether the human answered (`answered`) or the ask was released unanswered
12
12
  * (`unanswered` — ttl/abort → core was told nobody was reachable). Cosmetic dialog-dismiss. */
13
13
  outcome?: "answered" | "unanswered";
14
- /** Server-signed emit timestamp (additive, [2805]§五→[2806]). Server-minted side-frame ⇒ no core-stream
14
+ /** Server-signed emit timestamp (additive, [ref]§五→[ref]). Server-minted side-frame ⇒ no core-stream
15
15
  * `eventId` to carry (absence is honest); this is the frame's own time coordinate. */
16
16
  serverNowMs?: number;
17
- /** "question" only ([4851]③, additive, the `tool_approval` window-trio precedent from #288): the
17
+ /** "question" only ([ref]③, additive, the `tool_approval` window-trio precedent from [ref]): the
18
18
  * coordinator's OWN answer window (`QUESTION_TTL_MS`, default 5min) — at expiry the ask releases
19
19
  * UNAVAILABLE ("unanswered") and core adjudicates park-vs-continue. Minted from the SAME `ttlMs` the
20
20
  * `setTimeout` below actually arms (single source; a shell countdown rendered from these can never
@@ -89,7 +89,7 @@ export declare class QuestionCoordinator {
89
89
  };
90
90
  /** Test/observability hook: number of currently-parked questions. */
91
91
  pendingCount(): number;
92
- /** #152 ([2703] 案二):durable 部署上的 AskUserQuestion 判决探针——本调用点是否处在某条**投递得到人的**
92
+ /** [ref] ([ref] 案二):durable 部署上的 AskUserQuestion 判决探针——本调用点是否处在某条**投递得到人的**
93
93
  * 活流腿上(runWithContext 包裹的 bg/SSE 腿=true;sync /v1/tasks、verify/cascade、durable resume 驱动=false)。
94
94
  * resolve-spec 的 durable question policy 用它在**判决时**分腿:有活流 ⇒ allow(问活人),无 ⇒
95
95
  * ask(durable park)。ALS 让这个判断天然 per-leg,policy 组装期不必预知腿别。
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/80 seam #2 — the resource/preempt durable-suspend opt-in decision (design/74 "失败≠没做完" third state).
2
+ * [ref] seam #2 — the resource/preempt durable-suspend opt-in decision ([ref] "失败≠没做完" third state).
3
3
  *
4
4
  * Pure so it is unit-testable in isolation (the spec is otherwise assembled inside main.ts's bootstrap). When a
5
5
  * task opts in, a budget/turns/walltime limit OR a scheduler preempt durably SUSPENDS the task (resumable via
@@ -27,11 +27,11 @@ export declare function resourceSuspendOptIn(opts: {
27
27
  isCascade: boolean;
28
28
  /** Multi-tenant isolation key — the SAME key durableApproval uses (the principal; "_" when auth is off). */
29
29
  scope: string;
30
- /** [3833] S-3:`RESOURCE_SUSPEND_TOTAL_TOKENS`(跨片 token 总额)。0/缺省 ⇒ 不铸键。 */
30
+ /** [ref] S-3:`RESOURCE_SUSPEND_TOTAL_TOKENS`(跨片 token 总额)。0/缺省 ⇒ 不铸键。 */
31
31
  totalTokens?: number;
32
- /** [3833] S-3:`RESOURCE_SUSPEND_TOTAL_BUDGET_USD`(跨片 $ 总额)。0/缺省 ⇒ 不铸键。 */
32
+ /** [ref] S-3:`RESOURCE_SUSPEND_TOTAL_BUDGET_USD`(跨片 $ 总额)。0/缺省 ⇒ 不铸键。 */
33
33
  totalBudgetUsd?: number;
34
- /** [3833] S-3:`RESOURCE_SUSPEND_MAX_SLICES`(跨片 slice 数上限)。0/缺省 ⇒ 不铸键。 */
34
+ /** [ref] S-3:`RESOURCE_SUSPEND_MAX_SLICES`(跨片 slice 数上限)。0/缺省 ⇒ 不铸键。 */
35
35
  maxSlices?: number;
36
36
  }): {
37
37
  scope: string;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * [3833] 件 S-4 —— **running 态跨片用量投影**的数据面(`GET /v1/runs/:id` 的 `crossSliceUsage`)。
2
+ * [ref] 件 S-4 —— **running 态跨片用量投影**的数据面(`GET /v1/runs/:id` 的 `crossSliceUsage`)。
3
3
  *
4
4
  * 【为什么需要它】S-3 把三条跨片总额旋钮(`RESOURCE_SUSPEND_TOTAL_TOKENS` / `_BUDGET_USD` /
5
5
  * `_MAX_SLICES`)供到了 `TaskSpec.resourceSuspend`,core 那本跨片账(`ResourceLedger`)也确实在记 ——
6
6
  * 但**跑的过程中 wire 上一个数都读不到**。运维第一次知道「这条 run 逼近过上限」是在**爆窗那一刻**
7
- * (行翻 `suspended` + `resource_limit` gate),想提前介入无读面。[3833] 的 75 万 token 就是这样烧完的。
7
+ * (行翻 `suspended` + `resource_limit` gate),想提前介入无读面。[ref] 的 75 万 token 就是这样烧完的。
8
8
  *
9
9
  * 【两半各自的真源(刻意不自建第三本账)】
10
10
  * · **上限半**:本模块的进程内登记册 —— 记的是**这条 run 真正铸给 core 的那只 `resourceSuspend`**
@@ -53,7 +53,7 @@ export interface ResourceWindowTotals {
53
53
  }
54
54
  /** wire 上的投影体(`GET /v1/runs/:id` 顶层 `crossSliceUsage`)。**三轴各自成对**:上限键不在 ⇒ 它那根
55
55
  * 的已耗键也不在(没有天花板就没有「逼近天花板」这件事可读)。`spentMicroUsd` 另有一条缺席理由 ——
56
- * unpriced 部署下用量行不带 `costMicroUsd` = **未知**,折 0 会谎报「还没花钱」(RB-368 未知传染)。 */
56
+ * unpriced 部署下用量行不带 `costMicroUsd` = **未知**,折 0 会谎报「还没花钱」([ref] 未知传染)。 */
57
57
  export interface CrossSliceUsage {
58
58
  totalTokens?: number;
59
59
  spentTokens?: number;
@@ -12,7 +12,7 @@
12
12
  * caller-explicit — a deliberate `council`/`debate`/`team` request, or the `/v1/leader` endpoint).
13
13
  *
14
14
  * 🔴 ALL signals are DETERMINISTIC (config / mounted tools / exec-env isolation / autonomy / delegation). There is
15
- * NO LLM "difficulty" judge in the routing decision — the verdict's measurement-integrity rule (design/89 §2.2.1):
15
+ * NO LLM "difficulty" judge in the routing decision — the verdict's measurement-integrity rule ([ref] §2.2.1):
16
16
  * an LLM judge is a GATE inside an arm, NEVER the routing metric (it would make the router un-auditable + gameable).
17
17
  *
18
18
  * Pure + unit-testable. The decision is VALIDATED empirically against the S1 harness (a ROUTER arm that runs the