@sema-agent/server 7.149.0 → 7.151.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 (441) hide show
  1. package/MIGRATION.md +307 -9
  2. package/README.md +1 -1
  3. package/README.zh-CN.md +1 -1
  4. package/USAGE.md +92 -40
  5. package/deploy/sema-up/README.md +7 -1
  6. package/deploy/sema-up/chart/Chart.yaml +1 -1
  7. package/deploy/sema-up/chart/templates/NOTES.txt +5 -0
  8. package/deploy/sema-up/chart/templates/_helpers.tpl +15 -16
  9. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -3
  10. package/deploy/sema-up/chart/templates/server.yaml +5 -3
  11. package/deploy/sema-up/chart/values-full-single.yaml +3 -1
  12. package/deploy/sema-up/chart/values.yaml +8 -1
  13. package/deploy/sema-up/cluster-up.sh +1 -0
  14. package/deploy/sema-up/kube-up.sh +1 -1
  15. package/deploy/sema-up/lib/flagshape.sh +1 -1
  16. package/deploy/sema-up/lib/helm-values-cluster.py +2 -0
  17. package/deploy/sema-up/lib/helm-values-kube.py +2 -0
  18. package/dist/adoption/import.js +3 -3
  19. package/dist/approval-ask-machine.d.ts +1 -1
  20. package/dist/approval-card.d.ts +3 -3
  21. package/dist/approval-gate-currency.d.ts +2 -2
  22. package/dist/audit.d.ts +1 -1
  23. package/dist/audit.js +2 -2
  24. package/dist/auth-bridge.d.ts +20 -0
  25. package/dist/auth-bridge.js +9 -0
  26. package/dist/background-session-reap.d.ts +2 -2
  27. package/dist/bake-runner/main.d.ts +4 -2
  28. package/dist/bind-host.d.ts +2 -3
  29. package/dist/bind-host.js +2 -4
  30. package/dist/boot/budget-tracing.js +1 -1
  31. package/dist/boot/deferred-sandbox-path-env.d.ts +5 -3
  32. package/dist/boot/deferred-sandbox-path-env.js +1 -2
  33. package/dist/boot/engine-lease.d.ts +5 -0
  34. package/dist/boot/engine-lease.js +1 -0
  35. package/dist/boot/execution-env.d.ts +8 -14
  36. package/dist/boot/execution-env.js +54 -17
  37. package/dist/boot/execution-lane.js +32 -5
  38. package/dist/boot/late-binds.d.ts +8 -4
  39. package/dist/boot/late-binds.js +7 -1
  40. package/dist/boot/memory-consolidation.d.ts +3 -2
  41. package/dist/boot/memory-consolidation.js +6 -6
  42. package/dist/boot/parked-revive-gate.d.ts +5 -5
  43. package/dist/boot/parked-revive-gate.js +2 -3
  44. package/dist/boot/reapers.d.ts +5 -0
  45. package/dist/boot/reapers.js +12 -1
  46. package/dist/boot/resolve-spec.d.ts +7 -8
  47. package/dist/boot/resolve-spec.js +80 -35
  48. package/dist/boot/retention-lane.d.ts +1 -1
  49. package/dist/boot/runner-deps.d.ts +9 -2
  50. package/dist/boot/runner-deps.js +3 -3
  51. package/dist/boot/session-age-out.d.ts +36 -0
  52. package/dist/boot/session-age-out.js +101 -0
  53. package/dist/boot/session-faces.d.ts +5 -14
  54. package/dist/boot/session-faces.js +28 -24
  55. package/dist/boot/stage-01-config.js +2 -0
  56. package/dist/boot/stage-03-store-backend.js +2 -2
  57. package/dist/boot/stage-05-execution-env.d.ts +5 -3
  58. package/dist/boot/stage-05-execution-env.js +2 -2
  59. package/dist/boot/stage-06-runners.d.ts +7 -4
  60. package/dist/boot/stage-06-runners.js +16 -8
  61. package/dist/boot/stage-07-capability-layer.d.ts +7 -4
  62. package/dist/boot/stage-07-capability-layer.js +3 -2
  63. package/dist/boot/stage-08-reapers.d.ts +7 -4
  64. package/dist/boot/stage-08-reapers.js +4 -2
  65. package/dist/boot/stage-09-leader.d.ts +11 -5
  66. package/dist/boot/stage-09-leader.js +12 -3
  67. package/dist/boot/stage-10-http-server.d.ts +44 -6
  68. package/dist/boot/stage-10-http-server.js +12 -10
  69. package/dist/boot/web-admin.d.ts +1 -1
  70. package/dist/boot/web-admin.js +3 -1
  71. package/dist/boot/workflow-orchestration.d.ts +7 -2
  72. package/dist/boot/workflow-orchestration.js +24 -7
  73. package/dist/bounded-rotation.d.ts +29 -0
  74. package/dist/bounded-rotation.js +24 -0
  75. package/dist/capability-facts.d.ts +84 -66
  76. package/dist/capability-facts.js +58 -41
  77. package/dist/center-credential.d.ts +25 -6
  78. package/dist/center-credential.js +25 -5
  79. package/dist/config-catalog.d.ts +26 -7
  80. package/dist/config-catalog.js +15 -12
  81. package/dist/config-invariants.d.ts +2 -1
  82. package/dist/config-invariants.js +4 -4
  83. package/dist/config-types.d.ts +22 -15
  84. package/dist/config.d.ts +51 -2
  85. package/dist/config.js +35 -24
  86. package/dist/deployment-governance.d.ts +7 -28
  87. package/dist/deployment-governance.js +1 -14
  88. package/dist/deployment-shape.d.ts +9 -1
  89. package/dist/deployment-shape.js +2 -1
  90. package/dist/device-protocol.d.ts +5 -4
  91. package/dist/device-protocol.js +1 -1
  92. package/dist/device-ws-hub.d.ts +1 -0
  93. package/dist/device-ws-hub.js +66 -29
  94. package/dist/device-ws-protocol.d.ts +79 -12
  95. package/dist/device-ws-protocol.js +64 -26
  96. package/dist/engine-identity.d.ts +23 -5
  97. package/dist/engine-identity.js +13 -0
  98. package/dist/entry-mode-clamp-notice.d.ts +2 -1
  99. package/dist/execution-env-refusal.d.ts +23 -0
  100. package/dist/execution-env-refusal.js +5 -0
  101. package/dist/execution-lane-caps.d.ts +3 -1
  102. package/dist/field-conflict.d.ts +3 -3
  103. package/dist/file-history-capture.d.ts +11 -4
  104. package/dist/file-history-capture.js +9 -6
  105. package/dist/file-history-disclosure.d.ts +7 -5
  106. package/dist/file-history-disclosure.js +7 -5
  107. package/dist/fleet/drain-entry.d.ts +4 -0
  108. package/dist/fleet/engine-signal.d.ts +14 -1
  109. package/dist/fleet/engine-signal.js +5 -1
  110. package/dist/fleet/fleet-reconciler.d.ts +1 -1
  111. package/dist/fleet/serving-lease.d.ts +18 -3
  112. package/dist/fleet/serving-lease.js +81 -35
  113. package/dist/fleet-client.d.ts +13 -11
  114. package/dist/fleet-client.js +53 -33
  115. package/dist/history-anchor.js +1 -1
  116. package/dist/hitl-delivery.d.ts +1 -3
  117. package/dist/hitl-delivery.js +1 -1
  118. package/dist/hooks/hook-runner.js +2 -2
  119. package/dist/host-lsp-manager.d.ts +2 -2
  120. package/dist/http/active-run-conflict.d.ts +3 -7
  121. package/dist/http/active-run-conflict.js +2 -2
  122. package/dist/http/admission.js +19 -4
  123. package/dist/http/approval-sweeps.js +7 -6
  124. package/dist/http/caller-trust.d.ts +2 -2
  125. package/dist/http/caller-trust.js +3 -3
  126. package/dist/http/checkpoint-ctx.d.ts +20 -63
  127. package/dist/http/checkpoint-ctx.js +2 -24
  128. package/dist/http/claim-heartbeat.d.ts +4 -4
  129. package/dist/http/claim-heartbeat.js +3 -3
  130. package/dist/http/dispatch.d.ts +2 -1
  131. package/dist/http/dispatch.js +36 -29
  132. package/dist/http/durable-run-leg.js +17 -17
  133. package/dist/http/health-self-report.d.ts +9 -1
  134. package/dist/http/health-self-report.js +2 -0
  135. package/dist/http/owner-access.d.ts +264 -20
  136. package/dist/http/owner-access.js +215 -5
  137. package/dist/http/readiness.d.ts +4 -2
  138. package/dist/http/resume-ctx-read.js +38 -1
  139. package/dist/http/resume-legs.d.ts +2 -1
  140. package/dist/http/resume-legs.js +273 -89
  141. package/dist/http/route-ctx.d.ts +41 -19
  142. package/dist/http/route-table.d.ts +1 -1
  143. package/dist/http/routes/a2a-serve.js +15 -14
  144. package/dist/http/routes/admin-memory-optout.d.ts +1 -1
  145. package/dist/http/routes/agents-roster.js +2 -3
  146. package/dist/http/routes/approvals-assistant.d.ts +3 -2
  147. package/dist/http/routes/approvals-assistant.js +12 -12
  148. package/dist/http/routes/background.d.ts +3 -3
  149. package/dist/http/routes/capabilities.js +10 -6
  150. package/dist/http/routes/config-catalog.d.ts +1 -1
  151. package/dist/http/routes/fleet.js +10 -8
  152. package/dist/http/routes/mcp-reconnect.js +2 -2
  153. package/dist/http/routes/memory-origin.d.ts +1 -1
  154. package/dist/http/routes/notify-wake.js +2 -3
  155. package/dist/http/routes/projects.d.ts +4 -2
  156. package/dist/http/routes/projects.js +7 -6
  157. package/dist/http/routes/retention-ops.d.ts +1 -1
  158. package/dist/http/routes/run-permission-mode.d.ts +1 -1
  159. package/dist/http/routes/run-permission-mode.js +2 -2
  160. package/dist/http/routes/runs.d.ts +1 -1
  161. package/dist/http/routes/runs.js +125 -66
  162. package/dist/http/routes/session-memory-sync.js +4 -5
  163. package/dist/http/routes/session-sync.d.ts +4 -3
  164. package/dist/http/routes/session-sync.js +174 -83
  165. package/dist/http/routes/sessions-list.js +13 -7
  166. package/dist/http/routes/sessions.d.ts +1 -1
  167. package/dist/http/routes/sessions.js +26 -48
  168. package/dist/http/routes/tasks.js +38 -23
  169. package/dist/http/routes/trace-usage.js +14 -14
  170. package/dist/http/routes/workflows.d.ts +1 -0
  171. package/dist/http/routes/workflows.js +20 -38
  172. package/dist/http/server.d.ts +28 -30
  173. package/dist/http/server.js +7 -3
  174. package/dist/http/stored-body-replay.d.ts +3 -24
  175. package/dist/http/stored-body-replay.js +2 -12
  176. package/dist/http/submit-ctx.d.ts +1 -2
  177. package/dist/http/submit-ctx.js +8 -6
  178. package/dist/http/submit-replay.d.ts +15 -2
  179. package/dist/http/submit-replay.js +10 -4
  180. package/dist/http/wire-types.d.ts +19 -6
  181. package/dist/identity-source.d.ts +20 -3
  182. package/dist/identity-source.js +14 -0
  183. package/dist/index.d.ts +4 -0
  184. package/dist/lane-home-probe.d.ts +3 -7
  185. package/dist/lane-home-probe.js +0 -1
  186. package/dist/leader/endpoint.js +9 -8
  187. package/dist/leader/leader.d.ts +2 -1
  188. package/dist/leg-facts.d.ts +19 -5
  189. package/dist/leg-facts.js +3 -1
  190. package/dist/mcp-authorization-face.d.ts +18 -14
  191. package/dist/mcp-authorization-face.js +3 -2
  192. package/dist/memory-scope.d.ts +5 -4
  193. package/dist/memory-scope.js +4 -4
  194. package/dist/memory-store-refusal.d.ts +1 -1
  195. package/dist/memory-sync-client.d.ts +30 -2
  196. package/dist/memory-sync-client.js +16 -9
  197. package/dist/observability/corrupt-read-seat.d.ts +1 -1
  198. package/dist/observability/err-text.d.ts +7 -0
  199. package/dist/observability/err-text.js +5 -0
  200. package/dist/observability/fail-open.d.ts +12 -8
  201. package/dist/observability/fail-open.js +12 -8
  202. package/dist/observability/logger.d.ts +7 -0
  203. package/dist/observability/logger.js +3 -1
  204. package/dist/observability/metrics.js +1 -0
  205. package/dist/observability/run-terminal.d.ts +1 -1
  206. package/dist/orchestration/workflow-notify-journal.d.ts +18 -1
  207. package/dist/orchestration/workflow-notify-journal.js +12 -1
  208. package/dist/orchestration/workflow-park-decision.d.ts +70 -18
  209. package/dist/orchestration/workflow-park-decision.js +49 -10
  210. package/dist/orchestration/workflow-park-holder.d.ts +65 -0
  211. package/dist/orchestration/workflow-park-holder.js +98 -0
  212. package/dist/orchestration/workflow-record-fence.d.ts +36 -0
  213. package/dist/orchestration/workflow-record-fence.js +42 -0
  214. package/dist/owner-faces.d.ts +28 -4
  215. package/dist/owner-faces.js +2 -0
  216. package/dist/parked-decide.d.ts +104 -53
  217. package/dist/parked-decide.js +153 -117
  218. package/dist/peer-directory.d.ts +2 -2
  219. package/dist/peer-inbound-face.d.ts +2 -6
  220. package/dist/peer-inbound-face.js +0 -3
  221. package/dist/peer-seat.d.ts +1 -1
  222. package/dist/peer-seat.js +52 -59
  223. package/dist/permission-mode-admission.d.ts +41 -5
  224. package/dist/permission-mode-admission.js +29 -3
  225. package/dist/plugins/adoption-log-sql.d.ts +3 -1
  226. package/dist/plugins/adoption-log-sql.js +7 -1
  227. package/dist/plugins/approval-ask-store-file.d.ts +10 -2
  228. package/dist/plugins/approval-ask-store-file.js +8 -0
  229. package/dist/plugins/approval-ask-store-memory.d.ts +6 -1
  230. package/dist/plugins/approval-ask-store-memory.js +28 -9
  231. package/dist/plugins/approval-ask-store-sql.d.ts +43 -2
  232. package/dist/plugins/approval-ask-store-sql.js +34 -5
  233. package/dist/plugins/approval-exemption-store.js +3 -0
  234. package/dist/plugins/approval-nonce-store.js +2 -0
  235. package/dist/plugins/breaker-state-sql.js +2 -0
  236. package/dist/plugins/caching-session-store.d.ts +9 -15
  237. package/dist/plugins/caching-session-store.js +6 -0
  238. package/dist/plugins/device-store-sql.js +6 -0
  239. package/dist/plugins/error-origin.d.ts +18 -0
  240. package/dist/plugins/error-origin.js +10 -0
  241. package/dist/plugins/exec-path-law.d.ts +34 -0
  242. package/dist/plugins/exec-path-law.js +13 -0
  243. package/dist/plugins/execution-placement-sql.js +6 -6
  244. package/dist/plugins/file-run-store.js +1 -1
  245. package/dist/plugins/image-bake-store-sql.js +6 -0
  246. package/dist/plugins/image-index-sql.js +4 -0
  247. package/dist/plugins/landed-attendants.d.ts +212 -0
  248. package/dist/plugins/landed-attendants.js +161 -0
  249. package/dist/plugins/leader-run-store-sql.js +4 -0
  250. package/dist/plugins/local-checkpoint-store.d.ts +4 -1
  251. package/dist/plugins/local-checkpoint-store.js +3 -0
  252. package/dist/plugins/local-session-live-reference.d.ts +40 -0
  253. package/dist/plugins/local-session-live-reference.js +39 -0
  254. package/dist/plugins/local-session-store.d.ts +71 -33
  255. package/dist/plugins/local-session-store.js +129 -27
  256. package/dist/plugins/memory-engine-pg.js +4 -0
  257. package/dist/plugins/memory-engine-sql-apply.js +5 -2
  258. package/dist/plugins/memory-engine-tidb.js +4 -0
  259. package/dist/plugins/memory-optout-grant-store-sql.js +4 -0
  260. package/dist/plugins/memory-run-store.js +1 -1
  261. package/dist/plugins/memory-sync-store-pg.js +5 -0
  262. package/dist/plugins/memory-sync-store-tidb.js +5 -0
  263. package/dist/plugins/one-time-migrations.d.ts +80 -61
  264. package/dist/plugins/one-time-migrations.js +241 -104
  265. package/dist/plugins/org-delivery-quota-store.js +4 -1
  266. package/dist/plugins/outcome-ledger-sql.js +2 -0
  267. package/dist/plugins/permission-rule-store-sql.js +11 -4
  268. package/dist/plugins/pg-cost-quota.js +4 -0
  269. package/dist/plugins/pg-pool.js +28 -1
  270. package/dist/plugins/pg-rate-limiter.js +2 -0
  271. package/dist/plugins/posix-shell-fs.d.ts +6 -1
  272. package/dist/plugins/posix-shell-fs.js +8 -3
  273. package/dist/plugins/remote-env-adb.d.ts +19 -15
  274. package/dist/plugins/remote-env-adb.js +44 -17
  275. package/dist/plugins/remote-env-connect-seat.d.ts +105 -0
  276. package/dist/plugins/remote-env-connect-seat.js +72 -0
  277. package/dist/plugins/remote-env-device.d.ts +22 -5
  278. package/dist/plugins/remote-env-device.js +114 -14
  279. package/dist/plugins/remote-env-e2b.d.ts +18 -7
  280. package/dist/plugins/remote-env-e2b.js +53 -40
  281. package/dist/plugins/remote-env-file-error.js +6 -2
  282. package/dist/plugins/remote-env-host.d.ts +18 -1
  283. package/dist/plugins/remote-env-host.js +48 -47
  284. package/dist/plugins/remote-env-k8s.d.ts +41 -39
  285. package/dist/plugins/remote-env-k8s.js +56 -32
  286. package/dist/plugins/remote-env-local-docker.d.ts +13 -8
  287. package/dist/plugins/remote-env-local-docker.js +37 -43
  288. package/dist/plugins/remote-env-ssh.d.ts +18 -12
  289. package/dist/plugins/remote-env-ssh.js +64 -62
  290. package/dist/plugins/remote-shell.d.ts +101 -2
  291. package/dist/plugins/remote-shell.js +221 -3
  292. package/dist/plugins/replica-registration.d.ts +35 -0
  293. package/dist/plugins/replica-registration.js +48 -0
  294. package/dist/plugins/resume-anchor-store-sql.d.ts +11 -2
  295. package/dist/plugins/resume-anchor-store-sql.js +12 -5
  296. package/dist/plugins/retention-lane-store-sql.d.ts +1 -1
  297. package/dist/plugins/retention-lane-store-sql.js +4 -0
  298. package/dist/plugins/retention-sql.d.ts +20 -2
  299. package/dist/plugins/retention-sql.js +11 -0
  300. package/dist/plugins/run-store-sql.d.ts +22 -3
  301. package/dist/plugins/run-store-sql.js +33 -9
  302. package/dist/plugins/scenario-prefix-switch-m42.d.ts +6 -12
  303. package/dist/plugins/scenario-prefix-switch-m42.js +7 -5
  304. package/dist/plugins/schema-consistency.d.ts +9 -5
  305. package/dist/plugins/schema-consistency.js +48 -18
  306. package/dist/plugins/schema-drift-sentence.js +1 -1
  307. package/dist/plugins/send-file-ledger.js +3 -0
  308. package/dist/plugins/serving-requirement.d.ts +68 -0
  309. package/dist/plugins/serving-requirement.js +60 -0
  310. package/dist/plugins/session-birth.d.ts +6 -2
  311. package/dist/plugins/session-capture-record-store-sql.js +2 -0
  312. package/dist/plugins/session-ext-table.d.ts +14 -1
  313. package/dist/plugins/session-ext-table.js +5 -1
  314. package/dist/plugins/session-row-sql.d.ts +49 -2
  315. package/dist/plugins/session-row-sql.js +56 -13
  316. package/dist/plugins/session-store-sql.d.ts +34 -18
  317. package/dist/plugins/session-store-sql.js +98 -17
  318. package/dist/plugins/shared-memory-store-sql.d.ts +1 -0
  319. package/dist/plugins/shared-memory-store-sql.js +6 -2
  320. package/dist/plugins/sql-driver.d.ts +2 -1
  321. package/dist/plugins/sql-driver.js +18 -3
  322. package/dist/plugins/sql-errors.d.ts +11 -6
  323. package/dist/plugins/sql-errors.js +5 -6
  324. package/dist/plugins/stop-then-start-sentence.d.ts +48 -3
  325. package/dist/plugins/stop-then-start-sentence.js +48 -0
  326. package/dist/plugins/stop-then-start.d.ts +109 -0
  327. package/dist/plugins/stop-then-start.js +104 -0
  328. package/dist/plugins/store-backend.d.ts +40 -13
  329. package/dist/plugins/store-backend.js +169 -27
  330. package/dist/plugins/store-boundary.d.ts +57 -0
  331. package/dist/plugins/store-boundary.js +139 -0
  332. package/dist/plugins/store-contracts.d.ts +29 -2
  333. package/dist/plugins/store-contracts.js +3 -0
  334. package/dist/plugins/store-fault-sentence-m53.d.ts +7 -0
  335. package/dist/plugins/store-fault-sentence-m53.js +25 -0
  336. package/dist/plugins/store-fault.d.ts +26 -7
  337. package/dist/plugins/store-fault.js +18 -2
  338. package/dist/plugins/task-attachment-store.js +9 -0
  339. package/dist/plugins/task-list-store-sql.d.ts +2 -2
  340. package/dist/plugins/task-list-store-sql.js +10 -8
  341. package/dist/plugins/tidb-cost-quota.js +4 -0
  342. package/dist/plugins/tidb-pool.js +6 -1
  343. package/dist/plugins/tidb-rate-limiter.js +4 -0
  344. package/dist/plugins/user-input-ledger-sql.js +4 -0
  345. package/dist/plugins/workflow-run-store-sql.d.ts +28 -10
  346. package/dist/plugins/workflow-run-store-sql.js +64 -4
  347. package/dist/plugins/workspace-fill.d.ts +4 -7
  348. package/dist/plugins/workspace-fill.js +2 -1
  349. package/dist/plugins/write-behind-counter.js +5 -0
  350. package/dist/process-instance.d.ts +3 -0
  351. package/dist/process-instance.js +7 -0
  352. package/dist/project-context.d.ts +64 -0
  353. package/dist/project-context.js +66 -0
  354. package/dist/project-registry.d.ts +46 -0
  355. package/dist/project-registry.js +44 -0
  356. package/dist/question.d.ts +9 -21
  357. package/dist/question.js +28 -19
  358. package/dist/request-key-closure.js +1 -1
  359. package/dist/request-value-closure.d.ts +4 -0
  360. package/dist/request-value-closure.js +10 -0
  361. package/dist/run-acceptance.d.ts +3 -2
  362. package/dist/run-acceptance.js +4 -6
  363. package/dist/run-cancel-card.d.ts +1 -1
  364. package/dist/run-cancel-card.js +2 -1
  365. package/dist/run-local.js +1 -0
  366. package/dist/runs.d.ts +37 -8
  367. package/dist/runs.js +53 -12
  368. package/dist/runtime-governance.d.ts +5 -4
  369. package/dist/security.d.ts +31 -33
  370. package/dist/security.js +41 -7
  371. package/dist/server-secret-env.d.ts +12 -10
  372. package/dist/server-secret-env.js +24 -15
  373. package/dist/session-agent.d.ts +1 -10
  374. package/dist/session-agent.js +0 -6
  375. package/dist/session-bindings.d.ts +82 -0
  376. package/dist/session-bindings.js +18 -0
  377. package/dist/session-children-retire.d.ts +2 -2
  378. package/dist/session-children-retire.js +2 -6
  379. package/dist/session-deletion.d.ts +16 -1
  380. package/dist/session-error-wire.d.ts +3 -3
  381. package/dist/session-error-wire.js +3 -3
  382. package/dist/session-incarnation.d.ts +28 -4
  383. package/dist/session-incarnation.js +14 -2
  384. package/dist/session-kind.d.ts +57 -0
  385. package/dist/session-kind.js +22 -0
  386. package/dist/session-notify-door.d.ts +4 -4
  387. package/dist/session-notify-door.js +5 -6
  388. package/dist/session-row.d.ts +21 -1
  389. package/dist/session-row.js +7 -1
  390. package/dist/session-rules-seat.d.ts +4 -3
  391. package/dist/session-rules-seat.js +3 -11
  392. package/dist/session-sync-kernel.d.ts +24 -14
  393. package/dist/session-sync-kernel.js +3 -6
  394. package/dist/session-sync.d.ts +4 -98
  395. package/dist/session-sync.js +4 -74
  396. package/dist/session-titler.d.ts +10 -3
  397. package/dist/session-titler.js +19 -6
  398. package/dist/ssh-host-key.d.ts +5 -0
  399. package/dist/ssh-host-key.js +3 -0
  400. package/dist/stores-sql/checkpoint-store-sql.d.ts +21 -2
  401. package/dist/stores-sql/checkpoint-store-sql.js +106 -18
  402. package/dist/stores-sql/file-history-store-sql.d.ts +52 -2
  403. package/dist/stores-sql/file-history-store-sql.js +108 -70
  404. package/dist/stores-sql/pg-session-storage.d.ts +34 -7
  405. package/dist/stores-sql/pg-session-storage.js +37 -13
  406. package/dist/stores-sql/retention-store-sql.d.ts +2 -10
  407. package/dist/stores-sql/retention-store-sql.js +2 -10
  408. package/dist/stores-sql/session-policy-store-sql.d.ts +30 -7
  409. package/dist/stores-sql/session-policy-store-sql.js +61 -44
  410. package/dist/stores-sql/session-write-hooks.d.ts +11 -0
  411. package/dist/stores-sql/tidb-session-store.d.ts +58 -7
  412. package/dist/stores-sql/tidb-session-store.js +37 -13
  413. package/dist/submission-exit.d.ts +3 -2
  414. package/dist/submission-exit.js +9 -1
  415. package/dist/task-cwd.d.ts +6 -5
  416. package/dist/task-settings.d.ts +19 -5
  417. package/dist/task-settings.js +13 -7
  418. package/dist/terminal.d.ts +33 -2
  419. package/dist/terminal.js +139 -9
  420. package/dist/tool-approval.d.ts +147 -12
  421. package/dist/tool-approval.js +206 -109
  422. package/dist/trace/engine-notice-wire.d.ts +14 -0
  423. package/dist/trace/engine-notice-wire.js +18 -1
  424. package/dist/trace/project.d.ts +4 -3
  425. package/dist/trace/project.js +3 -2
  426. package/dist/trace/projection-table.d.ts +33 -2
  427. package/dist/trace/self-minted-wire.d.ts +422 -26
  428. package/dist/trace/self-minted-wire.js +149 -23
  429. package/dist/trace/tool-card.d.ts +3 -0
  430. package/dist/trace/tool-card.js +24 -0
  431. package/dist/trace/tool-output-media.d.ts +2 -1
  432. package/dist/unattended-permission-mode.d.ts +1 -1
  433. package/dist/web-admin-client/apply-effective.d.ts +1 -1
  434. package/dist/web-admin-client/effective-keys.d.ts +1 -1
  435. package/dist/web-admin-client/skills-mcp.d.ts +1 -1
  436. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +120 -41
  437. package/package.json +3 -3
  438. package/wire-changes/server@7.150.0.json +335 -0
  439. package/wire-changes/server@7.151.0.json +762 -0
  440. package/dist/http/session-inherit-env.d.ts +0 -36
  441. package/dist/http/session-inherit-env.js +0 -6
@@ -32,6 +32,7 @@ import { reapOrphanWorktrees, withWorktreeIsolation } from "../plugins/worktree-
32
32
  import { derivePkgSourceEnv } from "../sandbox-pkg-source.js";
33
33
  import { effectiveHostWorkspace } from "../task-cwd.js";
34
34
  import { taskInheritEnvRefusal } from "../hosted-posture.js";
35
+ import { bindingsOf } from "../session-bindings.js";
35
36
  import { sessionFaceOfHead } from "../session-incarnation.js";
36
37
  import { isCodeToken } from "../terminal.js";
37
38
  import { createCacheMissMemory } from "../workspace-cache.js";
@@ -61,16 +62,40 @@ function sandboxLaneEnvMerged(lane) {
61
62
  return Object.keys(merged).length > 0 ? merged : undefined;
62
63
  }
63
64
  const MAX_CWD_SESSIONS = 4096;
65
+ function withWrites(cells, writes) {
66
+ return bindingsOf(writes.cwd ?? cells.cwd, writes.shellEnv !== undefined ? { ...writes.shellEnv } : cells.shellEnv, writes.inheritEnv);
67
+ }
68
+ function restoreCell(map, sid, value) {
69
+ if (value === undefined)
70
+ map.delete(sid);
71
+ else
72
+ map.set(sid, value);
73
+ }
64
74
  export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
65
75
  const perSessionCwd = new Map();
66
76
  const perSessionShellEnv = new Map();
67
77
  const perSessionInheritEnv = new Map();
68
78
  const owners = new Map();
69
79
  const occupants = new Map();
80
+ const logs = new Map();
81
+ const cellsOf = (sid) => bindingsOf(perSessionCwd.get(sid), perSessionShellEnv.get(sid), perSessionInheritEnv.get(sid));
82
+ const materialize = (sid, log) => {
83
+ const cells = log.entries.reduce((acc, e) => withWrites(acc, e.writes), log.base);
84
+ restoreCell(perSessionCwd, sid, cells.cwd);
85
+ restoreCell(perSessionShellEnv, sid, cells.shellEnv);
86
+ restoreCell(perSessionInheritEnv, sid, cells.inheritEnv);
87
+ };
88
+ const compact = (sid, log) => {
89
+ while (log.entries[0]?.settled === true)
90
+ log.base = withWrites(log.base, log.entries.shift().writes);
91
+ if (log.entries.length === 0)
92
+ logs.delete(sid);
93
+ };
70
94
  const dropSession = (sid) => {
71
95
  perSessionCwd.delete(sid);
72
96
  perSessionShellEnv.delete(sid);
73
97
  perSessionInheritEnv.delete(sid);
98
+ logs.delete(sid);
74
99
  owners.delete(sid);
75
100
  occupants.delete(sid);
76
101
  };
@@ -85,22 +110,34 @@ export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
85
110
  perSessionCwd,
86
111
  perSessionShellEnv,
87
112
  sessionOwners: owners,
88
- setSessionCwd: (sid, cwd) => {
89
- perSessionCwd.set(sid, cwd);
113
+ perSessionInheritEnv,
114
+ commitSessionBindings: (sid, bindings) => {
115
+ const log = logs.get(sid) ?? { base: cellsOf(sid), entries: [] };
116
+ logs.set(sid, log);
117
+ const token = Symbol(sid);
118
+ log.entries.push({ token, writes: { ...bindings, ...(bindings.shellEnv !== undefined ? { shellEnv: { ...bindings.shellEnv } } : {}) }, settled: false });
119
+ materialize(sid, log);
90
120
  touch(sid, undefined);
121
+ return { sessionId: sid, token };
91
122
  },
92
- setSessionShellEnv: (sid, env) => {
93
- perSessionShellEnv.set(sid, env);
94
- touch(sid, undefined);
123
+ withdrawSessionBindings: (receipt) => {
124
+ const log = logs.get(receipt.sessionId);
125
+ const at = log?.entries.findIndex((e) => e.token === receipt.token) ?? -1;
126
+ if (log === undefined || at < 0)
127
+ return false;
128
+ log.entries.splice(at, 1);
129
+ materialize(receipt.sessionId, log);
130
+ compact(receipt.sessionId, log);
131
+ return true;
95
132
  },
96
- perSessionInheritEnv,
97
- setSessionInheritEnv: (sid, policy) => {
98
- if (policy === undefined) {
99
- perSessionInheritEnv.delete(sid);
100
- return;
101
- }
102
- perSessionInheritEnv.set(sid, policy);
103
- touch(sid, undefined);
133
+ settleSessionBindings: (receipt) => {
134
+ const log = logs.get(receipt.sessionId);
135
+ const entry = log?.entries.find((e) => e.token === receipt.token);
136
+ if (log === undefined || entry === undefined)
137
+ return false;
138
+ entry.settled = true;
139
+ compact(receipt.sessionId, log);
140
+ return true;
104
141
  },
105
142
  fenceSessionOwner: (sid, owner, incarnation) => {
106
143
  const ownerChanged = owners.has(sid) && owners.get(sid) !== owner;
@@ -113,6 +150,7 @@ export function createSessionScopedRegistries(maxEntries = MAX_CWD_SESSIONS) {
113
150
  perSessionCwd.delete(sid);
114
151
  perSessionShellEnv.delete(sid);
115
152
  perSessionInheritEnv.delete(sid);
153
+ logs.delete(sid);
116
154
  }
117
155
  touch(sid, owner);
118
156
  },
@@ -250,9 +288,7 @@ export function createExecutionEnv(ctx) {
250
288
  const perTaskImage = new PerTaskImageRegistry();
251
289
  const sessionEnvSelection = new SessionEnvironmentSelection();
252
290
  const sessionScoped = createSessionScopedRegistries();
253
- const { perSessionCwd, setSessionCwd } = sessionScoped;
254
- const { perSessionShellEnv, setSessionShellEnv } = sessionScoped;
255
- const { perSessionInheritEnv, setSessionInheritEnv } = sessionScoped;
291
+ const { perSessionCwd, perSessionShellEnv, perSessionInheritEnv } = sessionScoped;
256
292
  const lspManager = createLspManager(config, (event, fields) => logger.info(event, fields));
257
293
  if (lspManager)
258
294
  logger.info("lsp_enabled", { provider: config.remoteExec.provider });
@@ -533,7 +569,8 @@ export function createExecutionEnv(ctx) {
533
569
  },
534
570
  });
535
571
  return {
536
- perTaskImage, sessionEnvSelection, perSessionCwd, setSessionCwd, setSessionShellEnv, setSessionInheritEnv,
572
+ perTaskImage, sessionEnvSelection, perSessionCwd,
573
+ sessionBindings: { commitSessionBindings: sessionScoped.commitSessionBindings, withdrawSessionBindings: sessionScoped.withdrawSessionBindings, settleSessionBindings: sessionScoped.settleSessionBindings },
537
574
  fenceSessionOwner: sessionScoped.fenceSessionOwner,
538
575
  dropSessionScoped: sessionScoped.dropSession,
539
576
  dropSessionScopedOf: sessionScoped.dropSessionOf,
@@ -1,7 +1,7 @@
1
1
  import { loadRemoteExec } from "@sema-agent/settings-schema/node";
2
2
  import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
3
3
  import { crossInvariant } from "../config-invariants.js";
4
- import { entryDeclarableRemoteExec } from "../config.js";
4
+ import { entryDeclarableRemoteExec, FILE_LANE_CELL_ENV, logConfigDiagnostics, parseHostLaneEnv, parseLocalDockerLaneEnv, } from "../config.js";
5
5
  import { ALL_EXECUTION_LANES, buildReadDenyFloorUnkeptNote, laneIsolated, laneWiresExecutionEnv } from "../execution-lane-caps.js";
6
6
  import { installReadDenyFloorDeployment } from "../read-deny-floor-notice.js";
7
7
  import { buildReadFacePostureNotice, settleDerivedReadFace } from "../read-face-posture.js";
@@ -27,6 +27,29 @@ function fileLaneUnresolvableRefusal(entry, lane, envReading, root) {
27
27
  `(file-source name→value resolution is not wired yet), and ${envReading}. The file's declaration ends the lane selection: no other declaration may stand in for it. ` +
28
28
  `Refusing before any task starts: set REMOTE_EXEC=${lane} with that lane's required env, or change the file to the lane you mean.`);
29
29
  }
30
+ function envReadingOfFileLane(minted, read, logger) {
31
+ if (minted !== undefined)
32
+ return minted;
33
+ const reading = read();
34
+ logConfigDiagnostics(logger);
35
+ return reading;
36
+ }
37
+ function discloseFileCellOverrides(lane, envReading, fileCells, logger, root) {
38
+ const cellEnvKeys = FILE_LANE_CELL_ENV[lane];
39
+ const keys = Object.entries(cellEnvKeys)
40
+ .filter(([cell]) => envReading[cell] !== undefined && fileCells[cell] !== undefined && envReading[cell] !== fileCells[cell])
41
+ .map(([, envKey]) => envKey);
42
+ if (keys.length === 0)
43
+ return;
44
+ logger.warn("remote_exec_file_overrides", {
45
+ provider: lane,
46
+ root,
47
+ keys,
48
+ note: `config.d/remote-exec.json (CONFIG_PROVIDER=local, file-wins) gives a different value than env for ${keys.join(", ")} on the "${lane}" lane — the file's value is in effect and ` +
49
+ `the env value for ${keys.length === 1 ? "that key is" : "those keys are"} INERT. The lane's other env parameters are read as usual. ` +
50
+ `Make the two agree: unset the env key if the file's value is the intended one, or change the file's cell (an optional cell can be removed from the file; "image" is mandatory there).`,
51
+ });
52
+ }
30
53
  export async function composeExecutionLane(loaded, ctx) {
31
54
  if (ctx.configSource === "local")
32
55
  await applyRemoteExecFile(loaded, ctx);
@@ -127,25 +150,29 @@ async function applyRemoteExecFile(config, ctx) {
127
150
  };
128
151
  const drives = (lane) => ctx.entry.runs.includes(lane);
129
152
  if (fileRx.provider === "host" && drives("host")) {
130
- config.remoteExec = {
131
- provider: "host",
153
+ const envReading = envReadingOfFileLane(config.remoteExec?.provider === "host" ? config.remoteExec : undefined, parseHostLaneEnv, logger);
154
+ const fileCells = {
132
155
  ...(fileRx.workdir ? { workspaceBase: fileRx.workdir } : {}),
133
156
  ...(fileRx.commandTimeoutMs != null ? { commandTimeoutMs: fileRx.commandTimeoutMs } : {}),
134
157
  };
158
+ config.remoteExec = { provider: "host", ...envReading, ...fileCells };
135
159
  disclosePreemption("host");
160
+ discloseFileCellOverrides("host", envReading, fileCells, logger, localRoot);
136
161
  logger.info("remote_exec_from_file", { provider: "host", root: localRoot });
137
162
  return;
138
163
  }
139
164
  if (fileRx.provider === "local-docker" && drives("local-docker")) {
140
- config.remoteExec = {
141
- provider: "local-docker",
165
+ const envReading = envReadingOfFileLane(config.remoteExec?.provider === "local-docker" ? config.remoteExec : undefined, () => parseLocalDockerLaneEnv(config.requirePrincipal !== true), logger);
166
+ const fileCells = {
142
167
  image: fileRx.image,
143
168
  ...(fileRx.mountPath ? { mountPath: fileRx.mountPath } : fileRx.workdir ? { mountPath: fileRx.workdir } : {}),
144
169
  ...(fileRx.memory ? { memory: fileRx.memory } : {}),
145
170
  ...(fileRx.cpus != null ? { cpus: fileRx.cpus } : {}),
146
171
  ...(fileRx.network ? { network: fileRx.network } : {}),
147
172
  };
173
+ config.remoteExec = { provider: "local-docker", ...envReading, ...fileCells };
148
174
  disclosePreemption("local-docker");
175
+ discloseFileCellOverrides("local-docker", envReading, fileCells, logger, localRoot);
149
176
  logger.info("remote_exec_from_file", { provider: "local-docker", root: localRoot, image: fileRx.image });
150
177
  return;
151
178
  }
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 晚绑席([ref] 十段切分的**唯一**跨段可变面)—— 五只 cell,读点在前段、写点在后段。
2
+ * 晚绑席([ref] 十段切分的**唯一**跨段可变面)—— 六只 cell,读点在前段、写点在后段。
3
3
  *
4
4
  * 为什么是模块级 live binding 而不是 ctx 字段:读点的原文是**裸标识符**(`() => runStore`、
5
5
  * `() => parkedAskRedeem`),而 ctx 字段是**快照** —— 把读点改成 `ctx.runStore` 就是正文改写,
@@ -9,9 +9,10 @@
9
9
  * · `parkedAskRedeem` / `runDenySweep` —— 它们的**声明行本身**就是 `let`(逐字搬进本文件,含缩进),
10
10
  * 赋值点(server 造出来之后那两处)也随之搬进 `bindServerLateSeats` —— 跨模块给 import 赋值是非法的,
11
11
  * 所以 cell 与它的写点必须同居一个模块;
12
- * · `sessionNotifyDoor` —— 同上一形(server 的产物,写点在 `bindServerLateSeats`)。
12
+ * · `sessionNotifyDoor` / `runEndedHandoff` —— 同上一形(server 的产物,写点在 `bindServerLateSeats`);
13
+ * · `sessionAgeOut` —— 会话老化腿(`boot/session-age-out.ts`):读点在第 8 段的维护拍,它要的删除协调器在第 9 段铸 ⇒ 写点 `bindSessionAgeOut` 在第 9 段协调器之后。
13
14
  *
14
- * 时序与修前逐字相同:五只 cell 的读点全是 `() => x` 取值闭包(boot 期不求值,最早的求值发生在
15
+ * 时序与修前逐字相同:六只 cell 的读点全是 `() => x` 取值闭包(boot 期不求值,最早的求值发生在
15
16
  * listen 之后的请求/tick 上),写点仍在各自原来的那一拍。未绑窗内取值得到 `undefined` —— 这正是
16
17
  * 各消费座既有的 fail-closed 臂(device 限速座:`gate()` 取不到就抛,见 boot/device-lane.ts:68)。
17
18
  */
@@ -27,7 +28,10 @@ declare let rateLimiter: RateGate | undefined;
27
28
  declare let parkedAskRedeem: ParkedAskRedeem | undefined;
28
29
  declare let runDenySweep: ((now: number) => Promise<void>) | undefined;
29
30
  declare let sessionNotifyDoor: SessionNotifyDoor | undefined;
30
- export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor };
31
+ declare let runEndedHandoff: ((runId: string) => Promise<void>) | undefined;
32
+ declare let sessionAgeOut: (() => Promise<unknown>) | undefined;
33
+ export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor, runEndedHandoff, sessionAgeOut };
34
+ export declare function bindSessionAgeOut(v: (() => Promise<unknown>) | undefined): void;
31
35
  export declare function bindRunStore(v: ReturnType<StoreBackend["run"]> | undefined): void;
32
36
  export declare function bindRateLimiter(v: RateGate): void;
33
37
  export declare function bindServerLateSeats(ctx: {
@@ -3,7 +3,12 @@ let rateLimiter;
3
3
  let parkedAskRedeem;
4
4
  let runDenySweep;
5
5
  let sessionNotifyDoor;
6
- export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor };
6
+ let runEndedHandoff;
7
+ let sessionAgeOut;
8
+ export { runStore, rateLimiter, parkedAskRedeem, runDenySweep, sessionNotifyDoor, runEndedHandoff, sessionAgeOut };
9
+ export function bindSessionAgeOut(v) {
10
+ sessionAgeOut = v;
11
+ }
7
12
  export function bindRunStore(v) {
8
13
  runStore = v;
9
14
  }
@@ -14,6 +19,7 @@ export function bindServerLateSeats(ctx) {
14
19
  const { config, logger, server } = ctx;
15
20
  runDenySweep = server.denyExpiredApprovals;
16
21
  sessionNotifyDoor = server.sessionNotifyDoor;
22
+ runEndedHandoff = server.handOverRunEndedDecisions;
17
23
  if (!config.directDoorActive)
18
24
  parkedAskRedeem = server.redeemParkedAsk;
19
25
  else
@@ -326,8 +326,9 @@ export declare function judgeConsolidationValve(input: ConsolidationValveInput):
326
326
  export declare function buildConsolidationValveAudit(input: {
327
327
  /** 阀门判决({@link resolveConsolidationValve} 的 `enabled` + `source`)。 */
328
328
  valve: Pick<ConsolidationValve, "enabled" | "source">;
329
- /** 这台部署配了任何一把 service 凭证吗(`config.authToken` 或 `config.authTokens` 非空)。 */
330
- hasServiceAuth: boolean;
329
+ /** 这台部署接没接任何一类过凭据门的来源(service 凭据 / 鉴权桥;部署形表行 `credentialGateSource`,写门律 5 在部署上的投影)。
330
+ * 没接 ⇒ 没有一次请求过得了写门(逃生口之外)。 */
331
+ credentialGateSource: boolean;
331
332
  /** 本地开发的显式逃生口(`ALLOW_UNAUTHED_WRITES=true`)。 */
332
333
  allowUnauthedWrites: boolean;
333
334
  }): {
@@ -282,17 +282,17 @@ export function buildConsolidationValveAudit(input) {
282
282
  if (!input.valve.enabled || input.valve.source !== "explicit")
283
283
  return { warnings: [] };
284
284
  const warnings = [];
285
- if (!input.hasServiceAuth && !input.allowUnauthedWrites) {
285
+ if (!input.credentialGateSource && !input.allowUnauthedWrites) {
286
286
  warnings.push({
287
287
  tag: "memory_consolidation_run_credential_gated",
288
- detail: "MEMORY_CONSOLIDATION_DRIVER=on armed the consolidation valve, but this worker has NO service credential " +
289
- "(SERVICE_AUTH_TOKEN / per-system tokens are unset) and ALLOW_UNAUTHED_WRITES is not on. POST " +
288
+ detail: "MEMORY_CONSOLIDATION_DRIVER=on armed the consolidation valve, but this worker accepts NO credential on its write face " +
289
+ "(SERVICE_AUTH_TOKEN / per-system tokens are unset and no SSO bridge verifies registry sign-in tokens) and ALLOW_UNAUTHED_WRITES is not on. POST " +
290
290
  "/v1/admin/memory/consolidation/run runs the model, so it rides the billable-submit gate and is refused " +
291
- "with 503 auth.service_token_required BEFORE it reaches the route — while capabilities." +
291
+ "with 503 auth.service_token_required BEFORE it reaches the route for every caller — while capabilities." +
292
292
  "memoryConsolidationDriver still reports true (a family-wide gap this worker shares with adoption / memory " +
293
293
  "bundle / memory compliance; it is documented, not silently accepted). GET /v1/admin/memory/consolidation " +
294
- "is unaffected (it runs no model). Set SERVICE_AUTH_TOKEN, or set ALLOW_UNAUTHED_WRITES=true for local " +
295
- "development only.",
294
+ "is unaffected (it runs no model). Set SERVICE_AUTH_TOKEN (or configure the SSO bridge, AUTH_BRIDGE_ISSUER, so verified " +
295
+ "sign-in tokens pass), or set ALLOW_UNAUTHED_WRITES=true for local development only.",
296
296
  });
297
297
  }
298
298
  return { warnings };
@@ -1,7 +1,7 @@
1
1
  import { type BackgroundAgentRecord, type RunnerDeps, type ToolExecuteContext } from "@sema-agent/core";
2
2
  import type { ServiceConfig } from "../config.js";
3
3
  import type { RunnerDepsOnAsk } from "./runner-deps.js";
4
- import { type ApprovalBaselineConfigView, type DeploymentGovernanceConfigView, type LiveQuestionFace } from "../deployment-governance.js";
4
+ import { type ApprovalBaselineConfigView, type DeploymentGovernanceConfigView } from "../deployment-governance.js";
5
5
  import { type SandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
6
6
  import type { ApprovalExemptionStore } from "../plugins/approval-exemption-store.js";
7
7
  /** 本腿读的配置切面(`ServiceConfig` 结构满足)。两个构造口各自的切面 + lane 判别式读的 `remoteExec`。 */
@@ -15,9 +15,9 @@ export interface ParkedReviveGateConfigView extends DeploymentGovernanceConfigVi
15
15
  export interface ParkedReviveGateDeps {
16
16
  /** ⚠️ **活引用**:热改字段(autonomy/commandPolicy/守卫集/审批四旋钮)每次赎回现读,见下方「禁 memoize」。 */
17
17
  readonly config: ParkedReviveGateConfigView;
18
- /** [ref]:活体 AskUserQuestion 面。赎回腿今天无 ALS ctx ⇒ 判 ask,与原形同判。
19
- * ⚠️ 它同时是**决议链元数据** `contentMandate` 的唯一判据(见 {@link mandatePostureOf})。 */
20
- readonly question: LiveQuestionFace | undefined;
18
+ /** 问题席在场(与 resolve-spec 的 `questionSeat` 同一位,装配点递的是同一只协调器的在场性)。
19
+ * 它是**决议链元数据** `contentMandate` 的唯一判据(见 {@link chainMetadataOf})。 */
20
+ readonly questionSeat: boolean;
21
21
  /**
22
22
  * 部署级活体审批席 —— `RunnerDeps.onAsk` 的**同源铸法**(main.ts 递 `createRunnerDepsOnAsk(toolApproval)`,
23
23
  * 单一属主同 boot/runner-deps.ts)。
@@ -90,7 +90,7 @@ export type RebuiltParentConstraint = NonNullable<RebuiltInheritedGate["parentCo
90
90
  /**
91
91
  * 赎回腿的父约束链重建([ref] 件二)。
92
92
  *
93
- * 语义:**同/跨副本一致地重建「部署 ⊇ 操作员」两层完整链**——审批基线(durable question 门 + F4 高危写
93
+ * 语义:**同/跨副本一致地重建「部署 ⊇ 操作员」两层完整链**——审批基线(core 的问答策略 + F4 高危写
94
94
  * 审批门 + 部署名单那一问的豁免读面)作 base 的 `toolPolicy` 座,经**折叠属主** `applyRuntimeGovernance`
95
95
  * (→ core `tightenTaskSpec`)叠上部署治理段(autonomy / commandPolicy / MANUAL_MODE_SHELL_GATE /
96
96
  * 守卫集),取其 `toolPolicy` 装进单层 `parentConstraints`。
@@ -13,7 +13,7 @@ function hostGateCwd(config, localRoot) {
13
13
  return join(config.localDataRoot ?? localRoot, "parked-revive-unrooted");
14
14
  }
15
15
  export function createParkedReviveInheritedGate(deps) {
16
- const { config, question, approvalExemptionStore, logger, localRoot, approverSeat } = deps;
16
+ const { config, approvalExemptionStore, logger, localRoot, approverSeat } = deps;
17
17
  const slots = deps.slots ?? sandboxPathEnvSlots;
18
18
  return async (row, identity) => {
19
19
  const metadata = await chainMetadataOf(deps, row, identity);
@@ -32,7 +32,6 @@ export function createParkedReviveInheritedGate(deps) {
32
32
  const rootSessionId = row.rootSessionId;
33
33
  const baseline = createApprovalBaselinePolicy(config, {
34
34
  kind: "durable",
35
- question,
36
35
  ...(approvalExemptionStore !== undefined && rootSessionId ? { exemption: createSessionExemptionRead(approvalExemptionStore, rootSessionId, logger, "deployment_list", "parked_revive") } : {}),
37
36
  });
38
37
  const governed = applyRuntimeGovernance({ objective: "", toolPolicy: baseline }, createDeploymentGovernanceInputs(config, pathAdjudication));
@@ -53,7 +52,7 @@ async function chainMetadataOf(deps, row, identity) {
53
52
  const forced = caps?.forceDurableGate === true;
54
53
  return {
55
54
  ...(forced || deps.approverSeat === undefined ? { durableMandate: true } : {}),
56
- ...(forced || deps.question === undefined ? { contentMandate: true } : {}),
55
+ ...(forced || !deps.questionSeat ? { contentMandate: true } : {}),
57
56
  ...autoModePostureOf(deps, row, caps),
58
57
  };
59
58
  }
@@ -28,6 +28,7 @@ import type { ToolApprovalCoordinator } from "../tool-approval.js";
28
28
  import type { ParkCommitWatch } from "../plugins/park-commit-watch.js";
29
29
  import { type SandboxReaper } from "../plugins/sandbox-reaper.js";
30
30
  import { type AuditRotationPort } from "../approval-ask-retention.js";
31
+ import type { HolderPullTally } from "../orchestration/workflow-park-holder.js";
31
32
  /** [ref] / [ref]§五(sema-comms `audits/failopen-governance-176.md` §7 "Z 类 1 条"):default consecutive-failure
32
33
  * count before a reaper leg's swallowed error gets a `warn` line. The ~15 `.catch(() => undefined)` sites
33
34
  * below are correct in DIRECTION (a hiccuping periodic sweep must never crash the whole tick loop — one bad
@@ -103,6 +104,8 @@ export interface ReapersCtx {
103
104
  * `TOOL_APPROVAL_ENABLED=false` 的部署恒 undefined ⇒ 收敛器照常收敛,只是不发通知帧(壳侧靠
104
105
  * 重连 preamble 对账,见 approval-card.ts 的 `ApprovalRevokeFrame` 顶注)。 */
105
106
  toolApproval: ToolApprovalCoordinator | undefined;
107
+ /** workflow 停驻卡持有进程的拉取腿(`orchestration/workflow-park-holder.ts`;第 8 段按决定店 / 执行器视图在场装配)。缺席 = 没有 workflow 停驻车道 ⇒ 本腿零调用。 */
108
+ workflowParkHolderPull?: () => Promise<HolderPullTally>;
106
109
  /** [ref]:规则店的**保留期口**。`PERMISSION_RULES_ENABLED=false` 或后端没实装 ⇒ undefined
107
110
  * ⇒ 本腿根本不注册(零扫描),与它的同族旋钮腿同姿势。
108
111
  *
@@ -122,6 +125,8 @@ export interface ReapersCtx {
122
125
  approvalAskAudit: AuditRotationPort | undefined;
123
126
  /** 晚绑(server 造出来才有)——见文件头「位置即契约」①。 */
124
127
  getRunDenySweep: () => ((now: number) => Promise<void>) | undefined;
128
+ /** 会话老化腿(晚绑:它要的删除协调器在第 9 段铸,`late-binds.ts` 的 `sessionAgeOut`)。缺席 = 这台部署记不了会话种类 / 还没绑 ⇒ 本腿零调用。 */
129
+ getSessionAgeOut?: () => (() => Promise<unknown>) | undefined;
125
130
  /** 本车道的沙箱回收座(`plugins/sandbox-reaper.ts`;第 5 段与 run 工厂同一份车道配置铸):k8s 车道 = 沙箱 Pod reaper(`plugins/k8s-pod-reaper.ts`),local-docker 车道 = 无主容器 reaper
126
131
  * (`plugins/local-docker-reaper.ts`)。缺席 = 别的车道 ⇒ 本腿零调用。一次部署一条执行车道 ⇒ 一只座、一个节拍。 */
127
132
  sandboxReaper?: SandboxReaper;
@@ -86,7 +86,7 @@ export function createPlacementAwareReapSessions(deps) {
86
86
  };
87
87
  }
88
88
  export function startReapers(ctx) {
89
- const { config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits, rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap, workflowNotifyGate, workflowRecoverOpts, sqlWorkflowRunStore, workflowNotifyJournal, backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, getRunDenySweep, userInputLedger, approvalAskAudit, sandboxReaper, } = ctx;
89
+ const { config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits, rateLimiter, costQuota, storeSweep, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap, workflowNotifyGate, workflowRecoverOpts, sqlWorkflowRunStore, workflowNotifyJournal, backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, getRunDenySweep, getSessionAgeOut, userInputLedger, approvalAskAudit, sandboxReaper, workflowParkHolderPull, } = ctx;
90
90
  const leg = (p) => {
91
91
  if (p !== undefined)
92
92
  trackMaintenanceLeg(p);
@@ -119,6 +119,7 @@ export function startReapers(ctx) {
119
119
  const approvalNonceReapExpiredGuard = createThrottledReaperCatch("approval_nonce_reap_expired", logger);
120
120
  const runsFailSuspendedExpiredCheckpointGuard = createThrottledReaperCatch("runs_fail_suspended_expired_checkpoint", logger);
121
121
  const runDenySweepGuard = createThrottledReaperCatch("run_deny_sweep", logger);
122
+ const sessionAgeOutGuard = createThrottledReaperCatch("session_age_out", logger);
122
123
  const runsReapSuspendedGuard = createThrottledReaperCatch("runs_reap_suspended", logger);
123
124
  const checkpointReapCtxGuard = createThrottledReaperCatch("checkpoint_reap_ctx", logger);
124
125
  const storeSweepGuards = {
@@ -158,6 +159,8 @@ export function startReapers(ctx) {
158
159
  const approvalReconcileGuard = createThrottledReaperCatch("approval_reconcile", logger);
159
160
  const approvalSuspendedPollGuard = createThrottledReaperCatch("approval_suspended_poll", logger);
160
161
  let approvalSuspendedPollInFlight = false;
162
+ const workflowParkHolderPullGuard = createThrottledReaperCatch("workflow_park_holder_pull", logger);
163
+ let workflowParkHolderPullInFlight = false;
161
164
  const permissionRuleReapGuard = createThrottledReaperCatch("permission_rule_reap_expired", logger);
162
165
  let permissionRuleReapInFlight = false;
163
166
  let approvalReconcileInFlight = false;
@@ -265,6 +268,8 @@ export function startReapers(ctx) {
265
268
  leg(getRunDenySweep()?.(Date.now())
266
269
  .then(() => runDenySweepGuard.onSuccess(), runDenySweepGuard.onError));
267
270
  }
271
+ leg(getSessionAgeOut?.()?.()
272
+ .then(() => sessionAgeOutGuard.onSuccess(), sessionAgeOutGuard.onError));
268
273
  leg(approvalNonceStore
269
274
  ?.reapExpired()
270
275
  .then(reapCount("approval_nonces_reaped_total", {}))
@@ -360,6 +365,12 @@ export function startReapers(ctx) {
360
365
  .then(() => approvalSuspendedPollGuard.onSuccess(), approvalSuspendedPollGuard.onError)
361
366
  .finally(() => (approvalSuspendedPollInFlight = false)));
362
367
  }
368
+ if (workflowParkHolderPull && !workflowParkHolderPullInFlight) {
369
+ workflowParkHolderPullInFlight = true;
370
+ leg(workflowParkHolderPull()
371
+ .then(() => workflowParkHolderPullGuard.onSuccess(), workflowParkHolderPullGuard.onError)
372
+ .finally(() => (workflowParkHolderPullInFlight = false)));
373
+ }
363
374
  if (!permissionRuleReapInFlight) {
364
375
  permissionRuleReapInFlight = true;
365
376
  leg(permissionRuleStores
@@ -3,7 +3,6 @@ import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
3
3
  import { selectScenario } from "../capabilities/scenarios.js";
4
4
  import type { LoadedSkill } from "../capabilities/skills.js";
5
5
  import type { ServiceConfig } from "../config.js";
6
- import { type LiveQuestionFace } from "../deployment-governance.js";
7
6
  import { FleetEventBus } from "../fleet/fleet-bus.js";
8
7
  import { type HookLlmCall } from "../hooks/hook-runner.js";
9
8
  import type { createHookLlm } from "../hooks/hook-llm.js";
@@ -34,9 +33,9 @@ export interface ResolveSpecCtx {
34
33
  /** 活引用(registry 热应用换引用)—— 见文件头「位置即契约」。 */
35
34
  getKeyResolver: () => ReturnType<typeof createKeyResolver>;
36
35
  taskAttachmentStore: TaskAttachmentStore | undefined;
37
- perSessionCwd: Map<string, string>;
38
- setSessionCwd: (sid: string, cwd: string) => void;
39
- setSessionShellEnv: (sid: string, env: Record<string, string>) => void;
36
+ /** 会话登记簿的工作目录那一格(**只读**:这条腿没带工作目录时它是会话上已登记的那一枚)。会话绑定(cwd / shellEnv / inheritEnv)本装配器只判、只算
37
+ * (`LegFacts.sessionBindings`),写在路由层 run 认领之后的唯一提交点(`session-bindings.ts` 的 `commitLegBindings`)—— 律见那只文件头注。 */
38
+ perSessionCwd: ReadonlyMap<string, string>;
40
39
  /** 两张 per-session 登记簿的**租户围栏**(codex R1-F1):每次提交对拍本会话的主人,换主即清。
41
40
  * 论证(为什么 device lane 把这条从「不需要」变成「必需」)逐字见 `createSessionScopedRegistries` 头注。 */
42
41
  fenceSessionOwner: (sid: string, owner: string | null, incarnation?: string) => void;
@@ -64,10 +63,10 @@ export interface ResolveSpecCtx {
64
63
  /** [ref]:记忆同步腿(开 `MEMORY_SYNC_*` 且记忆引擎接线时在场)—— 项目层准备一步把本任务的项目层交给它跟踪(`memory-project-layer.ts`)。 */
65
64
  memorySyncRunner: MemorySyncRunner | undefined;
66
65
  durableEnabled: boolean;
67
- /** [ref] ([ref] 案二):活体 AskUserQuestion 面(QuestionCoordinator 的判决探针切面)。在场(=
68
- * ASK_QUESTION_ENABLED)时 durable question 门按活流上下文分腿、spec 不再 stamp QUESTION_AWAITS_RESUME
69
- * (否则 spec.onQuestion 恒遮蔽 RunnerDeps.onQuestion 的活人腿);缺席时行为与旧形逐字一致。 */
70
- liveQuestionFace: LiveQuestionFace | undefined;
66
+ /** 问题席在场(= `ASK_QUESTION_ENABLED` 装了 `QuestionCoordinator`,`RunnerDeps.onQuestion` 是它):本仓「问题席在不在」这一事实的**一位**,
67
+ * 三个读者同读 —— 本文件的 posture 判据与 sentinel 铸不铸、赎回链的 `contentMandate`(`parked-revive-gate.ts`)。在场 ⇒ spec 不铸
68
+ * `QUESTION_AWAITS_RESUME`(否则 `spec.onQuestion` 恒遮蔽 `RunnerDeps.onQuestion` 的问题席);落点归 core 的同步优先。 */
69
+ questionSeat: boolean;
71
70
  /**
72
71
  * [ref] 件C —— 部署级**活体审批席**(`RunnerDeps.onAsk` 的同源铸法,main.ts 递
73
72
  * `createRunnerDepsOnAsk(toolApproval)`;单一属主同 `boot/runner-deps.ts`,与 `parked-revive-gate.ts`