@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
@@ -7,7 +7,7 @@
7
7
  * SERVICE layer (core [R57] cross-review: do NOT push this shape into core — different consumer, different shape).
8
8
  *
9
9
  * Per core [R57] corrections: there is no `suspended` event (suspend = the run row's status); per-turn tokens ride
10
- * on `turn_end.usage` (core additive). As of core 1.121.0 (design/99 §E1) `tool_end` ALSO carries the model-facing
10
+ * on `turn_end.usage` (core additive). As of core 1.121.0 ([ref] §E1) `tool_end` ALSO carries the model-facing
11
11
  * `output` (+ `truncated`) — redacted + size-bounded at append (runs.ts) and read straight off the event here (the
12
12
  * old session-join `toolOutput` hook is gone, there's a real source now); `eventId`/`parentToolCallId` (§E2) ride
13
13
  * each content event, additive / tolerate-absent.
@@ -25,13 +25,13 @@ type GetEventsFn = (taskId: string, afterSeq: number) => Promise<RunEvent[]>;
25
25
  * Shared by BOTH durable-write legs (runInBackground + the resume leg) so the persisted shape never drifts; the
26
26
  * append-only deltas make a suspended/resumed run's total resume-safe (each leg appends its own, the echo sums).
27
27
  *
28
- * core 3.0.0([2296] 装车单 S10,§DESIGN-V2 V2-⑤): every drained row is tagged with `usageBasis:
28
+ * core 3.0.0([ref] 装车单 S10,§DESIGN-V2 V2-⑤): every drained row is tagged with `usageBasis:
29
29
  * "uncached-components-v1"` — the write point for this label (the tracker itself, {@link ModelUsageTracker},
30
30
  * never sets it; it stays a pure token/cost accumulator). This is what lets {@link aggregateModelUsage} tell
31
31
  * apart rows written under the current component semantics from older rows (pre-dating this label) when it
32
32
  * sums across a run's whole event log. */
33
33
  export declare function appendModelUsageDelta(append: AppendFn, modelUsage: ModelUsageTracker | undefined, taskId: string): Promise<void>;
34
- /** [998]② drain the pending prompt-manifest records (whitelisted at RECORD time, budget.ts — ids/digests/
34
+ /** [ref]② drain the pending prompt-manifest records (whitelisted at RECORD time, budget.ts — ids/digests/
35
35
  * counts only, no prompt bodies by core's manifest contract) into durable `prompt_assembled` events, one per
36
36
  * prepare IN EMISSION ORDER (a cascade/verify leg re-prepares under one taskId — every rung's manifest
37
37
  * persists; release-review finding). Shared by both durable-write legs; a no-op when nothing is pending
@@ -53,12 +53,12 @@ export declare function attachModelUsage<T extends TaskResult>(result: T, ctx: {
53
53
  * (append-only) → this is resume-safe: it sums across ALL process legs of a suspended/resumed run. Returns
54
54
  * undefined when the run logged no model usage (→ the shell soft-degrades to aggregate cost only).
55
55
  *
56
- * #59([2052]①):事件体是 **DB 里的 JSON**(旧版本 / 别的 producer 都可能写),此前的 `?? 0` 只接住
56
+ * #59([ref]①):事件体是 **DB 里的 JSON**(旧版本 / 别的 producer 都可能写),此前的 `?? 0` 只接住
57
57
  * null/undefined——NaN 与字符串会原样进 `+`,一个坏键就把该模型的整 run 总量变成 NaN 或字符串拼接,
58
58
  * 再顺着 `TaskStats.modelUsage` 回声流进 usage-analytics 的整窗聚合。守卫改「非有限数 = 缺席、按 0 计」,
59
59
  * 与 usage-analytics 读侧同口径。
60
60
  *
61
- * 🔴 RB-368(core 2.3.0,[2083] 提货单①)——**缺席必须活着走完整条链**。此前本折叠对「costMicroUsd
61
+ * 🔴 [ref](core 2.3.0,[ref] 提货单①)——**缺席必须活着走完整条链**。此前本折叠对「costMicroUsd
62
62
  * 缺席」与「=0」输出相同(都是 0),那时无所谓:core 恒发数字,缺席没有 producer。现在 unpriced 部署
63
63
  * 下 core 行级缺席、budget.ts 如实透传落库,若在这里折 0,诚实就只活到落库为止——回声上又变回
64
64
  * 「花了 0」,行级消歧白做。故改**未知传染**:该模型任一贡献行缺 costMicroUsd 键 ⇒ 总量的该键**整个不在**
@@ -109,7 +109,7 @@ export type TraceBlock = {
109
109
  tools?: unknown;
110
110
  };
111
111
  /** The durable `tool_start` event payload, shared by BOTH append sites (runInBackground + the resume leg) so the
112
- * persisted shape never drifts: redacted args (UNTRUSTED) + E2 identity. `label`([1543]§三族B:durable 腿
112
+ * persisted shape never drifts: redacted args (UNTRUSTED) + E2 identity. `label`([ref]§三族B:durable 腿
113
113
  * 此前剥掉——同一 run live 观看有展示名、replay/resume 退化成 wire 名):core 展示名 verbatim(tail 面
114
114
  * 1.251 复审同裁,两腿同处理)。 */
115
115
  export declare function toolStartEventData(ev: {
@@ -165,11 +165,12 @@ export declare function taskProgressEventData(ev: {
165
165
  workflowRunId?: string;
166
166
  workflowAgentLabel?: string;
167
167
  seq?: number;
168
+ model?: string;
168
169
  }): Record<string, unknown>;
169
- /** The `task_notification` payload (core 1.202 design/115 P2: a background task finished — this event is the
170
+ /** The `task_notification` payload (core 1.202 [ref] P2: a background task finished — this event is the
170
171
  * LEDGER/display projection of the OBSERVED terminal state, emitted the moment core observes it. It does NOT
171
172
  * attest that the `<task-notification>` XML has entered the model context: core's steer targets the NEXT TURN
172
- * BOUNDARY (design/116 §7 — turn 在飞时不注入), so the frame can precede actual injection by minutes ([1818]
173
+ * BOUNDARY ([ref] §7 — turn 在飞时不注入), so the frame can precede actual injection by minutes ([ref]
173
174
  * clay live: 3m54s; the previous wording here — "core already injected in-process" — was the same wrong
174
175
  * assumption that broke the shell's dedup). `injected: false` says exactly that on the wire: a consumer must
175
176
  * NOT treat this frame as an echo of model-context injection. EXPLICIT WHITELIST (never `{...ev}` — the 1.72 task_progress lesson: a
@@ -209,10 +210,14 @@ export declare function taskNotificationEventData(ev: {
209
210
  completionId?: string;
210
211
  error?: string;
211
212
  errorCode?: string;
213
+ apiFailure?: {
214
+ status?: number;
215
+ requestId?: string;
216
+ };
212
217
  };
213
218
  eventId?: string;
214
219
  parentToolCallId?: string;
215
- /** design/373 §3.6(core 5.61.0,additive):本帧**投出去时的注入档位**。见下方投影处的键注 —— 它是
220
+ /** [ref] §3.6(core 5.61.0,additive):本帧**投出去时的注入档位**。见下方投影处的键注 —— 它是
216
221
  * **事件顶层**键,不是 {@link TaskNotificationPayload} 的键,所以只有把整只 core 事件交给本投影的腿
217
222
  * 拿得到它;只拿到载荷的 park-drain 腿结构上没有这一位。 */
218
223
  priority?: SystemInjectionPriority;
@@ -224,7 +229,7 @@ export declare function taskNotificationEventData(ev: {
224
229
  * cards from it): `path` is the engine's own working-file path (env-derived, not free text) but still crosses our
225
230
  * wire → `redactSecrets` (a project path can embed a secret-shaped dir name); chars/truncated are numeric/bool
226
231
  * verbatim. Absent fields stay absent (feature off / nothing attached / no kept-tail floor). */
227
- /** The `diagnostics` payload (core 1.220 design/121 — NEW LSP diagnostics drained at a turn boundary; the model
232
+ /** The `diagnostics` payload (core 1.220 [ref] — NEW LSP diagnostics drained at a turn boundary; the model
228
233
  * already got the `<new-diagnostics>` context message in-process, this frame is the shell's render source).
229
234
  * EXPLICIT WHITELIST shared by all three legs. UNTRUSTED RAW (§E1: language-server output over workspace files —
230
235
  * a diagnostic message can quote file content, a secret-shaped uri/source is possible) → `redactSecrets` on the
@@ -244,7 +249,7 @@ export declare function diagnosticsEventData(ev: {
244
249
  eventId?: string;
245
250
  parentToolCallId?: string;
246
251
  }): Record<string, unknown>;
247
- /** The `steering_injected` payload([1550]/[1552] 裁定透传;core `TaskEvent` 联合臂 `type: "steering_injected"`,
252
+ /** The `steering_injected` payload([ref]/[ref] 裁定透传;core `TaskEvent` 联合臂 `type: "steering_injected"`,
248
253
  * shell 渲染源 = CC 的系统提醒条:core 在 turn 之间给模型注入一条系统提示[todo 提醒/文件变化/日期跨天/
249
254
  * 技能列表变化…]时随手抛的展示投影,一附件一帧)。EXPLICIT WHITELIST(source=封闭枚举 verbatim;
250
255
  * preview=注入文本的展示摘录,UNTRUSTED[core 未做秘密脱敏]→ `redactSecrets`)。共享三腿(sync 实时 SSE +
@@ -255,8 +260,8 @@ export declare function steeringInjectedEventData(ev: {
255
260
  eventId?: string;
256
261
  parentToolCallId?: string;
257
262
  }): Record<string, unknown>;
258
- /** `compaction_outcome`(core 2.5.0 [2105]②:压缩非 compacted 结局——manual /compact 的 mooted/failed
259
- * 两条真路)。[2373]A-2/C-2:此前它是**唯一**不走共享 builder、只在 live 腿 res.write 内联挑键的
263
+ /** `compaction_outcome`(core 2.5.0 [ref]②:压缩非 compacted 结局——manual /compact 的 mooted/failed
264
+ * 两条真路)。[ref]A-2/C-2:此前它是**唯一**不走共享 builder、只在 live 腿 res.write 内联挑键的
260
265
  * 内容帧 ⇒ 两条 durable 腿零 case、回放即消失、三方普查各自失明。收进共享白名单 builder,三腿同源。
261
266
  * outcome/trigger=闭枚举 verbatim;reason=引擎说明文本(可能引用配置值)→ redactSecrets;identity 同款。 */
262
267
  export declare function compactionOutcomeEventData(ev: {
@@ -266,7 +271,7 @@ export declare function compactionOutcomeEventData(ev: {
266
271
  eventId?: unknown;
267
272
  parentToolCallId?: unknown;
268
273
  }): Record<string, unknown>;
269
- /** The `workspace_changed` payload([1559]二 core 裁定:design/99 §E13 旧臂,L1 门本车首次撞见——非新增,
274
+ /** The `workspace_changed` payload([ref]二 core 裁定:[ref] §E13 旧臂,L1 门本车首次撞见——非新增,
270
275
  * 是本门扩 TaskEvent 臂集时第一次显式处置。语义 = bash `cd`/EnterWorktree 移动任务逻辑 cwd 后,在移动
271
276
  * 它的工具结算后发一帧,给 shell/宿主 UI 一个路径提示行。cwd 与已展示的工具 args 同信任级[UNTRUSTED,
272
277
  * RAW 逻辑路径,symlink 不解析]→ `redactSecrets` + 长度 bound[300,与 brainStatusEventData.detail 同
@@ -278,13 +283,13 @@ export declare function workspaceChangedEventData(ev: {
278
283
  parentToolCallId?: string;
279
284
  }): Record<string, unknown>;
280
285
  /**
281
- * `wiring_manifest`(core 5.14.0 design/173 新 `TaskEvent` 臂)—— 每条腿(root/child/resume)在 prepare
286
+ * `wiring_manifest`(core 5.14.0 [ref] 新 `TaskEvent` 臂)—— 每条腿(root/child/resume)在 prepare
282
287
  * 时自证「我到底接了什么线」的清单帧。
283
288
  *
284
289
  * 🔴 **本构造器存在的唯一理由是剥掉 `governance` 段**。core 给该段盖了 `audience: "operator"` 并成文
285
290
  * 了服务层义务:*a serving layer forwarding this event to a multi-tenant stream MUST project the governance
286
291
  * section for operators only; **no projection ⇒ do not disclose***。我方的三条腿(sync SSE / durable 账本 /
287
- * resume 账本)都是租户可读面,而 operator 投影是 #154 的独立大件——按 core 写死的失败方向,**没有投影
292
+ * resume 账本)都是租户可读面,而 operator 投影是 [ref] 的独立大件——按 core 写死的失败方向,**没有投影
288
293
  * 就不得披露**,所以本批先把整段剥掉止泄(此前 sync 腿的裸 catch-all 会把它连同 `lockedConfig` /
289
294
  * `compliance` / `memoryAdmission` / `retention` 四个治理面在场位原样透传给任意订阅者)。
290
295
  * operator 投影是**另一个**构造器({@link wiringManifestOperatorEventData},live 腿按调用方身份挑),
@@ -296,23 +301,23 @@ export declare function workspaceChangedEventData(ev: {
296
301
  * 顺着 spread 裸上线,尤其当新段可能又是一个 audience 受限面时)。所有值都是引擎派生的闭枚举/布尔/
297
302
  * 有限数/不透明摘要串,**非用户内容 ⇒ 不脱敏**;畸形值一律按缺席处理(不铸假值,与 compacted 同规)。
298
303
  *
299
- * 🔴 **未标签面的准入裁定逐面记录在此,缺省不是「放行」**(#154 裁定 C)。core 只给 `governance` 标了
304
+ * 🔴 **未标签面的准入裁定逐面记录在此,缺省不是「放行」**([ref] 裁定 C)。core 只给 `governance` 标了
300
305
  * audience,其余段没有标签 —— 没标签**不等于**可以默认投给租户,每一段都要有一次人的裁定,写在这里:
301
306
  * · `interaction.posture`(三值:interactive / headless / absent)—— **裁:租户可见**。它是部署形的
302
307
  * 自述(这条腿有没有人能答问题),消费端据此决定渲不渲交互面;不是治理秘密,也不构成任何治理位的
303
308
  * 侧信道(它不参与 governance 那 4 个布尔的还原)。
304
- * · `permissionRules.storeWired`(布尔;core 5.18.0 design/179 新段)—— **裁:租户可见**。同族判据:
309
+ * · `permissionRules.storeWired`(布尔;core 5.18.0 [ref] 新段)—— **裁:租户可见**。同族判据:
305
310
  * 它与 `parkLane.capable` / `elicit.seamWired` / `fleet.backgroundAgentStore` 是同一类「这条腿接没接
306
311
  * 某个可选设施」的部署形自述,而那三个早已租户可见。消费端的真需求也在租户侧:审批卡要不要渲染
307
312
  * 「不再询问」这一格,取决于这台 worker 有没有规则店 —— 剥掉它,客户端只能靠试(提交后被拒)才知道。
308
313
  * 它**不在** `governance` 段里(core 自己把它放在段外),也不构成那 4 个治理布尔的侧信道。
309
314
  * ⚠️ 恒在段(core 侧 `permissionRules` 无 `?`):两个真值都可能出现,**别把 false 读成缺席**。
310
- * 本仓自 #154 车二 / design/203 起真接了规则店(`main.ts` 在 `PERMISSION_RULES_ENABLED` 为真 ∧
315
+ * 本仓自 [ref] 车二 / [ref] 起真接了规则店(`main.ts` 在 `PERMISSION_RULES_ENABLED` 为真 ∧
311
316
  * backend 在场时把 `permissionRuleStore` 装进 `RunnerDeps`,SQL 与 File 两形)⇒ 那样的部署报
312
317
  * `storeWired: true`;旋钮关掉或后端缺席的部署仍报 `false`。消费端读到 false 就是「这台 worker
313
318
  * 今天没有这条车道」,不许当成「这版引擎还没这个概念」。
314
- * · `permissionRules.syncWired` / `permissionRules.orgGoverned`(布尔两位;core 5.23.0 design/182 §9/§7
315
- * 给**同一段**加的员,[3372] 提货批 codex 复审 high 抓获——首版把它们静默剥了,正是本仓建这份台账要防
319
+ * · `permissionRules.syncWired` / `permissionRules.orgGoverned`(布尔两位;core 5.23.0 [ref] §9/§7
320
+ * 给**同一段**加的员,[ref] 提货批 codex 复审 high 抓获——首版把它们静默剥了,正是本仓建这份台账要防
316
321
  * 的「投影白名单剥键」病)—— **裁:租户可见,与同段的 `storeWired` 同待遇**。判据三条:
317
322
  * ① **同段同类**:core 把它们放进 `permissionRules` 而不是 `governance`(唯一带 audience 标签的段),
318
323
  * 且形状与 `storeWired` 逐字同构(恒在的布尔,present-and-false 表示「有这个概念,这里没开」);
@@ -323,7 +328,7 @@ export declare function workspaceChangedEventData(ev: {
323
328
  * ③ **不是治理侧信道**:两位都不参与 `governance` 那 4 个布尔的还原(它们描述规则店这条车道自身的
324
329
  * 形状,与 lockedConfig/compliance/memoryAdmission/retention 无函数关系)。
325
330
  * ⚠️ 与 `storeWired` **不同**:本仓这两条至今未接(`RunnerDeps.permissionRuleSyncWired` /
326
- * `permissionRuleOrg` 全树零声明点,2026-08-10 #204 复扫亲验)⇒ 今天恒 `false`,这是**真值**不是
331
+ * `permissionRuleOrg` 全树零声明点,2026-08-10 [ref] 复扫亲验)⇒ 今天恒 `false`,这是**真值**不是
327
332
  * 缺席。哪天接上其中任一条,连本句一起改 —— 这一行是它的登记处。
328
333
  * 未来 core 加一段而它没有 audience 标签时,**先在这里补一条裁定再决定挑不挑键** —— 段级完备性钉
329
334
  * (test/wiring-manifest-projection.test.ts)会在那一刻先把人拦下来。
@@ -334,7 +339,7 @@ export declare function wiringManifestEventData(ev: {
334
339
  parentToolCallId?: unknown;
335
340
  }): Record<string, unknown>;
336
341
  /**
337
- * `wiring_manifest` 的 **operator 投影**(#154 件一)—— {@link wiringManifestEventData} 的租户形加上
342
+ * `wiring_manifest` 的 **operator 投影**([ref] 件一)—— {@link wiringManifestEventData} 的租户形加上
338
343
  * `governance` 段与 core 的真 `configFingerprint`。
339
344
  *
340
345
  * 🔴 分叉发生在**读口**,不在账本:两条 durable 腿(ledger-sink / resume)恒存剥后形,因为账本写的那一刻
@@ -360,7 +365,7 @@ export declare function wiringManifestOperatorEventData(ev: {
360
365
  parentToolCallId?: unknown;
361
366
  }): Record<string, unknown>;
362
367
  /**
363
- * `human_input`(core 5.14.0 design/171 新 `TaskEvent` 臂)—— 「谁把什么喂进了这条 run」的生命周期账本
368
+ * `human_input`(core 5.14.0 [ref] 新 `TaskEvent` 臂)—— 「谁把什么喂进了这条 run」的生命周期账本
364
369
  * 帧(objective / 实时 steer / nextTurn / parked-steer 续跑 / wake 五个载体共用一个投影点)。
365
370
  *
366
371
  * 信任划线(与 tool_approval 帧同族):
@@ -439,7 +444,7 @@ export interface TraceTurn {
439
444
  ts: string;
440
445
  role: "system" | "user" | "assistant" | "tool";
441
446
  blocks: TraceBlock[];
442
- /** core 3.0.0([2296] 装车单 S3,§DESIGN-V2 V2-②):这是**本服务自有的投影契约**,不是 core wire 帧的
447
+ /** core 3.0.0([ref] 装车单 S3,§DESIGN-V2 V2-②):这是**本服务自有的投影契约**,不是 core wire 帧的
443
448
  * verbatim 转发——`in` 刻意保持它历史上的「总量」语义不变(旧帧/新帧读端零伤),不随 core 的
444
449
  * `promptTokens`/`turn_end.usage.inputTokens` 翻转为 cache-MISS。新增 `uncachedIn` 承接 core 3.0.0 才有的
445
450
  * cache-MISS 分量(命名取自 core `uncachedInputTokensOf`),只在能确认自己踩在新契约帧上时才发
@@ -453,7 +458,7 @@ export interface TraceTurn {
453
458
  };
454
459
  }
455
460
  /**
456
- * `context_usage` 的白名单投影(core 1.414 新增一等 `TaskEvent` 分支;server [1669]⑥ 点名要的上下文用量面)。
461
+ * `context_usage` 的白名单投影(core 1.414 新增一等 `TaskEvent` 分支;server [ref]⑥ 点名要的上下文用量面)。
457
462
  *
458
463
  * 🔴 两条 core 明确交代的口径,必须原样传下去、不要在服务端"聪明地"重算:
459
464
  * · `usedTokens > compactAtTokens` **就是引擎自己喂 `shouldCompact` 的谓词** —— 消费方直接用,别重新推导阈值。
@@ -477,7 +482,7 @@ export declare function contextUsageEventData(ev: {
477
482
  * · `stopReason` —— **这一轮为什么停**(max_tokens / stop_sequence / …);
478
483
  * · `usageMissing: true` —— **用量不可信**的诚实标记。缺了它,"没有 usage"会被读成"用量是 0",
479
484
  * 而不是"未知";这正是那种"回放后看起来一切正常"的丢失。
480
- * 两者**在 live 腿看得见、durable 腿回放后永久消失** —— 与 [1622] 的 `label`、[1611] 的 workflowRunId 同一族
485
+ * 两者**在 live 腿看得见、durable 腿回放后永久消失** —— 与 [ref] 的 `label`、[ref] 的 workflowRunId 同一族
481
486
  * (白名单没跟上 core 新增字段)。补 builder 的同时也就把它纳入了 `wire-whitelist-exhaustiveness` 的编译期差集门。
482
487
  */
483
488
  export declare function turnEndEventData(ev: {
@@ -491,13 +496,13 @@ export declare function turnEndEventData(ev: {
491
496
  * costMicroUsd; core 3.0.0 adds required `totalInputTokens`) → the contract's `TraceTurn.tokens`.
492
497
  * Absent/empty → undefined.
493
498
  *
494
- * core 3.0.0([2296] 装车单 S3,§DESIGN-V2 V2-②,codex 复审「异议」采纳):`TraceTurn.tokens` 是本服务自有
499
+ * core 3.0.0([ref] 装车单 S3,§DESIGN-V2 V2-②,codex 复审「异议」采纳):`TraceTurn.tokens` 是本服务自有
495
500
  * 的投影契约,不是 wire verbatim——`in` 保持它一直以来的**总量**语义,3.0.0 起改取 `totalInputTokens`
496
501
  * (归一化总输入含 cache)优先,`inputTokens` 回落(旧帧/尚未升级的 core 下 `totalInputTokens` 缺席时,
497
502
  * `in` 落回旧值,读端零伤)。`uncachedIn` 只在**能确认自己踩在新契约帧上**(`totalInputTokens` 在场)时
498
503
  * 才发——旧帧的 `inputTokens` 是族依赖的旧语义,标成「uncachedIn(cache-MISS)」会是谎言。 */
499
504
  export declare function toContractTokens(usage: unknown): TraceTurn["tokens"] | undefined;
500
- /** [2373]C-13:tool_start/tool_end 的**共享挑键**——`projectEvents`(turns 面)与 `mapTraceEvent`
505
+ /** [ref]C-13:tool_start/tool_end 的**共享挑键**——`projectEvents`(turns 面)与 `mapTraceEvent`
501
506
  * (trace SSE 面)对同一账本行的字段选择逐字同构,此前两处独立手写,structured/totalChars/label
502
507
  * 三次扩字段各改两遍(见两处对偶注)。收一份:两面各自包装键名皮(id/name/input vs 同名),
503
508
  * 字段集合从此单点演进。 */
@@ -539,7 +544,7 @@ export interface TaskSummary {
539
544
  /** A run record → the cheap list summary (contract 2.1). Token/cost/turns come from the terminal result.stats;
540
545
  * scenario isn't denormalized on the run row (omitted — a later push-index/column refinement). */
541
546
  export declare function taskSummary(run: RunRecord, latestEventType?: string): TaskSummary;
542
- /** design/158 B2(lens4 N8)—— 重放边界的**读旧**归一:把历史账本里的 `brain_status` 行改叫 `status`。
547
+ /** [ref] B2(lens4 N8)—— 重放边界的**读旧**归一:把历史账本里的 `brain_status` 行改叫 `status`。
543
548
  *
544
549
  * 同一条「大脑存活性」观测曾在两条腿上叫两个名字:live 腿(`POST /v1/tasks/stream`)发 `type:"status"`,
545
550
  * durable 腿的账本行落 `brain_status`,而 SDK 的公开 `AgentEvent` 联合**只有** `status` —— 于是走
@@ -106,6 +106,7 @@ export function taskProgressEventData(ev) {
106
106
  ...(typeof ev.taskType === "string" && ev.taskType.length > 0 ? { taskType: ev.taskType } : {}),
107
107
  ...(ev.parentTaskId ? { parentTaskId: ev.parentTaskId } : {}),
108
108
  ...(ev.name ? { name: redactSecrets(ev.name) } : {}),
109
+ ...(typeof ev.model === "string" && ev.model.length > 0 ? { model: ev.model } : {}),
109
110
  ...(ev.status !== undefined ? { status: ev.status } : {}),
110
111
  ...(ev.usage ? { usage: ev.usage } : {}),
111
112
  ...(ev.currentAction ? { currentAction: redactSecrets(ev.currentAction) } : {}),
@@ -129,6 +130,14 @@ export function taskNotificationEventData(ev) {
129
130
  ...(n.completionId !== undefined ? { completionId: n.completionId } : {}),
130
131
  ...(n.error !== undefined ? { error: redactSecrets(n.error) } : {}),
131
132
  ...(n.errorCode !== undefined ? { errorCode: n.errorCode } : {}),
133
+ ...(n.apiFailure !== undefined
134
+ ? {
135
+ apiFailure: {
136
+ ...(typeof n.apiFailure.status === "number" ? { status: n.apiFailure.status } : {}),
137
+ ...(typeof n.apiFailure.requestId === "string" ? { requestId: n.apiFailure.requestId } : {}),
138
+ },
139
+ }
140
+ : {}),
132
141
  ...(n.source !== undefined ? { source: redactSecrets(n.source) } : {}),
133
142
  ...(n.exitCode !== undefined ? { exitCode: n.exitCode } : {}),
134
143
  ...(n.partial !== undefined ? { partial: n.partial } : {}),
@@ -1,17 +1,17 @@
1
1
  /**
2
- * #245 S1([3777] 决策卡死墙攻关):进程内 per-task「turn 最后活性时刻」——running 形 409 与
2
+ * [ref] S1([ref] 决策卡死墙攻关):进程内 per-task「turn 最后活性时刻」——running 形 409 与
3
3
  * GET /v1/runs/:id 读面的判别材料 `msSinceLastActivity` 的唯一数据源。
4
4
  *
5
5
  * 【为什么需要它】run 行的 `updatedAt` 由 liveness heartbeat(独立 `setInterval`,runs.ts)推进——
6
- * 它只证明 **server 进程**活着;turn 卡死在某个 await 上时心跳照走([3771] 推理缺陷的公开更正)。
6
+ * 它只证明 **server 进程**活着;turn 卡死在某个 await 上时心跳照走([ref] 推理缺陷的公开更正)。
7
7
  * 「turn 真在推进」的证据 = ledger sink 的 durable append(text/tool/status/park/done 全族都过那一条
8
- * 单写串行链)。cli 的 running 形保守臂([3779] C3)缺的就是这一维:没有它,「真忙的后台 run」与
8
+ * 单写串行链)。cli 的 running 形保守臂([ref] C3)缺的就是这一维:没有它,「真忙的后台 run」与
9
9
  * 「断连僵局」在 wire 上不可分辨,只能猜。
10
10
  *
11
11
  * 【语义边界(与消费端约定,勿漂)】
12
12
  * - **同副本 best-effort**:记录只活在本进程。跨副本命中(claim 持有者在别的副本)或本副本重启后
13
13
  * ⇒ 读不到 ⇒ wire 键**诚实缺席**——缺席 = 「无法证明」,不是「不活」。绝不铸 0(0 会被读成
14
- * 「刚刚还活着」,错误方向与 [2255] 「宁缺毋假」纪律同族)。
14
+ * 「刚刚还活着」,错误方向与 [ref] 「宁缺毋假」纪律同族)。
15
15
  * - 不落库、不进 SQL 面:这是分诊提示,不是状态机输入;任何门/CAS/resume 判定都不许读它。
16
16
  *
17
17
  * 【生命周期】终局**不主动清**——409 只在 `running` 行上消费本记录,终局行不进那个分支,残留无害;
@@ -31,7 +31,7 @@ export interface UsageRow {
31
31
  /**
32
32
  * 一行 per-model echo。**五键逐个可选**——本类型描述的不是本进程铸的对象,而是 **DB 里 result JSON 的一段**:
33
33
  * 旧版本写的行、别的 producer 写的行、以及 wire 契约本身(SDK `ModelUsageDelta` 五键全可选 + `[k]:unknown`
34
- * 开放)都可能少键。#59([2052]①):此处原先声明成「全必填」,`projectUsageStats` 又对任意 JSON 做裸 cast,
34
+ * 开放)都可能少键。#59([ref]①):此处原先声明成「全必填」,`projectUsageStats` 又对任意 JSON 做裸 cast,
35
35
  * 于是 fold 侧的裸算术遇缺席就产出 NaN,**一行毒一整窗**(NaN 沿 Σ 传染,JSON.stringify(NaN)==="null",
36
36
  * 消费端读到的是「没有数」而不是「少了一行」)。声明改诚实 + fold 侧 {@link numOf} 数值守卫。
37
37
  */
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * 墙钟阶跃守卫 —— 给「按墙钟绝对 deadline 做终局判定」的清算腿加一道**单调钟佐证**。
3
3
  *
4
- * 病灶(test [4232] 场景①,libfaketime 真实构造,宿主真钟全程未碰):审批 SLA=45s,把进程内墙钟
4
+ * 病灶(test [ref] 场景①,libfaketime 真实构造,宿主真钟全程未碰):审批 SLA=45s,把进程内墙钟
5
5
  * **前拨 1 小时**,真实只等了约 14 秒审批卡就被 D-D deny-sweep 判超时自动拒绝。链条是清楚的:
6
6
  * `checkpoint.deadline` 是 core 在 `put` 时按**当时的墙钟**铸的绝对时刻(必须是墙钟——它要跨进程
7
7
  * 重启存活,单调基准一重启就没了),而 sweep 每拍拿 `Date.now()` 去比 `deadline <= cutoff`。墙钟凭空
8
8
  * 前跳 J 毫秒 ⇒ 判定钟凭空多走 J 毫秒 ⇒ 人还没走开,窗就没了。
9
9
  *
10
- * [4235] core 半场三定性把判定半场划给本仓:`totalWaitMs` 的墙钟**记账**是设计如此(要跨 durable
10
+ * [ref] core 半场三定性把判定半场划给本仓:`totalWaitMs` 的墙钟**记账**是设计如此(要跨 durable
11
11
  * resume 延续),不改形;**判定**侧可以在进程内用单调钟做窗口佐证,与账面字段互不牵连。本模块就是那道佐证。
12
12
  *
13
13
  * ## 判据(为什么是「宽限一个完整 SLA」)
@@ -37,7 +37,7 @@
37
37
  * 不稳的钟判,也不让 fail-closed 腿永远不跑。绝对兜底始终另有一层:`checkpoint.terminal_at_ms` 由别的
38
38
  * reap 腿执行、不经本守卫。
39
39
  *
40
- * ## 方向与响亮度(#157 安全轴)
40
+ * ## 方向与响亮度([ref] 安全轴)
41
41
  * 宽限只会**推迟**一个 fail-closed 动作(deny),绝不会放行任何东西 —— 方向安全。但它必须**响亮**:
42
42
  * 检出即 warn(带跳变量与宽限量),宽限期内每拍 info。绝对兜底仍在:`checkpoint.terminal_at_ms`
43
43
  * (put 时写死的绝对上限)由另一条 reap 腿执行,不经本守卫 ⇒ 悬挂不可能无限。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/server",
3
- "version": "7.52.0",
3
+ "version": "7.53.0",
4
4
  "description": "Sema Server — the server/API implementation layer for Sema, wiring core, registry, model providers, and cloud agent execution. Built on @sema-agent/core.",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "scripts": {
38
38
  "typecheck": "tsc --noEmit -p tsconfig.typecheck.json",
39
- "build": "rm -rf dist && tsc -p tsconfig.build-js.json && tsc -p tsconfig.build-dts.json",
40
- "prepublishOnly": "npm run build",
39
+ "build": "rm -rf dist && tsc -p tsconfig.build-js.json && tsc -p tsconfig.build-dts.json && node scripts/scrub-dist-refs.mjs dist",
40
+ "prepublishOnly": "npm run build && vitest run test/pack-hygiene.test.ts",
41
41
  "start": "node dist/main.js",
42
42
  "dev": "tsx src/main.ts",
43
43
  "run-local": "node dist/run-local.js",
@@ -54,8 +54,8 @@
54
54
  "build:binary:run-local:darwin-arm64": "bun build --compile --target=bun-darwin-arm64 src/run-local.ts --outfile dist/run-local-darwin-arm64"
55
55
  },
56
56
  "dependencies": {
57
- "@sema-agent/core": "7.0.0",
58
- "@sema-agent/settings-schema": "1.0.0",
57
+ "@sema-agent/core": "7.0.2",
58
+ "@sema-agent/settings-schema": "1.3.0",
59
59
  "e2b": "^2.28.0",
60
60
  "libsodium-wrappers": "^0.8.4",
61
61
  "mysql2": "^3.22.4",
@@ -69,7 +69,7 @@
69
69
  "sharp": "^0.35.3"
70
70
  },
71
71
  "devDependencies": {
72
- "@sema-agent/sdk": "7.2.0",
72
+ "@sema-agent/sdk": "7.3.0",
73
73
  "@types/libsodium-wrappers": "^0.7.14",
74
74
  "@types/node": "22.10.2",
75
75
  "@types/pg": "^8.20.0",