@sema-agent/server 7.132.0 → 7.133.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 (402) hide show
  1. package/MIGRATION.md +266 -0
  2. package/README.md +8 -9
  3. package/README.zh-CN.md +7 -6
  4. package/USAGE.md +174 -55
  5. package/deploy/sema-up/README.md +19 -1
  6. package/deploy/sema-up/chart/templates/server-v4pro.yaml +5 -2
  7. package/deploy/sema-up/chart/templates/server.yaml +5 -2
  8. package/deploy/sema-up/stack/compose.yaml +3 -0
  9. package/deploy/sema-up/stack/sema-stack-cluster.yaml +4 -2
  10. package/dist/adoption/plan.d.ts +3 -2
  11. package/dist/adoption/plan.js +7 -5
  12. package/dist/adoption/runner.js +3 -10
  13. package/dist/adoption/sql.d.ts +3 -2
  14. package/dist/adoption/sql.js +3 -5
  15. package/dist/adoption/wire.d.ts +4 -1
  16. package/dist/adoption/wire.js +1 -0
  17. package/dist/approval-ask-audit-store.d.ts +31 -13
  18. package/dist/approval-ask-audit-store.js +272 -74
  19. package/dist/approval-ask-machine.d.ts +15 -0
  20. package/dist/approval-ask-machine.js +6 -0
  21. package/dist/approval-ask-retention.d.ts +136 -0
  22. package/dist/approval-ask-retention.js +102 -0
  23. package/dist/approval-card.d.ts +79 -19
  24. package/dist/approval-card.js +44 -13
  25. package/dist/approval-deny-reasons.d.ts +1 -1
  26. package/dist/approval.d.ts +9 -0
  27. package/dist/approval.js +24 -3
  28. package/dist/audit.d.ts +27 -10
  29. package/dist/audit.js +12 -16
  30. package/dist/bake-runner/main.js +3 -2
  31. package/dist/boot/deferred-sandbox-path-env.js +1 -1
  32. package/dist/boot/execution-env.js +9 -7
  33. package/dist/boot/execution-lane.js +11 -0
  34. package/dist/boot/leader.js +2 -0
  35. package/dist/boot/memory-boundary.js +2 -2
  36. package/dist/boot/memory-consolidation.d.ts +5 -4
  37. package/dist/boot/memory-consolidation.js +7 -6
  38. package/dist/boot/org-delivery.d.ts +28 -0
  39. package/dist/boot/org-delivery.js +20 -0
  40. package/dist/boot/reapers.d.ts +3 -0
  41. package/dist/boot/reapers.js +21 -1
  42. package/dist/boot/resolve-spec.d.ts +3 -0
  43. package/dist/boot/resolve-spec.js +60 -81
  44. package/dist/boot/runner-deps.js +1 -0
  45. package/dist/boot/session-faces.d.ts +1 -0
  46. package/dist/boot/session-faces.js +4 -2
  47. package/dist/boot/stage-02-web-admin-pull.js +4 -1
  48. package/dist/boot/stage-06-runners.d.ts +2 -0
  49. package/dist/boot/stage-06-runners.js +6 -3
  50. package/dist/boot/stage-07-capability-layer.d.ts +2 -0
  51. package/dist/boot/stage-07-capability-layer.js +24 -3
  52. package/dist/boot/stage-08-reapers.d.ts +2 -0
  53. package/dist/boot/stage-08-reapers.js +2 -2
  54. package/dist/boot/stage-09-leader.d.ts +3 -0
  55. package/dist/boot/stage-10-http-server.d.ts +3 -0
  56. package/dist/boot/stage-10-http-server.js +5 -6
  57. package/dist/boot/stores.js +2 -2
  58. package/dist/boot/web-admin.d.ts +4 -0
  59. package/dist/boot/web-admin.js +151 -63
  60. package/dist/boot/workflow-orchestration.d.ts +2 -0
  61. package/dist/boot/workflow-orchestration.js +2 -1
  62. package/dist/brain.js +8 -3
  63. package/dist/breaker-key.d.ts +6 -0
  64. package/dist/breaker-key.js +29 -0
  65. package/dist/caller-text-echo.d.ts +9 -6
  66. package/dist/caller-text-echo.js +8 -11
  67. package/dist/capabilities/center-plugins.d.ts +7 -0
  68. package/dist/capabilities/center-plugins.js +1 -1
  69. package/dist/capabilities/composite-members.d.ts +1 -1
  70. package/dist/capabilities/composite-members.js +1 -1
  71. package/dist/capabilities/execution-lane.js +2 -2
  72. package/dist/capabilities/hands-lane.d.ts +21 -0
  73. package/dist/capabilities/hands-lane.js +10 -0
  74. package/dist/capabilities/mcp-probe.d.ts +36 -4
  75. package/dist/capabilities/mcp-probe.js +27 -4
  76. package/dist/capabilities/scenarios.d.ts +63 -7
  77. package/dist/capabilities/scenarios.js +39 -7
  78. package/dist/capability-facts.d.ts +34 -4
  79. package/dist/capability-facts.js +28 -2
  80. package/dist/center-config-tier.d.ts +69 -0
  81. package/dist/center-config-tier.js +42 -0
  82. package/dist/checkpoint-identity.d.ts +16 -0
  83. package/dist/checkpoint-identity.js +19 -0
  84. package/dist/config-catalog.d.ts +17 -10
  85. package/dist/config-catalog.js +43 -28
  86. package/dist/config-d-migration.d.ts +3 -1
  87. package/dist/config-d-migration.js +2 -2
  88. package/dist/config-dir-trust.d.ts +114 -0
  89. package/dist/config-dir-trust.js +388 -0
  90. package/dist/config-invariants.d.ts +18 -5
  91. package/dist/config-invariants.js +35 -3
  92. package/dist/config-provider.d.ts +6 -1
  93. package/dist/config-provider.js +6 -2
  94. package/dist/config-types.d.ts +71 -14
  95. package/dist/config-types.js +8 -0
  96. package/dist/config.d.ts +13 -0
  97. package/dist/config.js +121 -59
  98. package/dist/delegated-session-owner.d.ts +185 -0
  99. package/dist/delegated-session-owner.js +119 -0
  100. package/dist/device-protocol.d.ts +5 -3
  101. package/dist/device-protocol.js +1 -1
  102. package/dist/device-ws-hub.js +21 -2
  103. package/dist/device-ws-protocol.d.ts +70 -6
  104. package/dist/device-ws-protocol.js +50 -23
  105. package/dist/elicitation.js +3 -2
  106. package/dist/entry-problems.d.ts +34 -0
  107. package/dist/entry-problems.js +14 -0
  108. package/dist/execution-lane-caps.d.ts +49 -10
  109. package/dist/execution-lane-caps.js +43 -4
  110. package/dist/field-conflict.d.ts +43 -0
  111. package/dist/field-conflict.js +20 -0
  112. package/dist/fleet/fleet-bus.d.ts +80 -6
  113. package/dist/fleet/fleet-bus.js +41 -9
  114. package/dist/hooks/classic-stations.d.ts +10 -5
  115. package/dist/hooks/classic-stations.js +4 -4
  116. package/dist/hooks/command-spawn.d.ts +57 -0
  117. package/dist/hooks/command-spawn.js +139 -0
  118. package/dist/hooks/hook-llm.js +2 -2
  119. package/dist/hooks/hook-runner.d.ts +127 -25
  120. package/dist/hooks/hook-runner.js +668 -287
  121. package/dist/hooks/hook-source.d.ts +44 -0
  122. package/dist/hooks/hook-source.js +40 -0
  123. package/dist/http/active-run-conflict.d.ts +5 -13
  124. package/dist/http/active-run-conflict.js +17 -27
  125. package/dist/http/admission.js +103 -60
  126. package/dist/http/approval-sweeps.js +55 -18
  127. package/dist/http/caller-trust.d.ts +77 -0
  128. package/dist/http/caller-trust.js +143 -0
  129. package/dist/http/checkpoint-ctx.d.ts +16 -16
  130. package/dist/http/checkpoint-ctx.js +13 -10
  131. package/dist/http/claimed-run.d.ts +4 -3
  132. package/dist/http/device-placement.d.ts +2 -4
  133. package/dist/http/device-placement.js +2 -1
  134. package/dist/http/dispatch.js +10 -4
  135. package/dist/http/durable-run-leg.d.ts +4 -32
  136. package/dist/http/durable-run-leg.js +34 -10
  137. package/dist/http/owner-access.d.ts +56 -0
  138. package/dist/http/owner-access.js +42 -0
  139. package/dist/http/principal-gate.d.ts +48 -23
  140. package/dist/http/principal-gate.js +39 -12
  141. package/dist/http/readiness.d.ts +11 -5
  142. package/dist/http/readiness.js +10 -3
  143. package/dist/http/request-guards.d.ts +16 -23
  144. package/dist/http/request-guards.js +30 -15
  145. package/dist/http/resume-ctx-read.d.ts +2 -5
  146. package/dist/http/resume-ctx-read.js +7 -4
  147. package/dist/http/resume-legs.d.ts +3 -4
  148. package/dist/http/resume-legs.js +126 -69
  149. package/dist/http/retired-service-deps.d.ts +43 -0
  150. package/dist/http/retired-service-deps.js +18 -0
  151. package/dist/http/route-ctx.d.ts +44 -28
  152. package/dist/http/route-ctx.js +4 -0
  153. package/dist/http/route-table.js +2 -0
  154. package/dist/http/routes/a2a-serve.js +3 -4
  155. package/dist/http/routes/admin-config-refresh.js +1 -1
  156. package/dist/http/routes/admin-drain.js +1 -1
  157. package/dist/http/routes/admin-memory-optout.js +5 -1
  158. package/dist/http/routes/adoption.js +2 -9
  159. package/dist/http/routes/approvals-assistant.js +49 -48
  160. package/dist/http/routes/background.js +3 -2
  161. package/dist/http/routes/capabilities.js +20 -4
  162. package/dist/http/routes/config-catalog.d.ts +3 -3
  163. package/dist/http/routes/config-catalog.js +1 -1
  164. package/dist/http/routes/devices.js +3 -17
  165. package/dist/http/routes/diagnostics.js +5 -1
  166. package/dist/http/routes/images.js +6 -7
  167. package/dist/http/routes/leader.js +1 -8
  168. package/dist/http/routes/mcp-reconnect.d.ts +1 -1
  169. package/dist/http/routes/mcp-reconnect.js +3 -2
  170. package/dist/http/routes/memory-bundle.js +1 -1
  171. package/dist/http/routes/memory-compliance.js +1 -1
  172. package/dist/http/routes/memory-consolidation.js +1 -1
  173. package/dist/http/routes/memory-origin.js +1 -1
  174. package/dist/http/routes/memory-policy.d.ts +1 -1
  175. package/dist/http/routes/memory-policy.js +3 -2
  176. package/dist/http/routes/notify-wake.js +8 -21
  177. package/dist/http/routes/observability.js +2 -2
  178. package/dist/http/routes/principal-inbox.d.ts +39 -0
  179. package/dist/http/routes/principal-inbox.js +76 -0
  180. package/dist/http/routes/retention-ops.js +2 -9
  181. package/dist/http/routes/rules.js +5 -18
  182. package/dist/http/routes/runs.d.ts +5 -0
  183. package/dist/http/routes/runs.js +33 -106
  184. package/dist/http/routes/session-sync.js +15 -28
  185. package/dist/http/routes/sessions.js +30 -40
  186. package/dist/http/routes/side-query.js +6 -4
  187. package/dist/http/routes/tasks.js +50 -14
  188. package/dist/http/routes/workflows.d.ts +351 -0
  189. package/dist/http/routes/workflows.js +153 -119
  190. package/dist/http/send.d.ts +24 -3
  191. package/dist/http/send.js +14 -2
  192. package/dist/http/server.d.ts +17 -18
  193. package/dist/http/server.js +15 -13
  194. package/dist/http/stored-body-replay.js +17 -4
  195. package/dist/http/submit-ctx.js +4 -3
  196. package/dist/http/submit-replay.d.ts +4 -3
  197. package/dist/http/submit-replay.js +5 -4
  198. package/dist/http/wire-types.d.ts +10 -7
  199. package/dist/index.d.ts +1 -1
  200. package/dist/index.js +0 -1
  201. package/dist/lane-home-probe.d.ts +78 -9
  202. package/dist/lane-home-probe.js +78 -12
  203. package/dist/leader/endpoint.d.ts +4 -1
  204. package/dist/leader/endpoint.js +11 -10
  205. package/dist/limit-refusal.d.ts +17 -5
  206. package/dist/limit-refusal.js +4 -1
  207. package/dist/mcp-assertion-header.d.ts +31 -10
  208. package/dist/mcp-assertion-header.js +10 -3
  209. package/dist/mcp-tool-faces.js +1 -3
  210. package/dist/memory-project-layer.d.ts +37 -0
  211. package/dist/memory-project-layer.js +46 -0
  212. package/dist/memory-scope.d.ts +23 -16
  213. package/dist/memory-scope.js +24 -8
  214. package/dist/memory-sync-client.d.ts +27 -13
  215. package/dist/memory-sync-client.js +107 -18
  216. package/dist/model-entry-refusal.d.ts +9 -1
  217. package/dist/model-entry-refusal.js +6 -1
  218. package/dist/model-plane-face.d.ts +51 -0
  219. package/dist/model-plane-face.js +24 -0
  220. package/dist/model-provider.d.ts +5 -0
  221. package/dist/model-provider.js +4 -2
  222. package/dist/model-route-endpoint.d.ts +8 -11
  223. package/dist/model-route-endpoint.js +4 -7
  224. package/dist/model-route-env.d.ts +22 -0
  225. package/dist/model-route-env.js +2 -0
  226. package/dist/model-route-gap.d.ts +60 -30
  227. package/dist/model-route-gap.js +21 -15
  228. package/dist/observability/corrupt-read-seat.d.ts +7 -0
  229. package/dist/observability/corrupt-read-seat.js +9 -0
  230. package/dist/observability/err-text.d.ts +6 -0
  231. package/dist/observability/err-text.js +18 -4
  232. package/dist/observability/fail-open.d.ts +35 -9
  233. package/dist/observability/fail-open.js +35 -9
  234. package/dist/observability/metrics.js +1 -0
  235. package/dist/observability/prompt-manifest.d.ts +3 -17
  236. package/dist/observability/prompt-manifest.js +45 -42
  237. package/dist/observability/tool-trace.js +9 -9
  238. package/dist/operator-ask.d.ts +10 -0
  239. package/dist/operator-ask.js +3 -0
  240. package/dist/orchestration/workflow-agent-session-index.d.ts +12 -12
  241. package/dist/orchestration/workflow-agent-session-index.js +9 -13
  242. package/dist/orchestration/workflow-completion-inbox.d.ts +42 -15
  243. package/dist/orchestration/workflow-completion-inbox.js +13 -0
  244. package/dist/orchestration/workflow-notify-journal.d.ts +13 -32
  245. package/dist/orchestration/workflow-notify-journal.js +27 -34
  246. package/dist/orchestration/workflow-park-decision.d.ts +89 -0
  247. package/dist/orchestration/workflow-park-decision.js +118 -0
  248. package/dist/org-delivery-gate.d.ts +81 -0
  249. package/dist/org-delivery-gate.js +59 -0
  250. package/dist/panel-tool-names.d.ts +23 -0
  251. package/dist/panel-tool-names.js +8 -0
  252. package/dist/parked-decide.d.ts +39 -6
  253. package/dist/parked-decide.js +98 -51
  254. package/dist/parked-revive-surface.d.ts +9 -2
  255. package/dist/parked-revive-surface.js +11 -8
  256. package/dist/permission-rule-list.d.ts +1 -1
  257. package/dist/permission-rule-list.js +2 -2
  258. package/dist/plugins/approval-ask-store-file.d.ts +16 -1
  259. package/dist/plugins/approval-ask-store-file.js +21 -0
  260. package/dist/plugins/approval-ask-store-memory.d.ts +18 -1
  261. package/dist/plugins/approval-ask-store-memory.js +34 -2
  262. package/dist/plugins/approval-ask-store-sql.d.ts +25 -0
  263. package/dist/plugins/approval-ask-store-sql.js +37 -1
  264. package/dist/plugins/blob-backend.d.ts +38 -25
  265. package/dist/plugins/blob-backend.js +29 -19
  266. package/dist/plugins/breaker-state-sql.d.ts +2 -2
  267. package/dist/plugins/breaker-state-sql.js +4 -4
  268. package/dist/plugins/caching-session-store.d.ts +3 -0
  269. package/dist/plugins/caching-session-store.js +3 -0
  270. package/dist/plugins/checkpoint-store-sql.d.ts +14 -0
  271. package/dist/plugins/checkpoint-store-sql.js +20 -2
  272. package/dist/plugins/file-history-store-sql.d.ts +5 -2
  273. package/dist/plugins/file-history-store-sql.js +3 -1
  274. package/dist/plugins/file-run-store.d.ts +5 -13
  275. package/dist/plugins/file-run-store.js +9 -0
  276. package/dist/plugins/fork-routing-session-store.d.ts +9 -1
  277. package/dist/plugins/fork-routing-session-store.js +12 -1
  278. package/dist/plugins/host-platform.d.ts +2 -0
  279. package/dist/plugins/host-platform.js +2 -1
  280. package/dist/plugins/local-checkpoint-store.d.ts +2 -0
  281. package/dist/plugins/local-checkpoint-store.js +6 -1
  282. package/dist/plugins/local-session-store.d.ts +1 -1
  283. package/dist/plugins/local-session-window.d.ts +39 -0
  284. package/dist/plugins/local-session-window.js +54 -0
  285. package/dist/plugins/mailbox-recipient-lifecycle.d.ts +3 -2
  286. package/dist/plugins/mailbox-store-sql.d.ts +30 -48
  287. package/dist/plugins/mailbox-store-sql.js +77 -52
  288. package/dist/plugins/memory-embedder-fingerprint.js +2 -1
  289. package/dist/plugins/memory-run-store.d.ts +5 -13
  290. package/dist/plugins/memory-run-store.js +8 -0
  291. package/dist/plugins/one-time-migrations.d.ts +110 -5
  292. package/dist/plugins/one-time-migrations.js +320 -8
  293. package/dist/plugins/org-delivery-quota-store.d.ts +123 -0
  294. package/dist/plugins/org-delivery-quota-store.js +228 -0
  295. package/dist/plugins/pg-pool.js +39 -7
  296. package/dist/plugins/pg-session-storage.d.ts +17 -4
  297. package/dist/plugins/pg-session-storage.js +29 -6
  298. package/dist/plugins/remote-env-adb.d.ts +6 -12
  299. package/dist/plugins/remote-env-adb.js +12 -2
  300. package/dist/plugins/remote-env-k8s.d.ts +8 -12
  301. package/dist/plugins/remote-env-k8s.js +23 -5
  302. package/dist/plugins/remote-env-local-docker.d.ts +10 -15
  303. package/dist/plugins/remote-env-local-docker.js +12 -9
  304. package/dist/plugins/remote-env-ssh.d.ts +10 -16
  305. package/dist/plugins/remote-env-ssh.js +17 -11
  306. package/dist/plugins/run-store-sql.d.ts +16 -14
  307. package/dist/plugins/run-store-sql.js +22 -2
  308. package/dist/plugins/schema-indexes.js +2 -0
  309. package/dist/plugins/send-user-file.js +2 -2
  310. package/dist/plugins/session-epoch-anchor.d.ts +32 -6
  311. package/dist/plugins/session-epoch-anchor.js +2 -3
  312. package/dist/plugins/session-store.d.ts +18 -8
  313. package/dist/plugins/session-store.js +15 -4
  314. package/dist/plugins/sql-driver.d.ts +74 -11
  315. package/dist/plugins/sql-driver.js +210 -12
  316. package/dist/plugins/sql-errors.d.ts +23 -0
  317. package/dist/plugins/sql-errors.js +21 -0
  318. package/dist/plugins/store-backend.d.ts +36 -1
  319. package/dist/plugins/store-backend.js +40 -14
  320. package/dist/plugins/store-contracts.d.ts +42 -0
  321. package/dist/plugins/store-contracts.js +1 -0
  322. package/dist/plugins/tidb-pool.d.ts +6 -1
  323. package/dist/plugins/tidb-pool.js +44 -10
  324. package/dist/plugins/tidb-session-storage.d.ts +3 -2
  325. package/dist/plugins/tidb-session-storage.js +2 -2
  326. package/dist/plugins/tidb-session-store.d.ts +24 -4
  327. package/dist/plugins/tidb-session-store.js +28 -4
  328. package/dist/plugins/workflow-journal-store-sql.d.ts +73 -19
  329. package/dist/plugins/workflow-journal-store-sql.js +19 -6
  330. package/dist/plugins/workflow-run-store-sql.d.ts +30 -8
  331. package/dist/plugins/workflow-run-store-sql.js +50 -9
  332. package/dist/posture-source.d.ts +18 -10
  333. package/dist/posture-source.js +4 -1
  334. package/dist/project-identity.d.ts +45 -6
  335. package/dist/project-identity.js +162 -8
  336. package/dist/project-layer-key.d.ts +28 -0
  337. package/dist/project-layer-key.js +29 -0
  338. package/dist/question.js +3 -2
  339. package/dist/read-deny-entry.d.ts +25 -0
  340. package/dist/read-deny-entry.js +12 -0
  341. package/dist/read-face-posture.d.ts +37 -11
  342. package/dist/read-face-posture.js +32 -3
  343. package/dist/request-key-closure.d.ts +7 -0
  344. package/dist/request-key-closure.js +9 -1
  345. package/dist/request-value-closure.d.ts +5 -0
  346. package/dist/request-value-closure.js +11 -3
  347. package/dist/rule-entry-list.d.ts +26 -2
  348. package/dist/rule-entry-list.js +72 -12
  349. package/dist/rules-consent.js +3 -4
  350. package/dist/run-acceptance.d.ts +19 -3
  351. package/dist/run-acceptance.js +13 -1
  352. package/dist/run-local.js +36 -6
  353. package/dist/runs.d.ts +10 -9
  354. package/dist/runs.js +21 -3
  355. package/dist/runtime-caps-resolver.d.ts +16 -6
  356. package/dist/runtime-caps-resolver.js +18 -5
  357. package/dist/sandbox-pkg-source.d.ts +19 -1
  358. package/dist/sandbox-pkg-source.js +29 -7
  359. package/dist/security.d.ts +87 -9
  360. package/dist/security.js +52 -9
  361. package/dist/session-error-wire.d.ts +19 -2
  362. package/dist/session-error-wire.js +5 -1
  363. package/dist/session-titled-frame.d.ts +33 -0
  364. package/dist/session-titled-frame.js +4 -0
  365. package/dist/session-titler.d.ts +9 -1
  366. package/dist/session-titler.js +15 -4
  367. package/dist/spec-fields.js +21 -2
  368. package/dist/sql-engine-posture.d.ts +3 -1
  369. package/dist/task-cwd.d.ts +1 -1
  370. package/dist/task-mcp.d.ts +3 -3
  371. package/dist/task-mcp.js +7 -66
  372. package/dist/task-settings.d.ts +89 -88
  373. package/dist/task-settings.js +71 -63
  374. package/dist/text-bidi.d.ts +0 -4
  375. package/dist/text-bidi.js +1 -3
  376. package/dist/tighten-only-seats.d.ts +150 -0
  377. package/dist/tighten-only-seats.js +196 -0
  378. package/dist/tool-approval.d.ts +303 -87
  379. package/dist/tool-approval.js +623 -239
  380. package/dist/trace/core-keyset-guard.d.ts +104 -22
  381. package/dist/trace/exit-seat.d.ts +28 -0
  382. package/dist/trace/exit-seat.js +76 -0
  383. package/dist/trace/ledger-events.d.ts +3 -2
  384. package/dist/trace/project.d.ts +80 -12
  385. package/dist/trace/project.js +41 -28
  386. package/dist/trace/projection-table.d.ts +100 -0
  387. package/dist/trace/projection-table.js +130 -0
  388. package/dist/trace/redact.d.ts +54 -0
  389. package/dist/trace/redact.js +778 -152
  390. package/dist/trace/self-minted-wire.d.ts +345 -1
  391. package/dist/trace/self-minted-wire.js +117 -1
  392. package/dist/trace/wire-projection-faces.d.ts +298 -2
  393. package/dist/trace/wire-projection-faces.js +154 -13
  394. package/dist/url-refusal.js +2 -0
  395. package/dist/web-admin-client/apply-effective.d.ts +12 -0
  396. package/dist/web-admin-client/apply-effective.js +56 -5
  397. package/dist/web-admin-client/facade.d.ts +1 -1
  398. package/dist/web-admin-client/facade.js +1 -1
  399. package/dist/web-admin-client/read-face.js +5 -9
  400. package/dist/web-admin-client/skills-mcp.js +4 -5
  401. package/docs/DEVICE-EXECUTOR-PROTOCOL.md +57 -9
  402. package/package.json +7 -3
@@ -1,11 +1,11 @@
1
1
  import { realpathSync } from "node:fs";
2
2
  import { join } from "node:path";
3
- import { NodeExecutionEnv, QUESTION_AWAITS_RESUME, WRITE_EXEMPT_DIR_COVERS_ROOT_CODE, deriveAskEffective, expandTiers, modePolicyOf, resolveAskSeamForm } from "@sema-agent/core";
3
+ import { NodeExecutionEnv, QUESTION_AWAITS_RESUME, deriveAskEffective, expandTiers, modePolicyOf, resolveAskSeamForm } from "@sema-agent/core";
4
4
  import { cappedCeiling } from "../budget.js";
5
5
  import { recordFailOpen } from "../observability/fail-open.js";
6
6
  import { SessionEnvironmentSelection, selectEnvironmentTool } from "../capabilities/select-environment-tool.js";
7
7
  import { sendUserFileTool } from "../capabilities/send-user-file-tool.js";
8
- import { buildPromptSeats, createScenarioGate, mergeUserSkills, selectScenario } from "../capabilities/scenarios.js";
8
+ import { buildExcludeToolsSeat, buildPromptSeats, createScenarioGate, mergeUserSkills, selectScenario } from "../capabilities/scenarios.js";
9
9
  import { stampHandsLane, toolPolicyForHands } from "../capabilities/hands-lane.js";
10
10
  import { applyLongtailDefer } from "../capabilities/tool-defer.js";
11
11
  import { assertGuardPatternsUsable, buildApprovalGrantNotice, buildOnlySensitiveBaselineWarning, createApprovalBaselinePolicy, createDeploymentGovernanceInputs } from "../deployment-governance.js";
@@ -17,7 +17,7 @@ import { HOST_POSTURE_REFUSED_CODE, taskInheritEnvRefusal, taskWriteFaceRefusal
17
17
  import { headerStr } from "../http/principal-gate.js";
18
18
  import { explicitOperatorOk } from "../http/server.js";
19
19
  import { isAtMentionable, matchCatalogModel, modelSupportsImages, refusedCatalogEntry, resolveTaskModel, selectableCatalog, terminalCatalogName } from "../model-select.js";
20
- import { modelUnavailableMessage } from "../model-entry-refusal.js";
20
+ import { echoModelRef, modelUnavailableMessage } from "../model-entry-refusal.js";
21
21
  import { PerTaskImageRegistry, resolveSandboxImageRef } from "../per-task-image.js";
22
22
  import { isRemoteScratchpadLane, remoteScratchpadDirFor } from "../plugins/remote-scratchpad.js";
23
23
  import { bindAttachmentsForTask } from "../plugins/task-attachment-store.js";
@@ -27,7 +27,9 @@ import { tightenGoverned } from "../governance-overrides.js";
27
27
  import { gateExecutionLane } from "../runtime-caps-resolver.js";
28
28
  import { applyRuntimeGovernance } from "../runtime-governance.js";
29
29
  import { HttpError, createCodedHttpError, encodeCheckpointScope } from "../security.js";
30
- import { memoryProjectKeyFor, memorySpecForRequest } from "../memory-scope.js";
30
+ import { sessionFaceReadOf } from "../session-incarnation.js";
31
+ import { memorySpecForRequest } from "../memory-scope.js";
32
+ import { createMemoryProjectLayers } from "../memory-project-layer.js";
31
33
  import { inheritEnvFieldIssue, singleMemberOffFieldIssue } from "../request-value-closure.js";
32
34
  import { a2aForScenario, mcpForScenario } from "../web-admin-client/facade.js";
33
35
  import { normalizeAttachments, normalizeResilience, normalizeResumeAtMode, normalizeSuggestNextPrompts, promptProfileFromBody, resolveTaskLimits, retainBackgroundProcessesFromBody, taskAgentsSpecFragment, toolMaterializeStrategyFromBody, allowToolsSpecFragment, toolNameListFromBody } from "../spec-fields.js";
@@ -37,17 +39,21 @@ import { assertRequestA2aUnlocked, resolveRequestA2a } from "../task-a2a.js";
37
39
  import { assertRequestMcpEntries, assertRequestMcpUnlocked, resolveRequestMcp } from "../task-mcp.js";
38
40
  import { storedToolAxesRereadM19 } from "../stored-request-tool-axes-m19.js";
39
41
  import { storedHooksRereadM20 } from "../stored-request-hooks-m20.js";
40
- import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, acceptAppendSystemPrompt, applyTaskSettings, effectivePermissionMode, effectiveThinking, parseTaskSettings, taskHooksHonored, settingsPermissionBucketIssue, withPermissionMode } from "../task-settings.js";
42
+ import { MAX_SETTINGS_OUTPUT_STYLE_CHARS, REQUEST_SETTINGS_REFUSAL_PREFIX, SETTINGS_RULE_REFUSAL_CODE, SettingsRuleRefusalError, acceptAppendSystemPrompt, applyTaskSettings, createWorkflowAskPolicy, effectivePermissionMode, effectiveThinking, parseTaskSettings, taskHooksHonored, settingsPermissionBucketIssue } from "../task-settings.js";
43
+ import { tightenOnlySeatIssue } from "../tighten-only-seats.js";
44
+ import { entryProblemsFacts } from "../entry-problems.js";
41
45
  import { inertToolListEntryOf } from "../rule-entry-list.js";
42
46
  import { TENANCY_WALL_CLOCK_BASE_SEC, enableForkFromBody, normalizeRetainSubagentSessions, selfOrchestrationFromBody } from "../task-workflow.js";
43
47
  import { redactSecrets } from "../trace/redact.js";
44
48
  import { DeferredSandboxPathEnv, isSandboxPathAdjudicationLane, sandboxPathEnvSlots } from "./deferred-sandbox-path-env.js";
45
- import { executionLaneCaps, executionLaneHomeDir, executionLaneOf } from "../execution-lane-caps.js";
49
+ import { executionLaneHomeDir, executionLaneOf, laneWiresExecutionEnv } from "../execution-lane-caps.js";
46
50
  import { effectiveMemoryPersistenceCapable } from "./memory-boundary.js";
47
51
  import { withUnattendedLeg } from "../unattended-permission-mode.js";
52
+ import { fieldConflictFacts } from "../field-conflict.js";
48
53
  export function createResolveSpec(ctx) {
49
- const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, } = ctx;
54
+ const { config, logger, metrics, localRoot, scenarios, principalCaps, centerRuntimeCapsResolver, getKeyResolver, taskAttachmentStore, perSessionCwd, setSessionCwd, setSessionShellEnv, fenceSessionOwner, hookLlm, hookAgent, fleetBus, hookWakeBus, resumeAnchorStore, ownerAware, taskLimitCaps, taskTimeoutSec, selectEnvTool, sendUserFileToolSpec, memoryEngine, memorySyncRunner, durableEnabled, approvalExemptionStore, checkpointStore, imageIndex, perTaskImage, sessionEnvSelection, liveQuestionFace, approverSeat, lockedKeys, } = ctx;
50
55
  const scenarioGate = createScenarioGate({ config, scenarios, principalCaps, logger }, "enforce");
56
+ const readSessionFace = sessionFaceReadOf(ownerAware);
51
57
  assertGuardPatternsUsable(config);
52
58
  const onlySensitiveBaseline = buildOnlySensitiveBaselineWarning(config, {
53
59
  approvalSeat: durableEnabled ? "durable" : "absent",
@@ -59,6 +65,7 @@ export function createResolveSpec(ctx) {
59
65
  const sessionCwd = auth?.sessionId ? effectiveHostWorkspace(perSessionCwd.get(auth.sessionId), {}) : undefined;
60
66
  return sessionCwd ?? (config.remoteExec === undefined ? process.cwd() : undefined);
61
67
  };
68
+ const memoryProjectLayers = createMemoryProjectLayers({ backend: memoryEngine?.backend, syncRunner: memorySyncRunner, log: logger });
62
69
  if (onlySensitiveBaseline)
63
70
  logger.warn(onlySensitiveBaseline.event, onlySensitiveBaseline.fields);
64
71
  const approvalGrantNotice = buildApprovalGrantNotice(config);
@@ -81,7 +88,7 @@ export function createResolveSpec(ctx) {
81
88
  cwdHonored: cwdHonored(config),
82
89
  });
83
90
  if (conflict) {
84
- throw new HttpError(400, `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
91
+ throw new HttpError(400, `cwd "${conflict.cwd.asSpelled}" is inside this session's scratchpad "${conflict.scratchpadDir.asSpelled}" — the scratchpad is the fs-write gate's EXEMPT directory, so a task rooted there would auto-approve every write under its own root and the engine refuses to build the gate at all (config.write_exempt_dir_covers_root). Point cwd at the project directory instead (or send no cwd and let the session keep the one it has): this session registers the cwd you send, so a task that happens not to mount the write gate would still leave every LATER task on this session rooted in the exemption. A workflow that really is meant to write without prompts says so with a knob that means it (a permission mode, an open write face) and still keeps its root outside the scratchpad — those knobs do not lift this refusal, because the conflict is between two fields of this request, not a permission level.`, { code: "request.field_conflict", extra: { ...fieldConflictFacts("scratchpad_root", body.scratchpadDir === conflict.scratchpadDir.asSpelled ? ["cwd", "scratchpadDir"] : ["cwd"]), cwd: conflict.cwd, scratchpadDir: conflict.scratchpadDir } });
85
92
  }
86
93
  }
87
94
  const offFieldIssue = singleMemberOffFieldIssue(body);
@@ -109,6 +116,11 @@ export function createResolveSpec(ctx) {
109
116
  if (bucketIssue)
110
117
  throw new HttpError(400, bucketIssue.message, { code: "request.field_invalid", extra: bucketIssue.fields });
111
118
  }
119
+ {
120
+ const seatIssue = tightenOnlySeatIssue(body.settings);
121
+ if (seatIssue)
122
+ throw new HttpError(400, seatIssue.message, { code: "request.field_invalid", extra: seatIssue.fields });
123
+ }
112
124
  {
113
125
  const replay = opts?.leg === "resume";
114
126
  const inertList = inertToolListEntryOf(body, replay ? ["deny"] : undefined);
@@ -136,8 +148,9 @@ export function createResolveSpec(ctx) {
136
148
  }
137
149
  const lane = bindSettingsCwdEnvAndModel(body, auth, gated, opts);
138
150
  const anchors = await resolveHistoryAnchors(body, auth);
139
- const spec = assembleSpecLiteral(body, auth, req, opts, { ...gated, ...lane, ...anchors }, effMode);
140
- const folded = await foldGovernanceAndSettings(body, auth, spec, gated, effMode);
151
+ const projectKey = memoryEngine ? await memoryProjectLayers.prepare(config, auth?.memoryScope, realTaskRootOf(auth)) : undefined;
152
+ const spec = assembleSpecLiteral(body, auth, req, opts, { ...gated, ...lane, ...anchors, projectKey }, effMode);
153
+ const folded = await foldGovernanceAndSettings(body, auth, spec, gated);
141
154
  const final = await applyImageFactsAndRouting(body, auth, folded.governed, {
142
155
  scenarioName: gated.scenarioName,
143
156
  scratchpadDir: folded.scratchpadDir,
@@ -149,7 +162,7 @@ export function createResolveSpec(ctx) {
149
162
  const gateScenarioAndAppend = async (body, auth, opts) => {
150
163
  const scenarioName = await scenarioGate(auth?.principal, body.scenario);
151
164
  gateExecutionLane(await principalCaps?.executionRuling(auth?.principal), executionLaneOf(config.remoteExec?.provider), logger);
152
- const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, auth?.sessionId !== undefined ? { sessionId: auth.sessionId } : {});
165
+ const cap = selectScenario(scenarios, scenarioName)(body, auth?.principal, auth?.sessionId !== undefined ? { sessionId: auth.sessionId, delegationRoot: { sessionId: auth.sessionId, incarnation: (await readSessionFace?.(auth.sessionId))?.incarnation ?? null } } : {});
153
166
  const acceptedAppend = acceptAppendSystemPrompt(body.appendSystemPrompt, (detail) => logger.warn("append_system_prompt_dropped", { detail, sessionId: auth?.sessionId ?? null }));
154
167
  const objective = typeof body.objective === "string" ? body.objective : "";
155
168
  const parsedSettings = parseTaskSettings(body.settings, opts?.leg === "fresh" || !taskHooksHonored(config) ? {} : { storedHooksReread: storedHooksRereadM20(new Date().toISOString().slice(0, 10)) });
@@ -274,22 +287,22 @@ export function createResolveSpec(ctx) {
274
287
  if (picked.unavailable !== undefined) {
275
288
  const { requested, name, refusal, source } = picked.unavailable;
276
289
  if (opts?.leg === "fresh") {
277
- throw new HttpError(400, modelUnavailableMessage(source === "mention" ? "@-mention" : "model", requested.slice(0, 120), name, refusal), { code: "request.model_unavailable" });
290
+ throw new HttpError(400, modelUnavailableMessage(source === "mention" ? "@-mention" : "model", requested, name, refusal), { code: "request.model_unavailable" });
278
291
  }
279
292
  metrics.inc("task_model_unavailable_fallback_total");
280
- logger.warn("task_model_unavailable_fallback", { requested: requested.slice(0, 120), name, code: refusal.code, source, fallback: picked.model, sessionId: auth?.sessionId ?? null });
293
+ logger.warn("task_model_unavailable_fallback", { requested: echoModelRef(requested), name, code: refusal.code, source, fallback: picked.model, sessionId: auth?.sessionId ?? null });
281
294
  }
282
295
  if (picked.notAllowed !== undefined) {
283
296
  const { requested, resolved, source } = picked.notAllowed;
284
297
  if (opts?.leg === "fresh") {
285
- throw new HttpError(400, `model "${requested.slice(0, 120)}" is not @-mentionable on this deployment (it resolves to catalog model "${resolved}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
298
+ throw new HttpError(400, `model "${echoModelRef(requested)}" is not @-mentionable on this deployment (it resolves to catalog model "${resolved}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
286
299
  }
287
300
  metrics.inc("task_model_not_allowlisted_resume_total");
288
- logger.warn("task_model_not_allowlisted_resume", { requested: requested.slice(0, 120), resolved, source, sessionId: auth?.sessionId ?? null, note: "resumed leg keeps running the model it was started on — the allowlist gates fresh picks only" });
301
+ logger.warn("task_model_not_allowlisted_resume", { requested: echoModelRef(requested), resolved, source, sessionId: auth?.sessionId ?? null, note: "resumed leg keeps running the model it was started on — the allowlist gates fresh picks only" });
289
302
  }
290
303
  if (picked.unknownExplicit !== undefined) {
291
304
  metrics.inc("task_model_unknown_fallback_total");
292
- logger.warn("task_model_unknown_fallback", { requested: picked.unknownExplicit.slice(0, 120), fallback: picked.model, sessionId: auth?.sessionId ?? null });
305
+ logger.warn("task_model_unknown_fallback", { requested: echoModelRef(picked.unknownExplicit), fallback: picked.model, sessionId: auth?.sessionId ?? null });
293
306
  }
294
307
  if (Array.isArray(body.images) && body.images.length > 0 && !modelSupportsImages(wireCatalog[picked.model])) {
295
308
  metrics.inc("images_omitted_total", { model: picked.model });
@@ -338,7 +351,7 @@ export function createResolveSpec(ctx) {
338
351
  return deriveAskEffective(askForm.form, "unresolved") === "human_reachable";
339
352
  };
340
353
  const assembleSpecLiteral = (body, auth, req, opts, parts, effMode) => {
341
- const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, } = parts;
354
+ const { scenarioName, cap, hands, acceptedAppend, parsedSettings, attachmentNotice, taskHooks, additionalDirectories, additionalReadDirectories, wireCatalog, picked, resumeAtEntryId, rewindFilesToEntryId, s4DefaultScopes, projectKey, } = parts;
342
355
  const storedToolAxes = opts?.leg === "fresh" ? undefined : storedToolAxesRereadM19(new Date().toISOString().slice(0, 10));
343
356
  const spec = {
344
357
  objective: attachmentNotice ? `${picked.cleanedObjective}\n\n${attachmentNotice}` : picked.cleanedObjective,
@@ -380,7 +393,7 @@ export function createResolveSpec(ctx) {
380
393
  ? { retainBackgroundProcesses: true }
381
394
  : {}),
382
395
  ...(body.excludeAllTools === true ? { excludeAllTools: true } : {}),
383
- ...(() => { const v = toolNameListFromBody(body.excludeTools); return v ? { excludeTools: v } : {}; })(),
396
+ ...buildExcludeToolsSeat(cap.excludeTools, toolNameListFromBody(body.excludeTools)),
384
397
  ...allowToolsSpecFragment(body.allowTools),
385
398
  ...(() => { const v = toolNameListFromBody(body.deferTools); return v ? { deferTools: v } : {}; })(),
386
399
  ...(() => { const v = promptProfileFromBody(body.promptProfile); return v ? { promptProfile: v } : {}; })(),
@@ -389,7 +402,7 @@ export function createResolveSpec(ctx) {
389
402
  ...(declaresInteractivePosture(body, req, opts) ? { interactionPosture: "interactive" } : {}),
390
403
  ...(body.approvalReach !== undefined ? { approvalReach: body.approvalReach } : {}),
391
404
  ...(typeof body.oneShot === "boolean" ? { oneShot: body.oneShot } : {}),
392
- resilience: normalizeResilience(body.resilience, explicitOperatorOk(auth?.principal, config.operatorPrincipals)),
405
+ resilience: normalizeResilience(body.resilience, explicitOperatorOk(auth?.principal, config)),
393
406
  finalVerification: cap.finalVerification === true || body.finalVerification === true ? true : undefined,
394
407
  attachments: normalizeAttachments(body.attachments),
395
408
  ...(taskHooks ? { mods: [taskHooks] } : {}),
@@ -400,23 +413,23 @@ export function createResolveSpec(ctx) {
400
413
  const cm = matchCatalogModel(body.compactionModel, wireCatalog, config.modelRefusals);
401
414
  const refusedCm = cm === undefined ? refusedCatalogEntry(body.compactionModel, config.modelRefusals) : undefined;
402
415
  if (refusedCm !== undefined && opts?.leg === "fresh") {
403
- throw new HttpError(400, modelUnavailableMessage("compactionModel", body.compactionModel.slice(0, 120), refusedCm.name, refusedCm.refusal), { code: "request.model_unavailable" });
416
+ throw new HttpError(400, modelUnavailableMessage("compactionModel", body.compactionModel, refusedCm.name, refusedCm.refusal), { code: "request.model_unavailable" });
404
417
  }
405
418
  if (cm === undefined) {
406
419
  if (opts?.leg === "fresh") {
407
- throw new HttpError(400, `unknown compactionModel "${body.compactionModel.slice(0, 120)}" — not in the configured catalog (name, tier word, or id; a catalog refresh may have removed it mid-request)`);
420
+ throw new HttpError(400, `unknown compactionModel "${echoModelRef(body.compactionModel)}" — not in the configured catalog (name, tier word, or id; a catalog refresh may have removed it mid-request)`);
408
421
  }
409
422
  metrics.inc("task_model_unknown_fallback_total");
410
- logger.warn("compaction_model_unknown_fallback", { requested: body.compactionModel.slice(0, 120), sessionId: auth?.sessionId ?? null });
423
+ logger.warn("compaction_model_unknown_fallback", { requested: echoModelRef(body.compactionModel), sessionId: auth?.sessionId ?? null });
411
424
  return {};
412
425
  }
413
426
  if (!isAtMentionable(cm, wireCatalog, config.atMention, config.modelRefusals)) {
414
427
  const terminal = terminalCatalogName(cm, wireCatalog, config.modelRefusals) ?? cm;
415
428
  if (opts?.leg === "fresh") {
416
- throw new HttpError(400, `compactionModel "${body.compactionModel.slice(0, 120)}" is not @-mentionable on this deployment (it resolves to catalog model "${terminal}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
429
+ throw new HttpError(400, `compactionModel "${echoModelRef(body.compactionModel)}" is not @-mentionable on this deployment (it resolves to catalog model "${terminal}") — which models can be @-mentioned is configured by the operator (models.atMention)`, { code: "request.model_not_allowed" });
417
430
  }
418
431
  metrics.inc("task_model_not_allowlisted_resume_total");
419
- logger.warn("task_model_not_allowlisted_resume", { requested: body.compactionModel.slice(0, 120), resolved: terminal, source: "compaction", sessionId: auth?.sessionId ?? null, note: "resumed leg keeps the compaction model it was started with — the allowlist gates fresh picks only" });
432
+ logger.warn("task_model_not_allowlisted_resume", { requested: echoModelRef(body.compactionModel), resolved: terminal, source: "compaction", sessionId: auth?.sessionId ?? null, note: "resumed leg keeps the compaction model it was started with — the allowlist gates fresh picks only" });
420
433
  }
421
434
  return { compactionModel: cm };
422
435
  })()),
@@ -459,7 +472,7 @@ export function createResolveSpec(ctx) {
459
472
  })(),
460
473
  ...(config.requirePrincipal !== true ? { backgroundScope: "session" } : {}),
461
474
  memory: memoryEngine
462
- ? memorySpecForRequest(auth?.memoryScope, memoryProjectKeyFor(config, auth?.memoryScope, realTaskRootOf(auth)), body.memoryWrite, s4DefaultScopes, { multiTenant: config.requirePrincipal === true }, { memory: body.memory, memoryCapture: body.memoryCapture })
475
+ ? memorySpecForRequest(auth?.memoryScope, projectKey, body.memoryWrite, s4DefaultScopes, { multiTenant: config.requirePrincipal === true }, { memory: body.memory, memoryCapture: body.memoryCapture })
463
476
  : undefined,
464
477
  ...((v) => (v !== undefined ? { memoryPersistenceCapable: v } : {}))(effectiveMemoryPersistenceCapable(config)),
465
478
  tools: ((base) => {
@@ -505,7 +518,7 @@ export function createResolveSpec(ctx) {
505
518
  };
506
519
  return spec;
507
520
  };
508
- const foldGovernanceAndSettings = async (body, auth, spec, gated, effMode) => {
521
+ const foldGovernanceAndSettings = async (body, auth, spec, gated) => {
509
522
  const { acceptedAppend, parsedSettings } = gated;
510
523
  const hostSemanticsLane = !isSandboxPathAdjudicationLane(config.remoteExec?.provider);
511
524
  const laneHomeBase = () => {
@@ -533,7 +546,7 @@ export function createResolveSpec(ctx) {
533
546
  };
534
547
  const governedBase = applyRuntimeGovernance(spec, createDeploymentGovernanceInputs(config, pathAdjudication));
535
548
  let governed = governedBase;
536
- let effectiveSettings = effMode ? withPermissionMode(parsedSettings.settings, effMode) : parsedSettings.settings;
549
+ let effectiveSettings = parsedSettings.settings;
537
550
  if (effectiveSettings?.outputStyle && acceptedAppend && acceptedAppend.length + 2 + effectiveSettings.outputStyle.length > MAX_SETTINGS_OUTPUT_STYLE_CHARS) {
538
551
  logger.warn("output_style_dropped", { detail: `combined append carriers exceed the ${MAX_SETTINGS_OUTPUT_STYLE_CHARS} cap (rider ${acceptedAppend.length} + style ${effectiveSettings.outputStyle.length}) — style dropped (pre-cap stored body on a resume leg?)`, sessionId: auth?.sessionId ?? null });
539
552
  const { outputStyle: _dropped2, ...rest2 } = effectiveSettings;
@@ -549,65 +562,31 @@ export function createResolveSpec(ctx) {
549
562
  ? await ensureScratchpadDir(config.localDataRoot ?? localRoot, auth.sessionId, (msg, meta) => logger.warn(msg, { ...(meta ?? {}), sessionId: auth.sessionId }))
550
563
  : undefined);
551
564
  if (effectiveSettings) {
552
- const gateCommon = {
553
- ...(approvalExemptionStore && auth?.sessionId
554
- ? {
555
- isExempt: async (toolName) => {
556
- const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
557
- if (hit)
558
- logger.info("fs_write_gate_exempted", { toolName, sessionId: auth.sessionId });
559
- return hit;
560
- },
561
- }
562
- : {}),
565
+ const ruleBases = {
566
+ ...(pathAdjudication.taskRoot !== undefined ? { taskRoot: pathAdjudication.taskRoot } : {}),
567
+ ...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
563
568
  };
564
- const fsWriteGate = hostSemanticsLane
565
- ? {
566
- env: pathAdjudication.env,
567
- ...(pathAdjudication.cwd !== undefined ? { cwd: pathAdjudication.cwd } : {}),
568
- ...(pathAdjudication.taskRoot !== undefined ? { taskRoot: pathAdjudication.taskRoot } : {}),
569
- ...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
570
- ...(scratchpadDir ? { scratchpadDir } : {}),
571
- ...gateCommon,
572
- }
573
- :
574
- (() => {
575
- const sandboxScratchpadDir = isRemoteScratchpadLane(config.remoteExec?.provider) ? remoteScratchpadDirFor(auth?.sessionId) : undefined;
576
- return {
577
- env: pathAdjudication.env,
578
- ...(pathAdjudication.taskHome !== undefined ? { taskHome: pathAdjudication.taskHome } : {}),
579
- ...gateCommon,
580
- ...(sandboxScratchpadDir ? { scratchpadDir: sandboxScratchpadDir } : {}),
581
- ...(gateCommon.isExempt
582
- ? {
583
- isExempt: (toolName, canonicalPath) => canonicalPath.startsWith("/") ? gateCommon.isExempt(toolName) : false,
584
- }
585
- : {}),
586
- };
587
- })();
588
- const workflowGate = approvalExemptionStore && auth?.sessionId
589
- ? {
590
- isExempt: async (toolName) => {
591
- const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
592
- if (hit)
593
- logger.info("workflow_gate_exempted", { toolName, sessionId: auth.sessionId });
594
- return hit;
595
- },
596
- }
597
- : undefined;
598
569
  try {
599
- governed = applyTaskSettings(governedBase, effectiveSettings, fsWriteGate, workflowGate);
570
+ governed = applyTaskSettings(governedBase, effectiveSettings, ruleBases);
600
571
  }
601
572
  catch (e) {
602
- if (e.code === WRITE_EXEMPT_DIR_COVERS_ROOT_CODE) {
603
- throw new HttpError(400, e.message, {
604
- code: "request.field_conflict",
605
- ...(e.detail !== undefined ? { extra: { writeExemptDirCoversRoot: e.detail } } : {}),
606
- });
607
- }
573
+ if (e instanceof SettingsRuleRefusalError)
574
+ throw new HttpError(422, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${e.message}`, { code: SETTINGS_RULE_REFUSAL_CODE, extra: { ...entryProblemsFacts(e.problems) } });
608
575
  throw new HttpError(422, `${REQUEST_SETTINGS_REFUSAL_PREFIX}${e.message}`);
609
576
  }
610
577
  }
578
+ if (governed.selfOrchestration === true) {
579
+ governed = tightenGoverned(governed, {
580
+ toolPolicy: createWorkflowAskPolicy(approvalExemptionStore && auth?.sessionId
581
+ ? async (toolName) => {
582
+ const hit = await approvalExemptionStore.has(auth.sessionId, toolName);
583
+ if (hit)
584
+ logger.info("workflow_gate_exempted", { toolName, sessionId: auth.sessionId });
585
+ return hit;
586
+ }
587
+ : undefined),
588
+ });
589
+ }
611
590
  return { governed, scratchpadDir, hostSemanticsLane };
612
591
  };
613
592
  const applyImageFactsAndRouting = async (body, auth, governed, folded) => {
@@ -631,7 +610,7 @@ export function createResolveSpec(ctx) {
631
610
  const resolved = await resolveSandboxImageRef({
632
611
  profile: taskImageProfile,
633
612
  ...(capsNeeded && capsNeeded.length > 0 ? { capabilitiesNeeded: capsNeeded } : {}),
634
- viewer: { operator: explicitOperatorOk(auth.principal, config.operatorPrincipals), tenantId: auth.principal ?? null },
613
+ viewer: { operator: explicitOperatorOk(auth.principal, config), tenantId: auth.principal ?? null },
635
614
  index: imageIndex,
636
615
  });
637
616
  if (!resolved.ok)
@@ -662,7 +641,7 @@ export function createResolveSpec(ctx) {
662
641
  const isolatedExecEnv = isIsolatedExecEnv(config.remoteExec?.provider, config.remoteExec?.provider === "k8s" ? config.remoteExec.runtimeClass : undefined);
663
642
  const decision = routeServiceTask({
664
643
  isolatedExecEnv,
665
- hasExecutionEnv: executionLaneCaps(executionLaneOf(config.remoteExec?.provider)).coreRemoteExecutionEnv === "supported",
644
+ hasExecutionEnv: laneWiresExecutionEnv(executionLaneOf(config.remoteExec?.provider)),
666
645
  ...(config.autonomy ? { autonomy: config.autonomy } : {}),
667
646
  });
668
647
  logger.info("orchestration_routed", { mode: decision.mode, reason: decision.reason, sessionId: auth?.sessionId ?? null });
@@ -180,6 +180,7 @@ export function createRunnerDeps(ctx) {
180
180
  logger,
181
181
  })
182
182
  : undefined,
183
+ principalInboxConsumer: config.principalInboxAssistant !== undefined ? { assistant: config.principalInboxAssistant } : undefined,
183
184
  onTaskOutcome: outcomeSink
184
185
  ? (o) => {
185
186
  metrics.inc("task_outcomes_total", { status: o.status, green: String(o.oracle?.green ?? "unknown") });
@@ -69,6 +69,7 @@ export interface SessionFacesCtx {
69
69
  export declare function createSessionFaces(ctx: SessionFacesCtx): {
70
70
  ownerAware: OwnerAwareSessionStore;
71
71
  sessionAudit: ((sessionId: string, opts?: SessionAuditReadOpts) => Promise<{
72
+ agent?: import("../audit.js").SessionAgent | undefined;
72
73
  owner: string | null;
73
74
  sessionId: string;
74
75
  createdAt: string;
@@ -1,4 +1,4 @@
1
- import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg } from "../audit.js";
1
+ import { buildRewindHandles, buildSessionAudit, buildSessionAuditLocal, buildSessionAuditPg, sessionAgentOf } from "../audit.js";
2
2
  import { makeDegenerateInstrument } from "../degenerate-instrument.js";
3
3
  import { PlanCacheProbe } from "../plan-cache-probe.js";
4
4
  import { purgeScratchpadDir } from "../env-facts.js";
@@ -25,7 +25,9 @@ export function createSessionFaces(ctx) {
25
25
  : await buildSessionAuditLocal(auditLocalRoot, sessionId, handles);
26
26
  if (!audit)
27
27
  return undefined;
28
- return { ...audit, owner: (await ownerAware.ownerOf?.(sessionId)) ?? null };
28
+ const [owner, placement] = await Promise.all([ownerAware.ownerOf?.(sessionId), opts !== undefined ? ownerAware.placementOf?.(sessionId) : undefined]);
29
+ const agent = sessionAgentOf(placement);
30
+ return { ...audit, owner: owner ?? null, ...(agent !== undefined ? { agent } : {}) };
29
31
  }
30
32
  : undefined;
31
33
  const sessionWatchRegistry = ownerAware.getHead && ownerAware.ownerOf
@@ -3,6 +3,7 @@ import { createWebAdminRuntime } from "./web-admin.js";
3
3
  import { composeExecutionLane, FILE_SOURCED_LANES } from "./execution-lane.js";
4
4
  import { serviceConfigSourceKind } from "../config-provider.js";
5
5
  import { logConfigDirMigration, migrateLocalConfigDirectory } from "../config-d-migration.js";
6
+ import { assertLocalConfigDirTrusted } from "../config-dir-trust.js";
6
7
  import { defaultModelRefusal, refusedNameMintedRefusal } from "../model-entry-refusal.js";
7
8
  import { isRosterGateArmed } from "../config.js";
8
9
  import { judgeServedModelRoute } from "../model-route-endpoint.js";
@@ -10,8 +11,10 @@ import { servedModelTableLeg } from "../model-select.js";
10
11
  export async function runStage02(ctx) {
11
12
  const { config, localRoot, logger, metrics } = ctx;
12
13
  const configSource = serviceConfigSourceKind(config);
13
- if (configSource === "local")
14
+ if (configSource === "local") {
15
+ await assertLocalConfigDirTrusted({ root: localRoot, declaredOwnerUid: config.configLocalOwnerUid });
14
16
  logConfigDirMigration(logger, await migrateLocalConfigDirectory(localRoot));
17
+ }
15
18
  await composeExecutionLane(config, { configSource, localRoot, logger, drivesFromFile: FILE_SOURCED_LANES });
16
19
  const webAdmin = await createWebAdminRuntime({ config, logger, metrics, localRoot });
17
20
  const servedLeg = servedModelTableLeg(config);
@@ -51,6 +51,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
51
51
  workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
52
52
  workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
53
53
  workflowModelAllowlistSnapshot: readonly string[];
54
+ workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
54
55
  workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
55
56
  workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
56
57
  workflowRecoverOpts: {
@@ -60,6 +61,7 @@ export declare function runStage06(ctx: Awaited<ReturnType<typeof runStage05>>):
60
61
  };
61
62
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
62
63
  workflowsCapable: boolean;
64
+ orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
63
65
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
64
66
  deviceLane: import("./device-lane.js").DeviceLane | undefined;
65
67
  dropSessionScoped: (sid: string) => void;
@@ -7,6 +7,7 @@ import { withoutHands } from "../capabilities/hands-lane.js";
7
7
  import { isBrandedDeployment } from "../capabilities/brand-identity.js";
8
8
  import { redactSecrets } from "../trace/redact.js";
9
9
  import { hasServiceAuth } from "../http/server.js";
10
+ import { operatorRosterPresent } from "../http/principal-gate.js";
10
11
  import { workflowModelAllowlistFor } from "../task-workflow.js";
11
12
  import { createHookLlm, buildHookFailureText } from "../hooks/hook-llm.js";
12
13
  import { assertRetentionLaneWirable } from "./retention-lane.js";
@@ -21,11 +22,12 @@ import { defaultEngineNoticeRouter } from "../trace/engine-notice-wire.js";
21
22
  import { createOrgMemoryAdmissionWiring } from "./org-memory.js";
22
23
  import { createGovernanceSeams } from "./governance-seams.js";
23
24
  import { createSharedMemoryScopeAuthorizer } from "../shared-memory-scope-authorizer.js";
25
+ import { mountOrgDeliveryGate } from "./org-delivery.js";
24
26
  import { parkedAskRedeem, runStore } from "./late-binds.js";
25
27
  import { withInternalRunEnvs } from "../internal-run-env.js";
26
28
  export function runStage06(ctx) {
27
29
  const { backend, backgroundAgentStore, brain, engineDataRoot, config, webAdmin, consolidationValve, deploymentMods, executionEnvFactory, fileHistoryStore, localRoot, logger, lspManager, mailboxRecipientLifecycle, mailboxStore, memoryEngine, memorySyncRunner, metrics, perSessionCwd, permissionRuleProvider, pricing, rosterStore, ruleConsent, sendUserFileTaskEnvs, sessionCaptureRecordStore, sessionCaptureRecords, sessionPolicyStore, sessionStore, taskAttachmentStore, taskListLane, toolResultStore, tracer, usageWindowStore } = ctx;
28
- const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
30
+ const { sqlWorkflowRunStore, workflowNotifyJournal, workflowCompletionInbox, deliverWorkflowCompletion, workflowNotifyGate, fleetBus, workflowRunStore, workflowJournalStore, outcomeSink, workflowRecoverOpts, workflowAgentRegistry, subagentSteerRegistry, workflowAgentSessionIndex, workflowParkDecisions, } = createWorkflowOrchestration({ config, logger, metrics, localRoot, backend, getRunStore: () => runStore });
29
31
  const parkCommitted = backend?.checkpoint && config.durableApproval ? createParkCommitWatch(backend.checkpoint(logger)) : undefined;
30
32
  const checkpointStore = parkCommitted?.store;
31
33
  const parkCommits = parkCommitted?.watch;
@@ -83,7 +85,7 @@ export function runStage06(ctx) {
83
85
  : undefined;
84
86
  for (const w of buildConsolidationValveAudit({
85
87
  valve: consolidationValve,
86
- operatorPrincipals: config.operatorPrincipals,
88
+ operatorRosterPresent: operatorRosterPresent(config),
87
89
  hasServiceAuth: hasServiceAuth(config),
88
90
  allowUnauthedWrites: config.allowUnauthedWrites ?? false,
89
91
  }).warnings) {
@@ -127,6 +129,7 @@ export function runStage06(ctx) {
127
129
  sharedMemoryStores: sharedMemoryStore ? sharedMemoryStore : undefined,
128
130
  getRunStore: () => runStore,
129
131
  });
132
+ const orgDeliveryGate = mountOrgDeliveryGate({ runnerDeps, directory: orgMemoryAdmission.directory, mailboxStore, backend, logger });
130
133
  const runner = new Runner(runnerDeps);
131
134
  const handslessRunner = new Runner(withoutHands(runnerDeps));
132
135
  const { hookModelFor, hookLlm } = createHookLlm({ config, getKeyResolver: () => webAdmin.getKeyResolver(), metrics });
@@ -210,6 +213,6 @@ export function runStage06(ctx) {
210
213
  onError: runnerDeps.onError ? runnerDeps.onError : undefined,
211
214
  };
212
215
  const subRunner = new Runner(subRunnerDeps);
213
- return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable };
216
+ return { ...ctx, approvalAskAudit, approvalExemptionStore, centerRuntimeCapsResolver, checkpointStore, parkCommits, durableEnabled, elicitation, fleetBus, governanceSeams, handslessRunner, hookAgent, hookAgentRunner, hookLlm, mcpRevocations, memoryConsolidationFaces, memoryOptOutGrantStore, orgMemoryAdmission, outcomeSink, principalCaps, question, retentionExecutor, retentionLaneStore, runner, runnerDeps, runtimeCapsPeekResolver, sendFileLedger, sendUserFileEmitter, sendUserFileToolSpec, sessionTitler, sharedMemoryStore, sqlWorkflowRunStore, streamApprovalGate, subRunner, subRunnerSessions, subagentSteerRegistry, toolApproval, workflowAgentRegistry, workflowAgentSessionIndex, workflowCompletionInbox, workflowJournalStore, workflowModelAllowlistSnapshot, workflowParkDecisions, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, workflowRunStore, workflowsCapable, orgDeliveryGate };
214
217
  }
215
218
  //# sourceMappingURL=stage-06-runners.js.map
@@ -66,6 +66,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
66
66
  workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
67
67
  workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
68
68
  workflowModelAllowlistSnapshot: readonly string[];
69
+ workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
69
70
  workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
70
71
  workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
71
72
  workflowRecoverOpts: {
@@ -75,6 +76,7 @@ export declare function runStage07(ctx: Awaited<ReturnType<typeof runStage06>>):
75
76
  };
76
77
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
77
78
  workflowsCapable: boolean;
79
+ orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
78
80
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
79
81
  deviceLane: import("./device-lane.js").DeviceLane | undefined;
80
82
  dropSessionScoped: (sid: string) => void;
@@ -7,13 +7,14 @@ import { ensureChildSessionDurableWithPromotion } from "../plugins/session-store
7
7
  import { webSearchConfigFromEnv, createWebSearchBackend, shouldProbeWebSearchOnBoot } from "../plugins/web-search.js";
8
8
  import { createAuthorizer } from "../security.js";
9
9
  import { buildForceDurableGateInertNotice, buildNoResponderBootWarns, gateIntentUnserviceableReason, singleUserAutoAcceptBaselineApplies } from "../approval.js";
10
- import { executionLaneOf } from "../execution-lane-caps.js";
10
+ import { executionLaneOf, laneWiresExecutionEnv } from "../execution-lane-caps.js";
11
11
  import { loadDeploymentSkills } from "../capabilities/skills.js";
12
12
  import { createRepoClient } from "../capabilities/repo-tools.js";
13
13
  import { buildScenarios, builtinScenarioDetails, danglingScenarioRefusal } from "../capabilities/scenarios.js";
14
14
  import { isBrandedDeployment } from "../capabilities/brand-identity.js";
15
15
  import { RateLimiter } from "../observability/rate-limit.js";
16
16
  import { explicitOperatorOk } from "../http/server.js";
17
+ import { buildOperatorUndeclaredNotice } from "../http/principal-gate.js";
17
18
  import { selfOrchestrationDenial } from "../task-workflow.js";
18
19
  import { centerEntitlementSourceWired } from "../runtime-caps-resolver.js";
19
20
  import { reclaimOrphansAtBoot } from "../boot-reclaim.js";
@@ -56,6 +57,18 @@ export async function runStage07(ctx) {
56
57
  throw new Error(gateRefusal);
57
58
  await reclaimOrphansAtBoot(runStore, checkpointStore, logger);
58
59
  await runBootCrashConvergence({ backend, runStore, liveAudit: approvalAskAudit, localDataRoot: config.localDataRoot, logger });
60
+ const adoption = await toolApproval?.adoptOpenAsks();
61
+ if (adoption !== undefined && (adoption.capped || adoption.cardUnreadable > 0)) {
62
+ logger.warn("approval_ask_adopted_partially", {
63
+ adopted: adoption.adopted,
64
+ cardUnreadable: adoption.cardUnreadable,
65
+ capped: adoption.capped,
66
+ note: "some approval asks still pending in the ask ledger were not taken into this replica's live list: unreadable card envelopes are skipped, and only the oldest pending rows up to the adoption cap are taken. The skipped asks stay answerable through POST /v1/tasks/:taskId/asks/:askId/decision and are expired by the reconciler on their own window.",
67
+ });
68
+ }
69
+ else if (adoption !== undefined && adoption.adopted > 0) {
70
+ logger.info("approval_ask_adopted", { adopted: adoption.adopted, alreadyLive: adoption.alreadyLive });
71
+ }
59
72
  const userInputLedgerStore = backend && runStore ? backend.userInputLedger() : undefined;
60
73
  const userInputLedger = backend && runStore && userInputLedgerStore
61
74
  ? await (async () => {
@@ -75,7 +88,7 @@ export async function runStage07(ctx) {
75
88
  ? selectEnvironmentTool({
76
89
  catalog: imageIndex,
77
90
  selection: sessionEnvSelection,
78
- viewerFor: (principal) => ({ operator: explicitOperatorOk(principal, config.operatorPrincipals), tenantId: principal ?? null }),
91
+ viewerFor: (principal) => ({ operator: explicitOperatorOk(principal, config), tenantId: principal ?? null }),
79
92
  })
80
93
  : undefined;
81
94
  const imageBakes = backend?.imageBake && config.imageBakes.enabled ? backend.imageBake() : undefined;
@@ -83,6 +96,11 @@ export async function runStage07(ctx) {
83
96
  logger.info("image_bakes_enabled", { operators: config.operatorPrincipals.length, runner: config.imageBakes.runnerPrincipal });
84
97
  if (durableEnabled)
85
98
  logger.info("durable_approval_enabled", { toolApprovalGate: config.approvalRequire.length });
99
+ {
100
+ const undeclared = buildOperatorUndeclaredNotice(config, durableEnabled);
101
+ if (undeclared)
102
+ logger.warn(undeclared.event, undeclared.fields);
103
+ }
86
104
  if (config.a2aServe) {
87
105
  const peer = facts.a2aServe({ config, runStore });
88
106
  if (peer.available) {
@@ -151,10 +169,13 @@ export async function runStage07(ctx) {
151
169
  })
152
170
  .catch((e) => logger.warn("web_search_probe_failed", { provider: webSearchCfg.provider, error: e instanceof Error ? e.message : String(e) }));
153
171
  }
154
- const ensureChildSessionDurable = checkpointStore && config.sessionBackend === "tidb" ? (sessionId) => ensureChildSessionDurableWithPromotion(sessionStore, subRunnerSessions, sessionId) : undefined;
172
+ const ensureChildSessionDurable = checkpointStore && config.sessionBackend === "tidb"
173
+ ? (sessionId, root) => ensureChildSessionDurableWithPromotion(sessionStore, subRunnerSessions, sessionId, root, logger)
174
+ : undefined;
155
175
  const webFetchSummarize = createWebFetchSummarizeLane({ brain, config, getKeyResolver: () => webAdmin.getKeyResolver(), logger });
156
176
  const scenarioDeps = {
157
177
  runner, subRunner, model: DEFAULT_MODEL_REF, skills, repoClient, requirePrincipal: config.requirePrincipal,
178
+ handsLane: laneWiresExecutionEnv(executionLaneOf(config.remoteExec?.provider)),
158
179
  webSearch: webSearch ? webSearch : undefined, logger, webFetchSummarize,
159
180
  backgroundAgentStore: backgroundAgentStore ? backgroundAgentStore : undefined,
160
181
  checkpointStore: checkpointStore ? checkpointStore : undefined,
@@ -79,6 +79,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
79
79
  workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
80
80
  workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
81
81
  workflowModelAllowlistSnapshot: readonly string[];
82
+ workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
82
83
  workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
83
84
  workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
84
85
  workflowRecoverOpts: {
@@ -88,6 +89,7 @@ export declare function runStage08(ctx: Awaited<ReturnType<typeof runStage07>>):
88
89
  };
89
90
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
90
91
  workflowsCapable: boolean;
92
+ orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
91
93
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
92
94
  deviceLane: import("./device-lane.js").DeviceLane | undefined;
93
95
  dropSessionScoped: (sid: string) => void;
@@ -5,12 +5,12 @@ import { startRetentionLane, RETENTION_LEASE_TTL_FACTOR } from "./retention-lane
5
5
  import { createLimitSync } from "./limit-sync.js";
6
6
  import { runDenySweep } from "./late-binds.js";
7
7
  export function runStage08(ctx) {
8
- const { approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, spaceReclaimer, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, rosterStore, runStore, runner, sqlWorkflowRunStore, subRunner, taskAttachmentStore, toolApproval, toolResultStore, userInputLedger, workflowJournalStore, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap } = ctx;
8
+ const { approvalAskAudit, approvalNonceStore, backend, backgroundAgentStore, ceilingVerdict, checkpointStore, parkCommits, config, webAdmin, consolidationSeatWatch, costQuota, degradeRouteWatch, fileHistoryErasure, spaceReclaimer, handslessRunner, hookAgentRunner, imageBakes, instanceId, localRoot, logger, mailboxStore, metrics, permissionRuleStores, pricing, rateLimiter, retentionExecutor, retentionLaneStore, rosterStore, runStore, runner, sqlWorkflowRunStore, subRunner, taskAttachmentStore, toolApproval, toolResultStore, userInputLedger, workflowJournalStore, workflowNotifyGate, workflowNotifyJournal, workflowRecoverOpts, worktreeReap } = ctx;
9
9
  const reaper = startReapers({
10
10
  config, logger, metrics, localRoot, backend, subRunner, runStore, checkpointStore, parkCommits,
11
11
  rateLimiter, costQuota, toolResultStore, fileHistoryErasure, taskAttachmentStore, imageBakes, worktreeReap,
12
12
  workflowNotifyGate, workflowRecoverOpts, workflowJournalStore, sqlWorkflowRunStore, workflowNotifyJournal, rosterStore,
13
- backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger,
13
+ backgroundAgentStore, mailboxStore, toolApproval, permissionRuleStores, approvalNonceStore, userInputLedger, approvalAskAudit,
14
14
  getRunDenySweep: () => runDenySweep,
15
15
  });
16
16
  const ttlMs = config.retentionSweep.intervalSec * 1000 * RETENTION_LEASE_TTL_FACTOR;
@@ -18,6 +18,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
18
18
  }>) | undefined;
19
19
  webAdminJwtVerifier: import("../auth-bridge.js").WebAdminJwtVerifier | undefined;
20
20
  sessionAudit: ((sessionId: string, opts?: import("../audit.js").SessionAuditReadOpts) => Promise<{
21
+ agent?: import("../audit.js").SessionAgent | undefined;
21
22
  owner: string | null;
22
23
  sessionId: string;
23
24
  createdAt: string;
@@ -102,6 +103,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
102
103
  workflowCompletionInbox: import("../orchestration/workflow-completion-inbox.js").WorkflowCompletionInbox | undefined;
103
104
  workflowJournalStore: import("../plugins/store-backend.js").ServiceWorkflowJournalStore | undefined;
104
105
  workflowModelAllowlistSnapshot: readonly string[];
106
+ workflowParkDecisions: import("../orchestration/workflow-park-decision.js").WorkflowParkDecisionStore | undefined;
105
107
  workflowNotifyGate: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyGate | undefined;
106
108
  workflowNotifyJournal: import("../orchestration/workflow-notify-journal.js").WorkflowNotifyJournalStore | undefined;
107
109
  workflowRecoverOpts: {
@@ -111,6 +113,7 @@ export declare function runStage09(ctx: Awaited<ReturnType<typeof runStage08>>):
111
113
  };
112
114
  workflowRunStore: import("../orchestration/workflow-notify-journal.js").JournalingWorkflowRunStore | undefined;
113
115
  workflowsCapable: boolean;
116
+ orgDeliveryGate: import("@sema-agent/core").OrgDeliveryGate | undefined;
114
117
  deploymentMods: readonly import("@sema-agent/core").ModRegistration<import("@sema-agent/core").EngineDollar>[];
115
118
  deviceLane: import("./device-lane.js").DeviceLane | undefined;
116
119
  dropSessionScoped: (sid: string) => void;