@sema-agent/server 7.52.1 → 7.54.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 (342) hide show
  1. package/USAGE.md +7 -1
  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 +4 -2
  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/engine-lease.d.ts +4 -4
  29. package/dist/boot/governance-seams.d.ts +5 -5
  30. package/dist/boot/leader.d.ts +5 -5
  31. package/dist/boot/leader.js +2 -0
  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/resolve-spec.js +1 -3
  42. package/dist/boot/retention-lane.d.ts +1 -1
  43. package/dist/boot/runner-deps.d.ts +53 -27
  44. package/dist/boot/runner-deps.js +16 -9
  45. package/dist/boot/runtime-caps.d.ts +4 -4
  46. package/dist/boot/session-faces.d.ts +1 -1
  47. package/dist/boot/shutdown.d.ts +10 -10
  48. package/dist/boot/shutdown.js +1 -1
  49. package/dist/boot/side-query-lane.d.ts +14 -14
  50. package/dist/boot/stores.js +5 -0
  51. package/dist/boot/task-list-lane.d.ts +3 -3
  52. package/dist/boot/webfetch-summarize-lane.d.ts +9 -9
  53. package/dist/boot/workflow-orchestration.d.ts +1 -1
  54. package/dist/bounded-session-map.d.ts +1 -1
  55. package/dist/brain.d.ts +3 -3
  56. package/dist/budget.d.ts +3 -3
  57. package/dist/canonical-json.d.ts +53 -0
  58. package/dist/canonical-json.js +48 -0
  59. package/dist/capabilities/center-prompts.d.ts +13 -13
  60. package/dist/capabilities/collab-workflows.d.ts +1 -1
  61. package/dist/capabilities/hands-lane.d.ts +4 -4
  62. package/dist/capabilities/memory-notice.d.ts +4 -4
  63. package/dist/capabilities/prompt.d.ts +2 -2
  64. package/dist/capabilities/sandbox-file-send.d.ts +2 -2
  65. package/dist/capabilities/scenarios.d.ts +16 -16
  66. package/dist/capabilities/skills.d.ts +1 -1
  67. package/dist/capabilities/team.d.ts +13 -12
  68. package/dist/capabilities/tool-defer.d.ts +6 -6
  69. package/dist/config-catalog.d.ts +139 -0
  70. package/dist/config-catalog.js +556 -0
  71. package/dist/config-center/apply-effective.d.ts +42 -30
  72. package/dist/config-center/apply-effective.js +69 -62
  73. package/dist/config-center/apply-ledger.d.ts +6 -6
  74. package/dist/config-center/effective-keys.d.ts +30 -0
  75. package/dist/config-center/effective-keys.js +49 -0
  76. package/dist/config-center/facade.d.ts +6 -5
  77. package/dist/config-center/facade.js +1 -1
  78. package/dist/config-center/hot-keys-registry.d.ts +2 -2
  79. package/dist/config-center/http-client.d.ts +5 -5
  80. package/dist/config-center/mcp-revocation.d.ts +6 -4
  81. package/dist/config-center/mcp-revocation.js +2 -12
  82. package/dist/config-center/restart-signal.d.ts +11 -1
  83. package/dist/config-center/restart-signal.js +4 -10
  84. package/dist/config-center/skills-mcp.d.ts +2 -2
  85. package/dist/config-center/stage-limits.d.ts +3 -3
  86. package/dist/config-center/types.d.ts +42 -59
  87. package/dist/config-invariants.d.ts +1 -1
  88. package/dist/config-lkg.js +7 -1
  89. package/dist/config-provider.d.ts +2 -2
  90. package/dist/config-provider.js +1 -1
  91. package/dist/config-types.d.ts +140 -132
  92. package/dist/config.d.ts +22 -22
  93. package/dist/config.js +2 -1
  94. package/dist/degenerate-instrument.d.ts +1 -1
  95. package/dist/deployment-governance.d.ts +13 -13
  96. package/dist/device-enrollment.d.ts +5 -3
  97. package/dist/device-store.d.ts +17 -3
  98. package/dist/device-store.js +2 -0
  99. package/dist/device-ws-hub.d.ts +10 -5
  100. package/dist/device-ws-hub.js +25 -5
  101. package/dist/device-ws-protocol.d.ts +3 -3
  102. package/dist/digest-form.d.ts +1 -1
  103. package/dist/elicitation.d.ts +1 -1
  104. package/dist/env-facts.d.ts +7 -7
  105. package/dist/execution-lane-caps.d.ts +5 -5
  106. package/dist/fleet/fleet-bus.d.ts +53 -53
  107. package/dist/fleet/fleet-reconciler.d.ts +2 -2
  108. package/dist/fleet/fleet-terminal-window.d.ts +1 -1
  109. package/dist/fleet/subagent-tail-bus.d.ts +3 -3
  110. package/dist/fleet-client.d.ts +3 -3
  111. package/dist/fleet-lease.d.ts +1 -1
  112. package/dist/hooks/branch-transcript.d.ts +2 -2
  113. package/dist/hooks/cc-agent-hook-prompt.d.ts +2 -2
  114. package/dist/hooks/cc-stop-prompt.d.ts +2 -2
  115. package/dist/hooks/hook-llm.d.ts +1 -1
  116. package/dist/hooks/hook-runner.d.ts +5 -5
  117. package/dist/http/active-run-conflict.d.ts +31 -33
  118. package/dist/http/active-run-conflict.js +4 -2
  119. package/dist/http/route-ctx.d.ts +22 -22
  120. package/dist/http/routes/a2a-serve.d.ts +2 -2
  121. package/dist/http/routes/admin-config-refresh.d.ts +1 -1
  122. package/dist/http/routes/admin-drain.d.ts +4 -4
  123. package/dist/http/routes/admin-memory-optout.d.ts +5 -5
  124. package/dist/http/routes/adoption.d.ts +1 -1
  125. package/dist/http/routes/agents-roster.d.ts +1 -1
  126. package/dist/http/routes/approvals-assistant.d.ts +6 -6
  127. package/dist/http/routes/approvals-assistant.js +4 -1
  128. package/dist/http/routes/capabilities.d.ts +1 -1
  129. package/dist/http/routes/capabilities.js +1 -0
  130. package/dist/http/routes/config-catalog.d.ts +28 -0
  131. package/dist/http/routes/config-catalog.js +42 -0
  132. package/dist/http/routes/diagnostics.d.ts +2 -2
  133. package/dist/http/routes/fleet.d.ts +1 -1
  134. package/dist/http/routes/images.d.ts +1 -1
  135. package/dist/http/routes/leader.d.ts +1 -1
  136. package/dist/http/routes/memory-bundle.d.ts +4 -4
  137. package/dist/http/routes/memory-compliance.d.ts +7 -7
  138. package/dist/http/routes/memory-consolidation.d.ts +1 -1
  139. package/dist/http/routes/memory-origin.d.ts +9 -9
  140. package/dist/http/routes/memory-policy.d.ts +3 -3
  141. package/dist/http/routes/notify-wake.d.ts +1 -1
  142. package/dist/http/routes/observability.d.ts +1 -1
  143. package/dist/http/routes/retention-ops.d.ts +1 -1
  144. package/dist/http/routes/rules.d.ts +3 -3
  145. package/dist/http/routes/run-memory-capture.d.ts +1 -1
  146. package/dist/http/routes/runs.d.ts +3 -3
  147. package/dist/http/routes/runs.js +12 -17
  148. package/dist/http/routes/session-sync.d.ts +2 -2
  149. package/dist/http/routes/sessions-list.d.ts +1 -1
  150. package/dist/http/routes/sessions.d.ts +9 -1
  151. package/dist/http/routes/sessions.js +60 -0
  152. package/dist/http/routes/shared-memory.d.ts +1 -1
  153. package/dist/http/routes/side-query.d.ts +1 -1
  154. package/dist/http/routes/tasks.d.ts +1 -1
  155. package/dist/http/routes/trace-usage.d.ts +1 -1
  156. package/dist/http/routes/workflows.d.ts +1 -1
  157. package/dist/http/run-meta.d.ts +1 -1
  158. package/dist/http/send.d.ts +6 -6
  159. package/dist/http/server.d.ts +84 -67
  160. package/dist/http/server.js +39 -10
  161. package/dist/http/sse-lifecycle.d.ts +1 -1
  162. package/dist/http/sse-log.d.ts +6 -6
  163. package/dist/http/verify-rounds.d.ts +3 -3
  164. package/dist/http/wire-gate.d.ts +2 -2
  165. package/dist/http/wire-types.d.ts +57 -38
  166. package/dist/key-resolver.d.ts +1 -1
  167. package/dist/leader/diffout.d.ts +2 -2
  168. package/dist/leader/diffup.d.ts +1 -1
  169. package/dist/leader/endpoint.d.ts +1 -1
  170. package/dist/leader/fanout.d.ts +6 -6
  171. package/dist/leader/grader-env-factory.d.ts +1 -1
  172. package/dist/leader/leader.d.ts +12 -12
  173. package/dist/leader/merge.d.ts +3 -3
  174. package/dist/leader/planner.d.ts +5 -5
  175. package/dist/leader/repair-oracle.d.ts +1 -1
  176. package/dist/leader/wire.d.ts +21 -9
  177. package/dist/leader/wire.js +6 -5
  178. package/dist/lsp/manager.d.ts +2 -2
  179. package/dist/lsp/types.d.ts +1 -1
  180. package/dist/lsp/ws-transport.d.ts +2 -2
  181. package/dist/main.js +12 -2
  182. package/dist/mcp-content-origin.d.ts +1 -1
  183. package/dist/memory-bundle-engine.d.ts +5 -3
  184. package/dist/memory-bundle-engine.js +2 -2
  185. package/dist/memory-operator-faces.d.ts +41 -11
  186. package/dist/memory-operator-faces.js +12 -0
  187. package/dist/memory-origin-fence.d.ts +1 -1
  188. package/dist/memory-origin-fence.js +2 -13
  189. package/dist/memory-posture.d.ts +6 -6
  190. package/dist/memory-scope.d.ts +7 -7
  191. package/dist/model-select.d.ts +5 -5
  192. package/dist/observability/cost-quota.d.ts +6 -6
  193. package/dist/observability/cost-taxonomy.d.ts +2 -2
  194. package/dist/observability/fail-open.d.ts +17 -5
  195. package/dist/observability/fail-open.js +16 -4
  196. package/dist/observability/metrics.d.ts +1 -1
  197. package/dist/observability/prompt-manifest.d.ts +8 -8
  198. package/dist/observability/rate-limit.d.ts +2 -2
  199. package/dist/observability/secret-env-scrub.d.ts +1 -1
  200. package/dist/observability/tool-trace.d.ts +1 -1
  201. package/dist/orchestration/hardened-vm-runner.d.ts +6 -6
  202. package/dist/orchestration/hardened-vm-worker-runner.d.ts +1 -1
  203. package/dist/orchestration/subagent-steer.d.ts +3 -3
  204. package/dist/orchestration/workflow-agent-steer.d.ts +1 -1
  205. package/dist/orchestration/workflow-completion-inbox.d.ts +6 -6
  206. package/dist/orchestration/workflow-notify-journal.d.ts +6 -6
  207. package/dist/parent-watch.d.ts +1 -1
  208. package/dist/parked-decide.d.ts +11 -11
  209. package/dist/plan-cache-probe.d.ts +1 -1
  210. package/dist/plugins/adoption-log-sql.d.ts +4 -4
  211. package/dist/plugins/approval-ask-store-memory.d.ts +1 -1
  212. package/dist/plugins/approval-ask-store-memory.js +12 -0
  213. package/dist/plugins/approval-ask-store-sql.d.ts +39 -17
  214. package/dist/plugins/approval-ask-store-sql.js +23 -6
  215. package/dist/plugins/approval-payload-fingerprint.d.ts +23 -0
  216. package/dist/plugins/approval-payload-fingerprint.js +23 -0
  217. package/dist/plugins/background-agent-store-sql.d.ts +8 -8
  218. package/dist/plugins/background-shell-support.d.ts +12 -12
  219. package/dist/plugins/blob-backend.d.ts +3 -3
  220. package/dist/plugins/breaker-state-sql.d.ts +3 -3
  221. package/dist/plugins/caching-session-store.d.ts +6 -6
  222. package/dist/plugins/checkpoint-store-sql.d.ts +162 -66
  223. package/dist/plugins/checkpoint-store-sql.js +76 -33
  224. package/dist/plugins/device-store-sql.d.ts +4 -3
  225. package/dist/plugins/e2b-orphan-reclaim.d.ts +3 -3
  226. package/dist/plugins/file-history-store-sql.d.ts +9 -8
  227. package/dist/plugins/file-run-store.d.ts +27 -27
  228. package/dist/plugins/fork-routing-session-store.d.ts +9 -9
  229. package/dist/plugins/image-bake-store-sql.d.ts +1 -1
  230. package/dist/plugins/image-index-sql.d.ts +2 -2
  231. package/dist/plugins/k8s-bg-scripts.d.ts +1 -1
  232. package/dist/plugins/k8s-exec-protocol.d.ts +1 -1
  233. package/dist/plugins/leader-run-store-sql.d.ts +1 -1
  234. package/dist/plugins/local-checkpoint-store.d.ts +26 -17
  235. package/dist/plugins/local-checkpoint-store.js +21 -11
  236. package/dist/plugins/local-session-store.d.ts +5 -5
  237. package/dist/plugins/mailbox-store-sql.d.ts +6 -6
  238. package/dist/plugins/memory-embedder-fingerprint.d.ts +2 -2
  239. package/dist/plugins/memory-engine-pg.d.ts +1 -1
  240. package/dist/plugins/memory-engine-tidb.d.ts +1 -1
  241. package/dist/plugins/memory-key-guards.d.ts +3 -3
  242. package/dist/plugins/memory-optout-grant-store-sql.d.ts +10 -10
  243. package/dist/plugins/memory-origin-law.d.ts +13 -13
  244. package/dist/plugins/memory-run-store.d.ts +12 -12
  245. package/dist/plugins/outcome-ledger-sql.d.ts +3 -3
  246. package/dist/plugins/permission-rule-store-file.d.ts +3 -3
  247. package/dist/plugins/permission-rule-store-sql.d.ts +38 -33
  248. package/dist/plugins/permission-rule-store-sql.js +7 -12
  249. package/dist/plugins/pg-cost-quota.d.ts +2 -2
  250. package/dist/plugins/pg-pool.d.ts +29 -2
  251. package/dist/plugins/pg-pool.js +50 -2
  252. package/dist/plugins/pg-query.d.ts +1 -1
  253. package/dist/plugins/pg-rate-limiter.d.ts +2 -2
  254. package/dist/plugins/pg-session-storage.d.ts +9 -9
  255. package/dist/plugins/remote-env-adb.d.ts +1 -1
  256. package/dist/plugins/remote-env-device.d.ts +6 -4
  257. package/dist/plugins/remote-env-device.js +4 -1
  258. package/dist/plugins/remote-env-e2b.d.ts +11 -11
  259. package/dist/plugins/remote-env-file-error.d.ts +2 -2
  260. package/dist/plugins/remote-env-host.d.ts +10 -10
  261. package/dist/plugins/remote-env-k8s.d.ts +7 -7
  262. package/dist/plugins/remote-env-local-docker.d.ts +1 -1
  263. package/dist/plugins/remote-env-ssh.d.ts +9 -9
  264. package/dist/plugins/remote-scratchpad.d.ts +1 -1
  265. package/dist/plugins/resume-anchor-store-sql.d.ts +1 -1
  266. package/dist/plugins/retention-lane-store-sql.d.ts +2 -2
  267. package/dist/plugins/retention-store-sql.d.ts +11 -11
  268. package/dist/plugins/roster-store-sql.d.ts +6 -8
  269. package/dist/plugins/run-store-sql.d.ts +12 -12
  270. package/dist/plugins/scheduler-support.d.ts +1 -1
  271. package/dist/plugins/send-user-file.d.ts +1 -1
  272. package/dist/plugins/session-capture-record-store-sql.d.ts +99 -0
  273. package/dist/plugins/session-capture-record-store-sql.js +110 -0
  274. package/dist/plugins/session-placement.d.ts +1 -1
  275. package/dist/plugins/session-policy-store-sql.d.ts +2 -2
  276. package/dist/plugins/session-store.d.ts +3 -3
  277. package/dist/plugins/shared-memory-store-sql.d.ts +5 -5
  278. package/dist/plugins/sql-driver.d.ts +7 -7
  279. package/dist/plugins/sql-errors.d.ts +2 -2
  280. package/dist/plugins/sql-escape.d.ts +1 -1
  281. package/dist/plugins/sql-row-helpers.d.ts +1 -1
  282. package/dist/plugins/store-backend.d.ts +32 -19
  283. package/dist/plugins/store-backend.js +5 -1
  284. package/dist/plugins/store-contracts.d.ts +9 -9
  285. package/dist/plugins/task-list-store-sql.d.ts +3 -3
  286. package/dist/plugins/tidb-cost-quota.d.ts +3 -3
  287. package/dist/plugins/tidb-pool.d.ts +13 -0
  288. package/dist/plugins/tidb-pool.js +9 -0
  289. package/dist/plugins/tidb-rate-limiter.d.ts +2 -2
  290. package/dist/plugins/tidb-session-storage.d.ts +2 -2
  291. package/dist/plugins/tidb-session-store.d.ts +11 -11
  292. package/dist/plugins/tool-result-store-sql.d.ts +8 -8
  293. package/dist/plugins/usage-window-store-sql.d.ts +3 -3
  294. package/dist/plugins/web-search.d.ts +7 -7
  295. package/dist/plugins/workflow-journal-store-sql.d.ts +6 -6
  296. package/dist/plugins/workflow-run-store-sql.d.ts +1 -1
  297. package/dist/plugins/write-behind-counter.d.ts +6 -6
  298. package/dist/principal-jwt.d.ts +2 -2
  299. package/dist/project-memory.d.ts +1 -1
  300. package/dist/prompts-domain-validate.d.ts +8 -8
  301. package/dist/question.d.ts +3 -3
  302. package/dist/resource-suspend.d.ts +4 -4
  303. package/dist/resource-window.d.ts +3 -3
  304. package/dist/router/route-orchestration.d.ts +1 -1
  305. package/dist/rules-consent.d.ts +48 -40
  306. package/dist/run-local.d.ts +5 -5
  307. package/dist/runs.d.ts +19 -19
  308. package/dist/runtime-caps-resolver.d.ts +6 -6
  309. package/dist/runtime-governance.d.ts +11 -7
  310. package/dist/runtime-governance.js +23 -1
  311. package/dist/security.d.ts +13 -13
  312. package/dist/session-leaf-bus.d.ts +1 -1
  313. package/dist/session-sync-content.d.ts +4 -4
  314. package/dist/session-sync-kernel.d.ts +2 -2
  315. package/dist/session-sync.d.ts +13 -13
  316. package/dist/session-titler.d.ts +1 -1
  317. package/dist/session-watch.d.ts +3 -3
  318. package/dist/shared-memory-scope-authorizer.d.ts +4 -4
  319. package/dist/sighup-idle.d.ts +1 -1
  320. package/dist/spec-fields.d.ts +20 -20
  321. package/dist/ssh-host-key.d.ts +5 -5
  322. package/dist/store-live-probe.d.ts +2 -2
  323. package/dist/task-cwd.d.ts +11 -11
  324. package/dist/task-mcp.d.ts +5 -5
  325. package/dist/task-settings.d.ts +35 -35
  326. package/dist/task-workflow.d.ts +3 -3
  327. package/dist/text-bidi.d.ts +1 -1
  328. package/dist/tool-approval.d.ts +186 -182
  329. package/dist/tool-approval.js +247 -120
  330. package/dist/trace/core-keyset-guard.d.ts +19 -5
  331. package/dist/trace/engine-notice-wire.d.ts +7 -7
  332. package/dist/trace/engine-notice-wire.js +2 -0
  333. package/dist/trace/injection-tier.d.ts +11 -21
  334. package/dist/trace/injection-tier.js +3 -4
  335. package/dist/trace/ledger-events.d.ts +3 -3
  336. package/dist/trace/ledger-sink.d.ts +7 -7
  337. package/dist/trace/project.d.ts +31 -30
  338. package/dist/trace/project.js +1 -0
  339. package/dist/turn-activity.d.ts +4 -4
  340. package/dist/usage-analytics.d.ts +1 -1
  341. package/dist/wall-clock-jump-guard.d.ts +3 -3
  342. package/package.json +6 -6
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 MVP — leader fan-out composition layer (design/50 §3, V2-MVP-PLAN.md M1, core seam).
2
+ * v2 MVP — leader fan-out composition layer ([ref] §3, V2-MVP-PLAN.md M1, core seam).
3
3
  *
4
4
  * Runs N sub-task workers in parallel over `runner.runTaskStream` sharing ONE AbortController, bounded by a
5
5
  * Semaphore, with an overall deadline (no infinite wait — council#5), and a
@@ -7,7 +7,7 @@
7
7
  * snapshot — closing the late-registration race (council round-2). Returns a typed WorkerReport per worker (council#6 — the
8
8
  * Coordinator needs a defined shape to route diffs in merge(b)).
9
9
  *
10
- * ── 重复 spawn 的去重由谁负责(#193 车4 件1,台账 P1-9③ 更正)────────────────────────────────────
10
+ * ── 重复 spawn 的去重由谁负责([ref] 车4 件1,台账 P1-9③ 更正)────────────────────────────────────
11
11
  * 这段头注**曾经**写着 fan-out 带一道「concurrency claim(run-store createRun unique-key CAS)」并称
12
12
  * 「the rule-5 dual-session tax solved at worker scale」。亲读后裁定:那道 claim 全链路无人传,而且
13
13
  * **由构造即无效** —— 它的 CAS 键是 `(workerId, sessionId)`,而 sessionId 是 `wire.ts` 每次现铸的
@@ -41,15 +41,15 @@ export interface WorkerReport {
41
41
  error?: string;
42
42
  /** The worker's TaskResult.stats (tokens/cost/turns) — for the value-campaign cost accounting. */
43
43
  stats?: TaskResult["stats"];
44
- /** design/52 L3a module sub-gate: did this worker's module pass the per-module judge (after any repair)? */
44
+ /** [ref] L3a module sub-gate: did this worker's module pass the per-module judge (after any repair)? */
45
45
  moduleJudge?: "pass" | "fail";
46
46
  /** Number of bounded repairs the module sub-gate spent on this worker (0 = passed first try). */
47
47
  repairs?: number;
48
- /** design/74 Slice 6: the terminal checkpoint gate when a worker is still SUSPENDED (the leader auto-resumed
48
+ /** [ref] Slice 6: the terminal checkpoint gate when a worker is still SUSPENDED (the leader auto-resumed
49
49
  * it up to its bound but it didn't fully complete — e.g. the overall deadline hit or the slice cap). Present
50
50
  * ⇒ resumable: the operator/leader can escalate (more budget) or accept the belt-diff partial progress. */
51
51
  checkpointGate?: TaskResult["checkpointGate"];
52
- /** design/74 Slice 6: the worker's terminal `TaskResult.errorCode` (e.g. `limits.max_cost_exceeded` on an
52
+ /** [ref] Slice 6: the worker's terminal `TaskResult.errorCode` (e.g. `limits.max_cost_exceeded` on an
53
53
  * exhausted resume, `limits.max_turns_exceeded` — core 5.8.0 码名轴) — surfaced for /v1/leader observability. */
54
54
  errorCode?: TaskResult["errorCode"];
55
55
  /** LEADER-REPAIRLOOP-INTEGRATION §10.6 (THE push chokepoint): the `runRepairLoop` terminal a single-agent
@@ -95,7 +95,7 @@ export interface FanOutOptions {
95
95
  * cancelled worker actually aborts (else the overall-timeout's `await work` can never unblock). Like the default
96
96
  * path it need not catch — runOne maps a throw to failed/timeout. */
97
97
  runWorker?: (st: FanOutSubtask, signal: AbortSignal) => Promise<WorkerReport>;
98
- /** Replan-lite C4 (design/68 §6): when a worker settles SUSPENDED, immediately cancelAll the rest — the
98
+ /** Replan-lite C4 ([ref] §6): when a worker settles SUSPENDED, immediately cancelAll the rest — the
99
99
  * suspended worker itself has already settled (its stream is deregistered), so the cancel sweep cannot
100
100
  * touch its checkpoint/paused env (the destroy-exemption falls out of the registration lifecycle). */
101
101
  cancelOnSuspend?: boolean;
@@ -20,7 +20,7 @@
20
20
  * built. v1 reuses the integration sandbox (R1) + re-seeds it (R2) instead. **There is no config key that turns
21
21
  * such a factory on** — an earlier revision of this header named one and shipped a `throw`-only stub beside it,
22
22
  * but no such key ever existed in `config.ts`, so an operator following that text set an env var that did
23
- * nothing. Both the stub and the promise were removed (#193 车4 件3 / staleness ledger P2-9); the auto-accept
23
+ * nothing. Both the stub and the promise were removed ([ref] 车4 件3 / staleness ledger P2-9); the auto-accept
24
24
  * slice, when it happens, is a new design件 that lands its factory, its wiring and its knob in one batch.
25
25
  *
26
26
  * Everything here is additive + OFF by default: nothing in this file runs unless the Stage-2 seams call it behind
@@ -1,8 +1,8 @@
1
1
  /**
2
- * v2 MVP M4 — the leader orchestrator (design/50 §3, V2-MVP-PLAN.md). Composes the proven pieces into one
2
+ * v2 MVP M4 — the leader orchestrator ([ref] §3, V2-MVP-PLAN.md). Composes the proven pieces into one
3
3
  * callable API: Planner → fanOut (M1) → diff-out (M2) → merge(b) (M3) → Coordinator push.
4
4
  *
5
- * Worker-env model (design/68 §8 F2(a)): preferred = FACTORY env (runner-owned lifecycle; durable suspend only
5
+ * Worker-env model ([ref] §8 F2(a)): preferred = FACTORY env (runner-owned lifecycle; durable suspend only
6
6
  * yields a complete ownedEnv on this path) + diff-out via the worker's mandatory SELF-UPLOAD last step
7
7
  * (`fetchDiff`, diffup.ts). Compat = the original static env the leader owns: provision up-front, pull each
8
8
  * branch's diff OUT of the still-alive env (pullDiff), destroy every env in a `finally`.
@@ -16,7 +16,7 @@ import { type RunnerLike, type WorkerReport } from "./fanout.js";
16
16
  import { type ExecStreamLike } from "./diffout.js";
17
17
  import { type MergeDeps, type MergeResult } from "./merge.js";
18
18
  import { type TaskSpec, type VerifyConfig, type CheckpointToken, type ToolSpec, type RepairTerminal, type OracleTier, type RepairResult } from "@sema-agent/core";
19
- /** design/74 Slice 6: drive a worker's resource-suspend auto-resume to a terminal (or bound) state. Exported
19
+ /** [ref] Slice 6: drive a worker's resource-suspend auto-resume to a terminal (or bound) state. Exported
20
20
  * for unit tests. Loops `resume(token, slice)` WHILE the result carries a `resource_limit` checkpoint gate —
21
21
  * NOT by status (the verify wrapper may surface a suspend as failed-with-token). Exits on: a terminal result
22
22
  * (completed/failed → no gate), an exhausted budget (core fails the resume fast → no token/gate), a
@@ -44,16 +44,16 @@ export interface ProvisionedWorker {
44
44
  branch: string;
45
45
  /** base commit of THIS worker's env (drives `git format-patch <baseSha>..<branch>` diff-out). */
46
46
  baseSha: string;
47
- /** runs the worker agent on this worker's env (static `executionEnv` or a factory — design/68 F2(a)). */
47
+ /** runs the worker agent on this worker's env (static `executionEnv` or a factory — [ref] F2(a)). */
48
48
  runner: RunnerLike;
49
49
  /** Static-env mode (M2 compat): pull the worker's branch diff OUT of its (post-task, still-alive) env. */
50
50
  diffEnv?: ExecStreamLike;
51
- /** Factory-env mode (design/68 F2(a), preferred when set): fetch the diff the worker SELF-UPLOADED as its
51
+ /** Factory-env mode ([ref] F2(a), preferred when set): fetch the diff the worker SELF-UPLOADED as its
52
52
  * mandatory last task step (presigned MinIO object) — the env is runner-owned and already gone. */
53
53
  fetchDiff?: () => Promise<import("./diffout.js").PullDiffResult>;
54
54
  /** Static-env mode only: the leader owns + destroys the env. Factory envs omit this — the runner's factory
55
55
  * lifecycle destroys them, and a SUSPENDED worker's paused env is thereby exempt from the leader's reap
56
- * (design/68 row4/C4: destroying a suspended worker's env = expiring its resume token). */
56
+ * ([ref] row4/C4: destroying a suspended worker's env = expiring its resume token). */
57
57
  destroy?: () => Promise<void>;
58
58
  spec: Omit<TaskSpec, "sessionId" | "signal">;
59
59
  /** Optional read-effect PROBE tools for the L3 verifier (verifyWorker path). The default verifierTools = the
@@ -71,7 +71,7 @@ export interface LeaderDeps {
71
71
  push: MergeDeps["push"];
72
72
  /** Integration test command (the merge gate) + repo dir inside the sandbox. */
73
73
  testCmd: string;
74
- /** Optional truecorrect MEASURE (design/59): a thorough hidden-oracle command run IN the integration sandbox
74
+ /** Optional truecorrect MEASURE ([ref]): a thorough hidden-oracle command run IN the integration sandbox
75
75
  * after the gate passes (NOT a gate) — offloads the measure from the control plane. Result in result.merge.measure. */
76
76
  measureCmd?: string;
77
77
  repoDir?: string;
@@ -80,7 +80,7 @@ export interface LeaderDeps {
80
80
  /** fan-out deadline + concurrency cap. */
81
81
  timeoutMs: number;
82
82
  maxConcurrency: number;
83
- /** design/52 L3a — optional per-module sub-gate + bounded repair, run AFTER fan-out, BEFORE merge. For each
83
+ /** [ref] L3a — optional per-module sub-gate + bounded repair, run AFTER fan-out, BEFORE merge. For each
84
84
  * completed worker: judge its module (diff) vs its sub-objective; on fail, re-run that ONE worker with the
85
85
  * judge's feedback (bounded by maxRepairs, default 1) on its own still-alive env, then re-judge. A module that
86
86
  * still fails is marked `failed` (merge quarantines it). Catches per-module escapes the end-integration test
@@ -93,12 +93,12 @@ export interface LeaderDeps {
93
93
  repairObjective: (sub: SubtaskSpec, reason: string) => string;
94
94
  maxRepairs?: number;
95
95
  };
96
- /** core 1.72 native L3a (design/54 §4): when set, each worker runs via `runWithVerification` (run the module +
96
+ /** core 1.72 native L3a ([ref] §4): when set, each worker runs via `runWithVerification` (run the module +
97
97
  * an INDEPENDENT DECORRELATED verifier tries to break it reading the diff/workspace + a bounded fix-loop)
98
98
  * instead of plain fan-out. The worker runner's `models` catalog MUST carry the heterogeneous `verifierModel`
99
99
  * (decorrelation = deployment contract). Mutually exclusive with `moduleGate` (this IS the native version). */
100
100
  verifyWorker?: VerifyConfig;
101
- /** Replan-lite (design/68 §6): bounded, DETERMINISTIC reactions — no runtime DAG surgery. When set:
101
+ /** Replan-lite ([ref] §6): bounded, DETERMINISTIC reactions — no runtime DAG surgery. When set:
102
102
  * worker failed → redispatch ×1 on a FRESH env (clean base; a crashed worker's half-written workspace is
103
103
  * never reused) → still failed = collapse-remainder-to-single; verify FAIL (repair already bounded inside
104
104
  * the verify loop) → collapse; structural merge conflict → collapse + record; budgetUsd exceeded → stop
@@ -151,7 +151,7 @@ export interface LeaderResult {
151
151
  route?: "single" | "fanout";
152
152
  /** Set when planning/provisioning failed before fan-out. */
153
153
  error?: string;
154
- /** Replan-lite (design/68 §6): which trigger won arbitration + what was done. */
154
+ /** Replan-lite ([ref] §6): which trigger won arbitration + what was done. */
155
155
  replan?: {
156
156
  trigger: "suspended" | "budget" | "merge-conflict" | "verify-fail" | "worker-failed";
157
157
  redispatched?: string[];
@@ -163,7 +163,7 @@ export interface LeaderResult {
163
163
  workerId: string;
164
164
  sessionId: string;
165
165
  }>;
166
- /** design/74 Slice 6 / task#16: the diff (uncommitted work auto-committed by the belt, then diff-out) of
166
+ /** [ref] Slice 6 / task#16: the diff (uncommitted work auto-committed by the belt, then diff-out) of
167
167
  * workers that did NOT merge (failed / still-suspended). Their progress is otherwise lost — the merge only
168
168
  * integrates COMPLETED workers — so surface it here for review/cherry-pick instead of silently dropping it
169
169
  * (the migration-run loss: a network-failed worker's 4 commits vanished). Best-effort + non-empty only. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 MVP M3 — merge(b), the hard bone (design/50 §7, V2-MVP-PLAN.md, search [25]/[26], council round-1).
2
+ * v2 MVP M3 — merge(b), the hard bone ([ref] §7, V2-MVP-PLAN.md, search [25]/[26], council round-1).
3
3
  *
4
4
  * The deterministic Coordinator integrates N completed workers' branches under FULL isolation:
5
5
  * 1. pull each worker's patch OUT of its container (M2 `pullDiff` — no creds go in).
@@ -65,7 +65,7 @@ export interface IntegrationRepair {
65
65
  * then VERIFIES no marker/.rej remains before continuing, and the downstream test gate still guards correctness.
66
66
  * Wired by the caller (provisionIntegrationSandbox); when unset, an apply conflict stays terminal exactly as before
67
67
  * (zero behaviour change). Reuses the IntegrationRepair sandbox + hands pattern → no new core/env seam (the seam
68
- * design/68 §8 feared for "adopting N half-done workspaces" is unnecessary for the conflict case).
68
+ * [ref] §8 feared for "adopting N half-done workspaces" is unnecessary for the conflict case).
69
69
  */
70
70
  export interface ConflictResolver {
71
71
  /** Max resolution attempts before giving up (each = one agent run + one marker/.rej re-check). */
@@ -112,7 +112,7 @@ export interface MergeDeps {
112
112
  repoDir?: string;
113
113
  /** Full test command run in the sandbox (the merge gate). */
114
114
  testCmd: string;
115
- /** Optional truecorrect MEASURE (design/59): a thorough hidden-oracle command run IN the integration sandbox
115
+ /** Optional truecorrect MEASURE ([ref]): a thorough hidden-oracle command run IN the integration sandbox
116
116
  * (E2B) right after the gate passes — offloads the measure from the CPU-contended control plane (the
117
117
  * frontier-multi oracle-timeout fix). NOT a gate (does not affect `ok`); the result lands in MergeResult.measure
118
118
  * for the caller to read as the objective truly-correct signal. Same place + env as the gate, just a thornier test. */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * v2 MVP — LLM Planner (design/50 §3: leader = LLM-planner that splits a DAG + deterministic Coordinator).
2
+ * v2 MVP — LLM Planner ([ref] §3: leader = LLM-planner that splits a DAG + deterministic Coordinator).
3
3
  * Decomposes an objective into N **disjoint-file** sub-tasks via one model completion, then VALIDATES the plan
4
4
  * deterministically (the trust boundary: an LLM proposes, the Coordinator enforces — service[19] leaderless-
5
5
  * leader). Disjoint file-ownership is the invariant that lets workers run in parallel + merge without conflict.
@@ -14,17 +14,17 @@ export interface PlanOptions {
14
14
  maxSubtasks?: number;
15
15
  /** Extra repo/context guidance appended to the prompt (e.g. file layout, conventions). */
16
16
  context?: string;
17
- /** Deployment knob (design/68 §11 A6, correctness-first): `false` = never fan out — `routePlan` skips the
17
+ /** Deployment knob ([ref] §11 A6, correctness-first): `false` = never fan out — `routePlan` skips the
18
18
  * router model call entirely and returns the deterministic single route (zero routing cost, zero risk of a
19
19
  * false fan-out). Default (undefined/true) = the router decides. */
20
20
  fanoutEnabled?: boolean;
21
- /** Economic guard threshold (design/68 §7, search[83] ruling): an objective SHORTER than this never reaches
21
+ /** Economic guard threshold ([ref] §7, search[83] ruling): an objective SHORTER than this never reaches
22
22
  * the router — deterministic single (a small task can't be economically decomposable; false-single is the
23
23
  * cheap error side). Default 64 — deliberately below the route corpus's smallest fan-out case. */
24
24
  minFanoutChars?: number;
25
25
  }
26
26
  /**
27
- * Deterministic economic 防灾 guard (design/68 §7 / §11 D2, search [83] ruling (b)): the asymmetry is that a
27
+ * Deterministic economic 防灾 guard ([ref] §7 / §11 D2, search [83] ruling (b)): the asymmetry is that a
28
28
  * false fan-out is the -98% disaster while a false single merely runs slower — so every case decidable WITHOUT
29
29
  * the model resolves to single, for free. Pure function (unit-testable); the semantic judgments (sequential/
30
30
  * coupled/uncertain) stay with the router LLM, and "估不准回 single" is the collapse fallback (B3).
@@ -65,7 +65,7 @@ export declare function routePrompt(objective: string, opts?: PlanOptions): stri
65
65
  * validated by `parsePlan` (the same disjointness/shape invariants the Coordinator depends on). */
66
66
  export declare function routePlan(objective: string, runRoute: (prompt: string) => Promise<string>, opts?: PlanOptions): Promise<SubtaskSpec[]>;
67
67
  /**
68
- * Decomposer quality gate (design/68 §5/§11 B1-B3): run the router, and on a rejected/unparseable plan retry
68
+ * Decomposer quality gate ([ref] §5/§11 B1-B3): run the router, and on a rejected/unparseable plan retry
69
69
  * the LLM AT MOST ONCE, then COLLAPSE TO SINGLE (never fail the task on a bad plan — single is almost always
70
70
  * the right fallback, and a false fan-out is the -98% disaster; a plan failure must not be louder than that).
71
71
  * `collapsed` carries the reason (observability: a collapse is a router-quality signal, not silent).
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The PROFILE-injected `RepairOracle` closure for the leader's single-agent self-repair loop
3
- * (`runRepairLoop`, core design/78 / D1). See `sema-internal server/docs/LEADER-REPAIRLOOP-INTEGRATION.md` (§3.1 + the authoritative
3
+ * (`runRepairLoop`, core [ref] / D1). See `sema-internal server/docs/LEADER-REPAIRLOOP-INTEGRATION.md` (§3.1 + the authoritative
4
4
  * §10 corrected layer). The closure GRADES a worker's candidate in an ISOLATED grader env (the reused
5
5
  * integration sandbox, distinct from the worker env) and maps the result to a core `OracleResult`. core only
6
6
  * fixes the `OracleResult` shape + the read-only/identity contract; the composition lives HERE so the core type
@@ -1,15 +1,16 @@
1
1
  import { type Brain, type Model, type ModelRoles, type ModelPricing, type TaskSpec, type ExecutionEnvFactory, type RemoteExecutionEnv, type ToolResultStore, type SessionStore, type RunnerDeps } from "@sema-agent/core";
2
2
  import type { CheckpointStoreFull } from "../plugins/store-backend.js";
3
3
  import { type LeaderDeps, type LeaderResult } from "./leader.js";
4
+ import { type DeploymentPostureSeats } from "../boot/runner-deps.js";
4
5
  import type { LeaderRequestBody } from "./endpoint.js";
5
6
  export interface LeaderWireConfig {
6
7
  /** Static-env compat mode (E2B only): the leader provisions/owns each env. Required when `envFactory` unset. */
7
8
  e2bApiKey?: string;
8
- /** design/68 F2(a) + k8s lane: the per-task execution-env factory the service main already built for
9
+ /** [ref] F2(a) + k8s lane: the per-task execution-env factory the service main already built for
9
10
  * REMOTE_EXEC (e2b or k8s/Kata) — workers and the integration sandbox run on envs from THIS factory.
10
11
  * Requires `s3` (diff-out is the worker's self-upload; there is no leader-held env to pull from). */
11
12
  envFactory?: ExecutionEnvFactory;
12
- /** Durable suspend/resume for SUB-WORKERS (design/68 C4): when set, each worker task carries the durable
13
+ /** Durable suspend/resume for SUB-WORKERS ([ref] C4): when set, each worker task carries the durable
13
14
  * question/ask policy + checkpoint store, so a gated ask/AskUserQuestion SUSPENDS the worker (checkpoint +
14
15
  * paused env) instead of failing — the trigger replan-lite C4 arbitrates on. Mirrors main.ts's per-task
15
16
  * durable wiring; ctx is seeded at provision so the surfaced token is resumable on the single-agent path. */
@@ -31,11 +32,22 @@ export interface LeaderWireConfig {
31
32
  * the resume dies with SessionError "Entry <leafId> not found" (found live: drill c3 deny path). */
32
33
  sessionStore?: SessionStore;
33
34
  /**
34
- * design/170 件B/C/D(#252,codex R2-F1)—— 部署治理三座席,**原样递给本车道的每一只 Runner**。
35
+ * [ref] 件B/C/D([ref],codex R2-F1)—— 部署治理三座席,**原样递给本车道的每一只 Runner**。
35
36
  * 主车道的 `boot/governance-seams.ts` 是唯一属主(判据、拒启、解析全在那里),本字段只是把它的产物
36
37
  * 搬过来:一个进程里「这台部署禁哪些能力、锁了哪些键」只能有一个答案。缺席 = 与接线前逐字相同。
37
38
  */
38
39
  governance?: Pick<RunnerDeps, "compliancePostureResolver" | "lockedConfig" | "retentionPolicy">;
40
+ /**
41
+ * [ref](黑板 [ref])—— **部署姿态座席族**(readFace 四席 `readFace`/`readDenyPatterns`/`readDenyBuiltinTiers`/
42
+ * `readDenyBuiltinExclude` + `memoryDelegationEvidence`/`memoryProvenance`/`memoryCapturePolicy`/
43
+ * `delegationEntryCaps`),**原样递给本车道的每一只 Runner**。唯一属主 = `boot/runner-deps.ts` 的
44
+ * `buildDeploymentPostureSeats(config)`(主 runner / subRunner / run-local 的共享基座展开的就是它),
45
+ * `boot/leader.ts` 把**同一函数、同一 config** 的产物搬过来:一个进程里「这台部署的 READ 面 / 记忆姿态 /
46
+ * 委派 caps」只能有一个答案。缺席 = 展开空对象 = 五处字面量键缺席(与接线前逐字相同)。
47
+ * 修前(≤7.53)这五只 Runner 一席都没有:运维写的 READ_DENY_PATTERNS / MEMORY_DELEGATION_EVIDENCE 等对
48
+ * leader 编排的 planner / worker / repair / conflict 四类任务**静默不生效**(core 内建 deny 表仍在)。
49
+ */
50
+ deploymentPosture?: DeploymentPostureSeats;
39
51
  /** Worker model brain + catalog (the same the service runs tasks on). */
40
52
  brain: Brain;
41
53
  models: Record<string, Model>;
@@ -48,7 +60,7 @@ export interface LeaderWireConfig {
48
60
  name: string;
49
61
  email: string;
50
62
  };
51
- /** design/68 A6 knob: false = router never fans out (deterministic single route, zero router cost). */
63
+ /** [ref] A6 knob: false = router never fans out (deterministic single route, zero router cost). */
52
64
  fanoutEnabled?: boolean;
53
65
  /** The model (a catalog name) the ROUTER/planner call runs on. The route is a trivial single-vs-fanout
54
66
  * classification; running it on a heavy reasoning model (deepseek-v4-pro + reasoning) returns an EMPTY
@@ -65,7 +77,7 @@ export interface LeaderWireConfig {
65
77
  * Env override: LEADER_CONFLICT_ROUNDS. Resolves the conflict in-place + keeps the other workers' work, instead
66
78
  * of discarding all fan-out output and redoing single. Runs the strong (default) model with hands in the sandbox. */
67
79
  conflictRounds?: number;
68
- /** design/68 §8 F2(a): when set, workers run on FACTORY envs (runner-owned lifecycle — the durable-suspend-
80
+ /** [ref] §8 F2(a): when set, workers run on FACTORY envs (runner-owned lifecycle — the durable-suspend-
69
81
  * complete path; a suspended worker's paused env is exempt from the leader reap by construction) and diff-out
70
82
  * is the worker's mandatory self-upload to this MinIO/S3 store (presigned per worker; creds adapter-held).
71
83
  * Unset = the original leader-owned static-env mode (pullDiff compat). */
@@ -85,11 +97,11 @@ export interface LeaderWireConfig {
85
97
  /** The env surface wire needs (both the E2B and k8s adapters implement core's RemoteExecutionEnv). */
86
98
  type WireEnv = Pick<RemoteExecutionEnv, "exec" | "writeFile">;
87
99
  /**
88
- * Resume-safe worker staging (the design/68 F2(a) factory-env path). Runs adapter-side before the agent's
100
+ * Resume-safe worker staging (the [ref] F2(a) factory-env path). Runs adapter-side before the agent's
89
101
  * first workspace-touching call: seed the base repo at the worker branch + plant the upload script (so the
90
102
  * presigned URL never passes through the model).
91
103
  *
92
- * 🔴 BL-1 fix (design/74 Slice 6): on a RESOURCE-SUSPEND RESUME core re-invokes the `executionEnvFactory`,
104
+ * 🔴 BL-1 fix ([ref] Slice 6): on a RESOURCE-SUSPEND RESUME core re-invokes the `executionEnvFactory`,
93
105
  * producing a FRESH `withStaging` wrapper (`staged=undefined`) whose `stage()` runs AGAIN — AFTER core's
94
106
  * `resumeVM()` has already untar'd the snapshot onto the fresh pod (`resumeVM` is not a STAGED_METHOD, so it
95
107
  * is NOT intercepted by the staging proxy; the agent's first `exec` is what triggers `stage()`, lazily, and
@@ -134,7 +146,7 @@ export declare function leaderResourceConfig(env?: NodeJS.ProcessEnv): {
134
146
  workerBudgetUsd: number;
135
147
  workerLimits: Partial<TaskSpec>;
136
148
  presignTtlSec: number;
137
- /** design/74 Slice 6: opt-in (LEADER_RESOURCE_SUSPEND=true) resource-slice suspend for workers. When set, a
149
+ /** [ref] Slice 6: opt-in (LEADER_RESOURCE_SUSPEND=true) resource-slice suspend for workers. When set, a
138
150
  * worker SUSPENDS at the per-slice window (`sliceMaxCostUsd`) instead of failing at the budget, and the
139
151
  * leader auto-resumes (resumeWithVerification) until the TOTAL (`totalBudgetUsd` = workerBudgetUsd) is spent
140
152
  * — a budget overrun becomes a resumable pause, not a worker failure. ⚠️ 语义更新(core 5.11.0 B3,
@@ -160,7 +172,7 @@ export interface LeaderLoopConfig {
160
172
  measureGatesOn: boolean;
161
173
  repairLoopAttempts: number;
162
174
  oracleFlakyK: number;
163
- /** replan-lite (design/68 §6) fan-out spend cap from LEADER_BUDGET_USD. Absent = replan-lite's own default
175
+ /** replan-lite ([ref] §6) fan-out spend cap from LEADER_BUDGET_USD. Absent = replan-lite's own default
164
176
  * (unset env stays absent — existing contract untouched; see leaderLoopConfig doc below). */
165
177
  replanBudgetUsd?: number;
166
178
  }
@@ -129,6 +129,7 @@ export function createLeaderRunner(cfg) {
129
129
  const { repairRounds, repairBudgetUsd, conflictRounds, repairLoopOn, measureGatesOn, repairLoopAttempts, oracleFlakyK, replanBudgetUsd, } = leaderLoopConfig({ repairRounds: cfg.repairRounds, conflictRounds: cfg.conflictRounds });
130
130
  const onNoticeSeat = createEngineNoticeSeat(cfg.logger);
131
131
  const governanceSeat = cfg.governance ?? {};
132
+ const deploymentPostureSeat = cfg.deploymentPosture ?? {};
132
133
  const mkRepair = (rawEnv, repoDir, oracleFiles) => {
133
134
  if (repairRounds <= 0)
134
135
  return undefined;
@@ -142,7 +143,7 @@ export function createLeaderRunner(cfg) {
142
143
  throw new Error(`oracle still present after remove (${f.path}) — refusing repair (measurement integrity)`);
143
144
  }
144
145
  try {
145
- const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, executionEnv: rawEnv, rootPath: repoDir });
146
+ const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, executionEnv: rawEnv, rootPath: repoDir });
146
147
  const objective = [
147
148
  `The integrated project at ${repoDir} fails its build/test. Make the MINIMAL change to the working tree so this command exits 0 (cd into the repo and run it yourself to confirm):`,
148
149
  ` ${testCmd}`,
@@ -185,7 +186,7 @@ export function createLeaderRunner(cfg) {
185
186
  throw new Error(`oracle still present after remove (${f.path}) — refusing conflict-resolve (measurement integrity)`);
186
187
  }
187
188
  try {
188
- const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, executionEnv: rawEnv, rootPath: repoDir });
189
+ const runner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, executionEnv: rawEnv, rootPath: repoDir });
189
190
  const objective = [
190
191
  `A parallel worker '${workerId}' ported a module on its own branch, but applying its patch onto the already-integrated tree at ${repoDir} produced a MERGE CONFLICT (git apply --3way). The OTHER workers' patches already applied cleanly — integrate THIS worker's changes too, resolving the overlap.`,
191
192
  `Resolve EVERY conflict in the working tree: open each file containing conflict markers (<<<<<<< / ======= / >>>>>>>) and merge BOTH sides' real intent (keep both workers' behaviour — never drop one side just to make it apply). Then apply any rejected hunks recorded in *.rej files by hand, and DELETE every *.rej and *.orig file.`,
@@ -248,7 +249,7 @@ export function createLeaderRunner(cfg) {
248
249
  if (Array.isArray(body.subtasks) && body.subtasks.length > 0) {
249
250
  return validateSubtasks(body.subtasks);
250
251
  }
251
- const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat });
252
+ const planRunner = new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat });
252
253
  const runRoute = async (prompt) => {
253
254
  const res = await planRunner.runTaskStream({
254
255
  objective: prompt,
@@ -338,7 +339,7 @@ export function createLeaderRunner(cfg) {
338
339
  workerId: sub.workerId, sessionId, branch: sub.branch,
339
340
  baseSha,
340
341
  runner: keepCtxWarm(new Runner({
341
- brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat,
342
+ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat,
342
343
  ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}),
343
344
  ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}),
344
345
  executionEnvFactory: (ctx) => withStaging(envFactory(ctx), stage, async (e) => {
@@ -358,7 +359,7 @@ export function createLeaderRunner(cfg) {
358
359
  const baseSha = await sh(env)(`cd ${repo} && git rev-parse HEAD`);
359
360
  return {
360
361
  workerId: sub.workerId, sessionId, branch: sub.branch, baseSha,
361
- runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
362
+ runner: keepCtxWarm(new Runner({ brain: cfg.brain, models: cfg.models, roles: cfg.roles, pricing: cfg.pricing, ...onNoticeSeat, ...governanceSeat, ...deploymentPostureSeat, ...(cfg.toolResultStore ? { toolResultStore: cfg.toolResultStore } : {}), ...(cfg.sessionStore ? { sessionStore: cfg.sessionStore } : {}), executionEnv: env })),
362
363
  diffEnv: env,
363
364
  destroy: () => env.destroy().then(() => { }),
364
365
  spec: { ...workerLimits, ...sub.spec, ...durableSpec, ...resourceSpec },
@@ -68,7 +68,7 @@ export interface E2bLspManagerOptions {
68
68
  }
69
69
  /**
70
70
  * §DESIGN-V2 F1/F8/F9 —— 本文件曾**手抄**一份 core 的 `settleOnAbort`(注释自陈 core「un-exported」,并写下
71
- * 「一旦 core 导出即 find-and-delete」的计划)。A-033.1(#256)执行了那句话:core 现已从包根导出它
71
+ * 「一旦 core 导出即 find-and-delete」的计划)。[ref]([ref])执行了那句话:core 现已从包根导出它
72
72
  * (`index.d.ts:27`,来自 `core/lsp.js`),手抄件遂删除,本文件的两处调用直接消费 core 的实现。
73
73
  *
74
74
  * 它的语义(读点在 `open` 的两处调用):给**这一个**调用方一个自己的 settle —— 调用方的 `signal` 让它拿到
@@ -86,7 +86,7 @@ export declare class E2bLspManager implements LspServerManager {
86
86
  private readonly log;
87
87
  private readonly hasServerCommand;
88
88
  private readonly metrics;
89
- /** design/121 (core 1.220, board [S] ①): the workspace diagnostics registry — WORKSPACE-scoped (survives
89
+ /** [ref] (core 1.220, board [S] ①): the workspace diagnostics registry — WORKSPACE-scoped (survives
90
90
  * heal/evict; diagnostics belong to files, not servers), drained by the Runner at turn boundaries. Every
91
91
  * session feeds it from `textDocument/publishDiagnostics` (the WS transport now dispatches notifications).
92
92
  * ⚠️ ONE registry across sandboxes on this manager instance (it is per-deployment) — same posture as
@@ -1,5 +1,5 @@
1
1
  /**
2
- * LSP sidecar — service-side types (design/64 §13.1). core 1.82+ ships `createLspTool(manager)`
2
+ * LSP sidecar — service-side types ([ref] §13.1). core 1.82+ ships `createLspTool(manager)`
3
3
  * + the `LspServerManager`/`LspSession`/`LspResult` SEAM (`@sema-agent/core`); the runner mounts the tool
4
4
  * when OUR manager is wired via `RunnerDeps.lspManager`. We re-export core's seam types — SINGLE SOURCE OF TRUTH,
5
5
  * incl. the injectable `LspTransport` (the WS-bridge connection to the language server inside E2B) + `LspReadText`.
@@ -17,7 +17,7 @@ export declare class WsLspTransport implements LspTransport {
17
17
  private isClosed;
18
18
  private keepalive;
19
19
  private awaitingPong;
20
- /** design/121: server→client NOTIFICATION subscribers (publishDiagnostics etc.). */
20
+ /** [ref]: server→client NOTIFICATION subscribers (publishDiagnostics etc.). */
21
21
  private readonly notificationHandlers;
22
22
  constructor(ws: WsLike, requestTimeoutMs?: number, keepaliveMs?: number);
23
23
  /** Manager-visible liveness (LspTransport.closed): evict + reopen instead of reusing a dead connection. */
@@ -26,7 +26,7 @@ export declare class WsLspTransport implements LspTransport {
26
26
  private failAll;
27
27
  request(method: string, params: unknown, signal?: AbortSignal): Promise<unknown>;
28
28
  notify(method: string, params: unknown): void;
29
- /** design/121 (core 1.220): subscribe to server→client notifications; returns unsubscribe. Additive —
29
+ /** [ref] (core 1.220): subscribe to server→client notifications; returns unsubscribe. Additive —
30
30
  * core's diagnostics registry is the intended consumer; with no subscriber, behavior is byte-identical. */
31
31
  onNotification(handler: (method: string, params: unknown) => void): () => void;
32
32
  close(): Promise<void>;
package/dist/main.js CHANGED
@@ -32,7 +32,7 @@ import { createHttpServer, explicitOperatorOk, hasServiceAuth } from "./http/ser
32
32
  import { exportMemoryScope } from "./memory-export.js";
33
33
  import { workflowModelAllowlistFor } from "./task-workflow.js";
34
34
  import { createMemoryBundleFaces } from "./memory-bundle-engine.js";
35
- import { backendOwnsControlPlane, createMemoryComplianceFaces, createMemoryOriginFaces } from "./memory-operator-faces.js";
35
+ import { backendOwnsControlPlane, createMemoryComplianceFaces, createMemoryOriginFaces, createSessionMemoryStatusFace } from "./memory-operator-faces.js";
36
36
  import { performMemorySync } from "./memory-sync.js";
37
37
  import { startOtlpExporter } from "./observability/otel-exporter.js";
38
38
  import { HEARTBEAT_MS, backgroundAgentOutput, taskHandleOutput, taskHandleStop } from "./runs.js";
@@ -120,17 +120,23 @@ async function main() {
120
120
  await configCenter.applyLocalRemoteExec();
121
121
  const { backend, storeBackendDegraded, memoryEngine, memorySyncCursors, rosterStore, backgroundAgentStore, taskAttachmentStore, mailboxStore, memoryExportBackend, memorySyncRunner, sessionStore, breakerState, usageWindowStore, memoryPosture, taskListLane, } = await openStores({ config, logger, metrics, localRoot });
122
122
  const instanceId = uuidv7();
123
- const memoryBundleFaces = memoryEngine ? createMemoryBundleFaces(memoryEngine) : undefined;
123
+ const sessionCaptureRecordStore = backend?.sessionCaptureRecords();
124
+ const memoryBundleFaces = memoryEngine ? createMemoryBundleFaces(memoryEngine, { ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}) }) : undefined;
124
125
  const memoryComplianceFaces = memoryEngine
125
126
  ? createMemoryComplianceFaces(memoryEngine, {
126
127
  onIncident: (err) => logger.warn("memory_compliance_incident", { code: err.code ?? null, detail: err.message }),
128
+ ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
127
129
  })
128
130
  : undefined;
129
131
  const memoryOriginFaces = memoryEngine
130
132
  ? createMemoryOriginFaces(memoryEngine, {
131
133
  onIncident: (err) => logger.warn("memory_origin_incident", { code: err.code ?? null, detail: err.message }),
134
+ ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
132
135
  })
133
136
  : undefined;
137
+ const sessionMemoryStatusFace = memoryEngine
138
+ ? createSessionMemoryStatusFace(memoryEngine, { ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}) })
139
+ : undefined;
134
140
  const adoptionBoot = await runAdoptionBootScan({ backend, logger });
135
141
  if (adoptionBoot.scanned > 0 || adoptionBoot.error !== undefined) {
136
142
  logger.info("adoption_boot_scan", { ...adoptionBoot });
@@ -211,6 +217,7 @@ async function main() {
211
217
  ...(config.memoryProvenance !== undefined ? { provenance: config.memoryProvenance } : {}),
212
218
  onIncident: (err) => logger.warn("memory_consolidation_incident", { code: err.code ?? null, detail: err.message }),
213
219
  onStopDetail: (audit) => logger.warn("memory_consolidation_stop_detail", audit),
220
+ ...(sessionCaptureRecordStore !== undefined ? { captureRecordStore: sessionCaptureRecordStore } : {}),
214
221
  })
215
222
  : undefined;
216
223
  for (const w of buildConsolidationValveAudit({
@@ -246,6 +253,7 @@ async function main() {
246
253
  mcpRevocations,
247
254
  config, logger, metrics, localRoot, promptSource: configCenter.promptSource, rosterStore, backgroundAgentStore, mailboxStore, usageWindowStore, brain,
248
255
  pricing, tracer, outcomeSink, elicitation, question, toolApproval, sessionStore, memoryEngine,
256
+ sessionCaptureRecordStore,
249
257
  memorySyncRunner, toolResultStore: runnerOffloadStore, sessionPolicyStore, runtimeCapsResolver, fileHistoryStore,
250
258
  legacyRewindBoundaryProbe: backend?.legacyRewindBoundaryProbe ? backend.legacyRewindBoundaryProbe.bind(backend) : undefined,
251
259
  permissionRuleStore: permissionRuleStores?.provider,
@@ -610,6 +618,7 @@ async function main() {
610
618
  memoryBundleImport: memoryBundleFaces ? memoryBundleFaces.importBundle : undefined,
611
619
  memoryCompliance: memoryComplianceFaces,
612
620
  memoryOriginFace: memoryOriginFaces,
621
+ sessionMemoryStatus: sessionMemoryStatusFace,
613
622
  memoryConsolidation: memoryConsolidationFaces,
614
623
  memoryOptOutGrant: memoryOptOutGrantStore,
615
624
  orgMemoryDirectory: orgMemoryAdmission.directory,
@@ -662,6 +671,7 @@ async function main() {
662
671
  mcpRevocations,
663
672
  mcpRevocationState: () => configCenter.mcpRevocationState(),
664
673
  configRefreshNow: () => configCenter.refreshNow(),
674
+ configCenterManagedKeys: () => configCenter.centerManagedKeys(),
665
675
  drainState,
666
676
  storeDegraded: storeBackendDegraded,
667
677
  storeLiveState: storeLiveProbe ? () => storeLiveProbe.state() : undefined,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * design/378(core 5.60.0)—— `McpServerSpec.contentOrigin` 的**闭词表单一属主**。
2
+ * [ref](core 5.60.0)—— `McpServerSpec.contentOrigin` 的**闭词表单一属主**。
3
3
  *
4
4
  * core 给 MCP 条目开了一个**内容出处声明**座位:一台 server 的整套工具的结果算 `"local"`(部署自己
5
5
  * 写的)/ `"execution"`(执行环境产物,`execIsExternalContent` 仍能收紧)/ `"external"`(第三方内容,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * #264 v2-c —— `POST /v1/memory/{export,import}` 两口的**引擎接线**(core 5.40.0 design/178 v2-c)。
2
+ * [ref] v2-c —— `POST /v1/memory/{export,import}` 两口的**引擎接线**(core 5.40.0 [ref] v2-c)。
3
3
  *
4
4
  * ## 为什么需要这个模块(而不是在 main.ts 里直接 new)
5
5
  *
@@ -29,7 +29,7 @@
29
29
  * HTTP 面诚实 501。
30
30
  *
31
31
  * 🔴 首版把这件事当成**运行期**事实(照常挂载,让 core 每次抛 `memory.export_incomplete` / 422),
32
- * 被 codex 交叉复审驳倒(#277 提货批 [medium],验真后修):`typeof backend.exportSnapshotOf === "function"`
32
+ * 被 codex 交叉复审驳倒([ref] 提货批 [medium],验真后修):`typeof backend.exportSnapshotOf === "function"`
33
33
  * 是一次**属性检查**,boot 期就判得出;而且它是**永久**缺席(换后端才会变),不是瞬时状态。照旧挂着
34
34
  * 就成了「能力位说 yes、每一次调用都确定性失败」——本仓「says yes ⟺ route works」是结构性承诺,
35
35
  * 一个恒假的 yes 会让壳给用户开出一条走不通的迁移流程。
@@ -41,7 +41,7 @@
41
41
  * `memory.export_incomplete` —— 那是诚实的运行期拒,附录 A 单列一条。绝不在这里回落到「用通用读面拼
42
42
  * 一个包」:core 明写那正是它拒绝生产的形(a governance-less export is the laundering shape)。
43
43
  */
44
- import { type MemoryBackend, type MemoryExportBundle, type MemoryImportReport } from "@sema-agent/core";
44
+ import { type MemoryBackend, type MemoryExportBundle, type MemoryImportReport, type SessionCaptureRecordStore } from "@sema-agent/core";
45
45
  /** 两口 HTTP 面消费的窄能力面(`ServiceDeps.memoryBundle{Export,Import}` 的实参来源)。 */
46
46
  export interface MemoryBundleFaces {
47
47
  exportScopes: (scopes: readonly string[]) => Promise<MemoryExportBundle>;
@@ -60,5 +60,7 @@ export interface MemoryBundleFaces {
60
60
  export declare function createMemoryBundleFaces(store: {
61
61
  backend: MemoryBackend;
62
62
  root: string;
63
+ }, opts?: {
64
+ captureRecordStore?: SessionCaptureRecordStore;
63
65
  }): MemoryBundleFaces | undefined;
64
66
  //# sourceMappingURL=memory-bundle-engine.d.ts.map
@@ -1,9 +1,9 @@
1
1
  import { MemoryEngine } from "@sema-agent/core";
2
- export function createMemoryBundleFaces(store) {
2
+ export function createMemoryBundleFaces(store, opts) {
3
3
  const b = store.backend;
4
4
  if (typeof b.exportSnapshotOf !== "function" || typeof b.importBundleCommit !== "function")
5
5
  return undefined;
6
- const engine = new MemoryEngine({ backend: store.backend, memoryDir: store.root });
6
+ const engine = new MemoryEngine({ backend: store.backend, memoryDir: store.root, ...(opts?.captureRecordStore !== undefined ? { captureRecordStore: opts.captureRecordStore } : {}) });
7
7
  return {
8
8
  exportScopes: (scopes) => engine.exportMemoryScopes(scopes),
9
9
  importBundle: (bundle, opts) => engine.importMemoryBundle(bundle, opts),