@assemblyline-agents/runtime 1.0.0 → 3.0.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 (460) hide show
  1. package/LICENSE +1 -1
  2. package/dist/a2a-client.d.ts +22 -0
  3. package/dist/a2a-client.d.ts.map +1 -0
  4. package/dist/a2a-client.js +211 -0
  5. package/dist/a2a-client.js.map +1 -0
  6. package/dist/agent-capability-snapshot.d.ts +32 -0
  7. package/dist/agent-capability-snapshot.d.ts.map +1 -0
  8. package/dist/agent-capability-snapshot.js +77 -0
  9. package/dist/agent-capability-snapshot.js.map +1 -0
  10. package/dist/agent-event-handlers.d.ts +21 -0
  11. package/dist/agent-event-handlers.d.ts.map +1 -0
  12. package/dist/agent-event-handlers.js +64 -0
  13. package/dist/agent-event-handlers.js.map +1 -0
  14. package/dist/agent-hook-context.d.ts +8 -0
  15. package/dist/agent-hook-context.d.ts.map +1 -0
  16. package/dist/agent-hook-context.js +29 -0
  17. package/dist/agent-hook-context.js.map +1 -0
  18. package/dist/agent-hook-evaluation.d.ts +61 -0
  19. package/dist/agent-hook-evaluation.d.ts.map +1 -0
  20. package/dist/agent-hook-evaluation.js +197 -0
  21. package/dist/agent-hook-evaluation.js.map +1 -0
  22. package/dist/agent-hook-run-lifecycle.d.ts +44 -0
  23. package/dist/agent-hook-run-lifecycle.d.ts.map +1 -0
  24. package/dist/agent-hook-run-lifecycle.js +76 -0
  25. package/dist/agent-hook-run-lifecycle.js.map +1 -0
  26. package/dist/agent-state.d.ts +31 -0
  27. package/dist/agent-state.d.ts.map +1 -0
  28. package/dist/agent-state.js +80 -0
  29. package/dist/agent-state.js.map +1 -0
  30. package/dist/agent-surface.d.ts +32 -0
  31. package/dist/agent-surface.d.ts.map +1 -0
  32. package/dist/agent-surface.js +85 -0
  33. package/dist/agent-surface.js.map +1 -0
  34. package/dist/attachments.d.ts +5 -1
  35. package/dist/attachments.d.ts.map +1 -1
  36. package/dist/attachments.js +58 -32
  37. package/dist/attachments.js.map +1 -1
  38. package/dist/audience.d.ts +30 -0
  39. package/dist/audience.d.ts.map +1 -0
  40. package/dist/audience.js +68 -0
  41. package/dist/audience.js.map +1 -0
  42. package/dist/authored-hooks.d.ts +6 -0
  43. package/dist/authored-hooks.d.ts.map +1 -0
  44. package/dist/authored-hooks.js +17 -0
  45. package/dist/authored-hooks.js.map +1 -0
  46. package/dist/automation-event-match.d.ts +8 -0
  47. package/dist/automation-event-match.d.ts.map +1 -0
  48. package/dist/automation-event-match.js +25 -0
  49. package/dist/automation-event-match.js.map +1 -0
  50. package/dist/background-review-trigger.d.ts +9 -0
  51. package/dist/background-review-trigger.d.ts.map +1 -0
  52. package/dist/background-review-trigger.js +72 -0
  53. package/dist/background-review-trigger.js.map +1 -0
  54. package/dist/background-review-types.d.ts +60 -0
  55. package/dist/background-review-types.d.ts.map +1 -0
  56. package/dist/background-review-types.js +2 -0
  57. package/dist/background-review-types.js.map +1 -0
  58. package/dist/background-review-worker.d.ts +14 -0
  59. package/dist/background-review-worker.d.ts.map +1 -0
  60. package/dist/background-review-worker.js +61 -0
  61. package/dist/background-review-worker.js.map +1 -0
  62. package/dist/background-review.d.ts +5 -0
  63. package/dist/background-review.d.ts.map +1 -0
  64. package/dist/background-review.js +332 -0
  65. package/dist/background-review.js.map +1 -0
  66. package/dist/builtin-tool-executors.d.ts +50 -27
  67. package/dist/builtin-tool-executors.d.ts.map +1 -1
  68. package/dist/builtin-tool-executors.js +332 -124
  69. package/dist/builtin-tool-executors.js.map +1 -1
  70. package/dist/builtin-tools.d.ts +16 -9
  71. package/dist/builtin-tools.d.ts.map +1 -1
  72. package/dist/builtin-tools.js +308 -116
  73. package/dist/builtin-tools.js.map +1 -1
  74. package/dist/capability-catalog.d.ts +3 -2
  75. package/dist/capability-catalog.d.ts.map +1 -1
  76. package/dist/capability-catalog.js +12 -7
  77. package/dist/capability-catalog.js.map +1 -1
  78. package/dist/capability-inspection.d.ts +31 -0
  79. package/dist/capability-inspection.d.ts.map +1 -0
  80. package/dist/capability-inspection.js +58 -0
  81. package/dist/capability-inspection.js.map +1 -0
  82. package/dist/channel-http-util.d.ts.map +1 -1
  83. package/dist/channel-http-util.js +6 -5
  84. package/dist/channel-http-util.js.map +1 -1
  85. package/dist/channel-ingress.d.ts +16 -1
  86. package/dist/channel-ingress.d.ts.map +1 -1
  87. package/dist/channel-ingress.js +152 -14
  88. package/dist/channel-ingress.js.map +1 -1
  89. package/dist/channel.d.ts +73 -3
  90. package/dist/channel.d.ts.map +1 -1
  91. package/dist/checkpoints.d.ts +1 -1
  92. package/dist/checkpoints.d.ts.map +1 -1
  93. package/dist/checkpoints.js +6 -6
  94. package/dist/checkpoints.js.map +1 -1
  95. package/dist/child-process-env.d.ts +7 -0
  96. package/dist/child-process-env.d.ts.map +1 -0
  97. package/dist/child-process-env.js +41 -0
  98. package/dist/child-process-env.js.map +1 -0
  99. package/dist/computer-relay-protocol.d.ts.map +1 -1
  100. package/dist/computer-relay-protocol.js +4 -4
  101. package/dist/computer-relay-protocol.js.map +1 -1
  102. package/dist/concurrency.d.ts +1 -1
  103. package/dist/concurrency.js +1 -1
  104. package/dist/connection-auth-util.d.ts +1 -0
  105. package/dist/connection-auth-util.d.ts.map +1 -1
  106. package/dist/connection-auth-util.js +3 -1
  107. package/dist/connection-auth-util.js.map +1 -1
  108. package/dist/connection-clients.d.ts +11 -3
  109. package/dist/connection-clients.d.ts.map +1 -1
  110. package/dist/connection-clients.js +71 -8
  111. package/dist/connection-clients.js.map +1 -1
  112. package/dist/connection-event-store.d.ts +98 -0
  113. package/dist/connection-event-store.d.ts.map +1 -0
  114. package/dist/connection-event-store.js +162 -0
  115. package/dist/connection-event-store.js.map +1 -0
  116. package/dist/connection-events.d.ts +51 -0
  117. package/dist/connection-events.d.ts.map +1 -0
  118. package/dist/connection-events.js +343 -0
  119. package/dist/connection-events.js.map +1 -0
  120. package/dist/connection-stores.d.ts +6 -0
  121. package/dist/connection-stores.d.ts.map +1 -1
  122. package/dist/connection-stores.js +20 -1
  123. package/dist/connection-stores.js.map +1 -1
  124. package/dist/connection-util.d.ts +3 -2
  125. package/dist/connection-util.d.ts.map +1 -1
  126. package/dist/connection-util.js +18 -1
  127. package/dist/connection-util.js.map +1 -1
  128. package/dist/connections.d.ts +60 -5
  129. package/dist/connections.d.ts.map +1 -1
  130. package/dist/connections.js +390 -57
  131. package/dist/connections.js.map +1 -1
  132. package/dist/context-policy-util.d.ts.map +1 -1
  133. package/dist/context-policy-util.js +1 -3
  134. package/dist/context-policy-util.js.map +1 -1
  135. package/dist/conversation-context.d.ts +9 -4
  136. package/dist/conversation-context.d.ts.map +1 -1
  137. package/dist/conversation-context.js +65 -19
  138. package/dist/conversation-context.js.map +1 -1
  139. package/dist/conversation-transcript.d.ts +8 -5
  140. package/dist/conversation-transcript.d.ts.map +1 -1
  141. package/dist/conversation-transcript.js +24 -5
  142. package/dist/conversation-transcript.js.map +1 -1
  143. package/dist/conversation-turn-coalescing.d.ts +22 -0
  144. package/dist/conversation-turn-coalescing.d.ts.map +1 -0
  145. package/dist/conversation-turn-coalescing.js +121 -0
  146. package/dist/conversation-turn-coalescing.js.map +1 -0
  147. package/dist/conversation-turn-dispatch.d.ts +5 -2
  148. package/dist/conversation-turn-dispatch.d.ts.map +1 -1
  149. package/dist/conversation-turn-dispatch.js +59 -22
  150. package/dist/conversation-turn-dispatch.js.map +1 -1
  151. package/dist/default-outbound-route.d.ts +29 -0
  152. package/dist/default-outbound-route.d.ts.map +1 -0
  153. package/dist/default-outbound-route.js +105 -0
  154. package/dist/default-outbound-route.js.map +1 -0
  155. package/dist/delivery-artifacts.d.ts +2 -0
  156. package/dist/delivery-artifacts.d.ts.map +1 -0
  157. package/dist/delivery-artifacts.js +34 -0
  158. package/dist/delivery-artifacts.js.map +1 -0
  159. package/dist/delivery-files.d.ts +5 -0
  160. package/dist/delivery-files.d.ts.map +1 -0
  161. package/dist/delivery-files.js +33 -0
  162. package/dist/delivery-files.js.map +1 -0
  163. package/dist/delivery-queue.d.ts +21 -1
  164. package/dist/delivery-queue.d.ts.map +1 -1
  165. package/dist/delivery-queue.js +144 -1
  166. package/dist/delivery-queue.js.map +1 -1
  167. package/dist/delivery-send.d.ts +2 -2
  168. package/dist/delivery-send.d.ts.map +1 -1
  169. package/dist/delivery-send.js +256 -100
  170. package/dist/delivery-send.js.map +1 -1
  171. package/dist/durable-files.d.ts +37 -0
  172. package/dist/durable-files.d.ts.map +1 -0
  173. package/dist/durable-files.js +63 -0
  174. package/dist/durable-files.js.map +1 -0
  175. package/dist/harness-loop.d.ts +18 -9
  176. package/dist/harness-loop.d.ts.map +1 -1
  177. package/dist/harness-loop.js +245 -50
  178. package/dist/harness-loop.js.map +1 -1
  179. package/dist/heic-transcode-worker.d.ts +2 -0
  180. package/dist/heic-transcode-worker.d.ts.map +1 -0
  181. package/dist/heic-transcode-worker.js +59 -0
  182. package/dist/heic-transcode-worker.js.map +1 -0
  183. package/dist/heic-transcode.d.ts +18 -0
  184. package/dist/heic-transcode.d.ts.map +1 -0
  185. package/dist/heic-transcode.js +99 -0
  186. package/dist/heic-transcode.js.map +1 -0
  187. package/dist/human-input-routing.d.ts +22 -0
  188. package/dist/human-input-routing.d.ts.map +1 -0
  189. package/dist/human-input-routing.js +26 -0
  190. package/dist/human-input-routing.js.map +1 -0
  191. package/dist/in-memory-agent-state-store.d.ts +21 -0
  192. package/dist/in-memory-agent-state-store.d.ts.map +1 -0
  193. package/dist/in-memory-agent-state-store.js +97 -0
  194. package/dist/in-memory-agent-state-store.js.map +1 -0
  195. package/dist/in-memory-conversation-turn-store.d.ts +3 -1
  196. package/dist/in-memory-conversation-turn-store.d.ts.map +1 -1
  197. package/dist/in-memory-conversation-turn-store.js +41 -2
  198. package/dist/in-memory-conversation-turn-store.js.map +1 -1
  199. package/dist/in-memory-run-store.d.ts +8 -0
  200. package/dist/in-memory-run-store.d.ts.map +1 -1
  201. package/dist/in-memory-run-store.js +28 -5
  202. package/dist/in-memory-run-store.js.map +1 -1
  203. package/dist/in-memory-sandbox-session-store.d.ts +2 -1
  204. package/dist/in-memory-sandbox-session-store.d.ts.map +1 -1
  205. package/dist/in-memory-sandbox-session-store.js +65 -1
  206. package/dist/in-memory-sandbox-session-store.js.map +1 -1
  207. package/dist/in-memory-small-stores.d.ts +18 -1
  208. package/dist/in-memory-small-stores.d.ts.map +1 -1
  209. package/dist/in-memory-small-stores.js +107 -1
  210. package/dist/in-memory-small-stores.js.map +1 -1
  211. package/dist/in-memory-workspace-store.d.ts +40 -0
  212. package/dist/in-memory-workspace-store.d.ts.map +1 -0
  213. package/dist/in-memory-workspace-store.js +370 -0
  214. package/dist/in-memory-workspace-store.js.map +1 -0
  215. package/dist/index.d.ts +116 -45
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +637 -566
  218. package/dist/index.js.map +1 -1
  219. package/dist/json-util.d.ts +8 -0
  220. package/dist/json-util.d.ts.map +1 -1
  221. package/dist/json-util.js +8 -0
  222. package/dist/json-util.js.map +1 -1
  223. package/dist/learning-store.d.ts +111 -0
  224. package/dist/learning-store.d.ts.map +1 -0
  225. package/dist/learning-store.js +193 -0
  226. package/dist/learning-store.js.map +1 -0
  227. package/dist/local-sandbox.d.ts +3 -2
  228. package/dist/local-sandbox.d.ts.map +1 -1
  229. package/dist/local-sandbox.js +69 -25
  230. package/dist/local-sandbox.js.map +1 -1
  231. package/dist/mcp-client.d.ts.map +1 -1
  232. package/dist/mcp-client.js +3 -2
  233. package/dist/mcp-client.js.map +1 -1
  234. package/dist/media-processor.d.ts +42 -0
  235. package/dist/media-processor.d.ts.map +1 -0
  236. package/dist/media-processor.js +2 -0
  237. package/dist/media-processor.js.map +1 -0
  238. package/dist/model-media.d.ts +13 -1
  239. package/dist/model-media.d.ts.map +1 -1
  240. package/dist/model-media.js +81 -18
  241. package/dist/model-media.js.map +1 -1
  242. package/dist/model-visible-interrupts.d.ts +10 -0
  243. package/dist/model-visible-interrupts.d.ts.map +1 -0
  244. package/dist/model-visible-interrupts.js +41 -0
  245. package/dist/model-visible-interrupts.js.map +1 -0
  246. package/dist/operator-controls.d.ts.map +1 -1
  247. package/dist/operator-controls.js +16 -3
  248. package/dist/operator-controls.js.map +1 -1
  249. package/dist/outbound-http-policy.d.ts +7 -0
  250. package/dist/outbound-http-policy.d.ts.map +1 -0
  251. package/dist/outbound-http-policy.js +155 -0
  252. package/dist/outbound-http-policy.js.map +1 -0
  253. package/dist/principals.d.ts +18 -0
  254. package/dist/principals.d.ts.map +1 -0
  255. package/dist/principals.js +90 -0
  256. package/dist/principals.js.map +1 -0
  257. package/dist/public-api.d.ts +21 -0
  258. package/dist/public-api.d.ts.map +1 -0
  259. package/dist/public-api.js +19 -0
  260. package/dist/public-api.js.map +1 -0
  261. package/dist/replay-resume.d.ts +15 -3
  262. package/dist/replay-resume.d.ts.map +1 -1
  263. package/dist/replay-resume.js +256 -24
  264. package/dist/replay-resume.js.map +1 -1
  265. package/dist/resource-projection-util.d.ts +1 -1
  266. package/dist/resource-projection-util.d.ts.map +1 -1
  267. package/dist/resource-projection-util.js +21 -10
  268. package/dist/resource-projection-util.js.map +1 -1
  269. package/dist/resource-projection.d.ts +8 -1
  270. package/dist/resource-projection.d.ts.map +1 -1
  271. package/dist/resource-projection.js +230 -26
  272. package/dist/resource-projection.js.map +1 -1
  273. package/dist/run-heartbeat.d.ts +12 -2
  274. package/dist/run-heartbeat.d.ts.map +1 -1
  275. package/dist/run-heartbeat.js +31 -4
  276. package/dist/run-heartbeat.js.map +1 -1
  277. package/dist/run-outcome.d.ts +9 -5
  278. package/dist/run-outcome.d.ts.map +1 -1
  279. package/dist/run-outcome.js +16 -5
  280. package/dist/run-outcome.js.map +1 -1
  281. package/dist/run-recovery.d.ts +31 -2
  282. package/dist/run-recovery.d.ts.map +1 -1
  283. package/dist/run-recovery.js +211 -32
  284. package/dist/run-recovery.js.map +1 -1
  285. package/dist/run-replay.d.ts +35 -0
  286. package/dist/run-replay.d.ts.map +1 -0
  287. package/dist/run-replay.js +193 -0
  288. package/dist/run-replay.js.map +1 -0
  289. package/dist/run-result.d.ts +4 -0
  290. package/dist/run-result.d.ts.map +1 -0
  291. package/dist/run-result.js +18 -0
  292. package/dist/run-result.js.map +1 -0
  293. package/dist/run-timeline-query.d.ts +38 -0
  294. package/dist/run-timeline-query.d.ts.map +1 -0
  295. package/dist/run-timeline-query.js +99 -0
  296. package/dist/run-timeline-query.js.map +1 -0
  297. package/dist/runs-query.d.ts.map +1 -1
  298. package/dist/runs-query.js +12 -4
  299. package/dist/runs-query.js.map +1 -1
  300. package/dist/runtime-bundle.d.ts.map +1 -1
  301. package/dist/runtime-bundle.js +2 -0
  302. package/dist/runtime-bundle.js.map +1 -1
  303. package/dist/runtime-learning.d.ts +88 -0
  304. package/dist/runtime-learning.d.ts.map +1 -0
  305. package/dist/runtime-learning.js +260 -0
  306. package/dist/runtime-learning.js.map +1 -0
  307. package/dist/runtime-types.d.ts +79 -10
  308. package/dist/runtime-types.d.ts.map +1 -1
  309. package/dist/sandbox-fs.d.ts +9 -5
  310. package/dist/sandbox-fs.d.ts.map +1 -1
  311. package/dist/sandbox-fs.js +50 -33
  312. package/dist/sandbox-fs.js.map +1 -1
  313. package/dist/sandbox-handle.d.ts +25 -0
  314. package/dist/sandbox-handle.d.ts.map +1 -0
  315. package/dist/sandbox-handle.js +120 -0
  316. package/dist/sandbox-handle.js.map +1 -0
  317. package/dist/sandbox-session-identity.d.ts +14 -0
  318. package/dist/sandbox-session-identity.d.ts.map +1 -0
  319. package/dist/sandbox-session-identity.js +33 -0
  320. package/dist/sandbox-session-identity.js.map +1 -0
  321. package/dist/sandbox-session-key.d.ts.map +1 -1
  322. package/dist/sandbox-session-key.js +14 -10
  323. package/dist/sandbox-session-key.js.map +1 -1
  324. package/dist/sandbox-session-lifecycle.d.ts +12 -0
  325. package/dist/sandbox-session-lifecycle.d.ts.map +1 -0
  326. package/dist/sandbox-session-lifecycle.js +261 -0
  327. package/dist/sandbox-session-lifecycle.js.map +1 -0
  328. package/dist/sandbox-snapshot-policy.js +3 -3
  329. package/dist/sandbox-snapshot-policy.js.map +1 -1
  330. package/dist/sandbox-state-sync.d.ts +22 -0
  331. package/dist/sandbox-state-sync.d.ts.map +1 -0
  332. package/dist/sandbox-state-sync.js +147 -0
  333. package/dist/sandbox-state-sync.js.map +1 -0
  334. package/dist/sandbox-sync-worker.d.ts +11 -2
  335. package/dist/sandbox-sync-worker.d.ts.map +1 -1
  336. package/dist/sandbox-sync-worker.js +143 -31
  337. package/dist/sandbox-sync-worker.js.map +1 -1
  338. package/dist/schedule-execution.d.ts.map +1 -1
  339. package/dist/schedule-execution.js +187 -57
  340. package/dist/schedule-execution.js.map +1 -1
  341. package/dist/sdk-api-client.d.ts +17 -0
  342. package/dist/sdk-api-client.d.ts.map +1 -0
  343. package/dist/sdk-api-client.js +55 -0
  344. package/dist/sdk-api-client.js.map +1 -0
  345. package/dist/security.js +2 -2
  346. package/dist/security.js.map +1 -1
  347. package/dist/self-improvement.d.ts +34 -6
  348. package/dist/self-improvement.d.ts.map +1 -1
  349. package/dist/self-improvement.js +140 -34
  350. package/dist/self-improvement.js.map +1 -1
  351. package/dist/skill-bundles.d.ts +55 -0
  352. package/dist/skill-bundles.d.ts.map +1 -0
  353. package/dist/skill-bundles.js +134 -0
  354. package/dist/skill-bundles.js.map +1 -0
  355. package/dist/source-loader.d.ts +8 -0
  356. package/dist/source-loader.d.ts.map +1 -1
  357. package/dist/source-loader.js +41 -10
  358. package/dist/source-loader.js.map +1 -1
  359. package/dist/state-store-helpers.d.ts +2 -0
  360. package/dist/state-store-helpers.d.ts.map +1 -1
  361. package/dist/state-store-helpers.js +11 -1
  362. package/dist/state-store-helpers.js.map +1 -1
  363. package/dist/state-stores.d.ts +2 -0
  364. package/dist/state-stores.d.ts.map +1 -1
  365. package/dist/state-stores.js +40 -7
  366. package/dist/state-stores.js.map +1 -1
  367. package/dist/state.d.ts +344 -5
  368. package/dist/state.d.ts.map +1 -1
  369. package/dist/state.js +44 -2
  370. package/dist/state.js.map +1 -1
  371. package/dist/storage.d.ts +59 -2
  372. package/dist/storage.d.ts.map +1 -1
  373. package/dist/storage.js +183 -6
  374. package/dist/storage.js.map +1 -1
  375. package/dist/subagent-execution.d.ts +7 -6
  376. package/dist/subagent-execution.d.ts.map +1 -1
  377. package/dist/subagent-execution.js +58 -19
  378. package/dist/subagent-execution.js.map +1 -1
  379. package/dist/target-instructions.d.ts +14 -0
  380. package/dist/target-instructions.d.ts.map +1 -0
  381. package/dist/target-instructions.js +18 -0
  382. package/dist/target-instructions.js.map +1 -0
  383. package/dist/tool-apis.d.ts.map +1 -1
  384. package/dist/tool-apis.js +55 -10
  385. package/dist/tool-apis.js.map +1 -1
  386. package/dist/tool-execution.d.ts +26 -13
  387. package/dist/tool-execution.d.ts.map +1 -1
  388. package/dist/tool-execution.js +368 -239
  389. package/dist/tool-execution.js.map +1 -1
  390. package/dist/turn-media.d.ts +29 -0
  391. package/dist/turn-media.d.ts.map +1 -0
  392. package/dist/turn-media.js +233 -0
  393. package/dist/turn-media.js.map +1 -0
  394. package/dist/usage-reconciliation.d.ts +1 -1
  395. package/dist/usage-reconciliation.js +1 -1
  396. package/dist/workspace-id.d.ts +10 -0
  397. package/dist/workspace-id.d.ts.map +1 -0
  398. package/dist/workspace-id.js +55 -0
  399. package/dist/workspace-id.js.map +1 -0
  400. package/dist/workspace-manifest.d.ts +24 -0
  401. package/dist/workspace-manifest.d.ts.map +1 -0
  402. package/dist/workspace-manifest.js +111 -0
  403. package/dist/workspace-manifest.js.map +1 -0
  404. package/dist/workspace-operation-limiter.d.ts +16 -0
  405. package/dist/workspace-operation-limiter.d.ts.map +1 -0
  406. package/dist/workspace-operation-limiter.js +31 -0
  407. package/dist/workspace-operation-limiter.js.map +1 -0
  408. package/dist/workspace-operations.d.ts +145 -0
  409. package/dist/workspace-operations.d.ts.map +1 -0
  410. package/dist/workspace-operations.js +420 -0
  411. package/dist/workspace-operations.js.map +1 -0
  412. package/dist/workspace-runtime.d.ts +110 -0
  413. package/dist/workspace-runtime.d.ts.map +1 -0
  414. package/dist/workspace-runtime.js +240 -0
  415. package/dist/workspace-runtime.js.map +1 -0
  416. package/dist/workspace-search.d.ts +55 -0
  417. package/dist/workspace-search.d.ts.map +1 -0
  418. package/dist/workspace-search.js +262 -0
  419. package/dist/workspace-search.js.map +1 -0
  420. package/dist/workspace-service.d.ts +173 -0
  421. package/dist/workspace-service.d.ts.map +1 -0
  422. package/dist/workspace-service.js +619 -0
  423. package/dist/workspace-service.js.map +1 -0
  424. package/dist/workspace.d.ts +7 -0
  425. package/dist/workspace.d.ts.map +1 -0
  426. package/dist/workspace.js +7 -0
  427. package/dist/workspace.js.map +1 -0
  428. package/package.json +7 -4
  429. package/dist/agent-harness.d.ts +0 -108
  430. package/dist/agent-harness.d.ts.map +0 -1
  431. package/dist/agent-harness.js +0 -2
  432. package/dist/agent-harness.js.map +0 -1
  433. package/dist/attachments-legacy.d.ts +0 -17
  434. package/dist/attachments-legacy.d.ts.map +0 -1
  435. package/dist/attachments-legacy.js +0 -273
  436. package/dist/attachments-legacy.js.map +0 -1
  437. package/dist/code-mode.d.ts +0 -20
  438. package/dist/code-mode.d.ts.map +0 -1
  439. package/dist/code-mode.js +0 -658
  440. package/dist/code-mode.js.map +0 -1
  441. package/dist/hook-dispatch.d.ts +0 -19
  442. package/dist/hook-dispatch.d.ts.map +0 -1
  443. package/dist/hook-dispatch.js +0 -37
  444. package/dist/hook-dispatch.js.map +0 -1
  445. package/dist/pi-agent-harness.d.ts +0 -40
  446. package/dist/pi-agent-harness.d.ts.map +0 -1
  447. package/dist/pi-agent-harness.js +0 -222
  448. package/dist/pi-agent-harness.js.map +0 -1
  449. package/dist/pi-harness.d.ts +0 -42
  450. package/dist/pi-harness.d.ts.map +0 -1
  451. package/dist/pi-harness.js +0 -142
  452. package/dist/pi-harness.js.map +0 -1
  453. package/dist/run-resolver.d.ts +0 -35
  454. package/dist/run-resolver.d.ts.map +0 -1
  455. package/dist/run-resolver.js +0 -84
  456. package/dist/run-resolver.js.map +0 -1
  457. package/dist/usage-budget.d.ts +0 -29
  458. package/dist/usage-budget.d.ts.map +0 -1
  459. package/dist/usage-budget.js +0 -145
  460. package/dist/usage-budget.js.map +0 -1
@@ -4,8 +4,12 @@ import { dueTimeForSchedule, dynamicScheduleMessage, stringValue, timestamp } fr
4
4
  import { buildDefaultContextBundle } from "./sandbox-fs.js";
5
5
  import { isJsonObject, safeJson } from "./json-util.js";
6
6
  import { failRun } from "./run-outcome.js";
7
+ import { loadDefaultOutboundRoute } from "./default-outbound-route.js";
7
8
  import { isRuntimeSettingsStore } from "./state.js";
8
9
  import { memoryBodyText, memoryDocumentSummary, positiveLimit } from "./storage.js";
10
+ import { defaultUserPrincipal, initiatorFromRun, principalFromRun } from "./principals.js";
11
+ import { audienceFromMetadata, audienceFromRun, normalizeAgentAudience } from "./audience.js";
12
+ import { matchingEventAutomations } from "./automation-event-match.js";
9
13
  export async function registerManifestSchedulesImpl(host) {
10
14
  const records = [];
11
15
  for (const schedule of manifestScheduleRegistrations(host)) {
@@ -37,12 +41,27 @@ export async function runDueSchedulesImpl(host, options = {}) {
37
41
  continue;
38
42
  const dueAtIso = dueAt.toISOString();
39
43
  const idempotencyKey = `${schedule.idempotencyKey}:${dueAtIso}`;
44
+ let job;
45
+ try {
46
+ job = await manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey);
47
+ }
48
+ catch (error) {
49
+ const message = error instanceof Error ? error.message : String(error);
50
+ await host.state.recordScheduleRun({
51
+ scheduleId: schedule.schedule,
52
+ runAt: dueAtIso,
53
+ idempotencyKey,
54
+ status: "failed"
55
+ });
56
+ results.push({ schedule: schedule.schedule, dueAt: dueAtIso, idempotencyKey, status: "failed", error: message });
57
+ continue;
58
+ }
40
59
  // Message schedules run through the bounded semaphore; claim capacity
41
60
  // BEFORE reserving the idempotency key so a saturated runtime skips the
42
61
  // tick without burning the key (the next sweep retries). Triggered
43
62
  // schedules use an existingRun and bypass admission (enter()).
44
63
  let admission;
45
- if (!schedule.trigger) {
64
+ if (!schedule.trigger && !schedule.lifecycle) {
46
65
  const admitted = host.admitRunOrReject();
47
66
  if (admitted instanceof RunCapacityError) {
48
67
  results.push({ schedule: schedule.schedule, dueAt: dueAtIso, idempotencyKey, status: "skipped", error: "run capacity saturated" });
@@ -71,7 +90,6 @@ export async function runDueSchedulesImpl(host, options = {}) {
71
90
  admission?.release();
72
91
  throw error;
73
92
  });
74
- const job = manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey);
75
93
  try {
76
94
  results.push(await runScheduleExecution(host, job, admission));
77
95
  }
@@ -100,13 +118,7 @@ export async function dispatchAutomationEventImpl(host, event) {
100
118
  throw new Error("Automation event occurredAt must be a valid ISO timestamp.");
101
119
  }
102
120
  const results = [];
103
- for (const automation of host.manifest.automationRegistrations ?? []) {
104
- if (automation.trigger.type !== "event")
105
- continue;
106
- if (automation.trigger.source !== event.source || automation.trigger.event !== event.event)
107
- continue;
108
- if (automation.trigger.filter && !jsonSubsetMatches(automation.trigger.filter, event.payload))
109
- continue;
121
+ for (const automation of matchingEventAutomations(host.manifest, event)) {
110
122
  const idempotencyKey = `${automation.idempotencyKey}:${event.eventId}`;
111
123
  let admission;
112
124
  if (!automation.lifecycle) {
@@ -139,6 +151,19 @@ export async function dispatchAutomationEventImpl(host, event) {
139
151
  }
140
152
  const execution = eventAutomationExecution(host, automation, event, idempotencyKey);
141
153
  try {
154
+ // Schedule-run records use the same durable ledger for schedule and event
155
+ // automations. Postgres enforces that every ledger row has a registered
156
+ // parent, so register the event automation before its first dispatch.
157
+ await host.state.registerSchedule({
158
+ id: automation.automation,
159
+ name: `automation:${automation.automation}`,
160
+ cron: `@event ${automation.trigger.source}:${automation.trigger.event}`,
161
+ metadata: {
162
+ agentRevision: host.manifest.agentRevision,
163
+ trigger: safeJson(automation.trigger),
164
+ message: automation.message ?? null
165
+ }
166
+ });
142
167
  const result = await runScheduleExecution(host, execution, admission);
143
168
  results.push({
144
169
  automation: automation.automation,
@@ -150,6 +175,10 @@ export async function dispatchAutomationEventImpl(host, event) {
150
175
  });
151
176
  }
152
177
  catch (error) {
178
+ // No durable evidence of this event exists on a throw (a durable run —
179
+ // even a failed one — resolves): un-burn the reservation so a provider
180
+ // retry can redeliver instead of the event being lost forever.
181
+ await host.state.releaseIdempotencyKey?.(`automation:${automation.automation}:event`, idempotencyKey).catch(() => undefined);
153
182
  results.push({
154
183
  automation: automation.automation,
155
184
  eventId: event.eventId,
@@ -164,13 +193,16 @@ export async function dispatchAutomationEventImpl(host, event) {
164
193
  function eventAutomationExecution(host, automation, event, idempotencyKey) {
165
194
  const eventAt = event.occurredAt ?? timestamp();
166
195
  const compiled = host.manifest.automations?.find((candidate) => candidate.name === automation.automation);
167
- const trigger = automation.lifecycle
168
- ? {
169
- handler: automation.lifecycle.handler,
170
- ...(automation.target ? { target: automation.target } : {}),
171
- ...(automation.metadata ? { metadata: automation.metadata } : {})
172
- }
173
- : undefined;
196
+ const principal = event.principal ?? defaultUserPrincipal(event.userId, event.source);
197
+ const initiator = event.initiator ?? principal;
198
+ const audience = normalizeAgentAudience(event.audience)
199
+ ?? (host.manifest.agent.audienceIsolation !== true
200
+ ? trustedScheduleAudience({ ...(principal ? { principal } : {}), ...(event.conversationId ? { conversationId: event.conversationId } : {}) })
201
+ : event.conversationId
202
+ ? { private: false, conversationId: event.conversationId }
203
+ : principal
204
+ ? { private: true, principal }
205
+ : { private: true });
174
206
  return {
175
207
  source: "manifest",
176
208
  scheduleId: automation.automation,
@@ -179,7 +211,7 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
179
211
  idempotencyKey,
180
212
  message: automation.message ?? `Handle ${event.event} from ${event.source}.`,
181
213
  channel: "automation",
182
- ...(trigger ? { trigger } : {}),
214
+ ...(automation.lifecycle ? { lifecycle: automation.lifecycle } : {}),
183
215
  ...(automation.target ? { target: automation.target } : {}),
184
216
  automationEvent: event,
185
217
  metadata: {
@@ -189,6 +221,9 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
189
221
  },
190
222
  definition: safeJson(compiled ?? automation),
191
223
  ...(event.userId ? { userId: event.userId } : {}),
224
+ ...(principal ? { principal } : {}),
225
+ ...(initiator ? { initiator } : {}),
226
+ audience,
192
227
  ...(event.conversationId ? { conversationId: event.conversationId } : {}),
193
228
  ...(event.projectId ? { projectId: event.projectId } : {}),
194
229
  ...(event.delivery ? { delivery: event.delivery } : {}),
@@ -201,19 +236,12 @@ function eventAutomationExecution(host, automation, event, idempotencyKey) {
201
236
  }
202
237
  };
203
238
  }
204
- function jsonSubsetMatches(expected, actual) {
205
- return Object.entries(expected).every(([key, expectedValue]) => {
206
- if (!Object.prototype.hasOwnProperty.call(actual, key))
207
- return false;
208
- const actualValue = actual[key];
209
- if (isJsonObject(expectedValue)) {
210
- return isJsonObject(actualValue) && jsonSubsetMatches(expectedValue, actualValue);
211
- }
212
- return JSON.stringify(expectedValue) === JSON.stringify(actualValue);
213
- });
214
- }
215
- function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
216
- return {
239
+ async function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
240
+ const compiled = compiledSchedule(host, schedule.schedule);
241
+ const compiledMetadata = compiled && "metadata" in compiled && isJsonObject(compiled.metadata)
242
+ ? compiled.metadata
243
+ : {};
244
+ const execution = {
217
245
  source: "manifest",
218
246
  scheduleId: schedule.schedule,
219
247
  resultSchedule: schedule.schedule,
@@ -222,17 +250,50 @@ function manifestScheduleExecution(host, schedule, dueAtIso, idempotencyKey) {
222
250
  message: scheduleMessage(host, schedule.schedule),
223
251
  channel: "schedule",
224
252
  ...(schedule.trigger ? { trigger: schedule.trigger } : {}),
253
+ ...(schedule.lifecycle ? { lifecycle: schedule.lifecycle } : {}),
225
254
  ...(schedule.target ? { target: schedule.target } : {}),
226
255
  metadata: {
256
+ ...compiledMetadata,
227
257
  schedule: schedule.schedule,
228
258
  dueAt: dueAtIso,
229
259
  idempotencyKey
230
260
  },
231
- definition: safeJson(compiledSchedule(host, schedule.schedule) ?? schedule)
261
+ definition: safeJson(compiled ?? schedule)
232
262
  };
263
+ const channel = host.manifest.agent.defaultOutboundChannel?.trim();
264
+ if (!channel)
265
+ return execution;
266
+ if (!isRuntimeSettingsStore(host.state)) {
267
+ throw new Error(`Default outbound channel "${channel}" requires durable runtime settings.`);
268
+ }
269
+ const saved = await loadDefaultOutboundRoute(host.state, host.skillScope(), channel);
270
+ if (!saved) {
271
+ throw new Error(`Default outbound channel "${channel}" has no saved route. Send the agent a message on that channel first.`);
272
+ }
273
+ execution.channel = channel;
274
+ if (saved.userId)
275
+ execution.userId = saved.userId;
276
+ if (saved.principal)
277
+ execution.principal = saved.principal;
278
+ if (saved.initiator)
279
+ execution.initiator = saved.initiator;
280
+ execution.audience = saved.audience;
281
+ if (saved.conversationId)
282
+ execution.conversationId = saved.conversationId;
283
+ if (saved.projectId)
284
+ execution.projectId = saved.projectId;
285
+ if (saved.workspaceId)
286
+ execution.workspaceId = saved.workspaceId;
287
+ if (saved.tenantId)
288
+ execution.tenantId = saved.tenantId;
289
+ if (saved.delivery)
290
+ execution.delivery = saved.delivery;
291
+ return execution;
233
292
  }
234
293
  async function runScheduleExecution(host, schedule, admission) {
235
- return schedule.trigger ? runTriggeredSchedule(host, schedule) : runMessageSchedule(host, schedule, admission);
294
+ return schedule.trigger || schedule.lifecycle
295
+ ? runTriggeredSchedule(host, schedule)
296
+ : runMessageSchedule(host, schedule, admission);
236
297
  }
237
298
  async function runMessageSchedule(host, schedule, admission) {
238
299
  const overrides = admission ? { admission } : {};
@@ -255,6 +316,7 @@ async function runMessageSchedule(host, schedule, admission) {
255
316
  };
256
317
  }
257
318
  function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
319
+ const audience = resolvedScheduleAudience(host, schedule);
258
320
  const options = {
259
321
  message,
260
322
  channel: schedule.channel,
@@ -264,10 +326,19 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
264
326
  };
265
327
  if (schedule.userId)
266
328
  options.userId = schedule.userId;
329
+ if (schedule.principal)
330
+ options.principal = schedule.principal;
331
+ if (schedule.initiator)
332
+ options.initiator = schedule.initiator;
333
+ options.audience = audience;
267
334
  if (schedule.conversationId)
268
335
  options.conversationId = schedule.conversationId;
269
336
  if (schedule.projectId)
270
337
  options.projectId = schedule.projectId;
338
+ if (schedule.workspaceId)
339
+ options.workspaceId = schedule.workspaceId;
340
+ if (schedule.tenantId)
341
+ options.tenantId = schedule.tenantId;
271
342
  if (schedule.delivery)
272
343
  options.delivery = schedule.delivery;
273
344
  if (schedule.conversationId) {
@@ -277,6 +348,9 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
277
348
  conversationId: schedule.conversationId,
278
349
  message,
279
350
  ...(schedule.userId ? { userId: schedule.userId } : {}),
351
+ ...(schedule.principal ? { principal: schedule.principal } : {}),
352
+ ...(schedule.initiator ? { initiator: schedule.initiator } : {}),
353
+ audience,
280
354
  ...(schedule.delivery ? { delivery: schedule.delivery } : {}),
281
355
  ...(schedule.turnMetadata ? { metadata: schedule.turnMetadata } : {})
282
356
  };
@@ -285,11 +359,9 @@ function scheduleRunOptions(host, schedule, message, metadata, overrides = {}) {
285
359
  }
286
360
  async function runTriggeredSchedule(host, schedule) {
287
361
  const trigger = schedule.trigger;
288
- if (!trigger)
289
- throw new Error(`Schedule ${schedule.resultSchedule} has no trigger definition.`);
290
- const handler = automationHandlers(host).find((candidate) => candidate.name === trigger.handler);
362
+ const handler = resolveAutomationLifecycle(host, schedule);
291
363
  if (!handler)
292
- throw new Error(`Trigger handler not found: ${trigger.handler}`);
364
+ throw new Error(`Automation ${schedule.resultSchedule} has no lifecycle definition.`);
293
365
  const invocation = {
294
366
  kind: schedule.automationEvent ? "event" : "schedule",
295
367
  source: schedule.source,
@@ -299,19 +371,25 @@ async function runTriggeredSchedule(host, schedule) {
299
371
  handler: handler.name,
300
372
  idempotencyKey: schedule.idempotencyKey
301
373
  };
302
- if (trigger.metadata)
374
+ if (trigger?.metadata)
303
375
  invocation.metadata = trigger.metadata;
376
+ const audience = resolvedScheduleAudience(host, schedule);
304
377
  let run = await host.state.createRun({
305
378
  agentRevision: host.manifest.agentRevision,
306
379
  status: "created",
307
380
  input: {
308
381
  message: schedule.message,
309
- model: host.manifest.agent.model,
310
382
  channel: schedule.channel,
311
383
  eventId: schedule.idempotencyKey,
312
384
  conversationId: schedule.conversationId ?? null,
385
+ autoConversation: !schedule.conversationId,
313
386
  userId: schedule.userId ?? null,
387
+ principal: schedule.principal ? safeJson(schedule.principal) : null,
388
+ initiator: schedule.initiator ? safeJson(schedule.initiator) : null,
389
+ audience: safeJson(audience),
314
390
  projectId: schedule.projectId ?? null,
391
+ workspaceId: schedule.workspaceId ?? null,
392
+ tenantId: schedule.tenantId ?? null,
315
393
  delivery: schedule.delivery ?? null,
316
394
  metadata: {
317
395
  ...schedule.metadata,
@@ -343,7 +421,7 @@ async function runTriggeredSchedule(host, schedule) {
343
421
  prepareContext = triggerPrepareContext(run.id, prepareResult);
344
422
  await host.state.appendEvent(run.id, "trigger.prepare_completed", {
345
423
  handler: handler.name,
346
- target: safeJson(prepareResult.target ?? trigger.target ?? null),
424
+ target: safeJson(prepareResult.target ?? trigger?.target ?? schedule.target ?? null),
347
425
  promptContext: safeJson(prepareResult.promptContext ?? {})
348
426
  });
349
427
  await host.emitSpan("ai.assembly-line.trigger.prepare", prepareStartedAt, host.runSpanAttributes(run, {
@@ -379,7 +457,7 @@ async function runTriggeredSchedule(host, schedule) {
379
457
  });
380
458
  return { schedule: schedule.resultSchedule, dueAt: schedule.dueAtIso, idempotencyKey: schedule.idempotencyKey, status: "failed", runId: run.id, error: message };
381
459
  }
382
- const target = prepareResult.target ?? trigger.target ?? schedule.target;
460
+ const target = prepareResult.target ?? trigger?.target ?? schedule.target;
383
461
  const promptContext = {
384
462
  triggerKind: invocation.kind,
385
463
  triggerSource: invocation.source ?? "manifest",
@@ -511,6 +589,25 @@ async function runTriggeredSchedule(host, schedule) {
511
589
  ...(finalizeResult.error ? { error: finalizeResult.error } : {})
512
590
  };
513
591
  }
592
+ function resolvedScheduleAudience(host, schedule) {
593
+ if (schedule.audience)
594
+ return schedule.audience;
595
+ if (host.manifest.agent.audienceIsolation !== true)
596
+ return trustedScheduleAudience(schedule);
597
+ if (schedule.conversationId)
598
+ return { private: false, conversationId: schedule.conversationId };
599
+ if (schedule.principal)
600
+ return { private: true, principal: schedule.principal };
601
+ return { private: true };
602
+ }
603
+ /** Without audienceIsolation, schedule fallbacks are trusted like every other run. */
604
+ function trustedScheduleAudience(schedule) {
605
+ return {
606
+ private: true,
607
+ ...(schedule.principal ? { principal: schedule.principal } : {}),
608
+ ...(schedule.conversationId ? { conversationId: schedule.conversationId } : {})
609
+ };
610
+ }
514
611
  async function loadTriggerHandler(host, handler) {
515
612
  const module = await host.sourceLoader.load(handler.source);
516
613
  const candidates = [module.default, module[handler.name], ...Object.values(module)];
@@ -525,7 +622,7 @@ export function normalizeScheduleTriggerDefinitionImpl(host, value) {
525
622
  const handler = stringValue(value.handler);
526
623
  if (!handler)
527
624
  throw new Error("Schedule trigger requires handler.");
528
- if (!automationHandlers(host).some((candidate) => candidate.name === handler)) {
625
+ if (!automationLifecycleSources(host).some((candidate) => candidate.name === handler)) {
529
626
  throw new Error(`Unknown trigger handler: ${handler}`);
530
627
  }
531
628
  const trigger = { handler };
@@ -550,13 +647,13 @@ function normalizeTriggerTarget(value) {
550
647
  return { type, name, ...(isJsonObject(value.metadata) ? { metadata: value.metadata } : {}) };
551
648
  }
552
649
  if (type === "agent") {
650
+ if (value.model !== undefined) {
651
+ throw new Error("Automation targets cannot select a model; use useModel() in agent.ts setup().");
652
+ }
553
653
  const name = stringValue(value.name);
554
- const model = stringValue(value.model);
555
654
  const target = { type };
556
655
  if (name)
557
656
  target.name = name;
558
- if (model)
559
- target.model = model;
560
657
  if (isJsonObject(value.metadata))
561
658
  target.metadata = value.metadata;
562
659
  return target;
@@ -577,6 +674,9 @@ function createTriggerHandlerContext(host, run, schedule, trigger, prepare) {
577
674
  return {
578
675
  runId: run.id,
579
676
  agentRevision: host.manifest.agentRevision,
677
+ ...(principalFromRun(run) ? { principal: principalFromRun(run) } : {}),
678
+ ...(initiatorFromRun(run) ? { initiator: initiatorFromRun(run) } : {}),
679
+ audience: audienceFromRun(run),
580
680
  trigger,
581
681
  state: createTriggerStateApi(host, run),
582
682
  memory: host.createMemoryToolApi(run),
@@ -721,7 +821,7 @@ async function collectTriggerResources(host, run, input = {}) {
721
821
  }
722
822
  }
723
823
  if (requested.has("skills")) {
724
- const skills = (await host.skillStore.list(host.skillScope())).filter((skill) => !skill.pending).slice(0, limit);
824
+ const skills = (await host.skillStore.list(host.skillScope())).filter((skill) => !skill.pending && !skill.archived).slice(0, limit);
725
825
  resources.push(...skills.map((skill) => ({
726
826
  kind: "skill",
727
827
  name: skill.name,
@@ -759,7 +859,7 @@ async function runDueDynamicSchedules(host, now) {
759
859
  const idempotencyKey = `dynamic:${job.id}:${dueAtIso}`;
760
860
  const leaseToken = job.leaseToken ?? "";
761
861
  try {
762
- // openeve_schedule_runs rows reference openeve_schedules; dynamic jobs
862
+ // assembly_line_schedule_runs rows reference assembly_line_schedules; dynamic jobs
763
863
  // live in the schedule store, so upsert a parent row before recording runs.
764
864
  await host.state.registerSchedule({
765
865
  id: `dynamic:${job.id}`,
@@ -832,6 +932,16 @@ function dynamicScheduleExecution(host, job, dueAtIso, idempotencyKey) {
832
932
  const conversationId = job.conversationId ?? targetConversation;
833
933
  const projectId = job.projectId ?? targetProject;
834
934
  const delivery = isJsonObject(job.target) ? job.target : undefined;
935
+ const principal = job.principal ?? defaultUserPrincipal(job.userId, job.channel);
936
+ const initiator = job.initiator ?? principal;
937
+ const audience = audienceFromMetadata(job.metadata)
938
+ ?? (host.manifest.agent.audienceIsolation !== true
939
+ ? trustedScheduleAudience({ ...(principal ? { principal } : {}), ...(conversationId ? { conversationId } : {}) })
940
+ : principal
941
+ ? { private: true, principal }
942
+ : conversationId
943
+ ? { private: false, conversationId }
944
+ : { private: true });
835
945
  const message = dynamicScheduleMessage(job);
836
946
  const trigger = job.trigger ? normalizeScheduleTriggerDefinitionImpl(host, job.trigger) : undefined;
837
947
  const metadata = {
@@ -860,6 +970,9 @@ function dynamicScheduleExecution(host, job, dueAtIso, idempotencyKey) {
860
970
  metadata,
861
971
  definition: safeJson(definition),
862
972
  ...(job.userId ? { userId: job.userId } : {}),
973
+ ...(principal ? { principal } : {}),
974
+ ...(initiator ? { initiator } : {}),
975
+ audience,
863
976
  ...(conversationId ? { conversationId } : {}),
864
977
  ...(projectId ? { projectId } : {}),
865
978
  ...(delivery ? { delivery } : {})
@@ -915,10 +1028,32 @@ function scheduleMessage(host, name) {
915
1028
  const compiled = compiledSchedule(host, name);
916
1029
  return registration?.message ?? compiled?.message ?? compiled?.description ?? `Run schedule ${name}.`;
917
1030
  }
918
- function automationHandlers(host) {
919
- return host.manifest.automationHandlers?.length
920
- ? host.manifest.automationHandlers
921
- : host.manifest.triggerHandlers ?? [];
1031
+ function resolveAutomationLifecycle(host, schedule) {
1032
+ const lifecycle = schedule.lifecycle;
1033
+ if (lifecycle?.kind === "inline") {
1034
+ const compiled = host.manifest.automationLifecycles?.find((candidate) => candidate.automation === schedule.resultSchedule) ?? host.manifest.automations?.find((candidate) => candidate.name === schedule.resultSchedule);
1035
+ return compiled ? { name: schedule.resultSchedule, source: compiled.source } : undefined;
1036
+ }
1037
+ const handlerName = lifecycle?.handler ?? schedule.trigger?.handler;
1038
+ return handlerName
1039
+ ? automationLifecycleSources(host).find((candidate) => candidate.name === handlerName)
1040
+ : undefined;
1041
+ }
1042
+ function automationLifecycleSources(host) {
1043
+ const inline = (host.manifest.automationLifecycles ?? []).map((lifecycle) => ({
1044
+ name: lifecycle.automation,
1045
+ source: lifecycle.source
1046
+ }));
1047
+ const legacy = [
1048
+ ...(host.manifest.automationHandlers ?? []),
1049
+ ...(host.manifest.triggerHandlers ?? [])
1050
+ ];
1051
+ const sources = new Map();
1052
+ for (const candidate of [...inline, ...legacy]) {
1053
+ if (!sources.has(candidate.name))
1054
+ sources.set(candidate.name, candidate);
1055
+ }
1056
+ return [...sources.values()];
922
1057
  }
923
1058
  function manifestScheduleRegistrations(host) {
924
1059
  if (Array.isArray(host.manifest.automationRegistrations)) {
@@ -936,13 +1071,8 @@ function manifestScheduleRegistrations(host) {
936
1071
  registration.message = automation.message;
937
1072
  if (automation.target)
938
1073
  registration.target = automation.target;
939
- if (automation.lifecycle) {
940
- registration.trigger = {
941
- handler: automation.lifecycle.handler,
942
- ...(automation.target ? { target: automation.target } : {}),
943
- ...(automation.metadata ? { metadata: automation.metadata } : {})
944
- };
945
- }
1074
+ if (automation.lifecycle)
1075
+ registration.lifecycle = automation.lifecycle;
946
1076
  return [registration];
947
1077
  });
948
1078
  }