@swirls/looms 0.3.0 → 0.5.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 (253) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/dist/actor/cell.d.ts +21 -2
  3. package/dist/actor/cell.js +15 -3
  4. package/dist/actor/host.d.ts +10 -2
  5. package/dist/actor/host.js +27 -4
  6. package/dist/actor/index.d.ts +2 -1
  7. package/dist/actor/index.js +1 -1
  8. package/dist/actor/routing.d.ts +3 -0
  9. package/dist/actor/routing.js +13 -2
  10. package/dist/agent/debugger/agent-chat.js +3 -30
  11. package/dist/agent/debugger/streaming-text.d.ts +6 -0
  12. package/dist/agent/debugger/streaming-text.js +33 -0
  13. package/dist/agent/definitions-store.d.ts +1 -1
  14. package/dist/agent/definitions-store.js +1 -1
  15. package/dist/agent/definitions.d.ts +48 -0
  16. package/dist/agent/definitions.js +44 -0
  17. package/dist/agent/effects.d.ts +184 -0
  18. package/dist/agent/effects.js +172 -40
  19. package/dist/agent/events.d.ts +89 -0
  20. package/dist/agent/events.js +25 -0
  21. package/dist/agent/module.d.ts +819 -407
  22. package/dist/agent/module.js +5 -1
  23. package/dist/agent/scope.d.ts +88 -0
  24. package/dist/agent/threads.js +39 -3
  25. package/dist/agent/types.d.ts +4 -0
  26. package/dist/approval/effects.d.ts +40 -0
  27. package/dist/approval/module.d.ts +80 -0
  28. package/dist/client/client.d.ts +468 -119
  29. package/dist/client/client.js +214 -21
  30. package/dist/client/index.d.ts +1 -1
  31. package/dist/client/sse.d.ts +1 -1
  32. package/dist/client/sse.js +2 -2
  33. package/dist/cloudflare/durable-object.d.ts +66 -2
  34. package/dist/cloudflare/durable-object.js +96 -1
  35. package/dist/cloudflare/event-store.d.ts +7 -3
  36. package/dist/cloudflare/event-store.js +16 -3
  37. package/dist/cloudflare/index.d.ts +7 -1
  38. package/dist/cloudflare/index.js +7 -1
  39. package/dist/cloudflare/memory-queue.d.ts +18 -0
  40. package/dist/cloudflare/memory-queue.js +53 -0
  41. package/dist/cloudflare/queue-consumer.d.ts +52 -0
  42. package/dist/cloudflare/queue-consumer.js +102 -0
  43. package/dist/cloudflare/queue-message.d.ts +31 -0
  44. package/dist/cloudflare/queue-message.js +33 -0
  45. package/dist/cloudflare/queue-pull.d.ts +62 -0
  46. package/dist/cloudflare/queue-pull.js +130 -0
  47. package/dist/cloudflare/queue-worker.d.ts +39 -0
  48. package/dist/cloudflare/queue-worker.js +62 -0
  49. package/dist/cloudflare/r2-blob-store.d.ts +33 -0
  50. package/dist/cloudflare/r2-blob-store.js +60 -0
  51. package/dist/cloudflare/router.d.ts +4 -1
  52. package/dist/cloudflare/router.js +8 -3
  53. package/dist/cloudflare/websocket.d.ts +27 -0
  54. package/dist/cloudflare/websocket.js +215 -0
  55. package/dist/core/attempts.d.ts +8 -0
  56. package/dist/core/attempts.js +27 -0
  57. package/dist/core/blob-offload.d.ts +21 -0
  58. package/dist/core/blob-offload.js +143 -0
  59. package/dist/core/blob-store.d.ts +45 -0
  60. package/dist/core/blob-store.js +164 -0
  61. package/dist/core/blobs.d.ts +37 -0
  62. package/dist/core/blobs.js +160 -0
  63. package/dist/core/definition-resolver.d.ts +40 -0
  64. package/dist/core/definition-resolver.js +129 -0
  65. package/dist/core/definition-store.d.ts +6 -0
  66. package/dist/core/definition-store.js +37 -1
  67. package/dist/core/effects.d.ts +86 -3
  68. package/dist/core/effects.js +99 -3
  69. package/dist/core/envelope.d.ts +9 -0
  70. package/dist/core/envelope.js +4 -0
  71. package/dist/core/event-codec.js +3 -0
  72. package/dist/core/fold.js +83 -1
  73. package/dist/core/ids.d.ts +2 -0
  74. package/dist/core/ids.js +4 -0
  75. package/dist/core/index.d.ts +10 -0
  76. package/dist/core/index.js +9 -0
  77. package/dist/core/launcher.d.ts +97 -0
  78. package/dist/core/launcher.js +67 -0
  79. package/dist/core/module-scope.d.ts +7 -3
  80. package/dist/core/module-scope.js +3 -0
  81. package/dist/core/module.d.ts +10 -0
  82. package/dist/core/projection.d.ts +5 -4
  83. package/dist/core/projection.js +4 -0
  84. package/dist/core/protocol.d.ts +36 -1
  85. package/dist/core/protocol.js +35 -0
  86. package/dist/core/published.d.ts +2 -0
  87. package/dist/core/published.js +4 -1
  88. package/dist/{react → core}/register.d.ts +9 -8
  89. package/dist/core/replay.d.ts +96 -0
  90. package/dist/core/run-context.d.ts +33 -0
  91. package/dist/core/run-context.js +23 -0
  92. package/dist/core/sqlite-store.js +57 -5
  93. package/dist/core/state.d.ts +60 -0
  94. package/dist/core/state.js +19 -0
  95. package/dist/core/store.d.ts +6 -0
  96. package/dist/core/store.js +7 -0
  97. package/dist/core/subscription.d.ts +97 -0
  98. package/dist/core/subscription.js +224 -0
  99. package/dist/core/thread.d.ts +7 -0
  100. package/dist/core/thread.js +1 -0
  101. package/dist/core/trace.d.ts +21 -0
  102. package/dist/core/trace.js +45 -0
  103. package/dist/core/worker-callback.d.ts +25 -1
  104. package/dist/debugger/app/assets/{index-CgDzWJg7.css → index-B7GdT1UA.css} +1 -1
  105. package/dist/debugger/app/assets/index-C31SnCuN.js +22 -0
  106. package/dist/debugger/app/assets/routes-DPA3O5AF.js +47 -0
  107. package/dist/debugger/app/index.html +2 -2
  108. package/dist/debugger/components/event-inspector.d.ts +3 -1
  109. package/dist/debugger/components/event-inspector.js +25 -4
  110. package/dist/debugger/components/event-stream.d.ts +4 -1
  111. package/dist/debugger/components/event-stream.js +2 -2
  112. package/dist/debugger/components/run-tree.d.ts +5 -2
  113. package/dist/debugger/components/run-tree.js +10 -4
  114. package/dist/debugger/context.d.ts +8 -1
  115. package/dist/debugger/context.js +15 -3
  116. package/dist/debugger/events/protocol-summarize.js +18 -3
  117. package/dist/debugger/index.d.ts +1 -1
  118. package/dist/debugger/index.js +1 -1
  119. package/dist/debugger/shell/debugger-shell.js +1 -1
  120. package/dist/debugger/shell/events-pane.js +4 -3
  121. package/dist/debugger/styles.css +1 -0
  122. package/dist/evaluator/definitions-store.d.ts +3 -4
  123. package/dist/evaluator/definitions-store.js +3 -3
  124. package/dist/evaluator/definitions.d.ts +4 -1
  125. package/dist/evaluator/definitions.js +5 -2
  126. package/dist/evaluator/effects.d.ts +41 -0
  127. package/dist/evaluator/effects.js +6 -2
  128. package/dist/evaluator/module.d.ts +84 -0
  129. package/dist/evaluator/module.js +7 -3
  130. package/dist/evaluator/threads.d.ts +2 -0
  131. package/dist/evaluator/threads.js +4 -0
  132. package/dist/projectors/event-log.d.ts +87 -0
  133. package/dist/projectors/event-log.js +396 -0
  134. package/dist/projectors/index-model.d.ts +12 -0
  135. package/dist/projectors/index-model.js +12 -3
  136. package/dist/projectors/memory.js +7 -0
  137. package/dist/projectors/postgres.d.ts +1 -0
  138. package/dist/projectors/postgres.js +32 -15
  139. package/dist/projectors/schema.d.ts +5 -0
  140. package/dist/projectors/schema.js +26 -1
  141. package/dist/projectors/sqlite.js +47 -19
  142. package/dist/projectors/with-projectors.d.ts +7 -1
  143. package/dist/projectors/with-projectors.js +13 -3
  144. package/dist/react/derived.d.ts +26 -8
  145. package/dist/react/derived.js +23 -26
  146. package/dist/react/index.d.ts +3 -3
  147. package/dist/react/index.js +2 -2
  148. package/dist/react/materialize.js +5 -1
  149. package/dist/react/react.d.ts +16 -9
  150. package/dist/react/react.js +47 -23
  151. package/dist/react/store.d.ts +14 -6
  152. package/dist/react/store.js +104 -12
  153. package/dist/react/tables.d.ts +4 -1
  154. package/dist/runtime/cancellation.d.ts +2 -1
  155. package/dist/runtime/cancellation.js +35 -2
  156. package/dist/runtime/child-run.d.ts +10 -0
  157. package/dist/runtime/child-run.js +58 -0
  158. package/dist/runtime/deadline-transition-planner.js +11 -2
  159. package/dist/runtime/dispatch-effect.d.ts +2 -2
  160. package/dist/runtime/dispatch-effect.js +43 -19
  161. package/dist/runtime/errors.d.ts +14 -1
  162. package/dist/runtime/errors.js +10 -0
  163. package/dist/runtime/filesystem-blob-store.d.ts +6 -0
  164. package/dist/runtime/filesystem-blob-store.js +59 -0
  165. package/dist/runtime/helpers.d.ts +15 -6
  166. package/dist/runtime/helpers.js +46 -6
  167. package/dist/runtime/index.d.ts +4 -2
  168. package/dist/runtime/index.js +3 -1
  169. package/dist/runtime/local-effect-executor.d.ts +11 -2
  170. package/dist/runtime/local-effect-executor.js +80 -4
  171. package/dist/runtime/looms.d.ts +38 -4
  172. package/dist/runtime/looms.js +17 -3
  173. package/dist/runtime/repository.d.ts +5 -4
  174. package/dist/runtime/repository.js +5 -2
  175. package/dist/runtime/retry-policy.d.ts +5 -0
  176. package/dist/runtime/retry-policy.js +10 -2
  177. package/dist/runtime/run-start.d.ts +1 -1
  178. package/dist/runtime/run-start.js +10 -0
  179. package/dist/runtime/runtime.d.ts +2 -2
  180. package/dist/runtime/runtime.js +191 -68
  181. package/dist/runtime/server/auth.d.ts +3 -0
  182. package/dist/runtime/server/fetch-handler.d.ts +2 -2
  183. package/dist/runtime/server/fetch-handler.js +35 -4
  184. package/dist/runtime/server/grant.d.ts +49 -0
  185. package/dist/runtime/server/grant.js +177 -0
  186. package/dist/runtime/server/routes/effects.js +47 -5
  187. package/dist/runtime/server/routes/runs.js +6 -1
  188. package/dist/runtime/server/run-route.d.ts +18 -0
  189. package/dist/runtime/server/run-route.js +26 -0
  190. package/dist/runtime/server.d.ts +3 -1
  191. package/dist/runtime/server.js +3 -1
  192. package/dist/runtime/sse.js +26 -4
  193. package/dist/runtime/subscription.d.ts +8 -0
  194. package/dist/runtime/subscription.js +23 -0
  195. package/dist/runtime/types.d.ts +87 -8
  196. package/dist/runtime/wake-engine.d.ts +4 -2
  197. package/dist/runtime/wake-engine.js +57 -6
  198. package/dist/runtime/worker-callbacks.d.ts +12 -2
  199. package/dist/runtime/worker-callbacks.js +102 -72
  200. package/dist/runtime/worker-effect-dispatch.d.ts +14 -5
  201. package/dist/runtime/worker-effect-dispatch.js +84 -18
  202. package/dist/schedule/debugger/index.d.ts +4 -0
  203. package/dist/schedule/debugger/index.js +11 -0
  204. package/dist/schedule/debugger/schedule-view.d.ts +3 -0
  205. package/dist/schedule/debugger/schedule-view.js +68 -0
  206. package/dist/schedule/debugger/summarize.d.ts +2 -0
  207. package/dist/schedule/debugger/summarize.js +43 -0
  208. package/dist/schedule/definitions-store.d.ts +10 -0
  209. package/dist/schedule/definitions-store.js +8 -0
  210. package/dist/schedule/definitions.d.ts +57 -0
  211. package/dist/schedule/definitions.js +30 -0
  212. package/dist/schedule/effects.d.ts +756 -0
  213. package/dist/schedule/effects.js +244 -0
  214. package/dist/schedule/ensure.d.ts +55 -0
  215. package/dist/schedule/ensure.js +109 -0
  216. package/dist/schedule/events.d.ts +116 -0
  217. package/dist/schedule/events.js +49 -0
  218. package/dist/schedule/index.d.ts +11 -0
  219. package/dist/schedule/index.js +11 -0
  220. package/dist/schedule/module.d.ts +1474 -0
  221. package/dist/schedule/module.js +22 -0
  222. package/dist/schedule/projections.d.ts +55 -0
  223. package/dist/schedule/projections.js +88 -0
  224. package/dist/schedule/scope.d.ts +121 -0
  225. package/dist/schedule/scope.js +7 -0
  226. package/dist/schedule/signals.d.ts +25 -0
  227. package/dist/schedule/signals.js +33 -0
  228. package/dist/schedule/specs.d.ts +59 -0
  229. package/dist/schedule/specs.js +231 -0
  230. package/dist/schedule/threads.d.ts +25 -0
  231. package/dist/schedule/threads.js +259 -0
  232. package/dist/testing/corpus-module.d.ts +34 -0
  233. package/dist/testing/corpus-module.js +87 -0
  234. package/dist/testing/index.d.ts +2 -0
  235. package/dist/testing/index.js +5 -6
  236. package/dist/testing/replay-corpus.d.ts +22 -0
  237. package/dist/testing/replay-corpus.js +50 -0
  238. package/dist/workflow/definitions-store.d.ts +1 -1
  239. package/dist/workflow/definitions-store.js +1 -1
  240. package/dist/workflow/definitions.d.ts +14 -0
  241. package/dist/workflow/effects.d.ts +122 -0
  242. package/dist/workflow/effects.js +16 -6
  243. package/dist/workflow/events.d.ts +42 -0
  244. package/dist/workflow/events.js +4 -0
  245. package/dist/workflow/module.d.ts +345 -32
  246. package/dist/workflow/module.js +7 -3
  247. package/dist/workflow/scope.d.ts +42 -0
  248. package/dist/workflow/threads.d.ts +72 -0
  249. package/dist/workflow/threads.js +106 -38
  250. package/package.json +11 -2
  251. package/dist/debugger/app/assets/index-BevQYa-U.js +0 -22
  252. package/dist/debugger/app/assets/routes-B17Om93i.js +0 -47
  253. /package/dist/{react → core}/register.js +0 -0
@@ -105,6 +105,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
105
105
  readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
106
106
  readonly toolCallId: import("effect/Schema").String;
107
107
  readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
108
+ readonly depth: import("effect/Schema").optional<import("effect/Schema").Finite>;
108
109
  }>;
109
110
  'effects.requested': import("effect/Schema").Struct<{
110
111
  readonly toolCallId: import("effect/Schema").String;
@@ -143,6 +144,9 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
143
144
  readonly actorId: import("effect/Schema").optional<import("effect/Schema").String>;
144
145
  }>, import("effect/Schema").Struct<{
145
146
  readonly type: import("effect/Schema").Literal<"system">;
147
+ }>, import("effect/Schema").Struct<{
148
+ readonly type: import("effect/Schema").Literal<"run">;
149
+ readonly runId: import("effect/Schema").String;
146
150
  }>]>>;
147
151
  readonly ephemeral: import("effect/Schema").optional<import("effect/Schema").Boolean>;
148
152
  readonly id: import("effect/Schema").optional<import("effect/Schema").String>;
@@ -160,16 +164,56 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
160
164
  readonly type: import("effect/Schema").Literal<"runtime.cancel">;
161
165
  readonly threadId: import("effect/Schema").String;
162
166
  readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
167
+ }>, import("effect/Schema").Struct<{
168
+ readonly type: import("effect/Schema").Literal<"runtime.launch">;
169
+ readonly runId: import("effect/Schema").String;
170
+ readonly kind: import("effect/Schema").String;
171
+ readonly definitionName: import("effect/Schema").String;
172
+ readonly definitionVersion: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").String, never>;
173
+ readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
174
+ readonly close: import("effect/Schema").withDecodingDefaultKey<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"terminate">, import("effect/Schema").Literal<"wait">]>, never>;
175
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
176
+ }>, import("effect/Schema").Struct<{
177
+ readonly type: import("effect/Schema").Literal<"runtime.cancelRun">;
178
+ readonly runId: import("effect/Schema").String;
179
+ readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
163
180
  }>, import("effect/Schema").Struct<{
164
181
  readonly type: import("effect/Schema").String;
165
182
  readonly input: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
166
183
  readonly tag: import("effect/Schema").optional<import("effect/Schema").String>;
184
+ readonly at: import("effect/Schema").optional<import("effect/Schema").Finite>;
167
185
  }>]>>;
168
186
  readonly waitOn: import("effect/Schema").optional<import("effect/Schema").Struct<{
169
187
  readonly type: import("effect/Schema").Union<readonly [import("effect/Schema").String, import("effect/Schema").$Array<import("effect/Schema").String>]>;
170
188
  readonly match: import("effect/Schema").optional<import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>>;
171
189
  }>>;
172
190
  }>;
191
+ lineage: import("effect/Schema").Struct<{
192
+ readonly depth: import("effect/Schema").Finite;
193
+ }>;
194
+ 'context.compacted': import("effect/Schema").Struct<{
195
+ readonly turn: import("effect/Schema").Finite;
196
+ readonly originalCount: import("effect/Schema").Finite;
197
+ readonly compactedCount: import("effect/Schema").Finite;
198
+ readonly summary: import("effect/Schema").optional<import("effect/Schema").String>;
199
+ readonly reason: import("effect/Schema").optional<import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"overflow">, import("effect/Schema").Literal<"manual">, import("effect/Schema").Literal<"threshold">]>>;
200
+ readonly messages: import("effect/Schema").optional<import("effect/Schema").$Array<import("effect/Schema").Struct<{
201
+ readonly role: import("effect/Schema").Union<readonly [import("effect/Schema").Literal<"system">, import("effect/Schema").Literal<"user">, import("effect/Schema").Literal<"assistant">, import("effect/Schema").Literal<"tool">]>;
202
+ readonly content: import("effect/Schema").String;
203
+ readonly toolCallId: import("effect/Schema").optional<import("effect/Schema").String>;
204
+ readonly name: import("effect/Schema").optional<import("effect/Schema").String>;
205
+ readonly toolCalls: import("effect/Schema").optional<import("effect/Schema").mutable<import("effect/Schema").$Array<import("effect/Schema").Struct<{
206
+ readonly id: import("effect/Schema").String;
207
+ readonly name: import("effect/Schema").String;
208
+ readonly arguments: import("effect/Schema").Codec<import("effect/Schema").Json, import("effect/Schema").Json, never, never>;
209
+ }>>>>;
210
+ }>>>;
211
+ }>;
212
+ 'turn.usage': import("effect/Schema").Struct<{
213
+ readonly turn: import("effect/Schema").Finite;
214
+ readonly input: import("effect/Schema").Finite;
215
+ readonly output: import("effect/Schema").Finite;
216
+ }>;
173
217
  }>, {
174
218
  callLLM: import("@swirls/looms/core").EffectDefinition<{
175
219
  readonly turn: number;
@@ -187,8 +231,265 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
187
231
  }[] | undefined;
188
232
  }[] | undefined;
189
233
  readonly input?: import("effect/Schema").Json | undefined;
234
+ readonly structuredOutput?: import("effect/Schema").Json | undefined;
235
+ readonly alreadyCompacted?: boolean | undefined;
190
236
  readonly consumedSteerMessageIds?: readonly string[] | undefined;
191
237
  }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
238
+ readonly type: "agent.context.compacted";
239
+ readonly payload: {
240
+ readonly turn: number;
241
+ readonly originalCount: number;
242
+ readonly compactedCount: number;
243
+ readonly summary?: string | undefined;
244
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
245
+ readonly messages?: readonly {
246
+ readonly role: "assistant" | "system" | "tool" | "user";
247
+ readonly content: string;
248
+ readonly toolCallId?: string | undefined;
249
+ readonly name?: string | undefined;
250
+ readonly toolCalls?: {
251
+ readonly id: string;
252
+ readonly name: string;
253
+ readonly arguments: import("effect/Schema").Json;
254
+ }[] | undefined;
255
+ }[] | undefined;
256
+ };
257
+ }) | (Omit<EventInput, "payload" | "type"> & {
258
+ readonly type: "agent.effects.requested";
259
+ readonly payload: {
260
+ readonly toolCallId: string;
261
+ readonly effects: readonly ({
262
+ readonly type: "runtime.spawn";
263
+ readonly childThreadId: string;
264
+ readonly kind: string;
265
+ readonly definitionName: string;
266
+ readonly definitionVersion: string;
267
+ readonly input: import("effect/Schema").Json;
268
+ } | {
269
+ readonly type: "runtime.wait";
270
+ readonly waitId: string;
271
+ readonly on: {
272
+ readonly type: string | readonly string[];
273
+ readonly match?: import("effect/Schema").Json | undefined;
274
+ } | {
275
+ readonly timerAt: number;
276
+ };
277
+ readonly tag?: import("effect/Schema").Json | undefined;
278
+ } | {
279
+ readonly type: "runtime.emit";
280
+ readonly event: {
281
+ readonly type: string;
282
+ readonly payload: import("effect/Schema").Json;
283
+ readonly threadId?: string | null | undefined;
284
+ readonly parentThreadId?: string | null | undefined;
285
+ readonly causationId?: string | null | undefined;
286
+ readonly correlationId?: string | null | undefined;
287
+ readonly effectId?: string | null | undefined;
288
+ readonly origin?: {
289
+ readonly type: "thread";
290
+ readonly threadId: string;
291
+ } | {
292
+ readonly type: "external";
293
+ readonly actorId?: string | undefined;
294
+ } | {
295
+ readonly type: "system";
296
+ } | {
297
+ readonly type: "run";
298
+ readonly runId: string;
299
+ } | undefined;
300
+ readonly ephemeral?: boolean | undefined;
301
+ readonly id?: string | undefined;
302
+ readonly ts?: number | undefined;
303
+ readonly idempotencyKey?: string | null | undefined;
304
+ };
305
+ readonly tag?: string | undefined;
306
+ } | {
307
+ readonly type: "runtime.complete";
308
+ readonly output: import("effect/Schema").Json;
309
+ } | {
310
+ readonly type: "runtime.fail";
311
+ readonly error: string;
312
+ } | {
313
+ readonly type: "runtime.cancel";
314
+ readonly threadId: string;
315
+ readonly tag?: string | undefined;
316
+ } | {
317
+ readonly type: "runtime.launch";
318
+ readonly runId: string;
319
+ readonly kind: string;
320
+ readonly definitionName: string;
321
+ readonly definitionVersion: string;
322
+ readonly input: import("effect/Schema").Json;
323
+ readonly close: "terminate" | "wait";
324
+ readonly tag?: string | undefined;
325
+ } | {
326
+ readonly type: "runtime.cancelRun";
327
+ readonly runId: string;
328
+ readonly tag?: string | undefined;
329
+ } | {
330
+ readonly type: string;
331
+ readonly input: import("effect/Schema").Json;
332
+ readonly tag?: string | undefined;
333
+ readonly at?: number | undefined;
334
+ })[];
335
+ readonly waitOn?: {
336
+ readonly type: string | readonly string[];
337
+ readonly match?: import("effect/Schema").Json | undefined;
338
+ } | undefined;
339
+ };
340
+ }) | (Omit<EventInput, "payload" | "type"> & {
341
+ readonly type: "agent.lineage";
342
+ readonly payload: {
343
+ readonly depth: number;
344
+ };
345
+ }) | (Omit<EventInput, "payload" | "type"> & {
346
+ readonly type: "agent.message";
347
+ readonly payload: {
348
+ readonly turn: number;
349
+ readonly message: {
350
+ readonly role: "assistant" | "system" | "tool" | "user";
351
+ readonly content: string;
352
+ readonly toolCallId?: string | undefined;
353
+ readonly name?: string | undefined;
354
+ readonly toolCalls?: {
355
+ readonly id: string;
356
+ readonly name: string;
357
+ readonly arguments: import("effect/Schema").Json;
358
+ }[] | undefined;
359
+ };
360
+ readonly usage?: {
361
+ readonly input: number;
362
+ readonly output: number;
363
+ } | undefined;
364
+ };
365
+ }) | (Omit<EventInput, "payload" | "type"> & {
366
+ readonly type: "agent.message.received";
367
+ readonly payload: {
368
+ readonly message: {
369
+ readonly role: "assistant" | "system" | "tool" | "user";
370
+ readonly content: string;
371
+ readonly toolCallId?: string | undefined;
372
+ readonly name?: string | undefined;
373
+ readonly toolCalls?: {
374
+ readonly id: string;
375
+ readonly name: string;
376
+ readonly arguments: import("effect/Schema").Json;
377
+ }[] | undefined;
378
+ };
379
+ };
380
+ }) | (Omit<EventInput, "payload" | "type"> & {
381
+ readonly type: "agent.session.cancel.requested";
382
+ readonly payload: {};
383
+ }) | (Omit<EventInput, "payload" | "type"> & {
384
+ readonly type: "agent.session.message.submitted";
385
+ readonly payload: {
386
+ readonly messageId: string;
387
+ readonly text: string;
388
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
389
+ readonly activeChildThreadId?: string | undefined;
390
+ };
391
+ }) | (Omit<EventInput, "payload" | "type"> & {
392
+ readonly type: "agent.session.steer.delivered";
393
+ readonly payload: {
394
+ readonly messageId: string;
395
+ readonly activeMessageId: string;
396
+ };
397
+ }) | (Omit<EventInput, "payload" | "type"> & {
398
+ readonly type: "agent.session.turn.closed";
399
+ readonly payload: {
400
+ readonly messageId: string;
401
+ readonly status: "cancelled" | "completed" | "failed";
402
+ readonly error?: string | undefined;
403
+ };
404
+ }) | (Omit<EventInput, "payload" | "type"> & {
405
+ readonly type: "agent.session.turn.started";
406
+ readonly payload: {
407
+ readonly messageId: string;
408
+ readonly childThreadId: string;
409
+ };
410
+ }) | (Omit<EventInput, "payload" | "type"> & {
411
+ readonly type: "agent.spawn.requested";
412
+ readonly payload: {
413
+ readonly childThreadId: string;
414
+ readonly kind: string;
415
+ readonly definitionName: string;
416
+ readonly definitionVersion: string;
417
+ readonly toolCallId: string;
418
+ readonly input: import("effect/Schema").Json;
419
+ readonly depth?: number | undefined;
420
+ };
421
+ }) | (Omit<EventInput, "payload" | "type"> & {
422
+ readonly type: "agent.steered";
423
+ readonly payload: {
424
+ readonly turn: number;
425
+ readonly messageId?: string | undefined;
426
+ readonly message: {
427
+ readonly role: "assistant" | "system" | "tool" | "user";
428
+ readonly content: string;
429
+ readonly toolCallId?: string | undefined;
430
+ readonly name?: string | undefined;
431
+ readonly toolCalls?: {
432
+ readonly id: string;
433
+ readonly name: string;
434
+ readonly arguments: import("effect/Schema").Json;
435
+ }[] | undefined;
436
+ };
437
+ readonly interrupt?: boolean | undefined;
438
+ };
439
+ }) | (Omit<EventInput, "payload" | "type"> & {
440
+ readonly type: "agent.tool.result";
441
+ readonly payload: {
442
+ readonly turn: number;
443
+ readonly toolCallId: string;
444
+ readonly name: string;
445
+ readonly result: import("effect/Schema").Json;
446
+ readonly error: string | null;
447
+ };
448
+ }) | (Omit<EventInput, "payload" | "type"> & {
449
+ readonly type: "agent.tool_call.requested";
450
+ readonly payload: {
451
+ readonly turn: number;
452
+ readonly toolCall: {
453
+ readonly id: string;
454
+ readonly name: string;
455
+ readonly arguments: import("effect/Schema").Json;
456
+ };
457
+ };
458
+ }) | (Omit<EventInput, "payload" | "type"> & {
459
+ readonly type: "agent.turn.started";
460
+ readonly payload: {
461
+ readonly turn: number;
462
+ };
463
+ }) | (Omit<EventInput, "payload" | "type"> & {
464
+ readonly type: "agent.turn.stopped";
465
+ readonly payload: {};
466
+ }) | (Omit<EventInput, "payload" | "type"> & {
467
+ readonly type: "agent.turn.text_delta";
468
+ readonly payload: {
469
+ readonly turn: number;
470
+ readonly delta: string;
471
+ };
472
+ }) | (Omit<EventInput, "payload" | "type"> & {
473
+ readonly type: "agent.turn.usage";
474
+ readonly payload: {
475
+ readonly turn: number;
476
+ readonly input: number;
477
+ readonly output: number;
478
+ };
479
+ }) | (Omit<EventInput, "payload" | "type"> & {
480
+ readonly type: "runtime.child.close.requested";
481
+ readonly payload: {
482
+ readonly policy: "terminate" | "wait";
483
+ };
484
+ }) | (Omit<EventInput, "payload" | "type"> & {
485
+ readonly type: "runtime.child.settled";
486
+ readonly payload: {
487
+ readonly runId: string;
488
+ readonly status: "cancelled" | "completed" | "failed";
489
+ readonly output: import("effect/Schema").Json;
490
+ readonly error: string | null;
491
+ };
492
+ }) | (Omit<EventInput, "payload" | "type"> & {
192
493
  readonly type: "runtime.effect.ambiguous";
193
494
  readonly payload: {
194
495
  readonly effectId: string;
@@ -232,6 +533,8 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
232
533
  readonly payload: {
233
534
  readonly effectId: string;
234
535
  readonly error: string;
536
+ readonly nonRetryable?: boolean | undefined;
537
+ readonly retryAfterMs?: number | undefined;
235
538
  };
236
539
  }) | (Omit<EventInput, "payload" | "type"> & {
237
540
  readonly type: "runtime.effect.heartbeat";
@@ -240,6 +543,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
240
543
  readonly attempt: number;
241
544
  readonly heartbeatAt: number;
242
545
  readonly deadlineAt: number | null;
546
+ readonly details?: import("effect/Schema").Json | undefined;
243
547
  };
244
548
  }) | (Omit<EventInput, "payload" | "type"> & {
245
549
  readonly type: "runtime.effect.queued";
@@ -292,6 +596,16 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
292
596
  readonly sourceRunId: string;
293
597
  readonly sourceSeq: number;
294
598
  };
599
+ }) | (Omit<EventInput, "payload" | "type"> & {
600
+ readonly type: "runtime.run.launched";
601
+ readonly payload: {
602
+ readonly runId: string;
603
+ readonly kind: string;
604
+ readonly definitionName: string;
605
+ readonly definitionVersion: string;
606
+ readonly effectId: string;
607
+ readonly close: "terminate" | "wait";
608
+ };
295
609
  }) | (Omit<EventInput, "payload" | "type"> & {
296
610
  readonly type: "runtime.run.started";
297
611
  readonly payload: {
@@ -301,6 +615,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
301
615
  readonly definitionVersion: string;
302
616
  readonly input: import("effect/Schema").Json;
303
617
  readonly requestedThreadId?: string | null | undefined;
618
+ readonly launchedBy?: {
619
+ readonly runId: string;
620
+ readonly threadId: string;
621
+ readonly effectId: string;
622
+ readonly causationId: string;
623
+ readonly causationSeq: number;
624
+ } | undefined;
625
+ readonly attributes?: {
626
+ readonly [x: string]: string;
627
+ } | undefined;
628
+ readonly trace?: {
629
+ readonly traceparent: string;
630
+ readonly tracestate?: string | undefined;
631
+ } | undefined;
304
632
  };
305
633
  }) | (Omit<EventInput, "payload" | "type"> & {
306
634
  readonly type: "runtime.signal.received";
@@ -385,6 +713,38 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
385
713
  readonly payload: import("effect/Schema").Json;
386
714
  };
387
715
  };
716
+ })>;
717
+ executeTool: import("@swirls/looms/core").EffectDefinition<{
718
+ readonly turn: number;
719
+ readonly definitionName?: string | undefined;
720
+ readonly definitionVersion: string;
721
+ readonly toolCall: {
722
+ readonly id: string;
723
+ readonly name: string;
724
+ readonly arguments: import("effect/Schema").Json;
725
+ };
726
+ readonly input?: import("effect/Schema").Json | undefined;
727
+ readonly depth?: number | undefined;
728
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
729
+ readonly type: "agent.context.compacted";
730
+ readonly payload: {
731
+ readonly turn: number;
732
+ readonly originalCount: number;
733
+ readonly compactedCount: number;
734
+ readonly summary?: string | undefined;
735
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
736
+ readonly messages?: readonly {
737
+ readonly role: "assistant" | "system" | "tool" | "user";
738
+ readonly content: string;
739
+ readonly toolCallId?: string | undefined;
740
+ readonly name?: string | undefined;
741
+ readonly toolCalls?: {
742
+ readonly id: string;
743
+ readonly name: string;
744
+ readonly arguments: import("effect/Schema").Json;
745
+ }[] | undefined;
746
+ }[] | undefined;
747
+ };
388
748
  }) | (Omit<EventInput, "payload" | "type"> & {
389
749
  readonly type: "agent.effects.requested";
390
750
  readonly payload: {
@@ -424,6 +784,9 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
424
784
  readonly actorId?: string | undefined;
425
785
  } | {
426
786
  readonly type: "system";
787
+ } | {
788
+ readonly type: "run";
789
+ readonly runId: string;
427
790
  } | undefined;
428
791
  readonly ephemeral?: boolean | undefined;
429
792
  readonly id?: string | undefined;
@@ -441,16 +804,35 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
441
804
  readonly type: "runtime.cancel";
442
805
  readonly threadId: string;
443
806
  readonly tag?: string | undefined;
807
+ } | {
808
+ readonly type: "runtime.launch";
809
+ readonly runId: string;
810
+ readonly kind: string;
811
+ readonly definitionName: string;
812
+ readonly definitionVersion: string;
813
+ readonly input: import("effect/Schema").Json;
814
+ readonly close: "terminate" | "wait";
815
+ readonly tag?: string | undefined;
816
+ } | {
817
+ readonly type: "runtime.cancelRun";
818
+ readonly runId: string;
819
+ readonly tag?: string | undefined;
444
820
  } | {
445
821
  readonly type: string;
446
822
  readonly input: import("effect/Schema").Json;
447
823
  readonly tag?: string | undefined;
824
+ readonly at?: number | undefined;
448
825
  })[];
449
826
  readonly waitOn?: {
450
827
  readonly type: string | readonly string[];
451
828
  readonly match?: import("effect/Schema").Json | undefined;
452
829
  } | undefined;
453
830
  };
831
+ }) | (Omit<EventInput, "payload" | "type"> & {
832
+ readonly type: "agent.lineage";
833
+ readonly payload: {
834
+ readonly depth: number;
835
+ };
454
836
  }) | (Omit<EventInput, "payload" | "type"> & {
455
837
  readonly type: "agent.message";
456
838
  readonly payload: {
@@ -525,6 +907,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
525
907
  readonly definitionVersion: string;
526
908
  readonly toolCallId: string;
527
909
  readonly input: import("effect/Schema").Json;
910
+ readonly depth?: number | undefined;
528
911
  };
529
912
  }) | (Omit<EventInput, "payload" | "type"> & {
530
913
  readonly type: "agent.steered";
@@ -577,17 +960,27 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
577
960
  readonly turn: number;
578
961
  readonly delta: string;
579
962
  };
580
- })>;
581
- executeTool: import("@swirls/looms/core").EffectDefinition<{
582
- readonly turn: number;
583
- readonly definitionName?: string | undefined;
584
- readonly definitionVersion: string;
585
- readonly toolCall: {
586
- readonly id: string;
587
- readonly name: string;
588
- readonly arguments: import("effect/Schema").Json;
963
+ }) | (Omit<EventInput, "payload" | "type"> & {
964
+ readonly type: "agent.turn.usage";
965
+ readonly payload: {
966
+ readonly turn: number;
967
+ readonly input: number;
968
+ readonly output: number;
589
969
  };
590
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
970
+ }) | (Omit<EventInput, "payload" | "type"> & {
971
+ readonly type: "runtime.child.close.requested";
972
+ readonly payload: {
973
+ readonly policy: "terminate" | "wait";
974
+ };
975
+ }) | (Omit<EventInput, "payload" | "type"> & {
976
+ readonly type: "runtime.child.settled";
977
+ readonly payload: {
978
+ readonly runId: string;
979
+ readonly status: "cancelled" | "completed" | "failed";
980
+ readonly output: import("effect/Schema").Json;
981
+ readonly error: string | null;
982
+ };
983
+ }) | (Omit<EventInput, "payload" | "type"> & {
591
984
  readonly type: "runtime.effect.ambiguous";
592
985
  readonly payload: {
593
986
  readonly effectId: string;
@@ -631,6 +1024,8 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
631
1024
  readonly payload: {
632
1025
  readonly effectId: string;
633
1026
  readonly error: string;
1027
+ readonly nonRetryable?: boolean | undefined;
1028
+ readonly retryAfterMs?: number | undefined;
634
1029
  };
635
1030
  }) | (Omit<EventInput, "payload" | "type"> & {
636
1031
  readonly type: "runtime.effect.heartbeat";
@@ -639,6 +1034,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
639
1034
  readonly attempt: number;
640
1035
  readonly heartbeatAt: number;
641
1036
  readonly deadlineAt: number | null;
1037
+ readonly details?: import("effect/Schema").Json | undefined;
642
1038
  };
643
1039
  }) | (Omit<EventInput, "payload" | "type"> & {
644
1040
  readonly type: "runtime.effect.queued";
@@ -691,6 +1087,16 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
691
1087
  readonly sourceRunId: string;
692
1088
  readonly sourceSeq: number;
693
1089
  };
1090
+ }) | (Omit<EventInput, "payload" | "type"> & {
1091
+ readonly type: "runtime.run.launched";
1092
+ readonly payload: {
1093
+ readonly runId: string;
1094
+ readonly kind: string;
1095
+ readonly definitionName: string;
1096
+ readonly definitionVersion: string;
1097
+ readonly effectId: string;
1098
+ readonly close: "terminate" | "wait";
1099
+ };
694
1100
  }) | (Omit<EventInput, "payload" | "type"> & {
695
1101
  readonly type: "runtime.run.started";
696
1102
  readonly payload: {
@@ -700,6 +1106,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
700
1106
  readonly definitionVersion: string;
701
1107
  readonly input: import("effect/Schema").Json;
702
1108
  readonly requestedThreadId?: string | null | undefined;
1109
+ readonly launchedBy?: {
1110
+ readonly runId: string;
1111
+ readonly threadId: string;
1112
+ readonly effectId: string;
1113
+ readonly causationId: string;
1114
+ readonly causationSeq: number;
1115
+ } | undefined;
1116
+ readonly attributes?: {
1117
+ readonly [x: string]: string;
1118
+ } | undefined;
1119
+ readonly trace?: {
1120
+ readonly traceparent: string;
1121
+ readonly tracestate?: string | undefined;
1122
+ } | undefined;
703
1123
  };
704
1124
  }) | (Omit<EventInput, "payload" | "type"> & {
705
1125
  readonly type: "runtime.signal.received";
@@ -780,201 +1200,9 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
780
1200
  readonly tag?: import("effect/Schema").Json | undefined;
781
1201
  readonly event: {
782
1202
  readonly id: string;
783
- readonly type: string;
784
- readonly payload: import("effect/Schema").Json;
785
- };
786
- };
787
- }) | (Omit<EventInput, "payload" | "type"> & {
788
- readonly type: "agent.effects.requested";
789
- readonly payload: {
790
- readonly toolCallId: string;
791
- readonly effects: readonly ({
792
- readonly type: "runtime.spawn";
793
- readonly childThreadId: string;
794
- readonly kind: string;
795
- readonly definitionName: string;
796
- readonly definitionVersion: string;
797
- readonly input: import("effect/Schema").Json;
798
- } | {
799
- readonly type: "runtime.wait";
800
- readonly waitId: string;
801
- readonly on: {
802
- readonly type: string | readonly string[];
803
- readonly match?: import("effect/Schema").Json | undefined;
804
- } | {
805
- readonly timerAt: number;
806
- };
807
- readonly tag?: import("effect/Schema").Json | undefined;
808
- } | {
809
- readonly type: "runtime.emit";
810
- readonly event: {
811
- readonly type: string;
812
- readonly payload: import("effect/Schema").Json;
813
- readonly threadId?: string | null | undefined;
814
- readonly parentThreadId?: string | null | undefined;
815
- readonly causationId?: string | null | undefined;
816
- readonly correlationId?: string | null | undefined;
817
- readonly effectId?: string | null | undefined;
818
- readonly origin?: {
819
- readonly type: "thread";
820
- readonly threadId: string;
821
- } | {
822
- readonly type: "external";
823
- readonly actorId?: string | undefined;
824
- } | {
825
- readonly type: "system";
826
- } | undefined;
827
- readonly ephemeral?: boolean | undefined;
828
- readonly id?: string | undefined;
829
- readonly ts?: number | undefined;
830
- readonly idempotencyKey?: string | null | undefined;
831
- };
832
- readonly tag?: string | undefined;
833
- } | {
834
- readonly type: "runtime.complete";
835
- readonly output: import("effect/Schema").Json;
836
- } | {
837
- readonly type: "runtime.fail";
838
- readonly error: string;
839
- } | {
840
- readonly type: "runtime.cancel";
841
- readonly threadId: string;
842
- readonly tag?: string | undefined;
843
- } | {
844
- readonly type: string;
845
- readonly input: import("effect/Schema").Json;
846
- readonly tag?: string | undefined;
847
- })[];
848
- readonly waitOn?: {
849
- readonly type: string | readonly string[];
850
- readonly match?: import("effect/Schema").Json | undefined;
851
- } | undefined;
852
- };
853
- }) | (Omit<EventInput, "payload" | "type"> & {
854
- readonly type: "agent.message";
855
- readonly payload: {
856
- readonly turn: number;
857
- readonly message: {
858
- readonly role: "assistant" | "system" | "tool" | "user";
859
- readonly content: string;
860
- readonly toolCallId?: string | undefined;
861
- readonly name?: string | undefined;
862
- readonly toolCalls?: {
863
- readonly id: string;
864
- readonly name: string;
865
- readonly arguments: import("effect/Schema").Json;
866
- }[] | undefined;
867
- };
868
- readonly usage?: {
869
- readonly input: number;
870
- readonly output: number;
871
- } | undefined;
872
- };
873
- }) | (Omit<EventInput, "payload" | "type"> & {
874
- readonly type: "agent.message.received";
875
- readonly payload: {
876
- readonly message: {
877
- readonly role: "assistant" | "system" | "tool" | "user";
878
- readonly content: string;
879
- readonly toolCallId?: string | undefined;
880
- readonly name?: string | undefined;
881
- readonly toolCalls?: {
882
- readonly id: string;
883
- readonly name: string;
884
- readonly arguments: import("effect/Schema").Json;
885
- }[] | undefined;
886
- };
887
- };
888
- }) | (Omit<EventInput, "payload" | "type"> & {
889
- readonly type: "agent.session.cancel.requested";
890
- readonly payload: {};
891
- }) | (Omit<EventInput, "payload" | "type"> & {
892
- readonly type: "agent.session.message.submitted";
893
- readonly payload: {
894
- readonly messageId: string;
895
- readonly text: string;
896
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
897
- readonly activeChildThreadId?: string | undefined;
898
- };
899
- }) | (Omit<EventInput, "payload" | "type"> & {
900
- readonly type: "agent.session.steer.delivered";
901
- readonly payload: {
902
- readonly messageId: string;
903
- readonly activeMessageId: string;
904
- };
905
- }) | (Omit<EventInput, "payload" | "type"> & {
906
- readonly type: "agent.session.turn.closed";
907
- readonly payload: {
908
- readonly messageId: string;
909
- readonly status: "cancelled" | "completed" | "failed";
910
- readonly error?: string | undefined;
911
- };
912
- }) | (Omit<EventInput, "payload" | "type"> & {
913
- readonly type: "agent.session.turn.started";
914
- readonly payload: {
915
- readonly messageId: string;
916
- readonly childThreadId: string;
917
- };
918
- }) | (Omit<EventInput, "payload" | "type"> & {
919
- readonly type: "agent.spawn.requested";
920
- readonly payload: {
921
- readonly childThreadId: string;
922
- readonly kind: string;
923
- readonly definitionName: string;
924
- readonly definitionVersion: string;
925
- readonly toolCallId: string;
926
- readonly input: import("effect/Schema").Json;
927
- };
928
- }) | (Omit<EventInput, "payload" | "type"> & {
929
- readonly type: "agent.steered";
930
- readonly payload: {
931
- readonly turn: number;
932
- readonly messageId?: string | undefined;
933
- readonly message: {
934
- readonly role: "assistant" | "system" | "tool" | "user";
935
- readonly content: string;
936
- readonly toolCallId?: string | undefined;
937
- readonly name?: string | undefined;
938
- readonly toolCalls?: {
939
- readonly id: string;
940
- readonly name: string;
941
- readonly arguments: import("effect/Schema").Json;
942
- }[] | undefined;
943
- };
944
- readonly interrupt?: boolean | undefined;
945
- };
946
- }) | (Omit<EventInput, "payload" | "type"> & {
947
- readonly type: "agent.tool.result";
948
- readonly payload: {
949
- readonly turn: number;
950
- readonly toolCallId: string;
951
- readonly name: string;
952
- readonly result: import("effect/Schema").Json;
953
- readonly error: string | null;
954
- };
955
- }) | (Omit<EventInput, "payload" | "type"> & {
956
- readonly type: "agent.tool_call.requested";
957
- readonly payload: {
958
- readonly turn: number;
959
- readonly toolCall: {
960
- readonly id: string;
961
- readonly name: string;
962
- readonly arguments: import("effect/Schema").Json;
963
- };
964
- };
965
- }) | (Omit<EventInput, "payload" | "type"> & {
966
- readonly type: "agent.turn.started";
967
- readonly payload: {
968
- readonly turn: number;
969
- };
970
- }) | (Omit<EventInput, "payload" | "type"> & {
971
- readonly type: "agent.turn.stopped";
972
- readonly payload: {};
973
- }) | (Omit<EventInput, "payload" | "type"> & {
974
- readonly type: "agent.turn.text_delta";
975
- readonly payload: {
976
- readonly turn: number;
977
- readonly delta: string;
1203
+ readonly type: string;
1204
+ readonly payload: import("effect/Schema").Json;
1205
+ };
978
1206
  };
979
1207
  })>;
980
1208
  }, {
@@ -1020,8 +1248,265 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1020
1248
  }[] | undefined;
1021
1249
  }[] | undefined;
1022
1250
  readonly input?: import("effect/Schema").Json | undefined;
1251
+ readonly structuredOutput?: import("effect/Schema").Json | undefined;
1252
+ readonly alreadyCompacted?: boolean | undefined;
1023
1253
  readonly consumedSteerMessageIds?: readonly string[] | undefined;
1024
1254
  }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1255
+ readonly type: "agent.context.compacted";
1256
+ readonly payload: {
1257
+ readonly turn: number;
1258
+ readonly originalCount: number;
1259
+ readonly compactedCount: number;
1260
+ readonly summary?: string | undefined;
1261
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
1262
+ readonly messages?: readonly {
1263
+ readonly role: "assistant" | "system" | "tool" | "user";
1264
+ readonly content: string;
1265
+ readonly toolCallId?: string | undefined;
1266
+ readonly name?: string | undefined;
1267
+ readonly toolCalls?: {
1268
+ readonly id: string;
1269
+ readonly name: string;
1270
+ readonly arguments: import("effect/Schema").Json;
1271
+ }[] | undefined;
1272
+ }[] | undefined;
1273
+ };
1274
+ }) | (Omit<EventInput, "payload" | "type"> & {
1275
+ readonly type: "agent.effects.requested";
1276
+ readonly payload: {
1277
+ readonly toolCallId: string;
1278
+ readonly effects: readonly ({
1279
+ readonly type: "runtime.spawn";
1280
+ readonly childThreadId: string;
1281
+ readonly kind: string;
1282
+ readonly definitionName: string;
1283
+ readonly definitionVersion: string;
1284
+ readonly input: import("effect/Schema").Json;
1285
+ } | {
1286
+ readonly type: "runtime.wait";
1287
+ readonly waitId: string;
1288
+ readonly on: {
1289
+ readonly type: string | readonly string[];
1290
+ readonly match?: import("effect/Schema").Json | undefined;
1291
+ } | {
1292
+ readonly timerAt: number;
1293
+ };
1294
+ readonly tag?: import("effect/Schema").Json | undefined;
1295
+ } | {
1296
+ readonly type: "runtime.emit";
1297
+ readonly event: {
1298
+ readonly type: string;
1299
+ readonly payload: import("effect/Schema").Json;
1300
+ readonly threadId?: string | null | undefined;
1301
+ readonly parentThreadId?: string | null | undefined;
1302
+ readonly causationId?: string | null | undefined;
1303
+ readonly correlationId?: string | null | undefined;
1304
+ readonly effectId?: string | null | undefined;
1305
+ readonly origin?: {
1306
+ readonly type: "thread";
1307
+ readonly threadId: string;
1308
+ } | {
1309
+ readonly type: "external";
1310
+ readonly actorId?: string | undefined;
1311
+ } | {
1312
+ readonly type: "system";
1313
+ } | {
1314
+ readonly type: "run";
1315
+ readonly runId: string;
1316
+ } | undefined;
1317
+ readonly ephemeral?: boolean | undefined;
1318
+ readonly id?: string | undefined;
1319
+ readonly ts?: number | undefined;
1320
+ readonly idempotencyKey?: string | null | undefined;
1321
+ };
1322
+ readonly tag?: string | undefined;
1323
+ } | {
1324
+ readonly type: "runtime.complete";
1325
+ readonly output: import("effect/Schema").Json;
1326
+ } | {
1327
+ readonly type: "runtime.fail";
1328
+ readonly error: string;
1329
+ } | {
1330
+ readonly type: "runtime.cancel";
1331
+ readonly threadId: string;
1332
+ readonly tag?: string | undefined;
1333
+ } | {
1334
+ readonly type: "runtime.launch";
1335
+ readonly runId: string;
1336
+ readonly kind: string;
1337
+ readonly definitionName: string;
1338
+ readonly definitionVersion: string;
1339
+ readonly input: import("effect/Schema").Json;
1340
+ readonly close: "terminate" | "wait";
1341
+ readonly tag?: string | undefined;
1342
+ } | {
1343
+ readonly type: "runtime.cancelRun";
1344
+ readonly runId: string;
1345
+ readonly tag?: string | undefined;
1346
+ } | {
1347
+ readonly type: string;
1348
+ readonly input: import("effect/Schema").Json;
1349
+ readonly tag?: string | undefined;
1350
+ readonly at?: number | undefined;
1351
+ })[];
1352
+ readonly waitOn?: {
1353
+ readonly type: string | readonly string[];
1354
+ readonly match?: import("effect/Schema").Json | undefined;
1355
+ } | undefined;
1356
+ };
1357
+ }) | (Omit<EventInput, "payload" | "type"> & {
1358
+ readonly type: "agent.lineage";
1359
+ readonly payload: {
1360
+ readonly depth: number;
1361
+ };
1362
+ }) | (Omit<EventInput, "payload" | "type"> & {
1363
+ readonly type: "agent.message";
1364
+ readonly payload: {
1365
+ readonly turn: number;
1366
+ readonly message: {
1367
+ readonly role: "assistant" | "system" | "tool" | "user";
1368
+ readonly content: string;
1369
+ readonly toolCallId?: string | undefined;
1370
+ readonly name?: string | undefined;
1371
+ readonly toolCalls?: {
1372
+ readonly id: string;
1373
+ readonly name: string;
1374
+ readonly arguments: import("effect/Schema").Json;
1375
+ }[] | undefined;
1376
+ };
1377
+ readonly usage?: {
1378
+ readonly input: number;
1379
+ readonly output: number;
1380
+ } | undefined;
1381
+ };
1382
+ }) | (Omit<EventInput, "payload" | "type"> & {
1383
+ readonly type: "agent.message.received";
1384
+ readonly payload: {
1385
+ readonly message: {
1386
+ readonly role: "assistant" | "system" | "tool" | "user";
1387
+ readonly content: string;
1388
+ readonly toolCallId?: string | undefined;
1389
+ readonly name?: string | undefined;
1390
+ readonly toolCalls?: {
1391
+ readonly id: string;
1392
+ readonly name: string;
1393
+ readonly arguments: import("effect/Schema").Json;
1394
+ }[] | undefined;
1395
+ };
1396
+ };
1397
+ }) | (Omit<EventInput, "payload" | "type"> & {
1398
+ readonly type: "agent.session.cancel.requested";
1399
+ readonly payload: {};
1400
+ }) | (Omit<EventInput, "payload" | "type"> & {
1401
+ readonly type: "agent.session.message.submitted";
1402
+ readonly payload: {
1403
+ readonly messageId: string;
1404
+ readonly text: string;
1405
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1406
+ readonly activeChildThreadId?: string | undefined;
1407
+ };
1408
+ }) | (Omit<EventInput, "payload" | "type"> & {
1409
+ readonly type: "agent.session.steer.delivered";
1410
+ readonly payload: {
1411
+ readonly messageId: string;
1412
+ readonly activeMessageId: string;
1413
+ };
1414
+ }) | (Omit<EventInput, "payload" | "type"> & {
1415
+ readonly type: "agent.session.turn.closed";
1416
+ readonly payload: {
1417
+ readonly messageId: string;
1418
+ readonly status: "cancelled" | "completed" | "failed";
1419
+ readonly error?: string | undefined;
1420
+ };
1421
+ }) | (Omit<EventInput, "payload" | "type"> & {
1422
+ readonly type: "agent.session.turn.started";
1423
+ readonly payload: {
1424
+ readonly messageId: string;
1425
+ readonly childThreadId: string;
1426
+ };
1427
+ }) | (Omit<EventInput, "payload" | "type"> & {
1428
+ readonly type: "agent.spawn.requested";
1429
+ readonly payload: {
1430
+ readonly childThreadId: string;
1431
+ readonly kind: string;
1432
+ readonly definitionName: string;
1433
+ readonly definitionVersion: string;
1434
+ readonly toolCallId: string;
1435
+ readonly input: import("effect/Schema").Json;
1436
+ readonly depth?: number | undefined;
1437
+ };
1438
+ }) | (Omit<EventInput, "payload" | "type"> & {
1439
+ readonly type: "agent.steered";
1440
+ readonly payload: {
1441
+ readonly turn: number;
1442
+ readonly messageId?: string | undefined;
1443
+ readonly message: {
1444
+ readonly role: "assistant" | "system" | "tool" | "user";
1445
+ readonly content: string;
1446
+ readonly toolCallId?: string | undefined;
1447
+ readonly name?: string | undefined;
1448
+ readonly toolCalls?: {
1449
+ readonly id: string;
1450
+ readonly name: string;
1451
+ readonly arguments: import("effect/Schema").Json;
1452
+ }[] | undefined;
1453
+ };
1454
+ readonly interrupt?: boolean | undefined;
1455
+ };
1456
+ }) | (Omit<EventInput, "payload" | "type"> & {
1457
+ readonly type: "agent.tool.result";
1458
+ readonly payload: {
1459
+ readonly turn: number;
1460
+ readonly toolCallId: string;
1461
+ readonly name: string;
1462
+ readonly result: import("effect/Schema").Json;
1463
+ readonly error: string | null;
1464
+ };
1465
+ }) | (Omit<EventInput, "payload" | "type"> & {
1466
+ readonly type: "agent.tool_call.requested";
1467
+ readonly payload: {
1468
+ readonly turn: number;
1469
+ readonly toolCall: {
1470
+ readonly id: string;
1471
+ readonly name: string;
1472
+ readonly arguments: import("effect/Schema").Json;
1473
+ };
1474
+ };
1475
+ }) | (Omit<EventInput, "payload" | "type"> & {
1476
+ readonly type: "agent.turn.started";
1477
+ readonly payload: {
1478
+ readonly turn: number;
1479
+ };
1480
+ }) | (Omit<EventInput, "payload" | "type"> & {
1481
+ readonly type: "agent.turn.stopped";
1482
+ readonly payload: {};
1483
+ }) | (Omit<EventInput, "payload" | "type"> & {
1484
+ readonly type: "agent.turn.text_delta";
1485
+ readonly payload: {
1486
+ readonly turn: number;
1487
+ readonly delta: string;
1488
+ };
1489
+ }) | (Omit<EventInput, "payload" | "type"> & {
1490
+ readonly type: "agent.turn.usage";
1491
+ readonly payload: {
1492
+ readonly turn: number;
1493
+ readonly input: number;
1494
+ readonly output: number;
1495
+ };
1496
+ }) | (Omit<EventInput, "payload" | "type"> & {
1497
+ readonly type: "runtime.child.close.requested";
1498
+ readonly payload: {
1499
+ readonly policy: "terminate" | "wait";
1500
+ };
1501
+ }) | (Omit<EventInput, "payload" | "type"> & {
1502
+ readonly type: "runtime.child.settled";
1503
+ readonly payload: {
1504
+ readonly runId: string;
1505
+ readonly status: "cancelled" | "completed" | "failed";
1506
+ readonly output: import("effect/Schema").Json;
1507
+ readonly error: string | null;
1508
+ };
1509
+ }) | (Omit<EventInput, "payload" | "type"> & {
1025
1510
  readonly type: "runtime.effect.ambiguous";
1026
1511
  readonly payload: {
1027
1512
  readonly effectId: string;
@@ -1065,6 +1550,8 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1065
1550
  readonly payload: {
1066
1551
  readonly effectId: string;
1067
1552
  readonly error: string;
1553
+ readonly nonRetryable?: boolean | undefined;
1554
+ readonly retryAfterMs?: number | undefined;
1068
1555
  };
1069
1556
  }) | (Omit<EventInput, "payload" | "type"> & {
1070
1557
  readonly type: "runtime.effect.heartbeat";
@@ -1073,6 +1560,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1073
1560
  readonly attempt: number;
1074
1561
  readonly heartbeatAt: number;
1075
1562
  readonly deadlineAt: number | null;
1563
+ readonly details?: import("effect/Schema").Json | undefined;
1076
1564
  };
1077
1565
  }) | (Omit<EventInput, "payload" | "type"> & {
1078
1566
  readonly type: "runtime.effect.queued";
@@ -1125,6 +1613,16 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1125
1613
  readonly sourceRunId: string;
1126
1614
  readonly sourceSeq: number;
1127
1615
  };
1616
+ }) | (Omit<EventInput, "payload" | "type"> & {
1617
+ readonly type: "runtime.run.launched";
1618
+ readonly payload: {
1619
+ readonly runId: string;
1620
+ readonly kind: string;
1621
+ readonly definitionName: string;
1622
+ readonly definitionVersion: string;
1623
+ readonly effectId: string;
1624
+ readonly close: "terminate" | "wait";
1625
+ };
1128
1626
  }) | (Omit<EventInput, "payload" | "type"> & {
1129
1627
  readonly type: "runtime.run.started";
1130
1628
  readonly payload: {
@@ -1134,6 +1632,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1134
1632
  readonly definitionVersion: string;
1135
1633
  readonly input: import("effect/Schema").Json;
1136
1634
  readonly requestedThreadId?: string | null | undefined;
1635
+ readonly launchedBy?: {
1636
+ readonly runId: string;
1637
+ readonly threadId: string;
1638
+ readonly effectId: string;
1639
+ readonly causationId: string;
1640
+ readonly causationSeq: number;
1641
+ } | undefined;
1642
+ readonly attributes?: {
1643
+ readonly [x: string]: string;
1644
+ } | undefined;
1645
+ readonly trace?: {
1646
+ readonly traceparent: string;
1647
+ readonly tracestate?: string | undefined;
1648
+ } | undefined;
1137
1649
  };
1138
1650
  }) | (Omit<EventInput, "payload" | "type"> & {
1139
1651
  readonly type: "runtime.signal.received";
@@ -1218,6 +1730,38 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1218
1730
  readonly payload: import("effect/Schema").Json;
1219
1731
  };
1220
1732
  };
1733
+ })>;
1734
+ executeTool: import("@swirls/looms/core").EffectDefinition<{
1735
+ readonly turn: number;
1736
+ readonly definitionName?: string | undefined;
1737
+ readonly definitionVersion: string;
1738
+ readonly toolCall: {
1739
+ readonly id: string;
1740
+ readonly name: string;
1741
+ readonly arguments: import("effect/Schema").Json;
1742
+ };
1743
+ readonly input?: import("effect/Schema").Json | undefined;
1744
+ readonly depth?: number | undefined;
1745
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1746
+ readonly type: "agent.context.compacted";
1747
+ readonly payload: {
1748
+ readonly turn: number;
1749
+ readonly originalCount: number;
1750
+ readonly compactedCount: number;
1751
+ readonly summary?: string | undefined;
1752
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
1753
+ readonly messages?: readonly {
1754
+ readonly role: "assistant" | "system" | "tool" | "user";
1755
+ readonly content: string;
1756
+ readonly toolCallId?: string | undefined;
1757
+ readonly name?: string | undefined;
1758
+ readonly toolCalls?: {
1759
+ readonly id: string;
1760
+ readonly name: string;
1761
+ readonly arguments: import("effect/Schema").Json;
1762
+ }[] | undefined;
1763
+ }[] | undefined;
1764
+ };
1221
1765
  }) | (Omit<EventInput, "payload" | "type"> & {
1222
1766
  readonly type: "agent.effects.requested";
1223
1767
  readonly payload: {
@@ -1257,6 +1801,9 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1257
1801
  readonly actorId?: string | undefined;
1258
1802
  } | {
1259
1803
  readonly type: "system";
1804
+ } | {
1805
+ readonly type: "run";
1806
+ readonly runId: string;
1260
1807
  } | undefined;
1261
1808
  readonly ephemeral?: boolean | undefined;
1262
1809
  readonly id?: string | undefined;
@@ -1274,16 +1821,35 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1274
1821
  readonly type: "runtime.cancel";
1275
1822
  readonly threadId: string;
1276
1823
  readonly tag?: string | undefined;
1824
+ } | {
1825
+ readonly type: "runtime.launch";
1826
+ readonly runId: string;
1827
+ readonly kind: string;
1828
+ readonly definitionName: string;
1829
+ readonly definitionVersion: string;
1830
+ readonly input: import("effect/Schema").Json;
1831
+ readonly close: "terminate" | "wait";
1832
+ readonly tag?: string | undefined;
1833
+ } | {
1834
+ readonly type: "runtime.cancelRun";
1835
+ readonly runId: string;
1836
+ readonly tag?: string | undefined;
1277
1837
  } | {
1278
1838
  readonly type: string;
1279
1839
  readonly input: import("effect/Schema").Json;
1280
1840
  readonly tag?: string | undefined;
1841
+ readonly at?: number | undefined;
1281
1842
  })[];
1282
1843
  readonly waitOn?: {
1283
1844
  readonly type: string | readonly string[];
1284
1845
  readonly match?: import("effect/Schema").Json | undefined;
1285
1846
  } | undefined;
1286
1847
  };
1848
+ }) | (Omit<EventInput, "payload" | "type"> & {
1849
+ readonly type: "agent.lineage";
1850
+ readonly payload: {
1851
+ readonly depth: number;
1852
+ };
1287
1853
  }) | (Omit<EventInput, "payload" | "type"> & {
1288
1854
  readonly type: "agent.message";
1289
1855
  readonly payload: {
@@ -1358,6 +1924,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1358
1924
  readonly definitionVersion: string;
1359
1925
  readonly toolCallId: string;
1360
1926
  readonly input: import("effect/Schema").Json;
1927
+ readonly depth?: number | undefined;
1361
1928
  };
1362
1929
  }) | (Omit<EventInput, "payload" | "type"> & {
1363
1930
  readonly type: "agent.steered";
@@ -1410,17 +1977,27 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1410
1977
  readonly turn: number;
1411
1978
  readonly delta: string;
1412
1979
  };
1413
- })>;
1414
- executeTool: import("@swirls/looms/core").EffectDefinition<{
1415
- readonly turn: number;
1416
- readonly definitionName?: string | undefined;
1417
- readonly definitionVersion: string;
1418
- readonly toolCall: {
1419
- readonly id: string;
1420
- readonly name: string;
1421
- readonly arguments: import("effect/Schema").Json;
1980
+ }) | (Omit<EventInput, "payload" | "type"> & {
1981
+ readonly type: "agent.turn.usage";
1982
+ readonly payload: {
1983
+ readonly turn: number;
1984
+ readonly input: number;
1985
+ readonly output: number;
1422
1986
  };
1423
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1987
+ }) | (Omit<EventInput, "payload" | "type"> & {
1988
+ readonly type: "runtime.child.close.requested";
1989
+ readonly payload: {
1990
+ readonly policy: "terminate" | "wait";
1991
+ };
1992
+ }) | (Omit<EventInput, "payload" | "type"> & {
1993
+ readonly type: "runtime.child.settled";
1994
+ readonly payload: {
1995
+ readonly runId: string;
1996
+ readonly status: "cancelled" | "completed" | "failed";
1997
+ readonly output: import("effect/Schema").Json;
1998
+ readonly error: string | null;
1999
+ };
2000
+ }) | (Omit<EventInput, "payload" | "type"> & {
1424
2001
  readonly type: "runtime.effect.ambiguous";
1425
2002
  readonly payload: {
1426
2003
  readonly effectId: string;
@@ -1464,6 +2041,8 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1464
2041
  readonly payload: {
1465
2042
  readonly effectId: string;
1466
2043
  readonly error: string;
2044
+ readonly nonRetryable?: boolean | undefined;
2045
+ readonly retryAfterMs?: number | undefined;
1467
2046
  };
1468
2047
  }) | (Omit<EventInput, "payload" | "type"> & {
1469
2048
  readonly type: "runtime.effect.heartbeat";
@@ -1472,6 +2051,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1472
2051
  readonly attempt: number;
1473
2052
  readonly heartbeatAt: number;
1474
2053
  readonly deadlineAt: number | null;
2054
+ readonly details?: import("effect/Schema").Json | undefined;
1475
2055
  };
1476
2056
  }) | (Omit<EventInput, "payload" | "type"> & {
1477
2057
  readonly type: "runtime.effect.queued";
@@ -1524,6 +2104,16 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1524
2104
  readonly sourceRunId: string;
1525
2105
  readonly sourceSeq: number;
1526
2106
  };
2107
+ }) | (Omit<EventInput, "payload" | "type"> & {
2108
+ readonly type: "runtime.run.launched";
2109
+ readonly payload: {
2110
+ readonly runId: string;
2111
+ readonly kind: string;
2112
+ readonly definitionName: string;
2113
+ readonly definitionVersion: string;
2114
+ readonly effectId: string;
2115
+ readonly close: "terminate" | "wait";
2116
+ };
1527
2117
  }) | (Omit<EventInput, "payload" | "type"> & {
1528
2118
  readonly type: "runtime.run.started";
1529
2119
  readonly payload: {
@@ -1533,6 +2123,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1533
2123
  readonly definitionVersion: string;
1534
2124
  readonly input: import("effect/Schema").Json;
1535
2125
  readonly requestedThreadId?: string | null | undefined;
2126
+ readonly launchedBy?: {
2127
+ readonly runId: string;
2128
+ readonly threadId: string;
2129
+ readonly effectId: string;
2130
+ readonly causationId: string;
2131
+ readonly causationSeq: number;
2132
+ } | undefined;
2133
+ readonly attributes?: {
2134
+ readonly [x: string]: string;
2135
+ } | undefined;
2136
+ readonly trace?: {
2137
+ readonly traceparent: string;
2138
+ readonly tracestate?: string | undefined;
2139
+ } | undefined;
1536
2140
  };
1537
2141
  }) | (Omit<EventInput, "payload" | "type"> & {
1538
2142
  readonly type: "runtime.signal.received";
@@ -1617,198 +2221,6 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1617
2221
  readonly payload: import("effect/Schema").Json;
1618
2222
  };
1619
2223
  };
1620
- }) | (Omit<EventInput, "payload" | "type"> & {
1621
- readonly type: "agent.effects.requested";
1622
- readonly payload: {
1623
- readonly toolCallId: string;
1624
- readonly effects: readonly ({
1625
- readonly type: "runtime.spawn";
1626
- readonly childThreadId: string;
1627
- readonly kind: string;
1628
- readonly definitionName: string;
1629
- readonly definitionVersion: string;
1630
- readonly input: import("effect/Schema").Json;
1631
- } | {
1632
- readonly type: "runtime.wait";
1633
- readonly waitId: string;
1634
- readonly on: {
1635
- readonly type: string | readonly string[];
1636
- readonly match?: import("effect/Schema").Json | undefined;
1637
- } | {
1638
- readonly timerAt: number;
1639
- };
1640
- readonly tag?: import("effect/Schema").Json | undefined;
1641
- } | {
1642
- readonly type: "runtime.emit";
1643
- readonly event: {
1644
- readonly type: string;
1645
- readonly payload: import("effect/Schema").Json;
1646
- readonly threadId?: string | null | undefined;
1647
- readonly parentThreadId?: string | null | undefined;
1648
- readonly causationId?: string | null | undefined;
1649
- readonly correlationId?: string | null | undefined;
1650
- readonly effectId?: string | null | undefined;
1651
- readonly origin?: {
1652
- readonly type: "thread";
1653
- readonly threadId: string;
1654
- } | {
1655
- readonly type: "external";
1656
- readonly actorId?: string | undefined;
1657
- } | {
1658
- readonly type: "system";
1659
- } | undefined;
1660
- readonly ephemeral?: boolean | undefined;
1661
- readonly id?: string | undefined;
1662
- readonly ts?: number | undefined;
1663
- readonly idempotencyKey?: string | null | undefined;
1664
- };
1665
- readonly tag?: string | undefined;
1666
- } | {
1667
- readonly type: "runtime.complete";
1668
- readonly output: import("effect/Schema").Json;
1669
- } | {
1670
- readonly type: "runtime.fail";
1671
- readonly error: string;
1672
- } | {
1673
- readonly type: "runtime.cancel";
1674
- readonly threadId: string;
1675
- readonly tag?: string | undefined;
1676
- } | {
1677
- readonly type: string;
1678
- readonly input: import("effect/Schema").Json;
1679
- readonly tag?: string | undefined;
1680
- })[];
1681
- readonly waitOn?: {
1682
- readonly type: string | readonly string[];
1683
- readonly match?: import("effect/Schema").Json | undefined;
1684
- } | undefined;
1685
- };
1686
- }) | (Omit<EventInput, "payload" | "type"> & {
1687
- readonly type: "agent.message";
1688
- readonly payload: {
1689
- readonly turn: number;
1690
- readonly message: {
1691
- readonly role: "assistant" | "system" | "tool" | "user";
1692
- readonly content: string;
1693
- readonly toolCallId?: string | undefined;
1694
- readonly name?: string | undefined;
1695
- readonly toolCalls?: {
1696
- readonly id: string;
1697
- readonly name: string;
1698
- readonly arguments: import("effect/Schema").Json;
1699
- }[] | undefined;
1700
- };
1701
- readonly usage?: {
1702
- readonly input: number;
1703
- readonly output: number;
1704
- } | undefined;
1705
- };
1706
- }) | (Omit<EventInput, "payload" | "type"> & {
1707
- readonly type: "agent.message.received";
1708
- readonly payload: {
1709
- readonly message: {
1710
- readonly role: "assistant" | "system" | "tool" | "user";
1711
- readonly content: string;
1712
- readonly toolCallId?: string | undefined;
1713
- readonly name?: string | undefined;
1714
- readonly toolCalls?: {
1715
- readonly id: string;
1716
- readonly name: string;
1717
- readonly arguments: import("effect/Schema").Json;
1718
- }[] | undefined;
1719
- };
1720
- };
1721
- }) | (Omit<EventInput, "payload" | "type"> & {
1722
- readonly type: "agent.session.cancel.requested";
1723
- readonly payload: {};
1724
- }) | (Omit<EventInput, "payload" | "type"> & {
1725
- readonly type: "agent.session.message.submitted";
1726
- readonly payload: {
1727
- readonly messageId: string;
1728
- readonly text: string;
1729
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1730
- readonly activeChildThreadId?: string | undefined;
1731
- };
1732
- }) | (Omit<EventInput, "payload" | "type"> & {
1733
- readonly type: "agent.session.steer.delivered";
1734
- readonly payload: {
1735
- readonly messageId: string;
1736
- readonly activeMessageId: string;
1737
- };
1738
- }) | (Omit<EventInput, "payload" | "type"> & {
1739
- readonly type: "agent.session.turn.closed";
1740
- readonly payload: {
1741
- readonly messageId: string;
1742
- readonly status: "cancelled" | "completed" | "failed";
1743
- readonly error?: string | undefined;
1744
- };
1745
- }) | (Omit<EventInput, "payload" | "type"> & {
1746
- readonly type: "agent.session.turn.started";
1747
- readonly payload: {
1748
- readonly messageId: string;
1749
- readonly childThreadId: string;
1750
- };
1751
- }) | (Omit<EventInput, "payload" | "type"> & {
1752
- readonly type: "agent.spawn.requested";
1753
- readonly payload: {
1754
- readonly childThreadId: string;
1755
- readonly kind: string;
1756
- readonly definitionName: string;
1757
- readonly definitionVersion: string;
1758
- readonly toolCallId: string;
1759
- readonly input: import("effect/Schema").Json;
1760
- };
1761
- }) | (Omit<EventInput, "payload" | "type"> & {
1762
- readonly type: "agent.steered";
1763
- readonly payload: {
1764
- readonly turn: number;
1765
- readonly messageId?: string | undefined;
1766
- readonly message: {
1767
- readonly role: "assistant" | "system" | "tool" | "user";
1768
- readonly content: string;
1769
- readonly toolCallId?: string | undefined;
1770
- readonly name?: string | undefined;
1771
- readonly toolCalls?: {
1772
- readonly id: string;
1773
- readonly name: string;
1774
- readonly arguments: import("effect/Schema").Json;
1775
- }[] | undefined;
1776
- };
1777
- readonly interrupt?: boolean | undefined;
1778
- };
1779
- }) | (Omit<EventInput, "payload" | "type"> & {
1780
- readonly type: "agent.tool.result";
1781
- readonly payload: {
1782
- readonly turn: number;
1783
- readonly toolCallId: string;
1784
- readonly name: string;
1785
- readonly result: import("effect/Schema").Json;
1786
- readonly error: string | null;
1787
- };
1788
- }) | (Omit<EventInput, "payload" | "type"> & {
1789
- readonly type: "agent.tool_call.requested";
1790
- readonly payload: {
1791
- readonly turn: number;
1792
- readonly toolCall: {
1793
- readonly id: string;
1794
- readonly name: string;
1795
- readonly arguments: import("effect/Schema").Json;
1796
- };
1797
- };
1798
- }) | (Omit<EventInput, "payload" | "type"> & {
1799
- readonly type: "agent.turn.started";
1800
- readonly payload: {
1801
- readonly turn: number;
1802
- };
1803
- }) | (Omit<EventInput, "payload" | "type"> & {
1804
- readonly type: "agent.turn.stopped";
1805
- readonly payload: {};
1806
- }) | (Omit<EventInput, "payload" | "type"> & {
1807
- readonly type: "agent.turn.text_delta";
1808
- readonly payload: {
1809
- readonly turn: number;
1810
- readonly delta: string;
1811
- };
1812
2224
  })>;
1813
2225
  };
1814
2226
  readonly threads: {