@sema-agent/server 7.147.0 → 7.148.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 (725) hide show
  1. package/MIGRATION.md +1039 -24
  2. package/README.md +20 -7
  3. package/README.zh-CN.md +14 -8
  4. package/USAGE.md +380 -163
  5. package/deploy/sema-up/README.md +16 -5
  6. package/deploy/sema-up/chart/templates/NOTES.txt +1 -1
  7. package/deploy/sema-up/chart/templates/_helpers.tpl +20 -4
  8. package/deploy/sema-up/chart/values.yaml +3 -2
  9. package/deploy/sema-up/cluster-up.sh +74 -176
  10. package/deploy/sema-up/kube-up.sh +29 -49
  11. package/deploy/sema-up/lib/chart-run.sh +23 -0
  12. package/deploy/sema-up/lib/dataroot.sh +3 -3
  13. package/deploy/sema-up/lib/health.sh +62 -13
  14. package/deploy/sema-up/lib/helm-values-cluster.py +18 -0
  15. package/deploy/sema-up/lib/helm-values-kube.py +35 -0
  16. package/deploy/sema-up/lib/regcred.py +8 -0
  17. package/deploy/sema-up/lib/remote/helm-install.sh +3 -0
  18. package/deploy/sema-up/lib/remote/image-import.sh +6 -0
  19. package/deploy/sema-up/lib/remote/machine-precheck.sh +11 -0
  20. package/deploy/sema-up/lib/remote/region-probe.sh +3 -0
  21. package/deploy/sema-up/lib/remote/stack-ready.sh +26 -0
  22. package/deploy/sema-up/lib/remote/vxlan-guard.sh +8 -0
  23. package/deploy/sema-up/lib/render-stack.py +17 -0
  24. package/deploy/sema-up/lib/shell-text.sh +87 -0
  25. package/deploy/sema-up/lib/usage-flags.txt +10 -0
  26. package/deploy/sema-up/lib/usage-head.txt +1 -0
  27. package/deploy/sema-up/lib/usage-tail.txt +13 -0
  28. package/deploy/sema-up/preflight.sh +10 -8
  29. package/deploy/sema-up/sema-up.sh +14 -39
  30. package/deploy/sema-up/smoke.sh +7 -6
  31. package/deploy/sema-up/stack/compose.dataroot.yaml +3 -0
  32. package/deploy/sema-up/stack/compose.yaml +13 -1
  33. package/deploy/sema-up/stack/sema-stack-cluster.yaml +21 -0
  34. package/dist/adoption/plan.d.ts +24 -0
  35. package/dist/adoption/plan.js +53 -1
  36. package/dist/adoption/runner.d.ts +10 -1
  37. package/dist/adoption/runner.js +36 -16
  38. package/dist/adoption/wire.d.ts +3 -3
  39. package/dist/approval-card.d.ts +28 -30
  40. package/dist/approval-gate-currency.js +3 -2
  41. package/dist/approval-reconciler.d.ts +4 -13
  42. package/dist/approval-reconciler.js +2 -2
  43. package/dist/approval.d.ts +13 -11
  44. package/dist/approval.js +3 -3
  45. package/dist/audit.d.ts +10 -3
  46. package/dist/audit.js +15 -7
  47. package/dist/auth-bridge.d.ts +0 -14
  48. package/dist/auth-bridge.js +0 -7
  49. package/dist/auto-mode-face.d.ts +10 -7
  50. package/dist/auto-mode-face.js +7 -4
  51. package/dist/background-agent-name.d.ts +19 -1
  52. package/dist/background-agent-name.js +12 -2
  53. package/dist/background-session-reap.d.ts +1 -1
  54. package/dist/bake-runner/main.js +9 -6
  55. package/dist/bench/s1/arms.js +6 -5
  56. package/dist/bench/s1/live-deps.js +5 -2
  57. package/dist/bench/s1/run-firm.js +6 -5
  58. package/dist/bind-host.d.ts +25 -0
  59. package/dist/bind-host.js +25 -0
  60. package/dist/boot/adoption.d.ts +3 -0
  61. package/dist/boot/adoption.js +1 -0
  62. package/dist/boot/deployment-mods.d.ts +1 -1
  63. package/dist/boot/execution-env.d.ts +17 -7
  64. package/dist/boot/execution-env.js +37 -31
  65. package/dist/boot/exit-boundary.d.ts +2 -2
  66. package/dist/boot/exit-boundary.js +6 -5
  67. package/dist/boot/fatal-exit.d.ts +3 -5
  68. package/dist/boot/fatal-exit.js +2 -2
  69. package/dist/boot/leader.d.ts +15 -0
  70. package/dist/boot/leader.js +17 -15
  71. package/dist/boot/memory-consolidation.d.ts +37 -29
  72. package/dist/boot/memory-consolidation.js +11 -5
  73. package/dist/boot/org-memory.js +1 -1
  74. package/dist/boot/parked-revive-gate.js +2 -2
  75. package/dist/boot/reapers.d.ts +4 -3
  76. package/dist/boot/reapers.js +19 -16
  77. package/dist/boot/resolve-spec.d.ts +5 -3
  78. package/dist/boot/resolve-spec.js +55 -67
  79. package/dist/boot/retention-lane.d.ts +4 -4
  80. package/dist/boot/retention-lane.js +2 -2
  81. package/dist/boot/runner-deps.d.ts +28 -7
  82. package/dist/boot/runner-deps.js +11 -4
  83. package/dist/boot/runtime-caps.d.ts +2 -2
  84. package/dist/boot/runtime-caps.js +16 -2
  85. package/dist/boot/session-faces.d.ts +16 -7
  86. package/dist/boot/session-faces.js +114 -94
  87. package/dist/boot/shutdown.d.ts +5 -4
  88. package/dist/boot/shutdown.js +6 -4
  89. package/dist/boot/stage-01-config.js +9 -1
  90. package/dist/boot/stage-02-web-admin-pull.d.ts +1 -0
  91. package/dist/boot/stage-02-web-admin-pull.js +6 -1
  92. package/dist/boot/stage-03-store-backend.d.ts +3 -0
  93. package/dist/boot/stage-03-store-backend.js +4 -3
  94. package/dist/boot/stage-04-stores.d.ts +2 -0
  95. package/dist/boot/stage-04-stores.js +2 -2
  96. package/dist/boot/stage-05-execution-env.d.ts +7 -3
  97. package/dist/boot/stage-05-execution-env.js +2 -2
  98. package/dist/boot/stage-06-runners.d.ts +10 -12
  99. package/dist/boot/stage-06-runners.js +23 -15
  100. package/dist/boot/stage-07-capability-layer.d.ts +11 -8
  101. package/dist/boot/stage-07-capability-layer.js +5 -3
  102. package/dist/boot/stage-08-reapers.d.ts +11 -8
  103. package/dist/boot/stage-08-reapers.js +3 -3
  104. package/dist/boot/stage-09-leader.d.ts +12 -15
  105. package/dist/boot/stage-09-leader.js +12 -4
  106. package/dist/boot/stage-10-http-server.d.ts +12 -15
  107. package/dist/boot/stage-10-http-server.js +7 -4
  108. package/dist/boot/store-evidence.d.ts +20 -0
  109. package/dist/boot/store-evidence.js +13 -0
  110. package/dist/boot/stores.d.ts +3 -0
  111. package/dist/boot/stores.js +21 -10
  112. package/dist/boot/task-list-lane.d.ts +4 -4
  113. package/dist/boot/web-admin.d.ts +4 -2
  114. package/dist/boot/web-admin.js +55 -35
  115. package/dist/boot/webfetch-summarize-lane.d.ts +1 -1
  116. package/dist/boot-reclaim.d.ts +3 -1
  117. package/dist/boot-reclaim.js +1 -1
  118. package/dist/brain.d.ts +7 -18
  119. package/dist/brain.js +5 -17
  120. package/dist/budget.js +6 -6
  121. package/dist/capabilities/center-plugins.d.ts +7 -1
  122. package/dist/capabilities/center-plugins.js +32 -10
  123. package/dist/capabilities/center-wiring.js +1 -1
  124. package/dist/capabilities/composite-members.d.ts +2 -2
  125. package/dist/capabilities/composite-members.js +2 -2
  126. package/dist/capabilities/repo-tools.d.ts +2 -0
  127. package/dist/capabilities/repo-tools.js +14 -12
  128. package/dist/capabilities/scenarios.d.ts +6 -15
  129. package/dist/capabilities/scenarios.js +11 -16
  130. package/dist/capabilities/skills.d.ts +1 -1
  131. package/dist/capabilities/tool-defer.d.ts +1 -1
  132. package/dist/capability-facts.d.ts +38 -11
  133. package/dist/capability-facts.js +47 -8
  134. package/dist/card-void.d.ts +4 -4
  135. package/dist/card-void.js +1 -1
  136. package/dist/center-credential-renewer.d.ts +6 -2
  137. package/dist/center-credential-renewer.js +7 -3
  138. package/dist/config-catalog.d.ts +16 -1
  139. package/dist/config-catalog.js +62 -56
  140. package/dist/config-dir-trust.d.ts +37 -4
  141. package/dist/config-dir-trust.js +88 -44
  142. package/dist/config-invariants.d.ts +42 -3
  143. package/dist/config-invariants.js +69 -5
  144. package/dist/config-lkg.d.ts +23 -1
  145. package/dist/config-lkg.js +17 -3
  146. package/dist/config-provider.d.ts +9 -9
  147. package/dist/config-provider.js +25 -110
  148. package/dist/config-pull-failure.d.ts +50 -0
  149. package/dist/config-pull-failure.js +48 -0
  150. package/dist/config-types.d.ts +26 -17
  151. package/dist/config.d.ts +8 -16
  152. package/dist/config.js +113 -47
  153. package/dist/delegated-session-owner.d.ts +1 -1
  154. package/dist/deleted-session-ids.d.ts +3 -2
  155. package/dist/deployment-governance.d.ts +3 -3
  156. package/dist/deployment-shape.d.ts +30 -4
  157. package/dist/deployment-shape.js +7 -0
  158. package/dist/egress-redirect.d.ts +25 -7
  159. package/dist/egress-redirect.js +20 -2
  160. package/dist/elicitation.d.ts +6 -5
  161. package/dist/elicitation.js +23 -22
  162. package/dist/engine-identity.d.ts +28 -0
  163. package/dist/engine-identity.js +10 -0
  164. package/dist/entry-problems.d.ts +5 -7
  165. package/dist/entry-problems.js +1 -1
  166. package/dist/env-facts.js +2 -1
  167. package/dist/env-witness.d.ts +7 -0
  168. package/dist/env-witness.js +16 -0
  169. package/dist/execution-lane-caps.d.ts +5 -18
  170. package/dist/execution-lane-caps.js +0 -22
  171. package/dist/execution-placement.d.ts +58 -18
  172. package/dist/execution-placement.js +41 -2
  173. package/dist/field-conflict.d.ts +7 -11
  174. package/dist/field-conflict.js +3 -3
  175. package/dist/file-history-capture.d.ts +3 -3
  176. package/dist/file-history-disclosure.js +1 -0
  177. package/dist/fleet/fleet-bus.d.ts +21 -3
  178. package/dist/fleet/fleet-bus.js +35 -25
  179. package/dist/fleet/fleet-reconciler.js +2 -2
  180. package/dist/fleet/serving-lease.js +3 -3
  181. package/dist/fleet-client.js +3 -3
  182. package/dist/fleet-lease.d.ts +0 -1
  183. package/dist/fleet-lease.js +4 -5
  184. package/dist/history-anchor.d.ts +23 -3
  185. package/dist/history-anchor.js +24 -4
  186. package/dist/hitl-delivery.d.ts +90 -0
  187. package/dist/hitl-delivery.js +98 -0
  188. package/dist/hooks/classic-stations.d.ts +8 -11
  189. package/dist/hooks/classic-stations.js +0 -7
  190. package/dist/hooks/hook-llm.d.ts +5 -1
  191. package/dist/hooks/hook-llm.js +24 -15
  192. package/dist/hooks/hook-runner.d.ts +67 -57
  193. package/dist/hooks/hook-runner.js +260 -186
  194. package/dist/host-lsp-manager.d.ts +22 -8
  195. package/dist/host-lsp-manager.js +4 -1
  196. package/dist/http/active-run-conflict.d.ts +2 -43
  197. package/dist/http/active-run-conflict.js +3 -7
  198. package/dist/http/admission.d.ts +4 -18
  199. package/dist/http/admission.js +75 -78
  200. package/dist/http/approval-sweeps.d.ts +3 -3
  201. package/dist/http/approval-sweeps.js +54 -30
  202. package/dist/http/caller-trust.d.ts +8 -10
  203. package/dist/http/caller-trust.js +1 -2
  204. package/dist/http/claim-heartbeat.d.ts +49 -0
  205. package/dist/http/claim-heartbeat.js +46 -0
  206. package/dist/http/claimed-run.d.ts +4 -3
  207. package/dist/http/dispatch.d.ts +8 -1
  208. package/dist/http/dispatch.js +76 -30
  209. package/dist/http/durable-run-leg.d.ts +3 -3
  210. package/dist/http/durable-run-leg.js +17 -12
  211. package/dist/http/execution-context.d.ts +17 -43
  212. package/dist/http/execution-context.js +7 -5
  213. package/dist/http/health-reader.d.ts +36 -0
  214. package/dist/http/health-reader.js +21 -0
  215. package/dist/http/health-self-report.d.ts +9 -9
  216. package/dist/http/health-self-report.js +4 -4
  217. package/dist/http/idempotency.d.ts +9 -5
  218. package/dist/http/idempotency.js +4 -4
  219. package/dist/http/memory-compliance-failure-reply.d.ts +15 -16
  220. package/dist/http/memory-compliance-failure-reply.js +4 -2
  221. package/dist/http/memory-face-fault-reply.d.ts +67 -0
  222. package/dist/http/memory-face-fault-reply.js +71 -0
  223. package/dist/http/memory-store-refusal-reply.d.ts +1 -1
  224. package/dist/http/memory-store-refusal-reply.js +3 -0
  225. package/dist/http/owner-access.d.ts +391 -67
  226. package/dist/http/owner-access.js +371 -35
  227. package/dist/http/principal-gate.d.ts +24 -81
  228. package/dist/http/principal-gate.js +24 -68
  229. package/dist/http/refusal-body.d.ts +35 -2
  230. package/dist/http/refusal-body.js +34 -0
  231. package/dist/http/request-guards.d.ts +9 -13
  232. package/dist/http/request-guards.js +34 -68
  233. package/dist/http/resume-composition.d.ts +37 -0
  234. package/dist/http/resume-composition.js +18 -0
  235. package/dist/http/resume-ctx-read.d.ts +35 -12
  236. package/dist/http/resume-ctx-read.js +25 -6
  237. package/dist/http/resume-legs.d.ts +21 -18
  238. package/dist/http/resume-legs.js +189 -129
  239. package/dist/http/retired-skill-manifest.d.ts +1 -1
  240. package/dist/http/route-ctx.d.ts +25 -32
  241. package/dist/http/routes/a2a-serve.d.ts +43 -5
  242. package/dist/http/routes/a2a-serve.js +58 -37
  243. package/dist/http/routes/admin-config-refresh.js +2 -2
  244. package/dist/http/routes/admin-drain.js +2 -2
  245. package/dist/http/routes/admin-memory-optout.js +4 -3
  246. package/dist/http/routes/adoption.d.ts +3 -0
  247. package/dist/http/routes/adoption.js +17 -10
  248. package/dist/http/routes/agents-roster.js +13 -7
  249. package/dist/http/routes/approvals-assistant.js +70 -65
  250. package/dist/http/routes/attachments.js +2 -2
  251. package/dist/http/routes/background.d.ts +3 -3
  252. package/dist/http/routes/background.js +9 -17
  253. package/dist/http/routes/capabilities.js +15 -18
  254. package/dist/http/routes/config-catalog.js +2 -2
  255. package/dist/http/routes/devices.d.ts +3 -3
  256. package/dist/http/routes/devices.js +4 -4
  257. package/dist/http/routes/diagnostics.d.ts +27 -3
  258. package/dist/http/routes/diagnostics.js +27 -21
  259. package/dist/http/routes/engine.js +2 -2
  260. package/dist/http/routes/fleet.js +5 -3
  261. package/dist/http/routes/images.js +10 -6
  262. package/dist/http/routes/leader.d.ts +7 -2
  263. package/dist/http/routes/leader.js +12 -3
  264. package/dist/http/routes/mcp-reconnect.d.ts +1 -1
  265. package/dist/http/routes/mcp-reconnect.js +7 -15
  266. package/dist/http/routes/memory-bundle.js +4 -7
  267. package/dist/http/routes/memory-compliance.js +4 -4
  268. package/dist/http/routes/memory-consolidation.js +6 -9
  269. package/dist/http/routes/memory-origin.d.ts +2 -0
  270. package/dist/http/routes/memory-origin.js +7 -8
  271. package/dist/http/routes/memory-policy.js +17 -12
  272. package/dist/http/routes/notify-wake.js +10 -19
  273. package/dist/http/routes/observability.js +3 -3
  274. package/dist/http/routes/principal-inbox.d.ts +1 -1
  275. package/dist/http/routes/principal-inbox.js +2 -2
  276. package/dist/http/routes/projects.d.ts +1 -1
  277. package/dist/http/routes/projects.js +3 -2
  278. package/dist/http/routes/retention-ops.js +6 -9
  279. package/dist/http/routes/rules.js +20 -5
  280. package/dist/http/routes/run-memory-capture.d.ts +2 -2
  281. package/dist/http/routes/run-memory-capture.js +6 -12
  282. package/dist/http/routes/run-permission-mode.d.ts +2 -2
  283. package/dist/http/routes/run-permission-mode.js +10 -17
  284. package/dist/http/routes/runs.js +146 -231
  285. package/dist/http/routes/session-memory-sync.d.ts +2 -2
  286. package/dist/http/routes/session-memory-sync.js +7 -13
  287. package/dist/http/routes/session-sync.d.ts +4 -2
  288. package/dist/http/routes/session-sync.js +21 -20
  289. package/dist/http/routes/sessions-list.d.ts +3 -3
  290. package/dist/http/routes/sessions-list.js +9 -9
  291. package/dist/http/routes/sessions.js +87 -124
  292. package/dist/http/routes/shared-memory.js +6 -6
  293. package/dist/http/routes/side-query.js +2 -2
  294. package/dist/http/routes/tasks.js +136 -120
  295. package/dist/http/routes/trace-usage.d.ts +0 -12
  296. package/dist/http/routes/trace-usage.js +40 -46
  297. package/dist/http/routes/workflows.d.ts +39 -4
  298. package/dist/http/routes/workflows.js +42 -14
  299. package/dist/http/run-concurrency-cap.d.ts +20 -12
  300. package/dist/http/run-concurrency-cap.js +39 -26
  301. package/dist/http/run-read-face.d.ts +3 -5
  302. package/dist/http/run-read-face.js +8 -13
  303. package/dist/http/send.d.ts +12 -3
  304. package/dist/http/send.js +42 -6
  305. package/dist/http/server.d.ts +39 -40
  306. package/dist/http/server.js +36 -11
  307. package/dist/http/sse-log.d.ts +17 -10
  308. package/dist/http/sse-log.js +7 -7
  309. package/dist/http/stored-body-replay.d.ts +12 -0
  310. package/dist/http/stored-body-replay.js +2 -2
  311. package/dist/http/submit-ctx.d.ts +16 -8
  312. package/dist/http/submit-ctx.js +6 -2
  313. package/dist/http/submit-replay.d.ts +19 -6
  314. package/dist/http/submit-replay.js +18 -6
  315. package/dist/http/sync-submit-body.d.ts +3 -4
  316. package/dist/http/sync-submit-body.js +4 -5
  317. package/dist/http/wire-types.d.ts +4 -3
  318. package/dist/identity-source.d.ts +36 -5
  319. package/dist/identity-source.js +27 -0
  320. package/dist/index.d.ts +1 -0
  321. package/dist/index.js +1 -0
  322. package/dist/key-resolver.d.ts +32 -0
  323. package/dist/key-resolver.js +23 -9
  324. package/dist/leader/diffup.js +2 -1
  325. package/dist/leader/endpoint.d.ts +26 -5
  326. package/dist/leader/endpoint.js +154 -14
  327. package/dist/leader/fanout.d.ts +3 -0
  328. package/dist/leader/fanout.js +78 -63
  329. package/dist/leader/leader.d.ts +16 -0
  330. package/dist/leader/leader.js +43 -3
  331. package/dist/leader/merge.d.ts +9 -1
  332. package/dist/leader/merge.js +16 -1
  333. package/dist/leader/repair-wire.js +1 -1
  334. package/dist/leader/wire.d.ts +36 -3
  335. package/dist/leader/wire.js +59 -18
  336. package/dist/lsp-evict.d.ts +6 -4
  337. package/dist/lsp-evict.js +2 -3
  338. package/dist/memory-operator-faces.d.ts +5 -4
  339. package/dist/memory-operator-faces.js +1 -1
  340. package/dist/memory-scope.d.ts +29 -2
  341. package/dist/memory-scope.js +64 -15
  342. package/dist/memory-store-refusal.d.ts +5 -2
  343. package/dist/memory-sync-client.d.ts +3 -2
  344. package/dist/memory-sync-client.js +6 -3
  345. package/dist/model-compat.d.ts +17 -8
  346. package/dist/model-compat.js +6 -2
  347. package/dist/model-context-window.d.ts +18 -0
  348. package/dist/model-context-window.js +2 -0
  349. package/dist/model-entry-headers.d.ts +46 -4
  350. package/dist/model-entry-headers.js +2 -2
  351. package/dist/model-entry-refusal.d.ts +35 -16
  352. package/dist/model-entry-refusal.js +40 -27
  353. package/dist/model-plane-face.d.ts +19 -11
  354. package/dist/model-plane-face.js +9 -1
  355. package/dist/model-plane-probe.d.ts +2 -0
  356. package/dist/model-plane-probe.js +17 -0
  357. package/dist/model-provider.d.ts +3 -3
  358. package/dist/model-route-endpoint.d.ts +9 -5
  359. package/dist/model-route-endpoint.js +29 -7
  360. package/dist/model-select.d.ts +16 -0
  361. package/dist/model-select.js +4 -0
  362. package/dist/mountinfo.d.ts +37 -0
  363. package/dist/mountinfo.js +47 -0
  364. package/dist/namespaced-rule-name.d.ts +23 -14
  365. package/dist/namespaced-rule-name.js +8 -11
  366. package/dist/net-address.d.ts +1 -1
  367. package/dist/observability/corrupt-read-seat.d.ts +4 -4
  368. package/dist/observability/corrupt-read-seat.js +5 -3
  369. package/dist/observability/fail-open.d.ts +58 -38
  370. package/dist/observability/fail-open.js +60 -38
  371. package/dist/observability/logger.d.ts +22 -1
  372. package/dist/observability/logger.js +89 -12
  373. package/dist/observability/metrics.js +3 -4
  374. package/dist/observability/otel-exporter.js +2 -1
  375. package/dist/observability/principal-context.d.ts +14 -7
  376. package/dist/observability/principal-context.js +8 -3
  377. package/dist/observability/run-terminal.d.ts +7 -1
  378. package/dist/observability/run-terminal.js +5 -2
  379. package/dist/orchestration/hardened-vm-runner.d.ts +1 -0
  380. package/dist/orchestration/hardened-vm-runner.js +11 -5
  381. package/dist/orchestration/hardened-vm-worker-runner.d.ts +0 -14
  382. package/dist/orchestration/hardened-vm-worker-runner.js +5 -0
  383. package/dist/orchestration/hardened-vm-worker.js +2 -1
  384. package/dist/orchestration/workflow-completion-inbox.d.ts +3 -3
  385. package/dist/orchestration/workflow-completion-inbox.js +3 -2
  386. package/dist/org-delivery-gate.d.ts +5 -4
  387. package/dist/org-delivery-gate.js +7 -6
  388. package/dist/outbound-dispatcher.d.ts +1 -1
  389. package/dist/outbound-dispatcher.js +6 -12
  390. package/dist/owner-brands.d.ts +81 -0
  391. package/dist/owner-brands.js +42 -0
  392. package/dist/owner-faces.d.ts +531 -0
  393. package/dist/owner-faces.js +126 -0
  394. package/dist/parked-decide.d.ts +67 -5
  395. package/dist/parked-decide.js +127 -5
  396. package/dist/parked-revive-surface.d.ts +14 -4
  397. package/dist/parked-revive-surface.js +5 -4
  398. package/dist/peer-directory.d.ts +6 -8
  399. package/dist/peer-directory.js +3 -2
  400. package/dist/permission-rule-vocab.d.ts +53 -8
  401. package/dist/permission-rule-vocab.js +30 -2
  402. package/dist/plugins/adoption-log-sql.d.ts +0 -22
  403. package/dist/plugins/adoption-log-sql.js +5 -3
  404. package/dist/plugins/approval-ask-retired-delete-by-task-m50.d.ts +7 -0
  405. package/dist/plugins/approval-ask-retired-delete-by-task-m50.js +17 -0
  406. package/dist/plugins/approval-ask-store-file.d.ts +18 -7
  407. package/dist/plugins/approval-ask-store-file.js +37 -14
  408. package/dist/plugins/approval-ask-store-memory.d.ts +12 -4
  409. package/dist/plugins/approval-ask-store-memory.js +24 -10
  410. package/dist/plugins/approval-ask-store-sql.d.ts +39 -20
  411. package/dist/plugins/approval-ask-store-sql.js +41 -10
  412. package/dist/plugins/approval-exemption-skill-m46.d.ts +20 -0
  413. package/dist/plugins/approval-exemption-skill-m46.js +25 -0
  414. package/dist/plugins/approval-exemption-store.d.ts +6 -1
  415. package/dist/plugins/approval-exemption-store.js +14 -0
  416. package/dist/plugins/approval-nonce-store.d.ts +39 -12
  417. package/dist/plugins/approval-nonce-store.js +72 -23
  418. package/dist/plugins/blob-backend.d.ts +2 -0
  419. package/dist/plugins/blob-backend.js +9 -6
  420. package/dist/plugins/caching-session-store.d.ts +13 -1
  421. package/dist/plugins/caching-session-store.js +43 -4
  422. package/dist/plugins/checkpoint-index-columns.d.ts +32 -5
  423. package/dist/plugins/checkpoint-index-columns.js +36 -1
  424. package/dist/plugins/checkpoint-store-face.d.ts +83 -10
  425. package/dist/plugins/checkpoint-store-face.js +18 -1
  426. package/dist/plugins/device-store-sql.js +1 -0
  427. package/dist/plugins/ensure-index.d.ts +13 -1
  428. package/dist/plugins/ensure-index.js +154 -21
  429. package/dist/plugins/ensure-schema-lock-policy.d.ts +0 -15
  430. package/dist/plugins/ensure-schema-lock-policy.js +3 -2
  431. package/dist/plugins/file-run-store.d.ts +63 -23
  432. package/dist/plugins/file-run-store.js +138 -83
  433. package/dist/plugins/host-platform.d.ts +24 -3
  434. package/dist/plugins/host-platform.js +15 -1
  435. package/dist/plugins/image-bake-store-sql.js +2 -0
  436. package/dist/plugins/imported-layer-root-retirement.d.ts +2 -2
  437. package/dist/plugins/k8s-pod-reaper.d.ts +1 -3
  438. package/dist/plugins/k8s-pod-reaper.js +0 -1
  439. package/dist/plugins/leader-run-store-sql.d.ts +22 -0
  440. package/dist/plugins/leader-run-store-sql.js +34 -4
  441. package/dist/plugins/local-checkpoint-store.d.ts +58 -23
  442. package/dist/plugins/local-checkpoint-store.js +195 -76
  443. package/dist/plugins/local-data-dir-modes-m39.js +2 -1
  444. package/dist/plugins/local-docker-capacity.d.ts +93 -0
  445. package/dist/plugins/local-docker-capacity.js +194 -0
  446. package/dist/plugins/local-docker-reaper.d.ts +92 -0
  447. package/dist/plugins/local-docker-reaper.js +102 -0
  448. package/dist/plugins/local-engine-high-water.d.ts +4 -2
  449. package/dist/plugins/local-engine-high-water.js +4 -1
  450. package/dist/plugins/local-session-store.d.ts +358 -125
  451. package/dist/plugins/local-session-store.js +824 -251
  452. package/dist/plugins/local-session-window.d.ts +3 -2
  453. package/dist/plugins/local-session-window.js +3 -2
  454. package/dist/plugins/local-sidecar-quarantine.js +3 -2
  455. package/dist/plugins/local-task-attachment-store.d.ts +18 -1
  456. package/dist/plugins/local-task-attachment-store.js +22 -1
  457. package/dist/plugins/memory-embedder.js +9 -7
  458. package/dist/plugins/memory-engine-pg.d.ts +3 -2
  459. package/dist/plugins/memory-engine-pg.js +14 -5
  460. package/dist/plugins/memory-engine-sql-apply.d.ts +8 -4
  461. package/dist/plugins/memory-engine-sql-apply.js +6 -8
  462. package/dist/plugins/memory-engine-tidb.d.ts +4 -2
  463. package/dist/plugins/memory-engine-tidb.js +11 -2
  464. package/dist/plugins/memory-optout-grant-store-sql.d.ts +1 -1
  465. package/dist/plugins/memory-optout-grant-store-sql.js +3 -3
  466. package/dist/plugins/memory-run-store.d.ts +39 -27
  467. package/dist/plugins/memory-run-store.js +72 -70
  468. package/dist/plugins/one-time-migration-marker.d.ts +10 -0
  469. package/dist/plugins/one-time-migration-marker.js +7 -0
  470. package/dist/plugins/one-time-migrations.d.ts +186 -45
  471. package/dist/plugins/one-time-migrations.js +442 -119
  472. package/dist/plugins/org-delivery-quota-store.js +2 -1
  473. package/dist/plugins/permission-rule-store-file.d.ts +3 -3
  474. package/dist/plugins/permission-rule-store-sql.d.ts +4 -63
  475. package/dist/plugins/permission-rule-store-sql.js +6 -86
  476. package/dist/plugins/pg-pool.d.ts +1 -31
  477. package/dist/plugins/pg-pool.js +16 -7
  478. package/dist/plugins/remote-env-e2b.d.ts +7 -25
  479. package/dist/plugins/remote-env-e2b.js +34 -25
  480. package/dist/plugins/remote-env-host.d.ts +2 -9
  481. package/dist/plugins/remote-env-host.js +34 -22
  482. package/dist/plugins/remote-env-k8s.d.ts +40 -45
  483. package/dist/plugins/remote-env-k8s.js +107 -58
  484. package/dist/plugins/remote-env-local-docker.d.ts +148 -14
  485. package/dist/plugins/remote-env-local-docker.js +367 -72
  486. package/dist/plugins/remote-scratchpad.js +4 -0
  487. package/dist/plugins/retention-deployment.d.ts +49 -17
  488. package/dist/plugins/retention-deployment.js +39 -8
  489. package/dist/plugins/run-preview-m45.d.ts +11 -0
  490. package/dist/plugins/run-preview-m45.js +19 -0
  491. package/dist/plugins/run-store-sql.d.ts +56 -68
  492. package/dist/plugins/run-store-sql.js +127 -116
  493. package/dist/plugins/s3-answer.d.ts +2 -1
  494. package/dist/plugins/sandbox-reaper.d.ts +26 -0
  495. package/dist/plugins/sandbox-reaper.js +2 -0
  496. package/dist/plugins/scenario-prefix-switch-m42.d.ts +54 -0
  497. package/dist/plugins/scenario-prefix-switch-m42.js +55 -0
  498. package/dist/plugins/scheduler-support.d.ts +16 -1
  499. package/dist/plugins/scheduler-support.js +22 -2
  500. package/dist/plugins/schema-consistency.d.ts +42 -9
  501. package/dist/plugins/schema-consistency.js +212 -11
  502. package/dist/plugins/schema-drift-sentence.d.ts +4 -1
  503. package/dist/plugins/schema-drift-sentence.js +4 -4
  504. package/dist/plugins/schema-ensure-legs.d.ts +9 -0
  505. package/dist/plugins/schema-ensure-legs.js +1 -1
  506. package/dist/plugins/schema-indexes.js +3 -0
  507. package/dist/plugins/schema-live-columns.d.ts +14 -5
  508. package/dist/plugins/schema-live-columns.js +10 -10
  509. package/dist/plugins/send-user-file.js +2 -1
  510. package/dist/plugins/session-birth.d.ts +37 -0
  511. package/dist/plugins/session-birth.js +38 -0
  512. package/dist/plugins/session-epoch-anchor.d.ts +40 -12
  513. package/dist/plugins/session-epoch-anchor.js +33 -11
  514. package/dist/plugins/session-ext-table.d.ts +27 -3
  515. package/dist/plugins/session-ext-table.js +19 -6
  516. package/dist/plugins/session-fork.d.ts +15 -1
  517. package/dist/plugins/session-fork.js +3 -0
  518. package/dist/plugins/session-ownership.d.ts +1 -1
  519. package/dist/plugins/session-placement.d.ts +22 -16
  520. package/dist/plugins/session-placement.js +15 -12
  521. package/dist/plugins/session-row-sql.d.ts +12 -0
  522. package/dist/plugins/session-row-sql.js +3 -3
  523. package/dist/plugins/session-run-rollup.d.ts +29 -0
  524. package/dist/plugins/session-run-rollup.js +40 -0
  525. package/dist/plugins/session-store-sql.d.ts +38 -12
  526. package/dist/plugins/session-store-sql.js +130 -30
  527. package/dist/plugins/session-withdraw-sql.d.ts +36 -0
  528. package/dist/plugins/session-withdraw-sql.js +42 -0
  529. package/dist/plugins/shared-memory-store-sql.d.ts +0 -69
  530. package/dist/plugins/shared-memory-store-sql.js +2 -1
  531. package/dist/plugins/shell-sentinel-owner-m48.d.ts +20 -0
  532. package/dist/plugins/shell-sentinel-owner-m48.js +3 -0
  533. package/dist/plugins/snapshot-bucket-presence.d.ts +2 -1
  534. package/dist/plugins/sql-driver.d.ts +1 -1
  535. package/dist/plugins/sql-driver.js +2 -1
  536. package/dist/plugins/sql-errors.d.ts +32 -5
  537. package/dist/plugins/sql-errors.js +55 -7
  538. package/dist/plugins/sql-json-column.d.ts +8 -7
  539. package/dist/plugins/sql-json-column.js +10 -6
  540. package/dist/plugins/store-backend.d.ts +84 -15
  541. package/dist/plugins/store-backend.js +186 -55
  542. package/dist/plugins/store-contracts.d.ts +90 -30
  543. package/dist/plugins/store-contracts.js +22 -1
  544. package/dist/plugins/store-fault.d.ts +28 -2
  545. package/dist/plugins/store-fault.js +20 -2
  546. package/dist/plugins/task-attachment-store.d.ts +15 -3
  547. package/dist/plugins/task-attachment-store.js +22 -9
  548. package/dist/plugins/tidb-pool.js +23 -8
  549. package/dist/plugins/web-search.js +5 -3
  550. package/dist/plugins/workflow-run-store-sql.d.ts +6 -1
  551. package/dist/plugins/workflow-run-store-sql.js +11 -5
  552. package/dist/principal-jwt.d.ts +4 -4
  553. package/dist/principal-jwt.js +20 -5
  554. package/dist/principal-shape.d.ts +41 -0
  555. package/dist/principal-shape.js +19 -0
  556. package/dist/question.d.ts +13 -23
  557. package/dist/question.js +21 -39
  558. package/dist/request-declaration-refusal.d.ts +35 -12
  559. package/dist/request-declaration-refusal.js +21 -9
  560. package/dist/request-form.d.ts +58 -0
  561. package/dist/request-form.js +72 -0
  562. package/dist/request-image-urls.d.ts +8 -2
  563. package/dist/request-image-urls.js +2 -1
  564. package/dist/request-images.d.ts +20 -0
  565. package/dist/request-images.js +59 -0
  566. package/dist/request-key-closure.d.ts +6 -7
  567. package/dist/request-key-closure.js +15 -2
  568. package/dist/resource-suspend.d.ts +7 -16
  569. package/dist/resource-suspend.js +1 -1
  570. package/dist/retired-name-host-notice.d.ts +21 -0
  571. package/dist/retired-name-host-notice.js +12 -0
  572. package/dist/rule-entry-list.d.ts +2 -2
  573. package/dist/rule-entry-list.js +3 -4
  574. package/dist/rule-issue-reading.d.ts +58 -0
  575. package/dist/rule-issue-reading.js +14 -0
  576. package/dist/rules-consent.d.ts +5 -3
  577. package/dist/rules-consent.js +1 -0
  578. package/dist/run-acceptance.d.ts +3 -1
  579. package/dist/run-acceptance.js +3 -0
  580. package/dist/run-local.d.ts +14 -6
  581. package/dist/run-local.js +92 -80
  582. package/dist/run-stale-default.d.ts +7 -0
  583. package/dist/run-stale-default.js +2 -0
  584. package/dist/runs.d.ts +26 -15
  585. package/dist/runs.js +39 -27
  586. package/dist/runtime-caps-resolver.d.ts +21 -6
  587. package/dist/runtime-caps-resolver.js +17 -4
  588. package/dist/runtime-governance.d.ts +2 -2
  589. package/dist/runtime-governance.js +5 -3
  590. package/dist/sealed-key-layout.d.ts +12 -5
  591. package/dist/sealed-key-layout.js +5 -0
  592. package/dist/sealed-key.d.ts +12 -2
  593. package/dist/sealed-key.js +115 -27
  594. package/dist/security.d.ts +128 -158
  595. package/dist/security.js +163 -59
  596. package/dist/sema-config-dir.d.ts +20 -0
  597. package/dist/sema-config-dir.js +25 -0
  598. package/dist/server-secret-env.d.ts +21 -5
  599. package/dist/server-secret-env.js +14 -4
  600. package/dist/session-children-retire.d.ts +7 -5
  601. package/dist/session-children-retire.js +7 -2
  602. package/dist/session-deletion.d.ts +88 -0
  603. package/dist/session-deletion.js +8 -0
  604. package/dist/session-erase.d.ts +145 -0
  605. package/dist/session-erase.js +115 -0
  606. package/dist/session-error-wire.d.ts +5 -5
  607. package/dist/session-error-wire.js +1 -1
  608. package/dist/session-incarnation.d.ts +52 -5
  609. package/dist/session-incarnation.js +19 -2
  610. package/dist/session-policy-wire.d.ts +6 -3
  611. package/dist/session-policy-wire.js +11 -1
  612. package/dist/session-resident-background.d.ts +0 -71
  613. package/dist/session-resident-background.js +4 -3
  614. package/dist/session-row.d.ts +2 -1
  615. package/dist/session-rules-seat.d.ts +12 -0
  616. package/dist/session-rules-seat.js +19 -0
  617. package/dist/session-titler.d.ts +7 -15
  618. package/dist/session-titler.js +1 -1
  619. package/dist/spec-fields.d.ts +57 -3
  620. package/dist/spec-fields.js +72 -51
  621. package/dist/store-posture.d.ts +136 -20
  622. package/dist/store-posture.js +188 -3
  623. package/dist/stored-request-hooks-m20.js +2 -2
  624. package/dist/stores-sql/background-agent-store-sql.d.ts +11 -2
  625. package/dist/stores-sql/background-agent-store-sql.js +73 -20
  626. package/dist/stores-sql/checkpoint-store-sql.d.ts +33 -28
  627. package/dist/stores-sql/checkpoint-store-sql.js +75 -44
  628. package/dist/stores-sql/mailbox-store-sql.d.ts +7 -4
  629. package/dist/stores-sql/mailbox-store-sql.js +31 -32
  630. package/dist/stores-sql/pg-session-storage.d.ts +7 -5
  631. package/dist/stores-sql/pg-session-storage.js +54 -46
  632. package/dist/stores-sql/retention-store-sql.d.ts +87 -19
  633. package/dist/stores-sql/retention-store-sql.js +92 -27
  634. package/dist/stores-sql/session-policy-store-sql.d.ts +32 -10
  635. package/dist/stores-sql/session-policy-store-sql.js +44 -36
  636. package/dist/stores-sql/session-write-hooks.d.ts +12 -6
  637. package/dist/stores-sql/tidb-session-storage.d.ts +4 -4
  638. package/dist/stores-sql/tidb-session-storage.js +13 -8
  639. package/dist/stores-sql/tidb-session-store.d.ts +36 -17
  640. package/dist/stores-sql/tidb-session-store.js +69 -39
  641. package/dist/stores-sql/windowed-session-storage.d.ts +5 -0
  642. package/dist/stores-sql/windowed-session-storage.js +9 -0
  643. package/dist/submission-exit.d.ts +50 -0
  644. package/dist/submission-exit.js +108 -0
  645. package/dist/task-a2a.d.ts +1 -1
  646. package/dist/task-a2a.js +3 -3
  647. package/dist/task-cwd.d.ts +20 -0
  648. package/dist/task-cwd.js +8 -0
  649. package/dist/task-mcp.d.ts +1 -1
  650. package/dist/task-mcp.js +3 -3
  651. package/dist/task-settings.d.ts +14 -10
  652. package/dist/task-settings.js +18 -7
  653. package/dist/terminal.d.ts +25 -43
  654. package/dist/terminal.js +31 -11
  655. package/dist/tool-approval.d.ts +131 -129
  656. package/dist/tool-approval.js +189 -193
  657. package/dist/trace/core-keyset-guard.d.ts +13 -6
  658. package/dist/trace/core-vocab-wire.d.ts +95 -0
  659. package/dist/trace/core-vocab-wire.js +15 -0
  660. package/dist/trace/exit-seat.d.ts +30 -4
  661. package/dist/trace/exit-seat.js +40 -36
  662. package/dist/trace/extension-call-face.d.ts +3 -2
  663. package/dist/trace/extension-call-face.js +3 -1
  664. package/dist/trace/ledger-events.d.ts +4 -7
  665. package/dist/trace/ledger-sink.d.ts +1 -30
  666. package/dist/trace/ledger-sink.js +0 -11
  667. package/dist/trace/model-segment.d.ts +5 -5
  668. package/dist/trace/model-segment.js +5 -5
  669. package/dist/trace/project.d.ts +55 -42
  670. package/dist/trace/project.js +52 -19
  671. package/dist/trace/redact.d.ts +123 -27
  672. package/dist/trace/redact.js +880 -260
  673. package/dist/trace/self-minted-wire.d.ts +487 -19
  674. package/dist/trace/self-minted-wire.js +172 -23
  675. package/dist/trace/wire-projection-faces.d.ts +5 -6
  676. package/dist/trace/wire-projection-faces.js +2 -2
  677. package/dist/upstream-body.d.ts +23 -0
  678. package/dist/upstream-body.js +16 -0
  679. package/dist/url-refusal.d.ts +3 -3
  680. package/dist/url-refusal.js +11 -4
  681. package/dist/user-authored-text.d.ts +1 -1
  682. package/dist/user-input-ledger.d.ts +7 -8
  683. package/dist/user-input-ledger.js +1 -1
  684. package/dist/web-admin-client/apply-effective.d.ts +6 -3
  685. package/dist/web-admin-client/apply-effective.js +13 -16
  686. package/dist/web-admin-client/apply-ledger.d.ts +16 -7
  687. package/dist/web-admin-client/apply-ledger.js +5 -2
  688. package/dist/web-admin-client/center-request.d.ts +2 -2
  689. package/dist/web-admin-client/center-request.js +15 -15
  690. package/dist/web-admin-client/effective-keys.d.ts +1 -1
  691. package/dist/web-admin-client/effective-keys.js +1 -1
  692. package/dist/web-admin-client/entry-metadata.d.ts +8 -0
  693. package/dist/web-admin-client/entry-metadata.js +13 -0
  694. package/dist/web-admin-client/http-client.d.ts +1 -1
  695. package/dist/web-admin-client/http-client.js +23 -4
  696. package/dist/web-admin-client/mcp-revocation.d.ts +1 -1
  697. package/dist/web-admin-client/mcp-revocation.js +2 -1
  698. package/dist/web-admin-client/read-warnings.d.ts +1 -0
  699. package/dist/web-admin-client/read-warnings.js +1 -0
  700. package/dist/web-admin-client/restart-signal.js +8 -4
  701. package/dist/web-admin-client/skills-mcp.d.ts +2 -2
  702. package/dist/web-admin-client/types.d.ts +1 -2
  703. package/dist/workspace-space.d.ts +3 -2
  704. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +4 -4
  705. package/package.json +6 -3
  706. package/scripts/drain-check-local.mjs +118 -147
  707. package/scripts/drain-check.mysql.sql +22 -2
  708. package/scripts/drain-check.pg.sql +22 -2
  709. package/wire-changes/server@7.148.0.json +1517 -0
  710. package/dist/http/memory-control-plane-corrupt-reply.d.ts +0 -25
  711. package/dist/http/memory-control-plane-corrupt-reply.js +0 -19
  712. package/dist/http/memory-layer-reply.d.ts +0 -30
  713. package/dist/http/memory-layer-reply.js +0 -24
  714. package/dist/lsp/e2b-bridge.d.ts +0 -57
  715. package/dist/lsp/e2b-bridge.js +0 -139
  716. package/dist/lsp/e2b-manager.d.ts +0 -93
  717. package/dist/lsp/e2b-manager.js +0 -178
  718. package/dist/lsp/lsp-frames.d.ts +0 -14
  719. package/dist/lsp/lsp-frames.js +0 -25
  720. package/dist/lsp/manager.d.ts +0 -129
  721. package/dist/lsp/manager.js +0 -127
  722. package/dist/lsp/types.d.ts +0 -12
  723. package/dist/lsp/types.js +0 -2
  724. package/dist/lsp/ws-transport.d.ts +0 -40
  725. package/dist/lsp/ws-transport.js +0 -210
@@ -1,11 +1,10 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { createHostLspManager } from "../host-lsp-manager.js";
3
+ import { createLspManager } from "../host-lsp-manager.js";
4
4
  import { TaskEnvRegistry } from "../capabilities/sandbox-file-send.js";
5
5
  import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
6
6
  import { SessionEnvironmentSelection } from "../capabilities/select-environment-tool.js";
7
7
  import { sandboxEnvNamesInForce } from "../config.js";
8
- import { createE2bLspManager } from "../lsp/e2b-manager.js";
9
8
  import { evictLspOnDestroy } from "../lsp-evict.js";
10
9
  import { PerTaskImageRegistry } from "../per-task-image.js";
11
10
  import { adbExecutionEnvFactory } from "../plugins/remote-env-adb.js";
@@ -17,10 +16,12 @@ import { boundedStoreCall, checkSandboxEgressPolicy, createSandboxPodApi, create
17
16
  import { podSpecPatchBrokerRefusal, SANDBOX_SECRET_SEAT_VERBS } from "../plugins/k8s-exec-protocol.js";
18
17
  import { createSandboxBrokerSeatOf, createSandboxGitPlaneSeat, sandboxGitPlanePremisesOf } from "../sandbox-git-plane.js";
19
18
  import { createSandboxPodReaper } from "../plugins/k8s-pod-reaper.js";
19
+ import { createLocalDockerReaper } from "../plugins/local-docker-reaper.js";
20
20
  import { recordFailOpen } from "../observability/fail-open.js";
21
21
  import { createRunWorkspaceSnapshotSeat } from "../fleet/workspace-snapshot-residual.js";
22
22
  import { createSpaceCommitFence } from "../workspace-space-commit.js";
23
23
  import { localDockerExecutionEnvFactory } from "../plugins/remote-env-local-docker.js";
24
+ import { createLocalDockerCapacity, localDockerWorkerLabelOf } from "../plugins/local-docker-capacity.js";
24
25
  import { sshExecutionEnvFactory } from "../plugins/remote-env-ssh.js";
25
26
  import { withRemoteScratchpad } from "../plugins/remote-scratchpad.js";
26
27
  import { FileSchedulerBackend, defaultSchedulerStorePath } from "../plugins/scheduler-support.js";
@@ -38,7 +39,7 @@ import { workspaceSnapshotTimeoutOf } from "../workspace-space.js";
38
39
  import { sayEgressPolicyReading } from "../sandbox-egress-policy.js";
39
40
  import { sandboxPathEnvSlots, withSandboxPathEnvSlot } from "./deferred-sandbox-path-env.js";
40
41
  import { createLaneHomeAbsenceReporter } from "../lane-home-probe.js";
41
- import { buildLaneHomeBootNote, buildLaneHomeClaim, capabilitiesFor, executionLaneOf, laneBindsReads, laneIsolated, laneSandboxReadFloorState } from "../execution-lane-caps.js";
42
+ import { buildLaneHomeBootNote, buildLaneHomeClaim, capabilitiesFor, laneIsolated, laneSandboxReadFloorState } from "../execution-lane-caps.js";
42
43
  import { warnReadDenyFloorUnkept } from "./execution-lane.js";
43
44
  import { seatText } from "../trace/exit-seat.js";
44
45
  import { countSessionResidentBackground } from "../session-resident-background.js";
@@ -65,11 +66,13 @@ export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
65
66
  const perSessionShellEnv = new Map();
66
67
  const perSessionInheritEnv = new Map();
67
68
  const owners = new Map();
69
+ const occupants = new Map();
68
70
  const dropSession = (sid) => {
69
71
  perSessionCwd.delete(sid);
70
72
  perSessionShellEnv.delete(sid);
71
73
  perSessionInheritEnv.delete(sid);
72
74
  owners.delete(sid);
75
+ occupants.delete(sid);
73
76
  };
74
77
  const touch = (sid, owner) => {
75
78
  const next = owner === undefined ? (owners.has(sid) ? owners.get(sid) : null) : owner;
@@ -99,8 +102,14 @@ export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
99
102
  perSessionInheritEnv.set(sid, policy);
100
103
  touch(sid, undefined);
101
104
  },
102
- fenceSessionOwner: (sid, owner) => {
103
- if (owners.has(sid) && owners.get(sid) !== owner) {
105
+ fenceSessionOwner: (sid, owner, incarnation) => {
106
+ const ownerChanged = owners.has(sid) && owners.get(sid) !== owner;
107
+ const occupantChanged = incarnation !== undefined && occupants.has(sid) && occupants.get(sid) !== incarnation;
108
+ if (incarnation === undefined)
109
+ occupants.delete(sid);
110
+ else
111
+ occupants.set(sid, incarnation);
112
+ if (ownerChanged || occupantChanged) {
104
113
  perSessionCwd.delete(sid);
105
114
  perSessionShellEnv.delete(sid);
106
115
  perSessionInheritEnv.delete(sid);
@@ -108,6 +117,12 @@ export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
108
117
  touch(sid, owner);
109
118
  },
110
119
  dropSession,
120
+ dropSessionOf: (sid, incarnation) => {
121
+ if (occupants.get(sid) !== incarnation)
122
+ return false;
123
+ dropSession(sid);
124
+ return true;
125
+ },
111
126
  };
112
127
  }
113
128
  export function ownsItsWorkspace(ctx) {
@@ -238,10 +253,14 @@ export function createExecutionEnv(ctx) {
238
253
  const { perSessionCwd, setSessionCwd } = sessionScoped;
239
254
  const { perSessionShellEnv, setSessionShellEnv } = sessionScoped;
240
255
  const { perSessionInheritEnv, setSessionInheritEnv } = sessionScoped;
256
+ const lspManager = createLspManager(config, (event, fields) => logger.info(event, fields));
257
+ if (lspManager)
258
+ logger.info("lsp_enabled", { provider: config.remoteExec.provider });
241
259
  let executionEnvFactory;
242
260
  let spaceReclaimer;
243
261
  let sandboxSecretSeatGate;
244
- let sandboxPodReaper;
262
+ let sandboxReaper;
263
+ let sandboxCapacity;
245
264
  let sandboxGitPlane = createSandboxGitPlaneSeat((r) => sandboxGitPlanePremisesOf(config, r), {});
246
265
  let worktreeReap;
247
266
  const workspaceFillOf = taskAttachmentStore === undefined ? undefined : (fctx) => createWorkspaceFill({ store: taskAttachmentStore, sessionId: fctx.sessionId, seeds: ownsItsWorkspace(fctx), logger });
@@ -299,7 +318,7 @@ export function createExecutionEnv(ctx) {
299
318
  if (k8sCfg.cache !== undefined || k8sCfg.s3Snapshot !== undefined)
300
319
  spaceReclaimer = createSpaceReclaimer(k8sCfg);
301
320
  sandboxSecretSeatGate = () => ensureSandboxSecretSeat(k8sCfg, logger, undefined, () => readSandboxSecretSeat(k8sCfg, "env"));
302
- sandboxPodReaper = createSandboxPodReaper({ api: createSandboxPodApi(k8sCfg), logger, metrics });
321
+ sandboxReaper = createSandboxPodReaper({ api: createSandboxPodApi(k8sCfg), logger, metrics });
303
322
  void checkSandboxEgressPolicy(k8sCfg)
304
323
  .then((gaps) => sayEgressPolicyReading(gaps, logger, k8sCfg.namespace))
305
324
  .catch((e) => logger.error("sandbox_egress_policy_check_crashed", { error: seatText("operator-log-text", e instanceof Error ? e.message : String(e)), effect: "the sandbox egress self-check did not complete this boot — the lane runs; the egress policy was not read" }));
@@ -347,6 +366,7 @@ export function createExecutionEnv(ctx) {
347
366
  ? new FileSchedulerBackend({
348
367
  storePath: schedulerStorePath,
349
368
  log: logger,
369
+ trust: { declaredOwnerUid: config.configLocalOwnerUid },
350
370
  ...(config.schedulerSessionWakeup === false || config.schedulerSessionLifetime === false
351
371
  ? {
352
372
  caps: {
@@ -383,8 +403,11 @@ export function createExecutionEnv(ctx) {
383
403
  }
384
404
  }
385
405
  else if (config.remoteExec.provider === "local-docker") {
386
- executionEnvFactory = localDockerExecutionEnvFactory({
406
+ const workerLabel = localDockerWorkerLabelOf(config.localDataRoot);
407
+ sandboxCapacity = config.remoteExec.capacity !== undefined ? createLocalDockerCapacity(config.remoteExec.capacity, { label: workerLabel, logger }) : undefined;
408
+ const localDockerFactory = localDockerExecutionEnvFactory({
387
409
  image: config.remoteExec.image,
410
+ workerLabel,
388
411
  ...(config.remoteExec.mountPath ? { mountPath: config.remoteExec.mountPath } : {}),
389
412
  ...homeDirSeat, ...homeAbsentNotice,
390
413
  ...(config.remoteExec.dockerPath ? { dockerPath: config.remoteExec.dockerPath } : {}),
@@ -398,8 +421,11 @@ export function createExecutionEnv(ctx) {
398
421
  ...(config.remoteExec.env ? { env: config.remoteExec.env } : {}),
399
422
  sandboxReadFloor: config.sandboxReadFloor,
400
423
  ...(workspaceFillOf !== undefined ? { workspaceFillOf } : {}),
424
+ ...(sandboxCapacity !== undefined ? { capacity: sandboxCapacity } : {}),
401
425
  logger,
402
426
  }, ctx.laneDeps?.localDocker);
427
+ executionEnvFactory = localDockerFactory;
428
+ sandboxReaper = createLocalDockerReaper({ port: localDockerFactory.reapPort, logger, metrics, ...(ctx.laneDeps?.localDockerReapNow !== undefined ? { now: ctx.laneDeps.localDockerReapNow } : {}) });
403
429
  }
404
430
  if (executionEnvFactory && DEPLOYMENT_SHAPE_PREDICATES.remoteScratchpad.holds(config)) {
405
431
  executionEnvFactory = withRemoteScratchpad(executionEnvFactory, logger);
@@ -476,28 +502,6 @@ export function createExecutionEnv(ctx) {
476
502
  logger.info("task_inherit_env_honored", { honored: taskInheritEnvRefusal(config) === undefined });
477
503
  }
478
504
  warnReadDenyFloorUnkept(config, logger);
479
- const lspProvider = config.remoteExec.provider;
480
- const lspLane = executionLaneOf(lspProvider);
481
- const lspLaneBindsReads = lspLane !== undefined && laneBindsReads(lspLane);
482
- if ((lspProvider === "e2b" || lspProvider === "k8s") && config.lspEnabled && !lspLaneBindsReads) {
483
- logger.warn("lsp_not_mounted", {
484
- provider: lspProvider,
485
- reason: "LSP_ENABLED is set, but this lane's execution environment cannot bind a read to the file that was checked (openBound), so every language-server file sync would be refused; the LSP tool is not mounted on this lane in this version",
486
- });
487
- }
488
- const lspManager = (lspProvider === "e2b" || lspProvider === "k8s") && config.lspEnabled && lspLaneBindsReads
489
- ? createE2bLspManager({
490
- log: (event, fields) => logger.info(event, fields),
491
- scheme: lspProvider === "k8s" ? "ws" : "wss",
492
- provider: lspProvider,
493
- metrics,
494
- })
495
- :
496
- lspProvider === "host" && config.lspHostEnabled && config.requirePrincipal !== true && lspLaneBindsReads
497
- ? createHostLspManager(config, (event, fields) => logger.info(event, fields))
498
- : undefined;
499
- if (lspManager)
500
- logger.info("lsp_enabled", { provider: lspProvider });
501
505
  const unreadableReported = new Set();
502
506
  let stallReapFailureReported = false;
503
507
  const stallMs = config.backgroundAgentStallMs;
@@ -533,8 +537,10 @@ export function createExecutionEnv(ctx) {
533
537
  perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv,
534
538
  fenceSessionOwner: sessionScoped.fenceSessionOwner,
535
539
  dropSessionScoped: sessionScoped.dropSession,
540
+ dropSessionScopedOf: sessionScoped.dropSessionOf,
536
541
  sessionResidentBackground,
537
- executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxPodReaper, sandboxGitPlane,
542
+ executionEnvFactory, worktreeReap, sendUserFileTaskEnvs, lspManager, spaceReclaimer, sandboxSecretSeatGate, sandboxReaper, sandboxGitPlane,
543
+ sandboxCapacity,
538
544
  };
539
545
  }
540
546
  //# sourceMappingURL=execution-env.js.map
@@ -24,7 +24,7 @@
24
24
  * 不是退出边界)。
25
25
  */
26
26
  import { type TaskRegistry } from "@sema-agent/core";
27
- import type { Logger } from "../observability/logger.js";
27
+ import { type Logger } from "../observability/logger.js";
28
28
  /**
29
29
  * 退出边界的硬收面**此刻**会收掉的后台 shell 行数(`background_bash` + `monitor`,在跑,整张进程级注册表,retain 行按
30
30
  * {@link PROCESS_EXIT_INCLUDES_RETAINED} 跳过)—— 「引擎现在退,会不会把一条在跑的后台 shell 一起收掉」这一问的**唯一**读法。
@@ -37,7 +37,7 @@ import type { Logger } from "../observability/logger.js";
37
37
  *
38
38
  * 读不出(core:某行 env 的 retain 声明读抛 ⇒ 计数抛)⇒ 按 **1** 计并经 `onUnreadable` 报出 —— 读不出 ⇒ 非空闲,与驻留项同一条律;
39
39
  * 本函数在租约拍(定时器回调)、`/health` 与交接口里被调,**不许抛**(定时器里一抛就是 uncaught,一台交接出去的引擎会因此崩掉并收掉它本该留着的 shell)——
40
- * 报口自己再抛(抛出物转不成文本之类)也一样:落 `console.error`(不回同一只报口),读数照返 1。
40
+ * 报口自己再抛(抛出物转不成文本之类)也一样:落日志出口接缝的文本出口 `writeLogText`(不回同一只报口),读数照返 1。
41
41
  * `registry` 只供测试换桩(只用到 `countRunningBackgroundShells`)。
42
42
  */
43
43
  export declare function countShellsExitWouldKill(opts: {
@@ -1,5 +1,6 @@
1
1
  import { defaultTaskRegistry } from "@sema-agent/core";
2
2
  import { reportHardKillReceipts } from "../background-session-reap.js";
3
+ import { writeLogText } from "../observability/logger.js";
3
4
  import { liveHostForegroundChildCount, reapHostForegroundChildren } from "../plugins/host-platform.js";
4
5
  import { liveEphemeralHostWorkspaceCount, reapEphemeralHostWorkspaces } from "../plugins/host-workspace-registry.js";
5
6
  import { seatText } from "../trace/exit-seat.js";
@@ -14,7 +15,7 @@ export function countShellsExitWouldKill(opts) {
14
15
  opts.onUnreadable(err);
15
16
  }
16
17
  catch (reportErr) {
17
- console.error("engine_handover_shell_count_report_threw", reportErr);
18
+ writeLogText("stderr", "engine_handover_shell_count_report_threw", reportErr);
18
19
  }
19
20
  return 1;
20
21
  }
@@ -70,19 +71,19 @@ export function installProcessExitBoundary({ logger }) {
70
71
  reapOwnChildProcesses();
71
72
  }
72
73
  catch (err) {
73
- console.error("shutdown_exit_boundary_child_reap_threw", err);
74
+ writeLogText("stderr", "shutdown_exit_boundary_child_reap_threw", err);
74
75
  }
75
76
  try {
76
77
  reapBackgroundHard();
77
78
  }
78
79
  catch (err) {
79
- console.error("shutdown_exit_boundary_background_hard_kill_threw", err);
80
+ writeLogText("stderr", "shutdown_exit_boundary_background_hard_kill_threw", err);
80
81
  }
81
82
  try {
82
83
  reapOwnHostWorkspaces();
83
84
  }
84
85
  catch (err) {
85
- console.error("shutdown_exit_boundary_workspace_reap_threw", err);
86
+ writeLogText("stderr", "shutdown_exit_boundary_workspace_reap_threw", err);
86
87
  }
87
88
  const left = { foregroundChildren: liveHostForegroundChildCount(), hostWorkspaces: liveEphemeralHostWorkspaceCount() };
88
89
  try {
@@ -91,7 +92,7 @@ export function installProcessExitBoundary({ logger }) {
91
92
  logger.warn("shutdown_exit_boundary_incomplete", left);
92
93
  }
93
94
  catch (err) {
94
- console.error("shutdown_exit_boundary_log_threw", err);
95
+ writeLogText("stderr", "shutdown_exit_boundary_log_threw", err);
95
96
  }
96
97
  };
97
98
  process.once("exit", onProcessExit);
@@ -18,12 +18,10 @@ export declare function buildFatalErrorText(err: unknown): string;
18
18
  * ── 修 ─────────────────────────────────────────────────────────────────────────────────────────
19
19
  * **同一只产物**再原样多行写一份到 stderr。刻意不做的三件:不铸第二份文案(两份措辞必然分叉)、不加
20
20
  * pretty 旋钮(一个只有出错时才走的出口不该有配置面)、JSON 行**照旧**(机读面零回退,scraper 不动)。
21
- * 两个面都在 stderr,次序=先机器行后人读段。**这个次序还承重**:`createLogger()` 的构造会装上 stdio 的
22
- * EPIPE 无害化监听(见 `observability/logger.ts` 那段注 —— 宿主把 stderr 接管道又先退时,下一次写会发一个
23
- * 异步 `'error'`,无监听即致命),所以那条裸 `process.stderr.write` **必须**排在它之后;同步抛由下面的
24
- * `try/finally` 兜住。
21
+ * 两个面都在 stderr,次序=先机器行后人读段;两个面都经日志出口接缝(`observability/logger.ts`:同一只秘密形筛、同一只
22
+ * 物理写,EPIPE 无害化监听由接缝在每次写之前装好),同步抛由下面的 `try/finally` 兜住。
25
23
  *
26
- * 全仓两个 fatal 出口(`main.ts` 的 `main().catch` 与 `run-local.ts` 的同名尾巴)都经这里 —— 后者此前
24
+ * 全仓三个 fatal 出口(`main.ts` 的 `main().catch`、起服前探针 `model-plane-probe.ts` 的同名尾巴与 `run-local.ts` 的那一只)都经这里 —— run-local 此前
27
25
  * 连形状律都没过(裸 `String(err)`),两处各写一遍正是「同类不同命」的土壤。
28
26
  */
29
27
  export declare function fatalExit(err: unknown): never;
@@ -1,5 +1,5 @@
1
1
  import { redactSecrets } from "../trace/redact.js";
2
- import { createLogger } from "../observability/logger.js";
2
+ import { createLogger, writeLogText } from "../observability/logger.js";
3
3
  export function buildFatalErrorText(err) {
4
4
  const code = err instanceof Error ? err.code : undefined;
5
5
  return redactSecrets(typeof code === "string" && err instanceof Error ? `${err.name} [${code}]: ${err.message}` : String(err));
@@ -8,7 +8,7 @@ export function fatalExit(err) {
8
8
  const text = buildFatalErrorText(err);
9
9
  try {
10
10
  createLogger().error("fatal", { err: text });
11
- process.stderr.write(text + "\n");
11
+ writeLogText("stderr", text);
12
12
  }
13
13
  finally {
14
14
  process.exit(1);
@@ -81,5 +81,20 @@ export declare function leaderK8sMinioGap(leaderEnabled: boolean, leaderProvider
81
81
  * 而承担的方式是重复的真实推送。
82
82
  */
83
83
  export declare function assertLeaderDurableStore(leaderEnabled: boolean, hasLeaderRunStore: boolean): void;
84
+ /**
85
+ * leader 的对象存储座(F2(a) 工厂模式的 diff-out:worker 自传补丁到 `<桶>/leader-diff/…`,leader 用同桶的 presigned GET 取回)。纯数据:三键齐(`MINIO_ENDPOINT` /
86
+ * `MINIO_ACCESS_KEY` / `MINIO_SECRET_KEY`)⇒ `{ s3 }`,否则 `{}`(静态兼容模式;k8s 车道要它)。
87
+ * 桶 = `MINIO_BUCKET`,缺席 = 工作区快照桶的**缺省名**(`WORKSPACE_SNAPSHOT_BUCKET_DEFAULT`,同一只常量)。两根旋钮各自独立:改了 `WORKSPACE_SNAPSHOT_BUCKET` 的部署,
88
+ * leader 的补丁仍落 `MINIO_BUCKET` 那一只 —— 要同桶就两根同设(目录两行写明)。
89
+ */
90
+ export declare function buildLeaderObjectStore(env?: NodeJS.ProcessEnv): {
91
+ readonly s3?: {
92
+ endpoint: string;
93
+ bucket: string;
94
+ accessKey: string;
95
+ secretKey: string;
96
+ region?: string;
97
+ };
98
+ };
84
99
  export declare function createLeaderFace(ctx: LeaderCtx): ReturnType<typeof createLeaderEndpoint> | undefined;
85
100
  //# sourceMappingURL=leader.d.ts.map
@@ -1,8 +1,10 @@
1
1
  import { createLeaderEndpoint } from "../leader/endpoint.js";
2
- import { createLeaderRunVisibility } from "../http/owner-access.js";
3
- import { createLeaderRunner } from "../leader/wire.js";
4
- import { buildDeploymentPostureSeats } from "./runner-deps.js";
2
+ import { seesRunAs } from "../http/owner-access.js";
3
+ import { claimCallerOf } from "../security.js";
4
+ import { createLeaderParkExpirer, createLeaderRunner } from "../leader/wire.js";
5
+ import { buildDeploymentPostureSeats, buildHandsBand } from "./runner-deps.js";
5
6
  import { hasApprovalListIntent } from "../approval.js";
7
+ import { WORKSPACE_SNAPSHOT_BUCKET_DEFAULT } from "../object-store-buckets.js";
6
8
  export function leaderK8sMinioGap(leaderEnabled, leaderProvider, hasS3) {
7
9
  if (!(leaderEnabled && leaderProvider === "k8s" && !hasS3))
8
10
  return null;
@@ -21,19 +23,17 @@ export function assertLeaderDurableStore(leaderEnabled, hasLeaderRunStore) {
21
23
  "without it a retry starts a SECOND real git push. Fix the database (or unset LEADER_ENABLED) and restart " +
22
24
  "(#193 车4 件2 capability gate; the DB_BACKEND literal check in config.ts is the intent half of the same rule)");
23
25
  }
26
+ export function buildLeaderObjectStore(env = process.env) {
27
+ const endpoint = env.MINIO_ENDPOINT;
28
+ const accessKey = env.MINIO_ACCESS_KEY;
29
+ const secretKey = env.MINIO_SECRET_KEY;
30
+ if (!endpoint || !accessKey || !secretKey)
31
+ return {};
32
+ return { s3: { endpoint, bucket: env.MINIO_BUCKET ?? WORKSPACE_SNAPSHOT_BUCKET_DEFAULT, accessKey, secretKey, ...(env.MINIO_REGION ? { region: env.MINIO_REGION } : {}) } };
33
+ }
24
34
  export function createLeaderFace(ctx) {
25
35
  const { config, logger, brain, pricing, executionEnvFactory, toolResultStore, sessionStore, checkpointStore, checkpointCtxSealing, governanceSeams } = ctx;
26
- const leaderMinio = process.env.MINIO_ENDPOINT && process.env.MINIO_ACCESS_KEY && process.env.MINIO_SECRET_KEY
27
- ? {
28
- s3: {
29
- endpoint: process.env.MINIO_ENDPOINT,
30
- bucket: process.env.MINIO_BUCKET ?? "workspaces",
31
- accessKey: process.env.MINIO_ACCESS_KEY,
32
- secretKey: process.env.MINIO_SECRET_KEY,
33
- ...(process.env.MINIO_REGION ? { region: process.env.MINIO_REGION } : {}),
34
- },
35
- }
36
- : {};
36
+ const leaderMinio = buildLeaderObjectStore();
37
37
  const leaderProvider = config.remoteExec.provider;
38
38
  const leaderRunStore = ctx.backend?.leaderRun?.();
39
39
  assertLeaderDurableStore(config.leaderEnabled, leaderRunStore !== undefined);
@@ -60,6 +60,7 @@ export function createLeaderFace(ctx) {
60
60
  ...(ctx.promptSource ? { promptSource: ctx.promptSource } : {}),
61
61
  ...(ctx.onError ? { onError: ctx.onError } : {}),
62
62
  mods: ctx.deploymentMods,
63
+ hands: buildHandsBand(config, undefined),
63
64
  fanoutEnabled: config.leaderFanoutEnabled,
64
65
  ...(process.env.MODEL_ROUTER_ID ? { routerModel: process.env.MODEL_ROUTER_ID } : {}),
65
66
  ...(leaderProvider === "e2b" ? { e2bApiKey: config.remoteExec.apiKey } : {}),
@@ -87,7 +88,8 @@ export function createLeaderFace(ctx) {
87
88
  logger,
88
89
  requiredFields: ["objective", "durableRemote", "testCmd", "seedCmd", "baseSha"],
89
90
  ...(leaderRunStore ? { store: leaderRunStore } : {}),
90
- ownerVisible: createLeaderRunVisibility(config),
91
+ ownerVisible: (subject, owner) => seesRunAs("run.leader", claimCallerOf(subject ?? undefined, config), owner ?? null),
92
+ ...(checkpointStore ? { expireWorkerParks: createLeaderParkExpirer(checkpointStore) } : {}),
91
93
  })
92
94
  : undefined;
93
95
  if (leaderEndpoint)
@@ -55,6 +55,8 @@ export type ConsolidationSeatBilling = {
55
55
  readonly kind: "unresolvable";
56
56
  readonly fault: string;
57
57
  };
58
+ /** 整理席解座的输入 = core 解析器的输入(凭据席除外 —— 由本函数按冻结的钥匙表铸)+ 部署的两张 per-model 钥匙表(与 `models` 同一代,同一刻读)。 */
59
+ export type ConsolidationSeatDeps = Omit<MemoryConsolidationDriverDeps, "getApiKeyAndHeaders"> & Pick<ServiceConfig, "modelApiKeyEnv" | "modelApiKeys">;
58
60
  /** 座解析的产物:core 的 options 原样 + 给投影用的两位自证。 */
59
61
  export interface ConsolidationDriverSeat {
60
62
  /** `runMemoryConsolidationDriver` 第三参的**模型席那一半**,core 的 `resolveMemoryConsolidationDriver` 原样产出(写判官另由操作面的座给)。 */
@@ -81,7 +83,7 @@ export interface ConsolidationDriverSeat {
81
83
  * 体内的注 —— 那里才是它真正生效的地方,写在这里会随实现漂。
82
84
  * (探针只构造闭包、不发任何请求、无副作用。)
83
85
  */
84
- export declare function resolveConsolidationDriverSeat(deps: MemoryConsolidationDriverDeps): ConsolidationDriverSeat;
86
+ export declare function resolveConsolidationDriverSeat(input: ConsolidationSeatDeps): ConsolidationDriverSeat;
85
87
  /**
86
88
  * [ref] 波 0([ref] §3)—— 整理驱动席的 **restart 读数**。过渡件:**波 1 转热后删**(那时每轮 run 起手
87
89
  * 现取当前代的席,不再有 boot 烤死的席,这只表也就没有要比的东西了)。
@@ -117,6 +119,8 @@ export interface ConsolidationSeatWatch {
117
119
  }
118
120
  /** 解席的输入面 = boot 期真席用的同三件(活引用:refresh 就地换代,`read()` 每次现取)。 */
119
121
  export type ConsolidationSeatPlane = Pick<MemoryConsolidationDriverDeps, "models" | "tiers" | "roles">;
122
+ /** 重启读数的输入面 = 解席三件 + 座随之冻结的两张钥匙表(座位指纹带凭据身份)。 */
123
+ export type ConsolidationSeatWeldPlane = ConsolidationSeatPlane & Pick<ServiceConfig, "modelApiKeyEnv" | "modelApiKeys">;
120
124
  /**
121
125
  * **每 scope 单飞**(codex 交叉复审 [high],验真后修)—— 同一 scope 上在飞的那一轮被后来者**并入**,
122
126
  * 而不是各起一轮。`create*`:返回带状态的活对象。
@@ -258,7 +262,7 @@ export declare function resolveConsolidationValve(input: {
258
262
  export declare function createConsolidationValveWatch(input: {
259
263
  driver: MemoryConsolidationDriverConfig;
260
264
  unwirable: Parameters<typeof resolveConsolidationValve>[0]["unwirable"];
261
- plane: () => ConsolidationSeatPlane;
265
+ plane: () => ConsolidationSeatWeldPlane;
262
266
  }): ConsolidationSeatWatch | undefined;
263
267
  /**
264
268
  * 阀门的**装配点**(车PI 修复轮 ⑦(a)(e):boot 第 4 段调它,测试调同一只 —— 不在测试里手抄接线)。`create*`:产出带行为的 watch。
@@ -279,7 +283,7 @@ export declare function createConsolidationValve(input: ConsolidationValveInput
279
283
  };
280
284
  /** 阀门判决的两件输入(装配点与纯判共用一只形 —— 两个入口递的是同一组事实)。 */
281
285
  export interface ConsolidationValveInput {
282
- readonly config: Pick<ServiceConfig, "memoryConsolidationDriver" | "memoryEngineBackend" | "memoryProvenance" | "compliancePosture" | "models" | "tiers" | "roles">;
286
+ readonly config: Pick<ServiceConfig, "memoryConsolidationDriver" | "memoryEngineBackend" | "memoryProvenance" | "compliancePosture" | "models" | "tiers" | "roles" | "modelApiKeyEnv" | "modelApiKeys">;
283
287
  /** 只读两件:在不在(记忆引擎接没接线)、整理状态随不随后端走(引擎的 `memoryGovernanceDurability` 答)。 */
284
288
  readonly memoryEngine: {
285
289
  readonly backend: MemoryBackend;
@@ -403,35 +407,37 @@ export declare function assertAutoConsolidationWirable(input: {
403
407
  * 「这条路径能不能写」在引擎里只有**一只**判官(合成写判官:技能拒行 / 收窄折叠 / 调用方与继承策略 / 人的持久规则车道 / 组织车道,一条走法一个优先序)。
404
408
  * 引擎的自动整理腿(有腿:名册上的 `Write` 脸、引擎盖的豁免根、人的持久规则读者)与本腿(运维手动阀门:没有腿)用的是**同一个构造器** ——
405
409
  * 同样的行给同样的答案,本仓不手搭第二只({@link createOperatorValveWriteJudge} 恰一处调用它,见 `test/memory-consolidation-write-judge.test.ts` ⑥)。
410
+ * 判官**按次铸**:每一次真跑(单飞里起跑的那一次,并入的等待者不另铸)现铸一只,所以人读的是发起这一轮的那位。
406
411
  *
407
- * ## 本仓供的两个部署事实(其余键一律缺席,缺席的语义见引擎:那一层不存在)
412
+ * ## 本仓供的部署事实(其余键一律缺席,缺席的语义见引擎:那一层不存在)
408
413
  *
409
414
  * · `ruleStoreProvider` = 部署唯一的那只合成规则店(`RunnerDeps.permissionRuleStore` 的同一个变量,装配第 4 段铸一次)。规则店没装配 ⇒ 缺席 ⇒ 没有规则层。
415
+ * · 人(`principal` / `localOwnerDeclared`)= **发起这一轮的调用方**:带主体 ⇒ 读那个主体的桶;不带主体 ⇒ 读本机属主的桶,当且仅当部署声明了它
416
+ * (`localOwnerDeclared` = Runner 下发的 `localOwnerRules` 同一只判据 `localOwnerRulesDeclared` 的答案;多租形不声明 ⇒ 匿名地板,而多租形的阀门口本来就要主体)。
417
+ * 整理 run 按 scope 单飞、可续跑:并入正在跑的那一轮的调用方用起跑者的判官(它们拿到的是同一份收执);续跑一条 pending run 的那一次,发起者就是这一次的调用方。
410
418
  * · `anchors.home` = `executionLaneHomeDir(config)` —— `~/` 行的基,与引擎执行环境的 `homeDir` 座、下单 422 门、规则基 `taskHome` 是**同一只函数**
411
419
  * (车道没有自己的 home 时诚实缺席;缺席 ⇒ 引擎读到人持有的 `~/` 收紧行时无处锚定 = 按异议处置,拒闭)。**刻意不另调 `os.homedir()`**:
412
- * 那会在非 host 车道上造出第二个读法 —— 阀门答「可解析」而腿内答「读不出」。⚠️ 今天这一键在生产座上**空转**:阀门不带主体(下面的 `principal`),
413
- * 引擎读匿名地板、不读任何人的持久行,「`~/` 行无锚 ⇒ 拒闭」走不到;留着它是为了主体有了来源之后不必再回来改这里。
414
- *
415
- * ## 刻意缺席的键(披露,不是遗漏)—— 三层没喂,所以这条腿仍是**响亮的放行座**(P-DEBT,见 {@link createOperatorValveWriteJudge})
416
- *
417
- * · `principal` / `localOwnerDeclared`(人的持久规则层):阀门是 operator 面的一次调用,本仓没有一个能回答「这个库属于谁」的来源 ——
418
- * 单用户 + file 后端(阀门结构上能起的唯一形,见 {@link assertConsolidationDriverWirable})里记忆是部署级全局层 / 任务根散列的项目层,principal 标签从不分盘,
419
- * 本仓也从不声明 `localOwnerRules`;整理 run 又是按 scope 单飞、可续跑的持久作业,「谁的规则」对并入 / 续跑的调用方没有定义。
420
- * · `callerPolicy`(部署的调用方策略层):`APPROVAL_REQUIRE` / `APPROVAL_DENY` / `AUTONOMY` / 敏感路径守卫集是**每任务现合成**的(`deployment-governance.ts`,
421
- * 读热可改的活配置,「禁 memoize」),没有部署级单例;boot 期铸一份喂进来就是冻结一份会过期的策略(收紧不生效 = 静默放行)。喂它需要一份设计:取哪几层、
422
- * 活配置怎么读、审批席取什么形;其中敏感路径层还要引擎的豁免根(`RunnerDeps.memoryEngineDir` 盖在每个请求上),而宿主构造器的输入没有这一位 —— 要向 core 请托,
423
- * 不在本层造第二条豁免根的读法。
424
- * · `anchors.root`:阀门按 scope 跑,手里没有项目根 —— 项目层 scope 键是任务根的单向散列(`project-identity.ts` 的 `repo:<sha256[:24]>`),反推不出根;
425
- * 全局层根本没有根。⇒ 人持有的相对 deny / ask 行无处锚定 = 异议,拒闭(引擎契约:判官不猜一行原本指向哪里)。
420
+ * 那会在非 host 车道上造出第二个读法 —— 阀门答「可解析」而腿内答「读不出」。
421
+ *
422
+ * ## 刻意缺席的键(披露,不是遗漏)—— 这两样没喂,所以这条腿仍记一笔债(P-DEBT,见 {@link createOperatorValveWriteJudge})
426
423
  *
427
- * 所以今天这条腿的放行范围与 7.128.x 相同(人的规则、部署的审批名单 / 敏感路径守卫都拦不住手动阀门这一轮折叠);变的只是「判官不再是代答」—— 往后每喂一层,
428
- * 只在本函数加键,钉 = `test/memory-consolidation-write-judge.test.ts` ⑦。
424
+ * · `callerPolicy`(部署的调用方策略层):腿上它是任务的整条部署治理链(审批名单 + 敏感路径守卫与誊本门 + 命令策略,经 `createDeploymentGovernanceInputs` /
425
+ * `createApprovalBaselinePolicy` / `applyRuntimeGovernance` 同一组构造口铸)。只喂其中一层(例如只喂审批名单)= 这条腿上半条治理链 —— 构造口的每个消费者都要挂
426
+ * 部署旋钮矩阵的一条腿、背齐全部旋钮(`test/operator-knob-client-posture-matrix.test.ts` 的消费腿对账),半条链背不齐。整条链喂进来又卡在敏感路径守卫:
427
+ * 腿上的守卫靠引擎盖在每个请求上的豁免根(`RunnerDeps.memoryEngineDir`)放过记忆库自己的写,宿主构造器的输入没有这一位 —— 不带豁免根喂进去会把库里的写当守卫目标拒掉
428
+ * (与腿不同答);在本层另造一条豁免根的读法是第二个写者。⇒ 等引擎的宿主输入收这一位,再整条喂、挂矩阵腿。
429
+ * · `anchors.root`:阀门按 scope 跑,手里没有项目根 —— 项目层 scope 键是任务根的单向散列(`project-identity.ts` 的 `repo:<sha256[:24]>`),反推不出根;
430
+ * 全局层根本没有根。⇒ 人持有的相对 deny / ask 行无处锚定 = 异议,拒闭(引擎契约:判官不猜一行原本指向哪里)。这一格没有来源,永久缺席。
429
431
  *
430
432
  * 自动整理腿不受影响:它走引擎腿自己的判官,人的持久规则与部署策略照判。
431
433
  */
432
434
  export declare function createOperatorValveJudgeInput(facts: {
433
435
  /** 部署唯一的合成规则店(装配第 4 段铸一次,`RunnerDeps.permissionRuleStore` 与本座读同一只)。缺席 = 规则店没装配。 */
434
436
  readonly ruleStoreProvider: PermissionRuleStoreProvider | undefined;
437
+ /** 部署是否声明本机属主的规则桶(`boot/runner-deps.ts` 的 `localOwnerRulesDeclared` —— Runner 下发 `localOwnerRules` 的同一只判据)。 */
438
+ readonly localOwnerDeclared: boolean;
439
+ /** 发起这一轮的调用方(阀门口的已验主体;不带主体 = `undefined`)。 */
440
+ readonly initiator: string | undefined;
435
441
  /** 只读 `executionLaneHomeDir` 读的两位(`ServiceConfig` 结构满足)。 */
436
442
  readonly config: LaneHomeDeployment;
437
443
  }): ConsolidationWriteJudgeInput;
@@ -439,10 +445,10 @@ export declare function createOperatorValveJudgeInput(facts: {
439
445
  * 运维阀门腿的写判官座:引擎的判官构造器喂 {@link createOperatorValveJudgeInput},**外加一个响亮的债计数**(P-DEBT)。
440
446
  *
441
447
  * 构造器只有引擎那一只,本函数不判任何东西:`judge(target)` 的答案原样返回。它只在每次被问时记一次
442
- * `server.memory-consolidation.operator-valve-layers-unfed`(计数 + 探针行 + 一次性告警)—— 因为人的规则层、部署策略层、项目根三样都没喂
443
- * ({@link createOperatorValveJudgeInput} 头注),放行的最坏后果没变:运维手动整理时,一条点名记忆库路径的人的持久规则或部署写策略拦不住这一轮折叠
444
- * (与 7.128.x 逐字同)。债在遥测里显形,而不是随着「判官已换成引擎的」这句话消失。自动整理腿不受影响,走引擎腿自己的判官。
445
- * 收口 = 三层各自有了来源(人:「读谁的桶」裁定;策略:设计 + 引擎的豁免根入参;根:无来源则永久缺席并改写本债)那一版,本 tag 删。
448
+ * `server.memory-consolidation.operator-valve-layers-unfed`(计数 + 探针行 + 一次性告警)—— 人已喂;没喂的是部署的调用方策略层
449
+ * (整条治理链等引擎的宿主输入收豁免根)与项目根(没有来源)({@link createOperatorValveJudgeInput} 头注)。放行的最坏后果:运维手动整理时,
450
+ * 部署的写策略(例如 `APPROVAL_DENY=Write`、点名记忆库路径的敏感路径守卫)拦不住这一轮折叠;人的 deny 行拦得住,人持有的相对行照旧拒闭。
451
+ * 自动整理腿不受影响,走引擎腿自己的判官。收口 = 引擎的宿主输入收豁免根、整条部署治理链喂上并挂矩阵腿那一版,本 tag 删(项目根改写成永久缺席的披露)。
446
452
  */
447
453
  export declare function createOperatorValveWriteJudge(facts: Parameters<typeof createOperatorValveJudgeInput>[0]): ConsolidationWriteJudge;
448
454
  /** 两个 admin 口消费的窄能力面(`ServiceDeps.memoryConsolidation` 的实参来源)。 */
@@ -454,8 +460,9 @@ export interface MemoryConsolidationFaces {
454
460
  /** 配置表的 scope(`MEMORY_CONSOLIDATION_SCOPES`)。恰好一条时是两个口的**唯一**缺省。 */
455
461
  readonly scopes: readonly string[];
456
462
  /** 跑(或**续跑**)一轮。core 的 run 行是持久的:同一 scope 上有 pending run 时本调用 CONTINUE 它
457
- * (同一 plan 缓存、同一 force requestId、零新 mint)—— 所以这一口对**重试安全**。 */
458
- run(scope: string): Promise<ConsolidationRunReceipt>;
463
+ * (同一 plan 缓存、同一 force requestId、零新 mint)—— 所以这一口对**重试安全**。
464
+ * `initiator` = 发起这一次的调用方(已验主体;不带主体 = `undefined`):写判官按它读人的规则桶;并入正在跑的那一轮的调用方用起跑者的判官。 */
465
+ run(scope: string, initiator: string | undefined): Promise<ConsolidationRunReceipt>;
459
466
  /** 该 scope 最近一次 driver run 的账(`undefined` = 从没跑过 —— 诚实缺席,不编一个空壳)。core 7.63.0([ref])起经引擎的治理店座读、异步。 */
460
467
  lastRun(scope: string): Promise<ConsolidationDriverRunRow | undefined>;
461
468
  }
@@ -496,9 +503,10 @@ export declare function createMemoryConsolidationFaces(stores: MemoryScopeStores
496
503
  /** 停因自由文本的**运维日志**座(缺席 = 没人听,不影响任何行为)。载荷由 {@link buildStopDetailAudit}
497
504
  * 铸,调用点在单飞回调**之内** ⇒ 一轮真 run 一行,并入的等待者不各落一行。 */
498
505
  onStopDetail?: (audit: ReturnType<typeof buildStopDetailAudit>) => void;
499
- /** core 7.50.0:整理跑的**写判官座**(必填 —— 缺席不是「没有规则」,core 也拒)。操作面不判任何东西,只把它原样递给驱动动词:
500
- * 早问库目录一次、应用时问每个产物文件,答 `no_objection` 以外一律拒写。装配层给哪一只见 {@link createOperatorValveWriteJudge}。 */
501
- writeJudge: ConsolidationWriteJudge;
506
+ /** core 7.50.0:整理跑的**写判官座**(必填 —— 缺席不是「没有规则」,core 也拒),按发起者铸:每一次真跑(单飞里起跑的那一次)调一次,
507
+ * 拿到的判官原样递给驱动动词 —— 早问库目录一次、应用时问每个产物文件,答 `no_objection` 以外一律拒写。操作面不判任何东西。
508
+ * 装配层给哪一只见 {@link createOperatorValveWriteJudge}。 */
509
+ writeJudgeFor: (initiator: string | undefined) => ConsolidationWriteJudge;
502
510
  /** 引擎通告的**运维行**座(与 Runner 的 `onNotice` 同一只转发器)。缺席 ⇒ 通告只在回执上。判官拒的两种时机都经它走一次:
503
511
  * 应用时拒 = 引擎在驱动里铸的 `memory.consolidation_incomplete`;早问拒 = 驱动抛出的拒绝经引擎导出的投递口(`deliverWriteRefusal`)转成的
504
512
  * `memory.consolidation_refused`(本仓不读通告名、不自铸通告形)。 */
@@ -7,7 +7,11 @@ import { captureRecordStoreOf } from "../memory-operator-faces.js";
7
7
  import { memoryStoreForRequest } from "../memory-scope-stores.js";
8
8
  import { createConsolidationWriteJudge, deliverWriteRefusal, expandTiers, MemoryEngine, memoryGovernanceDurability, modelOriginOf, resolveComplianceDenies, resolveMemoryConsolidationDriver, runMemoryConsolidationDriver, } from "@sema-agent/core";
9
9
  import { seatText } from "../trace/exit-seat.js";
10
- export function resolveConsolidationDriverSeat(deps) {
10
+ import { createKeyResolver, credentialIdentityFingerprint, credentialIdentityOf } from "../key-resolver.js";
11
+ export function resolveConsolidationDriverSeat(input) {
12
+ const { modelApiKeyEnv, modelApiKeys, ...seatDeps } = input;
13
+ const frozenKeys = createKeyResolver({ ...modelApiKeyEnv }, process.env, { ...modelApiKeys });
14
+ const deps = { ...seatDeps, ...(frozenKeys !== undefined ? { getApiKeyAndHeaders: frozenKeys } : {}) };
11
15
  let options;
12
16
  try {
13
17
  options = resolveMemoryConsolidationDriver(deps);
@@ -57,7 +61,7 @@ function consolidationSeatFingerprint(plane) {
57
61
  if ("unresolvable" in seat)
58
62
  return seat;
59
63
  const { cost: _cost, ...route } = seat.entry;
60
- return route;
64
+ return { ...route, credential: credentialIdentityFingerprint(credentialIdentityOf(plane, seat.entry.name)) };
61
65
  }
62
66
  function seatLabel(deps) {
63
67
  if (deps.memoryConsolidationDriver?.chat !== undefined)
@@ -195,7 +199,7 @@ export function createConsolidationValve(input) {
195
199
  if (valve.notice !== undefined)
196
200
  logger.warn(valve.notice.tag, { detail: valve.notice.detail });
197
201
  assertConsolidationDriverWirable({ ...wiring, enabled: valve.enabled });
198
- const plane = () => ({ models: config.models, tiers: config.tiers, roles: config.roles });
202
+ const plane = () => ({ models: config.models, tiers: config.tiers, roles: config.roles, modelApiKeyEnv: config.modelApiKeyEnv, modelApiKeys: config.modelApiKeys });
199
203
  return { valve, watch: createConsolidationValveWatch({ driver: config.memoryConsolidationDriver, unwirable, plane }) };
200
204
  }
201
205
  export function judgeConsolidationValve(input) {
@@ -322,6 +326,8 @@ export function createOperatorValveJudgeInput(facts) {
322
326
  const home = executionLaneHomeDir(facts.config);
323
327
  return {
324
328
  ...(facts.ruleStoreProvider !== undefined ? { ruleStoreProvider: facts.ruleStoreProvider } : {}),
329
+ ...(facts.initiator !== undefined && facts.initiator !== "" ? { principal: facts.initiator } : {}),
330
+ ...(facts.localOwnerDeclared ? { localOwnerDeclared: true } : {}),
325
331
  anchors: home !== undefined ? { home } : {},
326
332
  };
327
333
  }
@@ -356,10 +362,10 @@ export function createMemoryConsolidationFaces(stores, input) {
356
362
  seat: input.seat.seat,
357
363
  model: input.seat.model,
358
364
  scopes: input.scopes,
359
- run: (scope) => flight(scope, async () => {
365
+ run: (scope, initiator) => flight(scope, async () => {
360
366
  const receipt = await runMemoryConsolidationDriver(engineOf(scope), scope, {
361
367
  ...input.seat.options,
362
- writeJudge: input.writeJudge,
368
+ writeJudge: input.writeJudgeFor(initiator),
363
369
  compliance: { ...(input.postureOf !== undefined ? { postureOf: input.postureOf } : {}), scopeContract: memoryScopeContractOf([scope]) },
364
370
  ...(input.onNotice !== undefined ? { onNotice: input.onNotice } : {}),
365
371
  }).catch((err) => {
@@ -28,7 +28,7 @@ export function createOrgMemoryAdmissionWiring(opts) {
28
28
  const directory = centerLeg !== undefined
29
29
  ? (() => {
30
30
  const directoryNow = createIdentityBins(centerLeg.credential, (credential) => createOrgMemoryDirectory({
31
- fetchSection: (principal) => fetchPrincipalOrgMemory({ baseUrl: centerLeg.baseUrl, credential }, principal, fetch, centerLeg.worker),
31
+ fetchSection: (principal) => fetchPrincipalOrgMemory({ baseUrl: centerLeg.baseUrl, credential }, principal, undefined, centerLeg.worker),
32
32
  grantTtlMs: config.memoryOrgGrantTtlMs,
33
33
  unavailableBackoffMs: config.memoryOrgUnavailableBackoffMs,
34
34
  logger,
@@ -7,7 +7,7 @@ import { applyRuntimeGovernance } from "../runtime-governance.js";
7
7
  import { DeferredSandboxPathEnv, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
8
8
  import { DEPLOYMENT_SHAPE_PREDICATES } from "../deployment-shape.js";
9
9
  import { executionLaneHomeDir } from "../execution-lane-caps.js";
10
- import { createDeploymentListExemption } from "../approval.js";
10
+ import { createSessionExemptionRead } from "../approval.js";
11
11
  import { seatText } from "../trace/exit-seat.js";
12
12
  function hostGateCwd(config, localRoot) {
13
13
  return join(config.localDataRoot ?? localRoot, "parked-revive-unrooted");
@@ -33,7 +33,7 @@ export function createParkedReviveInheritedGate(deps) {
33
33
  const baseline = createApprovalBaselinePolicy(config, {
34
34
  kind: "durable",
35
35
  question,
36
- ...(approvalExemptionStore !== undefined && rootSessionId ? { exemption: createDeploymentListExemption(approvalExemptionStore, rootSessionId, logger, "parked_revive") } : {}),
36
+ ...(approvalExemptionStore !== undefined && rootSessionId ? { exemption: createSessionExemptionRead(approvalExemptionStore, rootSessionId, logger, "deployment_list", "parked_revive") } : {}),
37
37
  });
38
38
  const governed = applyRuntimeGovernance({ objective: "", toolPolicy: baseline }, createDeploymentGovernanceInputs(config, pathAdjudication));
39
39
  return {
@@ -26,7 +26,7 @@ import type { ApprovalNonceStore, CheckpointStoreFull, CostQuotaStore, ImageBake
26
26
  import { type StoreSweep, type StoreSweepLeg } from "../plugins/store-sweep.js";
27
27
  import type { ToolApprovalCoordinator } from "../tool-approval.js";
28
28
  import type { ParkCommitWatch } from "../plugins/park-commit-watch.js";
29
- import { type SandboxPodReaper } from "../plugins/k8s-pod-reaper.js";
29
+ import { type SandboxReaper } from "../plugins/sandbox-reaper.js";
30
30
  import { type AuditRotationPort } from "../approval-ask-retention.js";
31
31
  /** [ref] / [ref]§五(sema-comms `audits/failopen-governance-176.md` §7 "Z 类 1 条"):default consecutive-failure
32
32
  * count before a reaper leg's swallowed error gets a `warn` line. The ~15 `.catch(() => undefined)` sites
@@ -122,8 +122,9 @@ export interface ReapersCtx {
122
122
  approvalAskAudit: AuditRotationPort | undefined;
123
123
  /** 晚绑(server 造出来才有)——见文件头「位置即契约」①。 */
124
124
  getRunDenySweep: () => ((now: number) => Promise<void>) | undefined;
125
- /** k8s 车道的沙箱 Pod reaper(`plugins/k8s-pod-reaper.ts`;第 5 段与 run 工厂同一份 k8s 配置铸)。缺席 = 非 k8s 车道 ⇒ 本腿零调用。 */
126
- sandboxPodReaper?: SandboxPodReaper;
125
+ /** 本车道的沙箱回收座(`plugins/sandbox-reaper.ts`;第 5 段与 run 工厂同一份车道配置铸):k8s 车道 = 沙箱 Pod reaper(`plugins/k8s-pod-reaper.ts`),local-docker 车道 = 无主容器 reaper
126
+ * (`plugins/local-docker-reaper.ts`)。缺席 = 别的车道 ⇒ 本腿零调用。一次部署一条执行车道 ⇒ 一只座、一个节拍。 */
127
+ sandboxReaper?: SandboxReaper;
127
128
  }
128
129
  /** core 5.48 `reapDurableAgents` 的 `deps.sessions` 面(结构形,只列本仓要填的三格)。 */
129
130
  export interface ReapSessionsFacade {