@sema-agent/server 7.133.0 → 7.135.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 (526) hide show
  1. package/MIGRATION.md +221 -0
  2. package/README.md +2 -2
  3. package/README.zh-CN.md +2 -2
  4. package/USAGE.md +222 -36
  5. package/deploy/sema-up/README.md +16 -0
  6. package/deploy/sema-up/chart/Chart.yaml +1 -1
  7. package/deploy/sema-up/chart/templates/NOTES.txt +15 -0
  8. package/deploy/sema-up/chart/templates/_helpers.tpl +129 -0
  9. package/deploy/sema-up/chart/templates/sealed-key.yaml +24 -0
  10. package/deploy/sema-up/chart/templates/server-v4pro.yaml +14 -0
  11. package/deploy/sema-up/chart/templates/server.yaml +14 -0
  12. package/deploy/sema-up/chart/values-full-single.yaml +5 -1
  13. package/deploy/sema-up/chart/values.yaml +34 -0
  14. package/dist/adoption/plan.d.ts +1 -1
  15. package/dist/approval-ask-audit-store.d.ts +25 -25
  16. package/dist/approval-ask-machine.d.ts +2 -2
  17. package/dist/approval-card.d.ts +66 -154
  18. package/dist/approval-card.js +33 -52
  19. package/dist/approval-content-kind.d.ts +26 -6
  20. package/dist/approval-content-kind.js +23 -3
  21. package/dist/approval-deny-reasons.d.ts +1 -1
  22. package/dist/approval-gate-currency.d.ts +91 -0
  23. package/dist/approval-gate-currency.js +120 -0
  24. package/dist/approval-hmac.d.ts +7 -7
  25. package/dist/approval-policy-settlement.d.ts +2 -2
  26. package/dist/approval-reconciler.d.ts +3 -3
  27. package/dist/approval.d.ts +14 -8
  28. package/dist/approval.js +35 -16
  29. package/dist/auth-bridge.d.ts +1 -1
  30. package/dist/auto-mode-face.d.ts +4 -4
  31. package/dist/background-session-reap.d.ts +2 -2
  32. package/dist/bake-runner/main.d.ts +2 -2
  33. package/dist/bake-runner/runner.d.ts +4 -4
  34. package/dist/bench/s1/live-deps.d.ts +1 -1
  35. package/dist/bench/s1/run-firm.d.ts +1 -1
  36. package/dist/boot/coordinators.d.ts +7 -2
  37. package/dist/boot/coordinators.js +8 -5
  38. package/dist/boot/deferred-sandbox-path-env.d.ts +0 -6
  39. package/dist/boot/deferred-sandbox-path-env.js +0 -5
  40. package/dist/boot/engine-lease.d.ts +5 -5
  41. package/dist/boot/execution-env.d.ts +16 -15
  42. package/dist/boot/execution-env.js +19 -21
  43. package/dist/boot/fatal-exit.d.ts +2 -2
  44. package/dist/boot/late-binds.d.ts +1 -1
  45. package/dist/boot/leader.d.ts +2 -0
  46. package/dist/boot/leader.js +2 -1
  47. package/dist/boot/memory-boundary.d.ts +2 -2
  48. package/dist/boot/memory-consolidation.d.ts +15 -15
  49. package/dist/boot/parked-revive-gate.d.ts +3 -3
  50. package/dist/boot/parked-revive-gate.js +3 -2
  51. package/dist/boot/read-deny-anchor-audit.js +2 -2
  52. package/dist/boot/reapers.d.ts +4 -4
  53. package/dist/boot/resolve-spec.d.ts +1 -1
  54. package/dist/boot/resolve-spec.js +28 -24
  55. package/dist/boot/runner-deps.d.ts +29 -16
  56. package/dist/boot/runner-deps.js +12 -2
  57. package/dist/boot/session-faces.d.ts +3 -3
  58. package/dist/boot/session-faces.js +11 -30
  59. package/dist/boot/shutdown.d.ts +5 -5
  60. package/dist/boot/side-query-lane.d.ts +2 -2
  61. package/dist/boot/stage-05-execution-env.js +4 -4
  62. package/dist/boot/stage-06-runners.d.ts +4 -3
  63. package/dist/boot/stage-06-runners.js +15 -4
  64. package/dist/boot/stage-07-capability-layer.d.ts +2 -1
  65. package/dist/boot/stage-08-reapers.d.ts +2 -1
  66. package/dist/boot/stage-09-leader.d.ts +2 -1
  67. package/dist/boot/stage-09-leader.js +2 -2
  68. package/dist/boot/stage-10-http-server.d.ts +2 -1
  69. package/dist/boot/stage-10-http-server.js +2 -1
  70. package/dist/boot/stores.d.ts +8 -0
  71. package/dist/boot/stores.js +10 -13
  72. package/dist/boot/web-admin.d.ts +21 -15
  73. package/dist/boot/web-admin.js +16 -12
  74. package/dist/boot/workflow-orchestration.js +2 -9
  75. package/dist/brain.d.ts +11 -11
  76. package/dist/budget.d.ts +4 -4
  77. package/dist/budget.js +5 -1
  78. package/dist/caller-text-echo.d.ts +2 -0
  79. package/dist/caller-text-echo.js +2 -1
  80. package/dist/canonical-json.d.ts +2 -41
  81. package/dist/canonical-json.js +2 -13
  82. package/dist/capabilities/approvals-push.d.ts +4 -4
  83. package/dist/capabilities/builtin-tools.d.ts +5 -5
  84. package/dist/capabilities/center-plugins.d.ts +5 -5
  85. package/dist/capabilities/center-plugins.js +1 -1
  86. package/dist/capabilities/center-prompts.d.ts +1 -1
  87. package/dist/capabilities/center-wiring.d.ts +1 -1
  88. package/dist/capabilities/composite-members.d.ts +2 -2
  89. package/dist/capabilities/composite-members.js +1 -1
  90. package/dist/capabilities/execution-lane.d.ts +5 -5
  91. package/dist/capabilities/execution-lane.js +2 -2
  92. package/dist/capabilities/hands-lane.d.ts +5 -5
  93. package/dist/capabilities/mcp-probe.d.ts +10 -7
  94. package/dist/capabilities/mcp-probe.js +2 -2
  95. package/dist/capabilities/sandbox-file-send.d.ts +1 -18
  96. package/dist/capabilities/sandbox-file-send.js +0 -7
  97. package/dist/capabilities/scenarios.d.ts +28 -10
  98. package/dist/capabilities/scenarios.js +15 -5
  99. package/dist/capabilities/send-user-file-tool.d.ts +1 -1
  100. package/dist/capabilities/skills.d.ts +31 -12
  101. package/dist/capabilities/skills.js +23 -17
  102. package/dist/capabilities/tool-defer.d.ts +1 -1
  103. package/dist/capability-facts.d.ts +27 -24
  104. package/dist/capability-facts.js +18 -20
  105. package/dist/center-config-tier.d.ts +1 -1
  106. package/dist/center-credential.d.ts +4 -4
  107. package/dist/checkpoint-ctx-seal-m28.d.ts +42 -0
  108. package/dist/checkpoint-ctx-seal-m28.js +19 -0
  109. package/dist/checkpoint-identity.d.ts +5 -0
  110. package/dist/checkpoint-identity.js +14 -0
  111. package/dist/config-catalog.d.ts +12 -12
  112. package/dist/config-invariants.d.ts +4 -4
  113. package/dist/config-invariants.js +3 -2
  114. package/dist/config-lkg.d.ts +1 -1
  115. package/dist/config-provider.d.ts +13 -13
  116. package/dist/config-provider.js +2 -1
  117. package/dist/config-types.d.ts +83 -83
  118. package/dist/config.d.ts +26 -24
  119. package/dist/config.js +12 -10
  120. package/dist/cross-session-settings.d.ts +1 -1
  121. package/dist/delegated-session-owner.d.ts +16 -13
  122. package/dist/delegated-session-owner.js +9 -10
  123. package/dist/deployment-governance.d.ts +16 -16
  124. package/dist/deployment-shape.d.ts +127 -0
  125. package/dist/deployment-shape.js +72 -0
  126. package/dist/device-store.d.ts +1 -1
  127. package/dist/device-ws-hub.d.ts +1 -1
  128. package/dist/egress-redirect.d.ts +1 -1
  129. package/dist/entry-mode-clamp-notice.d.ts +2 -2
  130. package/dist/env-facts.d.ts +10 -9
  131. package/dist/env-facts.js +1 -1
  132. package/dist/env-name-allowlist-knobs.d.ts +5 -5
  133. package/dist/exec-bounds.d.ts +2 -2
  134. package/dist/execution-lane-caps.d.ts +31 -43
  135. package/dist/execution-lane-caps.js +0 -13
  136. package/dist/field-conflict.d.ts +2 -1
  137. package/dist/field-conflict.js +1 -0
  138. package/dist/file-history-capture.d.ts +9 -9
  139. package/dist/file-history-disclosure.d.ts +50 -9
  140. package/dist/file-history-disclosure.js +8 -13
  141. package/dist/fleet/drain-entry.d.ts +2 -2
  142. package/dist/fleet/fleet-bus.d.ts +26 -14
  143. package/dist/fleet/fleet-bus.js +6 -5
  144. package/dist/fleet/fleet-reconciler.d.ts +9 -9
  145. package/dist/fleet/subagent-tail-bus.d.ts +4 -4
  146. package/dist/fleet-client.d.ts +13 -13
  147. package/dist/fleet-lease.d.ts +16 -16
  148. package/dist/governance-http-status.d.ts +2 -2
  149. package/dist/hooks/hook-llm.d.ts +7 -7
  150. package/dist/hooks/hook-runner.d.ts +57 -30
  151. package/dist/hooks/hook-runner.js +38 -20
  152. package/dist/host-decision.d.ts +5 -5
  153. package/dist/host-lsp-manager.d.ts +5 -5
  154. package/dist/hosted-posture.d.ts +23 -13
  155. package/dist/hosted-posture.js +4 -9
  156. package/dist/http/admission.d.ts +2 -2
  157. package/dist/http/admission.js +28 -5
  158. package/dist/http/approval-sweeps.d.ts +1 -1
  159. package/dist/http/approval-sweeps.js +5 -2
  160. package/dist/http/checkpoint-ctx.d.ts +183 -2
  161. package/dist/http/checkpoint-ctx.js +197 -2
  162. package/dist/http/dispatch.d.ts +3 -3
  163. package/dist/http/dispatch.js +3 -3
  164. package/dist/http/durable-run-leg.js +7 -5
  165. package/dist/http/idempotency.d.ts +4 -4
  166. package/dist/http/idempotency.js +2 -2
  167. package/dist/http/mcp-dial-deadline.d.ts +7 -5
  168. package/dist/http/memory-compliance-failure-reply.d.ts +4 -4
  169. package/dist/http/owner-access.d.ts +4 -6
  170. package/dist/http/owner-access.js +1 -1
  171. package/dist/http/principal-gate.d.ts +39 -13
  172. package/dist/http/principal-gate.js +30 -6
  173. package/dist/http/readiness.d.ts +1 -1
  174. package/dist/http/refusal-body.d.ts +12 -0
  175. package/dist/http/refusal-body.js +11 -0
  176. package/dist/http/request-guards.d.ts +4 -13
  177. package/dist/http/request-guards.js +4 -17
  178. package/dist/http/resume-ctx-read.d.ts +53 -6
  179. package/dist/http/resume-ctx-read.js +26 -3
  180. package/dist/http/resume-legs.d.ts +5 -4
  181. package/dist/http/resume-legs.js +47 -29
  182. package/dist/http/route-ctx.d.ts +29 -38
  183. package/dist/http/route-table.d.ts +9 -9
  184. package/dist/http/routes/agents-roster.d.ts +1 -1
  185. package/dist/http/routes/agents-roster.js +2 -3
  186. package/dist/http/routes/approvals-assistant.d.ts +5 -5
  187. package/dist/http/routes/approvals-assistant.js +91 -17
  188. package/dist/http/routes/background.d.ts +3 -3
  189. package/dist/http/routes/background.js +2 -2
  190. package/dist/http/routes/capabilities.d.ts +1 -1
  191. package/dist/http/routes/capabilities.js +16 -8
  192. package/dist/http/routes/config-catalog.d.ts +1 -1
  193. package/dist/http/routes/devices.d.ts +1 -1
  194. package/dist/http/routes/diagnostics.d.ts +6 -6
  195. package/dist/http/routes/diagnostics.js +1 -1
  196. package/dist/http/routes/fleet.d.ts +1 -1
  197. package/dist/http/routes/fleet.js +5 -4
  198. package/dist/http/routes/mcp-reconnect.d.ts +4 -4
  199. package/dist/http/routes/mcp-reconnect.js +3 -3
  200. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  201. package/dist/http/routes/memory-origin.d.ts +1 -1
  202. package/dist/http/routes/notify-wake.d.ts +1 -1
  203. package/dist/http/routes/notify-wake.js +2 -2
  204. package/dist/http/routes/rules.d.ts +1 -1
  205. package/dist/http/routes/rules.js +4 -4
  206. package/dist/http/routes/runs.js +44 -11
  207. package/dist/http/routes/session-sync.d.ts +3 -2
  208. package/dist/http/routes/session-sync.js +109 -62
  209. package/dist/http/routes/sessions-list.d.ts +1 -1
  210. package/dist/http/routes/sessions-list.js +4 -5
  211. package/dist/http/routes/sessions.js +34 -48
  212. package/dist/http/routes/tasks.d.ts +1 -1
  213. package/dist/http/routes/tasks.js +21 -16
  214. package/dist/http/routes/trace-usage.d.ts +1 -1
  215. package/dist/http/routes/trace-usage.js +7 -9
  216. package/dist/http/routes/workflows.d.ts +3 -0
  217. package/dist/http/routes/workflows.js +31 -28
  218. package/dist/http/send.d.ts +5 -5
  219. package/dist/http/server.d.ts +39 -33
  220. package/dist/http/server.js +5 -2
  221. package/dist/http/session-inherit-env.d.ts +3 -3
  222. package/dist/http/sse-lifecycle.d.ts +1 -1
  223. package/dist/http/sse-log.d.ts +2 -2
  224. package/dist/http/submit-ctx.d.ts +4 -3
  225. package/dist/http/submit-ctx.js +19 -3
  226. package/dist/http/sync-submit-body.d.ts +1 -1
  227. package/dist/http/verify-rounds.d.ts +1 -1
  228. package/dist/http/wire-types.d.ts +35 -24
  229. package/dist/index.d.ts +2 -0
  230. package/dist/index.js +1 -0
  231. package/dist/instruction-source-notice.d.ts +2 -2
  232. package/dist/key-resolver.d.ts +3 -3
  233. package/dist/lane-home-probe.d.ts +1 -1
  234. package/dist/leader/diffout.d.ts +1 -1
  235. package/dist/leader/diffup.d.ts +2 -2
  236. package/dist/leader/endpoint.d.ts +1 -1
  237. package/dist/leader/fanout.d.ts +1 -1
  238. package/dist/leader/leader.d.ts +4 -4
  239. package/dist/leader/merge.d.ts +3 -3
  240. package/dist/leader/repair-wire.d.ts +1 -1
  241. package/dist/leader/wire.d.ts +9 -5
  242. package/dist/leader/wire.js +8 -7
  243. package/dist/list-entry-display.d.ts +1 -1
  244. package/dist/lsp-evict.d.ts +1 -1
  245. package/dist/main.js +1 -1
  246. package/dist/mcp-assertion-header.d.ts +1 -1
  247. package/dist/memory-layer-legacy-lock.d.ts +1 -1
  248. package/dist/memory-operator-faces.d.ts +1 -1
  249. package/dist/memory-origin-fence.js +2 -2
  250. package/dist/memory-posture.js +4 -2
  251. package/dist/memory-project-layer.d.ts +1 -1
  252. package/dist/memory-scope.d.ts +19 -19
  253. package/dist/memory-store-refusal.d.ts +4 -4
  254. package/dist/model-compat.d.ts +1 -1
  255. package/dist/model-entry-headers.d.ts +2 -2
  256. package/dist/model-entry-refusal.d.ts +17 -17
  257. package/dist/model-provider.d.ts +10 -10
  258. package/dist/model-reach-scope.d.ts +1 -1
  259. package/dist/model-route-endpoint.d.ts +6 -6
  260. package/dist/model-route-url.d.ts +5 -5
  261. package/dist/model-select.d.ts +15 -6
  262. package/dist/model-select.js +5 -0
  263. package/dist/model-unreachable-notice.d.ts +3 -3
  264. package/dist/namespaced-rule-name.d.ts +15 -5
  265. package/dist/namespaced-rule-name.js +3 -2
  266. package/dist/observability/corrupt-read-seat.d.ts +9 -9
  267. package/dist/observability/cost-taxonomy.d.ts +1 -1
  268. package/dist/observability/err-text.d.ts +1 -1
  269. package/dist/observability/fail-open.d.ts +12 -8
  270. package/dist/observability/fail-open.js +12 -8
  271. package/dist/observability/metrics.d.ts +3 -3
  272. package/dist/observability/prompt-manifest.d.ts +19 -8
  273. package/dist/observability/prompt-manifest.js +9 -8
  274. package/dist/observability/run-terminal.d.ts +36 -36
  275. package/dist/observability/secret-env-scrub.d.ts +3 -3
  276. package/dist/observability/tool-trace.d.ts +1 -1
  277. package/dist/observability/tool-trace.js +8 -9
  278. package/dist/operator-ask.d.ts +4 -4
  279. package/dist/orchestration/workflow-agent-session-index.d.ts +3 -3
  280. package/dist/orchestration/workflow-completion-inbox.d.ts +20 -5
  281. package/dist/orchestration/workflow-completion-inbox.js +29 -7
  282. package/dist/orchestration/workflow-notify-journal.d.ts +43 -19
  283. package/dist/orchestration/workflow-notify-journal.js +17 -0
  284. package/dist/orchestration/workflow-park-decision.d.ts +1 -1
  285. package/dist/orchestration/workflow-park-decision.js +1 -0
  286. package/dist/outbound-dispatcher.d.ts +4 -4
  287. package/dist/parent-watch.d.ts +4 -4
  288. package/dist/parked-decide.d.ts +20 -20
  289. package/dist/parked-decide.js +8 -5
  290. package/dist/parked-revive-surface.d.ts +7 -7
  291. package/dist/parked-revive-surface.js +2 -3
  292. package/dist/peer-directory.d.ts +3 -3
  293. package/dist/peer-directory.js +1 -1
  294. package/dist/permission-rule-list.d.ts +10 -1
  295. package/dist/permission-rule-list.js +7 -5
  296. package/dist/permission-rule-vocab.d.ts +3 -25
  297. package/dist/permission-rule-vocab.js +0 -13
  298. package/dist/plugins/adoption-log-sql.d.ts +1 -1
  299. package/dist/plugins/approval-ask-store-file.d.ts +8 -1
  300. package/dist/plugins/approval-ask-store-file.js +6 -3
  301. package/dist/plugins/approval-ask-store-memory.d.ts +11 -7
  302. package/dist/plugins/approval-ask-store-memory.js +11 -7
  303. package/dist/plugins/approval-ask-store-sql.d.ts +34 -15
  304. package/dist/plugins/approval-ask-store-sql.js +18 -5
  305. package/dist/plugins/approval-exemption-store.d.ts +3 -3
  306. package/dist/plugins/approval-nonce-store.d.ts +3 -3
  307. package/dist/plugins/approval-payload-fingerprint.d.ts +14 -6
  308. package/dist/plugins/approval-payload-fingerprint.js +1 -1
  309. package/dist/plugins/background-agent-store-sql.d.ts +1 -1
  310. package/dist/plugins/background-shell-support.d.ts +2 -2
  311. package/dist/plugins/blob-backend.d.ts +1 -1
  312. package/dist/plugins/caching-session-store.d.ts +24 -33
  313. package/dist/plugins/caching-session-store.js +8 -19
  314. package/dist/plugins/checkpoint-index-columns.d.ts +81 -0
  315. package/dist/plugins/checkpoint-index-columns.js +62 -0
  316. package/dist/plugins/checkpoint-store-sql.d.ts +66 -67
  317. package/dist/plugins/checkpoint-store-sql.js +100 -103
  318. package/dist/plugins/device-store-sql.d.ts +7 -6
  319. package/dist/plugins/e2b-orphan-reclaim.d.ts +1 -1
  320. package/dist/plugins/ensure-schema-lock-policy.d.ts +1 -1
  321. package/dist/plugins/file-history-store-sql.d.ts +9 -7
  322. package/dist/plugins/file-history-store-sql.js +27 -15
  323. package/dist/plugins/file-run-store.d.ts +8 -8
  324. package/dist/plugins/fork-routing-session-store.d.ts +2 -2
  325. package/dist/plugins/fork-routing-session-store.js +1 -1
  326. package/dist/plugins/host-platform.d.ts +10 -10
  327. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  328. package/dist/plugins/image-index-sql.d.ts +1 -1
  329. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  330. package/dist/plugins/local-checkpoint-store.d.ts +23 -12
  331. package/dist/plugins/local-checkpoint-store.js +29 -4
  332. package/dist/plugins/local-session-store.d.ts +44 -45
  333. package/dist/plugins/local-session-store.js +42 -52
  334. package/dist/plugins/local-session-window.d.ts +12 -6
  335. package/dist/plugins/local-session-window.js +1 -17
  336. package/dist/plugins/mailbox-store-sql.d.ts +2 -2
  337. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  338. package/dist/plugins/memory-run-store.d.ts +4 -4
  339. package/dist/plugins/memory-sync-store-pg.d.ts +3 -3
  340. package/dist/plugins/one-time-migrations.d.ts +76 -39
  341. package/dist/plugins/one-time-migrations.js +127 -34
  342. package/dist/plugins/outcome-ledger-sql.d.ts +1 -1
  343. package/dist/plugins/park-commit-watch.d.ts +3 -3
  344. package/dist/plugins/permission-rule-store-file.d.ts +5 -5
  345. package/dist/plugins/permission-rule-store-file.js +16 -19
  346. package/dist/plugins/permission-rule-store-sql.d.ts +38 -4
  347. package/dist/plugins/permission-rule-store-sql.js +74 -31
  348. package/dist/plugins/pg-cost-quota.d.ts +1 -1
  349. package/dist/plugins/pg-pool.d.ts +2 -2
  350. package/dist/plugins/pg-pool.js +5 -2
  351. package/dist/plugins/pg-rate-limiter.d.ts +1 -1
  352. package/dist/plugins/pg-session-storage.d.ts +9 -21
  353. package/dist/plugins/pg-session-storage.js +51 -42
  354. package/dist/plugins/remote-env-adb.d.ts +10 -10
  355. package/dist/plugins/remote-env-device.d.ts +22 -14
  356. package/dist/plugins/remote-env-device.js +28 -16
  357. package/dist/plugins/remote-env-e2b.d.ts +3 -3
  358. package/dist/plugins/remote-env-host.d.ts +16 -16
  359. package/dist/plugins/remote-env-k8s.d.ts +8 -8
  360. package/dist/plugins/remote-env-local-docker.d.ts +2 -2
  361. package/dist/plugins/remote-env-ssh.d.ts +4 -4
  362. package/dist/plugins/remote-scratchpad.d.ts +2 -3
  363. package/dist/plugins/remote-scratchpad.js +0 -4
  364. package/dist/plugins/remote-shell.d.ts +6 -6
  365. package/dist/plugins/retention-lane-store-sql.d.ts +4 -4
  366. package/dist/plugins/retention-store-sql.d.ts +4 -4
  367. package/dist/plugins/roster-store-sql.d.ts +1 -1
  368. package/dist/plugins/run-store-sql.d.ts +8 -8
  369. package/dist/plugins/schema-consistency.d.ts +2 -2
  370. package/dist/plugins/schema-ensure-legs.d.ts +3 -3
  371. package/dist/plugins/schema-indexes.d.ts +1 -1
  372. package/dist/plugins/schema-live-columns.d.ts +1 -1
  373. package/dist/plugins/session-event-payload.d.ts +4 -4
  374. package/dist/plugins/session-fork.d.ts +34 -0
  375. package/dist/plugins/session-fork.js +29 -0
  376. package/dist/plugins/session-ownership.d.ts +11 -0
  377. package/dist/plugins/session-ownership.js +11 -0
  378. package/dist/plugins/session-placement.d.ts +12 -14
  379. package/dist/plugins/session-placement.js +2 -15
  380. package/dist/plugins/session-policy-store-sql.d.ts +12 -12
  381. package/dist/plugins/session-store.d.ts +2 -2
  382. package/dist/plugins/session-store.js +2 -2
  383. package/dist/plugins/shared-memory-store-sql.d.ts +2 -2
  384. package/dist/plugins/sql-driver.d.ts +8 -8
  385. package/dist/plugins/sql-errors.d.ts +1 -1
  386. package/dist/plugins/sql-json-column.d.ts +21 -21
  387. package/dist/plugins/sql-row-helpers.d.ts +2 -2
  388. package/dist/plugins/store-backend.d.ts +17 -16
  389. package/dist/plugins/store-backend.js +3 -3
  390. package/dist/plugins/store-contracts.d.ts +21 -21
  391. package/dist/plugins/task-attachment-store.d.ts +2 -2
  392. package/dist/plugins/task-list-store-sql.d.ts +1 -1
  393. package/dist/plugins/tidb-pool.d.ts +2 -2
  394. package/dist/plugins/tidb-pool.js +9 -2
  395. package/dist/plugins/tidb-session-store.d.ts +17 -27
  396. package/dist/plugins/tidb-session-store.js +52 -42
  397. package/dist/plugins/tool-result-store-sql.d.ts +1 -1
  398. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  399. package/dist/plugins/user-input-ledger-file.d.ts +1 -1
  400. package/dist/plugins/user-input-ledger-sql.d.ts +3 -3
  401. package/dist/plugins/web-search.d.ts +19 -5
  402. package/dist/plugins/web-search.js +19 -4
  403. package/dist/{orchestration/workflow-journal-entry.d.ts → plugins/workflow-journal-payload.d.ts} +23 -32
  404. package/dist/plugins/workflow-journal-payload.js +32 -0
  405. package/dist/plugins/workflow-journal-store-sql.d.ts +28 -14
  406. package/dist/plugins/workflow-journal-store-sql.js +34 -15
  407. package/dist/plugins/workflow-run-store-sql.d.ts +4 -4
  408. package/dist/posture-source.d.ts +11 -11
  409. package/dist/principal-jwt.d.ts +6 -6
  410. package/dist/project-identity.d.ts +3 -3
  411. package/dist/project-memory.d.ts +4 -4
  412. package/dist/read-face-posture.d.ts +7 -7
  413. package/dist/request-key-closure.d.ts +1 -1
  414. package/dist/request-key-closure.js +1 -1
  415. package/dist/request-tool-axes.d.ts +12 -0
  416. package/dist/request-tool-axes.js +20 -0
  417. package/dist/request-value-closure.d.ts +15 -8
  418. package/dist/request-value-closure.js +2 -0
  419. package/dist/router/route-orchestration.d.ts +11 -16
  420. package/dist/router/route-orchestration.js +2 -12
  421. package/dist/rule-entry-list.d.ts +8 -7
  422. package/dist/rule-entry-list.js +2 -9
  423. package/dist/rules-consent.d.ts +6 -6
  424. package/dist/rules-consent.js +2 -0
  425. package/dist/run-cancel-context.d.ts +5 -5
  426. package/dist/run-local.d.ts +10 -10
  427. package/dist/run-local.js +1 -0
  428. package/dist/runs.d.ts +15 -12
  429. package/dist/runs.js +19 -4
  430. package/dist/runtime-caps-resolver.d.ts +6 -6
  431. package/dist/runtime-governance.d.ts +9 -9
  432. package/dist/sandbox-pkg-source.d.ts +9 -31
  433. package/dist/sandbox-pkg-source.js +14 -8
  434. package/dist/sealed-key.d.ts +34 -2
  435. package/dist/sealed-key.js +55 -1
  436. package/dist/security.d.ts +31 -32
  437. package/dist/security.js +12 -9
  438. package/dist/server-secret-env.d.ts +10 -10
  439. package/dist/session-children-retire.d.ts +1 -1
  440. package/dist/session-error-wire.d.ts +19 -12
  441. package/dist/session-error-wire.js +4 -1
  442. package/dist/session-incarnation.d.ts +52 -35
  443. package/dist/session-incarnation.js +23 -8
  444. package/dist/session-policy-wire.d.ts +27 -5
  445. package/dist/session-policy-wire.js +15 -1
  446. package/dist/session-records-skipped-notice.d.ts +1 -1
  447. package/dist/session-sync-kernel.d.ts +38 -11
  448. package/dist/session-sync-kernel.js +10 -0
  449. package/dist/session-sync.d.ts +49 -6
  450. package/dist/session-sync.js +52 -10
  451. package/dist/session-titler.d.ts +7 -6
  452. package/dist/session-titler.js +8 -13
  453. package/dist/session-watch.d.ts +3 -3
  454. package/dist/session-watch.js +4 -4
  455. package/dist/sighup-idle.d.ts +2 -2
  456. package/dist/spec-fields.d.ts +4 -4
  457. package/dist/sql-engine-posture.d.ts +3 -3
  458. package/dist/store-posture.d.ts +2 -2
  459. package/dist/stored-request-tool-axes-m19.d.ts +1 -1
  460. package/dist/task-a2a.d.ts +3 -1
  461. package/dist/task-a2a.js +38 -5
  462. package/dist/task-cwd.d.ts +7 -88
  463. package/dist/task-cwd.js +2 -15
  464. package/dist/task-mcp.d.ts +14 -10
  465. package/dist/task-mcp.js +39 -12
  466. package/dist/task-settings.d.ts +34 -18
  467. package/dist/task-settings.js +34 -4
  468. package/dist/task-workflow.d.ts +0 -24
  469. package/dist/task-workflow.js +2 -1
  470. package/dist/terminal.d.ts +5 -5
  471. package/dist/tighten-only-seats.d.ts +7 -6
  472. package/dist/tighten-only-seats.js +1 -1
  473. package/dist/tool-approval.d.ts +273 -228
  474. package/dist/tool-approval.js +125 -47
  475. package/dist/tool-rule-names.d.ts +7 -1
  476. package/dist/trace/core-keyset-guard.d.ts +15 -9
  477. package/dist/trace/engine-notice-wire.d.ts +5 -5
  478. package/dist/trace/engine-notice-wire.js +1 -0
  479. package/dist/trace/exit-seat.d.ts +40 -1
  480. package/dist/trace/exit-seat.js +46 -14
  481. package/dist/trace/ledger-events.d.ts +6 -4
  482. package/dist/trace/ledger-sink.d.ts +1 -1
  483. package/dist/trace/model-segment.d.ts +3 -3
  484. package/dist/trace/project.d.ts +65 -46
  485. package/dist/trace/project.js +49 -5
  486. package/dist/trace/redact.d.ts +44 -27
  487. package/dist/trace/redact.js +343 -73
  488. package/dist/trace/self-minted-wire.d.ts +39 -14
  489. package/dist/trace/self-minted-wire.js +9 -0
  490. package/dist/trace/sema-provenance.d.ts +1 -1
  491. package/dist/trace/task-notification-facets.d.ts +4 -4
  492. package/dist/trace/wire-projection-faces.d.ts +9 -3
  493. package/dist/trace/wire-projection-faces.js +7 -1
  494. package/dist/unattended-permission-mode.d.ts +5 -5
  495. package/dist/url-credential.d.ts +52 -0
  496. package/dist/url-credential.js +49 -0
  497. package/dist/url-refusal.d.ts +6 -2
  498. package/dist/url-refusal.js +8 -1
  499. package/dist/usage-analytics.d.ts +2 -2
  500. package/dist/user-input-ledger.d.ts +23 -23
  501. package/dist/web-admin-client/apply-effective.d.ts +5 -5
  502. package/dist/web-admin-client/apply-effective.js +2 -1
  503. package/dist/web-admin-client/apply-ledger.d.ts +2 -2
  504. package/dist/web-admin-client/center-request.d.ts +2 -2
  505. package/dist/web-admin-client/facade.d.ts +5 -5
  506. package/dist/web-admin-client/facade.js +1 -1
  507. package/dist/web-admin-client/hot-keys-registry.d.ts +2 -2
  508. package/dist/web-admin-client/http-client.d.ts +4 -4
  509. package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
  510. package/dist/web-admin-client/pull-state.d.ts +1 -1
  511. package/dist/web-admin-client/read-face.d.ts +2 -2
  512. package/dist/web-admin-client/read-warnings.d.ts +5 -5
  513. package/dist/web-admin-client/restart-signal.d.ts +6 -6
  514. package/dist/web-admin-client/skills-mcp.d.ts +29 -4
  515. package/dist/web-admin-client/skills-mcp.js +31 -4
  516. package/dist/web-admin-client/types.d.ts +17 -10
  517. package/dist/workspace-space.d.ts +5 -3
  518. package/dist/write-protection.d.ts +2 -2
  519. package/package.json +4 -3
  520. package/scripts/drain-check-local.mjs +35 -2
  521. package/scripts/drain-check.mysql.sql +22 -2
  522. package/scripts/drain-check.pg.sql +22 -2
  523. package/skills/loop.md +1 -1
  524. package/dist/mcp-tool-faces.d.ts +0 -69
  525. package/dist/mcp-tool-faces.js +0 -104
  526. package/dist/orchestration/workflow-journal-entry.js +0 -27
@@ -0,0 +1,32 @@
1
+ import { WorkflowJournalIncompatibleError, callKeyOrdinal, readWorkflowJournalEntry } from "@sema-agent/core";
2
+ import { SqlJsonColumnError, decodeJsonColumn } from "./sql-json-column.js";
3
+ export function journalEntryPayload(entry) {
4
+ return entry.parked !== undefined ? { payload: entry.parked, parked: true } : { payload: entry.result, parked: false };
5
+ }
6
+ export function journalRowPayloadOf(entry) {
7
+ const { payload, parked } = journalEntryPayload(entry);
8
+ return JSON.stringify(parked ? { parked: payload } : payload);
9
+ }
10
+ const ANY_JSON = (body) => ({ value: body });
11
+ export function journalLogicalRow(callKey, payload) {
12
+ return payload !== null && typeof payload === "object" && !Array.isArray(payload) && Object.hasOwn(payload, "parked")
13
+ ? { callKey, parked: payload.parked }
14
+ : { callKey, result: payload };
15
+ }
16
+ export function journalEntryOfCell(runId, callKey, cell, where) {
17
+ let payload;
18
+ try {
19
+ payload = decodeJsonColumn(cell, ANY_JSON, where);
20
+ }
21
+ catch (e) {
22
+ if (!(e instanceof SqlJsonColumnError) || e.problem !== "not-json")
23
+ throw e;
24
+ payload = cell;
25
+ }
26
+ const row = journalLogicalRow(callKey, payload);
27
+ const reading = readWorkflowJournalEntry(row);
28
+ if ("corrupt" in reading)
29
+ throw new WorkflowJournalIncompatibleError(runId, callKeyOrdinal(callKey), row);
30
+ return reading.entry;
31
+ }
32
+ //# sourceMappingURL=workflow-journal-payload.js.map
@@ -15,7 +15,7 @@
15
15
  * record (InMemory `{ scope, byOrdinal }` / File "first line names the scope, one line per ordinal"):
16
16
  * - `workflow_journal_owner (run_id) PK` — the run's ONE owning scope, the `incarnation` token minted by the claim
17
17
  * that wrote the record, and `appended_at_ms` (the owner's last append; the GC clock of this row). Written by the
18
- * run's first append; never a second scope (S-197, below).
18
+ * run's first append; never a second scope ([ref], below).
19
19
  * - `workflow_journal (run_id, incarnation, ordinal) PK` — one row per recorded call, keyed by the owner record that
20
20
  * wrote it. NO scope column: a run's scope lives in exactly one place, so "one run, two scopes" is not a state this
21
21
  * schema can hold.
@@ -26,7 +26,7 @@
26
26
  * OVERWRITES (last-write-wins) — a resumed run re-appends its replayed prefix verbatim, so this is the exact InMemory
27
27
  * `byOrdinal.set(ordinal, …)` semantics, not a duplicate row.
28
28
  *
29
- * 🔴 **The scope wall — ONE predicate, both faces** (S-197; core `workflowJournalStoreContract` "scope wall" case;
29
+ * 🔴 **The scope wall — ONE predicate, both faces** ([ref]; core `workflowJournalStoreContract` "scope wall" case;
30
30
  * core's InMemory / File stores refuse the same way): a run's journal belongs to the scope of its first append. Every
31
31
  * face answers through the owner row and the same pair `workflow_journal_owner.run_id = ? AND scope = ?`:
32
32
  * - `append` writes its row through `INSERT … SELECT … FROM workflow_journal_owner WHERE run_id = ? AND scope = ?` —
@@ -43,7 +43,7 @@
43
43
  * owner's row at the same ordinal. With the incarnation in the key, the stale write lands on a key of the dead record —
44
44
  * a row readable by no one, removed by the sweep — and the new record's rows are untouchable by it, on every engine,
45
45
  * without a locking clause.
46
- * Before S-197 the scope sat on every row: the read faces filtered it, the write face never judged it (a cross-scope
46
+ * Before [ref] the scope sat on every row: the read faces filtered it, the write face never judged it (a cross-scope
47
47
  * append on a NEW ordinal inserted a second scope's row into the run; on an EXISTING ordinal it overwrote the owner's
48
48
  * result under the owner's scope), held up by "runId is unique per scope and the owner is the sole writer".
49
49
  *
@@ -59,9 +59,10 @@
59
59
  * a multi-byte UTF-8 payload would silently slip past the byte-budget cap on PG with plain `LENGTH`, so
60
60
  * the twin uses the byte-counting function instead — codex R3, real dual-DB-suite-confirmed) in `loadPage`'s
61
61
  * size-gate CASE.
62
- * - `loadPage`'s bind-param ORDER: TiDB's `?`s appear in query-text order (maxResultBytes first, inside the
63
- * CASE, ahead of runId/scope), so its params array is `[maxResultBytes, runId, scope, limit, offset]`; PG's
64
- * `$n` are POSITIONAL (not text-order), so its array is `[runId, scope, maxResultBytes, limit, offset]`
62
+ * - `loadPage`'s bind-param ORDER (both the chunk read and the single oversize-row read go through `readRows`): TiDB's `?`s
63
+ * appear in query-text order (the byte gate first, inside the CASE, ahead of runId/scope), so its params array is
64
+ * `[inlineBytes, runId, scope, from, limit]`; PG's `$n` are POSITIONAL (not text-order), so its array is
65
+ * `[runId, scope, inlineBytes, from, limit]`
65
66
  * (`$3` inside the CASE refers to the third element regardless of where `$3` sits in the text). Same
66
67
  * placeholder-arity-fallout class the sql-driver.ts header calls out for null-safe compares.
67
68
  * - affectedRows vs rowCount (via SqlDriver's normalized `affected`). The guarded write reads it as the wall's
@@ -96,12 +97,12 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
96
97
  /** Record one agent's result. Idempotent per (run_id, ordinal) under the run's owner record: the PK upsert OVERWRITES (last-write-wins), so a
97
98
  * resumed run re-appending its replayed prefix verbatim leaves no duplicate. callKeyOrdinal is the SOLE ordinal
98
99
  * source (core's parser — a malformed key collapses to 0, matching InMemory). Throws on a REAL failure
99
- * (LOAD-BEARING) — an oversize entry included, on BOTH arms (S-194 / core 7.12.0 [ref]; see below) — and REFUSES an
100
- * append under a scope other than the run's owner, on any ordinal and both arms, writing nothing (S-197; the scope
100
+ * (LOAD-BEARING) — an oversize entry included, on BOTH arms ([ref] / core 7.12.0 [ref]; see below) — and REFUSES an
101
+ * append under a scope other than the run's owner, on any ordinal and both arms, writing nothing ([ref]; the scope
101
102
  * wall in the file header). */
102
103
  append(runId: string, scope: string, entry: WorkflowJournalEntry): Promise<void>;
103
104
  /** Entries for `runId` IF its owner scope === `scope`, ASCENDING by ordinal; otherwise EMPTY. CORE-9 audit
104
- * BLOCKER: the scope wall (S-197: the owner row, the same predicate append writes through) — the LLM controls
105
+ * BLOCKER: the scope wall ([ref]: the owner row, the same predicate append writes through) — the LLM controls
105
106
  * `resumeFromRunId`, so a cross-scope runId resolves to an empty journal (resume safely diverges to live, never
106
107
  * discloses another tenant's results). Each row's `result` is the persisted JSON.stringify(TaskResult) → JSON.parse
107
108
  * back. Throws on failure (LOAD-BEARING). */
@@ -109,8 +110,16 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
109
110
  /** [ref] locator 云形(core 1.353 WorkflowJournalStore.locator additive):SQL 店的 journal 坐标=
110
111
  * [ref] HTTP 读面路由(file 店返 jsonl 路径=CC 本地形;此处返云形,core 铸 diagnostics 教句时单源引用)。 */
111
112
  locator(runId: string, _scope: string): string;
112
- /** codex R1-H2:分页投影读——LIMIT/OFFSET 界行数,字节门界单行字节(超限行不取 result 全文,只回字节数;
113
- * 读面标 truncated)。ORDER BY ordinal 与 load 同轴;scope 墙与 load 同一只 JOIN(S-197)。
113
+ /** 分页投影读 —— **判整份 journal,取一页**。
114
+ *
115
+ * 🔴 判的范围 = `load` 的范围:这条 journal 里只要有一行(任意一页、任意大小)被 core 的判官判坏,本读就抛 `WorkflowJournalIncompatibleError`(点名按序数升序的第一条坏行 ——
116
+ * 与内存 / 文件店 `load` 逐行判的次序同),页只是投影。修前只判本页取到、且不超 `maxResultBytes` 的行:同一条坏 journal 在内存 / 文件上整次拒、在这里答 200
117
+ * (坏行在别的页、或是超单行门的坏行 —— 后者只出尺寸存根,永不解码)。判官只有一只、判的范围只有一个,页不是判的单位。
118
+ *
119
+ * 读法:按序数的键集游标分块(每块 {@link JOURNAL_SCAN_CHUNK_ROWS} 行,`ORDER BY ordinal` 的主键序;不用 OFFSET —— 活 run 在读的同时还在 append,位置偏移会在块界上漏行或重行),
120
+ * 每行经 {@link journalEntryOfCell}(`load` 的同一只回装点)判一遍;位置落在 `[offset, offset + limit)` 里的行进页。内存峰值 ≤ 正在读的一块 + 已收下的页(各 ≤ 50 行 × `maxResultBytes`,读面传 64 KiB)+ 一条超门的行(驱动 / 解码的开销另计):
121
+ * 行字节超 `maxResultBytes` 的行在块里只回字节数(库端 CASE 门,全文不过线),判它时单条取回全文、判完即弃 —— 页里它仍只是 `resultJson: null` 的尺寸存根。
122
+ * ORDER BY ordinal 与 `load` 同轴;scope 墙与 `load` 同一只 JOIN([ref])。读放大:每次读 = 整份 journal 的一遍主键范围扫描(≤ 一次续跑 `load` 的量),这是「判整份」的代价。
114
123
  * 🔴 param ORDER differs by dialect (see file header): TiDB's `?`s bind in text order (maxResultBytes first,
115
124
  * inside the CASE); PG's `$n` are positional, so its array keeps runId/scope first. Never unify — a swap
116
125
  * silently mis-binds the OTHER dialect's placeholders. */
@@ -123,7 +132,12 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
123
132
  resultJson: string | null;
124
133
  resultBytes: number;
125
134
  }>>;
126
- /** GC — purge ALL journal entries for a run (every incarnation), then its owner row (S-197). Scoped by run_id alone;
135
+ /** 超 `maxResultBytes` 的那一行的全文:单条读(序数 ≥ 它的第一行)—— 返回的行**必须就是它**(序数相等);它在块读与这次读之间被清扫了,读到的是「序数更大的下一行」,
136
+ * 那是别人的字节,不能挂在它的键下判 ⇒ 无可判(`undefined`),下一块读自然读到那一行、用它自己的键判。 */
137
+ private oversizeCellOf;
138
+ /** 读面的**唯一**行读法(`loadPage` 的块读与超门行的单条读共用):序数 ≥ `from` 的至多 `limit` 行,字节超 `inlineBytes` 的行 `resultJson` 为 null(只回 `resultBytes`)。 */
139
+ private readRows;
140
+ /** GC — purge ALL journal entries for a run (every incarnation), then its owner row ([ref]). Scoped by run_id alone;
127
141
  * idempotent (returns the journal rows removed). Mirrors the resume-anchor store's deleteBySession. An append racing the
128
142
  * two DELETEs can leave a row behind without its owner record; it is keyed by the dead incarnation — readable and
129
143
  * overwritable by no one (file header) — and the GC sweep removes it by age. */
@@ -157,9 +171,9 @@ export declare class SqlWorkflowJournalStore implements WorkflowJournalStore {
157
171
  * bound. A resume of a journal older than the retention window simply re-runs live (resume is an optimization).
158
172
  * Idempotent; returns the journal rows purged.
159
173
  *
160
- * S-197: the same cutoff then purges owner rows whose OWN clock (`appended_at_ms`, pushed by every append of the
174
+ * [ref]: the same cutoff then purges owner rows whose OWN clock (`appended_at_ms`, pushed by every append of the
161
175
  * owner) is older. Each DELETE's predicate reads only the row it deletes — a cross-table "owner with no rows left"
162
- * test inside the DELETE would be a non-current read on every engine here (the B-022 lesson: TiDB pins start_ts, PG
176
+ * test inside the DELETE would be a non-current read on every engine here (the [ref] lesson: TiDB pins start_ts, PG
163
177
  * READ COMMITTED re-checks only the target row), so a concurrent append could have its owner deleted from under it.
164
178
  * Every row of a run was written by an append that first pushed the owner's clock (monotonically — GREATEST) to at least
165
179
  * that row's `created_at_ms`, so an owner past the cutoff normally has no row left after the first DELETE. The one
@@ -1,18 +1,13 @@
1
1
  import { callKeyOrdinal } from "@sema-agent/core";
2
2
  import { assertJournalEntryFits } from "@sema-agent/core";
3
- import { journalEntryOfBody, journalRowPayloadOf, readJournalRowBody } from "../orchestration/workflow-journal-entry.js";
3
+ import { journalEntryOfCell, journalRowPayloadOf } from "./workflow-journal-payload.js";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { mysqlDriver, pgDriver } from "./sql-driver.js";
6
- import { decodeJsonColumn, foldJsonColumn, jsonColumnText, jsonColumnTextExpr } from "./sql-json-column.js";
6
+ import { jsonColumnText, jsonColumnTextExpr } from "./sql-json-column.js";
7
7
  const DEFAULT_RESUME_CLAIM_TTL_MS = 60 * 60 * 1000;
8
- function decodeJournalResult(cell, where) {
9
- try {
10
- return decodeJsonColumn(cell, readJournalRowBody, where);
11
- }
12
- catch (e) {
13
- throw foldJsonColumn(e, (m) => `workflow journal: ${m} — refusing rather than replay a journal entry nobody can read`);
14
- }
15
- }
8
+ const INT_MIN = -2147483648;
9
+ const INT_MAX = 2147483647;
10
+ const JOURNAL_SCAN_CHUNK_ROWS = 50;
16
11
  export class SqlWorkflowJournalStore {
17
12
  db;
18
13
  resumeClaimTtlMs;
@@ -43,18 +38,42 @@ export class SqlWorkflowJournalStore {
43
38
  const { rows } = await this.db.query(this.q(`SELECT call_key, ${jsonColumnText("tidb", "result")} FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = ? AND scope = ? ORDER BY ordinal ASC`, `SELECT call_key, ${jsonColumnText("pg", "result")} FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = $1 AND scope = $2 ORDER BY ordinal ASC`), [runId, scope]);
44
39
  return rows.map((r) => {
45
40
  const callKey = String(r.call_key);
46
- return journalEntryOfBody(callKey, decodeJournalResult(r.result, `workflow_journal.result for run ${runId} entry ${callKey}`));
41
+ return journalEntryOfCell(runId, callKey, r.result, `workflow_journal.result for run ${runId} entry ${callKey}`);
47
42
  });
48
43
  }
49
44
  locator(runId, _scope) {
50
45
  return `/v1/workflows/${runId}/journal`;
51
46
  }
52
47
  async loadPage(runId, scope, opts) {
48
+ const page = [];
49
+ let position = 0;
50
+ let from = INT_MIN;
51
+ for (;;) {
52
+ const chunk = await this.readRows(runId, scope, from, JOURNAL_SCAN_CHUNK_ROWS, opts.maxResultBytes);
53
+ for (const row of chunk) {
54
+ const cell = row.resultJson ?? (await this.oversizeCellOf(runId, scope, row.ordinal));
55
+ if (typeof cell === "string")
56
+ journalEntryOfCell(runId, row.callKey, cell, `workflow_journal.result for run ${runId} entry ${row.callKey}`);
57
+ if (position >= opts.offset && position < opts.offset + opts.limit)
58
+ page.push({ callKey: row.callKey, resultJson: row.resultJson, resultBytes: row.resultBytes });
59
+ position += 1;
60
+ }
61
+ const last = chunk.at(-1);
62
+ if (last === undefined || chunk.length < JOURNAL_SCAN_CHUNK_ROWS || last.ordinal >= INT_MAX)
63
+ return page;
64
+ from = last.ordinal + 1;
65
+ }
66
+ }
67
+ async oversizeCellOf(runId, scope, ordinal) {
68
+ const row = (await this.readRows(runId, scope, ordinal, 1, INT_MAX))[0];
69
+ return row !== undefined && row.ordinal === ordinal && row.resultJson !== null ? row.resultJson : undefined;
70
+ }
71
+ async readRows(runId, scope, from, limit, inlineBytes) {
53
72
  const params = this.db.dialect === "tidb"
54
- ? [opts.maxResultBytes, runId, scope, opts.limit, opts.offset]
55
- : [runId, scope, opts.maxResultBytes, opts.limit, opts.offset];
56
- const { rows } = await this.db.query(this.q(`SELECT call_key, CASE WHEN LENGTH(result) > ? THEN NULL ELSE ${jsonColumnTextExpr("tidb", "result")} END AS result_json, LENGTH(result) AS result_bytes FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = ? AND scope = ? ORDER BY ordinal ASC LIMIT ? OFFSET ?`, `SELECT call_key, CASE WHEN OCTET_LENGTH(result) > $3 THEN NULL ELSE ${jsonColumnTextExpr("pg", "result")} END AS result_json, OCTET_LENGTH(result) AS result_bytes FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = $1 AND scope = $2 ORDER BY ordinal ASC LIMIT $4 OFFSET $5`), params);
57
- return rows.map((r) => ({ callKey: String(r.call_key), resultJson: r.result_json === null ? null : String(r.result_json), resultBytes: Number(r.result_bytes) }));
73
+ ? [inlineBytes, runId, scope, from, limit]
74
+ : [runId, scope, inlineBytes, from, limit];
75
+ const { rows } = await this.db.query(this.q(`SELECT ordinal, call_key, CASE WHEN LENGTH(result) > ? THEN NULL ELSE ${jsonColumnTextExpr("tidb", "result")} END AS result_json, LENGTH(result) AS result_bytes FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = ? AND scope = ? AND ordinal >= ? ORDER BY ordinal ASC LIMIT ?`, `SELECT ordinal, call_key, CASE WHEN OCTET_LENGTH(result) > $3 THEN NULL ELSE ${jsonColumnTextExpr("pg", "result")} END AS result_json, OCTET_LENGTH(result) AS result_bytes FROM workflow_journal JOIN workflow_journal_owner USING (run_id, incarnation) WHERE run_id = $1 AND scope = $2 AND ordinal >= $4 ORDER BY ordinal ASC LIMIT $5`), params);
76
+ return rows.map((r) => ({ ordinal: Number(r.ordinal), callKey: String(r.call_key), resultJson: r.result_json === null ? null : String(r.result_json), resultBytes: Number(r.result_bytes) }));
58
77
  }
59
78
  async deleteByRun(runId) {
60
79
  const res = await this.db.query(this.q("DELETE FROM workflow_journal WHERE run_id = ?", "DELETE FROM workflow_journal WHERE run_id = $1"), [runId]);
@@ -70,7 +70,7 @@ type WorkflowRun = Parameters<WorkflowRunStore["put"]>[1];
70
70
  export declare const MAX_RUN_BLOB_BYTES: number;
71
71
  declare const onWarnType: (msg: string, meta: Record<string, unknown>) => void;
72
72
  export type InboxWarn = typeof onWarnType;
73
- /** S-107:workflow_run 行的 `error`(脚本抛出的 `err.message`)在**两条写腿**(put / update 常态 + oversize 降级)
73
+ /** [ref]:workflow_run 行的 `error`(脚本抛出的 `err.message`)在**两条写腿**(put / update 常态 + oversize 降级)
74
74
  * 同一口脱;`result` 由 core 完成时源头脱。幂等,不抛(超大 ⇒ 占位)。
75
75
  * core 7.48.0 起 `error` 在铸点也过 core 的 `redactSecrets`,但两张脱敏表互不为超集(本仓的表多认几种记号,core 的表多认另几种)⇒ 这一口暂留;
76
76
  * 退役条件 = core 的脱敏表成为两表的并集(本仓的每一种记号它都认)—— 到那时这一口与它的两条调用一起删。 */
@@ -90,12 +90,12 @@ export declare function withRedactedError<T extends {
90
90
  * 第一臂,「那张表独自作数」—— 剥成缺席就把一条走第一臂的记录推去走派生臂,而派生的两个缓存只装这条 run
91
91
  * **自己做出**的 park,继承来、从未跑到的那一条**只存在于被剥掉的那张表里**,于是它要么被漏掉、要么被
92
92
  * 当成不存在而在 resume 时活着重跑([ref] 正要消灭的形)。它同时也是本仓 `/decide` 的 workflow 车道复核
93
- * 「这条 park 属于这条 run」的**单一真源**(S-252)。实现上三级全部走 `{...上一级}` 展开、没有任何一级点名裁它,机器背书 =
93
+ * 「这条 park 属于这条 run」的**单一真源**([ref])。实现上三级全部走 `{...上一级}` 展开、没有任何一级点名裁它,机器背书 =
94
94
  * `test/slim-oversize-run.test.ts` 里那两格(最狠的一级上 `parks` 仍逐字完整 + 负控:记录本来没有
95
95
  * 这一位时不许凭空补 `[]`)。缺席 ⇒ 不补:补 `[]` 会把「这版引擎没写这个位」伪造成「这条 run 没有 park」,
96
96
  * 而 core 对两者的处置相反。
97
97
  *
98
- * 🔴 **S-252(7.75.0):阶梯不再为 park 另存第二份恢复身份。** 7.71.0 的 S-192 曾在 `agents[]` 里逐行保住
98
+ * 🔴 **[ref](7.75.0):阶梯不再为 park 另存第二份恢复身份。** 7.71.0 的 [ref] 曾在 `agents[]` 里逐行保住
99
99
  * `callKey`/`sessionId`/`parkedCheckpointToken`(外加两级 `label` 预算与一枚不可恢复标记),因为当时
100
100
  * `/decide` 的复核只认那一行。core 7.17.0 之后同一条记录上有了 `parks[]`,那份保留就成了**第二个会漂的
101
101
  * 定义**(真案:最后一级清空 `agents` 之后 token 仍躺在同一个 blob 的 `parks` 里,而 `/decide` 照拒)。
@@ -185,7 +185,7 @@ export declare class SqlWorkflowNotifyJournalStore implements WorkflowNotifyJour
185
185
  get(runId: string): Promise<WorkflowNotifyJournalEntry | null>;
186
186
  }
187
187
  /**
188
- * S-185 车CM —— **workflow 出身 park 的有界 join 索引** SQL 双生(契约与纪律的唯一属主 =
188
+ * [ref] 车CM —— **workflow 出身 park 的有界 join 索引** SQL 双生(契约与纪律的唯一属主 =
189
189
  * {@link import("../orchestration/workflow-agent-session-index.js").WorkflowAgentSessionIndex} 的文件头,
190
190
  * 这里只记方言差)。行是 `WorkflowRun` 的派生投影(一行一枚指针),写者只有一个(Journaling 装饰器的写观察点);
191
191
  * 收割在删 run 行的同一个方法里按同一张待删 id 表删它们的指针({@link SqlWorkflowRunStore.reap})。
@@ -1,17 +1,17 @@
1
1
  /**
2
- * S-167 → S-178 → S-1492 —— **一个部署级旋钮的值是谁定的**,五词闭集 + 一句运维指路。
2
+ * [ref] → [ref] → [ref] —— **一个部署级旋钮的值是谁定的**,五词闭集 + 一句运维指路。
3
3
  *
4
4
  * ## 为什么是一个共享件而不是每键一份
5
5
  *
6
- * S-167 给 `READ_FACE` 造了这套东西(值 + 来源 + 指路句),理由写在 `read-face-posture.ts` 的顶注里:
6
+ * [ref] 给 `READ_FACE` 造了这套东西(值 + 来源 + 指路句),理由写在 `read-face-posture.ts` 的顶注里:
7
7
  * 「缺席」这一态里塞着两件不同的事(单机 turnkey 没表态 vs 多租户就是要引擎默认),而把它们分开之后,
8
- * **env 恒赢的判据**与**运维面「为什么这台机器是这个值」**才有真答案。S-178 把同一条律推到另外三个键
8
+ * **env 恒赢的判据**与**运维面「为什么这台机器是这个值」**才有真答案。[ref] 把同一条律推到另外三个键
9
9
  * (`STREAM_ASK_WINDOW_MS` / `DURABLE_APPROVAL` / `SESSION_AUTO_TITLE`)时,唯一诚实的做法是**抽这一份**
10
10
  * ——四词表抄第二遍的那天,两份表会在加词时分家,而「这个值是谁定的」在运维面上是个是非题,不能有两个答案。
11
11
  *
12
12
  * ## 优先序(与 `config.ts` 的 `postureOn` 同形)
13
13
  * `env 显式` > `center 发布` > `车道声明` > `posture 派生` > `引擎/服务端默认`。
14
- * `lane`(S-1492,[ref])= **执行车道的契约行替运维声明了这个旋钮的缺省**(目前只有 `READ_FACE`:隔离型车道的读面缺省 `open`,声明在 `execution-lane-caps.ts`)。
14
+ * `lane`([ref],[ref])= **执行车道的契约行替运维声明了这个旋钮的缺省**(目前只有 `READ_FACE`:隔离型车道的读面缺省 `open`,声明在 `execution-lane-caps.ts`)。
15
15
  * 它是出处,不是表态:运维从没写过这个键,所以与 `posture` 一样不算「有人要求过」({@link isExplicitPosture});比 `posture` 优先,因为车道声明比整机 posture 更具体
16
16
  * (同一台单机上 `e2b` 沙箱里的读面缺省 `open`,理由是沙箱边界而不是「一个可信主人」)。
17
17
  *
@@ -22,12 +22,12 @@
22
22
  * 得到一句谁都不认的空话,或者更坏:一句**对某些键是假的**话。
23
23
  *
24
24
  * 🔴 `centerMeaning` 是 G-7(test [ref])的修复面,成因是一次真的过期断言:这一臂原本硬编码
25
- * 「applied from the web-admin (**restart-to-apply**)」,而 S-174(core 7.10.0 [ref])之后
25
+ * 「applied from the web-admin (**restart-to-apply**)」,而 [ref](core 7.10.0 [ref])之后
26
26
  * `readFace.face` 是**热换席**(`Runner.swapDeps({readFace})`,下一拍 refresh 当场换进全部 Runner,
27
27
  * `read-face` 重启片也不再为它签理由)——运维照那句话去滚动重启一片 fleet,重启的是一个已经生效的变更。
28
28
  * 生效时机是**键**的事实,不是四词表的属性,所以它跟 `postureMeaning` 一样归键。
29
29
  */
30
- /** 旋钮取值来源的闭集词表(顺序 = 优先序;五词,S-1492 起多 `lane`)。 */
30
+ /** 旋钮取值来源的闭集词表(顺序 = 优先序;五词,[ref] 起多 `lane`)。 */
31
31
  export declare const POSTURE_SOURCE_WORDS: readonly ["env", "center", "lane", "posture", "engine-default"];
32
32
  /** 一个旋钮的取值来源(闭集五词)。加词 ⇒ {@link postureSourceNote} 的穷举 switch 编译红。 */
33
33
  export type PostureSource = (typeof POSTURE_SOURCE_WORDS)[number];
@@ -41,13 +41,13 @@ export interface PostureKnobFacts {
41
41
  * 还是这个键根本没有 center 腿?),以及怎么把这个键取回来。只在 `source === "center"` 时被读到。
42
42
  *
43
43
  * 🔴 为什么归键而不是共享(G-7 的成因):生效时机是键的事实。同一句「restart-to-apply」对
44
- * `readFace.face` 是假的(S-174 热换席),对三个 S-178 旋钮则连触发条件都没有(`config.ts` 的
44
+ * `readFace.face` 是假的([ref] 热换席),对三个 [ref] 旋钮则连触发条件都没有(`config.ts` 的
45
45
  * `postureSourceOfKnob` / `postureSourceOfNumEnv` 只产 env/posture/engine-default,center 写不到
46
46
  * 它们)—— 一句共享的硬编码必然对其中一类说谎。
47
47
  */
48
48
  readonly centerMeaning: string;
49
49
  /**
50
- * `lane` 那一臂**专属**的一句话(S-1492):执行车道的契约行为什么替这个旋钮声明了缺省、这一声明的风险是什么、怎么钉回。只在 `source === "lane"` 时被读到。
50
+ * `lane` 那一臂**专属**的一句话([ref]):执行车道的契约行为什么替这个旋钮声明了缺省、这一声明的风险是什么、怎么钉回。只在 `source === "lane"` 时被读到。
51
51
  * 与 `centerMeaning` 同理由归键:没有 lane 腿的旋钮(今天除 `READ_FACE` 外都是)写一句「本键没有 lane 腿」,比一句会骗人的通用话诚实。
52
52
  */
53
53
  readonly laneMeaning: string;
@@ -64,17 +64,17 @@ export declare function postureSourceNote(facts: PostureKnobFacts): string;
64
64
  /**
65
65
  * 这个值是**运维显式表态**的吗?
66
66
  *
67
- * 🔴 S-178 施工时真踩(本批全量抓出):`hasOperatorGateIntent`(`src/approval.ts`)判「运维表达过门意图
67
+ * 🔴 [ref] 施工时真踩(本批全量抓出):`hasOperatorGateIntent`(`src/approval.ts`)判「运维表达过门意图
68
68
  * 没有」时读的是 `durableApproval` 这个**值** —— 那在本键进 posture 家族之前是对的(它只有显式设过才为
69
69
  * 真),之后当场失真:单机 turnkey 上 posture 派生的 `true` 会被读成「运维要门」,于是 run-local 那条
70
70
  * **结构上没有 durable 门**的腿在每次 boot 打一条补偿 warn,而它其实正处在「零门意图的既定姿势」里。
71
- * 这与 S-167 头注①记的是**同一形**病(用一个会被 posture 铸出来的量当「有人表态过」的代理)。
71
+ * 这与 [ref] 头注①记的是**同一形**病(用一个会被 posture 铸出来的量当「有人表态过」的代理)。
72
72
  *
73
73
  * ⇒ 判据落到**来源**上,穷举 switch(五词闭集加员即编译红):`env`(这台机器的运维写下的)与 `center`
74
74
  * (组织发布的)是表态;`lane`(车道契约行声明的缺省)、`posture`(姿态派生)与 `engine-default`(内建缺省)都**不是**「有人要求过」。
75
75
  */
76
76
  export declare function isExplicitPosture(source: PostureSource): boolean;
77
- /** operator 诊断面的一行读数:值 + 来源 + 指路句。三个 S-178 旋钮与 S-167 的 readFace 同形。 */
77
+ /** operator 诊断面的一行读数:值 + 来源 + 指路句。三个 [ref] 旋钮与 [ref] 的 readFace 同形。 */
78
78
  export interface PostureKnobReading<V> {
79
79
  value: V;
80
80
  source: PostureSource;
@@ -5,7 +5,7 @@ import { type ApprovalEnvelope } from "./approval-hmac.js";
5
5
  *
6
6
  * 它回答的是**一跳**:签发方(issuer)与判定这份 token 的那口钟可以差多少(exp/nbf 门的宽限)。
7
7
  *
8
- * 🔴 它**不**回答「两台副本之间差多少」:S-280 的消费记录不再靠任何钟差上界活着 —— 受理窗的判定、
8
+ * 🔴 它**不**回答「两台副本之间差多少」:[ref] 的消费记录不再靠任何钟差上界活着 —— 受理窗的判定、
9
9
  * 落地后的复核、到期清扫三处读的是**同一口钟**(消费记录店自己的钟,见
10
10
  * `plugins/approval-nonce-store.ts` 的 `nowMs()`)。曾经由本常量推导出的那个「副本间钟差」常量已
11
11
  * 整条删除:它是一条**猜出来的**上界,没有任何一条腿强制它,而正确的修法是根本不需要这个数。
@@ -36,7 +36,7 @@ export declare function verifyPrincipalJwt(token: string, keys: PrincipalJwtKey[
36
36
  *
37
37
  * 第三槽在两种门上是**同一条规则**「这份决定作用在哪份内容上」:动作门填被批工具调用的 `boundInputHash`
38
38
  * (core 铸);非动作门 `plan_review` 的 `edit` 填**修订后的计划**的哈希(计划随本次请求一起提交,签名器手上
39
- * 就有原文),`approve` / `reject` 不作用于任何新内容 ⇒ null。B-121(test 黑盒发现,验真后修):此前 edit 也填
39
+ * 就有原文),`approve` / `reject` 不作用于任何新内容 ⇒ null。[ref](test 黑盒发现,验真后修):此前 edit 也填
40
40
  * null,于是为「只改 README」签出的证明可以拿去提交任意 `editedPlan`——签名只护住了 decision/reason,没护住
41
41
  * 决定真正落地的那份内容。`cnf.bnd` 与 HMAC 都吃第三槽,所以 JWT 与信封同时绑住它;不匹配 ⇒
42
42
  * `401 principal_unbound`(既有码,cnf.bnd 不符)。旧注记「计划哈希被拒」说的是 approve(worker 没有可哈希的
@@ -51,7 +51,7 @@ export declare function editedPlanBinding(editedPlan: string): string;
51
51
  /**
52
52
  * JWT `cnf.bnd` = **「这份身份凭据被签发去决哪一张卡」**(动作身份),故只哈希前三位。
53
53
  *
54
- * 🔴 **与 HMAC 信封的分工**(S-433 F1 立此,属主注在 `approval-hmac.ts` 顶):HMAC 绑的是**「决了什么」**
54
+ * 🔴 **与 HMAC 信封的分工**([ref] F1 立此,属主注在 `approval-hmac.ts` 顶):HMAC 绑的是**「决了什么」**
55
55
  * —— `decision` / `reason` / `permissionModeAfter` 这些**会改变后果**的字段全在那一把里。所以「同一张卡上
56
56
  * 把 approve 的档偷偷调宽」只由 HMAC 拦;本函数**刻意不跟着加位**:决定内容改了 `cnf.bnd` 不该变(否则
57
57
  * 一份合法 JWT 会被绑死在一个它签发时还不知道的值上,而 `permissionModeAfter` 恰恰是决裁那一刻才定的)。
@@ -97,7 +97,7 @@ export type DirectDoorProofResult = {
97
97
  * verify principal → bind → mac-present → mac-valid (so a non-operator never gets a MAC oracle, an unverified
98
98
  * caller never reaches the operator list).
99
99
  *
100
- * 🔴 `opts.nowSec`(S-280 / 合并复审 R2):受理窗要按**哪口钟**判。非动作门(plan_review)的反重放是
100
+ * 🔴 `opts.nowSec`([ref] / 合并复审 R2):受理窗要按**哪口钟**判。非动作门(plan_review)的反重放是
101
101
  * 一条**消费记录**,而那条记录的生死由**消费记录店的钟**决定 —— 所以那条腿必须把店钟喂进来
102
102
  * (`floor(店钟/1000)`),否则「还受理 ⇒ 记录还在」就退化成「两台副本的钟差不多」这条没人声明过的假设。
103
103
  * 缺席 = 本机墙钟,这对动作门(`/decide`)是对的:它的反重放是 checkpointToken 的一次性,不牵扯第二台
@@ -110,7 +110,7 @@ export type DirectDoorProofResult = {
110
110
  * {sessionId, nonce, <content hash>, decision, reason}. Pass `actionBinding:false` for a non-action gate; the default
111
111
  * (true) keeps the /decide tool-approval contract byte-identical. The THIRD slot carries one rule on both gates —
112
112
  * "the content this decision acts on": the bound tool input for /decide, `editedPlanBinding(editedPlan)` for a
113
- * plan_review `edit` (B-121), null for approve/reject. Binding approve/reject to a hash of the EXISTING plan was
113
+ * plan_review `edit` ([ref]), null for approve/reject. Binding approve/reject to a hash of the EXISTING plan was
114
114
  * rejected (the plan artifact lives in a profile ref store; the worker has no TOCTOU original) — that ruling never
115
115
  * covered `edit`, whose content arrives with the request.
116
116
  */
@@ -119,7 +119,7 @@ export declare function verifyDirectDoorProof(proof: {
119
119
  mac?: string;
120
120
  kid?: string;
121
121
  },
122
- /** 🔴 **命名类型,不是结构等价的内联字面**(S-433 F1 [high] 的**根因**,验真后修):本位此前是一份手抄的
122
+ /** 🔴 **命名类型,不是结构等价的内联字面**([ref] F1 [high] 的**根因**,验真后修):本位此前是一份手抄的
123
123
  * 五字段内联形 —— 结构类型让**多带一个字段的调用方**照样编译通过,而下面那次手抄再把它**丢掉**,于是
124
124
  * `approval-hmac.ts` 上新增的签名位在这条唯一的真实验签链上**静默失效**,tsc 一个字都不响。
125
125
  * 用 {@link ApprovalEnvelope} 之后,信封的形只有**一个**声明点,新增一位自动到达验签器。 */
@@ -19,7 +19,7 @@ export type ProjectIdentity = {
19
19
  export declare function resolveProjectIdentity(taskRoot: string): ProjectIdentity;
20
20
  /**
21
21
  * 退役 `repo:` 键的**唯一**铸点([ref] ①:`repo:` + sha256 hex 前 24;`root` 为 realpath 字符串,不加尾斜杠、不折大小写)。
22
- * S-640 起它只是一次性迁移的来源(`memory-project-layer.ts` 把这一层的条目折进新键;窗见 `plugins/one-time-migrations.ts` 登记表)。
22
+ * [ref] 起它只是一次性迁移的来源(`memory-project-layer.ts` 把这一层的条目折进新键;窗见 `plugins/one-time-migrations.ts` 登记表)。
23
23
  */
24
24
  export declare function mintRepoScopeKey(projectRoot: string): string;
25
25
  /** 这把键是不是本仓铸的项目键族(现行 `userrepo:` 或退役的 `repo:`)—— 运维不许把它们点名成全局层 / 同步层。 */
@@ -38,7 +38,7 @@ export declare function assertProjectLayerOwnable(scope: string, envName: string
38
38
  */
39
39
  export declare function normalizeGitRemoteUrl(url: string): string | undefined;
40
40
  /**
41
- * 任务根 → 项目层身份(S-640):当前档(`r` 优先,没有 origin 退 `p`)+ 本 checkout 的低档(`r` 档时 = 它的 `p` 档)。
41
+ * 任务根 → 项目层身份([ref]):当前档(`r` 优先,没有 origin 退 `p`)+ 本 checkout 的低档(`r` 档时 = 它的 `p` 档)。
42
42
  * 缺席形与 {@link resolveProjectIdentity} 同;git 配置在而读不了 ⇒ `unreadable`。
43
43
  */
44
44
  export declare function projectLayerIdentityOf(taskRoot: string): {
@@ -54,7 +54,7 @@ export interface ProjectLayerOfTask {
54
54
  readonly foldFrom: readonly string[];
55
55
  }
56
56
  /**
57
- * 任务根 → 项目层(S-640:`userrepo:<属主段>/<档>.<摘要>`,属主 = `owner`,调用方由 `projectLayerOwnerOf(全局层)` 求得)。
57
+ * 任务根 → 项目层([ref]:`userrepo:<属主段>/<档>.<摘要>`,属主 = `owner`,调用方由 `projectLayerOwnerOf(全局层)` 求得)。
58
58
  * `foldFrom` = 同一 checkout 能推出的旧层:退役 `repo:<同一路径哈希>`(一次性迁移,窗见 `plugins/one-time-migrations.ts` 登记表 M25)
59
59
  * + 当前档是 `r` 时它的 `p` 档(常设律)。
60
60
  * `taskRoot === undefined` = 调用方**此刻不知道**任务根在本机哪里(根在沙箱/设备盘上;或 host 车道会话没登记 cwd、手落在 factory 现铸的
@@ -25,7 +25,7 @@ interface ProjectMemoryCtx {
25
25
  * every CLAUDE file it finds, per directory level up the ancestor chain, whereas this loader reads one root and
26
26
  * takes the single first hit. */
27
27
  declare const INSTRUCTION_FILE_CHAIN: readonly ["CLAUDE.md", ".claude/CLAUDE.md", "AGENTS.md", ".claude/AGENTS.md"];
28
- /** 一个链成员(相对项目根的拼写)。导出给 S-961 的 wire 段与它的值闭集登记(`trace/self-minted-wire.ts`)—— 链长一员,两处 tsc 跟着红。 */
28
+ /** 一个链成员(相对项目根的拼写)。导出给 [ref] 的 wire 段与它的值闭集登记(`trace/self-minted-wire.ts`)—— 链长一员,两处 tsc 跟着红。 */
29
29
  export type InstructionChainMember = (typeof INSTRUCTION_FILE_CHAIN)[number];
30
30
  /** Recover (root, rel) for a path the LOADER declared — every declared path is `root + one chain member`.
31
31
  * The probe needs this to re-run the loader's parent-directory symlink gate each round (self-review: the probe
@@ -49,14 +49,14 @@ export declare function instructionChainCoordinates(absPath: string, p?: Platfor
49
49
  * `phase: "post-compact"` forces a re-read (core re-renders the prefix there anyway). No entry for
50
50
  * sessionless one-shot runs. (post-clear never arrives from core — [ref] — so it is not a cache key here.)
51
51
  *
52
- * S-690 — source-change notice: with `instructionSource` wired, every prepare of a non-subagent session that WALKED the
52
+ * [ref] — source-change notice: with `instructionSource` wired, every prepare of a non-subagent session that WALKED the
53
53
  * instruction chain hands the chain member it selected (`null` = none) to {@link announceInstructionSource}, which
54
54
  * compares it with the session's persisted baseline. A prepare stopped by a pre-walk gate (hands-less, a cwd that is not
55
55
  * an absolute local directory) is "not applicable", not "none" — it never reaches the mint (O6, see `LoadOutcome`). The member is the one the snapshot carries — a cache hit answers the cached pick, so
56
56
  * the notice follows what the model actually reads, not the disk (a same-process edit changes nothing until the
57
57
  * snapshot is re-read: restart, post-compact, or a new session).
58
58
  *
59
- * S-961 — the same statement (same predicate, same member) also settles the calling LEG's `wiring_manifest.instructions`
59
+ * [ref] — the same statement (same predicate, same member) also settles the calling LEG's `wiring_manifest.instructions`
60
60
  * segment through {@link settleLegInstructionStatement} (`instruction-selection.ts`): the leg scope is the run identity
61
61
  * the ctx does not carry, and the first call inside a leg's scope whose `ctx.sessionId` equals the leg's session is that
62
62
  * leg's own prepare (a session-less adhoc leg falls back to plain first-call; [ref] X1). The segment projects
@@ -70,7 +70,7 @@ export declare function makeLoadProjectMemory(opts: {
70
70
  maxBytes?: number;
71
71
  /** TEST-ONLY: shrink the snapshot-cache bound so the settle-time trim is observable without 256 sessions. */
72
72
  cacheMax?: number;
73
- /** S-690: the baseline store + notice exit. Absent ⇒ no source-change notice (the session store has no baseline face). */
73
+ /** [ref]: the baseline store + notice exit. Absent ⇒ no source-change notice (the session store has no baseline face). */
74
74
  instructionSource?: InstructionSourceSeat;
75
75
  }): (ctx: ProjectMemoryCtx) => Promise<string | null | ProjectMemoryLoad>;
76
76
  /**
@@ -1,5 +1,5 @@
1
1
  /**
2
- * S-167(clay 裁定 2,[ref] 转达 / [ref] ②)—— **READ 容纳面档位的来源**(单一属主)。
2
+ * [ref](clay 裁定 2,[ref] 转达 / [ref] ②)—— **READ 容纳面档位的来源**(单一属主)。
3
3
  *
4
4
  * ## 它解决的问题
5
5
  *
@@ -20,7 +20,7 @@
20
20
  * ## 优先序(与 `config.ts` 的 `postureOn` 同形)
21
21
  * `env 显式` > `center 发布` > `lane 声明` > `posture 派生` > `引擎默认`。env 恒赢的论证逐字见 `web-admin-client/read-face.ts`
22
22
  * 头注①(READ 容纳面描述的是**这台机器的磁盘上有什么**,组织的下发面不知道)。
23
- * 🔴 **`lane` 一臂(S-1492,clay 裁 [ref])**:隔离型执行车道(`e2b` / `k8s` / `local-docker`)的契约行**显式声明**读面缺省 `open`
23
+ * 🔴 **`lane` 一臂([ref],clay 裁 [ref])**:隔离型执行车道(`e2b` / `k8s` / `local-docker`)的契约行**显式声明**读面缺省 `open`
24
24
  * (`execution-lane-caps.ts` 的 `laneReadFaceDefault`;沙箱内部就是模型的整个世界)。运维没写 `READ_FACE` 时,车道声明比整机 posture 更具体 ⇒ 排在它前面;
25
25
  * 声明 `roots` 的车道(`host` / `ssh` / `adb` / `device` / 未设车道)不替运维声明缺省,回到既有的 posture 派生,**一个字节不变**。
26
26
  * 缺席这一态的派生**只有一只函数**({@link readFaceDefaultFor}),且读的是**最终生效的车道**(`loadConfig` 装配完 `remoteExec` 之后一次;
@@ -39,7 +39,7 @@
39
39
  import { type LaneReadFaceDefault, type RemoteExecProvider } from "./execution-lane-caps.js";
40
40
  import { type PostureSource } from "./posture-source.js";
41
41
  /**
42
- * 档位来源的闭集词表 —— **S-178 起转 `posture-source.ts` 的共享件**(本模块只是给这一档取个本地名字,
42
+ * 档位来源的闭集词表 —— **[ref] 起转 `posture-source.ts` 的共享件**(本模块只是给这一档取个本地名字,
43
43
  * 不再持第二份词表:同一张四词表抄两遍的那天,两份会在加词时分家)。
44
44
  */
45
45
  export declare const READ_FACE_SOURCE_WORDS: readonly ["env", "center", "lane", "posture", "engine-default"];
@@ -77,7 +77,7 @@ export declare function settleDerivedReadFace(seat: ReadFaceDeploymentSeat, sing
77
77
  /** 本档的运维指路句 —— 骨架由共享件 {@link postureSourceNote} 给(四词穷举在那里,加词即编译红);
78
78
  * 本函数提供两条**键专属**臂(`center` / `posture`)的事实句。
79
79
  *
80
- * 🔴 `center` 那句话的事实来源是 S-174(core 7.10.0 [ref]):`RunnerDeps.readFace` 进了 core 的可换席
80
+ * 🔴 `center` 那句话的事实来源是 [ref](core 7.10.0 [ref]):`RunnerDeps.readFace` 进了 core 的可换席
81
81
  * 闭集 `SWAPPABLE_DEP_SEATS` ⇒ 组织发布/撤回一个档位,**下一拍 refresh 当场换进全部 Runner**,
82
82
  * `web-admin-client/restart-signal.ts` 的 `read-face` 片也不再为它签重启理由(判据同源 =
83
83
  * `CENTER_READ_FACE_LIVE_KEYS`,由 core 的 `isSwappableDepSeat` 派生)。本句此前逐字写着
@@ -92,10 +92,10 @@ export declare function buildReadFaceWiring(facts: ReadFacePostureFacts): {
92
92
  note: string;
93
93
  };
94
94
  /**
95
- * S-176 —— 派生的档位(`posture` 单机 ⇒ open,或 S-1492 的 `lane` 隔离车道 ⇒ open)在 **boot 期推送面**的那一行(`config.ts` 经既有 `CONFIG_NOTICES` 以 info 级排空)。
95
+ * [ref] —— 派生的档位(`posture` 单机 ⇒ open,或 [ref] 的 `lane` 隔离车道 ⇒ open)在 **boot 期推送面**的那一行(`config.ts` 经既有 `CONFIG_NOTICES` 以 info 级排空)。
96
96
  *
97
- * 为什么要有:S-167 的补偿项是「升级即放开,得让运维看得见并知道怎么钉回」,可此前唯一看得见的是**拉取**面
98
- * (`GET /v1/diagnostics/wiring`)—— 只对会去拉的人成立。单机 boot 日志里零字。S-1492 的 `lane` 臂同一个补偿:多租户沙箱部署升级后读面从 `roots` 变 `open`,
97
+ * 为什么要有:[ref] 的补偿项是「升级即放开,得让运维看得见并知道怎么钉回」,可此前唯一看得见的是**拉取**面
98
+ * (`GET /v1/diagnostics/wiring`)—— 只对会去拉的人成立。单机 boot 日志里零字。[ref] 的 `lane` 臂同一个补偿:多租户沙箱部署升级后读面从 `roots` 变 `open`,
99
99
  * 指路句带挂载告诫与钉回出路。
100
100
  * 为什么只在 `posture` / `lane` 两词上说:另外三词都不是「没人表态、服务替它选了一个更宽的档」——`env` 是运维自己写的,
101
101
  * `engine-default` 是本服务没铸(引擎默认接管),`center` 在 boot 这一拍还没到货(它有自己的换席通告)。
@@ -32,7 +32,7 @@ declare const TASK_BODY_SCENARIO_KEYS: readonly ["repo"];
32
32
  export type ScenarioBodyKey = (typeof TASK_BODY_SCENARIO_KEYS)[number];
33
33
  /** 剥掉索引签名,只留**具名**键 —— `TaskRequestBody` 上那条 `[k: string]: unknown` 会让
34
34
  * `keyof` 退化成 `string`,双向门就永远恒真(零判别力)。
35
- * 🔴 **导出**(S-405):姊妹门 `request-value-closure.ts` 的双向钉要同一个剥法 —— 抄第二份 = 两处哪天
35
+ * 🔴 **导出**([ref]):姊妹门 `request-value-closure.ts` 的双向钉要同一个剥法 —— 抄第二份 = 两处哪天
36
36
  * 分岔(一边看得见索引签名、一边看不见)谁都发现不了,而两边的判别力都建立在「剥干净了」这句话上。 */
37
37
  export type NamedKeysOf<T> = {
38
38
  [K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
@@ -23,7 +23,7 @@ const TASK_BODY_DECLARED_KEYS = [
23
23
  "excludeAllTools", "excludeTools", "fileHistory",
24
24
  "finalVerification", "forwardSubagentEvents", "images", "inheritEnv", "interactiveTools", "jobId", "limits", "maxCostUsd",
25
25
  "maxTokens", "mcpServers", "memory", "memoryCapture", "memoryWrite", "model", "objective", "oneShot", "outputRetries", "outputStyle",
26
- "outputSchema", "permissionMode", "projectId", "promptProfile", "reasoningEffort", "requireExistingSession",
26
+ "outputSchema", "permissionMode", "projectId", "projectMemory", "promptProfile", "reasoningEffort", "requireExistingSession",
27
27
  "resilience", "restoreFiles", "resumeAt", "resumeAtMode", "retainBackgroundProcesses", "retainSubagentSessions",
28
28
  "rewindFiles", "rewindFilesTo", "sandboxImageProfile", "scenario", "scratchpadDir", "selfOrchestration",
29
29
  "sessionId", "settings", "skills", "suggestNextPrompts", "systemPrompt", "taskId", "toolMaterializeStrategy",
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 请求侧 `toolAxes` 声明的读法 —— `mcpServers[].toolAxes`(`task-mcp.ts`)与 `a2aPeers[].toolAxes`(`task-a2a.ts`)同一只。
3
+ *
4
+ * 律(一句):判官是引擎包根的 `readToolAxes(declared, at)`;请求侧再多一条 —— **不许写 `boundaryFlow`**。
5
+ * `boundaryFlow: "engine"`(须同条 `egress: false`)声明一只引擎专用工具:名册行读成零条腿,设备车道的发射闸对它的调用不欠任何东西。
6
+ * 引擎分不出一条声明来自请求还是部署,所以这个位只许部署声明(`config.d` / 配置中心)写 —— 那两条腿原样交引擎(由引擎判 `egress: false`)。
7
+ * 读数形与引擎判官同一只(`ToolAxesRead`):请求侧写了这个位 ⇒ `ok: false`,原因句点名工具(或 skill)与出路;各腿按自己既有的「判不过」处置读它
8
+ * (MCP 新提交 400 点名 / 续跑重放整条 server 不进;A2A 整条对端不挂、warn 点名)。
9
+ */
10
+ import { type ToolAxesRead, type ToolAxesSurface } from "@sema-agent/core";
11
+ export declare function readRequestToolAxes(declared: unknown, at: ToolAxesSurface): ToolAxesRead;
12
+ //# sourceMappingURL=request-tool-axes.d.ts.map
@@ -0,0 +1,20 @@
1
+ import { readToolAxes } from "@sema-agent/core";
2
+ import { stripControlAndBidi } from "@sema-agent/settings-schema";
3
+ import { MAX_KEY_ECHO } from "./request-key-closure.js";
4
+ const KEY_NOUN = { mcp: "tool", a2a: "skill" };
5
+ export function readRequestToolAxes(declared, at) {
6
+ const read = readToolAxes(declared, at);
7
+ if (!read.ok || read.toolAxes === undefined)
8
+ return read;
9
+ for (const [name, axes] of Object.entries(read.toolAxes)) {
10
+ if (axes !== undefined && Object.hasOwn(axes, "boundaryFlow")) {
11
+ return {
12
+ ok: false,
13
+ problem: `the axes declared for ${KEY_NOUN[at]} ${JSON.stringify(stripControlAndBidi(name).slice(0, MAX_KEY_ECHO))} carry "boundaryFlow", which only a deployment's declaration may state ` +
14
+ `(it declares an engine-only ${KEY_NOUN[at]}, so the device lane's launch gate would owe its calls nothing; the engine cannot tell a request's entry from a deployment's) — drop "boundaryFlow"`,
15
+ };
16
+ }
17
+ }
18
+ return read;
19
+ }
20
+ //# sourceMappingURL=request-tool-axes.js.map